@everymatrix/ui-skeleton 1.60.0 → 1.60.1

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.
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'ui-skeleton';
24
- const BUILD = /* ui-skeleton */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, 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: true, lifecycleDOMEvents: false, member: true, method: false, mode: 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: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: false, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: false, vdomXlink: false, watchCallback: true };
24
+ const BUILD = /* ui-skeleton */ { 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, 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: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: false, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -380,32 +380,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
380
380
  const newClasses = parseClassList(newValue);
381
381
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
382
382
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
383
- } else if (memberName === "style") {
384
- {
385
- for (const prop in oldValue) {
386
- if (!newValue || newValue[prop] == null) {
387
- if (prop.includes("-")) {
388
- elm.style.removeProperty(prop);
389
- } else {
390
- elm.style[prop] = "";
391
- }
392
- }
393
- }
394
- }
395
- for (const prop in newValue) {
396
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
397
- if (prop.includes("-")) {
398
- elm.style.setProperty(prop, newValue[prop]);
399
- } else {
400
- elm.style[prop] = newValue[prop];
401
- }
402
- }
403
- }
404
- } else if (memberName === "key") ; else if (memberName === "ref") {
405
- if (newValue) {
406
- newValue(elm);
407
- }
408
- } else ;
383
+ }
409
384
  }
410
385
  };
411
386
  var parseClassListRegex = /\s/;
@@ -443,7 +418,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
443
418
  let i2 = 0;
444
419
  let elm;
445
420
  let childNode;
