@maggioli-design-system/mds-accordion-timer 2.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cjs/{index-bd5d8a33.js → index-d958b818.js} +91 -5
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/mds-accordion-timer.cjs.entry.js +1 -1
  4. package/dist/cjs/mds-accordion-timer.cjs.js +7 -3
  5. package/dist/collection/collection-manifest.json +2 -2
  6. package/dist/collection/common/keyboard-manager.js +40 -0
  7. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +3 -3
  8. package/dist/collection/dictionary/icon.js +3 -1
  9. package/dist/collection/dictionary/typography.js +5 -1
  10. package/dist/components/index.d.ts +9 -0
  11. package/dist/components/index.js +1 -1
  12. package/dist/components/mds-accordion-timer.js +1 -1
  13. package/dist/esm/{index-afb1c64b.js → index-22b73a3a.js} +91 -6
  14. package/dist/esm/loader.js +4 -3
  15. package/dist/esm/mds-accordion-timer.entry.js +1 -1
  16. package/dist/esm/mds-accordion-timer.js +4 -3
  17. package/dist/esm/polyfills/css-shim.js +1 -1
  18. package/dist/esm-es5/index-22b73a3a.js +2 -0
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
  21. package/dist/esm-es5/mds-accordion-timer.js +1 -1
  22. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
  23. package/dist/mds-accordion-timer/mds-accordion-timer.js +1 -1
  24. package/{www/build/p-6bb3b141.system.entry.js → dist/mds-accordion-timer/p-118bf4e5.system.entry.js} +1 -1
  25. package/dist/mds-accordion-timer/p-3face4e0.system.js +2 -0
  26. package/dist/mds-accordion-timer/p-9084d19f.js +2 -0
  27. package/dist/mds-accordion-timer/p-c6d75694.system.js +1 -0
  28. package/dist/mds-accordion-timer/{p-ff15a152.entry.js → p-f44da2be.entry.js} +1 -1
  29. package/dist/stats.json +36 -33
  30. package/dist/types/common/keyboard-manager.d.ts +11 -0
  31. package/dist/types/dictionary/icon.d.ts +2 -1
  32. package/dist/types/dictionary/typography.d.ts +2 -1
  33. package/dist/types/stencil-public-runtime.d.ts +59 -3
  34. package/dist/types/types/autocomplete.d.ts +2 -2
  35. package/dist/types/types/button.d.ts +4 -4
  36. package/dist/types/types/floating-ui.d.ts +2 -2
  37. package/dist/types/types/form-rel.d.ts +1 -1
  38. package/dist/types/types/input-text-type.d.ts +1 -1
  39. package/dist/types/types/input-value-type.d.ts +1 -1
  40. package/dist/types/types/loading.d.ts +1 -1
  41. package/dist/types/types/typography.d.ts +9 -8
  42. package/dist/types/types/variant.d.ts +10 -10
  43. package/loader/index.d.ts +9 -0
  44. package/package.json +5 -5
  45. package/src/common/keyboard-manager.ts +46 -0
  46. package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +3 -3
  47. package/src/components/mds-accordion-timer/test/mds-accordion-timer.e2e.ts +1 -1
  48. package/src/dictionary/icon.ts +4 -0
  49. package/src/dictionary/typography.ts +9 -3
  50. package/src/fixtures/icons.json +177 -0
  51. package/src/fixtures/iconsauce.json +175 -0
  52. package/src/tailwind/components.css +1 -0
  53. package/src/types/typography.ts +4 -0
  54. package/www/build/mds-accordion-timer.esm.js +1 -1
  55. package/www/build/mds-accordion-timer.js +1 -1
  56. package/{dist/mds-accordion-timer/p-6bb3b141.system.entry.js → www/build/p-118bf4e5.system.entry.js} +1 -1
  57. package/www/build/p-3face4e0.system.js +2 -0
  58. package/www/build/p-9084d19f.js +2 -0
  59. package/www/build/p-c6d75694.system.js +1 -0
  60. package/www/build/{p-ff15a152.entry.js → p-f44da2be.entry.js} +1 -1
  61. package/dist/esm-es5/index-afb1c64b.js +0 -2
  62. package/dist/mds-accordion-timer/p-94dc5a3c.system.js +0 -1
  63. package/dist/mds-accordion-timer/p-d5616601.js +0 -2
  64. package/dist/mds-accordion-timer/p-e2fa938f.system.js +0 -2
  65. package/www/build/p-94dc5a3c.system.js +0 -1
  66. package/www/build/p-d5616601.js +0 -2
  67. package/www/build/p-e2fa938f.system.js +0 -2
