proto-ikons-wc 0.0.83 → 0.0.85

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5d62eace.js');
5
+ const index = require('./index-5cc2712a.js');
6
6
 
7
7
  const acuraIkonCss = "";
8
8
 
@@ -66,6 +66,18 @@ const isComplexType = (o) => {
66
66
  o = typeof o;
67
67
  return o === 'object' || o === 'function';
68
68
  };
69
+ /**
70
+ * Helper method for querying a `meta` tag that contains a nonce value
71
+ * out of a DOM's head.
72
+ *
73
+ * @param doc The DOM containing the `head` to query against
74
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
75
+ * exists or the tag has no content.
76
+ */
77
+ function queryNonceMetaTagContent(doc) {
78
+ var _a, _b, _c;
79
+ 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;
80
+ }
69
81
  /**
70
82
  * Production h() function based on Preact by
71
83
  * Jason Miller (@developit)
@@ -124,6 +136,14 @@ const h = (nodeName, vnodeData, ...children) => {
124
136
  }
125
137
  return vnode;
126
138
  };
139
+ /**
140
+ * A utility function for creating a virtual DOM node from a tag and some
141
+ * possible text content.
142
+ *
143
+ * @param tag the tag for this element
144
+ * @param text possible text content for the node
145
+ * @returns a newly-minted virtual DOM node
146
+ */
127
147
  const newVNode = (tag, text) => {
128
148
  const vnode = {
129
149
  $flags$: 0,
@@ -138,6 +158,12 @@ const newVNode = (tag, text) => {
138
158
  return vnode;
139
159
  };
140
160
  const Host = {};
161
+ /**
162
+ * Check whether a given node is a Host node or not
163
+ *
164
+ * @param node the virtual DOM node to check
165
+ * @returns whether it's a Host node or not
166
+ */
141
167
  const isHost = (node) => node && node.$tag$ === Host;
142
168
  /**
143
169
  * Parse a new property value for a given property type.
@@ -216,6 +242,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
216
242
  styles.set(scopeId, style);
217
243
  };
218
244
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
245
+ var _a;
219
246
  let scopeId = getScopeId(cmpMeta);
220
247
  const style = styles.get(scopeId);
221
248
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -235,6 +262,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
235
262
  styleElm = doc.createElement('style');
236
263
  styleElm.innerHTML = style;
237
264
  }
265
+ // Apply CSP nonce to the style tag if it exists
266
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
267
+ if (nonce != null) {
268
+ styleElm.setAttribute('nonce', nonce);
269
+ }
238
270
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
239
271
  }
240
272
  if (appliedStyles) {
@@ -414,6 +446,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
414
446
  }
415
447
  return elm;
416
448
  };
449
+ /**
450
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
451
+ * add them to the DOM in the appropriate place.
452
+ *
453
+ * @param parentElm the DOM node which should be used as a parent for the new
454
+ * DOM nodes
455
+ * @param before a child of the `parentElm` which the new children should be
456
+ * inserted before (optional)
457
+ * @param parentVNode the parent virtual DOM node
458
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
459
+ * @param startIdx the index in the child virtual DOM nodes at which to start
460
+ * creating DOM nodes (inclusive)
461
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
462
+ * creating DOM nodes (inclusive)
463
+ */
417
464
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
418
465
  let containerElm = (parentElm);
419
466
  let childNode;
@@ -427,6 +474,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
427
474
  }
428
475
  }
429
476
  };
