main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel';
export type EmblaViewportRefType = <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void;
export type UseEmblaCarouselType = [
EmblaViewportRefType,
EmblaCarouselType | undefined
];
declare function useEmblaCarousel(options?: EmblaOptionsType, plugins?: EmblaPluginType[]): UseEmblaCarouselType;
declare namespace useEmblaCarousel {
let globalOptions: EmblaOptionsType | undefined;
}
export default useEmblaCarousel;

View File

@@ -0,0 +1,40 @@
'use strict';
var react = require('react');
var emblaCarouselReactiveUtils = require('embla-carousel-reactive-utils');
var EmblaCarousel = require('embla-carousel');
function useEmblaCarousel(options = {}, plugins = []) {
const storedOptions = react.useRef(options);
const storedPlugins = react.useRef(plugins);
const [emblaApi, setEmblaApi] = react.useState();
const [viewport, setViewport] = react.useState();
const reInit = react.useCallback(() => {
if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current);
}, [emblaApi]);
react.useEffect(() => {
if (emblaCarouselReactiveUtils.areOptionsEqual(storedOptions.current, options)) return;
storedOptions.current = options;
reInit();
}, [options, reInit]);
react.useEffect(() => {
if (emblaCarouselReactiveUtils.arePluginsEqual(storedPlugins.current, plugins)) return;
storedPlugins.current = plugins;
reInit();
}, [plugins, reInit]);
react.useEffect(() => {
if (emblaCarouselReactiveUtils.canUseDOM() && viewport) {
EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions;
const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current);
setEmblaApi(newEmblaApi);
return () => newEmblaApi.destroy();
} else {
setEmblaApi(undefined);
}
}, [viewport, setEmblaApi]);
return [setViewport, emblaApi];
}
useEmblaCarousel.globalOptions = undefined;
module.exports = useEmblaCarousel;
//# sourceMappingURL=embla-carousel-react.cjs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"embla-carousel-react.cjs.js","sources":["../src/components/useEmblaCarousel.ts"],"sourcesContent":["import { useRef, useEffect, useState, useCallback } from 'react'\nimport {\n areOptionsEqual,\n arePluginsEqual,\n canUseDOM\n} from 'embla-carousel-reactive-utils'\nimport EmblaCarousel, {\n EmblaCarouselType,\n EmblaOptionsType,\n EmblaPluginType\n} from 'embla-carousel'\n\nexport type EmblaViewportRefType = <ViewportElement extends HTMLElement>(\n instance: ViewportElement | null\n) => void\n\nexport type UseEmblaCarouselType = [\n EmblaViewportRefType,\n EmblaCarouselType | undefined\n]\n\nfunction useEmblaCarousel(\n options: EmblaOptionsType = {},\n plugins: EmblaPluginType[] = []\n): UseEmblaCarouselType {\n const storedOptions = useRef(options)\n const storedPlugins = useRef(plugins)\n const [emblaApi, setEmblaApi] = useState<EmblaCarouselType>()\n const [viewport, setViewport] = useState<HTMLElement>()\n\n const reInit = useCallback(() => {\n if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current)\n }, [emblaApi])\n\n useEffect(() => {\n if (areOptionsEqual(storedOptions.current, options)) return\n storedOptions.current = options\n reInit()\n }, [options, reInit])\n\n useEffect(() => {\n if (arePluginsEqual(storedPlugins.current, plugins)) return\n storedPlugins.current = plugins\n reInit()\n }, [plugins, reInit])\n\n useEffect(() => {\n if (canUseDOM() && viewport) {\n EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions\n const newEmblaApi = EmblaCarousel(\n viewport,\n storedOptions.current,\n storedPlugins.current\n )\n setEmblaApi(newEmblaApi)\n return () => newEmblaApi.destroy()\n } else {\n setEmblaApi(undefined)\n }\n }, [viewport, setEmblaApi])\n\n return [<EmblaViewportRefType>setViewport, emblaApi]\n}\n\ndeclare namespace useEmblaCarousel {\n let globalOptions: EmblaOptionsType | undefined\n}\n\nuseEmblaCarousel.globalOptions = undefined\n\nexport default useEmblaCarousel\n"],"names":["useEmblaCarousel","options","plugins","storedOptions","useRef","storedPlugins","emblaApi","setEmblaApi","useState","viewport","setViewport","reInit","useCallback","current","useEffect","areOptionsEqual","arePluginsEqual","canUseDOM","EmblaCarousel","globalOptions","newEmblaApi","destroy","undefined"],"mappings":";;;;;;AAqBA,SAASA,gBAAgBA,CACvBC,OAAA,GAA4B,EAAE,EAC9BC,UAA6B,EAAE,EAAA;AAE/B,EAAA,MAAMC,aAAa,GAAGC,YAAM,CAACH,OAAO,CAAC,CAAA;AACrC,EAAA,MAAMI,aAAa,GAAGD,YAAM,CAACF,OAAO,CAAC,CAAA;EACrC,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGC,cAAQ,EAAqB,CAAA;EAC7D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGF,cAAQ,EAAe,CAAA;AAEvD,EAAA,MAAMG,MAAM,GAAGC,iBAAW,CAAC,MAAK;AAC9B,IAAA,IAAIN,QAAQ,EAAEA,QAAQ,CAACK,MAAM,CAACR,aAAa,CAACU,OAAO,EAAER,aAAa,CAACQ,OAAO,CAAC,CAAA;AAC7E,GAAC,EAAE,CAACP,QAAQ,CAAC,CAAC,CAAA;AAEdQ,EAAAA,eAAS,CAAC,MAAK;IACb,IAAIC,0CAAe,CAACZ,aAAa,CAACU,OAAO,EAAEZ,OAAO,CAAC,EAAE,OAAA;IACrDE,aAAa,CAACU,OAAO,GAAGZ,OAAO,CAAA;AAC/BU,IAAAA,MAAM,EAAE,CAAA;AACV,GAAC,EAAE,CAACV,OAAO,EAAEU,MAAM,CAAC,CAAC,CAAA;AAErBG,EAAAA,eAAS,CAAC,MAAK;IACb,IAAIE,0CAAe,CAACX,aAAa,CAACQ,OAAO,EAAEX,OAAO,CAAC,EAAE,OAAA;IACrDG,aAAa,CAACQ,OAAO,GAAGX,OAAO,CAAA;AAC/BS,IAAAA,MAAM,EAAE,CAAA;AACV,GAAC,EAAE,CAACT,OAAO,EAAES,MAAM,CAAC,CAAC,CAAA;AAErBG,EAAAA,eAAS,CAAC,MAAK;AACb,IAAA,IAAIG,oCAAS,EAAE,IAAIR,QAAQ,EAAE;AAC3BS,MAAAA,aAAa,CAACC,aAAa,GAAGnB,gBAAgB,CAACmB,aAAa,CAAA;AAC5D,MAAA,MAAMC,WAAW,GAAGF,aAAa,CAC/BT,QAAQ,EACRN,aAAa,CAACU,OAAO,EACrBR,aAAa,CAACQ,OAAO,CACtB,CAAA;MACDN,WAAW,CAACa,WAAW,CAAC,CAAA;AACxB,MAAA,OAAO,MAAMA,WAAW,CAACC,OAAO,EAAE,CAAA;AACpC,KAAC,MAAM;MACLd,WAAW,CAACe,SAAS,CAAC,CAAA;AACxB,KAAA;AACF,GAAC,EAAE,CAACb,QAAQ,EAAEF,WAAW,CAAC,CAAC,CAAA;AAE3B,EAAA,OAAO,CAAuBG,WAAW,EAAEJ,QAAQ,CAAC,CAAA;AACtD,CAAA;AAMAN,gBAAgB,CAACmB,aAAa,GAAGG,SAAS;;;;"}

2
node_modules/embla-carousel-react/cjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { UseEmblaCarouselType, EmblaViewportRefType } from './components/useEmblaCarousel';
export { default } from './components/useEmblaCarousel';

60
node_modules/embla-carousel-react/cjs/package.json generated vendored Normal file
View File

@@ -0,0 +1,60 @@
{
"name": "embla-carousel-react",
"version": "8.3.0",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte",
"solid"
],
"types": "index.d.ts",
"sideEffects": false,
"files": [
"embla-carousel-react*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@types/react": "^18.0.8",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"dependencies": {
"embla-carousel": "8.3.0",
"embla-carousel-reactive-utils": "8.3.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.1 || ^18.0.0"
},
"main": "embla-carousel-react.cjs.js",
"type": "commonjs"
}