@@ -47,13 +47,25 @@ const uniqueTime = (key, measureText) => {
47
47
  };
48
48
  }
49
49
  };
50
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
50
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
51
51
  const isDef = (v) => v != null;
52
52
  const isComplexType = (o) => {
53
53
  // https://jsperf.com/typeof-fn-object/5
54
54
  o = typeof o;
55
55
  return o === 'object' || o === 'function';
56
56
  };
57
+ /**
58
+ * Helper method for querying a `meta` tag that contains a nonce value
59
+ * out of a DOM's head.
60
+ *
61
+ * @param doc The DOM containing the `head` to query against
62
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
63
+ * exists or the tag has no content.
64
+ */
65
+ function queryNonceMetaTagContent(doc) {
66
+ var _a, _b, _c;
67
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
68
+ }
57
69
  /**
58
70
  * Production h() function based on Preact by
59
71
  * Jason Miller (@developit)
@@ -62,7 +74,6 @@ const isComplexType = (o) => {
62
74
  *
63
75
  * Modified for Stencil's compiler and vdom
64
76
  */
65
- // const stack: any[] = [];
66
77
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
67
78
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
68
79
  const h = (nodeName, vnodeData, ...children) => {
@@ -100,6 +111,14 @@ const h = (nodeName, vnodeData, ...children) => {
100
111
  }
101
112
  return vnode;
102
113
  };
114
+ /**
115
+ * A utility function for creating a virtual DOM node from a tag and some
116
+ * possible text content.
117
+ *
118
+ * @param tag the tag for this element
119
+ * @param text possible text content for the node
120
+ * @returns a newly-minted virtual DOM node
121
+ */
103
122
  const newVNode = (tag, text) => {
104
123
  const vnode = {
105
124
  $flags$: 0,
@@ -111,6 +130,12 @@ const newVNode = (tag, text) => {
111
130
  return vnode;
112
131
  };
113
132
  const Host = {};
133
+ /**
134
+ * Check whether a given node is a Host node or not
135
+ *
136
+ * @param node the virtual DOM node to check
137
+ * @returns whether it's a Host node or not
138
+ */
114
139
  const isHost = (node) => node && node.$tag$ === Host;
115
140
  /**
116
141
  * Parse a new property value for a given property type.
@@ -193,6 +218,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
193
218
  styles.set(scopeId, style);
194
219
  };
195
220
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
221
+ var _a;
196
222
  let scopeId = getScopeId(cmpMeta);
197
223
  const style = styles.get(scopeId);
198
224
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -212,6 +238,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
212
238
  styleElm = doc.createElement('style');
213
239
  styleElm.innerHTML = style;
214
240
  }
241
+ // Apply CSP nonce to the style tag if it exists
242
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
243
+ if (nonce != null) {
244
+ styleElm.setAttribute('nonce', nonce);
245
+ }
215
246
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
216
247
  }
217
248
  if (appliedStyles) {
@@ -283,6 +314,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
283
314
  }
284
315
  return elm;
285
316
  };
317
+ /**
318
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
319
+ * add them to the DOM in the appropriate place.
320
+ *
321
+ * @param parentElm the DOM node which should be used as a parent for the new
322
+ * DOM nodes
323
+ * @param before a child of the `parentElm` which the new children should be
324
+ * inserted before (optional)
325
+ * @param parentVNode the parent virtual DOM node
326
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
327
+ * @param startIdx the index in the child virtual DOM nodes at which to start
328
+ * creating DOM nodes (inclusive)
329
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
330
+ * creating DOM nodes (inclusive)
331
+ */
286
332
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
287
333
  let containerElm = (parentElm);
288
334
  let childNode;
@@ -299,6 +345,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
299
345
  }
300
346
  }
