@studiometa/js-toolkit 2.7.0 → 2.8.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 (98) hide show
  1. package/Base/features.cjs +1 -3
  2. package/Base/features.cjs.map +2 -2
  3. package/Base/features.d.ts +1 -1
  4. package/Base/features.js +1 -3
  5. package/Base/features.js.map +2 -2
  6. package/Base/index.d.ts +10 -10
  7. package/Base/managers/OptionsManager.d.ts +9 -9
  8. package/Base/managers/RefsManager.cjs +13 -8
  9. package/Base/managers/RefsManager.cjs.map +2 -2
  10. package/Base/managers/RefsManager.js +14 -9
  11. package/Base/managers/RefsManager.js.map +2 -2
  12. package/Base/managers/ResponsiveOptionsManager.d.ts +1 -1
  13. package/Base/managers/ServicesManager.d.ts +2 -2
  14. package/Base/types.d.ts +1 -1
  15. package/Base/utils.cjs +15 -1
  16. package/Base/utils.cjs.map +2 -2
  17. package/Base/utils.js +15 -1
  18. package/Base/utils.js.map +2 -2
  19. package/decorators/index.cjs +1 -1
  20. package/decorators/index.cjs.map +2 -2
  21. package/decorators/index.d.ts +1 -1
  22. package/decorators/index.js +1 -1
  23. package/decorators/index.js.map +1 -1
  24. package/decorators/withDrag.d.ts +1 -1
  25. package/decorators/withScrolledInView/index.cjs +22 -0
  26. package/decorators/withScrolledInView/index.cjs.map +7 -0
  27. package/decorators/withScrolledInView/index.d.ts +2 -0
  28. package/decorators/withScrolledInView/index.js +3 -0
  29. package/decorators/withScrolledInView/index.js.map +7 -0
  30. package/decorators/withScrolledInView/types.cjs +19 -0
  31. package/decorators/withScrolledInView/types.cjs.map +7 -0
  32. package/decorators/withScrolledInView/types.d.ts +2 -0
  33. package/decorators/withScrolledInView/types.js +1 -0
  34. package/decorators/withScrolledInView/types.js.map +7 -0
  35. package/decorators/withScrolledInView/utils.cjs +99 -0
  36. package/decorators/withScrolledInView/utils.cjs.map +7 -0
  37. package/decorators/withScrolledInView/utils.d.ts +17 -0
  38. package/decorators/withScrolledInView/utils.js +77 -0
  39. package/decorators/withScrolledInView/utils.js.map +7 -0
  40. package/decorators/{withScrolledInView.cjs → withScrolledInView/withScrolledInView.cjs} +21 -9
  41. package/decorators/withScrolledInView/withScrolledInView.cjs.map +7 -0
  42. package/decorators/{withScrolledInView.d.ts → withScrolledInView/withScrolledInView.d.ts} +6 -5
  43. package/decorators/{withScrolledInView.js → withScrolledInView/withScrolledInView.js} +27 -8
  44. package/decorators/withScrolledInView/withScrolledInView.js.map +7 -0
  45. package/helpers/createApp.d.ts +1 -1
  46. package/helpers/getClosestParent.cjs +3 -11
  47. package/helpers/getClosestParent.cjs.map +2 -2
  48. package/helpers/getClosestParent.js +3 -11
  49. package/helpers/getClosestParent.js.map +2 -2
  50. package/helpers/importWhenIdle.d.ts +1 -1
  51. package/package.json +2 -2
  52. package/services/drag.d.ts +2 -2
  53. package/services/index.d.ts +7 -7
  54. package/services/key.d.ts +1 -1
  55. package/services/load.d.ts +1 -1
  56. package/services/pointer.d.ts +1 -1
  57. package/services/raf.d.ts +1 -1
  58. package/services/resize.d.ts +1 -1
  59. package/services/scroll.d.ts +1 -1
  60. package/utils/css/animate.cjs +18 -1
  61. package/utils/css/animate.cjs.map +3 -3
  62. package/utils/css/animate.d.ts +6 -3
  63. package/utils/css/animate.js +18 -1
  64. package/utils/css/animate.js.map +3 -3
  65. package/utils/css/getOffsetSizes.cjs +1 -1
  66. package/utils/css/getOffsetSizes.cjs.map +1 -1
  67. package/utils/css/getOffsetSizes.js +1 -1
  68. package/utils/css/getOffsetSizes.js.map +1 -1
  69. package/utils/css/matrix.d.ts +1 -1
  70. package/utils/css/transform.d.ts +1 -1
  71. package/utils/css/transition.d.ts +2 -2
  72. package/utils/dom/ancestors.cjs +37 -0
  73. package/utils/dom/ancestors.cjs.map +7 -0
  74. package/utils/dom/ancestors.d.ts +8 -0
  75. package/utils/dom/ancestors.js +15 -0
  76. package/utils/dom/ancestors.js.map +7 -0
  77. package/utils/dom/index.cjs +21 -0
  78. package/utils/dom/index.cjs.map +7 -0
  79. package/utils/dom/index.d.ts +1 -0
  80. package/utils/dom/index.js +2 -0
  81. package/utils/dom/index.js.map +7 -0
  82. package/utils/index.cjs +1 -0
  83. package/utils/index.cjs.map +2 -2
  84. package/utils/index.d.ts +1 -0
  85. package/utils/index.js +1 -0
  86. package/utils/index.js.map +2 -2
  87. package/utils/is.cjs +1 -1
  88. package/utils/is.cjs.map +2 -2
  89. package/utils/is.js +1 -1
  90. package/utils/is.js.map +2 -2
  91. package/utils/math/createEases.d.ts +1 -1
  92. package/utils/tween.cjs +3 -2
  93. package/utils/tween.cjs.map +2 -2
  94. package/utils/tween.d.ts +2 -1
  95. package/utils/tween.js +3 -2
  96. package/utils/tween.js.map +2 -2
  97. package/decorators/withScrolledInView.cjs.map +0 -7
  98. package/decorators/withScrolledInView.js.map +0 -7
package/Base/features.cjs CHANGED
@@ -22,8 +22,6 @@ __export(features_exports, {
22
22
  features: () => features
23
23
  });
24
24
  module.exports = __toCommonJS(features_exports);
