@everymatrix/ui-skeleton 1.69.0 → 1.69.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const uiSkeleton = require('./ui-skeleton-0b101594.js');
5
+ const uiSkeleton = require('./ui-skeleton-282391af.js');
6
6
  require('./index-946ac65b.js');
7
7
 
8
8
 
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
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"]}]]]], options);
11
+ return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -0,0 +1,179 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-946ac65b.js');
4
+
5
+ const uiSkeletonCss = ":host{display:block}.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, 10px)}.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, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.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, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.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, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
6
+ const UiSkeletonStyle0 = uiSkeletonCss;
7
+
8
+ const UiSkeleton = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ this.stylingValue = {
12
+ width: this.handleStylingProps(this.width),
13
+ height: this.handleStylingProps(this.height),
14
+ borderRadius: this.handleStylingProps(this.borderRadius),
15
+ marginBottom: this.handleStylingProps(this.marginBottom),
16
+ marginTop: this.handleStylingProps(this.marginTop),
17
+ marginLeft: this.handleStylingProps(this.marginLeft),
18
+ marginRight: this.handleStylingProps(this.marginRight),
19
+ size: this.handleStylingProps(this.size)
20
+ };
21
+ this.structure = undefined;
22
+ this.width = 'unset';
23
+ this.height = 'unset';
24
+ this.borderRadius = 'unset';
25
+ this.marginBottom = 'unset';
26
+ this.marginTop = 'unset';
27
+ this.marginLeft = 'unset';
28
+ this.marginRight = 'unset';
29
+ this.animation = true;
30
+ this.rows = 0;
31
+ this.size = '100%';
32
+ }
33
+ handleStructureChange(newValue, oldValue) {
34
+ if (oldValue !== newValue) {
35
+ this.handleStructure(newValue);
36
+ }
37
+ }
38
+ handleStylingProps(value) {
39
+ switch (typeof value) {
40
+ case 'number':
41
+ return value === 0 ? 0 : `${value}px`;
42
+ case 'undefined':
43
+ return 'unset';
44
+ case 'string':
45
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
46
+ value.endsWith('px') ||
47
+ value.endsWith('%')) {
48
+ return value;
49
+ }
50
+ else {
51
+ return 'unset';
52
+ }
53
+ default:
54
+ return 'unset';
55
+ }
56
+ }
57
+ handleStructure(structure) {
58
+ switch (structure) {
59
+ case 'logo':
60
+ return this.renderLogo();
61
+ case 'image':
62
+ return this.renderImage();
63
+ case 'title':
64
+ return this.renderTitle();
65
+ case 'text':
66
+ return this.renderText();
67
+ case 'rectangle':
68
+ return this.renderRectangle();
69
+ case 'circle':
70
+ return this.renderCircle();
71
+ default:
72
+ return null;
73
+ }
74
+ }
75
+ renderLogo() {
76
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Logo ' + (this.animation ? 'Skeleton' : '') })));
77
+ }
78
+ renderImage() {
79
+ return index.h("div", { class: 'Image ' + (this.animation ? 'Skeleton' : '') });
80
+ }
81
+ renderTitle() {
82
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Title ' + (this.animation ? 'Skeleton' : '') })));
83
+ }
84
+ renderText() {
85
+ 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' : '') })))));
86
+ }
87
+ renderRectangle() {
88
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Rectangle ' + (this.animation ? 'Skeleton' : '') })));
89
+ }
90
+ renderCircle() {
91
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Circle ' + (this.animation ? 'Skeleton' : '') })));
92
+ }
93
+ render() {
94
+ let styleBlock = '';
95
+ switch (this.structure) {
96
+ case 'logo':
97
+ styleBlock = `
98
+ :host {
99
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
100
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
101
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
102
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
103
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
104
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
105
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
106
+ }
107
+ `;
108
+ break;
109
+ case 'image':
110
+ styleBlock = `
111
+ :host {
112
+ --emw-skeleton-image-width: ${this.stylingValue.width};
113
+ --emw-skeleton-image-height: ${this.stylingValue.height};
114
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
115
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
116
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
117
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
118
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
119
+ }
120
+ `;
121
+ break;
122
+ case 'title':
123
+ styleBlock = `
124
+ :host {
125
+ --emw-skeleton-title-width: ${this.stylingValue.width};
126
+ --emw-skeleton-title-height: ${this.stylingValue.height};
127
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
128
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
129
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
130
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
131
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
132
+ }
133
+ `;
134
+ break;
135
+ case 'text':
136
+ styleBlock = `
137
+ :host {
138
+ --emw-skeleton-text-width: ${this.stylingValue.width};
139
+ --emw-skeleton-text-height: ${this.stylingValue.height};
140
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
141
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
142
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
143
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
144
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
145
+ }
146
+ `;
147
+ break;
148
+ case 'rectangle':
149
+ styleBlock = `
150
+ :host {
151
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
152
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
153
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
154
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
155
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
156
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
157
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
158
+ }
159
+ `;
160
+ break;
161
+ case 'circle':
162
+ styleBlock = `
163
+ :host {
164
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
165
+ }
166
+ `;
167
+ break;
168
+ default:
169
+ styleBlock = '';
170
+ }
171
+ return (index.h(index.Host, { key: 'e6b885bfd985ce7663d990756fe9101e25eb97f0' }, index.h("style", { key: '06ae24c7bb74f4dacfc12ae58085333f9dc89da5' }, styleBlock), this.handleStructure(this.structure)));
172
+ }
173
+ static get watchers() { return {
174
+ "structure": ["handleStructureChange"]
175
+ }; }
176
+ };
177
+ UiSkeleton.style = UiSkeletonStyle0;
178
+
179
+ exports.UiSkeleton = UiSkeleton;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const uiSkeleton = require('./ui-skeleton-0b101594.js');
5
+ const uiSkeleton = require('./ui-skeleton-282391af.js');
6
6
  require('./index-946ac65b.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"]}]]]], options);
22
+ return index.bootstrapLazy([["ui-skeleton.cjs",[[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -1,13 +1,5 @@
1
1
  :host {
2
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
3
  }
12
4
 
13
5
  .Skeleton {
@@ -18,7 +10,7 @@
18
10
  background-color: var(--emw-skeleton-rectangle-background, #c2c2c2);
19
11
  width: var(--emw-skeleton-rectangle-width, 400px);
20
12
  height: var(--emw-skeleton-rectangle-height, 200px);
21
- border-radius: var(--emw-skeleton-rectangle-border-radius, 2px);
13
+ border-radius: var(--emw-skeleton-rectangle-border-radius, 10px);
22
14
  }
23
15
 
24
16
  .Circle {
@@ -32,18 +24,18 @@
32
24
  background-color: var(--emw-skeleton-text-background, #c2c2c2);
33
25
  width: var(--emw-skeleton-text-width, 500px);
34
26
  height: var(--emw-skeleton-text-height, 20px);
35
- border-radius: var(--emw-skeleton-text-border-radius, 5px);
27
+ border-radius: var(--emw-skeleton-text-border-radius, 10px);
36
28
  margin-bottom: var(--emw-skeleton-text-margin-bottom, 5px);
37
29
  }
38
30
  .Text:last-child {
39
- width: var(--emw-skeleton-text-width-100, 300px);
31
+ width: calc(var(--emw-skeleton-text-width, 400px) - 100px);
40
32
  }
41
33
 
42
34
  .Title {
43
35
  background-color: var(--emw-skeleton-title-background, #c2c2c2);
44
36
  width: var(--emw-skeleton-title-width, 300px);
45
37
  height: var(--emw-skeleton-title-height, 30px);
46
- border-radius: var(--emw-skeleton-title-border-radius, 5px);
38
+ border-radius: var(--emw-skeleton-title-border-radius, 10px);
47
39
  margin-bottom: var(--emw-skeleton-title-margin-bottom, 5px);
48
40
  }
49
41
 
@@ -51,21 +43,21 @@
51
43
  background-color: var(--emw-skeleton-image-background, #c2c2c2);
52
44
  width: var(--emw-skeleton-image-width, 100%);
53
45
  height: var(--emw-skeleton-image-height, 100%);
54
- border-radius: var(--emw-skeleton-image-border-radius, inherit);
46
+ border-radius: var(--emw-skeleton-image-border-radius, unset);
55
47
  }
56
48
 
57
49
  .Logo {
58
50
  background-color: var(--emw-skeleton-logo-background, #c2c2c2);
59
51
  width: var(--emw-skeleton-logo-width, 120px);
60
52
  height: var(--emw-skeleton-logo-height, 75px);
61
- border-radius: var(--emw-skeleton-logo-border-radius, 5px);
53
+ border-radius: var(--emw-skeleton-logo-border-radius, 10px);
62
54
  }
63
55
 
64
56
  @keyframes skeleton-loading {
65
57
  0% {
66
- background-color: var(--emw-skeleton-primary-color, var(--emw-skeleton-color-0, #c2c2c2));
58
+ background-color: var(--emw-skeleton-primary-color, #e0e0e0);
67
59
  }
68
60
  100% {
69
- background-color: var(--emw-skeleton-secondary-color, var(--emw-skeleton-color-100, #f0f0f0));
61
+ background-color: var(--emw-skeleton-secondary-color, #f0f0f0);
70
62
  }
71
63
  }