301
347
  };
348
+ /**
349
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
350
+ * This can be used to, for instance, clean up after a list of children which
351
+ * should no longer be shown.
352
+ *
353
+ * This function also handles some of Stencil's slot relocation logic.
354
+ *
355
+ * @param vnodes a list of virtual DOM nodes to remove
356
+ * @param startIdx the index at which to start removing nodes (inclusive)
357
+ * @param endIdx the index at which to stop removing nodes (inclusive)
358
+ * @param vnode a VNode
359
+ * @param elm an element
360
+ */
302
361
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
303
362
  for (; startIdx <= endIdx; ++startIdx) {
304
363
  if ((vnode = vnodes[startIdx])) {
@@ -490,7 +549,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
490
549
  *
491
550
  * So, in other words, if `key` attrs are not set on VNodes which may be
492
551
  * changing order within a `children` array or something along those lines then
493
- * we could obtain a false positive and then have to do needless re-rendering.
552
+ * we could obtain a false negative and then have to do needless re-rendering
553
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
494
554
  *
495
555
  * @param leftVNode the first VNode to check
496
556
  * @param rightVNode the second VNode to check
@@ -532,6 +592,18 @@ const patch = (oldVNode, newVNode) => {
532
592
  }
533
593
  }
534
594
  };
595
+ /**
596
+ * The main entry point for Stencil's virtual DOM-based rendering engine
597
+ *
598
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
599
+ * function will handle creating a virtual DOM tree with a single root, patching
600
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
601
+ * relocation, and reflecting attributes.
602
+ *
603
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
604
+ * the DOM node into which it should be rendered.
605
+ * @param renderFnResults the virtual DOM nodes to be rendered
606
+ */
535
607
  const renderVdom = (hostRef, renderFnResults) => {
536
608
  const hostElm = hostRef.$hostElement$;
537
609
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -707,8 +779,8 @@ const safeCall = (instance, method, arg) => {
707
779
  const then = (promise, thenFn) => {
708
780
  return promise && promise.then ? promise.then(thenFn) : thenFn();
709
781
  };
710
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
711
- ;
782
+ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
783
+ ;
712
784
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
713
785
  const setValue = (ref, propName, newVal, cmpMeta) => {
714
786
  // check our new property value against our internal value
@@ -974,6 +1046,7 @@ const disconnectedCallback = (elm) => {
974
1046
  }
975
1047
  };
976
1048
  const bootstrapLazy = (lazyBundles, options = {}) => {
1049
+ var _a;
977
1050
  const endBootstrap = createTime();
978
1051
  const cmpTags = [];
979
1052
  const exclude = options.exclude || [];
@@ -1050,6 +1123,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1050
1123
  {
1051
1124
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1052
1125
  visibilityStyle.setAttribute('data-styles', '');
1126
+ // Apply CSP nonce to the style tag if it exists
1127
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1128
+ if (nonce != null) {
1129
+ visibilityStyle.setAttribute('nonce', nonce);
1130
+ }
1053
1131
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1054
1132
  }
1055
1133
  // Process deferred connectedCallbacks now all components have been registered
@@ -1094,6 +1172,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1094
1172
  };
1095
1173
  // prettier-ignore
1096
1174
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1175
+ /**
1176
+ * Assigns the given value to the nonce property on the runtime platform object.
1177
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1178
+ * @param nonce The value to be assigned to the platform nonce property.
1179
+ * @returns void
1180
+ */
1181
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1097
1182
  const hostRefs = /*@__PURE__*/ new WeakMap();
1098
1183
  const getHostRef = (ref) => hostRefs.get(ref);
1099
1184
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1207,3 +1292,4 @@ exports.getElement = getElement;
1207
1292
  exports.h = h;
1208
1293
  exports.promiseResolve = promiseResolve;
1209
1294
  exports.registerInstance = registerInstance;
1295
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-bd5d8a33.js');
5
+ const index = require('./index-d958b818.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.19.3 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,8 +14,9 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"clickActive","onClickActive"],[0,"mouseEnterActive","onMouseEnterActive"],[0,"mouseLeaveActive","onMouseLeaveActive"]]]]]], options);
17
+ return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"activeClicked","onClickActive"],[0,"activeMouseEnter","onMouseEnterActive"],[0,"activeMouseLeave","onMouseLeaveActive"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-bd5d8a33.js');
5
+ const index = require('./index-d958b818.js');
6
6
 
7
7
  const mdsAccordionTimerCss = ":host{display:block}";
8
8
 
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-bd5d8a33.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d958b818.js');
4
6
 
5
7
  /*
6
- Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
7
9
  */
8
10
  const patchBrowser = () => {
9
11
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-accordion-timer.cjs.js', document.baseURI).href));
@@ -15,5 +17,7 @@ const patchBrowser = () => {
15
17
  };
16
18
 
17
19
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"clickActive","onClickActive"],[0,"mouseEnterActive","onMouseEnterActive"],[0,"mouseLeaveActive","onMouseLeaveActive"]]]]]], options);
20
+ return index.bootstrapLazy([["mds-accordion-timer.cjs",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"activeClicked","onClickActive"],[0,"activeMouseEnter","onMouseEnterActive"],[0,"activeMouseLeave","onMouseLeaveActive"]]]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -4,8 +4,8 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.19.3",
8
- "typescriptVersion": "4.7.4"
7
+ "version": "2.22.2",
8
+ "typescriptVersion": "4.9.4"
9
9
  },
