@mgdis/stencil-helpers 1.1.9 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/components/index.d.ts +13 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/ide/index.d.ts +25 -4
- package/dist/ide/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +117 -100
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/storybook/index.d.ts +1 -1
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/tests/index.d.ts.map +1 -0
- package/dist/tests/unit.conf.d.ts.map +1 -0
- package/dist/tests/unit.d.ts.map +1 -0
- package/dist/{locale/index.conf.d.ts → types/index.d.ts} +1 -1
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +13 -12
- package/dist/locale/index.conf.d.ts.map +0 -1
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/unit.conf.d.ts.map +0 -1
- package/dist/test/unit.d.ts.map +0 -1
- /package/dist/{test → tests}/index.d.ts +0 -0
- /package/dist/{test → tests}/unit.conf.d.ts +0 -0
- /package/dist/{test → tests}/unit.d.ts +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This package centralizes helper functions for your [Stencil](https://stenciljs.c
|
|
|
5
5
|
- **Components**: Centralizes all component utilities.
|
|
6
6
|
- **Locale**: Centralizes all necessary locale utilities for managing content translation.
|
|
7
7
|
- **Storybook**: Centralizes all Storybook helpers useful for building your own Storybook.
|
|
8
|
-
- **
|
|
8
|
+
- **Tests**: Centralizes all test utilities to simplify testing your components.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -15,4 +15,4 @@ pnpm i @mgdis/stencil-helpers
|
|
|
15
15
|
|
|
16
16
|
## Documentation
|
|
17
17
|
|
|
18
|
-
Read the full [documentation](./
|
|
18
|
+
Read the full [documentation](./docs/README.md)
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* @returns ID
|
|
6
6
|
*/
|
|
7
7
|
export declare const createID: (prefix?: string, length?: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Validate html `id` format
|
|
10
|
+
* @param newValue - id value to validate
|
|
11
|
+
* @returns true if `id` is valid
|
|
12
|
+
*/
|
|
13
|
+
export declare const isValideID: (newValue: unknown) => boolean;
|
|
8
14
|
/**
|
|
9
15
|
* Class to manage component classlist
|
|
10
16
|
*/
|
|
@@ -75,7 +81,13 @@ export declare const getParentWindows: (localWindow: Window, windows?: Window[])
|
|
|
75
81
|
* @param value - value to check
|
|
76
82
|
* @returns `true` if string is valid
|
|
77
83
|
*/
|
|
78
|
-
export declare const isValidString: (value: unknown) =>
|
|
84
|
+
export declare const isValidString: (value: unknown) => value is string;
|
|
85
|
+
/**
|
|
86
|
+
* Value to stringify
|
|
87
|
+
* @param value
|
|
88
|
+
* @returns stringified value
|
|
89
|
+
*/
|
|
90
|
+
export declare const toString: (value: unknown) => string;
|
|
79
91
|
/**
|
|
80
92
|
* Cleans string characters by removing special characters and converting to lowercase.
|
|
81
93
|
* @param text - text to clean
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,wCAA+B,MAWnD,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;gBAEN,SAAS,GAAE,MAAM,EAAO;IAIpC;;;OAGG;IACH,GAAG,cAAe,MAAM,KAAG,IAAI,CAI7B;IAEF;;;OAGG;IACH,MAAM,cAAe,MAAM,KAAG,IAAI,CAKhC;IAEF;;;;OAIG;IACH,GAAG,cAAe,MAAM,KAAG,OAAO,CAEhC;IAEF;;;OAGG;IACH,IAAI,QAAO,MAAM,CAEf;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,EAA2E,CAAC;AAE9I;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,OAAO,YAAY,MAAM,EAAE,KAAG,OAEhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kHAAgH,CAAC;AAE/I;;;;GAIG;AACH,eAAO,MAAM,UAAU,gBAAiB,MAAM,KAAG,MAAM,EAItD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,YAAW,MAAM,EAAE,KAAQ,MAAM,EAgBpF,CAAC;AAkBF;;;;GAIG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,wCAA+B,MAWnD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,aAAc,OAAO,KAAG,OAA+F,CAAC;AAE/I;;GAEG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;gBAEN,SAAS,GAAE,MAAM,EAAO;IAIpC;;;OAGG;IACH,GAAG,cAAe,MAAM,KAAG,IAAI,CAI7B;IAEF;;;OAGG;IACH,MAAM,cAAe,MAAM,KAAG,IAAI,CAKhC;IAEF;;;;OAIG;IACH,GAAG,cAAe,MAAM,KAAG,OAAO,CAEhC;IAEF;;;OAGG;IACH,IAAI,QAAO,MAAM,CAEf;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,EAA2E,CAAC;AAE9I;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,OAAO,YAAY,MAAM,EAAE,KAAG,OAEhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kHAAgH,CAAC;AAE/I;;;;GAIG;AACH,eAAO,MAAM,UAAU,gBAAiB,MAAM,KAAG,MAAM,EAItD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,YAAW,MAAM,EAAE,KAAQ,MAAM,EAgBpF,CAAC;AAkBF;;;;GAIG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,MAA0D,CAAC;AAEnH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,MAGzC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAMjC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,QAAQ,aAAoB,MAAM,IAAI,KAAG,OAAO,CAAC,IAAI,CAAe,CAAC"}
|
package/dist/ide/index.d.ts
CHANGED
|
@@ -49,23 +49,28 @@ export declare const webTypesGenerator: (name: string, version: string, jsonDocs
|
|
|
49
49
|
description: string;
|
|
50
50
|
}[];
|
|
51
51
|
};
|
|
52
|
+
css: {
|
|
53
|
+
properties: {
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
52
58
|
}[];
|
|
53
59
|
};
|
|
54
60
|
};
|
|
55
61
|
};
|
|
56
62
|
/**
|
|
57
63
|
* Generate custom HTML datasets for VS Code
|
|
58
|
-
* @param version - Library version
|
|
59
64
|
* @param jsonDocs - Stencil JSON doc
|
|
60
65
|
* @param storybookBaseUrl - Storybook Base Url
|
|
61
66
|
* @returns custom HTML datasets
|
|
62
67
|
* @example
|
|
63
68
|
* ```ts
|
|
64
|
-
* const customDataJson = vsCodeGenerator(
|
|
69
|
+
* const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
|
|
65
70
|
* ```
|
|
66
71
|
*/
|
|
67
|
-
export declare const vsCodeGenerator: (
|
|
68
|
-
version:
|
|
72
|
+
export declare const vsCodeGenerator: (jsonDocs: JsonDocs, storybookBaseUrl: string, sourceBaseUrl: string) => {
|
|
73
|
+
version: number;
|
|
69
74
|
tags: {
|
|
70
75
|
name: string;
|
|
71
76
|
description: string;
|
|
@@ -86,4 +91,20 @@ export declare const vsCodeGenerator: (version: string, jsonDocs: JsonDocs, stor
|
|
|
86
91
|
globalAttributes: never[];
|
|
87
92
|
valueSets: never[];
|
|
88
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Generate custom CSS datasets for VS Code
|
|
96
|
+
* @param jsonDocs - Stencil JSON doc
|
|
97
|
+
* @returns custom CSS datasets
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const customDataJson = vsCodeCssGenerator(jsonDocs);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const vsCodeCssGenerator: (jsonDocs: JsonDocs) => {
|
|
104
|
+
version: number;
|
|
105
|
+
properties: {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
89
110
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ide/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmC,MAAM,wBAAwB,CAAC;AA2EnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,WAAW,MAAM,YAAY,QAAQ,oBAAoB,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmC,MAAM,wBAAwB,CAAC;AA2EnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,WAAW,MAAM,YAAY,QAAQ,oBAAoB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD3G,CAAC;AA4BH;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,aAAc,QAAQ,oBAAoB,MAAM,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;CAkBjG,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,aAAc,QAAQ;;;;;;CAQnD,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -4,14 +4,14 @@ var X = (e) => {
|
|
|
4
4
|
};
|
|
5
5
|
var he = (e, t, s) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
6
6
|
var g = (e, t, s) => he(e, typeof t != "symbol" ? t + "" : t, s), ye = (e, t, s) => t.has(e) || X("Cannot " + s);
|
|
7
|
-
var k = (e, t, s) => (ye(e, t, "read from private field"), s ? s.call(e) : t.get(e)),
|
|
8
|
-
const
|
|
7
|
+
var k = (e, t, s) => (ye(e, t, "read from private field"), s ? s.call(e) : t.get(e)), w = (e, t, s) => t.has(e) ? X("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
8
|
+
const Ie = (e = "", t = 10) => {
|
|
9
9
|
const s = new Uint8Array(t);
|
|
10
10
|
crypto.getRandomValues(s);
|
|
11
11
|
const r = Array.from(s).map((o) => o.toString(16).padStart(2, "0")).join("").slice(0, t);
|
|
12
12
|
return e !== "" ? `${e}-${r}` : r;
|
|
13
|
-
};
|
|
14
|
-
class
|
|
13
|
+
}, Ge = (e) => me(e) && /^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.exec(e) !== null;
|
|
14
|
+
class Xe {
|
|
15
15
|
constructor(t = []) {
|
|
16
16
|
/**
|
|
17
17
|
* Available classes
|
|
@@ -46,7 +46,7 @@ class Ie {
|
|
|
46
46
|
this.classes = t;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const Je = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Ke = (e, t) => t.includes(e == null ? void 0 : e.tagName.toLowerCase()), Qe = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier], mg-button', Ze = (e) => {
|
|
50
50
|
const t = te(e), s = se(e);
|
|
51
51
|
return [e, ...t, ...s];
|
|
52
52
|
}, te = (e, t = []) => {
|
|
@@ -63,7 +63,7 @@ const Ge = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Xe =
|
|
|
63
63
|
for (const s of Array.from(e.frames))
|
|
64
64
|
t.push(s), se(s, t);
|
|
65
65
|
return t;
|
|
66
|
-
},
|
|
66
|
+
}, me = (e) => typeof e == "string" && e.trim() !== "", Ye = (e) => typeof e == "object" ? JSON.stringify(e) : `${e}`, Ve = (e) => typeof e == "string" ? e.toLocaleLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "") : e, et = async (e) => e();
|
|
67
67
|
var E = {
|
|
68
68
|
allRenderFn: !1,
|
|
69
69
|
cmpDidLoad: !0,
|
|
@@ -153,11 +153,11 @@ var E = {
|
|
|
153
153
|
attachStyles: !0,
|
|
154
154
|
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
155
155
|
experimentalSlotFixes: !1
|
|
156
|
-
},
|
|
156
|
+
}, be = Object.defineProperty, Se = (e, t) => {
|
|
157
157
|
for (var s in t)
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
|
|
158
|
+
be(e, s, { get: t[s], enumerable: !0 });
|
|
159
|
+
}, J = (e, t) => t in e, K = "http://www.w3.org/1999/xlink", B = typeof window < "u" ? window : {}, _ = B.document || { head: {} };
|
|
160
|
+
B.HTMLElement;
|
|
161
161
|
var L = {
|
|
162
162
|
$flags$: 0,
|
|
163
163
|
$resourcesUrl$: "",
|
|
@@ -166,13 +166,13 @@ var L = {
|
|
|
166
166
|
ael: (e, t, s, r) => e.addEventListener(t, s, r),
|
|
167
167
|
rel: (e, t, s, r) => e.removeEventListener(t, s, r),
|
|
168
168
|
ce: (e, t) => new CustomEvent(e, t)
|
|
169
|
-
},
|
|
170
|
-
|
|
169
|
+
}, Q = {}, Te = "http://www.w3.org/2000/svg", ke = "http://www.w3.org/1999/xhtml", xe = (e) => e != null, re = (e) => (e = typeof e, e === "object" || e === "function"), Ae = {};
|
|
170
|
+
Se(Ae, {
|
|
171
171
|
err: () => oe,
|
|
172
|
-
map: () =>
|
|
172
|
+
map: () => Ee,
|
|
173
173
|
ok: () => U,
|
|
174
|
-
unwrap: () =>
|
|
175
|
-
unwrapErr: () =>
|
|
174
|
+
unwrap: () => Le,
|
|
175
|
+
unwrapErr: () => je
|
|
176
176
|
});
|
|
177
177
|
var U = (e) => ({
|
|
178
178
|
isOk: !0,
|
|
@@ -183,7 +183,7 @@ var U = (e) => ({
|
|
|
183
183
|
isErr: !0,
|
|
184
184
|
value: e
|
|
185
185
|
});
|
|
186
|
-
function
|
|
186
|
+
function Ee(e, t) {
|
|
187
187
|
if (e.isOk) {
|
|
188
188
|
const s = t(e.value);
|
|
189
189
|
return s instanceof Promise ? s.then((r) => U(r)) : U(s);
|
|
@@ -194,15 +194,15 @@ function Ae(e, t) {
|
|
|
194
194
|
}
|
|
195
195
|
throw "should never get here";
|
|
196
196
|
}
|
|
197
|
-
var
|
|
197
|
+
var Le = (e) => {
|
|
198
198
|
if (e.isOk)
|
|
199
199
|
return e.value;
|
|
200
200
|
throw e.value;
|
|
201
|
-
},
|
|
201
|
+
}, je = (e) => {
|
|
202
202
|
if (e.isErr)
|
|
203
203
|
return e.value;
|
|
204
204
|
throw e.value;
|
|
205
|
-
},
|
|
205
|
+
}, Re = (e, t, ...s) => {
|
|
206
206
|
let r = null, o = null, n = null, l = !1, a = !1;
|
|
207
207
|
const c = [], d = (i) => {
|
|
208
208
|
for (let $ = 0; $ < i.length; $++)
|
|
@@ -220,9 +220,9 @@ var Ee = (e) => {
|
|
|
220
220
|
$children$: null
|
|
221
221
|
};
|
|
222
222
|
return s.$attrs$ = null, s.$key$ = null, s.$name$ = null, s;
|
|
223
|
-
},
|
|
223
|
+
}, Oe = {}, Me = (e) => e && e.$tag$ === Oe, Z = (e, t, s, r, o, n) => {
|
|
224
224
|
if (s !== r) {
|
|
225
|
-
let l =
|
|
225
|
+
let l = J(e, t), a = t.toLowerCase();
|
|
226
226
|
if (t === "class") {
|
|
227
227
|
const c = e.classList, d = Y(s), f = Y(r);
|
|
228
228
|
c.remove(...d.filter((i) => i && !f.includes(i))), c.add(...f.filter((i) => i && !d.includes(i)));
|
|
@@ -234,9 +234,9 @@ var Ee = (e) => {
|
|
|
234
234
|
} else if (t !== "key") if (t === "ref")
|
|
235
235
|
r && r(e);
|
|
236
236
|
else if (!e.__lookupSetter__(t) && t[0] === "o" && t[1] === "n") {
|
|
237
|
-
if (t[2] === "-" ? t = t.slice(3) :
|
|
237
|
+
if (t[2] === "-" ? t = t.slice(3) : J(B, a) ? t = a.slice(2) : t = a[2] + t.slice(3), s || r) {
|
|
238
238
|
const c = t.endsWith(ne);
|
|
239
|
-
t = t.replace(
|
|
239
|
+
t = t.replace(Ne, ""), s && L.rel(e, t, s, c), r && L.ael(e, t, r, c);
|
|
240
240
|
}
|
|
241
241
|
} else {
|
|
242
242
|
const c = re(r);
|
|
@@ -251,15 +251,15 @@ var Ee = (e) => {
|
|
|
251
251
|
} catch {
|
|
252
252
|
}
|
|
253
253
|
let d = !1;
|
|
254
|
-
a !== (a = a.replace(/^xlink\:?/, "")) && (t = a, d = !0), r == null || r === !1 ? (r !== !1 || e.getAttribute(t) === "") && (d ? e.removeAttributeNS(
|
|
254
|
+
a !== (a = a.replace(/^xlink\:?/, "")) && (t = a, d = !0), r == null || r === !1 ? (r !== !1 || e.getAttribute(t) === "") && (d ? e.removeAttributeNS(K, t) : e.removeAttribute(t)) : (!l || n & 4 || o) && !c && (r = r === !0 ? "" : r, d ? e.setAttributeNS(K, t, r) : e.setAttribute(t, r));
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
},
|
|
258
|
-
const r = t.$elm$.nodeType === 11 && t.$elm$.host ? t.$elm$.host : t.$elm$, o = e && e.$attrs$ ||
|
|
257
|
+
}, _e = /\s/, Y = (e) => e ? e.split(_e) : [], ne = "Capture", Ne = new RegExp(ne + "$"), le = (e, t, s) => {
|
|
258
|
+
const r = t.$elm$.nodeType === 11 && t.$elm$.host ? t.$elm$.host : t.$elm$, o = e && e.$attrs$ || Q, n = t.$attrs$ || Q;
|
|
259
259
|
for (const l of V(Object.keys(o)))
|
|
260
|
-
l in n ||
|
|
260
|
+
l in n || Z(r, l, o[l], void 0, s, t.$flags$);
|
|
261
261
|
for (const l of V(Object.keys(n)))
|
|
262
|
-
|
|
262
|
+
Z(r, l, o[l], n[l], s, t.$flags$);
|
|
263
263
|
};
|
|
264
264
|
function V(e) {
|
|
265
265
|
return e.includes("ref") ? (
|
|
@@ -270,11 +270,11 @@ function V(e) {
|
|
|
270
270
|
e
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
|
-
var x, H, j, N = !1, F = !1,
|
|
273
|
+
var x, H, j, N = !1, F = !1, q = !1, h = !1, C = (e, t, s, r) => {
|
|
274
274
|
var o;
|
|
275
275
|
const n = t.$children$[s];
|
|
276
276
|
let l = 0, a, c, d;
|
|
277
|
-
if (N || (
|
|
277
|
+
if (N || (q = !0, n.$tag$ === "slot" && (x && r.classList.add(x + "-s"), n.$flags$ |= n.$children$ ? (
|
|
278
278
|
// slot element has fallback content
|
|
279
279
|
// still create an element that "mocks" the slot element
|
|
280
280
|
2
|
|
@@ -289,9 +289,9 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
289
289
|
a = n.$elm$ = _.createTextNode("");
|
|
290
290
|
else {
|
|
291
291
|
if (h || (h = n.$tag$ === "svg"), a = n.$elm$ = _.createElementNS(
|
|
292
|
-
h ?
|
|
292
|
+
h ? Te : ke,
|
|
293
293
|
!N && E.slotRelocation && n.$flags$ & 2 ? "slot-fb" : n.$tag$
|
|
294
|
-
), h && n.$tag$ === "foreignObject" && (h = !1), le(null, n, h), !!a.getRootNode().querySelector("body") && E.scoped &&
|
|
294
|
+
), h && n.$tag$ === "foreignObject" && (h = !1), le(null, n, h), !!a.getRootNode().querySelector("body") && E.scoped && xe(x) && a["s-si"] !== x && a.classList.add(a["s-si"] = x), G(a, r), n.$children$)
|
|
295
295
|
for (l = 0; l < n.$children$.length; ++l)
|
|
296
296
|
c = C(e, n, l, a), c && a.appendChild(c);
|
|
297
297
|
n.$tag$ === "svg" ? h = !1 : a.tagName === "foreignObject" && (h = !0);
|
|
@@ -307,7 +307,7 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
307
307
|
}
|
|
308
308
|
for (let r = s.length - 1; r >= 0; r--) {
|
|
309
309
|
const o = s[r];
|
|
310
|
-
o["s-hn"] !== j && o["s-ol"] && (T(ce(o), o, I(o)), o["s-ol"].remove(), o["s-ol"] = void 0, o["s-sh"] = void 0,
|
|
310
|
+
o["s-hn"] !== j && o["s-ol"] && (T(ce(o), o, I(o)), o["s-ol"].remove(), o["s-ol"] = void 0, o["s-sh"] = void 0, q = !0), t && R(o, t);
|
|
311
311
|
}
|
|
312
312
|
L.$flags$ &= -2;
|
|
313
313
|
}, ie = (e, t, s, r, o, n) => {
|
|
@@ -322,7 +322,7 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
322
322
|
$e(o), n && (F = !0, n["s-ol"] ? n["s-ol"].remove() : R(n, !0), n.remove());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
},
|
|
325
|
+
}, Fe = (e, t, s, r, o = !1) => {
|
|
326
326
|
let n = 0, l = 0, a = 0, c = 0, d = t.length - 1, f = t[0], i = t[d], $ = r.length - 1, u = r[0], p = r[$], m, y;
|
|
327
327
|
for (; n <= d && l <= $; )
|
|
328
328
|
if (f == null)
|
|
@@ -366,7 +366,7 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
366
366
|
) : s ? !0 : e.$key$ === t.$key$ : !1, I = (e) => e && e["s-ol"] || e, ce = (e) => (e["s-ol"] ? e["s-ol"] : e).parentNode, A = (e, t, s = !1) => {
|
|
367
367
|
const r = t.$elm$ = e.$elm$, o = e.$children$, n = t.$children$, l = t.$tag$, a = t.$text$;
|
|
368
368
|
let c;
|
|
369
|
-
a === null ? (h = l === "svg" ? !0 : l === "foreignObject" ? !1 : h, l === "slot" && !N || le(e, t, h), o !== null && n !== null ?
|
|
369
|
+
a === null ? (h = l === "svg" ? !0 : l === "foreignObject" ? !1 : h, l === "slot" && !N || le(e, t, h), o !== null && n !== null ? Fe(r, o, t, n, s) : n !== null ? (e.$text$ !== null && (r.textContent = ""), ie(r, null, t, n, 0, n.length - 1)) : (
|
|
370
370
|
// don't do this on initial render as it can cause non-hydrated content to be removed
|
|
371
371
|
!s && E.updatable && o !== null && ae(o, 0, o.length - 1)
|
|
372
372
|
), h && l === "svg" && (h = !1)) : (c = r["s-cr"]) ? c.parentNode.textContent = a : e.$text$ !== a && (r.data = a);
|
|
@@ -435,9 +435,9 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
435
435
|
for (const n of Array.from(e.childNodes))
|
|
436
436
|
G(n, e, !0);
|
|
437
437
|
}
|
|
438
|
-
},
|
|
438
|
+
}, Ce = (e, t, s = !1) => {
|
|
439
439
|
var r, o, n, l, a;
|
|
440
|
-
const c = e.$hostElement$, d = e.$cmpMeta$, f = e.$vnode$ || W(null, null), i =
|
|
440
|
+
const c = e.$hostElement$, d = e.$cmpMeta$, f = e.$vnode$ || W(null, null), i = Me(t) ? t : Re(null, null, t);
|
|
441
441
|
if (j = c.tagName, d.$attrsToReflect$ && (i.$attrs$ = i.$attrs$ || {}, d.$attrsToReflect$.map(
|
|
442
442
|
([$, u]) => i.$attrs$[u] = c[$]
|
|
443
443
|
)), s && i.$attrs$)
|
|
@@ -445,7 +445,7 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
445
445
|
c.hasAttribute($) && !["key", "ref", "style", "class"].includes($) && (i.$attrs$[$] = c[$]);
|
|
446
446
|
i.$tag$ = null, i.$flags$ |= 4, e.$vnode$ = i, i.$elm$ = f.$elm$ = c.shadowRoot || c, x = c["s-sc"], N = (d.$flags$ & 1) !== 0, H = c["s-cr"], F = !1, A(f, i, s);
|
|
447
447
|
{
|
|
448
|
-
if (L.$flags$ |= 1,
|
|
448
|
+
if (L.$flags$ |= 1, q) {
|
|
449
449
|
ue(i.$elm$);
|
|
450
450
|
for (const $ of b) {
|
|
451
451
|
const u = $.$nodeToRelocate$;
|
|
@@ -486,19 +486,19 @@ var x, H, j, N = !1, F = !1, z = !1, h = !1, C = (e, t, s, r) => {
|
|
|
486
486
|
$["s-hn"] !== j && !$["s-sh"] && (s && $["s-ih"] == null && ($["s-ih"] = (a = $.hidden) != null ? a : !1), $.hidden = !0);
|
|
487
487
|
H = void 0;
|
|
488
488
|
};
|
|
489
|
-
const
|
|
489
|
+
const De = (e, t, s) => {
|
|
490
490
|
[null, void 0, "", !1].includes(s) || ["innerHTML", "style"].includes(t) || e.setAttribute(t, ["object", "function"].includes(typeof s) ? "/!\\ Object props are not rendered in the code example" : s);
|
|
491
491
|
}, pe = (e, t, s, r, o) => {
|
|
492
492
|
if (t && typeof t == "string") {
|
|
493
493
|
const n = document.createElement(t);
|
|
494
494
|
Object.keys(s || {}).forEach((l) => {
|
|
495
|
-
|
|
495
|
+
De(n, l, s[l]);
|
|
496
496
|
}), r == null || r.forEach((l) => {
|
|
497
497
|
pe(n, l.$tag$, l.$attrs$, l.$children$, l.$text$);
|
|
498
498
|
}), s != null && s.innerHTML && (n.innerHTML = s.innerHTML), e.appendChild(n);
|
|
499
499
|
}
|
|
500
500
|
o && (e.innerHTML = o);
|
|
501
|
-
},
|
|
501
|
+
}, tt = (e, t) => {
|
|
502
502
|
const s = {};
|
|
503
503
|
if (typeof e != "object")
|
|
504
504
|
throw new Error("filterArgs - args isn't an object.");
|
|
@@ -508,11 +508,11 @@ const Ce = (e, t, s) => {
|
|
|
508
508
|
(!t || !Object.keys(t).includes(r) || t[r] !== o) && (s[n] = o);
|
|
509
509
|
}
|
|
510
510
|
return s;
|
|
511
|
-
},
|
|
511
|
+
}, st = (e, t) => {
|
|
512
512
|
var r, o;
|
|
513
513
|
const s = document.getElementById("storybook-root");
|
|
514
514
|
if (s !== null)
|
|
515
|
-
return (o = document.querySelector("[lang]")) == null || o.setAttribute("lang", ((r = t.globals) == null ? void 0 : r.locale) || "en"),
|
|
515
|
+
return (o = document.querySelector("[lang]")) == null || o.setAttribute("lang", ((r = t.globals) == null ? void 0 : r.locale) || "en"), Ce(
|
|
516
516
|
{
|
|
517
517
|
$ancestorComponent$: void 0,
|
|
518
518
|
$flags$: 0,
|
|
@@ -525,7 +525,7 @@ const Ce = (e, t, s) => {
|
|
|
525
525
|
},
|
|
526
526
|
e(t)
|
|
527
527
|
), s.children[s.children.length - 1];
|
|
528
|
-
},
|
|
528
|
+
}, rt = ({ $tag$: e, $attrs$: t, $children$: s, $text$: r }) => {
|
|
529
529
|
const o = document.createElement("div");
|
|
530
530
|
return pe(o, e, t, s, r), o.innerHTML;
|
|
531
531
|
}, D = (e, t) => {
|
|
@@ -534,8 +534,8 @@ const Ce = (e, t, s) => {
|
|
|
534
534
|
const s = t.split("/");
|
|
535
535
|
return `${e}${s.slice(2, s.length - 1).join("-")}--docs`;
|
|
536
536
|
};
|
|
537
|
-
var S,
|
|
538
|
-
class
|
|
537
|
+
var S, P;
|
|
538
|
+
class ot {
|
|
539
539
|
constructor(t) {
|
|
540
540
|
/**
|
|
541
541
|
* JsonDocs
|
|
@@ -546,14 +546,14 @@ class st {
|
|
|
546
546
|
* @param tagName - tag name we want to get the data from
|
|
547
547
|
* @returns component data
|
|
548
548
|
*/
|
|
549
|
-
|
|
549
|
+
w(this, S, (t) => this.jsonDoc.components.find((s) => s.tag === t));
|
|
550
550
|
/**
|
|
551
551
|
* Get the control for the given prop
|
|
552
552
|
* Based on https://storybook.js.org/docs/api/arg-types#controltype
|
|
553
553
|
* @param prop - prop to get control for
|
|
554
554
|
* @returns control type and options if applicable
|
|
555
555
|
*/
|
|
556
|
-
|
|
556
|
+
w(this, P, (t) => {
|
|
557
557
|
const s = t.type.replace(/"([^"]+)"/g, "$1").replace(/\s/g, "").replace(/\(.*?\)/g, (r) => r.replace(/\|/g, " OR ")).split("|").map((r) => r.trim().replace(/ OR /g, "|"));
|
|
558
558
|
return t.type === "string" ? { control: { type: "text" } } : t.type === "number" ? { control: { type: "number" } } : t.type === "boolean" ? { control: { type: "boolean" } } : t.type.startsWith("{") && t.type.endsWith("}") ? { control: { type: "object" } } : s.length > 1 ? s.includes("string") ? { control: { type: "text" } } : s.every((r) => r == null ? void 0 : r.includes("[]")) ? { control: { type: "object" } } : (s.unshift(void 0), { control: { type: "select" }, options: s }) : { control: { type: "object" } };
|
|
559
559
|
});
|
|
@@ -564,7 +564,7 @@ class st {
|
|
|
564
564
|
*/
|
|
565
565
|
g(this, "extractArgTypes", (t) => {
|
|
566
566
|
const s = k(this, S).call(this, t), r = s == null ? void 0 : s.props.reduce((f, i) => {
|
|
567
|
-
const { control: $, options: u } = k(this,
|
|
567
|
+
const { control: $, options: u } = k(this, P).call(this, i);
|
|
568
568
|
return {
|
|
569
569
|
...f,
|
|
570
570
|
[i.name]: {
|
|
@@ -682,8 +682,8 @@ class st {
|
|
|
682
682
|
this.jsonDoc = t;
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
S = new WeakMap(),
|
|
686
|
-
const
|
|
685
|
+
S = new WeakMap(), P = new WeakMap();
|
|
686
|
+
const Pe = (e, t) => {
|
|
687
687
|
if (t)
|
|
688
688
|
return `${e}${t}`;
|
|
689
689
|
}, ge = (e) => {
|
|
@@ -712,9 +712,9 @@ const De = (e, t) => {
|
|
|
712
712
|
`, t += e.slots.map(({ name: o, docs: n }) => `- \`${o}\`: ${n}
|
|
713
713
|
`).join(""), t += `
|
|
714
714
|
`), t;
|
|
715
|
-
},
|
|
715
|
+
}, z = (e) => `${e.docs}
|
|
716
716
|
|
|
717
|
-
Type: \`${e.type}\``,
|
|
717
|
+
Type: \`${e.type}\``, nt = (e, t, s, r) => ({
|
|
718
718
|
$schema: "https://json.schemastore.org/web-types",
|
|
719
719
|
name: e,
|
|
720
720
|
version: t,
|
|
@@ -729,7 +729,7 @@ Type: \`${e.type}\``, rt = (e, t, s, r) => ({
|
|
|
729
729
|
"doc-url": n,
|
|
730
730
|
attributes: o.props.filter((l) => l.attr).map((l) => ({
|
|
731
731
|
name: l.attr,
|
|
732
|
-
description:
|
|
732
|
+
description: z(l),
|
|
733
733
|
"doc-url": n,
|
|
734
734
|
value: {
|
|
735
735
|
type: l.type,
|
|
@@ -740,7 +740,7 @@ Type: \`${e.type}\``, rt = (e, t, s, r) => ({
|
|
|
740
740
|
js: {
|
|
741
741
|
properties: o.props.map((l) => ({
|
|
742
742
|
name: l.name,
|
|
743
|
-
description:
|
|
743
|
+
description: z(l),
|
|
744
744
|
"doc-url": n,
|
|
745
745
|
value: {
|
|
746
746
|
type: l.type,
|
|
@@ -752,6 +752,12 @@ Type: \`${e.type}\``, rt = (e, t, s, r) => ({
|
|
|
752
752
|
name: l.event,
|
|
753
753
|
description: l.docs
|
|
754
754
|
}))
|
|
755
|
+
},
|
|
756
|
+
css: {
|
|
757
|
+
properties: o.styles.map((l) => ({
|
|
758
|
+
name: l.name,
|
|
759
|
+
description: l.docs
|
|
760
|
+
}))
|
|
755
761
|
}
|
|
756
762
|
};
|
|
757
763
|
})
|
|
@@ -759,38 +765,46 @@ Type: \`${e.type}\``, rt = (e, t, s, r) => ({
|
|
|
759
765
|
}
|
|
760
766
|
}), we = (e, t, s) => [
|
|
761
767
|
{ name: "Storybook", url: D(e, s) },
|
|
762
|
-
{ name: "Sources", url:
|
|
763
|
-
],
|
|
768
|
+
{ name: "Sources", url: Pe(t, s) }
|
|
769
|
+
], Ue = (e) => {
|
|
764
770
|
if (!e.values.some(({ value: t }) => t === void 0))
|
|
765
771
|
return e.values.map(({ value: t }) => ({ name: t }));
|
|
766
|
-
},
|
|
767
|
-
version:
|
|
768
|
-
tags:
|
|
769
|
-
const
|
|
772
|
+
}, lt = (e, t, s) => ({
|
|
773
|
+
version: 1.1,
|
|
774
|
+
tags: e.components.map((r) => {
|
|
775
|
+
const o = we(t, s, r.filePath);
|
|
770
776
|
return {
|
|
771
|
-
name:
|
|
772
|
-
description: ge(
|
|
773
|
-
attributes:
|
|
774
|
-
name:
|
|
775
|
-
description:
|
|
776
|
-
values:
|
|
777
|
-
references:
|
|
777
|
+
name: r.tag,
|
|
778
|
+
description: ge(r),
|
|
779
|
+
attributes: r.props.map((n) => ({
|
|
780
|
+
name: n.attr || n.name,
|
|
781
|
+
description: z(n),
|
|
782
|
+
values: Ue(n),
|
|
783
|
+
references: o
|
|
778
784
|
})),
|
|
779
|
-
references:
|
|
785
|
+
references: o
|
|
780
786
|
};
|
|
781
787
|
}),
|
|
782
788
|
globalAttributes: [],
|
|
783
789
|
valueSets: []
|
|
784
|
-
}),
|
|
790
|
+
}), it = (e) => ({
|
|
791
|
+
version: 1.1,
|
|
792
|
+
properties: e.components.flatMap(
|
|
793
|
+
(t) => t.styles.map((s) => ({
|
|
794
|
+
name: s.name,
|
|
795
|
+
description: s.docs
|
|
796
|
+
}))
|
|
797
|
+
)
|
|
798
|
+
}), at = (e) => {
|
|
785
799
|
const t = { value: "2023", pattern: "yyyy" }, s = { value: "12", pattern: "mm" }, r = { value: "24", pattern: "dd" };
|
|
786
|
-
return
|
|
787
|
-
},
|
|
800
|
+
return ze([t.value, s.value, r.value].join("-"), e, { timeZone: "UTC" }).replace(t.value, t.pattern).replace(s.value, s.pattern).replace(r.value, r.pattern);
|
|
801
|
+
}, ct = (e) => e.toISOString().split("T")[0], We = (e, t, s) => {
|
|
788
802
|
const r = e.closest("[lang]"), o = Intl.NumberFormat.supportedLocalesOf(r == null ? void 0 : r.lang), n = o.length > 0 && typeof o[0] == "string" ? o[0] : navigator.language || s, l = n.split("-").shift();
|
|
789
803
|
return {
|
|
790
804
|
locale: n,
|
|
791
805
|
messages: t[l] || t[s]
|
|
792
806
|
};
|
|
793
|
-
},
|
|
807
|
+
}, ft = (e, t, s) => new Intl.NumberFormat(t, { style: "currency", currency: s }).format(e), ut = (e, t, s = 0) => new Intl.NumberFormat(t, { minimumFractionDigits: s }).format(s > 0 ? Number(e == null ? void 0 : e.toFixed(s)) : e), He = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/, ze = (e, t, s) => typeof e != "string" || e === "" || !He.test(e) ? "" : new Intl.DateTimeFormat(t, s).format(new Date(e)), $t = (e, t) => (s) => We(s, e, t), dt = ({ disconnect: e, observe: t, takeRecords: s }) => {
|
|
794
808
|
class r {
|
|
795
809
|
constructor(n) {
|
|
796
810
|
/**
|
|
@@ -819,7 +833,7 @@ Type: \`${e.type}\``, rt = (e, t, s, r) => ({
|
|
|
819
833
|
value: r
|
|
820
834
|
});
|
|
821
835
|
}), r;
|
|
822
|
-
},
|
|
836
|
+
}, pt = ({ disconnect: e, observe: t }) => {
|
|
823
837
|
class s {
|
|
824
838
|
constructor(o) {
|
|
825
839
|
/**
|
|
@@ -859,7 +873,7 @@ class Be extends Event {
|
|
|
859
873
|
g(this, "detail");
|
|
860
874
|
}
|
|
861
875
|
}
|
|
862
|
-
const
|
|
876
|
+
const gt = () => {
|
|
863
877
|
class e extends Be {
|
|
864
878
|
}
|
|
865
879
|
return [window, global].forEach((t) => {
|
|
@@ -871,32 +885,35 @@ const $t = () => {
|
|
|
871
885
|
}), e;
|
|
872
886
|
};
|
|
873
887
|
export {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
888
|
+
Xe as ClassList,
|
|
889
|
+
ot as StorybookPreview,
|
|
890
|
+
Je as allItemsAreString,
|
|
891
|
+
Ve as cleanString,
|
|
892
|
+
Ie as createID,
|
|
893
|
+
He as dateRegExp,
|
|
894
|
+
ct as dateToString,
|
|
895
|
+
$t as defineLocales,
|
|
896
|
+
tt as filterArgs,
|
|
897
|
+
Qe as focusableElements,
|
|
898
|
+
at as getLocaleDatePattern,
|
|
885
899
|
te as getParentWindows,
|
|
886
|
-
|
|
900
|
+
rt as getStoryHTML,
|
|
887
901
|
D as getStorybookUrl,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
902
|
+
Ze as getWindows,
|
|
903
|
+
Ke as isTagName,
|
|
904
|
+
me as isValidString,
|
|
905
|
+
Ge as isValideID,
|
|
906
|
+
ft as localeCurrency,
|
|
907
|
+
ze as localeDate,
|
|
908
|
+
ut as localeNumber,
|
|
909
|
+
et as nextTick,
|
|
910
|
+
dt as setupMutationObserverMock,
|
|
911
|
+
pt as setupResizeObserverMock,
|
|
912
|
+
gt as setupSubmitEventMock,
|
|
913
|
+
st as stencilWrapper,
|
|
914
|
+
Ye as toString,
|
|
915
|
+
it as vsCodeCssGenerator,
|
|
916
|
+
lt as vsCodeGenerator,
|
|
917
|
+
nt as webTypesGenerator
|
|
901
918
|
};
|
|
902
919
|
//# sourceMappingURL=index.es.js.map
|