use-scroll-animate 4.9.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +2 -1
- package/README_ja.md +1 -0
- package/README_zh.md +2 -1
- package/dist/chunks/{base-BvpQ4Ggj.cjs → base-B5i8qQPR.cjs} +46 -40
- package/dist/chunks/base-B5i8qQPR.cjs.map +1 -0
- package/dist/chunks/{base-DbbRUxaa.js → base-C3Sw9sAO.js} +46 -41
- package/dist/chunks/base-C3Sw9sAO.js.map +1 -0
- package/dist/chunks/{core-BWO7JKJ5.cjs → core-BDcszY4L.cjs} +2 -2
- package/dist/chunks/{core-BWO7JKJ5.cjs.map → core-BDcszY4L.cjs.map} +1 -1
- package/dist/chunks/{core-CcaSsbV8.js → core-BTf__I-8.js} +2 -2
- package/dist/chunks/{core-CcaSsbV8.js.map → core-BTf__I-8.js.map} +1 -1
- package/dist/chunks/{core-CCAM3nKw.cjs → core-BjOYKSrV.cjs} +2 -2
- package/dist/chunks/{core-CCAM3nKw.cjs.map → core-BjOYKSrV.cjs.map} +1 -1
- package/dist/chunks/{core-BVTuet9o.js → core-DN3hHbHh.js} +2 -2
- package/dist/chunks/{core-BVTuet9o.js.map → core-DN3hHbHh.js.map} +1 -1
- package/dist/chunks/fx-B8hk1Fby.cjs +114 -0
- package/dist/chunks/fx-B8hk1Fby.cjs.map +1 -0
- package/dist/chunks/fx-ChjxrMBo.js +109 -0
- package/dist/chunks/fx-ChjxrMBo.js.map +1 -0
- package/dist/chunks/{index-tags-Dh8nwXqw.js → index-tags-DucKMQr_.js} +2 -1
- package/dist/chunks/{index-tags-Dh8nwXqw.js.map → index-tags-DucKMQr_.js.map} +1 -1
- package/dist/chunks/{index-tags-CIRY2KnU.cjs → index-tags-wv0R_vkO.cjs} +2 -1
- package/dist/chunks/{index-tags-CIRY2KnU.cjs.map → index-tags-wv0R_vkO.cjs.map} +1 -1
- package/dist/chunks/{spring-fFkqE9J0.cjs → spring--oZh55tB.cjs} +2 -2
- package/dist/chunks/{spring-fFkqE9J0.cjs.map → spring--oZh55tB.cjs.map} +1 -1
- package/dist/chunks/{spring-B6w7mVCU.js → spring-CckMe3x0.js} +2 -2
- package/dist/chunks/{spring-B6w7mVCU.js.map → spring-CckMe3x0.js.map} +1 -1
- package/dist/chunks/{variants-Cal4DB0E.js → variants-Bsevy6Xm.js} +2 -2
- package/dist/chunks/{variants-Cal4DB0E.js.map → variants-Bsevy6Xm.js.map} +1 -1
- package/dist/chunks/{variants-C8xj8gfd.cjs → variants-DxPmgrNX.cjs} +2 -2
- package/dist/chunks/{variants-C8xj8gfd.cjs.map → variants-DxPmgrNX.cjs.map} +1 -1
- package/dist/components/a11y.cjs +3 -2
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +1 -0
- package/dist/components/a11y.d.ts +1 -0
- package/dist/components/a11y.js +4 -3
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +8 -6
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +33 -4
- package/dist/components/angular.d.ts +33 -4
- package/dist/components/angular.js +8 -6
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +2 -4
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.d.cts +2 -47
- package/dist/components/background.d.ts +2 -47
- package/dist/components/background.js +3 -4
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs +1 -1
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.cjs +2 -4
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.d.cts +2 -47
- package/dist/components/cards.d.ts +2 -47
- package/dist/components/cards.js +2 -3
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs +24 -130
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.d.cts +2 -47
- package/dist/components/click.d.ts +2 -47
- package/dist/components/click.js +4 -109
- package/dist/components/click.js.map +1 -1
- package/dist/components/depth.cjs +3 -5
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.d.cts +2 -47
- package/dist/components/depth.d.ts +2 -47
- package/dist/components/depth.js +3 -4
- package/dist/components/depth.js.map +1 -1
- package/dist/components/effects.cjs +265 -0
- package/dist/components/effects.cjs.map +1 -0
- package/dist/components/effects.d.cts +66 -0
- package/dist/components/effects.d.ts +66 -0
- package/dist/components/effects.js +258 -0
- package/dist/components/effects.js.map +1 -0
- package/dist/components/feedback.cjs +1 -3
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.d.cts +2 -47
- package/dist/components/feedback.d.ts +2 -47
- package/dist/components/feedback.js +1 -2
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx.cjs +289 -0
- package/dist/components/fx.cjs.map +1 -0
- package/dist/components/fx.css +3 -0
- package/dist/components/fx.d.cts +114 -0
- package/dist/components/fx.d.ts +114 -0
- package/dist/components/fx.js +275 -0
- package/dist/components/fx.js.map +1 -0
- package/dist/components/gesture.cjs +3 -5
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.d.cts +2 -47
- package/dist/components/gesture.d.ts +2 -47
- package/dist/components/gesture.js +4 -5
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs +1 -3
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.d.cts +2 -47
- package/dist/components/interaction.d.ts +2 -47
- package/dist/components/interaction.js +1 -2
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/jsx.d.cts +1 -0
- package/dist/components/jsx.d.ts +1 -0
- package/dist/components/layout.cjs +1 -3
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.d.cts +2 -47
- package/dist/components/layout.d.ts +2 -47
- package/dist/components/layout.js +2 -3
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs +2 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +1 -0
- package/dist/components/lazy.d.ts +1 -0
- package/dist/components/lazy.js +2 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs +366 -64
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +349 -65
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +1 -3
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.d.cts +2 -47
- package/dist/components/packs.d.ts +2 -47
- package/dist/components/packs.js +2 -3
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs +33 -22
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.d.cts +15 -52
- package/dist/components/page.d.ts +15 -52
- package/dist/components/page.js +33 -22
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +3 -4
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.d.cts +1 -0
- package/dist/components/perf.d.ts +1 -0
- package/dist/components/perf.js +4 -5
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs +2 -4
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.d.cts +2 -47
- package/dist/components/physics.d.ts +2 -47
- package/dist/components/physics.js +3 -4
- package/dist/components/physics.js.map +1 -1
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.cjs +1 -3
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.d.cts +2 -47
- package/dist/components/reveal.d.ts +2 -47
- package/dist/components/reveal.js +1 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +8 -6
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +33 -4
- package/dist/components/solid.d.ts +33 -4
- package/dist/components/solid.js +8 -6
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +8 -6
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +33 -4
- package/dist/components/svelte.d.ts +33 -4
- package/dist/components/svelte.js +8 -6
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +1 -3
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.d.cts +2 -47
- package/dist/components/svg.d.ts +2 -47
- package/dist/components/svg.js +2 -3
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +2 -4
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.d.cts +2 -47
- package/dist/components/text.d.ts +2 -47
- package/dist/components/text.js +2 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +3 -7
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.d.cts +4 -49
- package/dist/components/timeline.d.ts +4 -49
- package/dist/components/timeline.js +4 -7
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/transitions.cjs +1 -3
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.d.cts +2 -47
- package/dist/components/transitions.d.ts +2 -47
- package/dist/components/transitions.js +2 -3
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +3 -5
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.d.cts +2 -47
- package/dist/components/ui.d.ts +2 -47
- package/dist/components/ui.js +4 -5
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs +8 -6
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +33 -4
- package/dist/components/vue.d.ts +33 -4
- package/dist/components/vue.js +8 -6
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +3 -5
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.d.cts +2 -47
- package/dist/components/webgl.d.ts +2 -47
- package/dist/components/webgl.js +3 -4
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +31 -10
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -0
- package/dist/components.d.cts +137 -17
- package/dist/components.d.ts +137 -17
- package/dist/components.js +15 -11
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/docs/API.md +1 -1
- package/docs/ROADMAP.md +12 -12
- package/docs/components.md +29 -1
- package/docs/performance.md +1 -1
- package/docs/upgrading-5.md +2 -2
- package/package.json +24 -3
- package/dist/chunks/base-BvpQ4Ggj.cjs.map +0 -1
- package/dist/chunks/base-DbbRUxaa.js.map +0 -1
package/dist/components/lazy.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var indexTags = require('../chunks/index-tags-
|
|
3
|
+
var indexTags = require('../chunks/index-tags-wv0R_vkO.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
|
|
@@ -34,6 +34,7 @@ const LOADERS = {
|
|
|
34
34
|
depth: () => Promise.resolve().then(function () { return require('./depth.cjs'); }),
|
|
35
35
|
layout: () => Promise.resolve().then(function () { return require('./layout.cjs'); }),
|
|
36
36
|
packs: () => Promise.resolve().then(function () { return require('./packs.cjs'); }),
|
|
37
|
+
fx: () => Promise.resolve().then(function () { return require('./fx.cjs'); }),
|
|
37
38
|
};
|
|
38
39
|
const TAG_TO_CAT = new Map();
|
|
39
40
|
for (const [cat, tags] of Object.entries(indexTags.COMPONENT_CATEGORIES))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":["COMPONENT_CATEGORIES"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,oDAAO,kBAAoB,KAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,EAAE,EAAE,MAAM,oDAAO,UAAY,KAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,GAAG,EAAE,MAAM,oDAAO,WAAa,KAAC;AAChC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;
|
|
1
|
+
{"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n fx: () => import('./fx/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":["COMPONENT_CATEGORIES"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,oDAAO,kBAAoB,KAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,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,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;;;;"}
|
|
@@ -18,6 +18,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
18
18
|
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
19
19
|
readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
|
|
20
20
|
readonly packs: readonly ["usa-pack"];
|
|
21
|
+
readonly fx: readonly ["usa-fx"];
|
|
21
22
|
};
|
|
22
23
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
23
24
|
|
|
@@ -18,6 +18,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
18
18
|
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
19
19
|
readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
|
|
20
20
|
readonly packs: readonly ["usa-pack"];
|
|
21
|
+
readonly fx: readonly ["usa-fx"];
|
|
21
22
|
};
|
|
22
23
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
23
24
|
|
package/dist/components/lazy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-
|
|
1
|
+
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-DucKMQr_.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
|
|
@@ -32,6 +32,7 @@ const LOADERS = {
|
|
|
32
32
|
depth: () => import('./depth.js'),
|
|
33
33
|
layout: () => import('./layout.js'),
|
|
34
34
|
packs: () => import('./packs.js'),
|
|
35
|
+
fx: () => import('./fx.js'),
|
|
35
36
|
};
|
|
36
37
|
const TAG_TO_CAT = new Map();
|
|
37
38
|
for (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,OAAO,aAAgB,CAAC;AACtC,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,OAAO,iBAAoB,CAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,EAAE,EAAE,MAAM,OAAO,SAAY,CAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,GAAG,EAAE,MAAM,OAAO,UAAa,CAAC;AAChC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,MAAM,EAAE,MAAM,OAAO,aAAgB,CAAC;AACtC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n fx: () => import('./fx/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();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