@studiometa/js-toolkit 2.8.0 → 2.9.1

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 (73) hide show
  1. package/Base/Base.cjs +325 -0
  2. package/Base/Base.cjs.map +7 -0
  3. package/Base/Base.d.ts +197 -0
  4. package/Base/Base.js +304 -0
  5. package/Base/Base.js.map +7 -0
  6. package/Base/index.cjs +2 -292
  7. package/Base/index.cjs.map +3 -3
  8. package/Base/index.d.ts +1 -193
  9. package/Base/index.js +1 -290
  10. package/Base/index.js.map +2 -2
  11. package/Base/managers/AbstractManager.d.ts +2 -2
  12. package/Base/managers/ChildrenManager.cjs +11 -7
  13. package/Base/managers/ChildrenManager.cjs.map +2 -2
  14. package/Base/managers/ChildrenManager.d.ts +1 -1
  15. package/Base/managers/ChildrenManager.js +12 -8
  16. package/Base/managers/ChildrenManager.js.map +2 -2
  17. package/Base/managers/index.cjs +0 -2
  18. package/Base/managers/index.cjs.map +2 -2
  19. package/Base/managers/index.d.ts +0 -1
  20. package/Base/managers/index.js +0 -2
  21. package/Base/managers/index.js.map +2 -2
  22. package/Base/utils.cjs +13 -0
  23. package/Base/utils.cjs.map +2 -2
  24. package/Base/utils.d.ts +4 -0
  25. package/Base/utils.js +14 -1
  26. package/Base/utils.js.map +2 -2
  27. package/decorators/withScrolledInView/withScrolledInView.cjs +45 -55
  28. package/decorators/withScrolledInView/withScrolledInView.cjs.map +2 -2
  29. package/decorators/withScrolledInView/withScrolledInView.d.ts +1 -6
  30. package/decorators/withScrolledInView/withScrolledInView.js +45 -55
  31. package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
  32. package/helpers/createApp.cjs +21 -20
  33. package/helpers/createApp.cjs.map +2 -2
  34. package/helpers/createApp.js +21 -20
  35. package/helpers/createApp.js.map +2 -2
  36. package/helpers/getInstanceFromElement.cjs +1 -1
  37. package/helpers/getInstanceFromElement.cjs.map +2 -2
  38. package/helpers/getInstanceFromElement.js +1 -1
  39. package/helpers/getInstanceFromElement.js.map +2 -2
  40. package/package.json +1 -1
  41. package/services/drag.cjs +10 -3
  42. package/services/drag.cjs.map +2 -2
  43. package/services/drag.js +10 -3
  44. package/services/drag.js.map +2 -2
  45. package/utils/Queue.cjs +4 -1
  46. package/utils/Queue.cjs.map +2 -2
  47. package/utils/Queue.d.ts +1 -1
  48. package/utils/Queue.js +4 -1
  49. package/utils/Queue.js.map +2 -2
  50. package/utils/SmartQueue.cjs +57 -0
  51. package/utils/SmartQueue.cjs.map +7 -0
  52. package/utils/SmartQueue.d.ts +25 -0
  53. package/utils/SmartQueue.js +29 -0
  54. package/utils/SmartQueue.js.map +7 -0
  55. package/utils/index.cjs +3 -0
  56. package/utils/index.cjs.map +2 -2
  57. package/utils/index.d.ts +2 -0
  58. package/utils/index.js +3 -0
  59. package/utils/index.js.map +2 -2
  60. package/utils/nextTick.cjs +2 -5
  61. package/utils/nextTick.cjs.map +2 -2
  62. package/utils/nextTick.js +2 -5
  63. package/utils/nextTick.js.map +2 -2
  64. package/utils/wait.cjs +31 -0
  65. package/utils/wait.cjs.map +7 -0
  66. package/utils/wait.d.ts +1 -0
  67. package/utils/wait.js +9 -0
  68. package/utils/wait.js.map +7 -0
  69. package/Base/managers/AsyncChildrenManager.cjs +0 -61
  70. package/Base/managers/AsyncChildrenManager.cjs.map +0 -7
  71. package/Base/managers/AsyncChildrenManager.d.ts +0 -18
  72. package/Base/managers/AsyncChildrenManager.js +0 -39
  73. package/Base/managers/AsyncChildrenManager.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/ChildrenManager.ts"],