477
+ /**
478
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
479
+ * This can be used to, for instance, clean up after a list of children which
480
+ * should no longer be shown.
481
+ *
482
+ * This function also handles some of Stencil's slot relocation logic.
483
+ *
484
+ * @param vnodes a list of virtual DOM nodes to remove
485
+ * @param startIdx the index at which to start removing nodes (inclusive)
486
+ * @param endIdx the index at which to stop removing nodes (inclusive)
487
+ * @param vnode a VNode
488
+ * @param elm an element
489
+ */
430
490
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
431
491
  for (; startIdx <= endIdx; ++startIdx) {
432
492
  if ((vnode = vnodes[startIdx])) {
@@ -618,7 +678,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
618
678
  *
619
679
  * So, in other words, if `key` attrs are not set on VNodes which may be
620
680
  * changing order within a `children` array or something along those lines then
621
- * we could obtain a false positive and then have to do needless re-rendering.
681
+ * we could obtain a false negative and then have to do needless re-rendering
682
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
622
683
  *
623
684
  * @param leftVNode the first VNode to check
624
685
  * @param rightVNode the second VNode to check
@@ -688,6 +749,18 @@ const patch = (oldVNode, newVNode) => {
688
749
  elm.data = text;
689
750
  }
690
751
  };
752
+ /**
753
+ * The main entry point for Stencil's virtual DOM-based rendering engine
754
+ *
755
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
756
+ * function will handle creating a virtual DOM tree with a single root, patching
757
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
758
+ * relocation, and reflecting attributes.
759
+ *
760
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
761
+ * the DOM node into which it should be rendered.
762
+ * @param renderFnResults the virtual DOM nodes to be rendered
763
+ */
691
764
  const renderVdom = (hostRef, renderFnResults) => {
692
765
  const hostElm = hostRef.$hostElement$;
693
766
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -1078,6 +1151,7 @@ const disconnectedCallback = (elm) => {
1078
1151
  }
1079
1152
  };
1080
1153
  const bootstrapLazy = (lazyBundles, options = {}) => {
1154
+ var _a;
1081
1155
  const endBootstrap = createTime();
1082
1156
  const cmpTags = [];
1083
1157
  const exclude = options.exclude || [];
@@ -1140,6 +1214,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1140
1214
  {
1141
1215
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1142
1216
  visibilityStyle.setAttribute('data-styles', '');
1217
+ // Apply CSP nonce to the style tag if it exists
1218
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1219
+ if (nonce != null) {
1220
+ visibilityStyle.setAttribute('nonce', nonce);
1221
+ }
1143
1222
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1144
1223
  }
1145
1224
  // Process deferred connectedCallbacks now all components have been registered
@@ -1155,6 +1234,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1155
1234
  // Fallback appLoad event
1156
1235
  endBootstrap();
1157
1236
  };
1237
+ /**
1238
+ * Assigns the given value to the nonce property on the runtime platform object.
1239
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1240
+ * @param nonce The value to be assigned to the platform nonce property.
1241
+ * @returns void
1242
+ */
1243
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1158
1244
  const hostRefs = /*@__PURE__*/ new WeakMap();
1159
1245
  const getHostRef = (ref) => hostRefs.get(ref);
1160
1246
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1265,3 +1351,4 @@ exports.bootstrapLazy = bootstrapLazy;
1265
1351
  exports.h = h;
1266
1352
  exports.promiseResolve = promiseResolve;
1267
1353
  exports.registerInstance = registerInstance;
1354
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5d62eace.js');
5
+ const index = require('./index-5cc2712a.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.21.0 | 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();
@@ -18,4 +18,5 @@ const defineCustomElements = (win, options) => {
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-5d62eace.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5cc2712a.js');
4
6
 
5
7
  /*
6
- Stencil Client Patch Browser v2.21.0 | 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('proto-ikons-wc.cjs.js', document.baseURI).href));
@@ -17,3 +19,5 @@ const patchBrowser = () => {
17
19
  patchBrowser().then(options => {
18
20
  return index.bootstrapLazy([["acura-ikon_119.cjs",[[0,"acura-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"alfa-romeo-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"alfa-romeo-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"alien-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"am-general-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"asterisk-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"aston-martin-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"aston-martin-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"audi-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"barcode-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"barcode-scan-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"bash-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"beaker-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"bently-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"bmw-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"bugatti-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"buick-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"cadillac-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"chart-bar-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"chart-bubble-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"chart-donut-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"chart-donuts-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"check-icon",{"selected":[4],"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"chevrolet-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"chevron-double-left-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"chrysler-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"circular-saw-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"citroen-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"close-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"daewoo-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"dodge-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"eagle-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"ferrari-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"fiat-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"fiat-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"fingerprint-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"fire-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"fisker-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"flask-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"ford-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"genesis-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"geo-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"git-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"gmc-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"honda-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"hummer-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"hyundai-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"infiniti-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"isuzu-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"jaguar-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"jaguar-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"java-script-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"jeep-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"jeep-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"kia-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"lamborghini-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"lamborghini-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"land-rover-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"lexus-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"lincoln-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"lotus-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"lotus-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"maserati-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"maybach-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mazda-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"mazda-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mclaren-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"mclaren-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mercedes-benz-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"mercedes-benz-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mercury-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mini-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"mini-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"mitsubishi-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"nissan-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"oldsmobile-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"one-password-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"opel-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"panoz-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"paw-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"peugeot-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"peugeot-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"plymouth-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"pontiac-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"porsche-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"protocol-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"pulse-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"puzzle-icon",{"selected":[4],"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"qr-code-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"radio-2-icon",{"selected":[4],"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"radio-icon",{"selected":[4],"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"ram-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"ram-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"refresh-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"renault-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"renault-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"rolls-royce-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"saab-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"saab-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"saturn-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"scion-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"seat-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"skoda-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"slug-icon",{"label":[1],"name":[1],"size":[2]}],[0,"smart-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"spider-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"spyker-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"spyker-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"subaru-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"subaru-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"suzuki-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"svg-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"tesla-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"toyota-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"vector-curve-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"volkswagen-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"volvo-alt-ikon",{"hex":[1],"label":[1],"name":[1],"size":[2]}],[0,"volvo-ikon",{"hex":[1],"name":[1],"size":[2]}],[0,"webhook-icon",{"hex":[1],"label":[1],"name":[1],"size":[2]}]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -122,7 +122,7 @@
122
122
  ],
123
123
  "compiler": {
124
124
  "name": "@stencil/core",
125
- "version": "2.21.0",
125
+ "version": "2.22.2",
126
126
  "typescriptVersion": "4.9.4"
127
127
  },
128
128
  "collections": [],
@@ -131,6 +131,15 @@ export { WebhookIcon as WebhookIcon } from '../types/components/webhook-icon/web
131
131
  */
132
132
  export declare const setAssetPath: (path: string) => void;
133
133
 
134
+ /**
135
+ * Used to specify a nonce value that corresponds with an application's CSP.
136
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
137
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
138
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
139
+ * will result in the same behavior.
140
+ */
141
+ export declare const setNonce: (nonce: string) => void
142
+
134
143
  export interface SetPlatformOptions {
135
144
  raf?: (c: FrameRequestCallback) => number;
136
145
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
@@ -1,4 +1,4 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
1
+ export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
2
  export { AcuraIkon, defineCustomElement as defineCustomElementAcuraIkon } from './acura-ikon.js';
3
3
  export { AlfaRomeoAltIkon, defineCustomElement as defineCustomElementAlfaRomeoAltIkon } from './alfa-romeo-alt-ikon.js';
4
4
  export { AlfaRomeoIkon, defineCustomElement as defineCustomElementAlfaRomeoIkon } from './alfa-romeo-ikon.js';
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-33e47d42.js';
1
+ import { r as registerInstance, h } from './index-5b3a9445.js';
2
2
 
3
3
  const acuraIkonCss = "";
4
4
 
@@ -44,6 +44,18 @@ const isComplexType = (o) => {
44
44
  o = typeof o;
45
45
  return o === 'object' || o === 'function';
46
46
  };
47
+ /**
48
+ * Helper method for querying a `meta` tag that contains a nonce value
49
+ * out of a DOM's head.
50
+ *
51
+ * @param doc The DOM containing the `head` to query against
52
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
53
+ * exists or the tag has no content.
54
+ */
55
+ function queryNonceMetaTagContent(doc) {
56
+ var _a, _b, _c;
57
+ 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;
58
+ }
47
59
  /**
48
60
  * Production h() function based on Preact by
49
61
  * Jason Miller (@developit)
@@ -102,6 +114,14 @@ const h = (nodeName, vnodeData, ...children) => {
102
114
  }
103
115
  return vnode;
104
116
  };
117
+ /**
118
+ * A utility function for creating a virtual DOM node from a tag and some
119
+ * possible text content.
120
+ *
121
+ * @param tag the tag for this element
122
+ * @param text possible text content for the node
123
+ * @returns a newly-minted virtual DOM node
124
+ */
105
125
  const newVNode = (tag, text) => {
106
126
  const vnode = {
107
127
  $flags$: 0,
@@ -116,6 +136,12 @@ const newVNode = (tag, text) => {
116
136
  return vnode;
117
137
  };
118
138
  const Host = {};
139
+ /**
140
+ * Check whether a given node is a Host node or not
141
+ *
142
+ * @param node the virtual DOM node to check
143
+ * @returns whether it's a Host node or not
144
+ */
119
145
  const isHost = (node) => node && node.$tag$ === Host;
120
146
  /**
121
147
  * Parse a new property value for a given property type.
@@ -194,6 +220,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
194
220
  styles.set(scopeId, style);
195
221
  };
196
222
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
223
+ var _a;
197
224
  let scopeId = getScopeId(cmpMeta);
198
225
  const style = styles.get(scopeId);
199
226
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -213,6 +240,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
213
240
  styleElm = doc.createElement('style');
214
241
  styleElm.innerHTML = style;
215
242
  }
243
+ // Apply CSP nonce to the style tag if it exists
244
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
245
+ if (nonce != null) {
246
+ styleElm.setAttribute('nonce', nonce);
247
+ }
216
248
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
217
249
  }
218
250
  if (appliedStyles) {
@@ -392,6 +424,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
392
424
  }
393
425
  return elm;
394
426
  };
427
+ /**
428
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
429
+ * add them to the DOM in the appropriate place.
430
+ *
431
+ * @param parentElm the DOM node which should be used as a parent for the new
432
+ * DOM nodes
433
+ * @param before a child of the `parentElm` which the new children should be
434
+ * inserted before (optional)
435
+ * @param parentVNode the parent virtual DOM node
436
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
437
+ * @param startIdx the index in the child virtual DOM nodes at which to start
438
+ * creating DOM nodes (inclusive)
439
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
440
+ * creating DOM nodes (inclusive)
441
+ */
395
442
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
396
443
  let containerElm = (parentElm);
397
444
  let childNode;
@@ -405,6 +452,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
405
452
  }
406
453
  }
407
454
  };
455
+ /**
456
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
457
+ * This can be used to, for instance, clean up after a list of children which
458
+ * should no longer be shown.
459
+ *
460
+ * This function also handles some of Stencil's slot relocation logic.
461
+ *
462
+ * @param vnodes a list of virtual DOM nodes to remove
463
+ * @param startIdx the index at which to start removing nodes (inclusive)
464
+ * @param endIdx the index at which to stop removing nodes (inclusive)
465
+ * @param vnode a VNode
466
+ * @param elm an element
467
+ */
408
468
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
409
469
  for (; startIdx <= endIdx; ++startIdx) {
410
470
  if ((vnode = vnodes[startIdx])) {
@@ -596,7 +656,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
596
656
  *
597
657
  * So, in other words, if `key` attrs are not set on VNodes which may be
598
658
  * changing order within a `children` array or something along those lines then
599
- * we could obtain a false positive and then have to do needless re-rendering.
659
+ * we could obtain a false negative and then have to do needless re-rendering
660
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
600
661
  *
601
662
  * @param leftVNode the first VNode to check
602
663
  * @param rightVNode the second VNode to check
@@ -666,6 +727,18 @@ const patch = (oldVNode, newVNode) => {
666
727
  elm.data = text;
667
728
  }
668
729
  };
730
+ /**
731
+ * The main entry point for Stencil's virtual DOM-based rendering engine
732
+ *
733
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
734
+ * function will handle creating a virtual DOM tree with a single root, patching
735
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
736
+ * relocation, and reflecting attributes.
737
+ *
738
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
739
+ * the DOM node into which it should be rendered.
740
+ * @param renderFnResults the virtual DOM nodes to be rendered
741
+ */
669
742
  const renderVdom = (hostRef, renderFnResults) => {
670
743
  const hostElm = hostRef.$hostElement$;
671
744
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -1056,6 +1129,7 @@ const disconnectedCallback = (elm) => {
1056
1129
  }
1057
1130
  };
1058
1131
  const bootstrapLazy = (lazyBundles, options = {}) => {
1132
+ var _a;
1059
1133
  const endBootstrap = createTime();
1060
1134
  const cmpTags = [];
1061
1135
  const exclude = options.exclude || [];
@@ -1118,6 +1192,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1118
1192
  {
1119
1193
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1120
1194
  visibilityStyle.setAttribute('data-styles', '');
1195
+ // Apply CSP nonce to the style tag if it exists
1196
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1197
+ if (nonce != null) {
1198
+ visibilityStyle.setAttribute('nonce', nonce);
1199
+ }
1121
1200
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1122
1201
  }
1123
1202
  // Process deferred connectedCallbacks now all components have been registered
@@ -1133,6 +1212,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1133
1212
  // Fallback appLoad event
1134
1213
  endBootstrap();
1135
1214
  };
1215
+ /**
1216
+ * Assigns the given value to the nonce property on the runtime platform object.
1217
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1218
+ * @param nonce The value to be assigned to the platform nonce property.
1219
+ * @returns void
1220
+ */
1221
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1136
1222
  const hostRefs = /*@__PURE__*/ new WeakMap();
1137
1223
  const getHostRef = (ref) => hostRefs.get(ref);
1138
1224
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1239,4 +1325,4 @@ const flush = () => {
1239
1325
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1240
1326
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1241
1327
 
1242
- export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r };
1328
+ export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-33e47d42.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-5b3a9445.js';
2
+ export { s as setNonce } from './index-5b3a9445.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Esm v2.21.0 | 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();
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-33e47d42.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-5b3a9445.js';
2
+ export { s as setNonce } from './index-5b3a9445.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Browser v2.21.0 | 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;