446
- {
421
+ if (newVNode2.$text$ !== null) {
422
+ elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
423
+ } else {
447
424
  elm = newVNode2.$elm$ = doc.createElement(
448
425
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
449
426
  );
@@ -480,7 +457,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
480
457
  const vnode = vnodes[index];
481
458
  if (vnode) {
482
459
  const elm = vnode.$elm$;
483
- nullifyVNodeRefs(vnode);
484
460
  if (elm) {
485
461
  elm.remove();
486
462
  }
@@ -584,7 +560,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
584
560
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
585
561
  const oldChildren = oldVNode.$children$;
586
562
  const newChildren = newVNode2.$children$;
587
- {
563
+ const text = newVNode2.$text$;
564
+ if (text === null) {
588
565
  {
589
566
  {
590
567
  updateElement(oldVNode, newVNode2);
@@ -593,16 +570,15 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
593
570
  if (oldChildren !== null && newChildren !== null) {
594
571
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
595
572
  } else if (newChildren !== null) {
573
+ if (oldVNode.$text$ !== null) {
574
+ elm.textContent = "";
575
+ }
596
576
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
597
577
  } else if (oldChildren !== null) {
598
578
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
599
579
  }
600
- }
601
- };
602
- var nullifyVNodeRefs = (vNode) => {
603
- {
604
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
605
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
580
+ } else if (oldVNode.$text$ !== text) {
581
+ elm.data = text;
606
582
  }
607
583
  };
608
584
  var insertBefore = (parent, newNode, reference) => {
@@ -720,16 +696,12 @@ var postUpdateComponent = (hostRef) => {
720
696
  const tagName = hostRef.$cmpMeta$.$tagName$;
721
697
  const elm = hostRef.$hostElement$;
722
698
  const endPostUpdate = createTime("postUpdate", tagName);
723
- const instance = hostRef.$lazyInstance$ ;
724
699
  const ancestorComponent = hostRef.$ancestorComponent$;
725
700
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
726
701
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
727
702
  {
728
703
  addHydratedFlag(elm);
729
704
  }
730
- {
731
- safeCall(instance, "componentDidLoad");
732
- }
733
705
  endPostUpdate();
734
706
  {
735
707
  hostRef.$onReadyResolve$(elm);
@@ -757,16 +729,6 @@ var appDidLoad = (who) => {
757
729
  }
758
730
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
759
731
  };
760
- var safeCall = (instance, method, arg) => {
761
- if (instance && instance[method]) {
762
- try {
763
- return instance[method](arg);
764
- } catch (e) {
765
- consoleError(e);
766
- }
767
- }
768
- return void 0;
769
- };
770
732
  var addHydratedFlag = (elm) => {
771
733
  var _a;
772
734
  return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
@@ -1099,6 +1061,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1099
1061
  // src/runtime/nonce.ts
1100
1062
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1101
1063
 
1064
+ exports.Host = Host;
1102
1065
  exports.bootstrapLazy = bootstrapLazy;
1103
1066
  exports.h = h;
1104
1067
  exports.promiseResolve = promiseResolve;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const uiSkeleton = require('./ui-skeleton-ce8e4a69.js');
6
- require('./index-00751390.js');
5
+ const uiSkeleton = require('./ui-skeleton-1b7315dc.js');
6
+ require('./index-946ac65b.js');
7
7
 
8
8
 
9
9
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-00751390.js');
5
+ const index = require('./index-946ac65b.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"],"primaryColor":["updateStyles"],"secondaryColor":["updateStyles"]}]]]], options);
11
+ return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-946ac65b.js');
4
+
5
+ const uiSkeletonCss = ":host{display:block;--emw-skeleton-rectangle-background:#c2c2c2;--emw-skeleton-circle-background:#c2c2c2;--emw-skeleton-text-background:#c2c2c2;--emw-skeleton-title-background:#c2c2c2;--emw-skeleton-image-background:#c2c2c2;--emw-skeleton-logo-background:#c2c2c2;--emw-skeleton-primary-color:#e0e0e0;--emw-skeleton-secondary-color:#f0f0f0}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 2px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 5px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:var(--emw-skeleton-text-width-100, 300px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 5px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 250px);height:var(--emw-skeleton-image-height, 200px);border-radius:var(--emw-skeleton-image-border-radius, 10px)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 5px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, var(--emw-skeleton-color-0, #c2c2c2))}100%{background-color:var(--emw-skeleton-secondary-color, var(--emw-skeleton-color-100, #f0f0f0))}}";
6
+ const UiSkeletonStyle0 = uiSkeletonCss;
7
+
8
+ const UiSkeleton = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ this.structure = undefined;
12
+ this.width = undefined;
13
+ this.height = undefined;
14
+ this.borderRadius = undefined;
15
+ this.marginBottom = undefined;
16
+ this.marginTop = undefined;
17
+ this.marginLeft = undefined;
18
+ this.marginRight = undefined;
19
+ this.animation = true;
20
+ this.rows = undefined;
21
+ this.size = undefined;
22
+ this.color = undefined;
23
+ this.primaryColor = undefined;
24
+ this.secondaryColor = undefined;
25
+ }
26
+ handleStructureChange(newValue, oldValue) {
27
+ if (oldValue !== newValue) {
28
+ this.handleStructure(newValue);
29
+ }
30
+ }
31
+ handleStructure(structure) {
32
+ switch (structure) {
33
+ case 'logo':
34
+ return this.renderLogo();
35
+ case 'image':
36
+ return this.renderImage();
37
+ case 'title':
38
+ return this.renderTitle();
39
+ case 'text':
40
+ return this.renderText();
41
+ case 'rectangle':
42
+ return this.renderRectangle();
43
+ case 'circle':
44
+ return this.renderCircle();
45
+ default:
46
+ return null;
47
+ }
48
+ }
49
+ renderLogo() {
50
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Logo " + (this.animation ? 'Skeleton' : '') })));
51
+ }
52
+ renderImage() {
53
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Image " + (this.animation ? 'Skeleton' : '') })));
54
+ }
55
+ renderTitle() {
56
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Title " + (this.animation ? 'Skeleton' : '') })));
57
+ }
58
+ renderText() {
59
+ return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: "Text " + (this.animation ? 'Skeleton' : '') })))));
60
+ }
61
+ renderRectangle() {
62
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Rectangle " + (this.animation ? 'Skeleton' : '') })));
63
+ }
64
+ renderCircle() {
65
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Circle " + (this.animation ? 'Skeleton' : '') })));
66
+ }
67
+ render() {
68
+ let styleBlock = '';
69
+ switch (this.structure) {
70
+ case 'logo':
71
+ styleBlock = `
72
+ :host {
73
+ --emw-skeleton-logo-width: ${this.width};
74
+ --emw-skeleton-logo-height: ${this.height};
75
+ --emw-skeleton-logo-border-radius: ${this.borderRadius}px;
76
+ --emw-skeleton-logo-margin-bottom: ${this.marginBottom}px;
77
+ --emw-skeleton-logo-margin-top: ${this.marginTop}px;
78
+ --emw-skeleton-logo-margin-left: ${this.marginLeft}px;
79
+ --emw-skeleton-logo-margin-right: ${this.marginRight}px;
80
+ --emw-skeleton-logo-background: ${this.color};
81
+ --emw-skeleton-primary-color: ${this.primaryColor};
82
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
83
+ }
84
+ `;
85
+ break;
86
+ case 'image':
87
+ styleBlock = `
88
+ :host {
89
+ --emw-skeleton-image-width: ${this.width};
90
+ --emw-skeleton-image-height: ${this.height};
91
+ --emw-skeleton-image-border-radius: ${this.borderRadius}px;
92
+ --emw-skeleton-image-margin-bottom: ${this.marginBottom}px;
93
+ --emw-skeleton-image-margin-top: ${this.marginTop}px;
94
+ --emw-skeleton-image-margin-left: ${this.marginLeft}px;
95
+ --emw-skeleton-image-margin-right: ${this.marginRight}px;
96
+ --emw-skeleton-image-background: ${this.color};
97
+ --emw-skeleton-primary-color: ${this.primaryColor};
98
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
99
+ }
100
+ `;
101
+ break;
102
+ case 'title':
103
+ styleBlock = `
104
+ :host {
105
+ --emw-skeleton-title-width: ${this.width};
106
+ --emw-skeleton-title-height: ${this.height};
107
+ --emw-skeleton-title-border-radius: ${this.borderRadius}px;
108
+ --emw-skeleton-title-margin-bottom: ${this.marginBottom}px;
109
+ --emw-skeleton-title-margin-top: ${this.marginTop}px;
110
+ --emw-skeleton-title-margin-left: ${this.marginLeft}px;
111
+ --emw-skeleton-title-margin-right: ${this.marginRight}px;
112
+ --emw-skeleton-title-background: ${this.color};
113
+ --emw-skeleton-primary-color: ${this.primaryColor};
114
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
115
+ }
116
+ `;
117
+ break;
118
+ case 'text':
119
+ styleBlock = `
120
+ :host {
121
+ --emw-skeleton-text-width: ${this.width};
122
+ --emw-skeleton-text-height: ${this.height};
123
+ --emw-skeleton-text-border-radius: ${this.borderRadius}px;
124
+ --emw-skeleton-text-margin-bottom: ${this.marginBottom}px;
125
+ --emw-skeleton-text-margin-top: ${this.marginTop}px;
126
+ --emw-skeleton-text-margin-left: ${this.marginLeft}px;
127
+ --emw-skeleton-text-margin-right: ${this.marginRight}px;
128
+ --emw-skeleton-text-background: ${this.color};
129
+ --emw-skeleton-primary-color: ${this.primaryColor};
130
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
131
+ }
132
+ `;
133
+ break;
134
+ case 'rectangle':
135
+ styleBlock = `
136
+ :host {
137
+ --emw-skeleton-rectangle-width: ${this.width};
138
+ --emw-skeleton-rectangle-height: ${this.height};
139
+ --emw-skeleton-rectangle-border-radius: ${this.borderRadius}px;
140
+ --emw-skeleton-rectangle-margin-bottom: ${this.marginBottom}px;
141
+ --emw-skeleton-rectangle-margin-top: ${this.marginTop}px;
142
+ --emw-skeleton-rectangle-margin-left: ${this.marginLeft}px;
143
+ --emw-skeleton-rectangle-margin-right: ${this.marginRight}px;
144
+ --emw-skeleton-rectangle-background: ${this.color};
145
+ --emw-skeleton-primary-color: ${this.primaryColor};
146
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
147
+ }
148
+ `;
149
+ break;
150
+ case 'circle':
151
+ styleBlock = `
152
+ :host {
153
+ --emw-skeleton-circle-size: ${this.size};
154
+ --emw-skeleton-circle-background: ${this.color};
155
+ --emw-skeleton-primary-color: ${this.primaryColor};
156
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
157
+ }
158
+ `;
159
+ break;
160
+ default:
161
+ styleBlock = '';
162
+ }
163
+ return (index.h(index.Host, { key: '58f7f9acd15f0f96b8b6f47f6bea81d49a3857c5' }, index.h("style", { key: 'c72ac31d1c55fd5d18ec334629db45977a0f6124' }, styleBlock), this.handleStructure(this.structure)));
164
+ }
165
+ static get watchers() { return {
166
+ "structure": ["handleStructureChange"]
167
+ }; }
168
+ };
169
+ UiSkeleton.style = UiSkeletonStyle0;
170
+
171
+ exports.UiSkeleton = UiSkeleton;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const uiSkeleton = require('./ui-skeleton-ce8e4a69.js');
6
- require('./index-00751390.js');
5
+ const uiSkeleton = require('./ui-skeleton-1b7315dc.js');
6
+ require('./index-946ac65b.js');
7
7
 
8
8
 
9
9
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-00751390.js');
5
+ const index = require('./index-946ac65b.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"],"primaryColor":["updateStyles"],"secondaryColor":["updateStyles"]}]]]], options);
22
+ return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -1,3 +1,15 @@
1
+ :host {
2
+ display: block;
3
+ --emw-skeleton-rectangle-background: #c2c2c2;
4
+ --emw-skeleton-circle-background: #c2c2c2;
5
+ --emw-skeleton-text-background: #c2c2c2;
6
+ --emw-skeleton-title-background: #c2c2c2;
7
+ --emw-skeleton-image-background: #c2c2c2;
8
+ --emw-skeleton-logo-background: #c2c2c2;
9
+ --emw-skeleton-primary-color: #e0e0e0;
10
+ --emw-skeleton-secondary-color: #f0f0f0;
11
+ }
12
+
1
13
  .Skeleton {
2
14
  animation: skeleton-loading 1s linear infinite alternate;
3
15
  }
@@ -1,4 +1,4 @@
1
- import { h } from "@stencil/core";
1
+ import { h, Host } from "@stencil/core";
2
2
  export class UiSkeleton {
3
3
  constructor() {
4
4
  this.structure = undefined;
@@ -21,14 +21,6 @@ export class UiSkeleton {
21
21
  this.handleStructure(newValue);
22
22
  }
23
23
  }
24
- updateStyles() {
25
- if (this.primaryColor) {
26
- this.skeletonContainer.style.setProperty('--emw-skeleton-primary-color', this.primaryColor);
27
- }
28
- if (this.secondaryColor) {
29
- this.skeletonContainer.style.setProperty('--emw-skeleton-secondary-color', this.secondaryColor);
30
- }
31
- }
32
24
  handleStructure(structure) {
33
25
  switch (structure) {
34
26
  case 'logo':
@@ -44,92 +36,124 @@ export class UiSkeleton {
44
36
  case 'circle':
45
37
  return this.renderCircle();
46
38
  default:
47
- // nothing
48
- break;
39
+ return null;
49
40
  }
50
41
  }
51
42
  renderLogo() {
52
- const styles = {
53
- width: `${this.width}`,
54
- height: `${this.height}`,
55
- 'background-color': `${this.color}`,
56
- 'border-radius': `${this.borderRadius}px`,
57
- 'margin-bottom': `${this.marginBottom}px`,
58
- 'margin-top': `${this.marginTop}px`,
59
- 'margin-left': `${this.marginLeft}px`,
60
- 'margin-right': `${this.marginRight}px`
61
- };
62
- return (h("div", { ref: el => this.skeletonContainer = el }, h("div", { style: styles, class: "Logo " + (this.animation ? 'Skeleton' : '') })));
43
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: "Logo " + (this.animation ? 'Skeleton' : '') })));
63
44
  }
