@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 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
- - **Test**: Centralizes all test utilities to simplify testing your components.
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](./doc/README.md)
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) => boolean;
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,OAA2D,CAAC;AAE3G;;;;;;;;;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"}
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"}
@@ -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('1.0.0', jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
69
+ * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
65
70
  * ```
66
71
  */
67
- export declare const vsCodeGenerator: (version: string, jsonDocs: JsonDocs, storybookBaseUrl: string, sourceBaseUrl: string) => {
68
- version: string;
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
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C3G,CAAC;AA4BH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,YAAa,MAAM,YAAY,QAAQ,oBAAoB,MAAM,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;CAkBlH,CAAC"}
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
@@ -2,5 +2,6 @@ export * from './components';
2
2
  export * from './ide';
3
3
  export * from './locale';
4
4
  export * from './storybook';
5
- export * from './test';
5
+ export * from './tests';
6
+ export * from './types';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -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,QAAQ,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)), P = (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 ze = (e = "", t = 10) => {
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 Ie {
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 Ge = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Xe = (e, t) => t.includes(e == null ? void 0 : e.tagName.toLowerCase()), Ke = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier], mg-button', Qe = (e) => {
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
- }, Ze = (e) => typeof e == "string" && e.trim() !== "", Je = (e) => typeof e == "string" ? e.toLocaleLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "") : e, Ye = async (e) => e();
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
- }, me = Object.defineProperty, be = (e, t) => {
156
+ }, be = Object.defineProperty, Se = (e, t) => {
157
157
  for (var s in t)
158
- me(e, s, { get: t[s], enumerable: !0 });
159
- }, K = (e, t) => t in e, Q = "http://www.w3.org/1999/xlink", q = typeof window < "u" ? window : {}, _ = q.document || { head: {} };
160
- q.HTMLElement;
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
- }, Z = {}, Se = "http://www.w3.org/2000/svg", Te = "http://www.w3.org/1999/xhtml", ke = (e) => e != null, re = (e) => (e = typeof e, e === "object" || e === "function"), xe = {};
170
- be(xe, {
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: () => Ae,
172
+ map: () => Ee,
173
173
  ok: () => U,
174
- unwrap: () => Ee,
175
- unwrapErr: () => Le
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 Ae(e, t) {
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 Ee = (e) => {
197
+ var Le = (e) => {
198
198
  if (e.isOk)
199
199
  return e.value;
200
200
  throw e.value;
201
- }, Le = (e) => {
201
+ }, je = (e) => {
202
202
  if (e.isErr)
203
203
  return e.value;
204
204
  throw e.value;
205
- }, je = (e, t, ...s) => {
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
- }, Re = {}, Oe = (e) => e && e.$tag$ === Re, J = (e, t, s, r, o, n) => {
223
+ }, Oe = {}, Me = (e) => e && e.$tag$ === Oe, Z = (e, t, s, r, o, n) => {
224
224
  if (s !== r) {
225
- let l = K(e, t), a = t.toLowerCase();
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) : K(q, a) ? t = a.slice(2) : t = a[2] + t.slice(3), s || r) {
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(_e, ""), s && L.rel(e, t, s, c), r && L.ael(e, t, r, c);
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(Q, t) : e.removeAttribute(t)) : (!l || n & 4 || o) && !c && (r = r === !0 ? "" : r, d ? e.setAttributeNS(Q, t, r) : e.setAttribute(t, r));
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
- }, Me = /\s/, Y = (e) => e ? e.split(Me) : [], ne = "Capture", _e = 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$ || Z, n = t.$attrs$ || Z;
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 || J(r, l, o[l], void 0, s, t.$flags$);
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
- J(r, l, o[l], n[l], s, t.$flags$);
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, z = !1, h = !1, C = (e, t, s, r) => {
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 || (z = !0, n.$tag$ === "slot" && (x && r.classList.add(x + "-s"), n.$flags$ |= n.$children$ ? (
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 ? Se : Te,
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 && ke(x) && a["s-si"] !== x && a.classList.add(a["s-si"] = x), G(a, r), n.$children$)
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, z = !0), t && R(o, t);
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
- }, Ne = (e, t, s, r, o = !1) => {
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 ? Ne(r, o, t, n, s) : n !== null ? (e.$text$ !== null && (r.textContent = ""), ie(r, null, t, n, 0, n.length - 1)) : (
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
- }, Fe = (e, t, s = !1) => {
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 = Oe(t) ? t : je(null, null, t);
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, z) {
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 Ce = (e, t, s) => {
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
- Ce(n, l, s[l]);
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
- }, Ve = (e, t) => {
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
- }, et = (e, t) => {
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"), Fe(
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
- }, tt = ({ $tag$: e, $attrs$: t, $children$: s, $text$: r }) => {
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, w;
538
- class st {
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
- P(this, S, (t) => this.jsonDoc.components.find((s) => s.tag === t));
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
- P(this, w, (t) => {
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, w).call(this, i);
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(), w = new WeakMap();
686
- const De = (e, t) => {
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
- }, B = (e) => `${e.docs}
715
+ }, z = (e) => `${e.docs}
716
716
 
717
- Type: \`${e.type}\``, rt = (e, t, s, r) => ({
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: B(l),
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: B(l),
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: De(t, s) }
763
- ], Pe = (e) => {
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
- }, ot = (e, t, s, r) => ({
767
- version: e,
768
- tags: t.components.map((o) => {
769
- const n = we(s, r, o.filePath);
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: o.tag,
772
- description: ge(o),
773
- attributes: o.props.map((l) => ({
774
- name: l.attr || l.name,
775
- description: B(l),
776
- values: Pe(l),
777
- references: n
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: n
785
+ references: o
780
786
  };
781
787
  }),
782
788
  globalAttributes: [],
783
789
  valueSets: []
784
- }), nt = (e) => {
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 He([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);
787
- }, lt = (e) => e.toISOString().split("T")[0], Ue = (e, t, s) => {
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
- }, it = (e, t, s) => new Intl.NumberFormat(t, { style: "currency", currency: s }).format(e), at = (e, t, s = 0) => new Intl.NumberFormat(t, { minimumFractionDigits: s }).format(s > 0 ? Number(e == null ? void 0 : e.toFixed(s)) : e), We = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/, He = (e, t, s) => typeof e != "string" || e === "" || !We.test(e) ? "" : new Intl.DateTimeFormat(t, s).format(new Date(e)), ct = (e, t) => (s) => Ue(s, e, t), ft = ({ disconnect: e, observe: t, takeRecords: s }) => {
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
- }, ut = ({ disconnect: e, observe: t }) => {
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 $t = () => {
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
- Ie as ClassList,
875
- st as StorybookPreview,
876
- Ge as allItemsAreString,
877
- Je as cleanString,
878
- ze as createID,
879
- We as dateRegExp,
880
- lt as dateToString,
881
- ct as defineLocales,
882
- Ve as filterArgs,
883
- Ke as focusableElements,
884
- nt as getLocaleDatePattern,
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
- tt as getStoryHTML,
900
+ rt as getStoryHTML,
887
901
  D as getStorybookUrl,
888
- Qe as getWindows,
889
- Xe as isTagName,
890
- Ze as isValidString,
891
- it as localeCurrency,
892
- He as localeDate,
893
- at as localeNumber,
894
- Ye as nextTick,
895
- ft as setupMutationObserverMock,
896
- ut as setupResizeObserverMock,
897
- $t as setupSubmitEventMock,
898
- et as stencilWrapper,
899
- ot as vsCodeGenerator,
900
- rt as webTypesGenerator
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