10
10
  "collections": [],
11
11
  "bundles": []
@@ -0,0 +1,40 @@
1
+ export class KeyboardManager {
2
+ constructor() {
3
+ this.elements = [];
4
+ this.handleClickBehaviorDispatchEvent = (event) => {
5
+ if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
6
+ event.target.click();
7
+ }
8
+ };
9
+ this.handleEscapeBehaviorDispatchEvent = (event) => {
10
+ if (event.code === 'Escape' && this.escapeCallback) {
11
+ this.escapeCallback();
12
+ }
13
+ };
14
+ this.addElement = (el, name = 'element') => {
15
+ this.elements[name] = el;
16
+ };
17
+ this.attachClickBehavior = (name = 'element') => {
18
+ if (this.elements[name]) {
19
+ this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
20
+ }
21
+ };
22
+ this.detachClickBehavior = (name = 'element') => {
23
+ if (this.elements[name]) {
24
+ this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
25
+ }
26
+ };
27
+ this.attachEscapeBehavior = (callBack) => {
28
+ this.escapeCallback = callBack;
29
+ if (typeof window !== undefined) {
30
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
31
+ }
32
+ };
33
+ this.detachEscapeBehavior = () => {
34
+ this.escapeCallback = null;
35
+ if (typeof window !== undefined) {
36
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
37
+ }
38
+ };
39
+ }
40
+ }
@@ -170,19 +170,19 @@ export class MdsAccordionTimer {
170
170
  static get elementRef() { return "element"; }
171
171
  static get listeners() {
172
172
  return [{
173
- "name": "clickActive",
173
+ "name": "activeClicked",
174
174
  "method": "onClickActive",
175
175
  "target": undefined,
176
176
  "capture": false,
177
177
  "passive": false
178
178
  }, {
179
- "name": "mouseEnterActive",
179
+ "name": "activeMouseEnter",
180
180
  "method": "onMouseEnterActive",
181
181
  "target": undefined,
182
182
  "capture": false,
183
183
  "passive": false
184
184
  }, {
185
- "name": "mouseLeaveActive",
185
+ "name": "activeMouseLeave",
186
186
  "method": "onMouseLeaveActive",
187
187
  "target": undefined,
188
188
  "capture": false,
@@ -1,3 +1,5 @@
1
1
  import jsonIconsDictionary from '../fixtures/icons.json';
2
+ import jsonMggIconsDictionary from '../fixtures/iconsauce.json';
2
3
  const iconsDictionary = jsonIconsDictionary;
3
- export { iconsDictionary, };
4
+ const mggIconsDictionary = jsonMggIconsDictionary;
5
+ export { iconsDictionary, mggIconsDictionary, };
@@ -21,6 +21,10 @@ const typographyVariationsDictionary = [
21
21
  'read',
22
22
  'code',
23
23
  ];
24
+ const typographyReadingVariationsDictionary = [
25
+ 'info',
26
+ 'read',
27
+ ];
24
28
  const typographyMonoDictionary = [
25
29
  'snippet',
26
30
  'hack',
@@ -56,4 +60,4 @@ const typographyTooltipDictionary = [
56
60
  'detail',
57
61
  'tip',
58
62
  ];
59
- export { typographyDictionary, typographyVariationsDictionary, typographyMonoDictionary, typographyTitleDictionary, typographyInfoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTooltipDictionary, };
63
+ export { typographyDictionary, typographyInfoDictionary, typographyReadingVariationsDictionary, typographyMonoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTitleDictionary, typographyTooltipDictionary, typographyVariationsDictionary, };
@@ -13,6 +13,15 @@ export { MdsAccordionTimer as MdsAccordionTimer } from '../types/components/mds-
13
13
  */
14
14
  export declare const setAssetPath: (path: string) => void;
15
15
 
16
+ /**
17
+ * Used to specify a nonce value that corresponds with an application's CSP.
18
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
19
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
20
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
21
+ * will result in the same behavior.
22
+ */
23
+ export declare const setNonce: (nonce: string) => void
24
+
16
25
  export interface SetPlatformOptions {
17
26
  raf?: (c: FrameRequestCallback) => number;
18
27
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
@@ -1,2 +1,2 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
1
+ export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
2
  export { MdsAccordionTimer, defineCustomElement as defineCustomElementMdsAccordionTimer } from './mds-accordion-timer.js';
@@ -122,7 +122,7 @@ const MdsAccordionTimer$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
122
122
  }, [1, "mds-accordion-timer", {
123
123
  "duration": [2],
124
124
  "time": [32]
125
- }, [[0, "clickActive", "onClickActive"], [0, "mouseEnterActive", "onMouseEnterActive"], [0, "mouseLeaveActive", "onMouseLeaveActive"]]]);
125
+ }, [[0, "activeClicked", "onClickActive"], [0, "activeMouseEnter", "onMouseEnterActive"], [0, "activeMouseLeave", "onMouseLeaveActive"]]]);
126
126
  function defineCustomElement$1() {
127
127
  if (typeof customElements === "undefined") {
128
128
  return;
@@ -25,13 +25,25 @@ const uniqueTime = (key, measureText) => {
25
25
  };
26
26
  }
27
27
  };
28
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
28
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
29
29
  const isDef = (v) => v != null;
30
30
  const isComplexType = (o) => {
31
31
  // https://jsperf.com/typeof-fn-object/5
32
32
  o = typeof o;
33
33
  return o === 'object' || o === 'function';
34
34
  };
35
+ /**
36
+ * Helper method for querying a `meta` tag that contains a nonce value
37
+ * out of a DOM's head.
38
+ *
39
+ * @param doc The DOM containing the `head` to query against
40
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
41
+ * exists or the tag has no content.
42
+ */
43
+ function queryNonceMetaTagContent(doc) {
44
+ var _a, _b, _c;
45
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
46
+ }
35
47
  /**
36
48
  * Production h() function based on Preact by
37
49
  * Jason Miller (@developit)
@@ -40,7 +52,6 @@ const isComplexType = (o) => {
40
52
  *
41
53
  * Modified for Stencil's compiler and vdom
42
54
  */
43
- // const stack: any[] = [];
44
55
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
45
56
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
46
57
  const h = (nodeName, vnodeData, ...children) => {
@@ -78,6 +89,14 @@ const h = (nodeName, vnodeData, ...children) => {
78
89
  }
79
90
  return vnode;
80
91
  };
92
+ /**
93
+ * A utility function for creating a virtual DOM node from a tag and some
94
+ * possible text content.
95
+ *
96
+ * @param tag the tag for this element
97
+ * @param text possible text content for the node
98
+ * @returns a newly-minted virtual DOM node
99
+ */
81
100
  const newVNode = (tag, text) => {
82
101
  const vnode = {
83
102
  $flags$: 0,
@@ -89,6 +108,12 @@ const newVNode = (tag, text) => {
89
108
  return vnode;
90
109
  };
91
110
  const Host = {};
111
+ /**
112
+ * Check whether a given node is a Host node or not
113
+ *
114
+ * @param node the virtual DOM node to check
115
+ * @returns whether it's a Host node or not
116
+ */
92
117
  const isHost = (node) => node && node.$tag$ === Host;
93
118
  /**
94
119
  * Parse a new property value for a given property type.
@@ -171,6 +196,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
171
196
  styles.set(scopeId, style);
172
197
  };
173
198
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
199
+ var _a;
174
200
  let scopeId = getScopeId(cmpMeta);
175
201
  const style = styles.get(scopeId);
176
202
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -190,6 +216,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
190
216
  styleElm = doc.createElement('style');
191
217
  styleElm.innerHTML = style;
192
218
  }
219
+ // Apply CSP nonce to the style tag if it exists
220
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
221
+ if (nonce != null) {
222
+ styleElm.setAttribute('nonce', nonce);
223
+ }
193
224
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
194
225
  }
195
226
  if (appliedStyles) {
@@ -261,6 +292,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
261
292
  }
262
293
  return elm;
263
294
  };
295
+ /**
296
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
297
+ * add them to the DOM in the appropriate place.
298
+ *
299
+ * @param parentElm the DOM node which should be used as a parent for the new
300
+ * DOM nodes
301
+ * @param before a child of the `parentElm` which the new children should be
302
+ * inserted before (optional)
303
+ * @param parentVNode the parent virtual DOM node
304
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
305
+ * @param startIdx the index in the child virtual DOM nodes at which to start
306
+ * creating DOM nodes (inclusive)
307
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
308
+ * creating DOM nodes (inclusive)
309
+ */
264
310
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
265
311
  let containerElm = (parentElm);
266
312
  let childNode;
@@ -277,6 +323,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
277
323
  }
278
324
  }
279
325
  };
