@studiometa/js-toolkit 3.0.0-beta.0 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/Base.d.ts +19 -10
- package/Base/Base.js +46 -36
- package/Base/Base.js.map +2 -2
- package/Base/managers/AbstractManager.d.ts +3 -8
- package/Base/managers/AbstractManager.js +4 -22
- package/Base/managers/AbstractManager.js.map +2 -2
- package/Base/managers/ChildrenManager.d.ts +25 -2
- package/Base/managers/ChildrenManager.js +79 -63
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.js +3 -11
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/OptionsManager.d.ts +16 -11
- package/Base/managers/OptionsManager.js +38 -40
- package/Base/managers/OptionsManager.js.map +2 -2
- package/Base/managers/RefsManager.d.ts +11 -1
- package/Base/managers/RefsManager.js +48 -36
- package/Base/managers/RefsManager.js.map +2 -2
- package/Base/managers/ResponsiveOptionsManager.d.ts +9 -1
- package/Base/managers/ResponsiveOptionsManager.js +30 -23
- package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
- package/Base/managers/ServicesManager.d.ts +12 -13
- package/Base/managers/ServicesManager.js +16 -22
- package/Base/managers/ServicesManager.js.map +2 -2
- package/Base/utils.js.map +2 -2
- package/package.json +1 -1
- package/services/AbstractService.d.ts +1 -1
- package/services/AbstractService.js +1 -2
- package/services/AbstractService.js.map +2 -2
- package/services/DragService.js +1 -1
- package/services/DragService.js.map +2 -2
- package/services/KeyService.js +1 -1
- package/services/KeyService.js.map +2 -2
- package/services/LoadService.js +1 -1
- package/services/LoadService.js.map +2 -2
- package/services/PointerService.js +1 -1
- package/services/PointerService.js.map +2 -2
- package/services/ResizeService.js +1 -1
- package/services/ResizeService.js.map +2 -2
- package/services/ScrollService.js +1 -1
- package/services/ScrollService.js.map +2 -2
- package/utils/math/clamp.js.map +2 -2
- package/utils/math/createEases.js.map +2 -2
- package/utils/nextFrame.js.map +2 -2
|
@@ -31,43 +31,10 @@ function refBelongToInstance(ref, rootElement, name) {
|
|
|
31
31
|
);
|
|
32
32
|
return firstComponentAncestor === rootElement;
|
|
33
33
|
}
|
|
34
|
-
function __register(that, refName) {
|
|
35
|
-
const isMultiple = endsWith(refName, "[]");
|
|
36
|
-
const propName = normalizeRefName(refName);
|
|
37
|
-
const { name } = that.__base.$options;
|
|
38
|
-
const attributes = features.get("attributes");
|
|
39
|
-
const refs = [];
|
|
40
|
-
const selector = `[${attributes.ref}="${refName}"],[${attributes.ref}="${name}.${refName}"]`;
|
|
41
|
-
for (const ref of that.__element.querySelectorAll(selector)) {
|
|
42
|
-
if (refBelongToInstance(ref, that.__element, name)) {
|
|
43
|
-
refs.push(ref);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (isDev && !isMultiple && refs.length > 1) {
|
|
47
|
-
console.warn(
|
|
48
|
-
`[${that.__base.$id}]`,
|
|
49
|
-
`The "${refName}" ref has been found multiple times.`,
|
|
50
|
-
"Did you forgot to add the `[]` suffix to its name?"
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (refs.length) {
|
|
54
|
-
that.__eventsManager.bindRef(refName, refs);
|
|
55
|
-
}
|
|
56
|
-
Object.defineProperty(that, camelCase(propName), {
|
|
57
|
-
// @todo remove usage of non-multiple refs as array
|
|
58
|
-
value: isMultiple || refs.length > 1 ? refs : refs[0],
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function __unregister(that, refName) {
|
|
64
|
-
const propName = normalizeRefName(refName);
|
|
65
|
-
const refs = isArray(that[propName]) ? that[propName] : [that[propName]];
|
|
66
|
-
that.__eventsManager.unbindRef(refName, refs);
|
|
67
|
-
}
|
|
68
34
|
class RefsManager extends AbstractManager {
|
|
69
35
|
/**
|
|
70
36
|
* Get refs configuration.
|
|
37
|
+
* @private
|
|
71
38
|
*/
|
|
72
39
|
get __refs() {
|
|
73
40
|
return this.__config.refs ?? [];
|
|
@@ -76,13 +43,58 @@ class RefsManager extends AbstractManager {
|
|
|
76
43
|
* Register all refs.
|
|
77
44
|
*/
|
|
78
45
|
registerAll() {
|
|
79
|
-
for (const refName of this.__refs)
|
|
46
|
+
for (const refName of this.__refs) {
|
|
47
|
+
this.__register(refName);
|
|
48
|
+
}
|
|
80
49
|
}
|
|
81
50
|
/**
|
|
82
51
|
* Unregister all refs.
|
|
83
52
|
*/
|
|
84
53
|
unregisterAll() {
|
|
85
|
-
for (const refName of this.__refs)
|
|
54
|
+
for (const refName of this.__refs) {
|
|
55
|
+
this.__unregister(refName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register one ref.
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
__register(refName) {
|
|
63
|
+
const isMultiple = endsWith(refName, "[]");
|
|
64
|
+
const propName = normalizeRefName(refName);
|
|
65
|
+
const { name } = this.__base.__config;
|
|
66
|
+
const attributes = features.get("attributes");
|
|
67
|
+
const refs = [];
|
|
68
|
+
const selector = `[${attributes.ref}="${refName}"],[${attributes.ref}="${name}.${refName}"]`;
|
|
69
|
+
for (const ref of this.__element.querySelectorAll(selector)) {
|
|
70
|
+
if (refBelongToInstance(ref, this.__element, name)) {
|
|
71
|
+
refs.push(ref);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (isDev && !isMultiple && refs.length > 1) {
|
|
75
|
+
console.warn(
|
|
76
|
+
`[${this.__base.$id}]`,
|
|
77
|
+
`The "${refName}" ref has been found multiple times.`,
|
|
78
|
+
"Did you forgot to add the `[]` suffix to its name?"
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (refs.length) {
|
|
82
|
+
this.__eventsManager.bindRef(refName, refs);
|
|
83
|
+
}
|
|
84
|
+
Object.defineProperty(this.props, camelCase(propName), {
|
|
85
|
+
// @todo remove usage of non-multiple refs as array
|
|
86
|
+
value: isMultiple || refs.length > 1 ? refs : refs[0],
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Unregister one ref.
|
|
93
|
+
*/
|
|
94
|
+
__unregister(refName) {
|
|
95
|
+
const propName = normalizeRefName(refName);
|
|
96
|
+
const refs = this.props[propName];
|
|
97
|
+
this.__eventsManager.unbindRef(refName, isArray(refs) ? refs : [refs]);
|
|
86
98
|
}
|
|
87
99
|
}
|
|
88
100
|
export {
|
|
@@ -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 {\n isDev,\n isArray,\n getAncestorWhereUntil,\n endsWith,\n startsWith,\n memo,\n camelCase,\n} from '../../utils/index.js';\nimport { features } from '../features.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\nconst NAMESPACED_REF_REGEX = /^(.*\\.)/;\n\n/**\n * Normalize the name of ref.\n */\nexport const normalizeRefName = memo(function normalizeRefName(name: string) {\n let normalizedName = name;\n\n if (endsWith(name, '[]')) {\n normalizedName = normalizedName.replace(NORMALIZE_REF_NAME_REGEX, '');\n }\n\n if (normalizedName.includes('.')) {\n return normalizedName.replace(NAMESPACED_REF_REGEX, '');\n }\n\n return normalizedName;\n});\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction refBelongToInstance(ref: HTMLElement, rootElement: HTMLElement, name: string) {\n const attributes = features.get('attributes');\n const isPrefixed = startsWith(ref.getAttribute(attributes.ref), name);\n const firstComponentAncestor = getAncestorWhereUntil(\n ref,\n (el) =>\n el &&\n (isPrefixed\n ? el.getAttribute(attributes.component) === name && el\n : el.getAttribute(attributes.component)) &&\n el !== rootElement,\n (el) => el === rootElement,\n );\n\n return firstComponentAncestor === rootElement;\n}\n\n/**\n *
|
|
5
|
-
"mappings": "AAAA,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AAEzB,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAKtB,MAAM,mBAAmB,KAAK,SAASA,kBAAiB,MAAc;AAC3E,MAAI,iBAAiB;AAErB,MAAI,SAAS,MAAM,IAAI,GAAG;AACxB,qBAAiB,eAAe,QAAQ,0BAA0B,EAAE;AAAA,EACtE;AAEA,MAAI,eAAe,SAAS,GAAG,GAAG;AAChC,WAAO,eAAe,QAAQ,sBAAsB,EAAE;AAAA,EACxD;AAEA,SAAO;AACT,CAAC;AAKD,SAAS,oBAAoB,KAAkB,aAA0B,MAAc;AACrF,QAAM,aAAa,SAAS,IAAI,YAAY;AAC5C,QAAM,aAAa,WAAW,IAAI,aAAa,WAAW,GAAG,GAAG,IAAI;AACpE,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC,OACC,OACC,aACG,GAAG,aAAa,WAAW,SAAS,MAAM,QAAQ,KAClD,GAAG,aAAa,WAAW,SAAS,MACxC,OAAO;AAAA,IACT,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,2BAA2B;AACpC;
|
|
4
|
+
"sourcesContent": ["import { AbstractManager } from './AbstractManager.js';\nimport {\n isDev,\n isArray,\n getAncestorWhereUntil,\n endsWith,\n startsWith,\n memo,\n camelCase,\n} from '../../utils/index.js';\nimport { features } from '../features.js';\n\nconst NORMALIZE_REF_NAME_REGEX = /\\[\\]$/;\nconst NAMESPACED_REF_REGEX = /^(.*\\.)/;\n\n/**\n * Normalize the name of ref.\n */\nexport const normalizeRefName = memo(function normalizeRefName(name: string) {\n let normalizedName = name;\n\n if (endsWith(name, '[]')) {\n normalizedName = normalizedName.replace(NORMALIZE_REF_NAME_REGEX, '');\n }\n\n if (normalizedName.includes('.')) {\n return normalizedName.replace(NAMESPACED_REF_REGEX, '');\n }\n\n return normalizedName;\n});\n\n/**\n * Filter refs belonging to the related Base instance.\n */\nfunction refBelongToInstance(ref: HTMLElement, rootElement: HTMLElement, name: string) {\n const attributes = features.get('attributes');\n const isPrefixed = startsWith(ref.getAttribute(attributes.ref), name);\n const firstComponentAncestor = getAncestorWhereUntil(\n ref,\n (el) =>\n el &&\n (isPrefixed\n ? el.getAttribute(attributes.component) === name && el\n : el.getAttribute(attributes.component)) &&\n el !== rootElement,\n (el) => el === rootElement,\n );\n\n return firstComponentAncestor === rootElement;\n}\n\n/**\n * Refs Manager\n *\n * @todo Use `MutationObserver` to automatically update refs?\n */\nexport class RefsManager<T> extends AbstractManager<T> {\n /**\n * Get refs configuration.\n * @private\n */\n get __refs() {\n return this.__config.refs ?? [];\n }\n\n /**\n * Register all refs.\n */\n registerAll() {\n for (const refName of this.__refs) {\n this.__register(refName);\n }\n }\n\n /**\n * Unregister all refs.\n */\n unregisterAll() {\n for (const refName of this.__refs) {\n this.__unregister(refName);\n }\n }\n\n /**\n * Register one ref.\n * @private\n */\n __register(refName: string) {\n const isMultiple = endsWith(refName, '[]');\n const propName = normalizeRefName(refName);\n const { name } = this.__base.__config;\n const attributes = features.get('attributes');\n const refs = [] as HTMLElement[];\n const selector = `[${attributes.ref}=\"${refName}\"],[${attributes.ref}=\"${name}.${refName}\"]`;\n\n for (const ref of this.__element.querySelectorAll<HTMLElement>(selector)) {\n if (refBelongToInstance(ref, this.__element, name)) {\n refs.push(ref);\n }\n }\n\n /* v8 ignore next 7 */\n if (isDev && !isMultiple && refs.length > 1) {\n console.warn(\n `[${this.__base.$id}]`,\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 (refs.length) {\n this.__eventsManager.bindRef(refName, refs);\n }\n\n Object.defineProperty(this.props, camelCase(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 */\n __unregister(refName: string) {\n const propName = normalizeRefName(refName);\n const refs = this.props[propName];\n this.__eventsManager.unbindRef(refName, isArray(refs) ? refs : [refs]);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AAEzB,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAKtB,MAAM,mBAAmB,KAAK,SAASA,kBAAiB,MAAc;AAC3E,MAAI,iBAAiB;AAErB,MAAI,SAAS,MAAM,IAAI,GAAG;AACxB,qBAAiB,eAAe,QAAQ,0BAA0B,EAAE;AAAA,EACtE;AAEA,MAAI,eAAe,SAAS,GAAG,GAAG;AAChC,WAAO,eAAe,QAAQ,sBAAsB,EAAE;AAAA,EACxD;AAEA,SAAO;AACT,CAAC;AAKD,SAAS,oBAAoB,KAAkB,aAA0B,MAAc;AACrF,QAAM,aAAa,SAAS,IAAI,YAAY;AAC5C,QAAM,aAAa,WAAW,IAAI,aAAa,WAAW,GAAG,GAAG,IAAI;AACpE,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC,OACC,OACC,aACG,GAAG,aAAa,WAAW,SAAS,MAAM,QAAQ,KAClD,GAAG,aAAa,WAAW,SAAS,MACxC,OAAO;AAAA,IACT,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,2BAA2B;AACpC;AAOO,MAAM,oBAAuB,gBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrD,IAAI,SAAS;AACX,WAAO,KAAK,SAAS,QAAQ,CAAC;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc;AACZ,eAAW,WAAW,KAAK,QAAQ;AACjC,WAAK,WAAW,OAAO;AAAA,IACzB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAK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6,7 @@ export type ResponsiveOptionObject = OptionObject & {
|
|
|
6
6
|
/**
|
|
7
7
|
* Class options to manage options as data attributes on an HTML element.
|
|
8
8
|
*/
|
|
9
|
-
export declare class ResponsiveOptionsManager extends OptionsManager {
|
|
9
|
+
export declare class ResponsiveOptionsManager<T> extends OptionsManager<T> {
|
|
10
10
|
/**
|
|
11
11
|
* Get an option value.
|
|
12
12
|
*
|
|
@@ -23,4 +23,12 @@ export declare class ResponsiveOptionsManager extends OptionsManager {
|
|
|
23
23
|
* @param {ResponsiveOptionObject} config The option configuration.
|
|
24
24
|
*/
|
|
25
25
|
set(name: string, value: unknown, config: ResponsiveOptionObject): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the currently active responsive name of an option.
|
|
28
|
+
*
|
|
29
|
+
* @param {ResponsiveOptionsManager} that
|
|
30
|
+
* @param {string} name The default name of the option.
|
|
31
|
+
* @returns {string} The responsive name if one matches the current breakpoint, the default name otherwise.
|
|
32
|
+
*/
|
|
33
|
+
__getResponsiveName(name: string): string;
|
|
26
34
|
}
|
|
@@ -2,27 +2,6 @@ import { OptionsManager, __getPropertyName } from "./OptionsManager.js";
|
|
|
2
2
|
import { useResize } from "../../services/index.js";
|
|
3
3
|
import { isDev } from "../../utils/index.js";
|
|
4
4
|
import { features } from "../features.js";
|
|
5
|
-
function __getResponsiveName(that, name) {
|
|
6
|
-
const { breakpoint } = useResize().props();
|
|
7
|
-
if (!breakpoint) {
|
|
8
|
-
return name;
|
|
9
|
-
}
|
|
10
|
-
let responsiveName = name;
|
|
11
|
-
const propertyName = __getPropertyName(name).toLowerCase();
|
|
12
|
-
const regex = new RegExp(`${propertyName}:(.+)$`, "i");
|
|
13
|
-
const attributes = features.get("attributes");
|
|
14
|
-
const dataOptionRegExp = new RegExp(`^${attributes.option}-`);
|
|
15
|
-
for (const optionName of that.__element.getAttributeNames()) {
|
|
16
|
-
if (regex.test(optionName)) {
|
|
17
|
-
const [, breakpoints] = optionName.match(regex);
|
|
18
|
-
const isInBreakpoint = breakpoints.split(":").includes(breakpoint);
|
|
19
|
-
if (isInBreakpoint) {
|
|
20
|
-
responsiveName = optionName.replace(dataOptionRegExp, "");
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return responsiveName;
|
|
25
|
-
}
|
|
26
5
|
class ResponsiveOptionsManager extends OptionsManager {
|
|
27
6
|
/**
|
|
28
7
|
* Get an option value.
|
|
@@ -35,7 +14,7 @@ class ResponsiveOptionsManager extends OptionsManager {
|
|
|
35
14
|
if (!config.responsive) {
|
|
36
15
|
return super.get(name, config);
|
|
37
16
|
}
|
|
38
|
-
return super.get(__getResponsiveName(
|
|
17
|
+
return super.get(this.__getResponsiveName(name), config);
|
|
39
18
|
}
|
|
40
19
|
/**
|
|
41
20
|
* Set an option value.
|
|
@@ -50,8 +29,36 @@ class ResponsiveOptionsManager extends OptionsManager {
|
|
|
50
29
|
return;
|
|
51
30
|
}
|
|
52
31
|
if (isDev) {
|
|
53
|
-
console.warn(`[${this.
|
|
32
|
+
console.warn(`[${this.__base.$id}]`, "Responsive options are read-only.");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the currently active responsive name of an option.
|
|
37
|
+
*
|
|
38
|
+
* @param {ResponsiveOptionsManager} that
|
|
39
|
+
* @param {string} name The default name of the option.
|
|
40
|
+
* @returns {string} The responsive name if one matches the current breakpoint, the default name otherwise.
|
|
41
|
+
*/
|
|
42
|
+
__getResponsiveName(name) {
|
|
43
|
+
const { breakpoint } = useResize().props();
|
|
44
|
+
if (!breakpoint) {
|
|
45
|
+
return name;
|
|
46
|
+
}
|
|
47
|
+
let responsiveName = name;
|
|
48
|
+
const propertyName = __getPropertyName(name).toLowerCase();
|
|
49
|
+
const regex = new RegExp(`${propertyName}:(.+)$`, "i");
|
|
50
|
+
const attributes = features.get("attributes");
|
|
51
|
+
const dataOptionRegExp = new RegExp(`^${attributes.option}-`);
|
|
52
|
+
for (const optionName of this.__element.getAttributeNames()) {
|
|
53
|
+
if (regex.test(optionName)) {
|
|
54
|
+
const [, breakpoints] = optionName.match(regex);
|
|
55
|
+
const isInBreakpoint = breakpoints.split(":").includes(breakpoint);
|
|
56
|
+
if (isInBreakpoint) {
|
|
57
|
+
responsiveName = optionName.replace(dataOptionRegExp, "");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
54
60
|
}
|
|
61
|
+
return responsiveName;
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/Base/managers/ResponsiveOptionsManager.ts"],
|
|
4
|
-
"sourcesContent": ["import { OptionsManager, __getPropertyName } from './OptionsManager.js';\nimport type { OptionObject } from './OptionsManager.js';\nimport { useResize } from '../../services/index.js';\nimport { isDev } from '../../utils/index.js';\nimport { features } from '../features.js';\n\nexport type ResponsiveOptionObject = OptionObject & { responsive?: boolean };\n\n/**\n *
|
|
5
|
-
"mappings": "AAAA,SAAS,gBAAgB,yBAAyB;AAElD,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,gBAAgB;
|
|
4
|
+
"sourcesContent": ["import { OptionsManager, __getPropertyName } from './OptionsManager.js';\nimport type { OptionObject } from './OptionsManager.js';\nimport { useResize } from '../../services/index.js';\nimport { isDev } from '../../utils/index.js';\nimport { features } from '../features.js';\n\nexport type ResponsiveOptionObject = OptionObject & { responsive?: boolean };\n\n/**\n * Class options to manage options as data attributes on an HTML element.\n */\nexport class ResponsiveOptionsManager<T> extends OptionsManager<T> {\n /**\n * Get an option value.\n *\n * @param {string} name The option name.\n * @param {ResponsiveOptionObject} config The option configuration.\n * @returns {any}\n */\n get(name: string, config: ResponsiveOptionObject) {\n if (!config.responsive) {\n return super.get(name, config);\n }\n\n return super.get(this.__getResponsiveName(name), config);\n }\n\n /**\n * Set an option value.\n *\n * @param {string} name The option name.\n * @param {any} value The new value.\n * @param {ResponsiveOptionObject} config The option configuration.\n */\n set(name: string, value: unknown, config: ResponsiveOptionObject) {\n if (!config.responsive) {\n super.set(name, value, config);\n return;\n }\n\n if (isDev) {\n console.warn(`[${this.__base.$id}]`, 'Responsive options are read-only.');\n }\n }\n\n /**\n * Get the currently active responsive name of an option.\n *\n * @param {ResponsiveOptionsManager} that\n * @param {string} name The default name of the option.\n * @returns {string} The responsive name if one matches the current breakpoint, the default name otherwise.\n */\n __getResponsiveName(name: string) {\n const { breakpoint } = useResize().props();\n\n if (!breakpoint) {\n return name;\n }\n\n let responsiveName = name;\n const propertyName = __getPropertyName(name).toLowerCase();\n const regex = new RegExp(`${propertyName}:(.+)$`, 'i');\n const attributes = features.get('attributes');\n const dataOptionRegExp = new RegExp(`^${attributes.option}-`);\n\n for (const optionName of this.__element.getAttributeNames()) {\n if (regex.test(optionName)) {\n const [, breakpoints] = optionName.match(regex);\n const isInBreakpoint = breakpoints.split(':').includes(breakpoint);\n if (isInBreakpoint) {\n responsiveName = optionName.replace(dataOptionRegExp, '');\n }\n }\n }\n\n return responsiveName;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB,yBAAyB;AAElD,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AAOlB,MAAM,iCAAoC,eAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjE,IAAI,MAAc,QAAgC;AAChD,QAAI,CAAC,OAAO,YAAY;AACtB,aAAO,MAAM,IAAI,MAAM,MAAM;AAAA,IAC/B;AAEA,WAAO,MAAM,IAAI,KAAK,oBAAoB,IAAI,GAAG,MAAM;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAI,MAAc,OAAgB,QAAgC;AAChE,QAAI,CAAC,OAAO,YAAY;AACtB,YAAM,IAAI,MAAM,OAAO,MAAM;AAC7B;AAAA,IACF;AAEA,QAAI,OAAO;AACT,cAAQ,KAAK,IAAI,KAAK,OAAO,GAAG,KAAK,mCAAmC;AAAA,IAC1E;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,oBAAoB,MAAc;AAChC,UAAM,EAAE,WAAW,IAAI,UAAU,EAAE,MAAM;AAEzC,QAAI,CAAC,YAAY;AACf,aAAO;AAAA,IACT;AAEA,QAAI,iBAAiB;AACrB,UAAM,eAAe,kBAAkB,IAAI,EAAE,YAAY;AACzD,UAAM,QAAQ,IAAI,OAAO,GAAG,YAAY,UAAU,GAAG;AACrD,UAAM,aAAa,SAAS,IAAI,YAAY;AAC5C,UAAM,mBAAmB,IAAI,OAAO,IAAI,WAAW,MAAM,GAAG;AAE5D,eAAW,cAAc,KAAK,UAAU,kBAAkB,GAAG;AAC3D,UAAI,MAAM,KAAK,UAAU,GAAG;AAC1B,cAAM,CAAC,EAAE,WAAW,IAAI,WAAW,MAAM,KAAK;AAC9C,cAAM,iBAAiB,YAAY,MAAM,GAAG,EAAE,SAAS,UAAU;AACjE,YAAI,gBAAgB;AAClB,2BAAiB,WAAW,QAAQ,kBAAkB,EAAE;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { usePointer, useRaf, useResize, useScroll, useKey } from '../../services/index.js';
|
|
2
2
|
import type { PointerServiceInterface, RafServiceInterface, ResizeServiceInterface, ScrollServiceInterface, KeyServiceInterface, ServiceInterface } from '../../services/index.js';
|
|
3
3
|
import { AbstractManager } from './AbstractManager.js';
|
|
4
|
+
declare const SERVICES_MAP: {
|
|
5
|
+
scrolled: typeof useScroll;
|
|
6
|
+
resized: typeof useResize;
|
|
7
|
+
ticked: typeof useRaf;
|
|
8
|
+
moved: typeof usePointer;
|
|
9
|
+
keyed: typeof useKey;
|
|
10
|
+
};
|
|
4
11
|
type Services = {
|
|
5
12
|
scrolled: ScrollServiceInterface;
|
|
6
13
|
resized: ResizeServiceInterface;
|
|
@@ -8,27 +15,19 @@ type Services = {
|
|
|
8
15
|
moved: PointerServiceInterface;
|
|
9
16
|
keyed: KeyServiceInterface;
|
|
10
17
|
} & Record<string, ServiceInterface<unknown>>;
|
|
18
|
+
type ServiceProps = typeof SERVICES_MAP & Record<string, <T>() => ServiceInterface<T>>;
|
|
11
19
|
type ServiceNames = keyof Services;
|
|
12
20
|
/**
|
|
13
21
|
* Services management for the Base class.
|
|
14
22
|
*
|
|
15
23
|
* @todo Add support for disabled services on mount when the method is defined.
|
|
16
24
|
*/
|
|
17
|
-
export declare class ServicesManager extends AbstractManager {
|
|
25
|
+
export declare class ServicesManager extends AbstractManager<ServiceProps> {
|
|
18
26
|
/**
|
|
19
|
-
*
|
|
27
|
+
* Custom props
|
|
28
|
+
* @private
|
|
20
29
|
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get registered services.
|
|
24
|
-
*/
|
|
25
|
-
get __services(): {
|
|
26
|
-
scrolled: typeof useScroll;
|
|
27
|
-
resized: typeof useResize;
|
|
28
|
-
ticked: typeof useRaf;
|
|
29
|
-
moved: typeof usePointer;
|
|
30
|
-
keyed: typeof useKey;
|
|
31
|
-
};
|
|
30
|
+
__props: ServiceProps;
|
|
32
31
|
/**
|
|
33
32
|
* Test if the given service is registered.
|
|
34
33
|
*/
|
|
@@ -11,34 +11,28 @@ const SERVICES_MAP = {
|
|
|
11
11
|
const SERVICE_NAMES = Object.keys(SERVICES_MAP);
|
|
12
12
|
class ServicesManager extends AbstractManager {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Custom props
|
|
15
|
+
* @private
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
get __services() {
|
|
21
|
-
return {
|
|
22
|
-
...this.__customServices,
|
|
23
|
-
...SERVICES_MAP
|
|
24
|
-
};
|
|
25
|
-
}
|
|
17
|
+
__props = {
|
|
18
|
+
...SERVICES_MAP
|
|
19
|
+
};
|
|
26
20
|
/**
|
|
27
21
|
* Test if the given service is registered.
|
|
28
22
|
*/
|
|
29
23
|
has(service) {
|
|
30
24
|
if (!((isFunction(this.__base[service]) || // @ts-ignore
|
|
31
|
-
this.__base.__hasEvent(service)) && this.
|
|
25
|
+
this.__base.__hasEvent(service)) && this.props[service])) {
|
|
32
26
|
return false;
|
|
33
27
|
}
|
|
34
|
-
const { has } = this.
|
|
28
|
+
const { has } = this.props[service]();
|
|
35
29
|
return has(this.__base.$id);
|
|
36
30
|
}
|
|
37
31
|
/**
|
|
38
32
|
* Get a service props by name.
|
|
39
33
|
*/
|
|
40
34
|
get(service) {
|
|
41
|
-
return this.
|
|
35
|
+
return this.props[service]().props();
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
38
|
* Init the given service and bind it to the given instance.
|
|
@@ -52,11 +46,11 @@ class ServicesManager extends AbstractManager {
|
|
|
52
46
|
}
|
|
53
47
|
if (
|
|
54
48
|
// @ts-ignore
|
|
55
|
-
!(isFunction(this.__base[service]) || this.__base.__hasEvent(service)) || !this.
|
|
49
|
+
!(isFunction(this.__base[service]) || this.__base.__hasEvent(service)) || !this.props[service]
|
|
56
50
|
) {
|
|
57
51
|
return noop;
|
|
58
52
|
}
|
|
59
|
-
const serviceInstance = this.
|
|
53
|
+
const serviceInstance = this.props[service]();
|
|
60
54
|
serviceInstance.add(this.__base.$id, (...args) => this.__base.__callMethod(service, ...args));
|
|
61
55
|
return this.disable.bind(this, service);
|
|
62
56
|
}
|
|
@@ -64,7 +58,7 @@ class ServicesManager extends AbstractManager {
|
|
|
64
58
|
* Enable all services and return methods to disable them.
|
|
65
59
|
*/
|
|
66
60
|
enableAll() {
|
|
67
|
-
return Object.keys(this.
|
|
61
|
+
return Object.keys(this.props).map((serviceName) => this.enable(serviceName));
|
|
68
62
|
}
|
|
69
63
|
/**
|
|
70
64
|
* Disable all services.
|
|
@@ -72,7 +66,7 @@ class ServicesManager extends AbstractManager {
|
|
|
72
66
|
* @returns {void}
|
|
73
67
|
*/
|
|
74
68
|
disableAll() {
|
|
75
|
-
for (const serviceName of Object.keys(this.
|
|
69
|
+
for (const serviceName of Object.keys(this.props)) {
|
|
76
70
|
this.disable(serviceName);
|
|
77
71
|
}
|
|
78
72
|
}
|
|
@@ -80,10 +74,10 @@ class ServicesManager extends AbstractManager {
|
|
|
80
74
|
* Disable a service.
|
|
81
75
|
*/
|
|
82
76
|
disable(service) {
|
|
83
|
-
if (!this.
|
|
77
|
+
if (!this.props[service]) {
|
|
84
78
|
return;
|
|
85
79
|
}
|
|
86
|
-
const { remove } = this.
|
|
80
|
+
const { remove } = this.props[service]();
|
|
87
81
|
remove(this.__base.$id);
|
|
88
82
|
}
|
|
89
83
|
/**
|
|
@@ -112,7 +106,7 @@ class ServicesManager extends AbstractManager {
|
|
|
112
106
|
* The `use...` function for the service.
|
|
113
107
|
*/
|
|
114
108
|
register(name, useFunction) {
|
|
115
|
-
this.
|
|
109
|
+
this.props[name] = useFunction;
|
|
116
110
|
this.__base.__addEmits(name);
|
|
117
111
|
}
|
|
118
112
|
/**
|
|
@@ -129,7 +123,7 @@ class ServicesManager extends AbstractManager {
|
|
|
129
123
|
return;
|
|
130
124
|
}
|
|
131
125
|
this.__base.__removeEmits(name);
|
|
132
|
-
delete this.
|
|
126
|
+
delete this.props[name];
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
129
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/Base/managers/ServicesManager.ts"],
|
|
4
|
-
"sourcesContent": ["import { usePointer, useRaf, useResize, useScroll, useKey } from '../../services/index.js';\nimport type {\n PointerServiceInterface,\n RafServiceInterface,\n ResizeServiceInterface,\n ScrollServiceInterface,\n KeyServiceInterface,\n ServiceInterface,\n} from '../../services/index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { noop, isFunction, isDefined, isDev } from '../../utils/index.js';\n\nconst SERVICES_MAP = {\n scrolled: useScroll,\n resized: useResize,\n ticked: useRaf,\n moved: usePointer,\n keyed: useKey,\n};\n\nconst SERVICE_NAMES = Object.keys(SERVICES_MAP);\n\ntype Services = {\n scrolled: ScrollServiceInterface;\n resized: ResizeServiceInterface;\n ticked: RafServiceInterface;\n moved: PointerServiceInterface;\n keyed: KeyServiceInterface;\n} & Record<string, ServiceInterface<unknown>>;\n\ntype ServiceNames = keyof Services;\n\n/**\n * Services management for the Base class.\n *\n * @todo Add support for disabled services on mount when the method is defined.\n */\nexport class ServicesManager extends AbstractManager {\n /**\n *
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY,QAAQ,WAAW,WAAW,cAAc;AASjE,SAAS,uBAAuB;AAChC,SAAS,MAAM,YAAY,WAAW,aAAa;AAEnD,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAEA,MAAM,gBAAgB,OAAO,KAAK,YAAY;
|
|
4
|
+
"sourcesContent": ["import { usePointer, useRaf, useResize, useScroll, useKey } from '../../services/index.js';\nimport type {\n PointerServiceInterface,\n RafServiceInterface,\n ResizeServiceInterface,\n ScrollServiceInterface,\n KeyServiceInterface,\n ServiceInterface,\n} from '../../services/index.js';\nimport { AbstractManager } from './AbstractManager.js';\nimport { noop, isFunction, isDefined, isDev } from '../../utils/index.js';\n\nconst SERVICES_MAP = {\n scrolled: useScroll,\n resized: useResize,\n ticked: useRaf,\n moved: usePointer,\n keyed: useKey,\n};\n\nconst SERVICE_NAMES = Object.keys(SERVICES_MAP);\n\ntype Services = {\n scrolled: ScrollServiceInterface;\n resized: ResizeServiceInterface;\n ticked: RafServiceInterface;\n moved: PointerServiceInterface;\n keyed: KeyServiceInterface;\n} & Record<string, ServiceInterface<unknown>>;\n\ntype ServiceProps = typeof SERVICES_MAP & Record<string, <T>() => ServiceInterface<T>>;\n\ntype ServiceNames = keyof Services;\n\n/**\n * Services management for the Base class.\n *\n * @todo Add support for disabled services on mount when the method is defined.\n */\nexport class ServicesManager extends AbstractManager<ServiceProps> {\n /**\n * Custom props\n * @private\n */\n __props = {\n ...SERVICES_MAP,\n } as ServiceProps;\n\n /**\n * Test if the given service is registered.\n */\n has(service: ServiceNames | string): boolean {\n if (\n !(\n (isFunction(this.__base[service]) ||\n // @ts-ignore\n this.__base.__hasEvent(service)) &&\n this.props[service]\n )\n ) {\n return false;\n }\n\n const { has } = this.props[service]();\n return has(this.__base.$id);\n }\n\n /**\n * Get a service props by name.\n */\n get<S extends ServiceNames | string>(service: S): ReturnType<Services[S]['props']> {\n // @ts-ignore\n return this.props[service]().props();\n }\n\n /**\n * Init the given service and bind it to the given instance.\n *\n * @param {ServiceNames} service The name of the service.\n * @returns {() => void} A function to unbind the service.\n */\n enable(service: ServiceNames): () => void {\n if (this.has(service)) {\n return this.disable.bind(this, service);\n }\n\n if (\n // @ts-ignore\n !(isFunction(this.__base[service]) || this.__base.__hasEvent(service)) ||\n !this.props[service]\n ) {\n return noop;\n }\n const serviceInstance = this.props[service]();\n\n serviceInstance.add(this.__base.$id, (...args) => this.__base.__callMethod(service, ...args));\n\n return this.disable.bind(this, service);\n }\n\n /**\n * Enable all services and return methods to disable them.\n */\n enableAll() {\n return Object.keys(this.props).map((serviceName) => this.enable(serviceName));\n }\n\n /**\n * Disable all services.\n *\n * @returns {void}\n */\n disableAll() {\n for (const serviceName of Object.keys(this.props)) {\n this.disable(serviceName);\n }\n }\n\n /**\n * Disable a service.\n */\n disable(service: ServiceNames) {\n if (!this.props[service]) {\n return;\n }\n\n const { remove } = this.props[service]();\n remove(this.__base.$id);\n }\n\n /**\n * Toggle a service.\n */\n toggle(service: ServiceNames, force?: boolean) {\n if (isDefined(force)) {\n if (force && !this.has(service)) {\n this.enable(service);\n }\n\n if (!force && this.has(service)) {\n this.disable(service);\n }\n } else if (this.has(service)) {\n this.disable(service);\n } else {\n this.enable(service);\n }\n }\n\n /**\n * Register a new service to be enabled/disabled.\n *\n * @param {string} name\n * The name of the service hook.\n * @param {<T>(...args:unknown[]) => ServiceInterface<T>} useFunction\n * The `use...` function for the service.\n */\n register(name: string, useFunction: <T>(...args: unknown[]) => ServiceInterface<T>) {\n this.props[name] = useFunction;\n this.__base.__addEmits(name);\n }\n\n /**\n * Unregister a new service to be enabled disabled.\n *\n * @param {string} name\n * The name of the service hook.\n */\n unregister(name: string) {\n if (SERVICE_NAMES.includes(name)) {\n if (isDev) {\n throw new Error(`[ServicesManager] The \\`${name}\\` core service can not be unregistered.`);\n }\n return;\n }\n\n this.__base.__removeEmits(name);\n delete this.props[name];\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,QAAQ,WAAW,WAAW,cAAc;AASjE,SAAS,uBAAuB;AAChC,SAAS,MAAM,YAAY,WAAW,aAAa;AAEnD,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAEA,MAAM,gBAAgB,OAAO,KAAK,YAAY;AAmBvC,MAAM,wBAAwB,gBAA8B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjE,UAAU;AAAA,IACR,GAAG;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,SAAyC;AAC3C,QACE,GACG,WAAW,KAAK,OAAO,OAAO,CAAC;AAAA,IAE9B,KAAK,OAAO,WAAW,OAAO,MAChC,KAAK,MAAM,OAAO,IAEpB;AACA,aAAO;AAAA,IACT;AAEA,UAAM,EAAE,IAAI,IAAI,KAAK,MAAM,OAAO,EAAE;AACpC,WAAO,IAAI,KAAK,OAAO,GAAG;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKA,IAAqC,SAA8C;AAEjF,WAAO,KAAK,MAAM,OAAO,EAAE,EAAE,MAAM;AAAA,EACr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ACtB;AAAA,IACF,WAAW,KAAK,IAAI,OAAO,GAAG;AAC5B,WAAK,QAAQ,OAAO;AAAA,IACtB,OAAO;AACL,WAAK,OAAO,OAAO;AAAA,IACrB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,SAAS,MAAc,aAA6D;AAClF,SAAK,MAAM,IAAI,IAAI;AACnB,SAAK,OAAO,WAAW,IAAI;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW,MAAc;AACvB,QAAI,cAAc,SAAS,IAAI,GAAG;AAChC,UAAI,OAAO;AACT,cAAM,IAAI,MAAM,2BAA2B,IAAI,0CAA0C;AAAA,MAC3F;AACA;AAAA,IACF;AAEA,SAAK,OAAO,cAAc,IAAI;AAC9B,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
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, SmartQueue, dashCase } from '../utils/index.js';\nimport type { Base, BaseConfig, BaseConstructor } 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) {\n if (features.get('blocking')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n return 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 */\nexport function getSelector(nameOrSelector: string): string {\n const { component } = features.get('attributes');\n const prefix = features.get('prefix');\n const key = prefix + component + nameOrSelector;\n\n if (!selectors.has(key)) {\n const parts = [\n // Tag select\n `${prefix}-${dashCase(nameOrSelector)}`,\n // Single selector\n `[${component}=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[${component}*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[${component}$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[${component}^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(key, parts.join(','));\n }\n\n return selectors.get(key);\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, and if the selector does not\n // start with an uppercase letter, matching a component's name, try a classic DOM selector.\n if (elements.length === 0 && nameOrSelector[0] === nameOrSelector[0].toLowerCase()) {\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 */\nexport function getEventTarget(
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS,WAAW,YAAY,gBAAgB;AAEzD,SAAS,gBAAgB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAmB;AAC5C,MAAI,SAAS,IAAI,UAAU,GAAG;AAC5B,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,WAAW;AAAA,EACzB;AAEA,SA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
"sourcesContent": ["import { isArray, isDefined, SmartQueue, dashCase } from '../utils/index.js';\nimport type { Base, BaseConfig, BaseConstructor } 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) {\n if (features.get('blocking')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n return 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 */\nexport function getSelector(nameOrSelector: string): string {\n const { component } = features.get('attributes');\n const prefix = features.get('prefix');\n const key = prefix + component + nameOrSelector;\n\n if (!selectors.has(key)) {\n const parts = [\n // Tag select\n `${prefix}-${dashCase(nameOrSelector)}`,\n // Single selector\n `[${component}=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[${component}*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[${component}$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[${component}^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(key, parts.join(','));\n }\n\n return selectors.get(key);\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, and if the selector does not\n // start with an uppercase letter, matching a component's name, try a classic DOM selector.\n if (elements.length === 0 && nameOrSelector[0] === nameOrSelector[0].toLowerCase()) {\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 */\nexport function getEventTarget(instance: Base, event: string, config: BaseConfig): Base['$el'] {\n if (eventIsDefinedInConfig(event, config) || eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n}\n\nconst instances = new Set<Base>();\n\n/**\n * Get all mounted instances or the ones from a given component.\n */\nexport function getInstances(): Set<Base>;\nexport function getInstances<T extends BaseConstructor = BaseConstructor>(\n ctor: T,\n): Set<InstanceType<T>>;\nexport function getInstances<T extends BaseConstructor = BaseConstructor>(\n ctor?: T,\n): Set<InstanceType<T>> | Set<Base> {\n if (isDefined(ctor)) {\n const filteredInstances = new Set<InstanceType<T>>();\n for (const instance of instances) {\n if (instance instanceof ctor) {\n filteredInstances.add(instance as InstanceType<T>);\n }\n }\n return filteredInstances;\n } else {\n return new Set(instances);\n }\n}\n\nexport function addInstance(instance: Base) {\n instances.add(instance);\n}\n\nexport function deleteInstance(instance: Base) {\n instances.delete(instance);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS,WAAW,YAAY,gBAAgB;AAEzD,SAAS,gBAAgB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAmB;AAC5C,MAAI,SAAS,IAAI,UAAU,GAAG;AAC5B,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,WAAW;AAAA,EACzB;AAEA,SAAO,MAAM,IAAI,EAAE;AACrB;AAEA,MAAM,YAAY,oBAAI,IAAI;AAG1B,MAAM,YAAY;AAKX,SAAS,YAAY,gBAAgC;AAC1D,QAAM,EAAE,UAAU,IAAI,SAAS,IAAI,YAAY;AAC/C,QAAM,SAAS,SAAS,I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MAAI,UAAU,IAAI,GAAG;AACnB,UAAM,oBAAoB,oBAAI,IAAqB;AACnD,eAAW,YAAY,WAAW;AAChC,UAAI,oBAAoB,MAAM;AAC5B,0BAAkB,IAAI,QAA2B;AAAA,MACnD;AAAA,IACF;AACA,WAAO;AAAA,EACT,OAAO;AACL,WAAO,IAAI,IAAI,SAAS;AAAA,EAC1B;AACF;AAEO,SAAS,YAAY,UAAgB;AAC1C,YAAU,IAAI,QAAQ;AACxB;AAEO,SAAS,eAAe,UAAgB;AAC7C,YAAU,OAAO,QAAQ;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export interface ServiceInterface<T> {
|
|
|
20
20
|
* Service configuration of events to be attached to targets.
|
|
21
21
|
*/
|
|
22
22
|
export type ServiceConfig = [
|
|
23
|
-
|
|
23
|
+
(instance: AbstractService) => EventTarget,
|
|
24
24
|
[
|
|
25
25
|
string,
|
|
26
26
|
AddEventListenerOptions?
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isFunction } from "../utils/index.js";
|
|
2
1
|
class AbstractService {
|
|
3
2
|
/**
|
|
4
3
|
* Service configuration.
|
|
@@ -90,7 +89,7 @@ class AbstractService {
|
|
|
90
89
|
*/
|
|
91
90
|
__manageEvents(mode) {
|
|
92
91
|
for (const [target, events] of this.constructor.config) {
|
|
93
|
-
const resolvedTarget =
|
|
92
|
+
const resolvedTarget = target(this);
|
|
94
93
|
for (const [type, options] of events) {
|
|
95
94
|
resolvedTarget[`${mode}EventListener`](type, this, options);
|
|
96
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/js-toolkit/services/AbstractService.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export interface ServiceInterface<T> {\n /**\n * Remove a function from the resize service by its key.\n */\n remove(key: string): void;\n /**\n * Add a callback to the service. The callback will receive the current service props as parameter.\n */\n add(key: string, callback: (props: T) => void): void;\n /**\n * Test if the service has alreaydy a callback for the given key.\n */\n has(key: string): boolean;\n /**\n * Get the service's props.\n */\n props(): T;\n}\n\n/**\n * Service configuration of events to be attached to targets.\n */\nexport type ServiceConfig = [\n (instance: AbstractService) => EventTarget,\n [string, AddEventListenerOptions?][],\n][];\n\n/**\n * AbstractService class.\n */\nexport class AbstractService<PropsType = any> {\n /**\n * Used to type `this.constructor` correctly\n * @see https://github.com/microsoft/TypeScript/issues/3841#issuecomment-2381594311\n */\n declare ['constructor']: typeof AbstractService;\n\n /**\n * Service configuration.\n */\n static config: ServiceConfig = [];\n\n /**\n * Cache for the created instances.\n */\n static __instances = new Map();\n\n /**\n * Get a service instance as a singleton based on the given key.\n */\n static getInstance<T extends ServiceInterface<any>>(key: any = this, ...args: any[]) {\n if (!this.__instances.has(key)) {\n // @ts-ignore\n const instance = new this(...args);\n this.__instances.set(key, {\n add: (key, callback) => instance.add(key, callback),\n remove: (key) => instance.remove(key),\n has: (key) => instance.has(key),\n props: () => instance.props,\n } as T);\n }\n\n return this.__instances.get(key);\n }\n\n /**\n * Is the service active or not?\n */\n __isInit = false;\n\n /**\n * Props for the service.\n */\n props = {};\n\n /**\n * Holds all the callbacks that will be triggered.\n */\n callbacks: Map<string, (props: PropsType) => unknown> = new Map();\n\n /**\n * Does the service has the given key?\n */\n has(key: string): boolean {\n return this.callbacks.has(key);\n }\n\n /**\n * Get a service callback by its key.\n */\n get(key: string): (props: PropsType) => unknown {\n return this.callbacks.get(key);\n }\n\n /**\n * Add a callback to the service.\n */\n add(key: string, callback: (props: PropsType) => unknown) {\n if (this.has(key)) {\n console.warn(`The key \\`${key}\\` has already been added.`);\n return;\n }\n\n // Initialize the service when we add the first callback\n if (this.callbacks.size === 0 && !this.__isInit) {\n this.init();\n this.__isInit = true;\n }\n\n this.callbacks.set(key, callback);\n }\n\n /**\n * Remove a callback from the service by its key.\n */\n remove(key: string) {\n this.callbacks.delete(key);\n\n // Kill the service when we remove the last callback\n if (this.callbacks.size === 0 && this.__isInit) {\n this.kill();\n this.__isInit = false;\n }\n }\n\n /**\n * Trigger all service callbacks with service props.\n */\n trigger(props: PropsType) {\n for (const callback of this.callbacks.values()) {\n callback(props);\n }\n }\n\n /* v8 ignore next 6 */\n /**\n * Implements the EventListenerObject interface.\n */\n handleEvent(event: Event) {\n // Should be implemented.\n }\n\n /**\n * Add or remove event listeners based on the static `config` property.\n */\n __manageEvents(mode: 'add' | 'remove') {\n for (const [target, events] of this.constructor.config) {\n const resolvedTarget = target(this);\n for (const [type, options] of events) {\n resolvedTarget[`${mode}EventListener`](type, this, options);\n }\n }\n }\n\n /**\n * Triggered when the service is initialized.\n */\n init() {\n this.__manageEvents('add');\n }\n\n /**\n * Triggered when the service is killed.\n */\n kill() {\n this.__manageEvents('remove');\n }\n}\n"],
|
|
5
|
+
"mappings": "AA8BO,MAAM,gBAAiC;AAAA;AAAA;AAAA;AAAA,EAU5C,OAAO,SAAwB,CAAC;AAAA;AAAA;AAAA;AAAA,EAKhC,OAAO,cAAc,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA,EAK7B,OAAO,YAA6C,MAAW,SAAS,MAAa;AACnF,QAAI,CAAC,KAAK,YAAY,IAAI,GAAG,GAAG;AAE9B,YAAM,WAAW,IAAI,KAAK,GAAG,IAAI;AACjC,WAAK,YAAY,IAAI,KAAK;AAAA,QACxB,KAAK,CAACA,MAAK,aAAa,SAAS,IAAIA,MAAK,QAAQ;AAAA,QAClD,QAAQ,CAACA,SAAQ,SAAS,OAAOA,IAAG;AAAA,QACpC,KAAK,CAACA,SAAQ,SAAS,IAAIA,IAAG;AAAA,QAC9B,OAAO,MAAM,SAAS;AAAA,MACxB,CAAM;AAAA,IACR;AAEA,WAAO,KAAK,YAAY,IAAI,GAAG;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX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