4
- "sourcesContent": ["import type { Base, BaseConstructor, BaseAsyncConstructor, BaseEl } from '../index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { getComponentElements } from '../utils.js';\n\n/**\n * Get a child component's instance.\n *\n * @param {ChildrenManager} that\n * @param {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base> }} el\n * The root element of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} ComponentClass\n * A Base class or a Promise for async components.\n * @param {string} name\n * The name of the child component.\n * @returns {Base|Promise<Base | 'terminated'>|'terminated'}\n * A Base instance or a Promise resolving to a Base instance.\n * @private\n */\nfunction __getChild(\n // eslint-disable-next-line no-use-before-define\n that: ChildrenManager,\n el: BaseEl,\n ComponentClass: BaseConstructor | BaseAsyncConstructor,\n name: string,\n): Base | Promise<Base | 'terminated'> | 'terminated' {\n const asyncComponentPromise = that.__asyncComponentPromises.get(\n ComponentClass as BaseAsyncConstructor,\n );\n\n // Test if we have a constructor and not a promise or if the promise has been resolved\n if (\n '$isBase' in ComponentClass ||\n (asyncComponentPromise && asyncComponentPromise.status === 'resolved')\n ) {\n let ctor = ComponentClass as BaseConstructor;\n\n // Get resolved constructor from weakmap.\n // Only test for existence as the status was checked before.\n if (asyncComponentPromise) {\n ctor = asyncComponentPromise.ctor;\n }\n\n // Return existing instance if it exists\n if (el.__base__ && el.__base__.has(ctor)) {\n return el.__base__.get(ctor);\n }\n\n // Return a new instance if the component class is a child of the Base class\n // eslint-disable-next-line new-cap\n const child = new ctor(el);\n Object.defineProperty(child, '$parent', { get: () => that.__base });\n return child;\n }\n\n const promise = asyncComponentPromise\n ? asyncComponentPromise.promise\n : ComponentClass(that.__base);\n\n if (!asyncComponentPromise) {\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'pending',\n ctor: undefined,\n });\n }\n\n // Resolve async components\n return promise.then((module) => {\n // @ts-ignore\n const ctor = module.default ?? module;\n\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'resolved',\n ctor,\n });\n\n return __getChild(that, el, ctor, name);\n });\n}\n\n/**\n * Execute the given hook for all children instances.\n *\n * @param {ChildrenManager} that\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to execute.\n * @private\n */\n// eslint-disable-next-line no-use-before-define\nfunction __triggerHookForAll(that: ChildrenManager, hook: '$mount' | '$update' | '$destroy') {\n that.registeredNames.forEach((name) => {\n that[name].forEach((instance) => {\n if (instance instanceof Promise) {\n instance.then((resolvedInstance) => that.__triggerHook(hook, resolvedInstance, name));\n } else {\n that.__triggerHook(hook, instance, name);\n }\n });\n });\n}\n\n/**\n * Children manager.\n */\nexport class ChildrenManager extends AbstractManager {\n /**\n * Store async component promises to avoid calling them multiple times and\n * waiting for them when they are already resolved.\n */\n __asyncComponentPromises: WeakMap<\n BaseAsyncConstructor,\n {\n promise: ReturnType<BaseAsyncConstructor>;\n status: 'pending' | 'resolved';\n ctor?: BaseConstructor;\n }\n > = new WeakMap();\n\n get registeredNames(): string[] {\n return Object.keys(this).filter((key) => !key.startsWith('__'));\n }\n\n /**\n * Register instances of all children components.\n */\n registerAll() {\n Object.entries(this.__config.components).forEach(([name, component]) =>\n this.__register(name, component),\n );\n }\n\n /**\n * Mount all child component instances.\n */\n mountAll() {\n __triggerHookForAll(this, '$mount');\n }\n\n /**\n * Update all child component instances.\n */\n updateAll() {\n __triggerHookForAll(this, '$update');\n }\n\n /**\n * Destroy all child component instances.\n */\n destroyAll() {\n __triggerHookForAll(this, '$destroy');\n }\n\n /**\n * Execute the given hook for the given instance.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to trigger.\n * @param {Base} instance The target instance.\n * @param {string} name The name of the component.\n * @private\n */\n __triggerHook(hook: '$mount' | '$update' | '$destroy', instance: Base, name: string) {\n if (hook === '$update' && !instance.$isMounted) {\n // eslint-disable-next-line no-param-reassign\n hook = '$mount';\n }\n\n if (hook === '$update' || hook === '$destroy') {\n this.__eventsManager.unbindChild(name, instance);\n }\n\n if (hook === '$update' || hook === '$mount') {\n this.__eventsManager.bindChild(name, instance);\n }\n\n instance[hook]();\n }\n\n /**\n * Register instance of a child component.\n *\n * @param {string} name\n * The name of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} component\n * A Base class or a Promise for async components.\n * @private\n */\n __register(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: () => this.__getValue(name, component),\n });\n }\n\n __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n const elements = getComponentElements(name, this.__element);\n\n if (elements.length === 0) {\n return [];\n }\n\n return elements\n .map((element) => __getChild(this, element, component, name))\n .filter((instance) => instance !== 'terminated');\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,6BAAgC;AAChC,mBAAqC;AAgBrC,SAAS,WAEP,MACA,IACA,gBACA,MACoD;AACpD,QAAM,wBAAwB,KAAK,yBAAyB;AAAA,IAC1D;AAAA,EACF;AAGA,MACE,aAAa,kBACZ,yBAAyB,sBAAsB,WAAW,YAC3D;AACA,QAAI,OAAO;AAIX,QAAI,uBAAuB;AACzB,aAAO,sBAAsB;AAAA,IAC/B;AAGA,QAAI,GAAG,YAAY,GAAG,SAAS,IAAI,IAAI,GAAG;AACxC,aAAO,GAAG,SAAS,IAAI,IAAI;AAAA,IAC7B;AAIA,UAAM,QAAQ,IAAI,KAAK,EAAE;AACzB,WAAO,eAAe,OAAO,WAAW,EAAE,KAAK,MAAM,KAAK,OAAO,CAAC;AAClE,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,wBACZ,sBAAsB,UACtB,eAAe,KAAK,MAAM;AAE9B,MAAI,CAAC,uBAAuB;AAC1B,SAAK,yBAAyB,IAAI,gBAAgB;AAAA,MAChD;AAAA,MACA,QAAQ;AAAA,MACR,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAGA,SAAO,QAAQ,KAAK,CAACA,YAAW;AAE9B,UAAM,OAAOA,QAAO,WAAWA;AAE/B,SAAK,yBAAyB,IAAI,gBAAgB;AAAA,MAChD;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,WAAO,WAAW,MAAM,IAAI,MAAM,IAAI;AAAA,EACxC,CAAC;AACH;AAUA,SAAS,oBAAoB,M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d,KAAK,MAAM,KAAK,WAAW,MAAM,SAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,MAAc,WAAmD;AAC1E,UAAM,eAAW,mCAAqB,MAAM,KAAK,SAAS;AAE1D,QAAI,SAAS,WAAW,GAAG;AACzB,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,SACJ,IAAI,CAAC,YAAY,WAAW,MAAM,SAAS,WAAW,IAAI,CAAC,EAC3D,OAAO,CAAC,aAAa,aAAa,YAAY;AAAA,EACnD;AACF;",
4
+ "sourcesContent": ["import type { Base, BaseConstructor, BaseAsyncConstructor, BaseEl } from '../index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { getComponentElements, addToQueue } from '../utils.js';\n\n/**\n * Get a child component's instance.\n *\n * @param {ChildrenManager} that\n * @param {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base> }} el\n * The root element of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} ComponentClass\n * A Base class or a Promise for async components.\n * @param {string} name\n * The name of the child component.\n * @returns {Base|Promise<Base | 'terminated'>|'terminated'}\n * A Base instance or a Promise resolving to a Base instance.\n * @private\n */\nfunction __getChild(\n // eslint-disable-next-line no-use-before-define\n that: ChildrenManager,\n el: BaseEl,\n ComponentClass: BaseConstructor | BaseAsyncConstructor,\n name: string,\n): Base | Promise<Base | 'terminated'> | 'terminated' {\n const asyncComponentPromise = that.__asyncComponentPromises.get(\n ComponentClass as BaseAsyncConstructor,\n );\n\n // Test if we have a constructor and not a promise or if the promise has been resolved\n if (\n '$isBase' in ComponentClass ||\n (asyncComponentPromise && asyncComponentPromise.status === 'resolved')\n ) {\n let ctor = ComponentClass as BaseConstructor;\n\n // Get resolved constructor from weakmap.\n // Only test for existence as the status was checked before.\n if (asyncComponentPromise) {\n ctor = asyncComponentPromise.ctor;\n }\n\n // Return existing instance if it exists\n if (el.__base__ && el.__base__.has(ctor)) {\n return el.__base__.get(ctor);\n }\n\n // Return a new instance if the component class is a child of the Base class\n // eslint-disable-next-line new-cap\n const child = new ctor(el);\n Object.defineProperty(child, '$parent', { get: () => that.__base });\n return child;\n }\n\n const promise = asyncComponentPromise\n ? asyncComponentPromise.promise\n : ComponentClass(that.__base);\n\n if (!asyncComponentPromise) {\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'pending',\n ctor: undefined,\n });\n }\n\n // Resolve async components\n return promise.then((module) => {\n // @ts-ignore\n const ctor = module.default ?? module;\n\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'resolved',\n ctor,\n });\n\n return __getChild(that, el, ctor, name);\n });\n}\n\n/**\n * Execute the given hook for all children instances.\n *\n * @param {ChildrenManager} that\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to execute.\n * @private\n */\n// eslint-disable-next-line no-use-before-define\nfunction __triggerHookForAll(that: ChildrenManager, hook: '$mount' | '$update' | '$destroy') {\n addToQueue(() => {\n that.registeredNames.forEach((name) => {\n that[name].forEach((instance) => {\n if (instance instanceof Promise) {\n instance.then((resolvedInstance) => {\n addToQueue(() => that.__triggerHook(hook, resolvedInstance, name));\n });\n } else {\n addToQueue(() => that.__triggerHook(hook, instance, name));\n }\n });\n });\n });\n}\n\n/**\n * Children manager.\n */\nexport class ChildrenManager extends AbstractManager {\n /**\n * Store async component promises to avoid calling them multiple times and\n * waiting for them when they are already resolved.\n */\n __asyncComponentPromises: WeakMap<\n BaseAsyncConstructor,\n {\n promise: ReturnType<BaseAsyncConstructor>;\n status: 'pending' | 'resolved';\n ctor?: BaseConstructor;\n }\n > = new WeakMap();\n\n get registeredNames(): string[] {\n return Object.keys(this).filter((key) => !key.startsWith('__'));\n }\n\n /**\n * Register instances of all children components.\n */\n registerAll() {\n Object.entries(this.__config.components).forEach(([name, component]) =>\n this.__register(name, component),\n );\n }\n\n /**\n * Mount all child component instances.\n */\n mountAll() {\n __triggerHookForAll(this, '$mount');\n }\n\n /**\n * Update all child component instances.\n */\n updateAll() {\n __triggerHookForAll(this, '$update');\n }\n\n /**\n * Destroy all child component instances.\n */\n destroyAll() {\n __triggerHookForAll(this, '$destroy');\n }\n\n /**\n * Execute the given hook for the given instance.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to trigger.\n * @param {Base} instance The target instance.\n * @param {string} name The name of the component.\n * @private\n */\n __triggerHook(hook: '$mount' | '$update' | '$destroy', instance: Base, name: string) {\n if (hook === '$update' && !instance.$isMounted) {\n // eslint-disable-next-line no-param-reassign\n hook = '$mount';\n }\n\n if (hook === '$update' || hook === '$destroy') {\n this.__eventsManager.unbindChild(name, instance);\n }\n\n if (hook === '$update' || hook === '$mount') {\n this.__eventsManager.bindChild(name, instance);\n }\n\n instance[hook]();\n }\n\n /**\n * Register instance of a child component.\n *\n * @param {string} name\n * The name of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} component\n * A Base class or a Promise for async components.\n * @private\n */\n __register(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: () => this.__getValue(name, component),\n });\n }\n\n __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n const elements = getComponentElements(name, this.__element);\n\n if (elements.length === 0) {\n return [];\n }\n\n return elements\n .map((element) => __getChild(this, element, component, name))\n .filter((instance) => instance !== 'terminated');\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,6BAAgC;AAChC,mBAAiD;AAgBjD,SAAS,WAEP,MACA,IACA,gBACA,MACoD;AACpD,QAAM,wBAAwB,KAAK,yBAAyB;AAAA,IAC1D;AAAA,EACF;AAGA,MACE,aAAa,kBACZ,yBAAyB,sBAAsB,WAAW,YAC3D;AACA,QAAI,OAAO;AAIX,QAAI,uBAAuB;AACzB,aAAO,sBAAsB;AAAA,IAC/B;AAGA,QAAI,GAAG,YAAY,GAAG,SAAS,IAAI,IAAI,GAAG;AACxC,aAAO,GAAG,SAAS,IAAI,IAAI;AAAA,IAC7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,CAAC,CAAC,MAAM,SAAS,MAChE,KAAK,WAAW,MAAM,SAAS;AAAA,IACjC;AAAA,EACF;AAAA,EAKA,WAAW;AACT,wBAAoB,MAAM,QAAQ;AAAA,EACpC;AAAA,EAKA,YAAY;AACV,wBAAoB,MAAM,SAAS;AAAA,EACrC;AAAA,EAKA,aAAa;AACX,wBAAoB,MAAM,UAAU;AAAA,EACtC;AAAA,EAUA,cAAc,MAAyC,UAAgB,MAAc;AACnF,QAAI,SAAS,aAAa,CAAC,SAAS,YAAY;AAE9C,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,aAAa,SAAS,YAAY;AAC7C,WAAK,gBAAgB,YAAY,MAAM,QAAQ;AAAA,IACjD;AAEA,QAAI,SAAS,aAAa,SAAS,UAAU;AAC3C,WAAK,gBAAgB,UAAU,MAAM,QAAQ;AAAA,IAC/C;AAEA,aAAS,MAAM;AAAA,EACjB;AAAA,EAWA,WAAW,MAAc,WAAmD;AAC1E,WAAO,eAAe,MAAM,MAAM;AAAA,MAChC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,KAAK,MAAM,KAAK,WAAW,MAAM,SAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,MAAc,WAAmD;AAC1E,UAAM,eAAW,mCAAqB,MAAM,KAAK,SAAS;AAE1D,QAAI,SAAS,WAAW,GAAG;AACzB,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,SACJ,IAAI,CAAC,YAAY,WAAW,MAAM,SAAS,WAAW,IAAI,CAAC,EAC3D,OAAO,CAAC,aAAa,aAAa,YAAY;AAAA,EACnD;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -49,5 +49,5 @@ export declare class ChildrenManager extends AbstractManager {
49
49
  * @private
50
50
  */
51
51
  __register(name: string, component: BaseConstructor | BaseAsyncConstructor): void;
52
- __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor): (Base<import("../index.js").BaseProps> | "terminated" | Promise<Base<import("../index.js").BaseProps> | "terminated">)[];
52
+ __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor): (Base<import("../Base.js").BaseProps> | "terminated" | Promise<Base<import("../Base.js").BaseProps> | "terminated">)[];
53
53
  }
@@ -1,5 +1,5 @@
1
1
  import { AbstractManager } from "./AbstractManager.js";
