@siemens/ix-icons 0.0.0-pr-69-20250205144920 → 0.0.0-v3-preview-20250130095430

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/README.md +17 -46
  2. package/components/icon.js +252 -0
  3. package/components/icon.js.map +1 -0
  4. package/components/index.js +2 -1
  5. package/components/index.js.map +1 -1
  6. package/components/ix-icon.js +1 -1
  7. package/dist/cjs/{icon-319056c0.js → icon-2c9dc943.js} +56 -62
  8. package/dist/cjs/icon-2c9dc943.js.map +1 -0
  9. package/dist/cjs/{index-f6043fa9.js → index-ea94711c.js} +70 -178
  10. package/dist/cjs/index-ea94711c.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +2 -2
  12. package/dist/cjs/ix-icon.cjs.entry.js +2 -2
  13. package/dist/cjs/ix-icons.cjs.js +2 -2
  14. package/dist/cjs/ix-icons.cjs.js.map +1 -1
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +2 -2
  17. package/dist/collection/components/icon/icon.js +19 -31
  18. package/dist/collection/components/icon/icon.js.map +1 -1
  19. package/dist/collection/components/icon/icons.js +1258 -0
  20. package/dist/collection/components/icon/icons.js.map +1 -0
  21. package/dist/collection/components/icon/resolveIcon.js +43 -26
  22. package/dist/collection/components/icon/resolveIcon.js.map +1 -1
  23. package/dist/esm/{icon-fc868c56.js → icon-e3f6595d.js} +56 -62
  24. package/dist/esm/icon-e3f6595d.js.map +1 -0
  25. package/dist/esm/{index-051cb4f1.js → index-050dd9d6.js} +70 -178
  26. package/dist/esm/index-050dd9d6.js.map +1 -0
  27. package/dist/esm/index.js +2 -2
  28. package/dist/esm/ix-icon.entry.js +2 -2
  29. package/dist/esm/ix-icons.js +3 -3
  30. package/dist/esm/ix-icons.js.map +1 -1
  31. package/dist/esm/loader.js +2 -2
  32. package/dist/ix-icons/index.esm.js +1 -1
  33. package/dist/ix-icons/ix-icons.esm.js +1 -1
  34. package/dist/ix-icons/ix-icons.esm.js.map +1 -1
  35. package/dist/ix-icons/p-0194ffaa.js +3 -0
  36. package/dist/ix-icons/p-0194ffaa.js.map +1 -0
  37. package/dist/ix-icons/p-196f504a.js +2 -0
  38. package/dist/ix-icons/p-196f504a.js.map +1 -0
  39. package/dist/ix-icons/p-45457b43.entry.js +2 -0
  40. package/dist/types/components/icon/icon.d.ts +2 -5
  41. package/dist/types/components/icon/icons.d.ts +1256 -0
  42. package/dist/types/components/icon/meta-tag.d.ts +1 -1
  43. package/dist/types/components/icon/resolveIcon.d.ts +2 -1
  44. package/dist/types/components.d.ts +2 -8
  45. package/dist/types/stencil-public-runtime.d.ts +0 -6
  46. package/icons/package.json +1 -1
  47. package/package.json +2 -2
  48. package/components/p-187634d0.js +0 -1363
  49. package/components/p-187634d0.js.map +0 -1
  50. package/dist/cjs/icon-319056c0.js.map +0 -1
  51. package/dist/cjs/index-f6043fa9.js.map +0 -1
  52. package/dist/collection/components/icon/parser.js +0 -22
  53. package/dist/collection/components/icon/parser.js.map +0 -1
  54. package/dist/esm/icon-fc868c56.js.map +0 -1
  55. package/dist/esm/index-051cb4f1.js.map +0 -1
  56. package/dist/ix-icons/p-423803cb.js +0 -2
  57. package/dist/ix-icons/p-423803cb.js.map +0 -1
  58. package/dist/ix-icons/p-48b5ebf2.js +0 -3
  59. package/dist/ix-icons/p-48b5ebf2.js.map +0 -1
  60. package/dist/ix-icons/p-ca4fc358.entry.js +0 -2
  61. package/dist/sample.json +0 -1259
  62. package/dist/types/components/icon/parser.d.ts +0 -2
  63. /package/dist/ix-icons/{p-ca4fc358.entry.js.map → p-45457b43.entry.js.map} +0 -0