326
+ /**
327
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
328
+ * This can be used to, for instance, clean up after a list of children which
329
+ * should no longer be shown.
330
+ *
331
+ * This function also handles some of Stencil's slot relocation logic.
332
+ *
333
+ * @param vnodes a list of virtual DOM nodes to remove
334
+ * @param startIdx the index at which to start removing nodes (inclusive)
335
+ * @param endIdx the index at which to stop removing nodes (inclusive)
336
+ * @param vnode a VNode
337
+ * @param elm an element
338
+ */
280
339
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
281
340
  for (; startIdx <= endIdx; ++startIdx) {
282
341
  if ((vnode = vnodes[startIdx])) {
@@ -468,7 +527,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
468
527
  *
469
528
  * So, in other words, if `key` attrs are not set on VNodes which may be
470
529
  * changing order within a `children` array or something along those lines then
471
- * we could obtain a false positive and then have to do needless re-rendering.
530
+ * we could obtain a false negative and then have to do needless re-rendering
531
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
472
532
  *
473
533
  * @param leftVNode the first VNode to check
474
534
  * @param rightVNode the second VNode to check
@@ -510,6 +570,18 @@ const patch = (oldVNode, newVNode) => {
510
570
  }
511
571
  }
512
572
  };
573
+ /**
574
+ * The main entry point for Stencil's virtual DOM-based rendering engine
575
+ *
576
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
577
+ * function will handle creating a virtual DOM tree with a single root, patching
578
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
579
+ * relocation, and reflecting attributes.
580
+ *
581
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
582
+ * the DOM node into which it should be rendered.
583
+ * @param renderFnResults the virtual DOM nodes to be rendered
584
+ */
513
585
  const renderVdom = (hostRef, renderFnResults) => {
514
586
  const hostElm = hostRef.$hostElement$;
515
587
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -685,8 +757,8 @@ const safeCall = (instance, method, arg) => {
685
757
  const then = (promise, thenFn) => {
686
758
  return promise && promise.then ? promise.then(thenFn) : thenFn();
687
759
  };
688
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
689
- ;
760
+ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
761
+ ;
690
762
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
691
763
  const setValue = (ref, propName, newVal, cmpMeta) => {
692
764
  // check our new property value against our internal value
@@ -952,6 +1024,7 @@ const disconnectedCallback = (elm) => {
952
1024
  }
953
1025
  };
954
1026
  const bootstrapLazy = (lazyBundles, options = {}) => {
1027
+ var _a;
955
1028
  const endBootstrap = createTime();
956
1029
  const cmpTags = [];
957
1030
  const exclude = options.exclude || [];
@@ -1028,6 +1101,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1028
1101
  {
1029
1102
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1030
1103
  visibilityStyle.setAttribute('data-styles', '');
1104
+ // Apply CSP nonce to the style tag if it exists
1105
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1106
+ if (nonce != null) {
1107
+ visibilityStyle.setAttribute('nonce', nonce);
1108
+ }
1031
1109
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1032
1110
  }
1033
1111
  // Process deferred connectedCallbacks now all components have been registered
@@ -1072,6 +1150,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1072
1150
  };
1073
1151
  // prettier-ignore
1074
1152
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1153
+ /**
1154
+ * Assigns the given value to the nonce property on the runtime platform object.
1155
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1156
+ * @param nonce The value to be assigned to the platform nonce property.
1157
+ * @returns void
1158
+ */
1159
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1075
1160
  const hostRefs = /*@__PURE__*/ new WeakMap();
1076
1161
  const getHostRef = (ref) => hostRefs.get(ref);
1077
1162
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1178,4 +1263,4 @@ const flush = () => {
1178
1263
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1179
1264
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1180
1265
 
1181
- export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
1266
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-afb1c64b.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-22b73a3a.js';
2
+ export { s as setNonce } from './index-22b73a3a.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Esm v2.19.3 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchEsm = () => {
7
8
  return promiseResolve();
@@ -10,7 +11,7 @@ const patchEsm = () => {
10
11
  const defineCustomElements = (win, options) => {
11
12
  if (typeof window === 'undefined') return Promise.resolve();
12
13
  return patchEsm().then(() => {
13
- return bootstrapLazy([["mds-accordion-timer",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"clickActive","onClickActive"],[0,"mouseEnterActive","onMouseEnterActive"],[0,"mouseLeaveActive","onMouseLeaveActive"]]]]]], options);
14
+ return bootstrapLazy([["mds-accordion-timer",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"activeClicked","onClickActive"],[0,"activeMouseEnter","onMouseEnterActive"],[0,"activeMouseLeave","onMouseLeaveActive"]]]]]], options);
14
15
  });
15
16
  };
16
17
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-afb1c64b.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-22b73a3a.js';
2
2
 
3
3
  const mdsAccordionTimerCss = ":host{display:block}";
4
4
 
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-afb1c64b.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-22b73a3a.js';
2
+ export { s as setNonce } from './index-22b73a3a.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchBrowser = () => {
7
8
  const importMeta = import.meta.url;
@@ -13,5 +14,5 @@ const patchBrowser = () => {
13
14
  };
14
15
 
15
16
  patchBrowser().then(options => {
16
- return bootstrapLazy([["mds-accordion-timer",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"clickActive","onClickActive"],[0,"mouseEnterActive","onMouseEnterActive"],[0,"mouseLeaveActive","onMouseLeaveActive"]]]]]], options);
17
+ return bootstrapLazy([["mds-accordion-timer",[[1,"mds-accordion-timer",{"duration":[2],"time":[32]},[[0,"activeClicked","onClickActive"],[0,"activeMouseEnter","onMouseEnterActive"],[0,"activeMouseLeave","onMouseLeaveActive"]]]]]], options);
17
18
  });