64
45
  renderImage() {
65
- const styles = {
66
- width: `${this.width}`,
67
- height: `${this.height}`,
68
- 'background-color': `${this.color}`,
69
- 'border-radius': `${this.borderRadius}px`,
70
- 'margin-bottom': `${this.marginBottom}px`,
71
- 'margin-top': `${this.marginTop}px`,
72
- 'margin-left': `${this.marginLeft}px`,
73
- 'margin-right': `${this.marginRight}px`
74
- };
75
- return (h("div", { ref: el => this.skeletonContainer = el }, h("div", { style: styles, class: "Image " + (this.animation ? 'Skeleton' : '') })));
46
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: "Image " + (this.animation ? 'Skeleton' : '') })));
76
47
  }
77
48
  renderTitle() {
78
- const styles = {
79
- width: `${this.width}`,
80
- height: `${this.height}`,
81
- 'background-color': `${this.color}`,
82
- 'border-radius': `${this.borderRadius}px`,
83
- 'margin-bottom': `${this.marginBottom}px`,
84
- 'margin-top': `${this.marginTop}px`,
85
- 'margin-left': `${this.marginLeft}px`,
86
- 'margin-right': `${this.marginRight}px`
87
- };
88
- return (h("div", { ref: el => this.skeletonContainer = el }, h("div", { style: styles, class: "Title " + (this.animation ? 'Skeleton' : '') })));
49
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: "Title " + (this.animation ? 'Skeleton' : '') })));
89
50
  }
