analog-clock-components 0.1.365 → 0.1.366

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.
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-e96fa6bd.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-3b317992",[[1,"analog-clock",{size:[2],timeZone:[2,"time-zone"],time:[32]}]]]],e)));
1
+ import{p as e,b as o}from"./p-451de3ca.js";export{s as setNonce}from"./p-451de3ca.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-d8e50134",[[1,"analog-clock",{size:[2],timeZone:[2,"time-zone"],time:[32]}]]]],e)));
@@ -0,0 +1,2 @@
1
+ let t,n,e=!1,l=!1;const o={},s=t=>"object"==(t=typeof t)||"function"===t;function c(t){var n,e,l;return null!==(l=null===(e=null===(n=t.head)||void 0===n?void 0:n.querySelector('meta[name="csp-nonce"]'))||void 0===e?void 0:e.getAttribute("content"))&&void 0!==l?l:void 0}const r=(t,n,...e)=>{let l=null,o=!1,c=!1;const r=[],u=n=>{for(let e=0;e<n.length;e++)l=n[e],Array.isArray(l)?u(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof t&&!s(l))&&(l+=""),o&&c?r[r.length-1].t+=l:r.push(o?i(null,l):l),c=o)};if(u(e),n){const t=n.className||n.class;t&&(n.class="object"!=typeof t?t:Object.keys(t).filter((n=>t[n])).join(" "))}const a=i(t,null);return a.l=n,r.length>0&&(a.o=r),a},i=(t,n)=>({i:0,u:t,t:n,h:null,o:null,l:null}),u={},a=new WeakMap,f=t=>"sc-"+t.p,d=(t,n,e,l,o,c)=>{if(e!==l){let r=W(t,n);if(n.toLowerCase(),"class"===n){const n=t.classList,o=p(e),s=p(l);n.remove(...o.filter((t=>t&&!s.includes(t)))),n.add(...s.filter((t=>t&&!o.includes(t))))}else{const i=s(l);if((r||i&&null!==l)&&!o)try{if(t.tagName.includes("-"))t[n]=l;else{const o=null==l?"":l;"list"===n?r=!1:null!=e&&t[n]==o||(t[n]=o)}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(n)||t.removeAttribute(n):(!r||4&c||o)&&!i&&t.setAttribute(n,l=!0===l?"":l)}}},h=/\s/,p=t=>t?t.split(h):[],$=(t,n,e,l)=>{const s=11===n.h.nodeType&&n.h.host?n.h.host:n.h,c=t&&t.l||o,r=n.l||o;for(l in c)l in r||d(s,l,c[l],void 0,e,n.i);for(l in r)d(s,l,c[l],r[l],e,n.i)},m=(n,l,o)=>{const s=l.o[o];let c,r,i=0;if(e||(e="svg"===s.u),c=s.h=z.createElementNS(e?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",s.u),e&&"foreignObject"===s.u&&(e=!1),$(null,s,e),null!=t&&c["s-si"]!==t&&c.classList.add(c["s-si"]=t),s.o)for(i=0;i<s.o.length;++i)r=m(n,s,i),r&&c.appendChild(r);return"svg"===s.u?e=!1:"foreignObject"===c.tagName&&(e=!0),c},y=(t,e,l,o,s,c)=>{let r,i=t;for(i.shadowRoot&&i.tagName===n&&(i=i.shadowRoot);s<=c;++s)o[s]&&(r=m(null,l,s),r&&(o[s].h=r,i.insertBefore(r,e)))},w=(t,n,e,l)=>{for(;n<=e;++n)(l=t[n])&&l.h.remove()},b=(t,n)=>t.u===n.u,v=(t,n)=>{const l=n.h=t.h,o=t.o,s=n.o,c=n.u;e="svg"===c||"foreignObject"!==c&&e,$(t,n,e),null!==o&&null!==s?((t,n,e,l)=>{let o,s=0,c=0,r=n.length-1,i=n[0],u=n[r],a=l.length-1,f=l[0],d=l[a];for(;s<=r&&c<=a;)null==i?i=n[++s]:null==u?u=n[--r]:null==f?f=l[++c]:null==d?d=l[--a]:b(i,f)?(v(i,f),i=n[++s],f=l[++c]):b(u,d)?(v(u,d),u=n[--r],d=l[--a]):b(i,d)?(v(i,d),t.insertBefore(i.h,u.h.nextSibling),i=n[++s],d=l[--a]):b(u,f)?(v(u,f),t.insertBefore(u.h,i.h),u=n[--r],f=l[++c]):(o=m(n&&n[c],e,c),f=l[++c],o&&i.h.parentNode.insertBefore(o,i.h));s>r?y(t,null==l[a+1]?null:l[a+1].h,e,l,c,a):c>a&&w(n,s,r)})(l,o,n,s):null!==s?y(l,null,n,s,0,s.length-1):null!==o&&w(o,0,o.length-1),e&&"svg"===c&&(e=!1)},g=(t,n)=>{n&&!t.$&&n["s-p"]&&n["s-p"].push(new Promise((n=>t.$=n)))},S=(t,n)=>{if(t.i|=16,!(4&t.i))return g(t,t.m),tt((()=>j(t,n)));t.i|=512},j=(t,n)=>{const e=t.v;return P(void 0,(()=>O(t,e,n)))},O=async(t,n,e)=>{const l=t.g,o=l["s-rc"];e&&(t=>{const n=t.S,e=t.g,l=n.i,o=((t,n)=>{var e;let l=f(n);const o=V.get(l);if(t=11===t.nodeType?t:z,o)if("string"==typeof o){let n,s=a.get(t=t.head||t);if(s||a.set(t,s=new Set),!s.has(l)){{n=z.createElement("style"),n.innerHTML=o;const l=null!==(e=B.j)&&void 0!==e?e:c(z);null!=l&&n.setAttribute("nonce",l),t.insertBefore(n,t.querySelector("link"))}s&&s.add(l)}}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return l})(e.shadowRoot?e.shadowRoot:e.getRootNode(),n);10&l&&(e["s-sc"]=o,e.classList.add(o+"-h"))})(t);k(t,n),o&&(o.map((t=>t())),l["s-rc"]=void 0);{const n=l["s-p"],e=()=>M(t);0===n.length?e():(Promise.all(n).then(e),t.i|=4,n.length=0)}},k=(e,l)=>{try{l=l.render(),e.i&=-17,e.i|=2,((e,l)=>{const o=e.g,s=e.O||i(null,null),c=(t=>t&&t.u===u)(l)?l:r(null,null,l);n=o.tagName,c.u=null,c.i|=4,e.O=c,c.h=s.h=o.shadowRoot||o,t=o["s-sc"],v(s,c)})(e,l)}catch(t){q(t,e.g)}return null},M=t=>{const n=t.g,e=t.v,l=t.m;64&t.i||(t.i|=64,E(n),x(e,"componentDidLoad"),t.k(n),l||C()),t.$&&(t.$(),t.$=void 0),512&t.i&&Z((()=>S(t,!1))),t.i&=-517},C=()=>{E(z.documentElement),Z((()=>(t=>{const n=B.ce("appload",{detail:{namespace:"analog-clock"}});return t.dispatchEvent(n),n})(_)))},x=(t,n,e)=>{if(t&&t[n])try{return t[n](e)}catch(t){q(t)}},P=(t,n)=>t&&t.then?t.then(n):n(),E=t=>t.classList.add("hydrated"),L=(t,n,e)=>{if(n.M){const l=Object.entries(n.M),o=t.prototype;if(l.map((([t,[l]])=>{(31&l||2&e&&32&l)&&Object.defineProperty(o,t,{get(){return((t,n)=>F(this).C.get(n))(0,t)},set(e){((t,n,e,l)=>{const o=F(t),c=o.C.get(n),r=o.i,i=o.v;e=((t,n)=>null==t||s(t)?t:2&n?parseFloat(t):t)(e,l.M[n][0]),8&r&&void 0!==c||e===c||Number.isNaN(c)&&Number.isNaN(e)||(o.C.set(n,e),i&&2==(18&r)&&S(o,!1))})(this,t,e,n)},configurable:!0,enumerable:!0})})),1&e){const n=new Map;o.attributeChangedCallback=function(t,e,l){B.jmp((()=>{const e=n.get(t);if(this.hasOwnProperty(e))l=this[e],delete this[e];else if(o.hasOwnProperty(e)&&"number"==typeof this[e]&&this[e]==l)return;this[e]=(null!==l||"boolean"!=typeof this[e])&&l}))},t.observedAttributes=l.filter((([t,n])=>15&n[0])).map((([t,e])=>{const l=e[1]||t;return n.set(l,t),l}))}}return t},N=(t,n={})=>{var e;const l=[],o=n.exclude||[],s=_.customElements,r=z.head,i=r.querySelector("meta[charset]"),u=z.createElement("style"),a=[];let d,h=!0;Object.assign(B,n),B.P=new URL(n.resourcesUrl||"./",z.baseURI).href,t.map((t=>{t[1].map((n=>{const e={i:n[0],p:n[1],M:n[2],L:n[3]};e.M=n[2];const c=e.p,r=class extends HTMLElement{constructor(t){super(t),U(t=this,e),1&e.i&&t.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),h?a.push(this):B.jmp((()=>(t=>{if(0==(1&B.i)){const n=F(t),e=n.S,l=()=>{};if(!(1&n.i)){n.i|=1;{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){g(n,n.m=e);break}}e.M&&Object.entries(e.M).map((([n,[e]])=>{if(31&e&&t.hasOwnProperty(n)){const e=t[n];delete t[n],t[n]=e}})),(async(t,n,e,l,o)=>{if(0==(32&n.i)){{if(n.i|=32,(o=H(e)).then){const t=()=>{};o=await o,t()}o.isProxied||(L(o,e,2),o.isProxied=!0);const t=()=>{};n.i|=8;try{new o(n)}catch(t){q(t)}n.i&=-9,t()}if(o.style){let t=o.style;const n=f(e);if(!V.has(n)){const l=()=>{};((t,n,e)=>{let l=V.get(t);I&&e?(l=l||new CSSStyleSheet,"string"==typeof l?l=n:l.replaceSync(n)):l=n,V.set(t,l)})(n,t,!!(1&e.i)),l()}}}const s=n.m,c=()=>S(n,!0);s&&s["s-rc"]?s["s-rc"].push(c):c()})(0,n,e)}l()}})(this)))}disconnectedCallback(){B.jmp((()=>(()=>{0==(1&B.i)&&x(F(this).v,"disconnectedCallback")})()))}componentOnReady(){return F(this).N}};e.T=t[0],o.includes(c)||s.get(c)||(l.push(c),s.define(c,L(r,e,1)))}))}));{u.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles","");const t=null!==(e=B.j)&&void 0!==e?e:c(z);null!=t&&u.setAttribute("nonce",t),r.insertBefore(u,i?i.nextSibling:r.firstChild)}h=!1,a.length?a.map((t=>t.connectedCallback())):B.jmp((()=>d=setTimeout(C,30)))},T=t=>B.j=t,A=new WeakMap,F=t=>A.get(t),R=(t,n)=>A.set(n.v=t,n),U=(t,n)=>{const e={i:0,g:t,S:n,C:new Map};return e.N=new Promise((t=>e.k=t)),t["s-p"]=[],t["s-rc"]=[],A.set(t,e)},W=(t,n)=>n in t,q=(t,n)=>(0,console.error)(t,n),D=new Map,H=t=>{const n=t.p.replace(/-/g,"_"),e=t.T,l=D.get(e);return l?l[n]:import(`./${e}.entry.js`).then((t=>(D.set(e,t),t[n])),q)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},V=new Map,_="undefined"!=typeof window?window:{},z=_.document||{head:{}},B={i:0,P:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,n,e,l)=>t.addEventListener(n,e,l),rel:(t,n,e,l)=>t.removeEventListener(n,e,l),ce:(t,n)=>new CustomEvent(t,n)},G=t=>Promise.resolve(t),I=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),J=[],K=[],Q=(t,n)=>e=>{t.push(e),l||(l=!0,n&&4&B.i?Z(Y):B.raf(Y))},X=t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(t){q(t)}t.length=0},Y=()=>{X(J),X(K),(l=J.length>0)&&B.raf(Y)},Z=t=>G().then(t),tt=Q(K,!0);export{N as b,r as h,G as p,R as r,T as s}
@@ -1 +1 @@
1
- import{r as t,h as e}from"./p-e96fa6bd.js";const r=class{constructor(e){t(this,e),this.size=void 0,this.timeZone=0,this.time=Date.now()}componentDidLoad(){this.timer=window.setInterval((()=>{this.time=Date.now()}),250)}disconnectedCallback(){clearInterval(this.timer)}get hour(){return new Date(this.time).getHours()}get minute(){return new Date(this.time).getMinutes()}get second(){return new Date(this.time).getSeconds()}hourToDegrees(){const t=this.hour+this.timeZone;return Math.floor(this.minute/2)+30*t}minuteToDegrees(){return Math.floor(this.second/10)+6*this.minute}secondToDegrees(){return 6*this.second}render(){return e("svg",{class:"clock",viewBox:"0 0 200 200",width:this.size,height:this.size},e("circle",{id:"circle",cx:"100",cy:"100",r:"95","stroke-width":"10",fill:"transparent"}),e("line",{id:"hour",transform:`rotate(${this.hourToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"60","stroke-width":"10","stroke-linecap":"round"}),e("line",{id:"minute",transform:`rotate(${this.minuteToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"30","stroke-width":"8","stroke-linecap":"round"}),e("line",{id:"second",transform:`rotate(${this.secondToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"20","stroke-width":"2","stroke-linecap":"round"}))}};r.style=".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";export{r as analog_clock}
1
+ import{r as t,h as e}from"./p-451de3ca.js";const r=class{constructor(e){t(this,e),this.size=void 0,this.timeZone=0,this.time=Date.now()}componentDidLoad(){this.timer=window.setInterval((()=>{this.time=Date.now()}),250)}disconnectedCallback(){clearInterval(this.timer)}get hour(){return new Date(this.time).getHours()}get minute(){return new Date(this.time).getMinutes()}get second(){return new Date(this.time).getSeconds()}hourToDegrees(){const t=this.hour+this.timeZone;return Math.floor(this.minute/2)+30*t}minuteToDegrees(){return Math.floor(this.second/10)+6*this.minute}secondToDegrees(){return 6*this.second}render(){return e("svg",{class:"clock",viewBox:"0 0 200 200",width:this.size,height:this.size},e("circle",{id:"circle",cx:"100",cy:"100",r:"95","stroke-width":"10",fill:"transparent"}),e("line",{id:"hour",transform:`rotate(${this.hourToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"60","stroke-width":"10","stroke-linecap":"round"}),e("line",{id:"minute",transform:`rotate(${this.minuteToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"30","stroke-width":"8","stroke-linecap":"round"}),e("line",{id:"second",transform:`rotate(${this.secondToDegrees()}, 100, 100)`,x1:"100",y1:"100",x2:"100",y2:"20","stroke-width":"2","stroke-linecap":"round"}))}};r.style=".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";export{r as analog_clock}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b17ba620.js');
5
+ const index = require('./index-a22a8034.js');
6
6
 
7
7
  const analogClockCss = ".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";
8
8
 
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-b17ba620.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a22a8034.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.1 | 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('analog-clock.cjs.js', document.baseURI).href));
@@ -17,3 +19,5 @@ const patchBrowser = () => {
17
19
  patchBrowser().then(options => {
18
20
  return index.bootstrapLazy([["analog-clock.cjs",[[1,"analog-clock",{"size":[2],"timeZone":[2,"time-zone"],"time":[32]}]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -68,6 +68,18 @@ const isComplexType = (o) => {
68
68
  o = typeof o;
69
69
  return o === 'object' || o === 'function';
70
70
  };
71
+ /**
72
+ * Helper method for querying a `meta` tag that contains a nonce value
73
+ * out of a DOM's head.
74
+ *
75
+ * @param doc The DOM containing the `head` to query against
76
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
77
+ * exists or the tag has no content.
78
+ */
79
+ function queryNonceMetaTagContent(doc) {
80
+ var _a, _b, _c;
81
+ 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;
82
+ }
71
83
  /**
72
84
  * Production h() function based on Preact by
73
85
  * Jason Miller (@developit)
@@ -208,6 +220,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
208
220
  styles.set(scopeId, style);
209
221
  };
210
222
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
223
+ var _a;
211
224
  let scopeId = getScopeId(cmpMeta);
212
225
  const style = styles.get(scopeId);
213
226
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -227,6 +240,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
227
240
  styleElm = doc.createElement('style');
228
241
  styleElm.innerHTML = style;
229
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
+ }
230
248
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
231
249
  }
232
250
  if (appliedStyles) {
@@ -1078,6 +1096,7 @@ const disconnectedCallback = (elm) => {
1078
1096
  }
1079
1097
  };
1080
1098
  const bootstrapLazy = (lazyBundles, options = {}) => {
1099
+ var _a;
1081
1100
  const endBootstrap = createTime();
1082
1101
  const cmpTags = [];
1083
1102
  const exclude = options.exclude || [];
@@ -1151,6 +1170,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1151
1170
  {
1152
1171
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1153
1172
  visibilityStyle.setAttribute('data-styles', '');
1173
+ // Apply CSP nonce to the style tag if it exists
1174
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1175
+ if (nonce != null) {
1176
+ visibilityStyle.setAttribute('nonce', nonce);
1177
+ }
1154
1178
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1155
1179
  }
1156
1180
  // Process deferred connectedCallbacks now all components have been registered
@@ -1166,6 +1190,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1166
1190
  // Fallback appLoad event
1167
1191
  endBootstrap();
1168
1192
  };
1193
+ /**
1194
+ * Assigns the given value to the nonce property on the runtime platform object.
1195
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1196
+ * @param nonce The value to be assigned to the platform nonce property.
1197
+ * @returns void
1198
+ */
1199
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1169
1200
  const hostRefs = /*@__PURE__*/ new WeakMap();
1170
1201
  const getHostRef = (ref) => hostRefs.get(ref);
1171
1202
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1276,3 +1307,4 @@ exports.bootstrapLazy = bootstrapLazy;
1276
1307
  exports.h = h;
1277
1308
  exports.promiseResolve = promiseResolve;
1278
1309
  exports.registerInstance = registerInstance;
1310
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b17ba620.js');
5
+ const index = require('./index-a22a8034.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.1 | 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;
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.21.0",
7
+ "version": "2.22.1",
8
8
  "typescriptVersion": "4.9.4"
9
9
  },
10
10
  "collections": [],
@@ -13,6 +13,15 @@ export { AnalogClock as AnalogClock } from '../types/components/analog-clock/ana
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 { AnalogClock, defineCustomElement as defineCustomElementAnalogClock } from './analog-clock.js';
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-3f0e8356.js';
1
+ import { r as registerInstance, h } from './index-62b63d0e.js';
2
2
 
3
3
  const analogClockCss = ".clock #circle{stroke:var(--clock-circle-color, black)}.clock #hour{stroke:var(--clock-hour-color, black)}.clock #minute{stroke:var(--clock-minute-color, black)}.clock #second{stroke:var(--clock-second-color, black)}";
4
4
 
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-3f0e8356.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-62b63d0e.js';
2
+ export { s as setNonce } from './index-62b63d0e.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.1 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchBrowser = () => {
7
8
  const importMeta = import.meta.url;
@@ -46,6 +46,18 @@ const isComplexType = (o) => {
46
46
  o = typeof o;
47
47
  return o === 'object' || o === 'function';
48
48
  };
49
+ /**
50
+ * Helper method for querying a `meta` tag that contains a nonce value
51
+ * out of a DOM's head.
52
+ *
53
+ * @param doc The DOM containing the `head` to query against
54
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
55
+ * exists or the tag has no content.
56
+ */
57
+ function queryNonceMetaTagContent(doc) {
58
+ var _a, _b, _c;
59
+ 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;
60
+ }
49
61
  /**
50
62
  * Production h() function based on Preact by
51
63
  * Jason Miller (@developit)
@@ -186,6 +198,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
186
198
  styles.set(scopeId, style);
187
199
  };
188
200
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
201
+ var _a;
189
202
  let scopeId = getScopeId(cmpMeta);
190
203
  const style = styles.get(scopeId);
191
204
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -205,6 +218,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
205
218
  styleElm = doc.createElement('style');
206
219
  styleElm.innerHTML = style;
207
220
  }
221
+ // Apply CSP nonce to the style tag if it exists
222
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
223
+ if (nonce != null) {
224
+ styleElm.setAttribute('nonce', nonce);
225
+ }
208
226
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
209
227
  }
210
228
  if (appliedStyles) {
@@ -1056,6 +1074,7 @@ const disconnectedCallback = (elm) => {
1056
1074
  }
1057
1075
  };
1058
1076
  const bootstrapLazy = (lazyBundles, options = {}) => {
1077
+ var _a;
1059
1078
  const endBootstrap = createTime();
1060
1079
  const cmpTags = [];
1061
1080
  const exclude = options.exclude || [];
@@ -1129,6 +1148,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1129
1148
  {
1130
1149
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1131
1150
  visibilityStyle.setAttribute('data-styles', '');
1151
+ // Apply CSP nonce to the style tag if it exists
1152
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1153
+ if (nonce != null) {
1154
+ visibilityStyle.setAttribute('nonce', nonce);
1155
+ }
1132
1156
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1133
1157
  }
1134
1158
  // Process deferred connectedCallbacks now all components have been registered
@@ -1144,6 +1168,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1144
1168
  // Fallback appLoad event
1145
1169
  endBootstrap();
1146
1170
  };
1171
+ /**
1172
+ * Assigns the given value to the nonce property on the runtime platform object.
1173
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1174
+ * @param nonce The value to be assigned to the platform nonce property.
1175
+ * @returns void
1176
+ */
1177
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1147
1178
  const hostRefs = /*@__PURE__*/ new WeakMap();
1148
1179
  const getHostRef = (ref) => hostRefs.get(ref);
1149
1180
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1250,4 +1281,4 @@ const flush = () => {
1250
1281
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1251
1282
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1252
1283
 
1253
- export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r };
1284
+ 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-3f0e8356.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-62b63d0e.js';
2
+ export { s as setNonce } from './index-62b63d0e.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.1 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchEsm = () => {
7
8
  return promiseResolve();
@@ -257,6 +257,15 @@ export declare function getAssetPath(path: string): string;
257
257
  * @returns the set path
258
258
  */
259
259
  export declare function setAssetPath(path: string): string;
260
+ /**
261
+ * Used to specify a nonce value that corresponds with an application's
262
+ * [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
263
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
264
+ * Alternatively, the nonce value can be set on a `meta` tag in the DOM head
265
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) and will result in the same behavior.
266
+ * @param nonce The value to be used for the nonce attribute.
267
+ */
268
+ export declare function setNonce(nonce: string): void;
260
269
  /**
261
270
  * Retrieve a Stencil element for a given reference
262
271
  * @param ref the ref to get the Stencil element for
package/loader/index.d.ts CHANGED
@@ -10,3 +10,12 @@ export interface CustomElementsDefineOptions {
10
10
  }
11
11
  export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
12
12
  export declare function applyPolyfills(): Promise<void>;
13
+
14
+ /**
15
+ * Used to specify a nonce value that corresponds with an application's CSP.
16
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
17
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
18
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
19
+ * will result in the same behavior.
20
+ */
21
+ export declare function setNonce(nonce: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analog-clock-components",
3
- "version": "0.1.365",
3
+ "version": "0.1.366",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "format": "prettier --write src"
28
28
  },
29
29
  "dependencies": {
30
- "@stencil/core": "2.21.0"
30
+ "@stencil/core": "2.22.1"
31
31
  },
32
32
  "license": "MIT",
33
33
  "devDependencies": {
@@ -1,2 +0,0 @@
1
- let t,e,n=!1,l=!1;const s={},o=t=>"object"==(t=typeof t)||"function"===t,r=(t,e,...n)=>{let l=null,s=!1,r=!1;const i=[],a=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?a(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!o(l))&&(l+=""),s&&r?i[i.length-1].t+=l:i.push(s?c(null,l):l),r=s)};if(a(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const u=c(t,null);return u.l=e,i.length>0&&(u.o=i),u},c=(t,e)=>({i:0,u:t,t:e,h:null,o:null,l:null}),i={},a=new WeakMap,u=t=>"sc-"+t.$,f=(t,e,n,l,s,r)=>{if(n!==l){let c=R(t,e);if(e.toLowerCase(),"class"===e){const e=t.classList,s=$(n),o=$(l);e.remove(...s.filter((t=>t&&!o.includes(t)))),e.add(...o.filter((t=>t&&!s.includes(t))))}else{const i=o(l);if((c||i&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]=l;else{const s=null==l?"":l;"list"===e?c=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!c||4&r||s)&&!i&&t.setAttribute(e,l=!0===l?"":l)}}},h=/\s/,$=t=>t?t.split(h):[],d=(t,e,n,l)=>{const o=11===e.h.nodeType&&e.h.host?e.h.host:e.h,r=t&&t.l||s,c=e.l||s;for(l in r)l in c||f(o,l,r[l],void 0,n,e.i);for(l in c)f(o,l,r[l],c[l],n,e.i)},p=(e,l,s)=>{const o=l.o[s];let r,c,i=0;if(n||(n="svg"===o.u),r=o.h=V.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.u),n&&"foreignObject"===o.u&&(n=!1),d(null,o,n),null!=t&&r["s-si"]!==t&&r.classList.add(r["s-si"]=t),o.o)for(i=0;i<o.o.length;++i)c=p(e,o,i),c&&r.appendChild(c);return"svg"===o.u?n=!1:"foreignObject"===r.tagName&&(n=!0),r},y=(t,n,l,s,o,r)=>{let c,i=t;for(i.shadowRoot&&i.tagName===e&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=p(null,l,o),c&&(s[o].h=c,i.insertBefore(c,n)))},m=(t,e,n,l)=>{for(;e<=n;++e)(l=t[e])&&l.h.remove()},w=(t,e)=>t.u===e.u,b=(t,e)=>{const l=e.h=t.h,s=t.o,o=e.o,r=e.u;n="svg"===r||"foreignObject"!==r&&n,d(t,e,n),null!==s&&null!==o?((t,e,n,l)=>{let s,o=0,r=0,c=e.length-1,i=e[0],a=e[c],u=l.length-1,f=l[0],h=l[u];for(;o<=c&&r<=u;)null==i?i=e[++o]:null==a?a=e[--c]:null==f?f=l[++r]:null==h?h=l[--u]:w(i,f)?(b(i,f),i=e[++o],f=l[++r]):w(a,h)?(b(a,h),a=e[--c],h=l[--u]):w(i,h)?(b(i,h),t.insertBefore(i.h,a.h.nextSibling),i=e[++o],h=l[--u]):w(a,f)?(b(a,f),t.insertBefore(a.h,i.h),a=e[--c],f=l[++r]):(s=p(e&&e[r],n,r),f=l[++r],s&&i.h.parentNode.insertBefore(s,i.h));o>c?y(t,null==l[u+1]?null:l[u+1].h,n,l,r,u):r>u&&m(e,o,c)})(l,s,e,o):null!==o?y(l,null,e,o,0,o.length-1):null!==s&&m(s,0,s.length-1),n&&"svg"===r&&(n=!1)},g=(t,e)=>{e&&!t.p&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.p=e)))},v=(t,e)=>{if(t.i|=16,!(4&t.i))return g(t,t.m),Y((()=>S(t,e)));t.i|=512},S=(t,e)=>{const n=t.g;return x(void 0,(()=>j(t,n,e)))},j=async(t,e,n)=>{const l=t.v,s=l["s-rc"];n&&(t=>{const e=t.S,n=t.v,l=e.i,s=((t,e)=>{let n=u(e);const l=D.get(n);if(t=11===t.nodeType?t:V,l)if("string"==typeof l){let e,s=a.get(t=t.head||t);s||a.set(t,s=new Set),s.has(n)||(e=V.createElement("style"),e.innerHTML=l,t.insertBefore(e,t.querySelector("link")),s&&s.add(n))}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(t);O(t,e),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=l["s-p"],n=()=>k(t);0===e.length?n():(Promise.all(e).then(n),t.i|=4,e.length=0)}},O=(n,l)=>{try{l=l.render(),n.i&=-17,n.i|=2,((n,l)=>{const s=n.v,o=n.j||c(null,null),a=(t=>t&&t.u===i)(l)?l:r(null,null,l);e=s.tagName,a.u=null,a.i|=4,n.j=a,a.h=o.h=s.shadowRoot||s,t=s["s-sc"],b(o,a)})(n,l)}catch(t){U(t,n.v)}return null},k=t=>{const e=t.v,n=t.g,l=t.m;64&t.i||(t.i|=64,P(e),C(n,"componentDidLoad"),t.O(e),l||M()),t.p&&(t.p(),t.p=void 0),512&t.i&&X((()=>v(t,!1))),t.i&=-517},M=()=>{P(V.documentElement),X((()=>(t=>{const e=_.ce("appload",{detail:{namespace:"analog-clock"}});return t.dispatchEvent(e),e})(H)))},C=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){U(t)}},x=(t,e)=>t&&t.then?t.then(e):e(),P=t=>t.classList.add("hydrated"),E=(t,e,n)=>{if(e.k){const l=Object.entries(e.k),s=t.prototype;if(l.map((([t,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,t,{get(){return((t,e)=>T(this).M.get(e))(0,t)},set(n){((t,e,n,l)=>{const s=T(t),r=s.M.get(e),c=s.i,i=s.g;n=((t,e)=>null==t||o(t)?t:2&e?parseFloat(t):t)(n,l.k[e][0]),8&c&&void 0!==r||n===r||Number.isNaN(r)&&Number.isNaN(n)||(s.M.set(e,n),i&&2==(18&c)&&v(s,!1))})(this,t,n,e)},configurable:!0,enumerable:!0})})),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,l){_.jmp((()=>{const n=e.get(t);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},t.observedAttributes=l.filter((([t,e])=>15&e[0])).map((([t,n])=>{const l=n[1]||t;return e.set(l,t),l}))}}return t},L=(t,e={})=>{const n=[],l=e.exclude||[],s=H.customElements,o=V.head,r=o.querySelector("meta[charset]"),c=V.createElement("style"),i=[];let a,f=!0;Object.assign(_,e),_.C=new URL(e.resourcesUrl||"./",V.baseURI).href,t.map((t=>{t[1].map((e=>{const o={i:e[0],$:e[1],k:e[2],P:e[3]};o.k=e[2];const r=o.$,c=class extends HTMLElement{constructor(t){super(t),F(t=this,o),1&o.i&&t.attachShadow({mode:"open"})}connectedCallback(){a&&(clearTimeout(a),a=null),f?i.push(this):_.jmp((()=>(t=>{if(0==(1&_.i)){const e=T(t),n=e.S,l=()=>{};if(!(1&e.i)){e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){g(e,e.m=n);break}}n.k&&Object.entries(n.k).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n,l,s)=>{if(0==(32&e.i)){{if(e.i|=32,(s=q(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(E(s,n,2),s.isProxied=!0);const t=()=>{};e.i|=8;try{new s(e)}catch(t){U(t)}e.i&=-9,t()}if(s.style){let t=s.style;const e=u(n);if(!D.has(e)){const l=()=>{};((t,e,n)=>{let l=D.get(t);B&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=e:l.replaceSync(e)):l=e,D.set(t,l)})(e,t,!!(1&n.i)),l()}}}const o=e.m,r=()=>v(e,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,e,n)}l()}})(this)))}disconnectedCallback(){_.jmp((()=>(()=>{0==(1&_.i)&&C(T(this).g,"disconnectedCallback")})()))}componentOnReady(){return T(this).L}};o.N=t[0],l.includes(r)||s.get(r)||(n.push(r),s.define(r,E(c,o,1)))}))})),c.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",c.setAttribute("data-styles",""),o.insertBefore(c,r?r.nextSibling:o.firstChild),f=!1,i.length?i.map((t=>t.connectedCallback())):_.jmp((()=>a=setTimeout(M,30)))},N=new WeakMap,T=t=>N.get(t),A=(t,e)=>N.set(e.g=t,e),F=(t,e)=>{const n={i:0,v:t,S:e,M:new Map};return n.L=new Promise((t=>n.O=t)),t["s-p"]=[],t["s-rc"]=[],N.set(t,n)},R=(t,e)=>e in t,U=(t,e)=>(0,console.error)(t,e),W=new Map,q=t=>{const e=t.$.replace(/-/g,"_"),n=t.N,l=W.get(n);return l?l[e]:import(`./${n}.entry.js`).then((t=>(W.set(n,t),t[e])),U)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},D=new Map,H="undefined"!=typeof window?window:{},V=H.document||{head:{}},_={i:0,C:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l),ce:(t,e)=>new CustomEvent(t,e)},z=t=>Promise.resolve(t),B=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),G=[],I=[],J=(t,e)=>n=>{t.push(n),l||(l=!0,e&&4&_.i?X(Q):_.raf(Q))},K=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){U(t)}t.length=0},Q=()=>{K(G),K(I),(l=G.length>0)&&_.raf(Q)},X=t=>z().then(t),Y=J(I,!0);export{L as b,r as h,z as p,A as r}