@@ -1,1363 +0,0 @@
1
- const NAMESPACE = 'ix-icons';
2
- const BUILD = /* ix-icons */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, 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", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: false, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: false, vdomXlink: false, watchCallback: true };
3
-
4
- /*
5
- Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
6
- */
7
- var __defProp = Object.defineProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
-
13
- // src/utils/constants.ts
14
- var SVG_NS = "http://www.w3.org/2000/svg";
15
- var HTML_NS = "http://www.w3.org/1999/xhtml";
16
-
17
- // src/client/client-host-ref.ts
18
- var hostRefs = /* @__PURE__ */ new WeakMap();
19
- var deleteHostRef = (ref) => hostRefs.delete(ref);
20
- var getHostRef = (ref) => hostRefs.get(ref);
21
- var registerHost = (hostElement, cmpMeta) => {
22
- const hostRef = {
23
- $flags$: 0,
24
- $hostElement$: hostElement,
25
- $cmpMeta$: cmpMeta,
26
- $instanceValues$: /* @__PURE__ */ new Map()
27
- };
28
- {
29
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
30
- hostElement["s-p"] = [];
31
- hostElement["s-rc"] = [];
32
- }
33
- const ref = hostRefs.set(hostElement, hostRef);
34
- return ref;
35
- };
36
- var isMemberInElement = (elm, memberName) => memberName in elm;
37
- var consoleError = (e, el) => (0, console.error)(e, el);
38
-
39
- // src/client/client-style.ts
40
- var styles = /* @__PURE__ */ new Map();
41
- var HYDRATED_STYLE_ID = "sty-id";
42
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
43
- var win = typeof window !== "undefined" ? window : {};
44
- var doc = win.document || { head: {} };
45
- var H = win.HTMLElement || class {
46
- };
47
- var plt = {
48
- $flags$: 0,
49
- $resourcesUrl$: "",
50
- jmp: (h2) => h2(),
51
- raf: (h2) => requestAnimationFrame(h2),
52
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
53
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
54
- ce: (eventName, opts) => new CustomEvent(eventName, opts)
55
- };
56
- var promiseResolve = (v) => Promise.resolve(v);
57
- var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
58
- try {
59
- new CSSStyleSheet();
60
- return typeof new CSSStyleSheet().replaceSync === "function";
61
- } catch (e) {
62
- }
63
- return false;
64
- })() ;
65
- var queuePending = false;
66
- var queueDomReads = [];
67
- var queueDomWrites = [];
68
- var queueTask = (queue, write) => (cb) => {
69
- queue.push(cb);
70
- if (!queuePending) {
71
- queuePending = true;
72
- if (write && plt.$flags$ & 4 /* queueSync */) {
73
- nextTick(flush);
74
- } else {
75
- plt.raf(flush);
76
- }
77
- }
78
- };
79
- var consume = (queue) => {
80
- for (let i2 = 0; i2 < queue.length; i2++) {
81
- try {
82
- queue[i2](performance.now());
83
- } catch (e) {
84
- consoleError(e);
85
- }
86
- }
87
- queue.length = 0;
88
- };
89
- var flush = () => {
90
- consume(queueDomReads);
91
- {
92
- consume(queueDomWrites);
93
- if (queuePending = queueDomReads.length > 0) {
94
- plt.raf(flush);
95
- }
96
- }
97
- };
98
- var nextTick = (cb) => promiseResolve().then(cb);
99
- var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
100
-
101
- // src/runtime/asset-path.ts
102
- var getAssetPath = (path) => {
103
- const assetUrl = new URL(path, plt.$resourcesUrl$);
104
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
105
- };
106
- var setAssetPath = (path) => plt.$resourcesUrl$ = path;
107
- var isComplexType = (o) => {
108
- o = typeof o;
109
- return o === "object" || o === "function";
110
- };
111
-
112
- // src/utils/query-nonce-meta-tag-content.ts
113
- function queryNonceMetaTagContent(doc2) {
114
- var _a, _b, _c;
115
- 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;
116
- }
117
-
118
- // src/utils/result.ts
119
- var result_exports = {};
120
- __export(result_exports, {
121
- err: () => err,
122
- map: () => map,
123
- ok: () => ok,
124
- unwrap: () => unwrap,
125
- unwrapErr: () => unwrapErr
126
- });
127
- var ok = (value) => ({
128
- isOk: true,
129
- isErr: false,
130
- value
131
- });
132
- var err = (value) => ({
133
- isOk: false,
134
- isErr: true,
135
- value
136
- });
137
- function map(result, fn) {
138
- if (result.isOk) {
139
- const val = fn(result.value);
140
- if (val instanceof Promise) {
141
- return val.then((newVal) => ok(newVal));
142
- } else {
143
- return ok(val);
144
- }
145
- }
146
- if (result.isErr) {
147
- const value = result.value;
148
- return err(value);
149
- }
150
- throw "should never get here";
151
- }
152
- var unwrap = (result) => {
153
- if (result.isOk) {
154
- return result.value;
155
- } else {
156
- throw result.value;
157
- }
158
- };
159
- var unwrapErr = (result) => {
160
- if (result.isErr) {
161
- return result.value;
162
- } else {
163
- throw result.value;
164
- }
165
- };
166
- var createTime = (fnName, tagName = "") => {
167
- {
168
- return () => {
169
- return;
170
- };
171
- }
172
- };
173
- var h = (nodeName, vnodeData, ...children) => {
174
- let child = null;
175
- let key = null;
176
- let simple = false;
177
- let lastSimple = false;
178
- const vNodeChildren = [];
179
- const walk = (c) => {
180
- for (let i2 = 0; i2 < c.length; i2++) {
181
- child = c[i2];
182
- if (Array.isArray(child)) {
183
- walk(child);
184
- } else if (child != null && typeof child !== "boolean") {
185
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
186
- child = String(child);
187
- }
188
- if (simple && lastSimple) {
189
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
190
- } else {
191
- vNodeChildren.push(simple ? newVNode(null, child) : child);
192
- }
193
- lastSimple = simple;
194
- }
195
- }
196
- };
197
- walk(children);
198
- if (vnodeData) {
199
- if (vnodeData.key) {
200
- key = vnodeData.key;
201
- }
202
- {
203
- const classData = vnodeData.className || vnodeData.class;
204
- if (classData) {
205
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
206
- }
207
- }
208
- }
209
- const vnode = newVNode(nodeName, null);
210
- vnode.$attrs$ = vnodeData;
211
- if (vNodeChildren.length > 0) {
212
- vnode.$children$ = vNodeChildren;
213
- }
214
- {
215
- vnode.$key$ = key;
216
- }
217
- return vnode;
218
- };
219
- var newVNode = (tag, text) => {
220
- const vnode = {
221
- $flags$: 0,
222
- $tag$: tag,
223
- $text$: text,
224
- $elm$: null,
225
- $children$: null
226
- };
227
- {
228
- vnode.$attrs$ = null;
229
- }
230
- {
231
- vnode.$key$ = null;
232
- }
233
- return vnode;
234
- };
235
- var Host = {};
236
- var isHost = (node) => node && node.$tag$ === Host;
237
- var parsePropertyValue = (propValue, propType) => {
238
- if (propValue != null && !isComplexType(propValue)) {
239
- if (propType & 4 /* Boolean */) {
240
- return propValue === "false" ? false : propValue === "" || !!propValue;
241
- }
242
- if (propType & 1 /* String */) {
243
- return String(propValue);
244
- }
245
- return propValue;
246
- }
247
- return propValue;
248
- };
249
- var emitEvent = (elm, name, opts) => {
250
- const ev = plt.ce(name, opts);
251
- elm.dispatchEvent(ev);
252
- return ev;
253
- };
254
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
255
- var registerStyle = (scopeId2, cssText, allowCS) => {
256
- let style = styles.get(scopeId2);
257
- if (supportsConstructableStylesheets && allowCS) {
258
- style = style || new CSSStyleSheet();
259
- if (typeof style === "string") {
260
- style = cssText;
261
- } else {
262
- style.replaceSync(cssText);
263
- }
264
- } else {
265
- style = cssText;
266
- }
267
- styles.set(scopeId2, style);
268
- };
269
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
270
- var _a;
271
- const scopeId2 = getScopeId(cmpMeta);
272
- const style = styles.get(scopeId2);
273
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
274
- if (style) {
275
- if (typeof style === "string") {
276
- styleContainerNode = styleContainerNode.head || styleContainerNode;
277
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
278
- let styleElm;
279
- if (!appliedStyles) {
280
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
281
- }
282
- if (!appliedStyles.has(scopeId2)) {
283
- {
284
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
285
- styleElm.innerHTML = style;
286
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
287
- if (nonce != null) {
288
- styleElm.setAttribute("nonce", nonce);
289
- }
290
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
291
- if (styleContainerNode.nodeName === "HEAD") {
292
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
293
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
294
- styleContainerNode.insertBefore(
295
- styleElm,
296
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
297
- );
298
- } else if ("host" in styleContainerNode) {
299
- if (supportsConstructableStylesheets) {
300
- const stylesheet = new CSSStyleSheet();
301
- stylesheet.replaceSync(style);
302
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
303
- } else {
304
- const existingStyleContainer = styleContainerNode.querySelector("style");
305
- if (existingStyleContainer) {
306
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
307
- } else {
308
- styleContainerNode.prepend(styleElm);
309
- }
310
- }
311
- } else {
312
- styleContainerNode.append(styleElm);
313
- }
314
- }
315
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
316
- styleContainerNode.insertBefore(styleElm, null);
317
- }
318
- }
319
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
320
- styleElm.innerHTML += SLOT_FB_CSS;
321
- }
322
- if (appliedStyles) {
323
- appliedStyles.add(scopeId2);
324
- }
325
- }
326
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
327
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
328
- }
329
- }
330
- return scopeId2;
331
- };
332
- var attachStyles = (hostRef) => {
333
- const cmpMeta = hostRef.$cmpMeta$;
334
- const elm = hostRef.$hostElement$;
335
- const flags = cmpMeta.$flags$;
336
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
337
- const scopeId2 = addStyle(
338
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
339
- cmpMeta);
340
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
341
- elm["s-sc"] = scopeId2;
342
- elm.classList.add(scopeId2 + "-h");
343
- }
344
- endAttachStyles();
345
- };
346
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
347
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
348
- if (oldValue !== newValue) {
349
- let isProp = isMemberInElement(elm, memberName);
350
- memberName.toLowerCase();
351
- if (memberName === "class") {
352
- const classList = elm.classList;
353
- const oldClasses = parseClassList(oldValue);
354
- let newClasses = parseClassList(newValue);
355
- {
356
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
357
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
358
- }
359
- } else if (memberName === "style") {
360
- {
361
- for (const prop in oldValue) {
362
- if (!newValue || newValue[prop] == null) {
363
- if (prop.includes("-")) {
364
- elm.style.removeProperty(prop);
365
- } else {
366
- elm.style[prop] = "";
367
- }
368
- }
369
- }
370
- }
371
- for (const prop in newValue) {
372
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
373
- if (prop.includes("-")) {
374
- elm.style.setProperty(prop, newValue[prop]);
375
- } else {
376
- elm.style[prop] = newValue[prop];
377
- }
378
- }
379
- }
380
- } else if (memberName === "key") ; else {
381
- const isComplex = isComplexType(newValue);
382
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
383
- try {
384
- if (!elm.tagName.includes("-")) {
385
- const n = newValue == null ? "" : newValue;
386
- if (memberName === "list") {
387
- isProp = false;
388
- } else if (oldValue == null || elm[memberName] != n) {
389
- if (typeof elm.__lookupSetter__(memberName) === "function") {
390
- elm[memberName] = n;
391
- } else {
392
- elm.setAttribute(memberName, n);
393
- }
394
- }
395
- } else if (elm[memberName] !== newValue) {
396
- elm[memberName] = newValue;
397
- }
398
- } catch (e) {
399
- }
400
- }
401
- if (newValue == null || newValue === false) {
402
- if (newValue !== false || elm.getAttribute(memberName) === "") {
403
- {
404
- elm.removeAttribute(memberName);
405
- }
406
- }
407
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
408
- newValue = newValue === true ? "" : newValue;
409
- {
410
- elm.setAttribute(memberName, newValue);
411
- }
412
- }
413
- }
414
- }
415
- };
416
- var parseClassListRegex = /\s/;
417
- var parseClassList = (value) => {
418
- if (typeof value === "object" && value && "baseVal" in value) {
419
- value = value.baseVal;
420
- }
421
- if (!value || typeof value !== "string") {
422
- return [];
423
- }
424
- return value.split(parseClassListRegex);
425
- };
426
-
427
- // src/runtime/vdom/update-element.ts
428
- var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
429
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
430
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
431
- const newVnodeAttrs = newVnode.$attrs$ || {};
432
- {
433
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
434
- if (!(memberName in newVnodeAttrs)) {
435
- setAccessor(
436
- elm,
437
- memberName,
438
- oldVnodeAttrs[memberName],
439
- void 0,
440
- isSvgMode2,
441
- newVnode.$flags$);
442
- }
443
- }
444
- }
445
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
446
- setAccessor(
447
- elm,
448
- memberName,
449
- oldVnodeAttrs[memberName],
450
- newVnodeAttrs[memberName],
451
- isSvgMode2,
452
- newVnode.$flags$);
453
- }
454
- };
455
- function sortedAttrNames(attrNames) {
456
- return attrNames.includes("ref") ? (
457
- // we need to sort these to ensure that `'ref'` is the last attr
458
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
459
- ) : (
460
- // no need to sort, return the original array
461
- attrNames
462
- );
463
- }
464
- var hostTagName;
465
- var useNativeShadowDom = false;
466
- var isSvgMode = false;
467
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
468
- const newVNode2 = newParentVNode.$children$[childIndex];
469
- let i2 = 0;
470
- let elm;
471
- let childNode;
472
- {
473
- if (!isSvgMode) {
474
- isSvgMode = newVNode2.$tag$ === "svg";
475
- }
476
- elm = newVNode2.$elm$ = doc.createElementNS(
477
- isSvgMode ? SVG_NS : HTML_NS,
478
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
479
- ) ;
480
- if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
481
- isSvgMode = false;
482
- }
483
- {
484
- updateElement(null, newVNode2, isSvgMode);
485
- }
486
- if (newVNode2.$children$) {
487
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
488
- childNode = createElm(oldParentVNode, newVNode2, i2);
489
- if (childNode) {
490
- elm.appendChild(childNode);
491
- }
492
- }
493
- }
494
- {
495
- if (newVNode2.$tag$ === "svg") {
496
- isSvgMode = false;
497
- } else if (elm.tagName === "foreignObject") {
498
- isSvgMode = true;
499
- }
500
- }
501
- }
502
- elm["s-hn"] = hostTagName;
503
- return elm;
504
- };
505
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
506
- let containerElm = parentElm;
507
- let childNode;
508
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
509
- containerElm = containerElm.shadowRoot;
510
- }
511
- for (; startIdx <= endIdx; ++startIdx) {
512
- if (vnodes[startIdx]) {
513
- childNode = createElm(null, parentVNode, startIdx);
514
- if (childNode) {
515
- vnodes[startIdx].$elm$ = childNode;
516
- insertBefore(containerElm, childNode, before);
517
- }
518
- }
519
- }
520
- };
521
- var removeVnodes = (vnodes, startIdx, endIdx) => {
522
- for (let index = startIdx; index <= endIdx; ++index) {
523
- const vnode = vnodes[index];
524
- if (vnode) {
525
- const elm = vnode.$elm$;
526
- if (elm) {
527
- elm.remove();
528
- }
529
- }
530
- }
531
- };
532
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
533
- let oldStartIdx = 0;
534
- let newStartIdx = 0;
535
- let idxInOld = 0;
536
- let i2 = 0;
537
- let oldEndIdx = oldCh.length - 1;
538
- let oldStartVnode = oldCh[0];
539
- let oldEndVnode = oldCh[oldEndIdx];
540
- let newEndIdx = newCh.length - 1;
541
- let newStartVnode = newCh[0];
542
- let newEndVnode = newCh[newEndIdx];
543
- let node;
544
- let elmToMove;
545
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
546
- if (oldStartVnode == null) {
547
- oldStartVnode = oldCh[++oldStartIdx];
548
- } else if (oldEndVnode == null) {
549
- oldEndVnode = oldCh[--oldEndIdx];
550
- } else if (newStartVnode == null) {
551
- newStartVnode = newCh[++newStartIdx];
552
- } else if (newEndVnode == null) {
553
- newEndVnode = newCh[--newEndIdx];
554
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
555
- patch(oldStartVnode, newStartVnode, isInitialRender);
556
- oldStartVnode = oldCh[++oldStartIdx];
557
- newStartVnode = newCh[++newStartIdx];
558
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
559
- patch(oldEndVnode, newEndVnode, isInitialRender);
560
- oldEndVnode = oldCh[--oldEndIdx];
561
- newEndVnode = newCh[--newEndIdx];
562
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
563
- patch(oldStartVnode, newEndVnode, isInitialRender);
564
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
565
- oldStartVnode = oldCh[++oldStartIdx];
566
- newEndVnode = newCh[--newEndIdx];
567
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
568
- patch(oldEndVnode, newStartVnode, isInitialRender);
569
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
570
- oldEndVnode = oldCh[--oldEndIdx];
571
- newStartVnode = newCh[++newStartIdx];
572
- } else {
573
- idxInOld = -1;
574
- {
575
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
576
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
577
- idxInOld = i2;
578
- break;
579
- }
580
- }
581
- }
582
- if (idxInOld >= 0) {
583
- elmToMove = oldCh[idxInOld];
584
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
585
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
586
- } else {
587
- patch(elmToMove, newStartVnode, isInitialRender);
588
- oldCh[idxInOld] = void 0;
589
- node = elmToMove.$elm$;
590
- }
591
- newStartVnode = newCh[++newStartIdx];
592
- } else {
593
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
594
- newStartVnode = newCh[++newStartIdx];
595
- }
596
- if (node) {
597
- {
598
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
599
- }
600
- }
601
- }
602
- }
603
- if (oldStartIdx > oldEndIdx) {
604
- addVnodes(
605
- parentElm,
606
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
607
- newVNode2,
608
- newCh,
609
- newStartIdx,
610
- newEndIdx
611
- );
612
- } else if (newStartIdx > newEndIdx) {
613
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
614
- }
615
- };
616
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
617
- if (leftVNode.$tag$ === rightVNode.$tag$) {
618
- if (!isInitialRender) {
619
- return leftVNode.$key$ === rightVNode.$key$;
620
- }
621
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
622
- leftVNode.$key$ = rightVNode.$key$;
623
- }
624
- return true;
625
- }
626
- return false;
627
- };
628
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
629
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
630
- const oldChildren = oldVNode.$children$;
631
- const newChildren = newVNode2.$children$;
632
- const tag = newVNode2.$tag$;
633
- {
634
- {
635
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
636
- }
637
- {
638
- {
639
- updateElement(oldVNode, newVNode2, isSvgMode);
640
- }
641
- }
642
- if (oldChildren !== null && newChildren !== null) {
643
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
644
- } else if (newChildren !== null) {
645
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
646
- } else if (
647
- // don't do this on initial render as it can cause non-hydrated content to be removed
648
- !isInitialRender && BUILD.updatable && oldChildren !== null
649
- ) {
650
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
651
- }
652
- if (isSvgMode && tag === "svg") {
653
- isSvgMode = false;
654
- }
655
- }
656
- };
657
- var insertBefore = (parent, newNode, reference) => {
658
- {
659
- return parent == null ? void 0 : parent.insertBefore(newNode, reference);
660
- }
661
- };
662
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
663
- const hostElm = hostRef.$hostElement$;
664
- const cmpMeta = hostRef.$cmpMeta$;
665
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
666
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
667
- hostTagName = hostElm.tagName;
668
- if (isInitialLoad && rootVnode.$attrs$) {
669
- for (const key of Object.keys(rootVnode.$attrs$)) {
670
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
671
- rootVnode.$attrs$[key] = hostElm[key];
672
- }
673
- }
674
- }
675
- rootVnode.$tag$ = null;
676
- rootVnode.$flags$ |= 4 /* isHost */;
677
- hostRef.$vnode$ = rootVnode;
678
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
679
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
680
- patch(oldVNode, rootVnode, isInitialLoad);
681
- };
682
-
683
- // src/runtime/update-component.ts
684
- var attachToAncestor = (hostRef, ancestorComponent) => {
685
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
686
- const index = ancestorComponent["s-p"].push(
687
- new Promise(
688
- (r) => hostRef.$onRenderResolve$ = () => {
689
- ancestorComponent["s-p"].splice(index - 1, 1);
690
- r();
691
- }
692
- )
693
- );
694
- }
695
- };
696
- var scheduleUpdate = (hostRef, isInitialLoad) => {
697
- {
698
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
699
- }
700
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
701
- hostRef.$flags$ |= 512 /* needsRerender */;
702
- return;
703
- }
704
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
705
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
706
- return writeTask(dispatch) ;
707
- };
708
- var dispatchHooks = (hostRef, isInitialLoad) => {
709
- const elm = hostRef.$hostElement$;
710
- const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
711
- const instance = elm;
712
- if (!instance) {
713
- throw new Error(
714
- `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
715
- );
716
- }
717
- let maybePromise;
718
- if (isInitialLoad) {
719
- {
720
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
721
- }
722
- }
723
- endSchedule();
724
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
725
- };
726
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
727
- console.error(err2);
728
- fn();
729
- }) : fn();
730
- var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
731
- var updateComponent = async (hostRef, instance, isInitialLoad) => {
732
- var _a;
733
- const elm = hostRef.$hostElement$;
734
- const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
735
- const rc = elm["s-rc"];
736
- if (isInitialLoad) {
737
- attachStyles(hostRef);
738
- }
739
- const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
740
- {
741
- callRender(hostRef, instance, elm, isInitialLoad);
742
- }
743
- if (rc) {
744
- rc.map((cb) => cb());
745
- elm["s-rc"] = void 0;
746
- }
747
- endRender();
748
- endUpdate();
749
- {
750
- const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
751
- const postUpdate = () => postUpdateComponent(hostRef);
752
- if (childrenPromises.length === 0) {
753
- postUpdate();
754
- } else {
755
- Promise.all(childrenPromises).then(postUpdate);
756
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
757
- childrenPromises.length = 0;
758
- }
759
- }
760
- };
761
- var callRender = (hostRef, instance, elm, isInitialLoad) => {
762
- try {
763
- instance = instance.render() ;
764
- {
765
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
766
- }
767
- {
768
- hostRef.$flags$ |= 2 /* hasRendered */;
769
- }
770
- {
771
- {
772
- {
773
- renderVdom(hostRef, instance, isInitialLoad);
774
- }
775
- }
776
- }
777
- } catch (e) {
778
- consoleError(e, hostRef.$hostElement$);
779
- }
780
- return null;
781
- };
782
- var postUpdateComponent = (hostRef) => {
783
- const tagName = hostRef.$cmpMeta$.$tagName$;
784
- const elm = hostRef.$hostElement$;
785
- const endPostUpdate = createTime("postUpdate", tagName);
786
- const ancestorComponent = hostRef.$ancestorComponent$;
787
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
788
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
789
- {
790
- addHydratedFlag(elm);
791
- }
792
- endPostUpdate();
793
- {
794
- hostRef.$onReadyResolve$(elm);
795
- if (!ancestorComponent) {
796
- appDidLoad();
797
- }
798
- }
799
- } else {
800
- endPostUpdate();
801
- }
802
- {
803
- if (hostRef.$onRenderResolve$) {
804
- hostRef.$onRenderResolve$();
805
- hostRef.$onRenderResolve$ = void 0;
806
- }
807
- if (hostRef.$flags$ & 512 /* needsRerender */) {
808
- nextTick(() => scheduleUpdate(hostRef, false));
809
- }
810
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
811
- }
812
- };
813
- var appDidLoad = (who) => {
814
- {
815
- addHydratedFlag(doc.documentElement);
816
- }
817
- nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
818
- };
819
- var safeCall = (instance, method, arg, elm) => {
820
- if (instance && instance[method]) {
821
- try {
822
- return instance[method](arg);
823
- } catch (e) {
824
- consoleError(e, elm);
825
- }
826
- }
827
- return void 0;
828
- };
829
- var addHydratedFlag = (elm) => {
830
- var _a;
831
- return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
832
- };
833
-
834
- // src/runtime/set-value.ts
835
- var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
836
- var setValue = (ref, propName, newVal, cmpMeta) => {
837
- const hostRef = getHostRef(ref);
838
- const elm = ref;
839
- const oldVal = hostRef.$instanceValues$.get(propName);
840
- const flags = hostRef.$flags$;
841
- const instance = elm;
842
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
843
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
844
- const didValueChange = newVal !== oldVal && !areBothNaN;
845
- if (didValueChange) {
846
- hostRef.$instanceValues$.set(propName, newVal);
847
- {
848
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
849
- const watchMethods = cmpMeta.$watchers$[propName];
850
- if (watchMethods) {
851
- watchMethods.map((watchMethodName) => {
852
- try {
853
- instance[watchMethodName](newVal, oldVal, propName);
854
- } catch (e) {
855
- consoleError(e, elm);
856
- }
857
- });
858
- }
859
- }
860
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
861
- scheduleUpdate(hostRef, false);
862
- }
863
- }
864
- }
865
- };
866
-
867
- // src/runtime/proxy-component.ts
868
- var proxyComponent = (Cstr, cmpMeta, flags) => {
869
- var _a, _b;
870
- const prototype = Cstr.prototype;
871
- if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
872
- if (Cstr.watchers && !cmpMeta.$watchers$) {
873
- cmpMeta.$watchers$ = Cstr.watchers;
874
- }
875
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
876
- members.map(([memberName, [memberFlags]]) => {
877
- if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
878
- const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
879
- if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
880
- if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
881
- if (flags & 1 /* isElementConstructor */ || !origGetter) {
882
- Object.defineProperty(prototype, memberName, {
883
- get() {
884
- {
885
- return origGetter ? origGetter.apply(this) : getValue(this, memberName);
886
- }
887
- },
888
- configurable: true,
889
- enumerable: true
890
- });
891
- }
892
- Object.defineProperty(prototype, memberName, {
893
- set(newValue) {
894
- const ref = getHostRef(this);
895
- if (origSetter) {
896
- const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
897
- if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
898
- newValue = ref.$instanceValues$.get(memberName);
899
- } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
900
- ref.$instanceValues$.set(memberName, currentValue);
901
- }
902
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
903
- newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
904
- setValue(this, memberName, newValue, cmpMeta);
905
- return;
906
- }
907
- {
908
- setValue(this, memberName, newValue, cmpMeta);
909
- return;
910
- }
911
- }
912
- });
913
- }
914
- });
915
- {
916
- const attrNameToPropName = /* @__PURE__ */ new Map();
917
- prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
918
- plt.jmp(() => {
919
- var _a2;
920
- const propName = attrNameToPropName.get(attrName);
921
- if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
922
- newValue = this[propName];
923
- delete this[propName];
924
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
925
- this[propName] == newValue) {
926
- return;
927
- } else if (propName == null) {
928
- const hostRef = getHostRef(this);
929
- const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
930
- if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
931
- const elm = this;
932
- const instance = elm;
933
- const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
934
- entry == null ? void 0 : entry.forEach((callbackName) => {
935
- if (instance[callbackName] != null) {
936
- instance[callbackName].call(instance, newValue, oldValue, attrName);
937
- }
938
- });
939
- }
940
- return;
941
- }
942
- const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
943
- newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
944
- if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
945
- this[propName] = newValue;
946
- }
947
- });
948
- };
949
- Cstr.observedAttributes = Array.from(
950
- /* @__PURE__ */ new Set([
951
- ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
952
- ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
953
- const attrName = m[1] || propName;
954
- attrNameToPropName.set(attrName, propName);
955
- return attrName;
956
- })
957
- ])
958
- );
959
- }
960
- }
961
- return Cstr;
962
- };
963
-
964
- // src/runtime/initialize-component.ts
965
- var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
966
- let Cstr;
967
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
968
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
969
- {
970
- Cstr = elm.constructor;
971
- const cmpTag = elm.localName;
972
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
973
- }
974
- if (Cstr && Cstr.style) {
975
- let style;
976
- if (typeof Cstr.style === "string") {
977
- style = Cstr.style;
978
- }
979
- const scopeId2 = getScopeId(cmpMeta);
980
- if (!styles.has(scopeId2)) {
981
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
982
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
983
- endRegisterStyles();
984
- }
985
- }
986
- }
987
- const ancestorComponent = hostRef.$ancestorComponent$;
988
- const schedule = () => scheduleUpdate(hostRef, true);
989
- if (ancestorComponent && ancestorComponent["s-rc"]) {
990
- ancestorComponent["s-rc"].push(schedule);
991
- } else {
992
- schedule();
993
- }
994
- };
995
- var fireConnectedCallback = (instance, elm) => {
996
- };
997
-
998
- // src/runtime/connected-callback.ts
999
- var connectedCallback = (elm) => {
1000
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1001
- const hostRef = getHostRef(elm);
1002
- const cmpMeta = hostRef.$cmpMeta$;
1003
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1004
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1005
- hostRef.$flags$ |= 1 /* hasConnected */;
1006
- {
1007
- let ancestorComponent = elm;
1008
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1009
- if (ancestorComponent["s-p"]) {
1010
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1011
- break;
1012
- }
1013
- }
1014
- }
1015
- if (cmpMeta.$members$) {
1016
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1017
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1018
- const value = elm[memberName];
1019
- delete elm[memberName];
1020
- elm[memberName] = value;
1021
- }
1022
- });
1023
- }
1024
- {
1025
- initializeComponent(elm, hostRef, cmpMeta);
1026
- }
1027
- } else {
1028
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1029
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1030
- }
1031
- }
1032
- endConnected();
1033
- }
1034
- };
1035
- var disconnectedCallback = async (elm) => {
1036
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1037
- getHostRef(elm);
1038
- }
1039
- if (rootAppliedStyles.has(elm)) {
1040
- rootAppliedStyles.delete(elm);
1041
- }
1042
- if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1043
- rootAppliedStyles.delete(elm.shadowRoot);
1044
- }
1045
- };
1046
- var proxyCustomElement = (Cstr, compactMeta) => {
1047
- const cmpMeta = {
1048
- $flags$: compactMeta[0],
1049
- $tagName$: compactMeta[1]
1050
- };
1051
- {
1052
- cmpMeta.$members$ = compactMeta[2];
1053
- }
1054
- {
1055
- cmpMeta.$watchers$ = Cstr.$watchers$;
1056
- }
1057
- Object.assign(Cstr.prototype, {
1058
- __hasHostListenerAttached: false,
1059
- __registerHost() {
1060
- registerHost(this, cmpMeta);
1061
- },
1062
- connectedCallback() {
1063
- if (!this.__hasHostListenerAttached) {
1064
- getHostRef(this);
1065
- this.__hasHostListenerAttached = true;
1066
- }
1067
- connectedCallback(this);
1068
- },
1069
- disconnectedCallback() {
1070
- disconnectedCallback(this);
1071
- plt.raf(() => {
1072
- var _a;
1073
- const hostRef = getHostRef(this);
1074
- if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1075
- delete hostRef.$vnode$;
1076
- }
1077
- if (this instanceof Node && !this.isConnected) {
1078
- deleteHostRef(this);
1079
- }
1080
- });
1081
- },
1082
- __attachShadow() {
1083
- {
1084
- if (!this.shadowRoot) {
1085
- {
1086
- this.attachShadow({ mode: "open" });
1087
- }
1088
- } else {
1089
- if (this.shadowRoot.mode !== "open") {
1090
- throw new Error(
1091
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
1092
- );
1093
- }
1094
- }
1095
- }
1096
- }
1097
- });
1098
- Cstr.is = cmpMeta.$tagName$;
1099
- return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
1100
- };
1101
-
1102
- // src/runtime/nonce.ts
1103
- var setNonce = (nonce) => plt.$nonce$ = nonce;
1104
-
1105
- // src/runtime/platform-options.ts
1106
- var setPlatformOptions = (opts) => Object.assign(plt, opts);
1107
-
1108
- /**
1109
- * Provide custom SVG path for icons
1110
- *
1111
- * <meta name="ix-icons:path" content="/build/svg" />
1112
- */
1113
- function getCustomAssetUrl() {
1114
- const assetPath = document.querySelector("meta[name='ix-icons:path']");
1115
- if (assetPath) {
1116
- const path = assetPath.getAttribute('content');
1117
- return path;
1118
- }
1119
- return false;
1120
- }
1121
-
1122
- /*
1123
- * COPYRIGHT (c) Siemens AG 2018-2025 ALL RIGHTS RESERVED.
1124
- */
1125
- let parser = null;
1126
- const errorSymbol = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'><path fill-rule='evenodd' d='M384,0 L384,384 L0,384 L0,0 L384,0 Z M192,207.085 L57.751,341.333 L326.248,341.333 L192,207.085 Z M42.666,57.751 L42.666,326.248 L176.915,192 L42.666,57.751 Z M341.333,57.751 L207.085,192 L341.333,326.248 L341.333,57.751 Z M326.248,42.666 L57.751,42.666 L192,176.915 L326.248,42.666 Z' transform='translate(64 64)'/></svg>";
1127
- function parseSVGDataContent(content) {
1128
- if (typeof window['DOMParser'] === 'undefined') {
1129
- console.error('DOMParser not supported by your browser.');
1130
- return '';
1131
- }
1132
- if (parser === null) {
1133
- parser = new window['DOMParser']();
1134
- }
1135
- const svgDocument = parser.parseFromString(content, 'text/html');
1136
- const svgElement = svgDocument.querySelector('svg');
1137
- if (!svgElement) {
1138
- console.error('No valid svg data provided');
1139
- return '';
1140
- }
1141
- return svgElement.outerHTML;
1142
- }
1143
-
1144
- /*
1145
- * SPDX-FileCopyrightText: 2023 Siemens AG
1146
- *
1147
- * SPDX-License-Identifier: MIT
1148
- *
1149
- * This source code is licensed under the MIT license found in the
1150
- * LICENSE file in the root directory of this source tree.
1151
- */
1152
- let fetchCache;
1153
- const requests = new Map();
1154
- const getIconCacheMap = () => {
1155
- if (typeof window === 'undefined') {
1156
- return new Map();
1157
- }
1158
- if (!fetchCache) {
1159
- window.IxIcons = window.IxIcons || {};
1160
- fetchCache = window.IxIcons.map = window.IxIcons.map || new Map();
1161
- }
1162
- return fetchCache;
1163
- };
1164
- const isSvgDataUrl = (url) => {
1165
- if (!url) {
1166
- return false;
1167
- }
1168
- if (typeof url !== 'string') {
1169
- return false;
1170
- }
1171
- return url.startsWith('data:image/svg+xml');
1172
- };
1173
- async function fetchSVG(url) {
1174
- const cache = getIconCacheMap();
1175
- if (cache.has(url)) {
1176
- return cache.get(url);
1177
- }
1178
- if (requests.has(url)) {
1179
- return requests.get(url);
1180
- }
1181
- const fetching = fetch(url)
1182
- .then(async (response) => {
1183
- const responseText = await response.text();
1184
- let svgContent = '';
1185
- if (response.ok) {
1186
- svgContent = parseSVGDataContent(responseText);
1187
- cache.set(url, svgContent);
1188
- }
1189
- else {
1190
- console.error('Failed to request svg data from', url, 'with status code', response.status);
1191
- }
1192
- return svgContent;
1193
- })
1194
- .catch(() => {
1195
- console.error('Failed to fetch svg data:', url);
1196
- cache.set(url, '');
1197
- return '';
1198
- })
1199
- .finally(() => {
1200
- requests.delete(url);
1201
- });
1202
- return fetching;
1203
- }
1204
- const urlRegex = /^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:www\.)?(?:\S+\.\S+)(?:\S*)$/i;
1205
- function isValidUrl(url) {
1206
- return urlRegex.test(url);
1207
- }
1208
- function getIconUrl(name) {
1209
- const customAssetUrl = getCustomAssetUrl();
1210
- if (customAssetUrl) {
1211
- return `${customAssetUrl}/${name}.svg`;
1212
- }
1213
- let url = `svg/${name}.svg`;
1214
- try {
1215
- url = getAssetPath(url);
1216
- }
1217
- catch (error) {
1218
- console.warn(`Could not load icon with name "${name}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to property.`);
1219
- }
1220
- return url;
1221
- }
1222
- async function resolveIcon(element, iconName) {
1223
- if (!iconName) {
1224
- console.warn('No icon was provided', element);
1225
- return '';
1226
- }
1227
- if (isSvgDataUrl(iconName)) {
1228
- return parseSVGDataContent(iconName);
1229
- }
1230
- return loadIcon(iconName);
1231
- }
1232
- async function loadIcon(iconName) {
1233
- const cache = getIconCacheMap();
1234
- if (cache.has(iconName)) {
1235
- return cache.get(iconName);
1236
- }
1237
- if (isValidUrl(iconName)) {
1238
- return fetchSVG(iconName);
1239
- }
1240
- return fetchSVG(getIconUrl(iconName));
1241
- }
1242
- function removePrefix(name, prefix) {
1243
- if (name.startsWith(prefix)) {
1244
- name = name.slice(prefix.length);
1245
- return name.replace(/^(\w)/, (_match, p1) => p1.toLowerCase());
1246
- }
1247
- return name;
1248
- }
1249
- function addIcons(icons) {
1250
- Object.keys(icons).forEach(name => {
1251
- const icon = icons[name];
1252
- name = removePrefix(name, 'icon');
1253
- addIconToCache(name, icon);
1254
- });
1255
- }
1256
- function addIconToCache(name, icon) {
1257
- const cache = getIconCacheMap();
1258
- if (cache.has(name)) {
1259
- console.warn(`Icon name '${name}' already in cache. Overwritting with new icon data.`);
1260
- }
1261
- const svg = parseSVGDataContent(icon);
1262
- cache.set(name, svg);
1263
- const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, '$1-$2').toLowerCase();
1264
- if (name != toKebabCase) {
1265
- cache.set(toKebabCase, svg);
1266
- }
1267
- }
1268
-
1269
- const iconCss = ":host{display:inline-flex;height:1.5rem;width:1.5rem;min-height:1.5rem;min-width:1.5rem;color:inherit}:host .svg-container{display:block;position:relative;width:100%;height:100%}:host .svg-container svg{display:block;position:relative;height:100%;width:100%}:host .svg-container svg,:host .svg-container svg[fill],:host .svg-container svg [fill]{fill:currentColor !important}:host(.size-12){height:0.75rem;width:0.75rem;min-height:0.75rem;min-width:0.75rem}:host(.size-16){height:1rem;width:1rem;min-height:1rem;min-width:1rem}:host(.size-32){height:2rem;width:2rem;min-height:2rem;min-width:2rem}";
1270
- const IxIconStyle0 = iconCss;
1271
-
1272
- const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends H {
1273
- constructor() {
1274
- super();
1275
- this.__registerHost();
1276
- this.__attachShadow();
1277
- /**
1278
- * Size of the icon
1279
- */
1280
- this.size = '24';
1281
- /**
1282
- * Only fetch and parse svg data when icon is visible
1283
- */
1284
- this.lazyLoading = false;
1285
- this.isVisible = false;
1286
- }
1287
- componentWillLoad() {
1288
- this.waitForRendering(() => {
1289
- this.isVisible = true;
1290
- this.loadIconContent();
1291
- });
1292
- }
1293
- async loadIconContent() {
1294
- const content = await resolveIcon(this.hostElement, this.name);
1295
- if (!content) {
1296
- this.svgContent = parseSVGDataContent(errorSymbol);
1297
- return;
1298
- }
1299
- this.svgContent = content;
1300
- }
1301
- waitForRendering(onRender) {
1302
- if (this.lazyLoading && typeof window !== 'undefined' && window.IntersectionObserver) {
1303
- const observer = new IntersectionObserver(entries => {
1304
- entries.forEach(entry => {
1305
- if (entry.isIntersecting) {
1306
- onRender();
1307
- observer.disconnect();
1308
- }
1309
- });
1310
- }, {
1311
- rootMargin: '25px',
1312
- });
1313
- observer.observe(this.hostElement);
1314
- }
1315
- else {
1316
- onRender();
1317
- }
1318
- }
1319
- render() {
1320
- const style = {};
1321
- if (this.color) {
1322
- style['color'] = `var(--theme-${this.color})`;
1323
- }
1324
- return (h(Host, { key: '484071b4f74e0b803b8d36913c866bfdb4b1a259', style: style, class: {
1325
- ['size-12']: this.size === '12',
1326
- ['size-16']: this.size === '16',
1327
- ['size-24']: this.size === '24',
1328
- ['size-32']: this.size === '32',
1329
- } }, h("div", { key: 'd988ef0fcc83087c24c905cf95ff02fe187aed5e', class: 'svg-container', innerHTML: this.svgContent })));
1330
- }
1331
- static get assetsDirs() { return ["svg"]; }
1332
- get hostElement() { return this; }
1333
- static get watchers() { return {
1334
- "name": ["loadIconContent"]
1335
- }; }
1336
- static get style() { return IxIconStyle0; }
1337
- }, [1, "ix-icon", {
1338
- "size": [1],
1339
- "color": [1],
1340
- "name": [1],
1341
- "lazyLoading": [4, "lazy-loading"],
1342
- "svgContent": [32],
1343
- "isVisible": [32]
1344
- }, undefined, {
1345
- "name": ["loadIconContent"]
1346
- }]);
1347
- function defineCustomElement() {
1348
- if (typeof customElements === "undefined") {
1349
- return;
1350
- }
1351
- const components = ["ix-icon"];
1352
- components.forEach(tagName => { switch (tagName) {
1353
- case "ix-icon":
1354
- if (!customElements.get(tagName)) {
1355
- customElements.define(tagName, Icon);
1356
- }
1357
- break;
1358
- } });
1359
- }
1360
-
1361
- export { Icon as I, setNonce as a, setPlatformOptions as b, addIcons as c, addIconToCache as d, defineCustomElement as e, getAssetPath as g, setAssetPath as s };
1362
-
1363
- //# sourceMappingURL=p-187634d0.js.map