90
51
  renderText() {
91
- const styles = {
92
- width: `${this.width}`,
93
- height: `${this.height}`,
94
- 'background-color': `${this.color}`,
95
- 'border-radius': `${this.borderRadius}px`,
96
- 'margin-bottom': `${this.marginBottom}px`,
97
- 'margin-top': `${this.marginTop}px`,
98
- 'margin-left': `${this.marginLeft}px`,
99
- 'margin-right': `${this.marginRight}px`
100
- };
101
- return (Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index) => (h("div", { style: styles, key: index, class: "Text " + (this.animation ? 'Skeleton' : '') }))));
52
+ return (h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index) => (h("div", { key: index, class: "Text " + (this.animation ? 'Skeleton' : '') })))));
102
53
  }
103
54
  renderRectangle() {
104
- const styles = {
105
- width: `${this.width}`,
106
- height: `${this.height}`,
107
- 'background-color': `${this.color}`,
108
- 'border-radius': `${this.borderRadius}px`,
109
- 'margin-bottom': `${this.marginBottom}px`,
110
- 'margin-top': `${this.marginTop}px`,
111
- 'margin-left': `${this.marginLeft}px`,
112
- 'margin-right': `${this.marginRight}px`
113
- };
114
- return (h("div", { ref: el => this.skeletonContainer = el }, h("div", { style: styles, class: "Rectangle " + (this.animation ? 'Skeleton' : '') })));
55
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: "Rectangle " + (this.animation ? 'Skeleton' : '') })));
115
56
  }