2
- import { getComponentElements } from "../utils.js";
2
+ import { getComponentElements, addToQueue } from "../utils.js";
3
3
  function __getChild(that, el, ComponentClass, name) {
4
4
  const asyncComponentPromise = that.__asyncComponentPromises.get(
5
5
  ComponentClass
@@ -35,13 +35,17 @@ function __getChild(that, el, ComponentClass, name) {
35
35
  });
36
36
  }
37
37
  function __triggerHookForAll(that, hook) {
38
- that.registeredNames.forEach((name) => {
39
- that[name].forEach((instance) => {
40
- if (instance instanceof Promise) {
41
- instance.then((resolvedInstance) => that.__triggerHook(hook, resolvedInstance, name));
42
- } else {
43
- that.__triggerHook(hook, instance, name);
44
- }
38
+ addToQueue(() => {
39
+ that.registeredNames.forEach((name) => {
40
+ that[name].forEach((instance) => {
41
+ if (instance instanceof Promise) {
42
+ instance.then((resolvedInstance) => {
43
+ addToQueue(() => that.__triggerHook(hook, resolvedInstance, name));
44
+ });
45
+ } else {
46
+ addToQueue(() => that.__triggerHook(hook, instance, name));
47
+ }
48
+ });
45
49
  });
46
50
  });
47
51
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/ChildrenManager.ts"],
4
- "sourcesContent": ["import type { Base, BaseConstructor, BaseAsyncConstructor, BaseEl } from '../index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { getComponentElements } from '../utils.js';\n\n/**\n * Get a child component's instance.\n *\n * @param {ChildrenManager} that\n * @param {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base> }} el\n * The root element of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} ComponentClass\n * A Base class or a Promise for async components.\n * @param {string} name\n * The name of the child component.\n * @returns {Base|Promise<Base | 'terminated'>|'terminated'}\n * A Base instance or a Promise resolving to a Base instance.\n * @private\n */\nfunction __getChild(\n // eslint-disable-next-line no-use-before-define\n that: ChildrenManager,\n el: BaseEl,\n ComponentClass: BaseConstructor | BaseAsyncConstructor,\n name: string,\n): Base | Promise<Base | 'terminated'> | 'terminated' {\n const asyncComponentPromise = that.__asyncComponentPromises.get(\n ComponentClass as BaseAsyncConstructor,\n );\n\n // Test if we have a constructor and not a promise or if the promise has been resolved\n if (\n '$isBase' in ComponentClass ||\n (asyncComponentPromise && asyncComponentPromise.status === 'resolved')\n ) {\n let ctor = ComponentClass as BaseConstructor;\n\n // Get resolved constructor from weakmap.\n // Only test for existence as the status was checked before.\n if (asyncComponentPromise) {\n ctor = asyncComponentPromise.ctor;\n }\n\n // Return existing instance if it exists\n if (el.__base__ && el.__base__.has(ctor)) {\n return el.__base__.get(ctor);\n }\n\n // Return a new instance if the component class is a child of the Base class\n // eslint-disable-next-line new-cap\n const child = new ctor(el);\n Object.defineProperty(child, '$parent', { get: () => that.__base });\n return child;\n }\n\n const promise = asyncComponentPromise\n ? asyncComponentPromise.promise\n : ComponentClass(that.__base);\n\n if (!asyncComponentPromise) {\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'pending',\n ctor: undefined,\n });\n }\n\n // Resolve async components\n return promise.then((module) => {\n // @ts-ignore\n const ctor = module.default ?? module;\n\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'resolved',\n ctor,\n });\n\n return __getChild(that, el, ctor, name);\n });\n}\n\n/**\n * Execute the given hook for all children instances.\n *\n * @param {ChildrenManager} that\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to execute.\n * @private\n */\n// eslint-disable-next-line no-use-before-define\nfunction __triggerHookForAll(that: ChildrenManager, hook: '$mount' | '$update' | '$destroy') {\n that.registeredNames.forEach((name) => {\n that[name].forEach((instance) => {\n if (instance instanceof Promise) {\n instance.then((resolvedInstance) => that.__triggerHook(hook, resolvedInstance, name));\n } else {\n that.__triggerHook(hook, instance, name);\n }\n });\n });\n}\n\n/**\n * Children manager.\n */\nexport class ChildrenManager extends AbstractManager {\n /**\n * Store async component promises to avoid calling them multiple times and\n * waiting for them when they are already resolved.\n */\n __asyncComponentPromises: WeakMap<\n BaseAsyncConstructor,\n {\n promise: ReturnType<BaseAsyncConstructor>;\n status: 'pending' | 'resolved';\n ctor?: BaseConstructor;\n }\n > = new WeakMap();\n\n get registeredNames(): string[] {\n return Object.keys(this).filter((key) => !key.startsWith('__'));\n }\n\n /**\n * Register instances of all children components.\n */\n registerAll() {\n Object.entries(this.__config.components).forEach(([name, component]) =>\n this.__register(name, component),\n );\n }\n\n /**\n * Mount all child component instances.\n */\n mountAll() {\n __triggerHookForAll(this, '$mount');\n }\n\n /**\n * Update all child component instances.\n */\n updateAll() {\n __triggerHookForAll(this, '$update');\n }\n\n /**\n * Destroy all child component instances.\n */\n destroyAll() {\n __triggerHookForAll(this, '$destroy');\n }\n\n /**\n * Execute the given hook for the given instance.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to trigger.\n * @param {Base} instance The target instance.\n * @param {string} name The name of the component.\n * @private\n */\n __triggerHook(hook: '$mount' | '$update' | '$destroy', instance: Base, name: string) {\n if (hook === '$update' && !instance.$isMounted) {\n // eslint-disable-next-line no-param-reassign\n hook = '$mount';\n }\n\n if (hook === '$update' || hook === '$destroy') {\n this.__eventsManager.unbindChild(name, instance);\n }\n\n if (hook === '$update' || hook === '$mount') {\n this.__eventsManager.bindChild(name, instance);\n }\n\n instance[hook]();\n }\n\n /**\n * Register instance of a child component.\n *\n * @param {string} name\n * The name of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} component\n * A Base class or a Promise for async components.\n * @private\n */\n __register(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: () => this.__getValue(name, component),\n });\n }\n\n __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n const elements = getComponentElements(name, this.__element);\n\n if (elements.length === 0) {\n return [];\n }\n\n return elements\n .map((element) => __getChild(this, element, component, name))\n .filter((instance) => instance !== 'terminated');\n }\n}\n"],
5
- "mappings": "AACA,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AAgBrC,SAAS,WAEP,MACA,IACA,gBACA,MACoD;AACpD,QAAM,wBAAwB,KAAK,yBAAyB;AAAA,IAC1D;AAAA,EACF;AAGA,MACE,aAAa,kBACZ,yBAAyB,sBAAsB,WAAW,YAC3D;AACA,QAAI,OAAO;AAIX,QAAI,uBAAuB;AACzB,aAAO,sBAAsB;AAAA,IAC/B;AAGA,QAAI,GAAG,YAAY,GAAG,SAAS,IAAI,IAAI,GAAG;AACxC,aAAO,GAAG,SAAS,IAAI,IAAI;AAAA,IAC7B;AAIA,UAAM,QAAQ,IAAI,KAAK,EAAE;AACzB,WAAO,eAAe,OAAO,WAAW,EAAE,KAAK,MAAM,KAAK,OAAO,CAAC;AAClE,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,wBACZ,sBAAsB,UACtB,eAAe,KAAK,MAAM;AAE9B,MAAI,CAAC,uBAAuB;AAC1B,SAAK,yBAAyB,IAAI,gBAAgB;AAAA,MAChD;AAAA,MACA,QAAQ;AAAA,MACR,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAGA,SAAO,QAAQ,KAAK,CAAC,WAAW;AAE9B,UAAM,OAAO,OAAO,WAAW;AAE/B,SAAK,yBAAyB,IAAI,gBAAgB;AAAA,MAChD;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,WAAO,WAAW,MAAM,IAAI,MAAM,IAAI;AAAA,EACxC,CAAC;AACH;AAUA,SAAS,oBAAoB,MAAuB,MAAyC;AAC3F,OAAK,gBAAgB,QAAQ,CAAC,SAAS;AACrC,SAAK,MAAM,QAAQ,CAAC,aAAa;AAC/B,UAAI,oBAAoB,SAAS;AAC/B,iBAAS,KAAK,CAAC,qBAAqB,KAAK,cAAc,MAAM,kBAAkB,IAAI,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C;AAAA,IACV;AAEA,WAAO,SACJ,IAAI,CAAC,YAAY,WAAW,MAAM,SAAS,WAAW,IAAI,CAAC,EAC3D,OAAO,CAAC,aAAa,aAAa,YAAY;AAAA,EACnD;AACF;",
4
+ "sourcesContent": ["import type { Base, BaseConstructor, BaseAsyncConstructor, BaseEl } from '../index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { getComponentElements, addToQueue } from '../utils.js';\n\n/**\n * Get a child component's instance.\n *\n * @param {ChildrenManager} that\n * @param {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base> }} el\n * The root element of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} ComponentClass\n * A Base class or a Promise for async components.\n * @param {string} name\n * The name of the child component.\n * @returns {Base|Promise<Base | 'terminated'>|'terminated'}\n * A Base instance or a Promise resolving to a Base instance.\n * @private\n */\nfunction __getChild(\n // eslint-disable-next-line no-use-before-define\n that: ChildrenManager,\n el: BaseEl,\n ComponentClass: BaseConstructor | BaseAsyncConstructor,\n name: string,\n): Base | Promise<Base | 'terminated'> | 'terminated' {\n const asyncComponentPromise = that.__asyncComponentPromises.get(\n ComponentClass as BaseAsyncConstructor,\n );\n\n // Test if we have a constructor and not a promise or if the promise has been resolved\n if (\n '$isBase' in ComponentClass ||\n (asyncComponentPromise && asyncComponentPromise.status === 'resolved')\n ) {\n let ctor = ComponentClass as BaseConstructor;\n\n // Get resolved constructor from weakmap.\n // Only test for existence as the status was checked before.\n if (asyncComponentPromise) {\n ctor = asyncComponentPromise.ctor;\n }\n\n // Return existing instance if it exists\n if (el.__base__ && el.__base__.has(ctor)) {\n return el.__base__.get(ctor);\n }\n\n // Return a new instance if the component class is a child of the Base class\n // eslint-disable-next-line new-cap\n const child = new ctor(el);\n Object.defineProperty(child, '$parent', { get: () => that.__base });\n return child;\n }\n\n const promise = asyncComponentPromise\n ? asyncComponentPromise.promise\n : ComponentClass(that.__base);\n\n if (!asyncComponentPromise) {\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'pending',\n ctor: undefined,\n });\n }\n\n // Resolve async components\n return promise.then((module) => {\n // @ts-ignore\n const ctor = module.default ?? module;\n\n that.__asyncComponentPromises.set(ComponentClass, {\n promise,\n status: 'resolved',\n ctor,\n });\n\n return __getChild(that, el, ctor, name);\n });\n}\n\n/**\n * Execute the given hook for all children instances.\n *\n * @param {ChildrenManager} that\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to execute.\n * @private\n */\n// eslint-disable-next-line no-use-before-define\nfunction __triggerHookForAll(that: ChildrenManager, hook: '$mount' | '$update' | '$destroy') {\n addToQueue(() => {\n that.registeredNames.forEach((name) => {\n that[name].forEach((instance) => {\n if (instance instanceof Promise) {\n instance.then((resolvedInstance) => {\n addToQueue(() => that.__triggerHook(hook, resolvedInstance, name));\n });\n } else {\n addToQueue(() => that.__triggerHook(hook, instance, name));\n }\n });\n });\n });\n}\n\n/**\n * Children manager.\n */\nexport class ChildrenManager extends AbstractManager {\n /**\n * Store async component promises to avoid calling them multiple times and\n * waiting for them when they are already resolved.\n */\n __asyncComponentPromises: WeakMap<\n BaseAsyncConstructor,\n {\n promise: ReturnType<BaseAsyncConstructor>;\n status: 'pending' | 'resolved';\n ctor?: BaseConstructor;\n }\n > = new WeakMap();\n\n get registeredNames(): string[] {\n return Object.keys(this).filter((key) => !key.startsWith('__'));\n }\n\n /**\n * Register instances of all children components.\n */\n registerAll() {\n Object.entries(this.__config.components).forEach(([name, component]) =>\n this.__register(name, component),\n );\n }\n\n /**\n * Mount all child component instances.\n */\n mountAll() {\n __triggerHookForAll(this, '$mount');\n }\n\n /**\n * Update all child component instances.\n */\n updateAll() {\n __triggerHookForAll(this, '$update');\n }\n\n /**\n * Destroy all child component instances.\n */\n destroyAll() {\n __triggerHookForAll(this, '$destroy');\n }\n\n /**\n * Execute the given hook for the given instance.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to trigger.\n * @param {Base} instance The target instance.\n * @param {string} name The name of the component.\n * @private\n */\n __triggerHook(hook: '$mount' | '$update' | '$destroy', instance: Base, name: string) {\n if (hook === '$update' && !instance.$isMounted) {\n // eslint-disable-next-line no-param-reassign\n hook = '$mount';\n }\n\n if (hook === '$update' || hook === '$destroy') {\n this.__eventsManager.unbindChild(name, instance);\n }\n\n if (hook === '$update' || hook === '$mount') {\n this.__eventsManager.bindChild(name, instance);\n }\n\n instance[hook]();\n }\n\n /**\n * Register instance of a child component.\n *\n * @param {string} name\n * The name of the child component.\n * @param {BaseConstructor|BaseAsyncConstructor} component\n * A Base class or a Promise for async components.\n * @private\n */\n __register(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: () => this.__getValue(name, component),\n });\n }\n\n __getValue(name: string, component: BaseConstructor | BaseAsyncConstructor) {\n const elements = getComponentElements(name, this.__element);\n\n if (elements.length === 0) {\n return [];\n }\n\n return elements\n .map((element) => __getChild(this, element, component, name))\n .filter((instance) => instance !== 'terminated');\n }\n}\n"],
5
+ "mappings": "AACA,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,kBAAkB;AAgBjD,SAAS,WAEP,MACA,IACA,gBACA,MACoD;AACpD,QAAM,wBAAwB,KAAK,yBAAyB;AAAA,IAC1D;AAAA,EACF;AAGA,MACE,aAAa,kBACZ,yBAAyB,sBAAsB,WAAW,YAC3D;AACA,QAAI,OAAO;AAIX,QAAI,uBAAuB;AACzB,aAAO,sBAAsB;AAAA,IAC/B;AAGA,QAAI,GAAG,YAAY,GAAG,SAAS,IAAI,IAAI,GAAG;AACxC,aAAO,GAAG,SAAS,IAAI,IAAI;AAAA,IAC7B;AAIA,UAAM,QAAQ,IAAI,KAAK,EAAE;AACzB,WAAO,eAAe,OAAO,WAAW,EAAE,KAAK,MAAM,KAAK,OAAO,CAAC;AAClE,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,wBACZ,sBAAsB,UACtB,eAAe,KAAK,MAAM;AAE9B,MAAI,CAAC,uBAAuB;AAC1B,SAA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AAA,EACtC;AAAA,EAUA,cAAc,MAAyC,UAAgB,MAAc;AACnF,QAAI,SAAS,aAAa,CAAC,SAAS,YAAY;AAE9C,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,aAAa,SAAS,YAAY;AAC7C,WAAK,gBAAgB,YAAY,MAAM,QAAQ;AAAA,IACjD;AAEA,QAAI,SAAS,aAAa,SAAS,UAAU;AAC3C,WAAK,gBAAgB,UAAU,MAAM,QAAQ;AAAA,IAC/C;AAEA,aAAS,MAAM;AAAA,EACjB;AAAA,EAWA,WAAW,MAAc,WAAmD;AAC1E,WAAO,eAAe,MAAM,MAAM;AAAA,MAChC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,KAAK,MAAM,KAAK,WAAW,MAAM,SAAS;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,MAAc,WAAmD;AAC1E,UAAM,WAAW,qBAAqB,MAAM,KAAK,SAAS;AAE1D,QAAI,SAAS,WAAW,GAAG;AACzB,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,SACJ,IAAI,CAAC,YAAY,WAAW,MAAM,SAAS,WAAW,IAAI,CAAC,EAC3D,OAAO,CAAC,aAAa,aAAa,YAAY;AAAA,EACnD;AACF;",
6
6
  "names": []
7
7
  }
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var managers_exports = {};
21
21
  __export(managers_exports, {
22
22
  AbstractManager: () => import_AbstractManager.AbstractManager,
23
- AsyncChildrenManager: () => import_AsyncChildrenManager.AsyncChildrenManager,
24
23
  ChildrenManager: () => import_ChildrenManager.ChildrenManager,
25
24
  EventsManager: () => import_EventsManager.EventsManager,
26
25
  OptionsManager: () => import_OptionsManager.OptionsManager,
@@ -30,7 +29,6 @@ __export(managers_exports, {
30
29
  });
31
30
  module.exports = __toCommonJS(managers_exports);
32
31
  var import_AbstractManager = require("./AbstractManager.cjs");
33
- var import_AsyncChildrenManager = require("./AsyncChildrenManager.cjs");
34
32
  var import_ChildrenManager = require("./ChildrenManager.cjs");
35
33
  var import_EventsManager = require("./EventsManager.cjs");
36
34
  var import_OptionsManager = require("./OptionsManager.cjs");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/index.ts"],
4
- "sourcesContent": ["export { AbstractManager } from './AbstractManager.js';\nexport { AsyncChildrenManager } from './AsyncChildrenManager.js';\nexport { ChildrenManager } from './ChildrenManager.js';\nexport { EventsManager } from './EventsManager.js';\nexport { OptionsManager } from './OptionsManager.js';\nexport { RefsManager } from './RefsManager.js';\nexport { ResponsiveOptionsManager } from './ResponsiveOptionsManager.js';\nexport { ServicesManager } from './ServicesManager.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,kCAAqC;AACrC,6BAAgC;AAChC,2BAA8B;AAC9B,4BAA+B;AAC/B,yBAA4B;AAC5B,sCAAyC;AACzC,6BAAgC;",
4
+ "sourcesContent": ["export { AbstractManager } from './AbstractManager.js';\nexport { ChildrenManager } from './ChildrenManager.js';\nexport { EventsManager } from './EventsManager.js';\nexport { OptionsManager } from './OptionsManager.js';\nexport { RefsManager } from './RefsManager.js';\nexport { ResponsiveOptionsManager } from './ResponsiveOptionsManager.js';\nexport { ServicesManager } from './ServicesManager.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,6BAAgC;AAChC,2BAA8B;AAC9B,4BAA+B;AAC/B,yBAA4B;AAC5B,sCAAyC;AACzC,6BAAgC;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,4 @@
1
1
  export { AbstractManager } from './AbstractManager.js';
2
- export { AsyncChildrenManager } from './AsyncChildrenManager.js';
3
2
  export { ChildrenManager } from './ChildrenManager.js';
4
3
  export { EventsManager } from './EventsManager.js';
5
4
  export { OptionsManager } from './OptionsManager.js';
@@ -1,5 +1,4 @@
1
1
  import { AbstractManager } from "./AbstractManager.js";
2
- import { AsyncChildrenManager } from "./AsyncChildrenManager.js";
3
2
  import { ChildrenManager } from "./ChildrenManager.js";
4
3
  import { EventsManager } from "./EventsManager.js";
5
4
  import { OptionsManager } from "./OptionsManager.js";
@@ -8,7 +7,6 @@ import { ResponsiveOptionsManager } from "./ResponsiveOptionsManager.js";
8
7
  import { ServicesManager } from "./ServicesManager.js";
9
8
  export {
10
9
  AbstractManager,
11
- AsyncChildrenManager,
12
10
  ChildrenManager,
13
11
  EventsManager,
14
12
  OptionsManager,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/index.ts"],
4
- "sourcesContent": ["export { AbstractManager } from './AbstractManager.js';\nexport { AsyncChildrenManager } from './AsyncChildrenManager.js';\nexport { ChildrenManager } from './ChildrenManager.js';\nexport { EventsManager } from './EventsManager.js';\nexport { OptionsManager } from './OptionsManager.js';\nexport { RefsManager } from './RefsManager.js';\nexport { ResponsiveOptionsManager } from './ResponsiveOptionsManager.js';\nexport { ServicesManager } from './ServicesManager.js';\n"],
5
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,uBAAuB;",
4
+ "sourcesContent": ["export { AbstractManager } from './AbstractManager.js';\nexport { ChildrenManager } from './ChildrenManager.js';\nexport { EventsManager } from './EventsManager.js';\nexport { OptionsManager } from './OptionsManager.js';\nexport { RefsManager } from './RefsManager.js';\nexport { ResponsiveOptionsManager } from './ResponsiveOptionsManager.js';\nexport { ServicesManager } from './ServicesManager.js';\n"],
5
+ "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,uBAAuB;",
6
6
  "names": []
7
7
  }
package/Base/utils.cjs CHANGED
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // packages/js-toolkit/Base/utils.ts
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
+ addToQueue: () => addToQueue,
22
23
  eventIsDefinedInConfig: () => eventIsDefinedInConfig,
23
24
  eventIsNative: () => eventIsNative,
24
25
  getComponentElements: () => getComponentElements,
@@ -26,6 +27,18 @@ __export(utils_exports, {
26
27
  });
27
28
  module.exports = __toCommonJS(utils_exports);
28
29
  var import_utils = require("../utils/index.cjs");
30
+ var import_features = require("./features.cjs");
31
+ var queue;
32
+ function addToQueue(fn) {
33
+ if (!import_features.features.get("asyncChildren")) {
34
+ fn();
35
+ return;
36
+ }
37
+ if (!queue) {
38
+ queue = new import_utils.SmartQueue();
39
+ }
40
+ queue.add(fn);
41
+ }
29
42
  var selectors = /* @__PURE__ */ new Map();
30
43
  var separator = " ";
31
44
  function getSelector(nameOrSelector) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/Base/utils.ts"],
4
- "sourcesContent": ["import { isArray, isDefined, isDev } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {string} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(nameOrSelector);\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAG1C,IAAM,YAAY,oBAAI,IAAI;AAG1B,IAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA,MAEZ,oBAAoB;AAAA,MAEpB,qBAAqB,YAAY,iBAAiB;AAAA,MAElD,qBAAqB,YAAY;AAAA,MAEjC,qBAAqB,iBAAiB;AAAA,IACxC;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAE;AAAA,EAAO;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,aAAO,sBAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,aAAO,wBAAU,QAAQ,KAAK,QAAQ;AACxC;AAMO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,oBAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,wCAAwC,SAAS,IAAI,YAAY;AAAA,IACnE;AAAA,EACF;AAGA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isArray, isDefined, isDev, SmartQueue } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\nimport { features } from './features.js';\n\nlet queue: SmartQueue;\n\n/**\n * Add a task to the main queue.\n */\nexport function addToQueue(fn: () => unknown): void {\n if (!features.get('asyncChildren')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n queue.add(fn);\n}\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {string} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(nameOrSelector);\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsD;AAEtD,sBAAyB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAyB;AAClD,MAAI,CAAC,yBAAS,IAAI,eAAe,GAAG;AAClC,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,wBAAW;AAAA,EACzB;AAEA,QAAM,IAAI,EAAE;AACd;AAEA,IAAM,YAAY,oBAAI,IAAI;AAG1B,IAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA,MAEZ,oBAAoB;AAAA,MAEpB,qBAAqB,YAAY,iBAAiB;AAAA,MAElD,qBAAqB,YAAY;AAAA,MAEjC,qBAAqB,iBAAiB;AAAA,IACxC;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAE;AAAA,EAAO;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,aAAO,sBAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,aAAO,wBAAU,QAAQ,KAAK,QAAQ;AACxC;AAMO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,oBAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,wCAAwC,SAAS,IAAI,YAAY;AAAA,IACnE;AAAA,EACF;AAGA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/Base/utils.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import type { Base, BaseConfig } from './index.js';
2
+ /**
3
+ * Add a task to the main queue.
4
+ */
5
+ export declare function addToQueue(fn: () => unknown): void;
2
6
  /**
3
7
  * Get a list of elements based on the name of a component.
4
8
  *
package/Base/utils.js CHANGED
@@ -1,4 +1,16 @@
1
- import { isArray, isDefined, isDev } from "../utils/index.js";
1
+ import { isArray, isDefined, isDev, SmartQueue } from "../utils/index.js";
2
+ import { features } from "./features.js";
3
+ let queue;
4
+ function addToQueue(fn) {
5
+ if (!features.get("asyncChildren")) {
6
+ fn();
7
+ return;
8
+ }
9
+ if (!queue) {
10
+ queue = new SmartQueue();
11
+ }
12
+ queue.add(fn);
13
+ }
2
14
  const selectors = /* @__PURE__ */ new Map();
3
15
  const separator = " ";
4
16
  function getSelector(nameOrSelector) {
@@ -48,6 +60,7 @@ function getEventTarget(instance, event, config) {
48
60
  return instance;
49
61
  }
50
62
  export {
63
+ addToQueue,
51
64
  eventIsDefinedInConfig,
52
65
  eventIsNative,
53
66
  getComponentElements,
package/Base/utils.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/Base/utils.ts"],
4
- "sourcesContent": ["import { isArray, isDefined, isDev } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {string} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(nameOrSelector);\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
5
- "mappings": "AAAA,SAAS,SAAS,WAAW,aAAa;AAG1C,MAAM,YAAY,oBAAI,IAAI;AAG1B,MAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA,MAEZ,oBAAoB;AAAA,MAEpB,qBAAqB,YAAY,iBAAiB;AAAA,MAElD,qBAAqB,YAAY;AAAA,MAEjC,qBAAqB,iBAAiB;AAAA,IACxC;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAE;AAAA,EAAO;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,SAAO,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,SAAO,UAAU,QAAQ,KAAK,QAAQ;AACxC;AAMO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,OAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,wCAAwC,SAAS,IAAI,YAAY;AAAA,IACnE;AAAA,EACF;AAGA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isArray, isDefined, isDev, SmartQueue } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\nimport { features } from './features.js';\n\nlet queue: SmartQueue;\n\n/**\n * Add a task to the main queue.\n */\nexport function addToQueue(fn: () => unknown): void {\n if (!features.get('asyncChildren')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n queue.add(fn);\n}\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {string} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(nameOrSelector);\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
5
+ "mappings": "AAAA,SAAS,SAAS,WAAW,OAAO,kBAAkB;AAEtD,SAAS,gBAAgB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAyB;AAClD,MAAI,CAAC,SAAS,IAAI,eAAe,GAAG;AAClC,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,WAAW;AAAA,EACzB;AAEA,QAAM,IAAI,EAAE;AACd;AAEA,MAAM,YAAY,oBAAI,IAAI;AAG1B,MAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA,MAEZ,oBAAoB;AAAA,MAEpB,qBAAqB,YAAY,iBAAiB;AAAA,MAElD,qBAAqB,YAAY;AAAA,MAEjC,qBAAqB,iBAAiB;AAAA,IACxC;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAE;AAAA,EAAO;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,SAAO,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,SAAO,UAAU,QAAQ,KAAK,QAAQ;AACxC;AAMO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,OAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,wCAAwC,SAAS,IAAI,YAAY;AAAA,IACnE;AAAA,EACF;AAGA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,11 @@ var import_withMountWhenInView = require("../withMountWhenInView.cjs");
26
26
  var import_utils = require("../../utils/index.cjs");
27
27
  var import_utils2 = require("./utils.cjs");
28
28
  var scheduler = (0, import_utils.useScheduler)(["update", "render"]);
29
+ function updateProgress(props, axis, progressKey, currentKey) {
30
+ props[progressKey][axis] = props.start[axis] === props.end[axis] ? 0 : (0, import_utils.clamp01)(
31
+ (props[currentKey][axis] - props.start[axis]) / (props.end[axis] - props.start[axis])
32
+ );
33
+ }
29
34
  function updateProps(props, dampFactor, dampPrecision, axis = "x") {
30
35
  props.current[axis] = (0, import_utils.clamp)(
31
36
  axis === "x" ? window.pageXOffset : window.pageYOffset,
@@ -38,12 +43,8 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
38
43
  dampFactor,
39
44
  dampPrecision
40
45
  );
41
- props.progress[axis] = (0, import_utils.clamp01)(
42
- (props.current[axis] - props.start[axis]) / (props.end[axis] - props.start[axis])
43
- );
44
- props.dampedProgress[axis] = (0, import_utils.clamp01)(
45
- (props.dampedCurrent[axis] - props.start[axis]) / (props.end[axis] - props.start[axis])
46
- );
46
+ updateProgress(props, axis, "progress", "current");
47
+ updateProgress(props, axis, "dampedProgress", "dampedCurrent");
47
48
  }
48
49
  function withScrolledInView(BaseClass, options = {}) {
49
50
  class WithScrolledInView extends (0, import_withMountWhenInView.withMountWhenInView)(
@@ -94,13 +95,48 @@ function withScrolledInView(BaseClass, options = {}) {
94
95
  y: 0
95
96
  }
96
97
  };
98
+ shouldEvaluateProps = true;
99
+ get props() {
100
+ if (this.shouldEvaluateProps) {
101
+ this.shouldEvaluateProps = false;
102
+ const targetSizes = options.useOffsetSizes ? (0, import_utils.getOffsetSizes)(this.$el) : this.$el.getBoundingClientRect();
103
+ targetSizes.y += window.pageYOffset;
104
+ targetSizes.x += window.pageXOffset;
105
+ const containerSizes = {
106
+ x: 0,
107
+ y: 0,
108
+ height: window.innerHeight,
109
+ width: window.innerWidth
110
+ };
111
+ const offset = (0, import_utils2.normalizeOffset)(this.$options.offset);
112
+ const [yStart, yEnd] = (0, import_utils2.getEdges)("y", targetSizes, containerSizes, offset);
113
+ const yCurrent = (0, import_utils.clamp)(window.pageYOffset, yStart, yEnd);
114
+ const yProgress = yStart === yEnd ? 0 : (0, import_utils.clamp01)((yCurrent - yStart) / (yEnd - yStart));
115
+ const [xStart, xEnd] = (0, import_utils2.getEdges)("x", targetSizes, containerSizes, offset);
116
+ const xCurrent = (0, import_utils.clamp)(window.pageXOffset, xStart, xEnd);
117
+ const xProgress = xStart === xEnd ? 0 : (0, import_utils.clamp01)((xCurrent - xStart) / (xEnd - xStart));
118
+ this.__props.start.x = xStart;
119
+ this.__props.start.y = yStart;
120
+ this.__props.end.x = xEnd;
121
+ this.__props.end.y = yEnd;
122
+ this.__props.current.x = xCurrent;
123
+ this.__props.current.y = yCurrent;
124
+ this.__props.dampedCurrent.x = xCurrent;
125
+ this.__props.dampedCurrent.y = yCurrent;
126
+ this.__props.progress.x = xProgress;
127
+ this.__props.progress.y = yProgress;
128
+ this.__props.dampedProgress.x = xProgress;
129
+ this.__props.dampedProgress.y = yProgress;
130
+ }
131
+ return this.__props;
132
+ }
97
133
  dampFactor = null;
98
134
  dampPrecision = null;
99
135
  constructor(element) {
100
136
  super(element);
101
137
  const render = () => {
102
138
  scheduler.update(() => {
103
- const renderFn = this.__callMethod("scrolledInView", this.__props);
139
+ const renderFn = this.__callMethod("scrolledInView", this.props);
104
140
  if ((0, import_utils.isFunction)(renderFn)) {
105
141
  scheduler.render(() => {
106
142
  renderFn(this.__props);
@@ -113,7 +149,8 @@ function withScrolledInView(BaseClass, options = {}) {
113
149
  delegate[event.type](event.detail[0]);
114
150
  },
115
151
  resized: () => {
116
- this.__setProps();
152
+ this.shouldEvaluateProps = true;
153
+ render();
117
154
  },
118
155
  scrolled: (props) => {
119
156
  if (!this.$services.has("ticked") && props.changed.y || props.changed.x) {
@@ -136,9 +173,6 @@ function withScrolledInView(BaseClass, options = {}) {
136
173
  this.$on("scrolled", delegate);
137
174
  this.$on("ticked", delegate);
138
175
  });
139
- this.$on("mounted", () => {
140
- this.__setProps();
141
- });
142
176
  this.$on("destroyed", () => {
143
177
  this.$off("resized", delegate);
144
178
  this.$off("scrolled", delegate);
@@ -175,50 +209,6 @@ function withScrolledInView(BaseClass, options = {}) {
175
209
  super.destroyed();
176
210
  }
177
211
  }
178
- __setProps() {
179
- const targetSizes = options.useOffsetSizes ? (0, import_utils.getOffsetSizes)(this.$el) : this.$el.getBoundingClientRect();
180
- targetSizes.y += window.pageYOffset;
181
- targetSizes.x += window.pageXOffset;
182
- const containerSizes = {
183
- x: 0,
184
- y: 0,
185
- height: window.innerHeight,
186
- width: window.innerWidth
187
- };
188
- const offset = (0, import_utils2.normalizeOffset)(this.$options.offset);
189
- const [yStart, yEnd] = (0, import_utils2.getEdges)("y", targetSizes, containerSizes, offset);
190
- const yCurrent = (0, import_utils.clamp)(window.pageYOffset, yStart, yEnd);
191
- const yProgress = (0, import_utils.clamp01)((yCurrent - yStart) / (yEnd - yStart));
192
- const [xStart, xEnd] = (0, import_utils2.getEdges)("x", targetSizes, containerSizes, offset);
193
- const xCurrent = (0, import_utils.clamp)(window.pageXOffset, xStart, xEnd);
194
- const xProgress = (0, import_utils.clamp01)((xCurrent - xStart) / (xEnd - xStart));
195
- this.__props.start.x = xStart;
196
- this.__props.start.y = yStart;
197
- this.__props.end.x = xEnd;
198
- this.__props.end.y = yEnd;
199
- this.__props.current.x = xCurrent;
200
- this.__props.current.y = yCurrent;
201
- this.__props.dampedCurrent.x = (0, import_utils.damp)(
202
- xCurrent,
203
- this.__props.dampedCurrent.x,
204
- this.dampFactor,
205
- this.dampPrecision
206
- );
207
- this.__props.dampedCurrent.y = (0, import_utils.damp)(
208
- yCurrent,
209
- this.__props.dampedCurrent.y,
210
- this.dampFactor,
211
- this.dampPrecision
212
- );
213
- this.__props.progress.x = xProgress;
214
- this.__props.progress.y = yProgress;
215
- this.__props.dampedProgress.x = (0, import_utils.clamp01)(
216
- (this.__props.dampedCurrent.x - xStart) / (xEnd - xStart)
217
- );
218
- this.__props.dampedProgress.y = (0, import_utils.clamp01)(
219
- (this.__props.dampedCurrent.y - yStart) / (yEnd - yStart)
220
- );
221
- }
222
212
  }
223
213
  return WithScrolledInView;
224
214
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/decorators/withScrolledInView/withScrolledInView.ts"],
4
- "sourcesContent": ["import type { BaseInterface, BaseDecorator } from '../../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../../Base/index.js';\nimport type {\n RafServiceProps,\n ScrollServiceProps,\n ResizeServiceProps,\n} from '../../services/index.js';\nimport { withMountWhenInView } from '../withMountWhenInView.js';\nimport {\n damp,\n clamp,\n clamp01,\n getOffsetSizes,\n isFunction,\n useScheduler,\n} from '../../utils/index.js';\nimport { normalizeOffset, getEdges } from './utils.js';\n\nconst scheduler = useScheduler(['update', 'render']);\n\nexport interface WithScrolledInViewProps extends BaseProps {\n $options: {\n dampFactor: number;\n dampPrecision: number;\n offset: string;\n };\n}\n\nexport type ScrollInViewProps = {\n start: {\n x: number;\n y: number;\n };\n end: {\n x: number;\n y: number;\n };\n current: {\n x: number;\n y: number;\n };\n dampedCurrent: {\n x: number;\n y: number;\n };\n progress: {\n x: number;\n y: number;\n };\n dampedProgress: {\n x: number;\n y: number;\n };\n};\n\nexport type WithScrolledInViewOptions = IntersectionObserverInit & {\n useOffsetSizes?: boolean;\n};\n\n/**\n * Update props on tick.\n */\nfunction updateProps(\n props: ScrollInViewProps,\n dampFactor: number,\n dampPrecision: number,\n axis: 'x' | 'y' = 'x',\n): void {\n props.current[axis] = clamp(\n axis === 'x' ? window.pageXOffset : window.pageYOffset,\n props.start[axis],\n props.end[axis],\n );\n props.dampedCurrent[axis] = damp(\n props.current[axis],\n props.dampedCurrent[axis],\n dampFactor,\n dampPrecision,\n );\n props.progress[axis] = clamp01(\n (props.current[axis] - props.start[axis]) / (props.end[axis] - props.start[axis]),\n );\n props.dampedProgress[axis] = clamp01(\n (props.dampedCurrent[axis] - props.start[axis]) / (props.end[axis] - props.start[axis]),\n );\n}\n\nexport interface WithScrolledInViewInterface extends BaseInterface {\n /**\n * @private\n * @type {ScrollInViewProps}\n */\n __props: ScrollInViewProps;\n dampFactor?: number;\n dampPrecision?: number;\n mounted(): void;\n resized(props: ResizeServiceProps): void;\n scrolled(props: ScrollServiceProps): void;\n ticked(props: RafServiceProps): void;\n destroyed(): void;\n /**\n * @private\n */\n __setProps(): void;\n}\n\n/**\n * Add scrolled in view capabilities to a component.\n */\nexport function withScrolledInView<S extends Base = Base>(\n BaseClass: typeof Base,\n options: WithScrolledInViewOptions = {},\n): BaseDecorator<WithScrolledInViewInterface, S, WithScrolledInViewProps> {\n /**\n * Class.\n */\n class WithScrolledInView<T extends BaseProps = BaseProps> extends withMountWhenInView(\n BaseClass,\n options,\n )<T & WithScrolledInViewProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: `${BaseClass.config.name}WithMountWhenInView`,\n emits: ['scrolledInView'],\n options: {\n dampFactor: {\n type: Number,\n default: 0.1,\n },\n dampPrecision: {\n type: Number,\n default: 0.001,\n },\n offset: {\n type: String,\n default: 'start end / end start',\n },\n },\n };\n\n __props: ScrollInViewProps = {\n start: {\n x: 0,\n y: 0,\n },\n end: {\n x: 0,\n y: 0,\n },\n current: {\n x: 0,\n y: 0,\n },\n dampedCurrent: {\n x: 0,\n y: 0,\n },\n progress: {\n x: 0,\n y: 0,\n },\n dampedProgress: {\n x: 0,\n y: 0,\n },\n };\n\n /**\n * Factor used for the `dampedProgress` props.\n * @deprecated\n * @todo v3 delete in favor of option API\n */\n dampFactor?: number = null;\n\n /**\n * Precision for the `dampedProgress` props.\n * @deprecated\n * @todo v3 delete in favor of option API\n */\n dampPrecision?: number = null;\n\n /**\n * Bind listeners.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n const render = () => {\n scheduler.update(() => {\n // @ts-ignore\n const renderFn = this.__callMethod('scrolledInView', this.__props);\n if (isFunction(renderFn)) {\n scheduler.render(() => {\n renderFn(this.__props);\n });\n }\n });\n };\n\n const delegate = {\n handleEvent(event) {\n delegate[event.type](event.detail[0]);\n },\n resized: () => {\n this.__setProps();\n },\n scrolled: (props) => {\n if ((!this.$services.has('ticked') && props.changed.y) || props.changed.x) {\n this.$services.enable('ticked');\n }\n },\n ticked: () => {\n const dampFactor = this.dampFactor ?? this.$options.dampFactor;\n const dampPrecision = this.dampPrecision ?? this.$options.dampPrecision;\n\n updateProps(this.__props, dampFactor, dampPrecision, 'x');\n updateProps(this.__props, dampFactor, dampPrecision, 'y');\n\n if (\n this.__props.dampedCurrent.x === this.__props.current.x &&\n this.__props.dampedCurrent.y === this.__props.current.y\n ) {\n this.$services.disable('ticked');\n }\n\n render();\n },\n };\n\n this.$on('before-mounted', () => {\n this.$on('resized', delegate);\n this.$on('scrolled', delegate);\n this.$on('ticked', delegate);\n });\n\n this.$on('mounted', () => {\n this.__setProps();\n });\n\n this.$on('destroyed', () => {\n this.$off('resized', delegate);\n this.$off('scrolled', delegate);\n this.$off('ticked', delegate);\n\n // Clamp damped values to their final value and trigger one last render on destroy\n this.__props.dampedCurrent.x = this.__props.current.x;\n this.__props.dampedCurrent.y = this.__props.current.y;\n this.__props.dampedProgress.x = this.__props.progress.x;\n this.__props.dampedProgress.y = this.__props.progress.y;\n render();\n });\n }\n\n /**\n * Mounted hook.\n */\n mounted() {\n // @ts-ignore\n if (isFunction(super.mounted)) {\n // @ts-ignore\n super.mounted();\n }\n }\n\n /**\n * Resized hook.\n */\n resized(props: ResizeServiceProps) {\n // @ts-ignore\n if (isFunction(super.resized)) {\n // @ts-ignore\n super.resized(props);\n }\n }\n\n /**\n * Scrolled hook.\n */\n scrolled(props: ScrollServiceProps) {\n // @ts-ignore\n if (isFunction(super.scrolled)) {\n // @ts-ignore\n super.scrolled(props);\n }\n }\n\n /**\n * Ticked hook.\n */\n ticked(props: RafServiceProps) {\n // @ts-ignore\n if (isFunction(super.ticked)) {\n // @ts-ignore\n super.ticked(props);\n }\n }\n\n /**\n * Destroyed hook.\n */\n destroyed() {\n // @ts-ignore\n if (isFunction(super.destroyed)) {\n // @ts-ignore\n super.destroyed();\n }\n }\n\n /**\n * Set the decorator props.\n */\n __setProps() {\n const targetSizes = options.useOffsetSizes\n ? getOffsetSizes(this.$el)\n : this.$el.getBoundingClientRect();\n\n targetSizes.y += window.pageYOffset;\n targetSizes.x += window.pageXOffset;\n\n const containerSizes = {\n x: 0,\n y: 0,\n height: window.innerHeight,\n width: window.innerWidth,\n };\n\n const offset = normalizeOffset(this.$options.offset);\n\n // Y axis\n const [yStart, yEnd] = getEdges('y', targetSizes, containerSizes, offset);\n const yCurrent = clamp(window.pageYOffset, yStart, yEnd);\n const yProgress = clamp01((yCurrent - yStart) / (yEnd - yStart));\n // X axis\n const [xStart, xEnd] = getEdges('x', targetSizes, containerSizes, offset);\n const xCurrent = clamp(window.pageXOffset, xStart, xEnd);\n const xProgress = clamp01((xCurrent - xStart) / (xEnd - xStart));\n\n this.__props.start.x = xStart;\n this.__props.start.y = yStart;\n this.__props.end.x = xEnd;\n this.__props.end.y = yEnd;\n this.__props.current.x = xCurrent;\n this.__props.current.y = yCurrent;\n this.__props.dampedCurrent.x = damp(\n xCurrent,\n this.__props.dampedCurrent.x,\n this.dampFactor,\n this.dampPrecision,\n );\n this.__props.dampedCurrent.y = damp(\n yCurrent,\n this.__props.dampedCurrent.y,\n this.dampFactor,\n this.dampPrecision,\n );\n this.__props.progress.x = xProgress;\n this.__props.progress.y = yProgress;\n this.__props.dampedProgress.x = clamp01(\n (this.__props.dampedCurrent.x - xStart) / (xEnd - xStart),\n );\n this.__props.dampedProgress.y = clamp01(\n (this.__props.dampedCurrent.y - yStart) / (yEnd - yStart),\n );\n }\n }\n\n // @ts-ignore\n return WithScrolledInView;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iCAAoC;AACpC,mBAOO;AACP,IAAAA,gBAA0C;AAE1C,IAAM,gBAAY,2BAAa,CAAC,UAAU,QAAQ,CAAC;AA4CnD,SAAS,YACP,OACA,YACA,eACA,OAAkB,KACZ;AACN,QAAM,QAAQ,YAAQ;AAAA,IACpB,SAAS,MAAM,OAAO,cAAc,OAAO;AAAA,IAC3C,MAAM,MAAM;AAAA,IACZ,MAAM,IAAI;AAAA,EACZ;A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AK,aAAa,gBAAgB,MAAM;AACxE,YAAM,eAAW,oBAAM,OAAO,aAAa,QAAQ,IAAI;AACvD,YAAM,gBAAY,uBAAS,WAAW,WAAW,OAAO,OAAO;AAE/D,YAAM,CAAC,QAAQ,IAAI,QAAI,wBAAS,KAAK,aAAa,gBAAgB,MAAM;AACxE,YAAM,eAAW,oBAAM,OAAO,aAAa,QAAQ,IAAI;AACvD,YAAM,gBAAY,uBAAS,WAAW,WAAW,OAAO,OAAO;AAE/D,WAAK,QAAQ,MAAM,IAAI;AACvB,WAAK,QAAQ,MAAM,IAAI;AACvB,WAAK,QAAQ,IAAI,IAAI;AACrB,WAAK,QAAQ,IAAI,IAAI;AACrB,WAAK,QAAQ,QAAQ,IAAI;AACzB,WAAK,QAAQ,QAAQ,IAAI;AACzB,WAAK,QAAQ,cAAc,QAAI;AAAA,QAC7B;AAAA,QACA,KAAK,QAAQ,cAAc;AAAA,QAC3B,KAAK;AAAA,QACL,KAAK;AAAA,MACP;AACA,WAAK,QAAQ,cAAc,QAAI;AAAA,QAC7B;AAAA,QACA,KAAK,QAAQ,cAAc;AAAA,QAC3B,KAAK;AAAA,QACL,KAAK;AAAA,MACP;AACA,WAAK,QAAQ,SAAS,IAAI;AAC1B,WAAK,QAAQ,SAAS,IAAI;AAC1B,WAAK,QAAQ,eAAe,QAAI;AAAA,SAC7B,KAAK,QAAQ,cAAc,IAAI,WAAW,OAAO;AAAA,MACpD;AACA,WAAK,QAAQ,eAAe,QAAI;AAAA,SAC7B,KAAK,QAAQ,cAAc,IAAI,WAAW,OAAO;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAGA,SAAO;AACT;",
4
+ "sourcesContent": ["import type { BaseInterface, BaseDecorator } from '../../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../../Base/index.js';\nimport type {\n RafServiceProps,\n ScrollServiceProps,\n ResizeServiceProps,\n} from '../../services/index.js';\nimport { withMountWhenInView } from '../withMountWhenInView.js';\nimport {\n damp,\n clamp,\n clamp01,\n getOffsetSizes,\n isFunction,\n useScheduler,\n} from '../../utils/index.js';\nimport { normalizeOffset, getEdges } from './utils.js';\n\nconst scheduler = useScheduler(['update', 'render']);\n\nexport interface WithScrolledInViewProps extends BaseProps {\n $options: {\n dampFactor: number;\n dampPrecision: number;\n offset: string;\n };\n}\n\nexport type ScrollInViewProps = {\n start: {\n x: number;\n y: number;\n };\n end: {\n x: number;\n y: number;\n };\n current: {\n x: number;\n y: number;\n };\n dampedCurrent: {\n x: number;\n y: number;\n };\n progress: {\n x: number;\n y: number;\n };\n dampedProgress: {\n x: number;\n y: number;\n };\n};\n\nexport type WithScrolledInViewOptions = IntersectionObserverInit & {\n useOffsetSizes?: boolean;\n};\n\nfunction updateProgress(\n props: ScrollInViewProps,\n axis: 'x' | 'y',\n progressKey: 'progress' | 'dampedProgress',\n currentKey: 'current' | 'dampedCurrent',\n) {\n props[progressKey][axis] =\n props.start[axis] === props.end[axis]\n ? 0\n : clamp01(\n (props[currentKey][axis] - props.start[axis]) / (props.end[axis] - props.start[axis]),\n );\n}\n\n/**\n * Update props on tick.\n */\nfunction updateProps(\n props: ScrollInViewProps,\n dampFactor: number,\n dampPrecision: number,\n axis: 'x' | 'y' = 'x',\n): void {\n props.current[axis] = clamp(\n axis === 'x' ? window.pageXOffset : window.pageYOffset,\n props.start[axis],\n props.end[axis],\n );\n props.dampedCurrent[axis] = damp(\n props.current[axis],\n props.dampedCurrent[axis],\n dampFactor,\n dampPrecision,\n );\n updateProgress(props, axis, 'progress', 'current');\n updateProgress(props, axis, 'dampedProgress', 'dampedCurrent');\n}\n\nexport interface WithScrolledInViewInterface extends BaseInterface {\n /**\n * @type {ScrollInViewProps}\n */\n readonly props: ScrollInViewProps;\n dampFactor?: number;\n dampPrecision?: number;\n mounted(): void;\n resized(props: ResizeServiceProps): void;\n scrolled(props: ScrollServiceProps): void;\n ticked(props: RafServiceProps): void;\n destroyed(): void;\n}\n\n/**\n * Add scrolled in view capabilities to a component.\n */\nexport function withScrolledInView<S extends Base = Base>(\n BaseClass: typeof Base,\n options: WithScrolledInViewOptions = {},\n): BaseDecorator<WithScrolledInViewInterface, S, WithScrolledInViewProps> {\n /**\n * Class.\n */\n class WithScrolledInView<T extends BaseProps = BaseProps> extends withMountWhenInView(\n BaseClass,\n options,\n )<T & WithScrolledInViewProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: `${BaseClass.config.name}WithMountWhenInView`,\n emits: ['scrolledInView'],\n options: {\n dampFactor: {\n type: Number,\n default: 0.1,\n },\n dampPrecision: {\n type: Number,\n default: 0.001,\n },\n offset: {\n type: String,\n default: 'start end / end start',\n },\n },\n };\n\n __props: ScrollInViewProps = {\n start: {\n x: 0,\n y: 0,\n },\n end: {\n x: 0,\n y: 0,\n },\n current: {\n x: 0,\n y: 0,\n },\n dampedCurrent: {\n x: 0,\n y: 0,\n },\n progress: {\n x: 0,\n y: 0,\n },\n dampedProgress: {\n x: 0,\n y: 0,\n },\n };\n\n shouldEvaluateProps = true;\n\n get props() {\n if (this.shouldEvaluateProps) {\n this.shouldEvaluateProps = false;\n const targetSizes = options.useOffsetSizes\n ? getOffsetSizes(this.$el)\n : this.$el.getBoundingClientRect();\n\n targetSizes.y += window.pageYOffset;\n targetSizes.x += window.pageXOffset;\n\n const containerSizes = {\n x: 0,\n y: 0,\n height: window.innerHeight,\n width: window.innerWidth,\n };\n\n const offset = normalizeOffset(this.$options.offset);\n\n // Y axis\n const [yStart, yEnd] = getEdges('y', targetSizes, containerSizes, offset);\n const yCurrent = clamp(window.pageYOffset, yStart, yEnd);\n const yProgress = yStart === yEnd ? 0 : clamp01((yCurrent - yStart) / (yEnd - yStart));\n // X axis\n const [xStart, xEnd] = getEdges('x', targetSizes, containerSizes, offset);\n const xCurrent = clamp(window.pageXOffset, xStart, xEnd);\n const xProgress = xStart === xEnd ? 0 : clamp01((xCurrent - xStart) / (xEnd - xStart));\n\n this.__props.start.x = xStart;\n this.__props.start.y = yStart;\n this.__props.end.x = xEnd;\n this.__props.end.y = yEnd;\n this.__props.current.x = xCurrent;\n this.__props.current.y = yCurrent;\n this.__props.dampedCurrent.x = xCurrent;\n this.__props.dampedCurrent.y = yCurrent;\n this.__props.progress.x = xProgress;\n this.__props.progress.y = yProgress;\n this.__props.dampedProgress.x = xProgress;\n this.__props.dampedProgress.y = yProgress;\n }\n\n return this.__props;\n }\n\n /**\n * Factor used for the `dampedProgress` props.\n * @deprecated\n * @todo v3 delete in favor of option API\n */\n dampFactor?: number = null;\n\n /**\n * Precision for the `dampedProgress` props.\n * @deprecated\n * @todo v3 delete in favor of option API\n */\n dampPrecision?: number = null;\n\n /**\n * Bind listeners.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n const render = () => {\n scheduler.update(() => {\n // @ts-ignore\n const renderFn = this.__callMethod('scrolledInView', this.props);\n if (isFunction(renderFn)) {\n scheduler.render(() => {\n renderFn(this.__props);\n });\n }\n });\n };\n\n const delegate = {\n handleEvent(event) {\n delegate[event.type](event.detail[0]);\n },\n resized: () => {\n this.shouldEvaluateProps = true;\n render();\n },\n scrolled: (props) => {\n if ((!this.$services.has('ticked') && props.changed.y) || props.changed.x) {\n this.$services.enable('ticked');\n }\n },\n ticked: () => {\n const dampFactor = this.dampFactor ?? this.$options.dampFactor;\n const dampPrecision = this.dampPrecision ?? this.$options.dampPrecision;\n updateProps(this.__props, dampFactor, dampPrecision, 'x');\n updateProps(this.__props, dampFactor, dampPrecision, 'y');\n\n if (\n this.__props.dampedCurrent.x === this.__props.current.x &&\n this.__props.dampedCurrent.y === this.__props.current.y\n ) {\n this.$services.disable('ticked');\n }\n\n render();\n },\n };\n\n this.$on('before-mounted', () => {\n this.$on('resized', delegate);\n this.$on('scrolled', delegate);\n this.$on('ticked', delegate);\n });\n\n this.$on('destroyed', () => {\n this.$off('resized', delegate);\n this.$off('scrolled', delegate);\n this.$off('ticked', delegate);\n\n // Clamp damped values to their final value and trigger one last render on destroy\n this.__props.dampedCurrent.x = this.__props.current.x;\n this.__props.dampedCurrent.y = this.__props.current.y;\n this.__props.dampedProgress.x = this.__props.progress.x;\n this.__props.dampedProgress.y = this.__props.progress.y;\n render();\n });\n }\n\n /**\n * Mounted hook.\n */\n mounted() {\n // @ts-ignore\n if (isFunction(super.mounted)) {\n // @ts-ignore\n super.mounted();\n }\n }\n\n /**\n * Resized hook.\n */\n resized(props: ResizeServiceProps) {\n // @ts-ignore\n if (isFunction(super.resized)) {\n // @ts-ignore\n super.resized(props);\n }\n }\n\n /**\n * Scrolled hook.\n */\n scrolled(props: ScrollServiceProps) {\n // @ts-ignore\n if (isFunction(super.scrolled)) {\n // @ts-ignore\n super.scrolled(props);\n }\n }\n\n /**\n * Ticked hook.\n */\n ticked(props: RafServiceProps) {\n // @ts-ignore\n if (isFunction(super.ticked)) {\n // @ts-ignore\n super.ticked(props);\n }\n }\n\n /**\n * Destroyed hook.\n */\n destroyed() {\n // @ts-ignore\n if (isFunction(super.destroyed)) {\n // @ts-ignore\n super.destroyed();\n }\n }\n }\n\n // @ts-ignore\n return WithScrolledInView;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iCAAoC;AACpC,mBAOO;AACP,IAAAA,gBAA0C;AAE1C,IAAM,gBAAY,2BAAa,CAAC,UAAU,QAAQ,CAAC;AAyCnD,SAAS,eACP,OACA,MACA,aACA,YACA;AACA,QAAM,aAAa,QACjB,MAAM,MAAM,UAAU,MAAM,IAAI,QAC5B,QACA;AAAA,KACG,MAAM,YAAY,QAAQ,MAAM,MAAM,UAAU,MAAM,IAAI,QAAQ,MAAM,MAAM;AAAA,EACjF;AACR;AAKA,SAAS,YACP,OACA,YACA,eACA,OAAkB,KACZ;AACN,QAAM,QAAQ,YAAQ;AAAA,IACpB,SAAS,MAAM,OAAO,cAAc,OAAO;AAAA,IAC3C,MAAM,MAAM;AAAA,IACZ,MAAM,IAAI;AAAA,EACZ;AACA,QAAM,cAAc,YAAQ;AAAA,IAC1B,MA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,QAAQ,SAAS;AACtD,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IAKA,UAAU;AAER,cAAI,yBAAW,MAAM,OAAO,GAAG;AAE7B,cAAM,QAAQ;AAAA,MAChB;AAAA,IACF;AAAA,IAKA,QAAQ,OAA2B;AAEjC,cAAI,yBAAW,MAAM,OAAO,GAAG;AAE7B,cAAM,QAAQ,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IAKA,SAAS,OAA2B;AAElC,cAAI,yBAAW,MAAM,QAAQ,GAAG;AAE9B,cAAM,SAAS,KAAK;AAAA,MACtB;AAAA,IACF;AAAA,IAKA,OAAO,OAAwB;AAE7B,cAAI,yBAAW,MAAM,MAAM,GAAG;AAE5B,cAAM,OAAO,KAAK;AAAA,MACpB;AAAA,IACF;AAAA,IAKA,YAAY;AAEV,cAAI,yBAAW,MAAM,SAAS,GAAG;AAE/B,cAAM,UAAU;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AAGA,SAAO;AACT;",
6
6
  "names": ["import_utils"]
7
7
  }
@@ -39,10 +39,9 @@ export type WithScrolledInViewOptions = IntersectionObserverInit & {
39
39
  };
40
40
  export interface WithScrolledInViewInterface extends BaseInterface {
41
41
  /**
42
- * @private
43
42
  * @type {ScrollInViewProps}
44
43
  */
45
- __props: ScrollInViewProps;
44
+ readonly props: ScrollInViewProps;
46
45
  dampFactor?: number;
47
46
  dampPrecision?: number;
48
47
  mounted(): void;
@@ -50,10 +49,6 @@ export interface WithScrolledInViewInterface extends BaseInterface {
50
49
  scrolled(props: ScrollServiceProps): void;
51
50
  ticked(props: RafServiceProps): void;
52
51
  destroyed(): void;
53
- /**
54
- * @private
55
- */
56
- __setProps(): void;
57
52
  }
58
53
  /**
59
54
  * Add scrolled in view capabilities to a component.