25
- var features = /* @__PURE__ */ new Map([
26
- ["asyncChildren", false]
27
- ]);
25
+ var features = /* @__PURE__ */ new Map([["asyncChildren", false]]);
28
26
  if (module.exports.default) module.exports = module.exports.default;
29
27
  //# sourceMappingURL=features.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/Base/features.ts"],
4
- "sourcesContent": ["export type Features = Record<'asyncChildren', boolean>;\n\nexport const features = new Map<keyof Features, boolean>([\n ['asyncChildren', false],\n]);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,WAAW,oBAAI,IAA6B;AAAA,EACvD,CAAC,iBAAiB,KAAK;AACzB,CAAC;",
4
+ "sourcesContent": ["export type Features = Record<'asyncChildren', boolean>;\n\nexport const features = new Map<keyof Features, boolean>([['asyncChildren', false]]);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,WAAW,oBAAI,IAA6B,CAAC,CAAC,iBAAiB,KAAK,CAAC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- export declare type Features = Record<'asyncChildren', boolean>;
1
+ export type Features = Record<'asyncChildren', boolean>;
2
2
  export declare const features: Map<"asyncChildren", boolean>;
package/Base/features.js CHANGED
@@ -1,6 +1,4 @@
1
- const features = /* @__PURE__ */ new Map([
2
- ["asyncChildren", false]
3
- ]);
1
+ const features = /* @__PURE__ */ new Map([["asyncChildren", false]]);
4
2
  export {
5
3
  features
6
4
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/Base/features.ts"],
4
- "sourcesContent": ["export type Features = Record<'asyncChildren', boolean>;\n\nexport const features = new Map<keyof Features, boolean>([\n ['asyncChildren', false],\n]);\n"],
5
- "mappings": "AAEO,MAAM,WAAW,oBAAI,IAA6B;AAAA,EACvD,CAAC,iBAAiB,KAAK;AACzB,CAAC;",
4
+ "sourcesContent": ["export type Features = Record<'asyncChildren', boolean>;\n\nexport const features = new Map<keyof Features, boolean>([['asyncChildren', false]]);\n"],
5
+ "mappings": "AAEO,MAAM,WAAW,oBAAI,IAA6B,CAAC,CAAC,iBAAiB,KAAK,CAAC,CAAC;",
6
6
  "names": []
7
7
  }
package/Base/index.d.ts CHANGED
@@ -1,27 +1,27 @@
1
1
  import { ChildrenManager, RefsManager, ServicesManager, EventsManager, OptionsManager } from './managers/index.js';
2
- export declare type BaseEl = HTMLElement & {
2
+ export type BaseEl = HTMLElement & {
3
3
  __base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
4
4
  };
5
- export declare type BaseConstructor<T extends Base = Base> = {
5
+ export type BaseConstructor<T extends Base = Base> = {
6
6
  new (...args: any[]): T;
7
7
  prototype: Base;
8
8
  } & Pick<typeof Base, keyof typeof Base>;
9
- export declare type BaseAsyncConstructor<T extends Base = Base> = (Base: any) => Promise<BaseConstructor<T> | {
9
+ export type BaseAsyncConstructor<T extends Base = Base> = (Base: any) => Promise<BaseConstructor<T> | {
10
10
  default: BaseConstructor<T>;
11
11
  }>;
12
- export declare type BaseOptions = {
12
+ export type BaseOptions = {
13
13
  [name: string]: unknown;
14
14
  };
15
- export declare type BaseRefs = {
15
+ export type BaseRefs = {
16
16
  [name: string]: HTMLElement | HTMLElement[];
17
17
  };
18
- export declare type BaseChildren = {
18
+ export type BaseChildren = {
19
19
  [nameOrSelector: string]: Base[] | Promise<Base>[];
20
20
  };
21
- export declare type BaseConfigComponents = {
21
+ export type BaseConfigComponents = {
22
22
  [nameOrSelector: string]: BaseConstructor | BaseAsyncConstructor;
23
23
  };
24
- export declare type BaseConfig = {
24
+ export type BaseConfig = {
25
25
  name: string;
26
26
  debug?: boolean;
27
27
  log?: boolean;
@@ -30,14 +30,14 @@ export declare type BaseConfig = {
30
30
  components?: BaseConfigComponents;
31
31
  options?: import('./managers/OptionsManager').OptionsSchema;
32
32
  };
33
- export declare type BaseProps = {
33
+ export type BaseProps = {
34
34
  $el?: HTMLElement;
35
35
  $options?: BaseOptions;
36
36
  $refs?: BaseRefs;
37
37
  $children?: BaseChildren;
38
38
  $parent?: Base;
39
39
  };
40
- export declare type Managers = {
40
+ export type Managers = {
41
41
  ChildrenManager: typeof ChildrenManager;
42
42
  EventsManager: typeof EventsManager;
43
43
  OptionsManager: typeof OptionsManager;
@@ -1,34 +1,34 @@
1
1
  import type { Options as DeepmergeOptions } from 'deepmerge';
2
2
  import { AbstractManager } from './AbstractManager.js';
3
3
  import type { Base } from '../index.js';
4
- declare type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
5
- declare type ArrayOption = {
4
+ type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
5
+ type ArrayOption = {
6
6
  type: ArrayConstructor;
7
7
  default?: () => unknown[];
8
8
  merge?: boolean | DeepmergeOptions;
9
9
  };
10
- declare type ObjectOption = {
10
+ type ObjectOption = {
11
11
  type: ObjectConstructor;
12
12
  default?: () => unknown;
13
13
  merge?: boolean | DeepmergeOptions;
14
14
  };
15
- declare type StringOption = {
15
+ type StringOption = {
16
16
  type: StringConstructor;
17
17
  default?: string;
18
18
  };
19
- declare type NumberOption = {
19
+ type NumberOption = {
20
20
  type: NumberConstructor;
21
21
  default?: number;
22
22
  };
23
- declare type BooleanOption = {
23
+ type BooleanOption = {
24
24
  type: BooleanConstructor;
25
25
  default?: boolean;
26
26
  };
27
- export declare type OptionObject = ArrayOption | ObjectOption | StringOption | NumberOption | BooleanOption;
28
- export declare type OptionsSchema = {
27
+ export type OptionObject = ArrayOption | ObjectOption | StringOption | NumberOption | BooleanOption;
28
+ export type OptionsSchema = {
29
29
  [name: string]: OptionType | OptionObject;
30
30
  };
31
- export declare type OptionsInterface = {
31
+ export type OptionsInterface = {
32
32
  [optionName: string]: unknown;
33
33
  };
34
34
  /**
@@ -29,19 +29,24 @@ var NORMALIZE_REF_NAME_REGEX = /\[\]$/;
29
29
  function normalizeRefName(name) {
30
30
  return name.endsWith("[]") ? name.replace(NORMALIZE_REF_NAME_REGEX, "") : name;
31
31
  }
32
- function __filterRefsBelongingToInstance(that, ref) {
33
- let ancestor = ref.parentElement;
34
- while (ancestor && !(0, import_utils.isDefined)(ancestor.dataset.component)) {
35
- ancestor = ancestor.parentElement;
36
- }
37
- return ancestor === null || ancestor === that.__element;
32
+ function refBelongToInstance(ref, rootElement, name) {
33
+ const isPrefixed = ref.dataset.ref.startsWith(name);
34
+ const firstComponentAncestor = (0, import_utils.getAncestorWhereUntil)(
35
+ ref,
36
+ (el) => el && (isPrefixed ? el.dataset.component === name && el : (0, import_utils.isDefined)(el.dataset.component)) && el !== rootElement,
37
+ (el) => el === rootElement
38
+ );
39
+ return firstComponentAncestor === rootElement;
38
40
  }
39
41
  function __register(that, refName) {
40
42
  const isMultiple = refName.endsWith("[]");
41
43
  const propName = normalizeRefName(refName);
44
+ const { name } = that.__base.$options;
42
45
  const refs = Array.from(
43
- that.__element.querySelectorAll(`[data-ref="${refName}"]`)
44
- ).filter((ref) => __filterRefsBelongingToInstance(that, ref));
46
+ that.__element.querySelectorAll(
47
+ `[data-ref="${refName}"],[data-ref="${name}.${refName}"]`
48
+ )
49
+ ).filter((ref) => refBelongToInstance(ref, that.__element, name));
45
50
  if (import_utils.isDev && !isMultiple && refs.length > 1) {
46
51
  console.warn(
47
52
  `[${that.__base.$options.name}]`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/RefsManager.ts"],
4
- "sourcesContent": ["import { AbstractManager } from './AbstractManager.js';\nimport { isDev, isArray, isDefined } from '../../utils/index.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\n/**\n * Normalize the name of ref.\n */\nexport function normalizeRefName(name: string) {\n return name.endsWith('[]') ? name.replace(NORMALIZE_REF_NAME_REGEX, '') : name;\n}\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction __filterRefsBelongingToInstance(that: RefsManager, ref: HTMLElement) {\n let ancestor = ref.parentElement;\n\n while (ancestor && !isDefined(ancestor.dataset.component)) {\n ancestor = ancestor.parentElement;\n }\n\n return ancestor === null || ancestor === that.__element;\n}\n\n/**\n * Register one ref.\n *\n * @param {RefsManager} that\n * @param {string} refName The ref name.\n * @private\n */\nfunction __register(that: RefsManager, refName: string) {\n const isMultiple = refName.endsWith('[]');\n const propName = normalizeRefName(refName);\n\n const refs = Array.from(\n that.__element.querySelectorAll<HTMLElement>(`[data-ref=\"${refName}\"]`),\n ).filter((ref) => __filterRefsBelongingToInstance(that, ref));\n\n if (isDev && !isMultiple && refs.length > 1) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref has been found multiple times.`,\n 'Did you forgot to add the `[]` suffix to its name?',\n );\n }\n\n if (!isMultiple && refs.length <= 1 && !isDefined(refs[0])) {\n if (isDev) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref is missing.`,\n `Is there an \\`[data-ref=\"${refName}\"]\\` element in the component's scope?`,\n );\n }\n\n return;\n }\n\n that.__eventsManager.bindRef(refName, refs);\n\n Object.defineProperty(that, propName, {\n // @todo remove usage of non-multiple refs as array\n value: isMultiple || refs.length > 1 ? refs : refs[0],\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Unregister one ref.\n */\nfunction __unregister(that: RefsManager, refName: string) {\n const propName = normalizeRefName(refName);\n const refs = isArray(that[propName]) ? that[propName] : [that[propName]];\n that.__eventsManager.unbindRef(refName, refs);\n}\n\n/**\n * Refs Manager\n *\n * @todo Use `MutationObserver` to automatically update refs?\n */\nexport class RefsManager extends AbstractManager {\n /**\n * Get refs configuration.\n */\n get __refs() {\n return this.__config.refs ?? [];\n }\n\n /**\n * Register all refs.\n */\n registerAll() {\n this.__refs.forEach((refName) => __register(this, refName));\n }\n\n /**\n * Unregister all refs.\n */\n unregisterAll() {\n this.__refs.forEach((refName) => __unregister(this, refName));\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,mBAA0C;AAE1C,IAAM,2BAA2B;AAI1B,SAAS,iBAAiB,MAAc;AAC7C,SAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,0BAA0B,EAAE,IAAI;AAC5E;AAKA,SAAS,gCAAgC,MAAmB,KAAkB;AAC5E,MAAI,WAAW,IAAI;AAEnB,SAAO,YAAY,KAAC,wBAAU,SAAS,QAAQ,SAAS,GAAG;AACzD,eAAW,SAAS;AAAA,EACtB;AAEA,SAAO,aAAa,QAAQ,aAAa,KAAK;AAChD;AASA,SAAS,WAAW,MAAmB,SAAiB;AACtD,QAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,QAAM,WAAW,iBAAiB,OAAO;AAEzC,QAAM,OAAO,MAAM;AAAA,IACjB,KAAK,UAAU,iBAA8B,cAAc,WAAW;AAAA,EACxE,EAAE,OAAO,CAAC,QAAQ,gCAAgC,MAAM,GAAG,CAAC;AAE5D,MAAI,sBAAS,CAAC,cAAc,KAAK,SAAS,GAAG;AAC3C,YAAQ;AAAA,MAEN,IAAI,KAAK,OAAO,SAAS;AAAA,MACzB,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,KAAK,UAAU,KAAK,KAAC,wBAAU,KAAK,EAAE,GAAG;AAC1D,QAAI,oBAAO;AACT,cAAQ;AAAA,QAEN,IAAI,KAAK,OAAO,SAAS;AAAA,QACzB,QAAQ;AAAA,QACR,4BAA4B;AAAA,MAC9B;AAAA,IACF;AAEA;AAAA,EACF;AAEA,OAAK,gBAAgB,QAAQ,SAAS,IAAI;AAE1C,SAAO,eAAe,MAAM,UAAU;AAAA,IAEpC,OAAO,cAAc,KAAK,SAAS,IAAI,OAAO,KAAK;AAAA,IACnD,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AACH;AAKA,SAAS,aAAa,MAAmB,SAAiB;AACxD,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,WAAO,sBAAQ,KAAK,SAAS,IAAI,KAAK,YAAY,CAAC,KAAK,SAAS;AACvE,OAAK,gBAAgB,UAAU,SAAS,IAAI;AAC9C;AAOO,IAAM,cAAN,cAA0B,uCAAgB;AAAA,EAI/C,IAAI,SAAS;AACX,WAAO,KAAK,SAAS,QAAQ,CAAC;AAAA,EAChC;AAAA,EAKA,cAAc;AACZ,SAAK,OAAO,QAAQ,CAAC,YAAY,WAAW,MAAM,OAAO,CAAC;AAAA,EAC5D;AAAA,EAKA,gBAAgB;AACd,SAAK,OAAO,QAAQ,CAAC,YAAY,aAAa,MAAM,OAAO,CAAC;AAAA,EAC9D;AACF;",
4
+ "sourcesContent": ["import { AbstractManager } from './AbstractManager.js';\nimport { isDev, isArray, isDefined, getAncestorWhereUntil } from '../../utils/index.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\n\n/**\n * Normalize the name of ref.\n */\nexport function normalizeRefName(name: string) {\n return name.endsWith('[]') ? name.replace(NORMALIZE_REF_NAME_REGEX, '') : name;\n}\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction refBelongToInstance(ref: HTMLElement, rootElement: HTMLElement, name: string) {\n const isPrefixed = ref.dataset.ref.startsWith(name);\n const firstComponentAncestor = getAncestorWhereUntil(\n ref,\n (el) =>\n el &&\n (isPrefixed ? el.dataset.component === name && el : isDefined(el.dataset.component)) &&\n el !== rootElement,\n (el) => el === rootElement,\n );\n\n return firstComponentAncestor === rootElement;\n}\n\n/**\n * Register one ref.\n *\n * @param {RefsManager} that\n * @param {string} refName The ref name.\n * @private\n */\nfunction __register(that: RefsManager, refName: string) {\n const isMultiple = refName.endsWith('[]');\n const propName = normalizeRefName(refName);\n const { name } = that.__base.$options;\n\n const refs = Array.from(\n that.__element.querySelectorAll<HTMLElement>(\n `[data-ref=\"${refName}\"],[data-ref=\"${name}.${refName}\"]`,\n ),\n ).filter((ref) => refBelongToInstance(ref, that.__element, name));\n\n if (isDev && !isMultiple && refs.length > 1) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref has been found multiple times.`,\n 'Did you forgot to add the `[]` suffix to its name?',\n );\n }\n\n if (!isMultiple && refs.length <= 1 && !isDefined(refs[0])) {\n if (isDev) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref is missing.`,\n `Is there an \\`[data-ref=\"${refName}\"]\\` element in the component's scope?`,\n );\n }\n\n return;\n }\n\n that.__eventsManager.bindRef(refName, refs);\n\n Object.defineProperty(that, propName, {\n // @todo remove usage of non-multiple refs as array\n value: isMultiple || refs.length > 1 ? refs : refs[0],\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Unregister one ref.\n */\nfunction __unregister(that: RefsManager, refName: string) {\n const propName = normalizeRefName(refName);\n const refs = isArray(that[propName]) ? that[propName] : [that[propName]];\n that.__eventsManager.unbindRef(refName, refs);\n}\n\n/**\n * Refs Manager\n *\n * @todo Use `MutationObserver` to automatically update refs?\n */\nexport class RefsManager extends AbstractManager {\n /**\n * Get refs configuration.\n */\n get __refs() {\n return this.__config.refs ?? [];\n }\n\n /**\n * Register all refs.\n */\n registerAll() {\n this.__refs.forEach((refName) => __register(this, refName));\n }\n\n /**\n * Unregister all refs.\n */\n unregisterAll() {\n this.__refs.forEach((refName) => __unregister(this, refName));\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,mBAAiE;AAEjE,IAAM,2BAA2B;AAK1B,SAAS,iBAAiB,MAAc;AAC7C,SAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,0BAA0B,EAAE,IAAI;AAC5E;AAKA,SAAS,oBAAoB,KAAkB,aAA0B,MAAc;AACrF,QAAM,aAAa,IAAI,QAAQ,IAAI,WAAW,IAAI;AAClD,QAAM,6BAAyB;AAAA,IAC7B;AAAA,IACA,CAAC,OACC,OACC,aAAa,GAAG,QAAQ,cAAc,QAAQ,SAAK,wBAAU,GAAG,QAAQ,SAAS,MAClF,OAAO;AAAA,IACT,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,2BAA2B;AACpC;AASA,SAAS,WAAW,MAAmB,SAAiB;AACtD,QAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,EAAE,KAAK,IAAI,KAAK,OAAO;AAE7B,QAAM,OAAO,MAAM;AAAA,IACjB,KAAK,UAAU;AAAA,MACb,cAAc,wBAAwB,QAAQ;AAAA,IAChD;AAAA,EACF,EAAE,OAAO,CAAC,QAAQ,oBAAoB,KAAK,KAAK,WAAW,IAAI,CAAC;AAEhE,MAAI,sBAAS,CAAC,cAAc,KAAK,SAAS,GAAG;AAC3C,YAAQ;AAAA,MAEN,IAAI,KAAK,OAAO,SAAS;AAAA,MACzB,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,KAAK,UAAU,KAAK,KAAC,wBAAU,KAAK,EAAE,GAAG;AAC1D,QAAI,oBAAO;AACT,cAAQ;AAAA,QAEN,IAAI,KAAK,OAAO,SAAS;AAAA,QACzB,QAAQ;AAAA,QACR,4BAA4B;AAAA,MAC9B;AAAA,IACF;AAEA;AAAA,EACF;AAEA,OAAK,gBAAgB,QAAQ,SAAS,IAAI;AAE1C,SAAO,eAAe,MAAM,UAAU;AAAA,IAEpC,OAAO,cAAc,KAAK,SAAS,IAAI,OAAO,KAAK;AAAA,IACnD,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AACH;AAKA,SAAS,aAAa,MAAmB,SAAiB;AACxD,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,WAAO,sBAAQ,KAAK,SAAS,IAAI,KAAK,YAAY,CAAC,KAAK,SAAS;AACvE,OAAK,gBAAgB,UAAU,SAAS,IAAI;AAC9C;AAOO,IAAM,cAAN,cAA0B,uCAAgB;AAAA,EAI/C,IAAI,SAAS;AACX,WAAO,KAAK,SAAS,QAAQ,CAAC;AAAA,EAChC;AAAA,EAKA,cAAc;AACZ,SAAK,OAAO,QAAQ,CAAC,YAAY,WAAW,MAAM,OAAO,CAAC;AAAA,EAC5D;AAAA,EAKA,gBAAgB;AACd,SAAK,OAAO,QAAQ,CAAC,YAAY,aAAa,MAAM,OAAO,CAAC;AAAA,EAC9D;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,22 +1,27 @@
1
1
  import { AbstractManager } from "./AbstractManager.js";
2
- import { isDev, isArray, isDefined } from "../../utils/index.js";
2
+ import { isDev, isArray, isDefined, getAncestorWhereUntil } from "../../utils/index.js";
3
3
  const NORMALIZE_REF_NAME_REGEX = /\[\]$/;
4
4
  function normalizeRefName(name) {
5
5
  return name.endsWith("[]") ? name.replace(NORMALIZE_REF_NAME_REGEX, "") : name;
6
6
  }
7
- function __filterRefsBelongingToInstance(that, ref) {
8
- let ancestor = ref.parentElement;
9
- while (ancestor && !isDefined(ancestor.dataset.component)) {
10
- ancestor = ancestor.parentElement;
11
- }
12
- return ancestor === null || ancestor === that.__element;
7
+ function refBelongToInstance(ref, rootElement, name) {
8
+ const isPrefixed = ref.dataset.ref.startsWith(name);
9
+ const firstComponentAncestor = getAncestorWhereUntil(
10
+ ref,
11
+ (el) => el && (isPrefixed ? el.dataset.component === name && el : isDefined(el.dataset.component)) && el !== rootElement,
12
+ (el) => el === rootElement
13
+ );
14
+ return firstComponentAncestor === rootElement;
13
15
  }
14
16
  function __register(that, refName) {
15
17
  const isMultiple = refName.endsWith("[]");
16
18
  const propName = normalizeRefName(refName);
19
+ const { name } = that.__base.$options;
17
20
  const refs = Array.from(
18
- that.__element.querySelectorAll(`[data-ref="${refName}"]`)
19
- ).filter((ref) => __filterRefsBelongingToInstance(that, ref));
21
+ that.__element.querySelectorAll(
22
+ `[data-ref="${refName}"],[data-ref="${name}.${refName}"]`
23
+ )
24
+ ).filter((ref) => refBelongToInstance(ref, that.__element, name));
20
25
  if (isDev && !isMultiple && refs.length > 1) {
21
26
  console.warn(
22
27
  `[${that.__base.$options.name}]`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/Base/managers/RefsManager.ts"],
4
- "sourcesContent": ["import { AbstractManager } from './AbstractManager.js';\nimport { isDev, isArray, isDefined } from '../../utils/index.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\n/**\n * Normalize the name of ref.\n */\nexport function normalizeRefName(name: string) {\n return name.endsWith('[]') ? name.replace(NORMALIZE_REF_NAME_REGEX, '') : name;\n}\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction __filterRefsBelongingToInstance(that: RefsManager, ref: HTMLElement) {\n let ancestor = ref.parentElement;\n\n while (ancestor && !isDefined(ancestor.dataset.component)) {\n ancestor = ancestor.parentElement;\n }\n\n return ancestor === null || ancestor === that.__element;\n}\n\n/**\n * Register one ref.\n *\n * @param {RefsManager} that\n * @param {string} refName The ref name.\n * @private\n */\nfunction __register(that: RefsManager, refName: string) {\n const isMultiple = refName.endsWith('[]');\n const propName = normalizeRefName(refName);\n\n const refs = Array.from(\n that.__element.querySelectorAll<HTMLElement>(`[data-ref=\"${refName}\"]`),\n ).filter((ref) => __filterRefsBelongingToInstance(that, ref));\n\n if (isDev && !isMultiple && refs.length > 1) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref has been found multiple times.`,\n 'Did you forgot to add the `[]` suffix to its name?',\n );\n }\n\n if (!isMultiple && refs.length <= 1 && !isDefined(refs[0])) {\n if (isDev) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref is missing.`,\n `Is there an \\`[data-ref=\"${refName}\"]\\` element in the component's scope?`,\n );\n }\n\n return;\n }\n\n that.__eventsManager.bindRef(refName, refs);\n\n Object.defineProperty(that, propName, {\n // @todo remove usage of non-multiple refs as array\n value: isMultiple || refs.length > 1 ? refs : refs[0],\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Unregister one ref.\n */\nfunction __unregister(that: RefsManager, refName: string) {\n const propName = normalizeRefName(refName);\n const refs = isArray(that[propName]) ? that[propName] : [that[propName]];\n that.__eventsManager.unbindRef(refName, refs);\n}\n\n/**\n * Refs Manager\n *\n * @todo Use `MutationObserver` to automatically update refs?\n */\nexport class RefsManager extends AbstractManager {\n /**\n * Get refs configuration.\n */\n get __refs() {\n return this.__config.refs ?? [];\n }\n\n /**\n * Register all refs.\n */\n registerAll() {\n this.__refs.forEach((refName) => __register(this, refName));\n }\n\n /**\n * Unregister all refs.\n */\n unregisterAll() {\n this.__refs.forEach((refName) => __unregister(this, refName));\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,OAAO,SAAS,iBAAiB;AAE1C,MAAM,2BAA2B;AAI1B,SAAS,iBAAiB,MAAc;AAC7C,SAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,0BAA0B,EAAE,IAAI;AAC5E;AAKA,SAAS,gCAAgC,MAAmB,KAAkB;AAC5E,MAAI,WAAW,IAAI;AAEnB,SAAO,YAAY,CAAC,UAAU,SAAS,QAAQ,SAAS,GAAG;AACzD,eAAW,SAAS;AAAA,EACtB;AAEA,SAAO,aAAa,QAAQ,aAAa,KAAK;AAChD;AASA,SAAS,WAAW,MAAmB,SAAiB;AACtD,QAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,QAAM,WAAW,iBAAiB,OAAO;AAEzC,QAAM,OAAO,MAAM;AAAA,IACjB,KAAK,UAAU,iBAA8B,cAAc,WAAW;AAAA,EACxE,EAAE,OAAO,CAAC,QAAQ,gCAAgC,MAAM,GAAG,CAAC;AAE5D,MAAI,SAAS,CAAC,cAAc,KAAK,SAAS,GAAG;AAC3C,YAAQ;AAAA,MAEN,IAAI,KAAK,OAAO,SAAS;AAAA,MACzB,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,KAAK,UAAU,KAAK,CAAC,UAAU,KAAK,EAAE,GAAG;AAC1D,QAAI,OAAO;AACT,cAAQ;AAAA,QAEN,IAAI,KAAK,OAAO,SAAS;AAAA,QACzB,QAAQ;AAAA,QACR,4BAA4B;AAAA,MAC9B;AAAA,IACF;AAEA;AAAA,EACF;AAEA,OAAK,gBAAgB,QAAQ,SAAS,IAAI;AAE1C,SAAO,eAAe,MAAM,UAAU;AAAA,IAEpC,OAAO,cAAc,KAAK,SAAS,IAAI,OAAO,KAAK;AAAA,IACnD,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AACH;AAKA,SAAS,aAAa,MAAmB,SAAiB;AACxD,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,OAAO,QAAQ,KAAK,SAAS,IAAI,KAAK,YAAY,CAAC,KAAK,SAAS;AACvE,OAAK,gBAAgB,UAAU,SAAS,IAAI;AAC9C;AAOO,MAAM,oBAAoB,gBAAgB;AAAA,EAI/C,IAAI,SAAS;AACX,WAAO,KAAK,SAAS,QAAQ,CAAC;AAAA,EAChC;AAAA,EAKA,cAAc;AACZ,SAAK,OAAO,QAAQ,CAAC,YAAY,WAAW,MAAM,OAAO,CAAC;AAAA,EAC5D;AAAA,EAKA,gBAAgB;AACd,SAAK,OAAO,QAAQ,CAAC,YAAY,aAAa,MAAM,OAAO,CAAC;AAAA,EAC9D;AACF;",
4
+ "sourcesContent": ["import { AbstractManager } from './AbstractManager.js';\nimport { isDev, isArray, isDefined, getAncestorWhereUntil } from '../../utils/index.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\n\n/**\n * Normalize the name of ref.\n */\nexport function normalizeRefName(name: string) {\n return name.endsWith('[]') ? name.replace(NORMALIZE_REF_NAME_REGEX, '') : name;\n}\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction refBelongToInstance(ref: HTMLElement, rootElement: HTMLElement, name: string) {\n const isPrefixed = ref.dataset.ref.startsWith(name);\n const firstComponentAncestor = getAncestorWhereUntil(\n ref,\n (el) =>\n el &&\n (isPrefixed ? el.dataset.component === name && el : isDefined(el.dataset.component)) &&\n el !== rootElement,\n (el) => el === rootElement,\n );\n\n return firstComponentAncestor === rootElement;\n}\n\n/**\n * Register one ref.\n *\n * @param {RefsManager} that\n * @param {string} refName The ref name.\n * @private\n */\nfunction __register(that: RefsManager, refName: string) {\n const isMultiple = refName.endsWith('[]');\n const propName = normalizeRefName(refName);\n const { name } = that.__base.$options;\n\n const refs = Array.from(\n that.__element.querySelectorAll<HTMLElement>(\n `[data-ref=\"${refName}\"],[data-ref=\"${name}.${refName}\"]`,\n ),\n ).filter((ref) => refBelongToInstance(ref, that.__element, name));\n\n if (isDev && !isMultiple && refs.length > 1) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref has been found multiple times.`,\n 'Did you forgot to add the `[]` suffix to its name?',\n );\n }\n\n if (!isMultiple && refs.length <= 1 && !isDefined(refs[0])) {\n if (isDev) {\n console.warn(\n // @ts-ignore\n `[${that.__base.$options.name}]`,\n `The \"${refName}\" ref is missing.`,\n `Is there an \\`[data-ref=\"${refName}\"]\\` element in the component's scope?`,\n );\n }\n\n return;\n }\n\n that.__eventsManager.bindRef(refName, refs);\n\n Object.defineProperty(that, propName, {\n // @todo remove usage of non-multiple refs as array\n value: isMultiple || refs.length > 1 ? refs : refs[0],\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Unregister one ref.\n */\nfunction __unregister(that: RefsManager, refName: string) {\n const propName = normalizeRefName(refName);\n const refs = isArray(that[propName]) ? that[propName] : [that[propName]];\n that.__eventsManager.unbindRef(refName, refs);\n}\n\n/**\n * Refs Manager\n *\n * @todo Use `MutationObserver` to automatically update refs?\n */\nexport class RefsManager extends AbstractManager {\n /**\n * Get refs configuration.\n */\n get __refs() {\n return this.__config.refs ?? [];\n }\n\n /**\n * Register all refs.\n */\n registerAll() {\n this.__refs.forEach((refName) => __register(this, refName));\n }\n\n /**\n * Unregister all refs.\n */\n unregisterAll() {\n this.__refs.forEach((refName) => __unregister(this, refName));\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,OAAO,SAAS,WAAW,6BAA6B;AAEjE,MAAM,2BAA2B;AAK1B,SAAS,iBAAiB,MAAc;AAC7C,SAAO,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,0BAA0B,EAAE,IAAI;AAC5E;AAKA,SAAS,oBAAoB,KAAkB,aAA0B,MAAc;AACrF,QAAM,aAAa,IAAI,QAAQ,IAAI,WAAW,IAAI;AAClD,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC,OACC,OACC,aAAa,GAAG,QAAQ,cAAc,QAAQ,KAAK,UAAU,GAAG,QAAQ,SAAS,MAClF,OAAO;AAAA,IACT,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,2BAA2B;AACpC;AASA,SAAS,WAAW,MAAmB,SAAiB;AACtD,QAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,EAAE,KAAK,IAAI,KAAK,OAAO;AAE7B,QAAM,OAAO,MAAM;AAAA,IACjB,KAAK,UAAU;AAAA,MACb,cAAc,wBAAwB,QAAQ;AAAA,IAChD;AAAA,EACF,EAAE,OAAO,CAAC,QAAQ,oBAAoB,KAAK,KAAK,WAAW,IAAI,CAAC;AAEhE,MAAI,SAAS,CAAC,cAAc,KAAK,SAAS,GAAG;AAC3C,YAAQ;AAAA,MAEN,IAAI,KAAK,OAAO,SAAS;AAAA,MACzB,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,cAAc,KAAK,UAAU,KAAK,CAAC,UAAU,KAAK,EAAE,GAAG;AAC1D,QAAI,OAAO;AACT,cAAQ;AAAA,QAEN,IAAI,KAAK,OAAO,SAAS;AAAA,QACzB,QAAQ;AAAA,QACR,4BAA4B;AAAA,MAC9B;AAAA,IACF;AAEA;AAAA,EACF;AAEA,OAAK,gBAAgB,QAAQ,SAAS,IAAI;AAE1C,SAAO,eAAe,MAAM,UAAU;AAAA,IAEpC,OAAO,cAAc,KAAK,SAAS,IAAI,OAAO,KAAK;AAAA,IACnD,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AACH;AAKA,SAAS,aAAa,MAAmB,SAAiB;AACxD,QAAM,WAAW,iBAAiB,OAAO;AACzC,QAAM,OAAO,QAAQ,KAAK,SAAS,IAAI,KAAK,YAAY,CAAC,KAAK,SAAS;AACvE,OAAK,gBAAgB,UAAU,SAAS,IAAI;AAC9C;AAOO,MAAM,oBAAoB,gBAAgB;AAAA,EAI/C,IAAI,SAAS;AACX,WAAO,KAAK,SAAS,QAAQ,CAAC;AAAA,EAChC;AAAA,EAKA,cAAc;AACZ,SAAK,OAAO,QAAQ,CAAC,YAAY,WAAW,MAAM,OAAO,CAAC;AAAA,EAC5D;AAAA,EAKA,gBAAgB;AACd,SAAK,OAAO,QAAQ,CAAC,YAAY,aAAa,MAAM,OAAO,CAAC;AAAA,EAC9D;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { OptionsManager } from './OptionsManager.js';
2
2
  import type { OptionObject } from './OptionsManager.js';
3
- export declare type ResponsiveOptionObject = OptionObject & {
3
+ export type ResponsiveOptionObject = OptionObject & {
4
4
  responsive?: boolean;
5
5
  };
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { usePointer, useRaf, useResize, useScroll, useKey, useLoad } from '../../services/index.js';
2
2
  import type { PointerServiceInterface, RafServiceInterface, ResizeServiceInterface, ScrollServiceInterface, KeyServiceInterface, LoadServiceInterface, ServiceInterface } from '../../services/index.js';
3
3
  import { AbstractManager } from './AbstractManager.js';
4
- declare type Services = {
4
+ type Services = {
5
5
  scrolled: ScrollServiceInterface;
6
6
  resized: ResizeServiceInterface;
7
7
  ticked: RafServiceInterface;
@@ -9,7 +9,7 @@ declare type Services = {
9
9
  keyed: KeyServiceInterface;
10
10
  loaded: LoadServiceInterface;
11
11
  } & Record<string, ServiceInterface<unknown>>;
12
- declare type ServiceNames = keyof Services;
12
+ type ServiceNames = keyof Services;
13
13
  /**
14
14
  * Services management for the Base class.
15
15
  *
package/Base/types.d.ts CHANGED
@@ -42,6 +42,6 @@ export interface BaseInterface {
42
42
  */
43
43
  scrolled?(props: ScrollServiceProps): void;
44
44
  }
45
- export declare type BaseDecorator<S extends BaseInterface, T extends Base, U extends BaseProps = BaseProps> = {
45
+ export type BaseDecorator<S extends BaseInterface, T extends Base, U extends BaseProps = BaseProps> = {
46
46
  new <W extends BaseProps = BaseProps>(...args: unknown[]): S & T & Base<W & U>;
47
47
  } & Partial<Pick<T, keyof T>> & Pick<typeof Base, keyof typeof Base>;
package/Base/utils.cjs CHANGED
@@ -26,8 +26,22 @@ __export(utils_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(utils_exports);
28
28
  var import_utils = require("../utils/index.cjs");
29
+ var selectors = /* @__PURE__ */ new Map();
30
+ var separator = " ";
31
+ function getSelector(nameOrSelector) {
32
+ if (!selectors.has(nameOrSelector)) {
33
+ const parts = [
34
+ `[data-component="${nameOrSelector}"]`,
35
+ `[data-component*="${separator}${nameOrSelector}${separator}"]`,
36
+ `[data-component$="${separator}${nameOrSelector}"]`,
37
+ `[data-component^="${nameOrSelector}${separator}"]`
38
+ ];
39
+ selectors.set(nameOrSelector, parts.join(","));
40
+ }
41
+ return selectors.get(nameOrSelector);
42
+ }
29
43
  function getComponentElements(nameOrSelector, element = document) {
30
- const selector = `[data-component="${nameOrSelector}"]`;
44
+ const selector = getSelector(nameOrSelector);
31
45
  let elements = [];
32
46
  try {
33
47
  elements = Array.from(element.querySelectorAll(selector));
@@ -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\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 = `[data-component=\"${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;AAanC,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,oBAAoB;AACrC,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 } 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;",
6
6
  "names": []
7
7
  }
package/Base/utils.js CHANGED
@@ -1,6 +1,20 @@
1
1
  import { isArray, isDefined, isDev } from "../utils/index.js";
2
+ const selectors = /* @__PURE__ */ new Map();
3
+ const separator = " ";
4
+ function getSelector(nameOrSelector) {
5
+ if (!selectors.has(nameOrSelector)) {
6
+ const parts = [
7
+ `[data-component="${nameOrSelector}"]`,
8
+ `[data-component*="${separator}${nameOrSelector}${separator}"]`,
9
+ `[data-component$="${separator}${nameOrSelector}"]`,
10
+ `[data-component^="${nameOrSelector}${separator}"]`
11
+ ];
12
+ selectors.set(nameOrSelector, parts.join(","));
13
+ }
14
+ return selectors.get(nameOrSelector);
15
+ }
2
16
  function getComponentElements(nameOrSelector, element = document) {
3
- const selector = `[data-component="${nameOrSelector}"]`;
17
+ const selector = getSelector(nameOrSelector);
4
18
  let elements = [];
5
19
  try {
6
20
  elements = Array.from(element.querySelectorAll(selector));
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\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 = `[data-component=\"${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;AAanC,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,oBAAoB;AACrC,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 } 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;",
6
6
  "names": []
7
7
  }
@@ -24,7 +24,7 @@ __reExport(decorators_exports, require("./withFreezedOptions.cjs"), module.expor
24
24
  __reExport(decorators_exports, require("./withIntersectionObserver.cjs"), module.exports);
25
25
  __reExport(decorators_exports, require("./withMountWhenInView.cjs"), module.exports);
26
26
  __reExport(decorators_exports, require("./withResponsiveOptions.cjs"), module.exports);
27
- __reExport(decorators_exports, require("./withScrolledInView.cjs"), module.exports);
27
+ __reExport(decorators_exports, require("./withScrolledInView/index.cjs"), module.exports);
28
28
  __reExport(decorators_exports, require("./withVue2.cjs"), module.exports);
29
29
  if (module.exports.default) module.exports = module.exports.default;
30
30
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/decorators/index.ts"],
4
- "sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountWhenInView.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView.js';\nexport * from './withVue2.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,wCAAd;AACA,+BAAc,yCADd;AAEA,+BAAc,2BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,qCAJd;AAKA,+BAAc,2CALd;AAMA,+BAAc,sCANd;AAOA,+BAAc,wCAPd;AAQA,+BAAc,qCARd;AASA,+BAAc,2BATd;",
4
+ "sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountWhenInView.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView/index.js';\nexport * from './withVue2.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,wCAAd;AACA,+BAAc,yCADd;AAEA,+BAAc,2BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,qCAJd;AAKA,+BAAc,2CALd;AAMA,+BAAc,sCANd;AAOA,+BAAc,wCAPd;AAQA,+BAAc,2CARd;AASA,+BAAc,2BATd;",
6
6
  "names": []
7
7
  }
@@ -6,5 +6,5 @@ export * from './withFreezedOptions.js';
6
6
  export * from './withIntersectionObserver.js';
7
7
  export * from './withMountWhenInView.js';
8
8
  export * from './withResponsiveOptions.js';
9
- export * from './withScrolledInView.js';
9
+ export * from './withScrolledInView/index.js';
10
10
  export * from './withVue2.js';
@@ -6,6 +6,6 @@ export * from "./withFreezedOptions.js";
6
6
  export * from "./withIntersectionObserver.js";
7
7
  export * from "./withMountWhenInView.js";
8
8
  export * from "./withResponsiveOptions.js";
9
- export * from "./withScrolledInView.js";
9
+ export * from "./withScrolledInView/index.js";
10
10
  export * from "./withVue2.js";
11
11
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/decorators/index.ts"],
4
- "sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountWhenInView.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView.js';\nexport * from './withVue2.js';\n"],
4
+ "sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountWhenInView.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView/index.js';\nexport * from './withVue2.js';\n"],
5
5
  "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import type { BaseDecorator, BaseInterface } from '../Base/types.js';
2
2
  import type { Base } from '../Base/index.js';
3
3
  import type { DragServiceOptions, DragServiceProps } from '../services/drag.js';
4
- export declare type DragDecoratorOptions = DragServiceOptions & {
4
+ export type DragDecoratorOptions = DragServiceOptions & {
5
5
  target?: (this: Base, instance: Base) => HTMLElement;
6
6
  };
7
7
  export interface WithDragInterface extends BaseInterface {
@@ -0,0 +1,22 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/js-toolkit/decorators/withScrolledInView/index.ts
17
+ var withScrolledInView_exports = {};
18
+ module.exports = __toCommonJS(withScrolledInView_exports);
19
+ __reExport(withScrolledInView_exports, require("./withScrolledInView.cjs"), module.exports);
20
+ __reExport(withScrolledInView_exports, require("./types.cjs"), module.exports);
21
+ if (module.exports.default) module.exports = module.exports.default;
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/decorators/withScrolledInView/index.ts"],
4
+ "sourcesContent": ["export * from './withScrolledInView.js';\nexport * from './types.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uCAAc,qCAAd;AACA,uCAAc,wBADd;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './withScrolledInView.js';
2
+ export * from './types.js';
@@ -0,0 +1,3 @@
1
+ export * from "./withScrolledInView.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/decorators/withScrolledInView/index.ts"],
4
+ "sourcesContent": ["export * from './withScrolledInView.js';\nexport * from './types.js';\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // packages/js-toolkit/decorators/withScrolledInView/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
18
+ if (module.exports.default) module.exports = module.exports.default;
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/decorators/withScrolledInView/types.ts"],
4
+ "sourcesContent": ["export type OffsetValue = 'start' | 'center' | 'end' | string | number;\n\nexport type NormalizedOffset = [[OffsetValue, OffsetValue], [OffsetValue, OffsetValue]];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export type OffsetValue = 'start' | 'center' | 'end' | string | number;
2
+ export type NormalizedOffset = [[OffsetValue, OffsetValue], [OffsetValue, OffsetValue]];
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }