proto-ikons-wc 0.1.0 → 0.1.2

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,8 +1,8 @@
1
1
  const NAMESPACE = 'proto-ikons-wc';
2
- const BUILD = /* proto-ikons-wc */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: true, watchCallback: false };
2
+ const BUILD = /* proto-ikons-wc */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, constructableCSS: true, cssAnnotations: true, devTools: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: true, watchCallback: false };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.27.1 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
@@ -15,10 +15,15 @@ var SVG_NS = "http://www.w3.org/2000/svg";
15
15
  var HTML_NS = "http://www.w3.org/1999/xhtml";
16
16
 
17
17
  // src/client/client-host-ref.ts
18
- var hostRefs = /* @__PURE__ */ new WeakMap();
19
- var getHostRef = (ref) => hostRefs.get(ref);
18
+ var getHostRef = (ref) => {
19
+ if (ref.__stencil__getHostRef) {
20
+ return ref.__stencil__getHostRef();
21
+ }
22
+ return void 0;
23
+ };
20
24
  var registerInstance = (lazyInstance, hostRef) => {
21
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
25
+ lazyInstance.__stencil__getHostRef = () => hostRef;
26
+ hostRef.$lazyInstance$ = lazyInstance;
22
27
  };
23
28
  var registerHost = (hostElement, cmpMeta) => {
24
29
  const hostRef = {
@@ -32,7 +37,8 @@ var registerHost = (hostElement, cmpMeta) => {
32
37
  hostElement["s-p"] = [];
33
38
  hostElement["s-rc"] = [];
34
39
  }
35
- const ref = hostRefs.set(hostElement, hostRef);
40
+ const ref = hostRef;
41
+ hostElement.__stencil__getHostRef = () => ref;
36
42
  return ref;
37
43
  };
38
44
  var isMemberInElement = (elm, memberName) => memberName in elm;
@@ -77,7 +83,6 @@ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
77
83
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
78
84
  var XLINK_NS = "http://www.w3.org/1999/xlink";
79
85
  var win = typeof window !== "undefined" ? window : {};
80
- var doc = win.document || { head: {} };
81
86
  var plt = {
82
87
  $flags$: 0,
83
88
  $resourcesUrl$: "",
@@ -138,9 +143,9 @@ var isComplexType = (o) => {
138
143
  };
139
144
 
140
145
  // src/utils/query-nonce-meta-tag-content.ts
141
- function queryNonceMetaTagContent(doc2) {
146
+ function queryNonceMetaTagContent(doc) {
142
147
  var _a, _b, _c;
143
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
148
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
144
149
  }
145
150
 
146
151
  // src/utils/result.ts
@@ -308,7 +313,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
308
313
  var _a;
309
314
  const scopeId2 = getScopeId(cmpMeta);
310
315
  const style = styles.get(scopeId2);
311
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
316
+ if (!win.document) {
317
+ return scopeId2;
318
+ }
319
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
312
320
  if (style) {
313
321
  if (typeof style === "string") {
314
322
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -319,9 +327,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
319
327
  }
320
328
  if (!appliedStyles.has(scopeId2)) {
321
329
  {
322
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
330
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
323
331
  styleElm.innerHTML = style;
324
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
332
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
325
333
  if (nonce != null) {
326
334
  styleElm.setAttribute("nonce", nonce);
327
335
  }
@@ -378,61 +386,62 @@ var attachStyles = (hostRef) => {
378
386
  };
379
387
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
380
388
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
381
- if (oldValue !== newValue) {
382
- let isProp = isMemberInElement(elm, memberName);
383
- let ln = memberName.toLowerCase();
384
- if (memberName === "class") {
385
- const classList = elm.classList;
386
- const oldClasses = parseClassList(oldValue);
387
- let newClasses = parseClassList(newValue);
388
- {
389
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
390
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
391
- }
392
- } else if (memberName === "key") ; else {
393
- const isComplex = isComplexType(newValue);
394
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
395
- try {
396
- if (!elm.tagName.includes("-")) {
397
- const n = newValue == null ? "" : newValue;
398
- if (memberName === "list") {
399
- isProp = false;
400
- } else if (oldValue == null || elm[memberName] != n) {
401
- if (typeof elm.__lookupSetter__(memberName) === "function") {
402
- elm[memberName] = n;
403
- } else {
404
- elm.setAttribute(memberName, n);
405
- }
389
+ if (oldValue === newValue) {
390
+ return;
391
+ }
392
+ let isProp = isMemberInElement(elm, memberName);
393
+ let ln = memberName.toLowerCase();
394
+ if (memberName === "class") {
395
+ const classList = elm.classList;
396
+ const oldClasses = parseClassList(oldValue);
397
+ let newClasses = parseClassList(newValue);
398
+ {
399
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
400
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
401
+ }
402
+ } else if (memberName === "key") ; else {
403
+ const isComplex = isComplexType(newValue);
404
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
405
+ try {
406
+ if (!elm.tagName.includes("-")) {
407
+ const n = newValue == null ? "" : newValue;
408
+ if (memberName === "list") {
409
+ isProp = false;
410
+ } else if (oldValue == null || elm[memberName] != n) {
411
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
412
+ elm[memberName] = n;
413
+ } else {
414
+ elm.setAttribute(memberName, n);
406
415
  }
407
- } else if (elm[memberName] !== newValue) {
408
- elm[memberName] = newValue;
409
416
  }
410
- } catch (e) {
417
+ } else if (elm[memberName] !== newValue) {
418
+ elm[memberName] = newValue;
411
419
  }
420
+ } catch (e) {
412
421
  }
413
- let xlink = false;
414
- {
415
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
416
- memberName = ln;
417
- xlink = true;
418
- }
422
+ }
423
+ let xlink = false;
424
+ {
425
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
426
+ memberName = ln;
427
+ xlink = true;
419
428
  }
420
- if (newValue == null || newValue === false) {
421
- if (newValue !== false || elm.getAttribute(memberName) === "") {
422
- if (xlink) {
423
- elm.removeAttributeNS(XLINK_NS, memberName);
424
- } else {
425
- elm.removeAttribute(memberName);
426
- }
427
- }
428
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
429
- newValue = newValue === true ? "" : newValue;
429
+ }
430
+ if (newValue == null || newValue === false) {
431
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
430
432
  if (xlink) {
431
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
433
+ elm.removeAttributeNS(XLINK_NS, memberName);
432
434
  } else {
433
- elm.setAttribute(memberName, newValue);
435
+ elm.removeAttribute(memberName);
434
436
  }
435
437
  }
438
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
439
+ newValue = newValue === true ? "" : newValue;
440
+ if (xlink) {
441
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
442
+ } else {
443
+ elm.setAttribute(memberName, newValue);
444
+ }
436
445
  }
437
446
  }
438
447
  };
@@ -493,12 +502,17 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
493
502
  let elm;
494
503
  let childNode;
495
504
  if (newVNode2.$text$ !== null) {
496
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
505
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
497
506
  } else {
498
507
  if (!isSvgMode) {
499
508
  isSvgMode = newVNode2.$tag$ === "svg";
500
509
  }
501
- elm = newVNode2.$elm$ = doc.createElementNS(
510
+ if (!win.document) {
511
+ throw new Error(
512
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
513
+ );
514
+ }
515
+ elm = newVNode2.$elm$ = win.document.createElementNS(
502
516
  isSvgMode ? SVG_NS : HTML_NS,
503
517
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
504
518
  ) ;
@@ -658,9 +672,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
658
672
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
659
673
  }
660
674
  {
661
- {
662
- updateElement(oldVNode, newVNode2, isSvgMode);
663
- }
675
+ updateElement(oldVNode, newVNode2, isSvgMode);
664
676
  }
665
677
  if (oldChildren !== null && newChildren !== null) {
666
678
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -742,6 +754,12 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
742
754
  );
743
755
  }
744
756
  let maybePromise;
757
+ if (isInitialLoad) {
758
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
759
+ } else {
760
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
761
+ }
762
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
745
763
  endSchedule();
746
764
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
747
765
  };
@@ -805,12 +823,15 @@ var postUpdateComponent = (hostRef) => {
805
823
  const tagName = hostRef.$cmpMeta$.$tagName$;
806
824
  const elm = hostRef.$hostElement$;
807
825
  const endPostUpdate = createTime("postUpdate", tagName);
826
+ const instance = hostRef.$lazyInstance$ ;
808
827
  const ancestorComponent = hostRef.$ancestorComponent$;
828
+ safeCall(instance, "componentDidRender", void 0, elm);
809
829
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
810
830
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
811
831
  {
812
832
  addHydratedFlag(elm);
813
833
  }
834
+ safeCall(instance, "componentDidLoad", void 0, elm);
814
835
  endPostUpdate();
815
836
  {
816
837
  hostRef.$onReadyResolve$(elm);
@@ -819,6 +840,7 @@ var postUpdateComponent = (hostRef) => {
819
840
  }
820
841
  }
821
842
  } else {
843
+ safeCall(instance, "componentDidUpdate", void 0, elm);
822
844
  endPostUpdate();
823
845
  }
824
846
  {
@@ -835,6 +857,16 @@ var postUpdateComponent = (hostRef) => {
835
857
  var appDidLoad = (who) => {
836
858
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
837
859
  };
860
+ var safeCall = (instance, method, arg, elm) => {
861
+ if (instance && instance[method]) {
862
+ try {
863
+ return instance[method](arg);
864
+ } catch (e) {
865
+ consoleError(e, elm);
866
+ }
867
+ }
868
+ return void 0;
869
+ };
838
870
  var addHydratedFlag = (elm) => {
839
871
  var _a;
840
872
  return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
@@ -859,6 +891,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
859
891
  hostRef.$instanceValues$.set(propName, newVal);
860
892
  if (instance) {
861
893
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
894
+ if (instance.componentShouldUpdate) {
895
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
896
+ return;
897
+ }
898
+ }
862
899
  scheduleUpdate(hostRef, false);
863
900
  }
864
901
  }
@@ -1021,6 +1058,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1021
1058
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1022
1059
  }
1023
1060
  endNewInstance();
1061
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1024
1062
  } else {
1025
1063
  Cstr = elm.constructor;
1026
1064
  const cmpTag = elm.localName;
@@ -1048,6 +1086,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1048
1086
  }
1049
1087
  };
1050
1088
  var fireConnectedCallback = (instance, elm) => {
1089
+ {
1090
+ safeCall(instance, "connectedCallback", void 0, elm);
1091
+ }
1051
1092
  };
1052
1093
 
1053
1094
  // src/runtime/connected-callback.ts
@@ -1080,20 +1121,27 @@ var connectedCallback = (elm) => {
1080
1121
  initializeComponent(elm, hostRef, cmpMeta);
1081
1122
  }
1082
1123
  } else {
1083
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1084
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1124
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1125
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1126
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1127
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1085
1128
  }
1086
1129
  }
1087
1130
  endConnected();
1088
1131
  }
1089
1132
  };
1090
1133
  var disconnectInstance = (instance, elm) => {
1134
+ {
1135
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1136
+ }
1091
1137
  };
1092
1138
  var disconnectedCallback = async (elm) => {
1093
1139
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1094
1140
  const hostRef = getHostRef(elm);
1095
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1096
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1141
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1142
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1143
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1144
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1097
1145
  }
1098
1146
  }
1099
1147
  if (rootAppliedStyles.has(elm)) {
@@ -1107,18 +1155,22 @@ var disconnectedCallback = async (elm) => {
1107
1155
  // src/runtime/bootstrap-lazy.ts
1108
1156
  var bootstrapLazy = (lazyBundles, options = {}) => {
1109
1157
  var _a;
1158
+ if (!win.document) {
1159
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1160
+ return;
1161
+ }
1110
1162
  const endBootstrap = createTime();
1111
1163
  const cmpTags = [];
1112
1164
  const exclude = options.exclude || [];
1113
1165
  const customElements2 = win.customElements;
1114
- const head = doc.head;
1166
+ const head = win.document.head;
1115
1167
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1116
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1168
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1117
1169
  const deferredConnectedCallbacks = [];
1118
1170
  let appLoadFallback;
1119
1171
  let isBootstrapping = true;
1120
1172
  Object.assign(plt, options);
1121
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1173
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1122
1174
  let hasSlotRelocation = false;
1123
1175
  lazyBundles.map((lazyBundle) => {
1124
1176
  lazyBundle[1].map((compactMeta) => {
@@ -1195,7 +1247,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1195
1247
  }
1196
1248
  if (dataStyles.innerHTML.length) {
1197
1249
  dataStyles.setAttribute("data-styles", "");
1198
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1250
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1199
1251
  if (nonce != null) {
1200
1252
  dataStyles.setAttribute("nonce", nonce);
1201
1253
  }
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-9f1252b7.js';
2
- export { s as setNonce } from './index-9f1252b7.js';
1
+ import { b as bootstrapLazy } from './index-854c1ae4.js';
2
+ export { s as setNonce } from './index-854c1ae4.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-9f1252b7.js';
2
- export { s as setNonce } from './index-9f1252b7.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-854c1ae4.js';
2
+ export { s as setNonce } from './index-854c1ae4.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.27.1 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  var patchBrowser = () => {
9
9
  const importMeta = import.meta.url;