motionary 10.0.0 → 10.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +45 -0
  3. package/bin/create-motionary-plugin.mjs +124 -0
  4. package/dist/chunks/keyframes-CyH_abhI.js +183 -0
  5. package/dist/chunks/keyframes-CyH_abhI.js.map +1 -0
  6. package/dist/chunks/keyframes-cUdsXSXQ.cjs +187 -0
  7. package/dist/chunks/keyframes-cUdsXSXQ.cjs.map +1 -0
  8. package/dist/chunks/registry-C0xLNq3-.cjs +81 -0
  9. package/dist/chunks/registry-C0xLNq3-.cjs.map +1 -0
  10. package/dist/chunks/registry-jF8VIA_9.js +69 -0
  11. package/dist/chunks/registry-jF8VIA_9.js.map +1 -0
  12. package/dist/chunks/tween-DDObu9iA.js +542 -0
  13. package/dist/chunks/tween-DDObu9iA.js.map +1 -0
  14. package/dist/chunks/tween-JEthWrjo.cjs +554 -0
  15. package/dist/chunks/tween-JEthWrjo.cjs.map +1 -0
  16. package/dist/components/marketplace.cjs +104 -0
  17. package/dist/components/marketplace.cjs.map +1 -1
  18. package/dist/components/marketplace.d.cts +33 -2
  19. package/dist/components/marketplace.d.ts +33 -2
  20. package/dist/components/marketplace.js +101 -1
  21. package/dist/components/marketplace.js.map +1 -1
  22. package/dist/components/widgets.cjs +420 -199
  23. package/dist/components/widgets.cjs.map +1 -1
  24. package/dist/components/widgets.d.cts +42 -2
  25. package/dist/components/widgets.d.ts +42 -2
  26. package/dist/components/widgets.js +420 -201
  27. package/dist/components/widgets.js.map +1 -1
  28. package/dist/llms-full.txt +3018 -0
  29. package/dist/llms.txt +207 -0
  30. package/dist/manifest.json +7562 -0
  31. package/dist/manifest.schema.json +85 -0
  32. package/dist/runtime/format-css.cjs +184 -0
  33. package/dist/runtime/format-css.cjs.map +1 -0
  34. package/dist/runtime/format-css.d.cts +174 -0
  35. package/dist/runtime/format-css.d.ts +174 -0
  36. package/dist/runtime/format-css.iife.js +2 -0
  37. package/dist/runtime/format-css.iife.js.map +1 -0
  38. package/dist/runtime/format-css.js +176 -0
  39. package/dist/runtime/format-css.js.map +1 -0
  40. package/dist/runtime/format-motion.cjs +138 -0
  41. package/dist/runtime/format-motion.cjs.map +1 -0
  42. package/dist/runtime/format-motion.d.cts +208 -0
  43. package/dist/runtime/format-motion.d.ts +208 -0
  44. package/dist/runtime/format-motion.iife.js +2 -0
  45. package/dist/runtime/format-motion.iife.js.map +1 -0
  46. package/dist/runtime/format-motion.js +132 -0
  47. package/dist/runtime/format-motion.js.map +1 -0
  48. package/dist/runtime.cjs +78 -0
  49. package/dist/runtime.cjs.map +1 -0
  50. package/dist/runtime.d.cts +236 -0
  51. package/dist/runtime.d.ts +236 -0
  52. package/dist/runtime.iife.js +2 -0
  53. package/dist/runtime.iife.js.map +1 -0
  54. package/dist/runtime.js +54 -0
  55. package/dist/runtime.js.map +1 -0
  56. package/dist/widgets.umd.js +1 -1
  57. package/dist/widgets.umd.js.map +1 -1
  58. package/docs/ROADMAP.md +69 -38
  59. package/docs/components.md +55 -0
  60. package/docs/runtime/core.md +55 -0
  61. package/docs/runtime/format-css.md +59 -0
  62. package/docs/runtime/format-motion.md +56 -0
  63. package/package.json +48 -6
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Module registry shared by every copy of `motionary/runtime` on the page
5
+ * (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
6
+ * so a component never needs to import the runtime itself — it asks for a
7
+ * module with `requireModule()` and gets a clear error when it is missing.
8
+ * Nothing here touches `window` / `document`: safe to import during SSR and
9
+ * inside Web Workers.
10
+ */
11
+ /** Runtime version (kept in sync with the package version by the release script). */
12
+ const RUNTIME_VERSION = '10.1.0';
13
+ /** Where the CDN builds live (major-pinned). */
14
+ const RUNTIME_CDN = 'https://cdn.jsdelivr.net/npm/motionary@10/dist/';
15
+ const KEY = Symbol.for('motionary.runtime');
16
+ /** The page-wide registry (created on first use). */
17
+ function registry() {
18
+ const g = globalThis;
19
+ return (g[KEY] || (g[KEY] = { version: RUNTIME_VERSION, modules: new Map(), slots: {} }));
20
+ }
21
+ /** The import path of a module id. */
22
+ const modulePath = (id) => (id === 'core' ? 'motionary/runtime' : `motionary/runtime/${id}`);
23
+ /** The CDN IIFE file of a module id. */
24
+ const moduleCdn = (id) => RUNTIME_CDN + (id === 'core' ? 'runtime.iife.js' : `runtime/${id}.iife.js`);
25
+ /** The text of the "module missing" error (shared with the components). */
26
+ function missingMessage(id, who = 'This feature') {
27
+ const path = modulePath(id);
28
+ const reg = id === 'core' ? `import { use } from 'motionary/runtime'; use();` : `import { use } from 'motionary/runtime'; import { ${camel(id)} } from '${path}'; use(${camel(id)});`;
29
+ const cdn = id === 'core' ? `<script src="${moduleCdn('core')}"></script>` : `<script src="${moduleCdn('core')}"></script><script src="${moduleCdn(id)}"></script>`;
30
+ return `[motionary] ${who} requires ${path}. Install once: npm i motionary — then register it before the component mounts: ${reg} Or from a CDN (core first): ${cdn} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${id}.md`;
31
+ }
32
+ /** 'format-css' → 'formatCss' (the module object's export name). */
33
+ const camel = (id) => id.replace(/-(\w)/g, (_, c) => c.toUpperCase());
34
+ /** Thrown by `requireModule()` when a module is not registered. */
35
+ class RuntimeModuleError extends Error {
36
+ constructor(id, who) {
37
+ super(missingMessage(id, who));
38
+ this.name = 'RuntimeModuleError';
39
+ this.module = id;
40
+ }
41
+ }
42
+ /** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
43
+ function register(...mods) {
44
+ const r = registry();
45
+ for (const m of mods) {
46
+ if (!m || typeof m.id !== 'string')
47
+ throw new TypeError('[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>');
48
+ if (r.modules.has(m.id))
49
+ continue;
50
+ for (const dep of m.requires || [])
51
+ if (!r.modules.has(dep))
52
+ throw new RuntimeModuleError(dep, `motionary/runtime/${m.id}`);
53
+ r.modules.set(m.id, m);
54
+ m.setup?.(r);
55
+ }
56
+ return r;
57
+ }
58
+ /** Is a module registered? */
59
+ const hasModule = (id) => registry().modules.has(id);
60
+ /** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
61
+ function requireModule(id, who) {
62
+ const m = registry().modules.get(id);
63
+ if (!m)
64
+ throw new RuntimeModuleError(id, who);
65
+ return m.api;
66
+ }
67
+ /** Ids of the registered modules. */
68
+ const registeredModules = () => Array.from(registry().modules.keys());
69
+
70
+ exports.RUNTIME_CDN = RUNTIME_CDN;
71
+ exports.RUNTIME_VERSION = RUNTIME_VERSION;
72
+ exports.RuntimeModuleError = RuntimeModuleError;
73
+ exports.hasModule = hasModule;
74
+ exports.missingMessage = missingMessage;
75
+ exports.moduleCdn = moduleCdn;
76
+ exports.modulePath = modulePath;
77
+ exports.register = register;
78
+ exports.registeredModules = registeredModules;
79
+ exports.registry = registry;
80
+ exports.requireModule = requireModule;
81
+ //# sourceMappingURL=registry-C0xLNq3-.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-C0xLNq3-.cjs","sources":["../../src/runtime/registry.ts"],"sourcesContent":["/**\n * Module registry shared by every copy of `motionary/runtime` on the page\n * (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),\n * so a component never needs to import the runtime itself — it asks for a\n * module with `requireModule()` and gets a clear error when it is missing.\n * Nothing here touches `window` / `document`: safe to import during SSR and\n * inside Web Workers.\n */\n\n/** Runtime version (kept in sync with the package version by the release script). */\nexport const RUNTIME_VERSION = '10.1.0';\n\n/** Where the CDN builds live (major-pinned). */\nexport const RUNTIME_CDN = 'https://cdn.jsdelivr.net/npm/motionary@10/dist/';\n\n/** A runtime module: `{ id, version, api }`, registered with `use()`. */\nexport interface RuntimeModule<A = unknown> {\n /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */\n id: string;\n version: string;\n /** Other modules this one needs (registered first by `use()` callers). */\n requires?: string[];\n /** The module's public API (what `requireModule(id)` returns). */\n api: A;\n /** Optional one-time setup, called on first registration. */\n setup?(registry: RuntimeRegistry): void;\n}\n\nexport interface RuntimeRegistry {\n version: string;\n modules: Map<string, RuntimeModule>;\n /** Shared per-page state slots (the ticker lives here). */\n slots: Record<string, unknown>;\n}\n\nconst KEY = Symbol.for('motionary.runtime');\n\n/** The page-wide registry (created on first use). */\nexport function registry(): RuntimeRegistry {\n const g = globalThis as unknown as Record<symbol, RuntimeRegistry | undefined>;\n return (g[KEY] ||= { version: RUNTIME_VERSION, modules: new Map(), slots: {} });\n}\n\n/** The import path of a module id. */\nexport const modulePath = (id: string): string => (id === 'core' ? 'motionary/runtime' : `motionary/runtime/${id}`);\n\n/** The CDN IIFE file of a module id. */\nexport const moduleCdn = (id: string): string => RUNTIME_CDN + (id === 'core' ? 'runtime.iife.js' : `runtime/${id}.iife.js`);\n\n/** The text of the \"module missing\" error (shared with the components). */\nexport function missingMessage(id: string, who = 'This feature'): string {\n const path = modulePath(id);\n const reg = id === 'core' ? `import { use } from 'motionary/runtime'; use();` : `import { use } from 'motionary/runtime'; import { ${camel(id)} } from '${path}'; use(${camel(id)});`;\n const cdn = id === 'core' ? `<script src=\"${moduleCdn('core')}\"></script>` : `<script src=\"${moduleCdn('core')}\"></script><script src=\"${moduleCdn(id)}\"></script>`;\n return `[motionary] ${who} requires ${path}. Install once: npm i motionary — then register it before the component mounts: ${reg} Or from a CDN (core first): ${cdn} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${id}.md`;\n}\n\n/** 'format-css' → 'formatCss' (the module object's export name). */\nexport const camel = (id: string): string => id.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\n\n/** Thrown by `requireModule()` when a module is not registered. */\nexport class RuntimeModuleError extends Error {\n readonly module: string;\n constructor(id: string, who?: string) {\n super(missingMessage(id, who));\n this.name = 'RuntimeModuleError';\n this.module = id;\n }\n}\n\n/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */\nexport function register(...mods: RuntimeModule[]): RuntimeRegistry {\n const r = registry();\n for (const m of mods) {\n if (!m || typeof m.id !== 'string') throw new TypeError('[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>');\n if (r.modules.has(m.id)) continue;\n for (const dep of m.requires || []) if (!r.modules.has(dep)) throw new RuntimeModuleError(dep, `motionary/runtime/${m.id}`);\n r.modules.set(m.id, m as RuntimeModule);\n m.setup?.(r);\n }\n return r;\n}\n\n/** Is a module registered? */\nexport const hasModule = (id: string): boolean => registry().modules.has(id);\n\n/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */\nexport function requireModule<A = unknown>(id: string, who?: string): A {\n const m = registry().modules.get(id);\n if (!m) throw new RuntimeModuleError(id, who);\n return m.api as A;\n}\n\n/** Ids of the registered modules. */\nexport const registeredModules = (): string[] => Array.from(registry().modules.keys());\n"],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAEH;AACO,MAAM,eAAe,GAAG;AAE/B;AACO,MAAM,WAAW,GAAG;AAsB3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;AAE3C;SACgB,QAAQ,GAAA;IACtB,MAAM,CAAC,GAAG,UAAoE;IAC9E,QAAQ,CAAC,CAAC,GAAG,CAAA,KAAL,CAAC,CAAC,GAAG,CAAA,GAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAChF;AAEA;AACO,MAAM,UAAU,GAAG,CAAC,EAAU,MAAc,EAAE,KAAK,MAAM,GAAG,mBAAmB,GAAG,CAAA,kBAAA,EAAqB,EAAE,CAAA,CAAE;AAElH;AACO,MAAM,SAAS,GAAG,CAAC,EAAU,KAAa,WAAW,IAAI,EAAE,KAAK,MAAM,GAAG,iBAAiB,GAAG,CAAA,QAAA,EAAW,EAAE,CAAA,QAAA,CAAU;AAE3H;SACgB,cAAc,CAAC,EAAU,EAAE,G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AAC,CAAC,EAAE,KAAK,QAAQ;AAAE,YAAA,MAAM,IAAI,SAAS,CAAC,kGAAkG,CAAC;QAC3J,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAAE;AACzB,QAAA,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,QAAQ,IAAI,EAAE;YAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,CAAA,kBAAA,EAAqB,CAAC,CAAC,EAAE,CAAA,CAAE,CAAC;QAC3H,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAkB,CAAC;AACvC,QAAA,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IACd;AACA,IAAA,OAAO,CAAC;AACV;AAEA;AACO,MAAM,SAAS,GAAG,CAAC,EAAU,KAAc,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AAE3E;AACM,SAAU,aAAa,CAAc,EAAU,EAAE,GAAY,EAAA;IACjE,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AACpC,IAAA,IAAI,CAAC,CAAC;AAAE,QAAA,MAAM,IAAI,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC;IAC7C,OAAO,CAAC,CAAC,GAAQ;AACnB;AAEA;AACO,MAAM,iBAAiB,GAAG,MAAgB,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;;;;;;;;;;;;;;"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Module registry shared by every copy of `motionary/runtime` on the page
3
+ * (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
4
+ * so a component never needs to import the runtime itself — it asks for a
5
+ * module with `requireModule()` and gets a clear error when it is missing.
6
+ * Nothing here touches `window` / `document`: safe to import during SSR and
7
+ * inside Web Workers.
8
+ */
9
+ /** Runtime version (kept in sync with the package version by the release script). */
10
+ const RUNTIME_VERSION = '10.1.0';
11
+ /** Where the CDN builds live (major-pinned). */
12
+ const RUNTIME_CDN = 'https://cdn.jsdelivr.net/npm/motionary@10/dist/';
13
+ const KEY = Symbol.for('motionary.runtime');
14
+ /** The page-wide registry (created on first use). */
15
+ function registry() {
16
+ const g = globalThis;
17
+ return (g[KEY] || (g[KEY] = { version: RUNTIME_VERSION, modules: new Map(), slots: {} }));
18
+ }
19
+ /** The import path of a module id. */
20
+ const modulePath = (id) => (id === 'core' ? 'motionary/runtime' : `motionary/runtime/${id}`);
21
+ /** The CDN IIFE file of a module id. */
22
+ const moduleCdn = (id) => RUNTIME_CDN + (id === 'core' ? 'runtime.iife.js' : `runtime/${id}.iife.js`);
23
+ /** The text of the "module missing" error (shared with the components). */
24
+ function missingMessage(id, who = 'This feature') {
25
+ const path = modulePath(id);
26
+ const reg = id === 'core' ? `import { use } from 'motionary/runtime'; use();` : `import { use } from 'motionary/runtime'; import { ${camel(id)} } from '${path}'; use(${camel(id)});`;
27
+ const cdn = id === 'core' ? `<script src="${moduleCdn('core')}"></script>` : `<script src="${moduleCdn('core')}"></script><script src="${moduleCdn(id)}"></script>`;
28
+ return `[motionary] ${who} requires ${path}. Install once: npm i motionary — then register it before the component mounts: ${reg} Or from a CDN (core first): ${cdn} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${id}.md`;
29
+ }
30
+ /** 'format-css' → 'formatCss' (the module object's export name). */
31
+ const camel = (id) => id.replace(/-(\w)/g, (_, c) => c.toUpperCase());
32
+ /** Thrown by `requireModule()` when a module is not registered. */
33
+ class RuntimeModuleError extends Error {
34
+ constructor(id, who) {
35
+ super(missingMessage(id, who));
36
+ this.name = 'RuntimeModuleError';
37
+ this.module = id;
38
+ }
39
+ }
40
+ /** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
41
+ function register(...mods) {
42
+ const r = registry();
43
+ for (const m of mods) {
44
+ if (!m || typeof m.id !== 'string')
45
+ throw new TypeError('[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>');
46
+ if (r.modules.has(m.id))
47
+ continue;
48
+ for (const dep of m.requires || [])
49
+ if (!r.modules.has(dep))
50
+ throw new RuntimeModuleError(dep, `motionary/runtime/${m.id}`);
51
+ r.modules.set(m.id, m);
52
+ m.setup?.(r);
53
+ }
54
+ return r;
55
+ }
56
+ /** Is a module registered? */
57
+ const hasModule = (id) => registry().modules.has(id);
58
+ /** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
59
+ function requireModule(id, who) {
60
+ const m = registry().modules.get(id);
61
+ if (!m)
62
+ throw new RuntimeModuleError(id, who);
63
+ return m.api;
64
+ }
65
+ /** Ids of the registered modules. */
66
+ const registeredModules = () => Array.from(registry().modules.keys());
67
+
68
+ export { RUNTIME_VERSION as R, RUNTIME_CDN as a, RuntimeModuleError as b, moduleCdn as c, modulePath as d, registeredModules as e, registry as f, requireModule as g, hasModule as h, missingMessage as m, register as r };
69
+ //# sourceMappingURL=registry-jF8VIA_9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-jF8VIA_9.js","sources":["../../src/runtime/registry.ts"],"sourcesContent":["/**\n * Module registry shared by every copy of `motionary/runtime` on the page\n * (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),\n * so a component never needs to import the runtime itself — it asks for a\n * module with `requireModule()` and gets a clear error when it is missing.\n * Nothing here touches `window` / `document`: safe to import during SSR and\n * inside Web Workers.\n */\n\n/** Runtime version (kept in sync with the package version by the release script). */\nexport const RUNTIME_VERSION = '10.1.0';\n\n/** Where the CDN builds live (major-pinned). */\nexport const RUNTIME_CDN = 'https://cdn.jsdelivr.net/npm/motionary@10/dist/';\n\n/** A runtime module: `{ id, version, api }`, registered with `use()`. */\nexport interface RuntimeModule<A = unknown> {\n /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */\n id: string;\n version: string;\n /** Other modules this one needs (registered first by `use()` callers). */\n requires?: string[];\n /** The module's public API (what `requireModule(id)` returns). */\n api: A;\n /** Optional one-time setup, called on first registration. */\n setup?(registry: RuntimeRegistry): void;\n}\n\nexport interface RuntimeRegistry {\n version: string;\n modules: Map<string, RuntimeModule>;\n /** Shared per-page state slots (the ticker lives here). */\n slots: Record<string, unknown>;\n}\n\nconst KEY = Symbol.for('motionary.runtime');\n\n/** The page-wide registry (created on first use). */\nexport function registry(): RuntimeRegistry {\n const g = globalThis as unknown as Record<symbol, RuntimeRegistry | undefined>;\n return (g[KEY] ||= { version: RUNTIME_VERSION, modules: new Map(), slots: {} });\n}\n\n/** The import path of a module id. */\nexport const modulePath = (id: string): string => (id === 'core' ? 'motionary/runtime' : `motionary/runtime/${id}`);\n\n/** The CDN IIFE file of a module id. */\nexport const moduleCdn = (id: string): string => RUNTIME_CDN + (id === 'core' ? 'runtime.iife.js' : `runtime/${id}.iife.js`);\n\n/** The text of the \"module missing\" error (shared with the components). */\nexport function missingMessage(id: string, who = 'This feature'): string {\n const path = modulePath(id);\n const reg = id === 'core' ? `import { use } from 'motionary/runtime'; use();` : `import { use } from 'motionary/runtime'; import { ${camel(id)} } from '${path}'; use(${camel(id)});`;\n const cdn = id === 'core' ? `<script src=\"${moduleCdn('core')}\"></script>` : `<script src=\"${moduleCdn('core')}\"></script><script src=\"${moduleCdn(id)}\"></script>`;\n return `[motionary] ${who} requires ${path}. Install once: npm i motionary — then register it before the component mounts: ${reg} Or from a CDN (core first): ${cdn} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${id}.md`;\n}\n\n/** 'format-css' → 'formatCss' (the module object's export name). */\nexport const camel = (id: string): string => id.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\n\n/** Thrown by `requireModule()` when a module is not registered. */\nexport class RuntimeModuleError extends Error {\n readonly module: string;\n constructor(id: string, who?: string) {\n super(missingMessage(id, who));\n this.name = 'RuntimeModuleError';\n this.module = id;\n }\n}\n\n/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */\nexport function register(...mods: RuntimeModule[]): RuntimeRegistry {\n const r = registry();\n for (const m of mods) {\n if (!m || typeof m.id !== 'string') throw new TypeError('[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>');\n if (r.modules.has(m.id)) continue;\n for (const dep of m.requires || []) if (!r.modules.has(dep)) throw new RuntimeModuleError(dep, `motionary/runtime/${m.id}`);\n r.modules.set(m.id, m as RuntimeModule);\n m.setup?.(r);\n }\n return r;\n}\n\n/** Is a module registered? */\nexport const hasModule = (id: string): boolean => registry().modules.has(id);\n\n/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */\nexport function requireModule<A = unknown>(id: string, who?: string): A {\n const m = registry().modules.get(id);\n if (!m) throw new RuntimeModuleError(id, who);\n return m.api as A;\n}\n\n/** Ids of the registered modules. */\nexport const registeredModules = (): string[] => Array.from(registry().modules.keys());\n"],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAEH;AACO,MAAM,eAAe,GAAG;AAE/B;AACO,MAAM,WAAW,GAAG;AAsB3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;AAE3C;SACgB,QAAQ,GAAA;IACtB,MAAM,CAAC,GAAG,UAAoE;IAC9E,QAAQ,CAAC,CAAC,GAAG,CAAA,KAAL,CAAC,CAAC,GAAG,CAAA,GAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAChF;AAEA;AACO,MAAM,UAAU,GAAG,CAAC,EAAU,MAAc,EAAE,KAAK,MAAM,GAAG,mBAAmB,GAAG,CAAA,kBAAA,EAAqB,EAAE,CAAA,CAAE;AAElH;AACO,MAAM,SAAS,GAAG,CAAC,EAAU,KAAa,WAAW,IAAI,EAAE,KAAK,MAAM,GAAG,iBAAiB,GAAG,CAAA,QAAA,EAAW,E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