@redvars/peacock 3.0.0
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.
- package/.editorconfig +29 -0
- package/.husky/pre-commit +1 -0
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/custom-elements-manifest.config.mjs +34 -0
- package/custom-elements.md +252 -0
- package/demo/index.html +24 -0
- package/demo/tokens.css +510 -0
- package/dist/src/LoaderUtils.d.ts +23 -0
- package/dist/src/LoaderUtils.js +81 -0
- package/dist/src/LoaderUtils.js.map +1 -0
- package/dist/src/avatar/avatar.css.d.ts +1 -0
- package/dist/src/avatar/avatar.css.js +41 -0
- package/dist/src/avatar/avatar.css.js.map +1 -0
- package/dist/src/avatar/avatar.d.ts +14 -0
- package/dist/src/avatar/avatar.js +44 -0
- package/dist/src/avatar/avatar.js.map +1 -0
- package/dist/src/icon/datasource.d.ts +2 -0
- package/dist/src/icon/datasource.js +20 -0
- package/dist/src/icon/datasource.js.map +1 -0
- package/dist/src/icon/icon.css.d.ts +1 -0
- package/dist/src/icon/icon.css.js +22 -0
- package/dist/src/icon/icon.css.js.map +1 -0
- package/dist/src/icon/icon.d.ts +26 -0
- package/dist/src/icon/icon.js +119 -0
- package/dist/src/icon/icon.js.map +1 -0
- package/dist/src/icon/p-icon.d.ts +3 -0
- package/dist/src/icon/p-icon.js +10 -0
- package/dist/src/icon/p-icon.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/peacock-loader.d.ts +1 -0
- package/dist/src/peacock-loader.js +16 -0
- package/dist/src/peacock-loader.js.map +1 -0
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.js +101 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/icon.test.d.ts +1 -0
- package/dist/test/icon.test.js +14 -0
- package/dist/test/icon.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +87 -0
- package/readme-gen.mjs +11 -0
- package/rollup.config.js +19 -0
- package/src/LoaderUtils.ts +121 -0
- package/src/avatar/avatar.css.ts +41 -0
- package/src/avatar/avatar.ts +39 -0
- package/src/avatar/demo/index.html +26 -0
- package/src/icon/datasource.ts +28 -0
- package/src/icon/demo/index.html +25 -0
- package/src/icon/icon.css.ts +22 -0
- package/src/icon/icon.ts +117 -0
- package/src/icon/p-icon.ts +5 -0
- package/src/index.ts +2 -0
- package/src/peacock-loader.ts +17 -0
- package/src/utils.ts +118 -0
- package/test/icon.test.ts +16 -0
- package/tsconfig.json +22 -0
- package/web-dev-server.config.js +27 -0
- package/web-test-runner.config.js +41 -0
package/demo/tokens.css
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
/* -------------------------------------------
|
|
2
|
+
* Autogenerated by ⛋ Terrazzo. DO NOT EDIT!
|
|
3
|
+
* ------------------------------------------- */
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--color-background: #fffbff;
|
|
7
|
+
--color-black: #000000;
|
|
8
|
+
--color-blue: #305cde;
|
|
9
|
+
--color-blue-0: #000000;
|
|
10
|
+
--color-blue-10: #001550;
|
|
11
|
+
--color-blue-20: #00277f;
|
|
12
|
+
--color-blue-30: #003ab2;
|
|
13
|
+
--color-blue-40: #2352d5;
|
|
14
|
+
--color-blue-50: #446def;
|
|
15
|
+
--color-blue-60: #6789ff;
|
|
16
|
+
--color-blue-70: #90a7ff;
|
|
17
|
+
--color-blue-80: #b6c4ff;
|
|
18
|
+
--color-blue-90: #dce1ff;
|
|
19
|
+
--color-blue-95: #eff0ff;
|
|
20
|
+
--color-blue-98: #faf8ff;
|
|
21
|
+
--color-blue-100: #ffffff;
|
|
22
|
+
--color-error: var(--color-red);
|
|
23
|
+
--color-error-0: var(--color-red-0);
|
|
24
|
+
--color-error-10: var(--color-red-10);
|
|
25
|
+
--color-error-20: var(--color-red-20);
|
|
26
|
+
--color-error-30: var(--color-red-30);
|
|
27
|
+
--color-error-40: var(--color-red-40);
|
|
28
|
+
--color-error-50: var(--color-red-50);
|
|
29
|
+
--color-error-60: var(--color-red-60);
|
|
30
|
+
--color-error-70: var(--color-red-70);
|
|
31
|
+
--color-error-80: var(--color-red-80);
|
|
32
|
+
--color-error-90: var(--color-red-90);
|
|
33
|
+
--color-error-95: var(--color-red-95);
|
|
34
|
+
--color-error-98: var(--color-red-98);
|
|
35
|
+
--color-error-100: var(--color-red-100);
|
|
36
|
+
--color-error-container: #ffdad6;
|
|
37
|
+
--color-green: #2e6f40;
|
|
38
|
+
--color-green-0: #000000;
|
|
39
|
+
--color-green-10: #00210b;
|
|
40
|
+
--color-green-20: #003917;
|
|
41
|
+
--color-green-30: #005225;
|
|
42
|
+
--color-green-40: #0f6d35;
|
|
43
|
+
--color-green-50: #31874b;
|
|
44
|
+
--color-green-60: #4da163;
|
|
45
|
+
--color-green-70: #68bd7b;
|
|
46
|
+
--color-green-80: #83d995;
|
|
47
|
+
--color-green-90: #9ff6af;
|
|
48
|
+
--color-green-95: #c4ffcb;
|
|
49
|
+
--color-green-98: #eaffe9;
|
|
50
|
+
--color-green-100: #ffffff;
|
|
51
|
+
--color-inverse-on-surface: #fbeeec;
|
|
52
|
+
--color-inverse-primary: #aec6ff;
|
|
53
|
+
--color-inverse-surface: #362f2e;
|
|
54
|
+
--color-neutral: #747878;
|
|
55
|
+
--color-neutral-0: #000000;
|
|
56
|
+
--color-neutral-4: #0b0f0f;
|
|
57
|
+
--color-neutral-6: #101415;
|
|
58
|
+
--color-neutral-10: #191c1d;
|
|
59
|
+
--color-neutral-12: #1d2021;
|
|
60
|
+
--color-neutral-17: #272b2b;
|
|
61
|
+
--color-neutral-20: #2e3132;
|
|
62
|
+
--color-neutral-22: #323536;
|
|
63
|
+
--color-neutral-30: #444748;
|
|
64
|
+
--color-neutral-40: #5c5f5f;
|
|
65
|
+
--color-neutral-50: #747878;
|
|
66
|
+
--color-neutral-60: #8e9192;
|
|
67
|
+
--color-neutral-70: #a9acac;
|
|
68
|
+
--color-neutral-80: #c4c7c7;
|
|
69
|
+
--color-neutral-87: #d8dadb;
|
|
70
|
+
--color-neutral-90: #e1e3e3;
|
|
71
|
+
--color-neutral-92: #e6e8e9;
|
|
72
|
+
--color-neutral-94: #eceeef;
|
|
73
|
+
--color-neutral-95: #eff1f1;
|
|
74
|
+
--color-neutral-96: #f2f4f4;
|
|
75
|
+
--color-neutral-98: #f8fafa;
|
|
76
|
+
--color-neutral-99: #fafdfd;
|
|
77
|
+
--color-neutral-100: #ffffff;
|
|
78
|
+
--color-neutral-variant: #6f797a;
|
|
79
|
+
--color-neutral-variant-0: #000000;
|
|
80
|
+
--color-neutral-variant-4: #071011;
|
|
81
|
+
--color-neutral-variant-6: #0c1516;
|
|
82
|
+
--color-neutral-variant-10: #141d1f;
|
|
83
|
+
--color-neutral-variant-12: #182123;
|
|
84
|
+
--color-neutral-variant-17: #222b2d;
|
|
85
|
+
--color-neutral-variant-20: #293234;
|
|
86
|
+
--color-neutral-variant-22: #2d3638;
|
|
87
|
+
--color-neutral-variant-30: #3f484a;
|
|
88
|
+
--color-neutral-variant-40: #576062;
|
|
89
|
+
--color-neutral-variant-50: #6f797a;
|
|
90
|
+
--color-neutral-variant-60: #899294;
|
|
91
|
+
--color-neutral-variant-70: #a3adaf;
|
|
92
|
+
--color-neutral-variant-80: #bfc8ca;
|
|
93
|
+
--color-neutral-variant-87: #d2dcde;
|
|
94
|
+
--color-neutral-variant-90: #dbe4e6;
|
|
95
|
+
--color-neutral-variant-92: #e0eaec;
|
|
96
|
+
--color-neutral-variant-94: #e6f0f1;
|
|
97
|
+
--color-neutral-variant-95: #e9f2f4;
|
|
98
|
+
--color-neutral-variant-96: #ecf5f7;
|
|
99
|
+
--color-neutral-variant-98: #f2fbfd;
|
|
100
|
+
--color-neutral-variant-99: #f6feff;
|
|
101
|
+
--color-neutral-variant-100: #ffffff;
|
|
102
|
+
--color-on-background: #201a19;
|
|
103
|
+
--color-on-error: #ffffff;
|
|
104
|
+
--color-on-error-container: #410002;
|
|
105
|
+
--color-on-primary: #ffffff;
|
|
106
|
+
--color-on-primary-container: #001a42;
|
|
107
|
+
--color-on-secondary: #ffffff;
|
|
108
|
+
--color-on-secondary-container: #141b2c;
|
|
109
|
+
--color-on-surface: var(--color-neutral-10);
|
|
110
|
+
--color-on-surface-variant: var(--color-neutral-30);
|
|
111
|
+
--color-on-tertiary: #ffffff;
|
|
112
|
+
--color-on-tertiary-container: #29132d;
|
|
113
|
+
--color-orange: #ff7518;
|
|
114
|
+
--color-orange-0: #000000;
|
|
115
|
+
--color-orange-10: #341100;
|
|
116
|
+
--color-orange-20: #552100;
|
|
117
|
+
--color-orange-30: #783100;
|
|
118
|
+
--color-orange-40: #9e4300;
|
|
119
|
+
--color-orange-50: #c55500;
|
|
120
|
+
--color-orange-60: #ee6803;
|
|
121
|
+
--color-orange-70: #ff8d4c;
|
|
122
|
+
--color-orange-80: #ffb691;
|
|
123
|
+
--color-orange-90: #ffdbcb;
|
|
124
|
+
--color-orange-95: #ffede6;
|
|
125
|
+
--color-orange-98: #fff8f6;
|
|
126
|
+
--color-orange-100: #ffffff;
|
|
127
|
+
--color-outline: var(--color-neutral-variant-50);
|
|
128
|
+
--color-outline-variant: var(--color-neutral-variant-80);
|
|
129
|
+
--color-primary: #4589ff;
|
|
130
|
+
--color-primary-0: #000000;
|
|
131
|
+
--color-primary-10: #001a42;
|
|
132
|
+
--color-primary-20: #002e6b;
|
|
133
|
+
--color-primary-30: #004396;
|
|
134
|
+
--color-primary-40: #005ac4;
|
|
135
|
+
--color-primary-50: #2673e8;
|
|
136
|
+
--color-primary-60: #4f8eff;
|
|
137
|
+
--color-primary-70: #82aaff;
|
|
138
|
+
--color-primary-80: #aec6ff;
|
|
139
|
+
--color-primary-90: #d8e2ff;
|
|
140
|
+
--color-primary-95: #edf0ff;
|
|
141
|
+
--color-primary-98: #faf9ff;
|
|
142
|
+
--color-primary-100: #ffffff;
|
|
143
|
+
--color-primary-container: #d8e2ff;
|
|
144
|
+
--color-purple: #e40078;
|
|
145
|
+
--color-purple-0: #000000;
|
|
146
|
+
--color-purple-10: #3f001c;
|
|
147
|
+
--color-purple-20: #650032;
|
|
148
|
+
--color-purple-30: #8e0048;
|
|
149
|
+
--color-purple-40: #ba0061;
|
|
150
|
+
--color-purple-50: #e6067a;
|
|
151
|
+
--color-purple-60: #ff4993;
|
|
152
|
+
--color-purple-70: #ff84ad;
|
|
153
|
+
--color-purple-80: #ffb1c7;
|
|
154
|
+
--color-purple-90: #ffd9e2;
|
|
155
|
+
--color-purple-95: #ffecef;
|
|
156
|
+
--color-purple-98: #fff8f8;
|
|
157
|
+
--color-purple-100: #ffffff;
|
|
158
|
+
--color-red: #e73121;
|
|
159
|
+
--color-red-0: #000000;
|
|
160
|
+
--color-red-10: #410000;
|
|
161
|
+
--color-red-20: #690000;
|
|
162
|
+
--color-red-30: #930000;
|
|
163
|
+
--color-red-40: #be0c05;
|
|
164
|
+
--color-red-50: #e32e1f;
|
|
165
|
+
--color-red-60: #ff5541;
|
|
166
|
+
--color-red-70: #ff8a78;
|
|
167
|
+
--color-red-80: #ffb4a8;
|
|
168
|
+
--color-red-90: #ffdad4;
|
|
169
|
+
--color-red-95: #ffedea;
|
|
170
|
+
--color-red-98: #fff8f6;
|
|
171
|
+
--color-red-100: #ffffff;
|
|
172
|
+
--color-scrim: #000000;
|
|
173
|
+
--color-secondary: #6f778b;
|
|
174
|
+
--color-secondary-0: #000000;
|
|
175
|
+
--color-secondary-10: #141b2c;
|
|
176
|
+
--color-secondary-20: #293041;
|
|
177
|
+
--color-secondary-30: #3f4759;
|
|
178
|
+
--color-secondary-40: #575e71;
|
|
179
|
+
--color-secondary-50: #6f778b;
|
|
180
|
+
--color-secondary-60: #8990a5;
|
|
181
|
+
--color-secondary-70: #a4abc0;
|
|
182
|
+
--color-secondary-80: #bfc6dc;
|
|
183
|
+
--color-secondary-90: #dbe2f9;
|
|
184
|
+
--color-secondary-95: #edf0ff;
|
|
185
|
+
--color-secondary-98: #faf9ff;
|
|
186
|
+
--color-secondary-100: #ffffff;
|
|
187
|
+
--color-secondary-container: #dbe2f9;
|
|
188
|
+
--color-shadow: #000000;
|
|
189
|
+
--color-success: var(--color-green);
|
|
190
|
+
--color-success-0: var(--color-green-0);
|
|
191
|
+
--color-success-10: var(--color-green-10);
|
|
192
|
+
--color-success-20: var(--color-green-20);
|
|
193
|
+
--color-success-30: var(--color-green-30);
|
|
194
|
+
--color-success-40: var(--color-green-40);
|
|
195
|
+
--color-success-50: var(--color-green-50);
|
|
196
|
+
--color-success-60: var(--color-green-60);
|
|
197
|
+
--color-success-70: var(--color-green-70);
|
|
198
|
+
--color-success-80: var(--color-green-80);
|
|
199
|
+
--color-success-90: var(--color-green-90);
|
|
200
|
+
--color-success-95: var(--color-green-95);
|
|
201
|
+
--color-success-98: var(--color-green-98);
|
|
202
|
+
--color-success-100: var(--color-green-100);
|
|
203
|
+
--color-surface: var(--color-neutral-98);
|
|
204
|
+
--color-surface-container: var(--color-neutral-94);
|
|
205
|
+
--color-surface-container-high: var(--color-neutral-92);
|
|
206
|
+
--color-surface-container-highest: var(--color-neutral-90);
|
|
207
|
+
--color-surface-container-low: var(--color-neutral-96);
|
|
208
|
+
--color-surface-container-lowest: var(--color-neutral-100);
|
|
209
|
+
--color-surface-dim: var(--color-neutral-87);
|
|
210
|
+
--color-surface-variant: var(--color-neutral-90);
|
|
211
|
+
--color-tertiary: #8b6d8d;
|
|
212
|
+
--color-tertiary-0: #000000;
|
|
213
|
+
--color-tertiary-10: #29132d;
|
|
214
|
+
--color-tertiary-20: #402843;
|
|
215
|
+
--color-tertiary-30: #583e5a;
|
|
216
|
+
--color-tertiary-40: #715573;
|
|
217
|
+
--color-tertiary-50: #8b6d8d;
|
|
218
|
+
--color-tertiary-60: #a686a7;
|
|
219
|
+
--color-tertiary-70: #c2a1c2;
|
|
220
|
+
--color-tertiary-80: #dfbcdf;
|
|
221
|
+
--color-tertiary-90: #fcd7fb;
|
|
222
|
+
--color-tertiary-95: #ffebfc;
|
|
223
|
+
--color-tertiary-98: #fff7fa;
|
|
224
|
+
--color-tertiary-100: #ffffff;
|
|
225
|
+
--color-tertiary-container: #fcd7fb;
|
|
226
|
+
--color-warning: var(--color-yellow);
|
|
227
|
+
--color-warning-0: var(--color-yellow-0);
|
|
228
|
+
--color-warning-10: var(--color-yellow-10);
|
|
229
|
+
--color-warning-20: var(--color-yellow-20);
|
|
230
|
+
--color-warning-30: var(--color-yellow-30);
|
|
231
|
+
--color-warning-40: var(--color-yellow-40);
|
|
232
|
+
--color-warning-50: var(--color-yellow-50);
|
|
233
|
+
--color-warning-60: var(--color-yellow-60);
|
|
234
|
+
--color-warning-70: var(--color-yellow-70);
|
|
235
|
+
--color-warning-80: var(--color-yellow-80);
|
|
236
|
+
--color-warning-90: var(--color-yellow-90);
|
|
237
|
+
--color-warning-95: var(--color-yellow-95);
|
|
238
|
+
--color-warning-98: var(--color-yellow-98);
|
|
239
|
+
--color-warning-100: var(--color-yellow-100);
|
|
240
|
+
--color-white: #ffffff;
|
|
241
|
+
--color-yellow: #ffed29;
|
|
242
|
+
--color-yellow-0: #000000;
|
|
243
|
+
--color-yellow-10: #1f1c00;
|
|
244
|
+
--color-yellow-20: #363100;
|
|
245
|
+
--color-yellow-30: #4e4800;
|
|
246
|
+
--color-yellow-40: #686000;
|
|
247
|
+
--color-yellow-50: #837900;
|
|
248
|
+
--color-yellow-60: #9f9300;
|
|
249
|
+
--color-yellow-70: #bcae00;
|
|
250
|
+
--color-yellow-80: #d9c900;
|
|
251
|
+
--color-yellow-90: #f7e61e;
|
|
252
|
+
--color-yellow-95: #fff392;
|
|
253
|
+
--color-yellow-98: #fff9e6;
|
|
254
|
+
--color-yellow-100: #ffffff;
|
|
255
|
+
--container-lg: 1056px; /* Large container width. Intended for standard desktop layouts with typical content density. */
|
|
256
|
+
--container-max: 1584px; /* Maximum container width. Use when constraining very wide layouts to maintain readable line lengths. */
|
|
257
|
+
--container-md: 672px; /* Medium container width. Suitable for tablet layouts and compact desktop content areas. */
|
|
258
|
+
--container-sm: 320px; /* Small container width. Use for narrow layouts and small screens such as mobile devices. */
|
|
259
|
+
--container-xl: 1312px; /* Extra large container width. Use for wide desktop displays and content-heavy pages. */
|
|
260
|
+
--duration-long1: 450ms; /* These durations are often paired with Emphasized easing. */
|
|
261
|
+
--duration-long2: 500ms; /* These durations are often paired with Emphasized easing. */
|
|
262
|
+
--duration-medium1: 250ms; /* These are used for medium duration transitions, like modal animations. */
|
|
263
|
+
--duration-medium2: 300ms; /* These are used for medium duration transitions, like modal animations. */
|
|
264
|
+
--duration-short1: 50ms; /* These are used for small utility-focused transitions. Like checkbox animations. */
|
|
265
|
+
--duration-short2: 100ms; /* These are used for small utility-focused transitions. Like checkbox animations. */
|
|
266
|
+
--duration-short3: 150ms; /* These are used for small utility-focused transitions. Like checkbox animations. */
|
|
267
|
+
--duration-short4: 200ms; /* These are used for small utility-focused transitions. Like checkbox animations. */
|
|
268
|
+
--easing-linear: cubic-bezier(0, 0, 1, 1);
|
|
269
|
+
--easing-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
270
|
+
--font-family-brand: "Noto Sans", sans-serif; /* The font family used for brand headings and titles. */
|
|
271
|
+
--font-family-monospace: "Noto Sans Mono", monospace; /* The font family used for code snippets and monospaced text. */
|
|
272
|
+
--font-family-sans: "Noto Sans", sans-serif; /* The primary font family used for body text and general content. */
|
|
273
|
+
--font-weight-bold: 700; /* Bold weight for emphasis. 700 weight. */
|
|
274
|
+
--font-weight-medium: 500; /* Slightly heavier than regular weight. 500 weight. */
|
|
275
|
+
--font-weight-regular: 400; /* Standard weight for regular text. 400 weight. */
|
|
276
|
+
--font-weight-semi-bold: 600; /* Heavier than medium weight. 600 weight. */
|
|
277
|
+
--global-badge-color: var(--color-error-40);
|
|
278
|
+
--spacing-000: 0; /* No spacing (base × 0). */
|
|
279
|
+
--spacing-025: 0.125rem; /* 2px - Smallest increment (base × 0.125). */
|
|
280
|
+
--spacing-050: 0.25rem; /* 4px - Extra small spacing (base × 0.25). */
|
|
281
|
+
--spacing-100: 0.5rem; /* 8px - Small spacing (base × 0.5). */
|
|
282
|
+
--spacing-150: 0.75rem; /* 12px - Small-medium spacing (base × 0.75). */
|
|
283
|
+
--spacing-200: 1rem; /* 16px - Base spacing unit (base × 1). */
|
|
284
|
+
--spacing-300: 1.5rem; /* 24px - Medium spacing (base × 1.5). */
|
|
285
|
+
--spacing-400: 2rem; /* 32px - Medium-large spacing (base × 2). */
|
|
286
|
+
--spacing-500: 2.5rem; /* 40px - Large spacing (base × 2.5). */
|
|
287
|
+
--spacing-600: 3rem; /* 48px - Extra large spacing (base × 3). */
|
|
288
|
+
--spacing-800: 4rem; /* 64px - Huge spacing (base × 4). */
|
|
289
|
+
--spacing-1000: 5rem; /* 80px - Massive spacing (base × 5). */
|
|
290
|
+
--spacing-1200: 6rem; /* 96px - Gigantic spacing (base × 6). */
|
|
291
|
+
--spacing-2000: 10rem; /* 160px - Maximum defined spacing (base × 10). */
|
|
292
|
+
--spacing-base: 1rem; /* Base spacing unit (1rem = 16px). */
|
|
293
|
+
--typography-body-large-emphasized-font-family: var(--font-family-sans);
|
|
294
|
+
--typography-body-large-emphasized-font-size: 1rem;
|
|
295
|
+
--typography-body-large-emphasized-font-weight: var(--font-weight-medium);
|
|
296
|
+
--typography-body-large-emphasized-letter-spacing: 0.5px;
|
|
297
|
+
--typography-body-large-emphasized-line-height: 1.5rem;
|
|
298
|
+
--typography-body-large-font-family: var(--font-family-sans);
|
|
299
|
+
--typography-body-large-font-size: 1rem;
|
|
300
|
+
--typography-body-large-font-weight: var(--font-weight-regular);
|
|
301
|
+
--typography-body-large-letter-spacing: 0.5px;
|
|
302
|
+
--typography-body-large-line-height: 1.5rem;
|
|
303
|
+
--typography-body-medium-emphasized-font-family: var(--font-family-sans);
|
|
304
|
+
--typography-body-medium-emphasized-font-size: 0.875rem;
|
|
305
|
+
--typography-body-medium-emphasized-font-weight: var(--font-weight-medium);
|
|
306
|
+
--typography-body-medium-emphasized-letter-spacing: 0.25px;
|
|
307
|
+
--typography-body-medium-emphasized-line-height: 1.25rem;
|
|
308
|
+
--typography-body-medium-font-family: var(--font-family-sans);
|
|
309
|
+
--typography-body-medium-font-size: 0.875rem;
|
|
310
|
+
--typography-body-medium-font-weight: var(--font-weight-regular);
|
|
311
|
+
--typography-body-medium-letter-spacing: 0.25px;
|
|
312
|
+
--typography-body-medium-line-height: 1.25rem;
|
|
313
|
+
--typography-body-small-emphasized-font-family: var(--font-family-sans);
|
|
314
|
+
--typography-body-small-emphasized-font-size: 0.75rem;
|
|
315
|
+
--typography-body-small-emphasized-font-weight: var(--font-weight-medium);
|
|
316
|
+
--typography-body-small-emphasized-letter-spacing: 0.4000000059604645px;
|
|
317
|
+
--typography-body-small-emphasized-line-height: 1rem;
|
|
318
|
+
--typography-body-small-font-family: var(--font-family-sans);
|
|
319
|
+
--typography-body-small-font-size: 0.75rem;
|
|
320
|
+
--typography-body-small-font-weight: var(--font-weight-regular);
|
|
321
|
+
--typography-body-small-letter-spacing: 0.4000000059604645px;
|
|
322
|
+
--typography-body-small-line-height: 1rem;
|
|
323
|
+
--typography-code-large-emphasized-font-family: var(--font-family-monospace);
|
|
324
|
+
--typography-code-large-emphasized-font-size: 1rem;
|
|
325
|
+
--typography-code-large-emphasized-font-weight: var(--font-weight-medium);
|
|
326
|
+
--typography-code-large-emphasized-letter-spacing: 0.5px;
|
|
327
|
+
--typography-code-large-emphasized-line-height: 1.5rem;
|
|
328
|
+
--typography-code-large-font-family: var(--font-family-monospace);
|
|
329
|
+
--typography-code-large-font-size: 1rem;
|
|
330
|
+
--typography-code-large-font-weight: var(--font-weight-regular);
|
|
331
|
+
--typography-code-large-letter-spacing: 0.5px;
|
|
332
|
+
--typography-code-large-line-height: 1.5rem;
|
|
333
|
+
--typography-code-medium-emphasized-font-family: var(--font-family-monospace);
|
|
334
|
+
--typography-code-medium-emphasized-font-size: 0.875rem;
|
|
335
|
+
--typography-code-medium-emphasized-font-weight: var(--font-weight-medium);
|
|
336
|
+
--typography-code-medium-emphasized-letter-spacing: 0.25px;
|
|
337
|
+
--typography-code-medium-emphasized-line-height: 1.25rem;
|
|
338
|
+
--typography-code-medium-font-family: var(--font-family-monospace);
|
|
339
|
+
--typography-code-medium-font-size: 0.875rem;
|
|
340
|
+
--typography-code-medium-font-weight: var(--font-weight-regular);
|
|
341
|
+
--typography-code-medium-letter-spacing: 0.25px;
|
|
342
|
+
--typography-code-medium-line-height: 1.25rem;
|
|
343
|
+
--typography-code-small-emphasized-font-family: var(--font-family-monospace);
|
|
344
|
+
--typography-code-small-emphasized-font-size: 0.75rem;
|
|
345
|
+
--typography-code-small-emphasized-font-weight: var(--font-weight-medium);
|
|
346
|
+
--typography-code-small-emphasized-letter-spacing: 0.4000000059604645px;
|
|
347
|
+
--typography-code-small-emphasized-line-height: 1rem;
|
|
348
|
+
--typography-code-small-font-family: var(--font-family-monospace);
|
|
349
|
+
--typography-code-small-font-size: 0.75rem;
|
|
350
|
+
--typography-code-small-font-weight: var(--font-weight-regular);
|
|
351
|
+
--typography-code-small-letter-spacing: 0.4000000059604645px;
|
|
352
|
+
--typography-code-small-line-height: 1rem;
|
|
353
|
+
--typography-display-large-emphasized-font-family: var(--font-family-sans);
|
|
354
|
+
--typography-display-large-emphasized-font-size: 3.5625rem;
|
|
355
|
+
--typography-display-large-emphasized-font-weight: var(--font-weight-medium);
|
|
356
|
+
--typography-display-large-emphasized-letter-spacing: -0.25px;
|
|
357
|
+
--typography-display-large-emphasized-line-height: 4rem;
|
|
358
|
+
--typography-display-large-font-family: var(--font-family-sans);
|
|
359
|
+
--typography-display-large-font-size: 3.5625rem;
|
|
360
|
+
--typography-display-large-font-weight: var(--font-weight-regular);
|
|
361
|
+
--typography-display-large-letter-spacing: -0.25px;
|
|
362
|
+
--typography-display-large-line-height: 4rem;
|
|
363
|
+
--typography-display-medium-emphasized-font-family: var(--font-family-sans);
|
|
364
|
+
--typography-display-medium-emphasized-font-size: 2.8125rem;
|
|
365
|
+
--typography-display-medium-emphasized-font-weight: var(--font-weight-medium);
|
|
366
|
+
--typography-display-medium-emphasized-letter-spacing: 0;
|
|
367
|
+
--typography-display-medium-emphasized-line-height: 3.25rem;
|
|
368
|
+
--typography-display-medium-font-family: var(--font-family-sans);
|
|
369
|
+
--typography-display-medium-font-size: 2.8125rem;
|
|
370
|
+
--typography-display-medium-font-weight: var(--font-weight-regular);
|
|
371
|
+
--typography-display-medium-letter-spacing: 0;
|
|
372
|
+
--typography-display-medium-line-height: 3.25rem;
|
|
373
|
+
--typography-display-small-emphasized-font-family: var(--font-family-sans);
|
|
374
|
+
--typography-display-small-emphasized-font-size: 2.25rem;
|
|
375
|
+
--typography-display-small-emphasized-font-weight: var(--font-weight-medium);
|
|
376
|
+
--typography-display-small-emphasized-letter-spacing: 0;
|
|
377
|
+
--typography-display-small-emphasized-line-height: 2.75rem;
|
|
378
|
+
--typography-display-small-font-family: var(--font-family-sans);
|
|
379
|
+
--typography-display-small-font-size: 2.25rem;
|
|
380
|
+
--typography-display-small-font-weight: var(--font-weight-regular);
|
|
381
|
+
--typography-display-small-letter-spacing: 0;
|
|
382
|
+
--typography-display-small-line-height: 2.75rem;
|
|
383
|
+
--typography-headline-large-emphasized-font-family: var(--font-family-sans);
|
|
384
|
+
--typography-headline-large-emphasized-font-size: 2rem;
|
|
385
|
+
--typography-headline-large-emphasized-font-weight: var(--font-weight-medium);
|
|
386
|
+
--typography-headline-large-emphasized-letter-spacing: 0;
|
|
387
|
+
--typography-headline-large-emphasized-line-height: 2.5rem;
|
|
388
|
+
--typography-headline-large-font-family: var(--font-family-sans);
|
|
389
|
+
--typography-headline-large-font-size: 2rem;
|
|
390
|
+
--typography-headline-large-font-weight: var(--font-weight-regular);
|
|
391
|
+
--typography-headline-large-letter-spacing: 0;
|
|
392
|
+
--typography-headline-large-line-height: 2.5rem;
|
|
393
|
+
--typography-headline-medium-emphasized-font-family: var(--font-family-sans);
|
|
394
|
+
--typography-headline-medium-emphasized-font-size: 1.75rem;
|
|
395
|
+
--typography-headline-medium-emphasized-font-weight: var(--font-weight-medium);
|
|
396
|
+
--typography-headline-medium-emphasized-letter-spacing: 0;
|
|
397
|
+
--typography-headline-medium-emphasized-line-height: 2.25rem;
|
|
398
|
+
--typography-headline-medium-font-family: var(--font-family-sans);
|
|
399
|
+
--typography-headline-medium-font-size: 1.75rem;
|
|
400
|
+
--typography-headline-medium-font-weight: var(--font-weight-regular);
|
|
401
|
+
--typography-headline-medium-letter-spacing: 0;
|
|
402
|
+
--typography-headline-medium-line-height: 2.25rem;
|
|
403
|
+
--typography-headline-small-emphasized-font-family: var(--font-family-sans);
|
|
404
|
+
--typography-headline-small-emphasized-font-size: 1.5rem;
|
|
405
|
+
--typography-headline-small-emphasized-font-weight: var(--font-weight-medium);
|
|
406
|
+
--typography-headline-small-emphasized-letter-spacing: 0;
|
|
407
|
+
--typography-headline-small-emphasized-line-height: 2rem;
|
|
408
|
+
--typography-headline-small-font-family: var(--font-family-sans);
|
|
409
|
+
--typography-headline-small-font-size: 1.5rem;
|
|
410
|
+
--typography-headline-small-font-weight: var(--font-weight-regular);
|
|
411
|
+
--typography-headline-small-letter-spacing: 0;
|
|
412
|
+
--typography-headline-small-line-height: 2rem;
|
|
413
|
+
--typography-label-large-emphasized-font-family: var(--font-family-sans);
|
|
414
|
+
--typography-label-large-emphasized-font-size: 0.875rem;
|
|
415
|
+
--typography-label-large-emphasized-font-weight: var(--font-weight-semi-bold);
|
|
416
|
+
--typography-label-large-emphasized-letter-spacing: 0.10000000149011612px;
|
|
417
|
+
--typography-label-large-emphasized-line-height: 1.25rem;
|
|
418
|
+
--typography-label-large-font-family: var(--font-family-sans);
|
|
419
|
+
--typography-label-large-font-size: 0.875rem;
|
|
420
|
+
--typography-label-large-font-weight: var(--font-weight-medium);
|
|
421
|
+
--typography-label-large-letter-spacing: 0.10000000149011612px;
|
|
422
|
+
--typography-label-large-line-height: 1.25rem;
|
|
423
|
+
--typography-label-medium-emphasized-font-family: var(--font-family-sans);
|
|
424
|
+
--typography-label-medium-emphasized-font-size: 0.75rem;
|
|
425
|
+
--typography-label-medium-emphasized-font-weight: var(--font-weight-semi-bold);
|
|
426
|
+
--typography-label-medium-emphasized-letter-spacing: 0.5px;
|
|
427
|
+
--typography-label-medium-emphasized-line-height: 1rem;
|
|
428
|
+
--typography-label-medium-font-family: var(--font-family-sans);
|
|
429
|
+
--typography-label-medium-font-size: 0.75rem;
|
|
430
|
+
--typography-label-medium-font-weight: var(--font-weight-medium);
|
|
431
|
+
--typography-label-medium-letter-spacing: 0.5px;
|
|
432
|
+
--typography-label-medium-line-height: 1rem;
|
|
433
|
+
--typography-label-small-emphasized-font-family: var(--font-family-sans);
|
|
434
|
+
--typography-label-small-emphasized-font-size: 0.6875rem;
|
|
435
|
+
--typography-label-small-emphasized-font-weight: var(--font-weight-semi-bold);
|
|
436
|
+
--typography-label-small-emphasized-letter-spacing: 0.5px;
|
|
437
|
+
--typography-label-small-emphasized-line-height: 1rem;
|
|
438
|
+
--typography-label-small-font-family: var(--font-family-sans);
|
|
439
|
+
--typography-label-small-font-size: 0.6875rem;
|
|
440
|
+
--typography-label-small-font-weight: var(--font-weight-medium);
|
|
441
|
+
--typography-label-small-letter-spacing: 0.5px;
|
|
442
|
+
--typography-label-small-line-height: 1rem;
|
|
443
|
+
--typography-title-large-emphasized-font-family: var(--font-family-sans);
|
|
444
|
+
--typography-title-large-emphasized-font-size: 1.375rem;
|
|
445
|
+
--typography-title-large-emphasized-font-weight: var(--font-weight-medium);
|
|
446
|
+
--typography-title-large-emphasized-letter-spacing: 0;
|
|
447
|
+
--typography-title-large-emphasized-line-height: 1.75rem;
|
|
448
|
+
--typography-title-large-font-family: var(--font-family-sans);
|
|
449
|
+
--typography-title-large-font-size: 1.375rem;
|
|
450
|
+
--typography-title-large-font-weight: var(--font-weight-regular);
|
|
451
|
+
--typography-title-large-letter-spacing: 0;
|
|
452
|
+
--typography-title-large-line-height: 1.75rem;
|
|
453
|
+
--typography-title-medium-emphasized-font-family: var(--font-family-sans);
|
|
454
|
+
--typography-title-medium-emphasized-font-size: 1rem;
|
|
455
|
+
--typography-title-medium-emphasized-font-weight: var(--font-weight-semi-bold);
|
|
456
|
+
--typography-title-medium-emphasized-letter-spacing: 0.15000000596046448px;
|
|
457
|
+
--typography-title-medium-emphasized-line-height: 1.5rem;
|
|
458
|
+
--typography-title-medium-font-family: var(--font-family-sans);
|
|
459
|
+
--typography-title-medium-font-size: 1rem;
|
|
460
|
+
--typography-title-medium-font-weight: var(--font-weight-medium);
|
|
461
|
+
--typography-title-medium-letter-spacing: 0.15000000596046448px;
|
|
462
|
+
--typography-title-medium-line-height: 1.5rem;
|
|
463
|
+
--typography-title-small-emphasized-font-family: var(--font-family-sans);
|
|
464
|
+
--typography-title-small-emphasized-font-size: 0.875rem;
|
|
465
|
+
--typography-title-small-emphasized-font-weight: var(--font-weight-semi-bold);
|
|
466
|
+
--typography-title-small-emphasized-letter-spacing: 0.10000000149011612px;
|
|
467
|
+
--typography-title-small-emphasized-line-height: 1.25rem;
|
|
468
|
+
--typography-title-small-font-family: var(--font-family-sans);
|
|
469
|
+
--typography-title-small-font-size: 0.875rem;
|
|
470
|
+
--typography-title-small-font-weight: var(--font-weight-medium);
|
|
471
|
+
--typography-title-small-letter-spacing: 0.10000000149011612px;
|
|
472
|
+
--typography-title-small-line-height: 1.25rem;
|
|
473
|
+
color-scheme: light dark;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
[data-theme='dark'] {
|
|
477
|
+
--color-background: #201a19;
|
|
478
|
+
--color-error-container: #93000a;
|
|
479
|
+
--color-inverse-on-surface: #362f2e;
|
|
480
|
+
--color-inverse-primary: #005ac4;
|
|
481
|
+
--color-inverse-surface: #ede0dd;
|
|
482
|
+
--color-on-background: #ede0dd;
|
|
483
|
+
--color-on-error: #690005;
|
|
484
|
+
--color-on-error-container: #ffb4ab;
|
|
485
|
+
--color-on-primary: #002e6b;
|
|
486
|
+
--color-on-primary-container: #d8e2ff;
|
|
487
|
+
--color-on-secondary: #293041;
|
|
488
|
+
--color-on-secondary-container: #dbe2f9;
|
|
489
|
+
--color-on-surface: #ede0dd;
|
|
490
|
+
--color-on-surface-variant: #d8c2be;
|
|
491
|
+
--color-on-tertiary: #402843;
|
|
492
|
+
--color-on-tertiary-container: #fcd7fb;
|
|
493
|
+
--color-outline: var(--color-neutral-variant-60);
|
|
494
|
+
--color-outline-variant: var(--color-neutral-variant-30);
|
|
495
|
+
--color-primary-container: #004396;
|
|
496
|
+
--color-scrim: #000000;
|
|
497
|
+
--color-secondary-container: #3f4759;
|
|
498
|
+
--color-shadow: #000000;
|
|
499
|
+
--color-surface: #201a19;
|
|
500
|
+
--color-surface-container: var(--color-neutral-12);
|
|
501
|
+
--color-surface-container-high: var(--color-neutral-17);
|
|
502
|
+
--color-surface-container-highest: var(--color-neutral-22);
|
|
503
|
+
--color-surface-container-low: var(--color-neutral-10);
|
|
504
|
+
--color-surface-container-lowest: var(--color-neutral-4);
|
|
505
|
+
--color-surface-dim: var(--color-neutral-6);
|
|
506
|
+
--color-surface-variant: #534341;
|
|
507
|
+
--color-tertiary-container: #583e5a;
|
|
508
|
+
--global-badge-color: var(--color-error-80);
|
|
509
|
+
}
|
|
510
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface ComponentConfig {
|
|
2
|
+
CustomElementClass?: any;
|
|
3
|
+
importPath?: string;
|
|
4
|
+
dependencies?: string[];
|
|
5
|
+
}
|
|
6
|
+
interface LoaderConfig {
|
|
7
|
+
prefix?: string;
|
|
8
|
+
components?: Record<string, ComponentConfig>;
|
|
9
|
+
}
|
|
10
|
+
export { LoaderConfig };
|
|
11
|
+
export declare class LoaderUtils {
|
|
12
|
+
private loaderConfig;
|
|
13
|
+
private _loaderConfig;
|
|
14
|
+
private _observer;
|
|
15
|
+
constructor(loaderConfig: LoaderConfig);
|
|
16
|
+
static registerComponent(tagName: string, CustomElementClass: any): void;
|
|
17
|
+
start(): void;
|
|
18
|
+
eagerLoadComponents(): void;
|
|
19
|
+
getFullTagName(name: string): string;
|
|
20
|
+
registerAsync(tagName: string): Promise<void>;
|
|
21
|
+
load(root: Element | Document): Promise<void>;
|
|
22
|
+
lazyLoadComponents(root: any): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export class LoaderUtils {
|
|
2
|
+
constructor(loaderConfig) {
|
|
3
|
+
this.loaderConfig = loaderConfig;
|
|
4
|
+
this._loaderConfig = loaderConfig;
|
|
5
|
+
}
|
|
6
|
+
static registerComponent(tagName, CustomElementClass) {
|
|
7
|
+
if (CustomElementClass && !customElements.get(tagName)) {
|
|
8
|
+
customElements.define(tagName, CustomElementClass);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
start() {
|
|
12
|
+
this.eagerLoadComponents();
|
|
13
|
+
this.lazyLoadComponents(document);
|
|
14
|
+
}
|
|
15
|
+
eagerLoadComponents() {
|
|
16
|
+
if (!this._loaderConfig.components)
|
|
17
|
+
return;
|
|
18
|
+
for (const [name, value] of Object.entries(this._loaderConfig.components)) {
|
|
19
|
+
if (value.CustomElementClass)
|
|
20
|
+
LoaderUtils.registerComponent(this.getFullTagName(name), value.CustomElementClass);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getFullTagName(name) {
|
|
24
|
+
return `${this._loaderConfig.prefix}-${name}`;
|
|
25
|
+
}
|
|
26
|
+
async registerAsync(tagName) {
|
|
27
|
+
if (customElements.get(tagName))
|
|
28
|
+
return;
|
|
29
|
+
const baseName = tagName.replace(`${this._loaderConfig.prefix}-`, '');
|
|
30
|
+
if (!this._loaderConfig.components)
|
|
31
|
+
return;
|
|
32
|
+
const config = this._loaderConfig.components[baseName];
|
|
33
|
+
if (!config || !config.importPath)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
const module = await import(config.importPath);
|
|
37
|
+
// Runtime definition: grabbing the class from the module
|
|
38
|
+
const CustomElementClass = module.default || module[Object.keys(module)[0]];
|
|
39
|
+
if (CustomElementClass && !customElements.get(tagName)) {
|
|
40
|
+
customElements.define(tagName, CustomElementClass);
|
|
41
|
+
}
|
|
42
|
+
// Handle dependencies recursively
|
|
43
|
+
if (config.dependencies) {
|
|
44
|
+
for (const dep of config.dependencies) {
|
|
45
|
+
// eslint-disable-next-line no-await-in-loop
|
|
46
|
+
await this.registerAsync(this.getFullTagName(dep));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(`Unable to load <${tagName}> from ${config.importPath}`, error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async load(root) {
|
|
55
|
+
const rootTagName = root instanceof Element ? root.tagName.toLowerCase() : '';
|
|
56
|
+
const tags = Array.from(root.querySelectorAll(':not(:defined)')).map(el => el.tagName.toLowerCase());
|
|
57
|
+
if (rootTagName.includes('-') && !customElements.get(rootTagName)) {
|
|
58
|
+
tags.push(rootTagName);
|
|
59
|
+
}
|
|
60
|
+
const tagsToRegister = [...new Set(tags)];
|
|
61
|
+
await Promise.allSettled(tagsToRegister.map(tagName => this.registerAsync(tagName)));
|
|
62
|
+
}
|
|
63
|
+
lazyLoadComponents(root) {
|
|
64
|
+
this._observer = new MutationObserver(mutations => {
|
|
65
|
+
for (const { addedNodes } of mutations) {
|
|
66
|
+
for (const node of addedNodes) {
|
|
67
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
68
|
+
this.load(node);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const target = root instanceof Document ? root.documentElement : root;
|
|
74
|
+
this.load(target);
|
|
75
|
+
this._observer.observe(target, {
|
|
76
|
+
subtree: true,
|
|
77
|
+
childList: true,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=LoaderUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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azy load\n dependencies?: string[];\n}\n\ninterface LoaderConfig {\n prefix?: string;\n components?: Record<string, ComponentConfig>;\n}\n\nexport { LoaderConfig };\n\nexport class LoaderUtils {\n private _loaderConfig: LoaderConfig;\n private _observer: MutationObserver | undefined;\n\n constructor(private loaderConfig: LoaderConfig) {\n this._loaderConfig = loaderConfig;\n }\n\n static registerComponent(tagName: string, CustomElementClass: any) {\n if (CustomElementClass && !customElements.get(tagName)) {\n customElements.define(tagName, CustomElementClass);\n }\n }\n\n start() {\n this.eagerLoadComponents();\n this.lazyLoadComponents(document);\n }\n\n eagerLoadComponents() {\n if (!this._loaderConfig.components) return;\n for (const [name, value] of Object.entries(this._loaderConfig.components)) {\n if (value.CustomElementClass)\n LoaderUtils.registerComponent(\n this.getFullTagName(name),\n value.CustomElementClass,\n );\n }\n }\n\n getFullTagName(name: string) {\n return `${this._loaderConfig.prefix}-${name}`;\n }\n\n async registerAsync(tagName: string): Promise<void> {\n if (customElements.get(tagName)) return;\n\n const baseName = tagName.replace(`${this._loaderConfig.prefix}-`, '');\n\n if (!this._loaderConfig.components) return;\n\n const config = this._loaderConfig.components[baseName];\n if (!config || !config.importPath) return;\n\n try {\n const module = await import(config.importPath);\n\n // Runtime definition: grabbing the class from the module\n const CustomElementClass =\n module.default || module[Object.keys(module)[0]];\n\n if (CustomElementClass && !customElements.get(tagName)) {\n customElements.define(tagName, CustomElementClass);\n }\n\n // Handle dependencies recursively\n if (config.dependencies) {\n for (const dep of config.dependencies) {\n // eslint-disable-next-line no-await-in-loop\n await this.registerAsync(this.getFullTagName(dep));\n }\n }\n } catch (error) {\n console.error(\n `Unable to load <${tagName}> from ${config.importPath}`,\n error,\n );\n }\n }\n\n async load(root: Element | Document): Promise<void> {\n const rootTagName =\n root instanceof Element ? root.tagName.toLowerCase() : '';\n\n const tags = Array.from(root.querySelectorAll(':not(:defined)')).map(el =>\n el.tagName.toLowerCase(),\n );\n\n if (rootTagName.includes('-') && !customElements.get(rootTagName)) {\n tags.push(rootTagName);\n }\n\n const tagsToRegister = [...new Set(tags)];\n await Promise.allSettled(\n tagsToRegister.map(tagName => this.registerAsync(tagName)),\n );\n }\n\n lazyLoadComponents(root: any) {\n this._observer = new MutationObserver(mutations => {\n for (const { addedNodes } of mutations) {\n for (const node of addedNodes) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.load(node as Element);\n }\n }\n }\n });\n\n const target = root instanceof Document ? root.documentElement : root;\n this.load(target);\n\n this._observer.observe(target, {\n subtree: true,\n childList: true,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { getTypography } from '../utils.js';
|
|
3
|
+
export const styles = css `
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
--avatar-size: 2rem;
|
|
8
|
+
--avatar-background-color: var(--color-primary);
|
|
9
|
+
--avatar-text-color: var(--color-on-primary);
|
|
10
|
+
--avatar-border-radius: var(--global-avatar-border-radius);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.avatar-container {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--spacing-050);
|
|
17
|
+
line-height: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.avatar {
|
|
21
|
+
border-radius: var(--avatar-border-radius);
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
color: var(--avatar-text-color);
|
|
26
|
+
width: var(--avatar-size);
|
|
27
|
+
height: var(--avatar-size);
|
|
28
|
+
${unsafeCSS(getTypography('body-large-emphasized'))}
|
|
29
|
+
background-color: var(--avatar-background-color);
|
|
30
|
+
|
|
31
|
+
font-size: calc(var(--avatar-size) * 0.4);
|
|
32
|
+
|
|
33
|
+
.image {
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
border-radius: inherit;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
//# sourceMappingURL=avatar.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.css.js","sourceRoot":"","sources":["../../../src/avatar/avatar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;MAyBnB,SAAS,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;;;;;;;;;;;;CAYtD,CAAC","sourcesContent":["import { css, unsafeCSS } from 'lit';\nimport { getTypography } from '../utils.js';\n\nexport const styles = css`\n :host {\n display: inline-block;\n pointer-events: none;\n --avatar-size: 2rem;\n --avatar-background-color: var(--color-primary);\n --avatar-text-color: var(--color-on-primary);\n --avatar-border-radius: var(--global-avatar-border-radius);\n }\n\n .avatar-container {\n display: flex;\n align-items: center;\n gap: var(--spacing-050);\n line-height: 0;\n }\n\n .avatar {\n border-radius: var(--avatar-border-radius);\n display: flex;\n justify-content: center;\n align-items: center;\n color: var(--avatar-text-color);\n width: var(--avatar-size);\n height: var(--avatar-size);\n ${unsafeCSS(getTypography('body-large-emphasized'))}\n background-color: var(--avatar-background-color);\n\n font-size: calc(var(--avatar-size) * 0.4);\n\n .image {\n width: 100%;\n height: 100%;\n overflow: hidden;\n border-radius: inherit;\n }\n }\n`;\n"]}
|