116
57
  renderCircle() {
117
- const styles = {
118
- width: `${this.size}`,
119
- height: `${this.size}`,
120
- 'background-color': `${this.color}`,
121
- 'margin-bottom': `${this.marginBottom}px`,
122
- 'margin-top': `${this.marginTop}px`,
123
- 'margin-left': `${this.marginLeft}px`,
124
- 'margin-right': `${this.marginRight}px`
125
- };
126
- return (h("div", { ref: el => this.skeletonContainer = el }, h("div", { style: styles, class: "Circle " + (this.animation ? 'Skeleton' : '') })));
127
- }
128
- componentDidLoad() {
129
- this.updateStyles();
58
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: "Circle " + (this.animation ? 'Skeleton' : '') })));
130
59
  }
131
60
  render() {
132
- return (this.handleStructure(this.structure));
61
+ let styleBlock = '';
62
+ switch (this.structure) {
63
+ case 'logo':
64
+ styleBlock = `
65
+ :host {
66
+ --emw-skeleton-logo-width: ${this.width};
67
+ --emw-skeleton-logo-height: ${this.height};
68
+ --emw-skeleton-logo-border-radius: ${this.borderRadius}px;
69
+ --emw-skeleton-logo-margin-bottom: ${this.marginBottom}px;
70
+ --emw-skeleton-logo-margin-top: ${this.marginTop}px;
71
+ --emw-skeleton-logo-margin-left: ${this.marginLeft}px;
72
+ --emw-skeleton-logo-margin-right: ${this.marginRight}px;
73
+ --emw-skeleton-logo-background: ${this.color};
74
+ --emw-skeleton-primary-color: ${this.primaryColor};
75
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
76
+ }
77
+ `;
78
+ break;
79
+ case 'image':
80
+ styleBlock = `
81
+ :host {
82
+ --emw-skeleton-image-width: ${this.width};
83
+ --emw-skeleton-image-height: ${this.height};
84
+ --emw-skeleton-image-border-radius: ${this.borderRadius}px;
85
+ --emw-skeleton-image-margin-bottom: ${this.marginBottom}px;
86
+ --emw-skeleton-image-margin-top: ${this.marginTop}px;
87
+ --emw-skeleton-image-margin-left: ${this.marginLeft}px;
88
+ --emw-skeleton-image-margin-right: ${this.marginRight}px;
89
+ --emw-skeleton-image-background: ${this.color};
90
+ --emw-skeleton-primary-color: ${this.primaryColor};
91
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
92
+ }
93
+ `;
94
+ break;
95
+ case 'title':
96
+ styleBlock = `
97
+ :host {
98
+ --emw-skeleton-title-width: ${this.width};
99
+ --emw-skeleton-title-height: ${this.height};
100
+ --emw-skeleton-title-border-radius: ${this.borderRadius}px;
101
+ --emw-skeleton-title-margin-bottom: ${this.marginBottom}px;
102
+ --emw-skeleton-title-margin-top: ${this.marginTop}px;
103
+ --emw-skeleton-title-margin-left: ${this.marginLeft}px;
104
+ --emw-skeleton-title-margin-right: ${this.marginRight}px;
105
+ --emw-skeleton-title-background: ${this.color};
106
+ --emw-skeleton-primary-color: ${this.primaryColor};
107
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
108
+ }
109
+ `;
110
+ break;
111
+ case 'text':
112
+ styleBlock = `
113
+ :host {
114
+ --emw-skeleton-text-width: ${this.width};
115
+ --emw-skeleton-text-height: ${this.height};
116
+ --emw-skeleton-text-border-radius: ${this.borderRadius}px;
117
+ --emw-skeleton-text-margin-bottom: ${this.marginBottom}px;
118
+ --emw-skeleton-text-margin-top: ${this.marginTop}px;
119
+ --emw-skeleton-text-margin-left: ${this.marginLeft}px;
120
+ --emw-skeleton-text-margin-right: ${this.marginRight}px;
121
+ --emw-skeleton-text-background: ${this.color};
122
+ --emw-skeleton-primary-color: ${this.primaryColor};
123
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
124
+ }
125
+ `;
126
+ break;
127
+ case 'rectangle':
128
+ styleBlock = `
129
+ :host {
130
+ --emw-skeleton-rectangle-width: ${this.width};
131
+ --emw-skeleton-rectangle-height: ${this.height};
132
+ --emw-skeleton-rectangle-border-radius: ${this.borderRadius}px;
133
+ --emw-skeleton-rectangle-margin-bottom: ${this.marginBottom}px;
134
+ --emw-skeleton-rectangle-margin-top: ${this.marginTop}px;
135
+ --emw-skeleton-rectangle-margin-left: ${this.marginLeft}px;
136
+ --emw-skeleton-rectangle-margin-right: ${this.marginRight}px;
137
+ --emw-skeleton-rectangle-background: ${this.color};
138
+ --emw-skeleton-primary-color: ${this.primaryColor};
139
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
140
+ }
141
+ `;
142
+ break;
143
+ case 'circle':
144
+ styleBlock = `
145
+ :host {
146
+ --emw-skeleton-circle-size: ${this.size};
147
+ --emw-skeleton-circle-background: ${this.color};
148
+ --emw-skeleton-primary-color: ${this.primaryColor};
149
+ --emw-skeleton-secondary-color: ${this.secondaryColor};
150
+ }
151
+ `;
152
+ break;
153
+ default:
154
+ styleBlock = '';
155
+ }
156
+ return (h(Host, { key: '58f7f9acd15f0f96b8b6f47f6bea81d49a3857c5' }, h("style", { key: 'c72ac31d1c55fd5d18ec334629db45977a0f6124' }, styleBlock), this.handleStructure(this.structure)));
133
157
  }
134
158
  static get is() { return "ui-skeleton"; }
135
159
  static get originalStyleUrls() {
@@ -327,7 +351,7 @@ export class UiSkeleton {
327
351
  "optional": false,
328
352
  "docs": {
329
353
  "tags": [],
330
- "text": "The size of the circle - only for `circle - it can either be a value in px (150px) or in percentage (100%)"
354
+ "text": "The size of the circle - only for `circle` - it can either be a value in px (150px) or in percentage (100%)"
331
355
  },
332
356
  "attribute": "size",
333
357
  "reflect": false
@@ -389,12 +413,6 @@ export class UiSkeleton {
389
413
  return [{
390
414
  "propName": "structure",
391
415
  "methodName": "handleStructureChange"
392
- }, {
393
- "propName": "primaryColor",
394
- "methodName": "updateStyles"
395
- }, {
396
- "propName": "secondaryColor",
397
- "methodName": "updateStyles"
398
416
  }];
399
417
  }
400
418
  }