tyrell-components 1.0.0-TC27 → 1.0.0-TC29
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/css/tyrell.css +0 -7
- package/dist/tyrell.css +0 -7
- package/dist/tyrell.js +1 -1
- package/lib/components/button.d.ts +9 -1
- package/lib/components/button.d.ts.map +1 -1
- package/lib/components/button.js +22 -3
- package/lib/components/button.js.map +1 -1
- package/lib/components/tag.d.ts +9 -1
- package/lib/components/tag.d.ts.map +1 -1
- package/lib/components/tag.js +40 -4
- package/lib/components/tag.js.map +1 -1
- package/lib/styles/button.d.ts +3 -1
- package/lib/styles/button.d.ts.map +1 -1
- package/lib/styles/button.js +58 -185
- package/lib/styles/button.js.map +1 -1
- package/lib/styles/calendar-month.d.ts +1 -1
- package/lib/styles/calendar-month.d.ts.map +1 -1
- package/lib/styles/calendar-month.js +21 -19
- package/lib/styles/calendar-month.js.map +1 -1
- package/lib/styles/calendar-navigation.d.ts +1 -1
- package/lib/styles/calendar-navigation.d.ts.map +1 -1
- package/lib/styles/calendar-navigation.js +8 -0
- package/lib/styles/calendar-navigation.js.map +1 -1
- package/lib/styles/date-picker.d.ts +1 -1
- package/lib/styles/date-picker.d.ts.map +1 -1
- package/lib/styles/date-picker.js +12 -4
- package/lib/styles/date-picker.js.map +1 -1
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.d.ts.map +1 -1
- package/lib/styles/select.js +10 -15
- package/lib/styles/select.js.map +1 -1
- package/lib/styles/tag.d.ts +1 -1
- package/lib/styles/tag.d.ts.map +1 -1
- package/lib/styles/tag.js +36 -140
- package/lib/styles/tag.js.map +1 -1
- package/lib/types/common.d.ts +2 -1
- package/lib/types/common.d.ts.map +1 -1
- package/lib/types/common.js +13 -1
- package/lib/types/common.js.map +1 -1
- package/lib/utils/flavor-sheet.d.ts +32 -0
- package/lib/utils/flavor-sheet.d.ts.map +1 -0
- package/lib/utils/flavor-sheet.js +40 -0
- package/lib/utils/flavor-sheet.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/lib/styles/tag.js
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
* Tag Component Styles
|
|
3
3
|
* PORTED FROM: clj/ty/components/tag.css
|
|
4
4
|
*/
|
|
5
|
+
import { FLAVORS } from '../types/common.js';
|
|
6
|
+
/* Neutral maps to text/border tokens instead of flavor tokens, so it is
|
|
7
|
+
written out by hand in the template below. */
|
|
8
|
+
const COLOR_FLAVORS = FLAVORS.filter((f) => f !== 'neutral');
|
|
9
|
+
const tagFlavor = (f) => `
|
|
10
|
+
/* ----- ${f.toUpperCase()} ----- */
|
|
11
|
+
:host([flavor="${f}"]) {
|
|
12
|
+
--tag-bg: var(--ty-bg-${f});
|
|
13
|
+
--tag-color: var(--ty-color-${f});
|
|
14
|
+
--tag-border-color: var(--ty-border-${f});
|
|
15
|
+
}
|
|
16
|
+
:host([flavor="${f}+"]) {
|
|
17
|
+
--tag-bg: var(--ty-bg-${f}-bold);
|
|
18
|
+
--tag-color: var(--ty-color-${f}-strong);
|
|
19
|
+
--tag-border-color: var(--ty-color-${f});
|
|
20
|
+
}
|
|
21
|
+
:host([flavor="${f}-"]) {
|
|
22
|
+
--tag-bg: var(--ty-bg-${f}-soft);
|
|
23
|
+
--tag-color: var(--ty-color-${f});
|
|
24
|
+
--tag-border-color: var(--ty-border-${f});
|
|
25
|
+
}
|
|
26
|
+
:host([flavor="${f}"]) .tag-container[tabindex]:hover,
|
|
27
|
+
:host([flavor="${f}+"]) .tag-container[tabindex]:hover,
|
|
28
|
+
:host([flavor="${f}-"]) .tag-container[tabindex]:hover {
|
|
29
|
+
background: var(--ty-bg-${f}-bold);
|
|
30
|
+
}
|
|
31
|
+
:host([flavor="${f}"]) .tag-container[tabindex]:focus,
|
|
32
|
+
:host([flavor="${f}+"]) .tag-container[tabindex]:focus,
|
|
33
|
+
:host([flavor="${f}-"]) .tag-container[tabindex]:focus {
|
|
34
|
+
box-shadow: 0 0 0 3px var(--ty-color-${f}-faint);
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
5
37
|
export const tagStyles = `
|
|
6
38
|
/* Tag Component Styles using centralized ty.variables.css */
|
|
7
39
|
|
|
@@ -189,147 +221,11 @@ export const tagStyles = `
|
|
|
189
221
|
/* ===== FLAVOR VARIANTS =====
|
|
190
222
|
Each flavor sets --tag-bg / --tag-color / --tag-border-color on :host.
|
|
191
223
|
Append '+' to flavor for a stronger shade (mild background, strong color),
|
|
192
|
-
or '-' for a softer shade (soft background, base color).
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
:host([flavor="primary"]) {
|
|
196
|
-
--tag-bg: var(--ty-bg-primary);
|
|
197
|
-
--tag-color: var(--ty-color-primary);
|
|
198
|
-
--tag-border-color: var(--ty-border-primary);
|
|
199
|
-
}
|
|
200
|
-
:host([flavor="primary+"]) {
|
|
201
|
-
--tag-bg: var(--ty-bg-primary-bold);
|
|
202
|
-
--tag-color: var(--ty-color-primary-strong);
|
|
203
|
-
--tag-border-color: var(--ty-color-primary);
|
|
204
|
-
}
|
|
205
|
-
:host([flavor="primary-"]) {
|
|
206
|
-
--tag-bg: var(--ty-bg-primary-soft);
|
|
207
|
-
--tag-color: var(--ty-color-primary);
|
|
208
|
-
--tag-border-color: var(--ty-border-primary);
|
|
209
|
-
}
|
|
210
|
-
:host([flavor="primary"]) .tag-container[tabindex]:hover,
|
|
211
|
-
:host([flavor="primary+"]) .tag-container[tabindex]:hover,
|
|
212
|
-
:host([flavor="primary-"]) .tag-container[tabindex]:hover {
|
|
213
|
-
background: var(--ty-bg-primary-bold);
|
|
214
|
-
}
|
|
215
|
-
:host([flavor="primary"]) .tag-container[tabindex]:focus,
|
|
216
|
-
:host([flavor="primary+"]) .tag-container[tabindex]:focus,
|
|
217
|
-
:host([flavor="primary-"]) .tag-container[tabindex]:focus {
|
|
218
|
-
box-shadow: 0 0 0 3px var(--ty-color-primary-faint);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* ----- SECONDARY ----- */
|
|
222
|
-
:host([flavor="secondary"]) {
|
|
223
|
-
--tag-bg: var(--ty-bg-secondary);
|
|
224
|
-
--tag-color: var(--ty-color-secondary);
|
|
225
|
-
--tag-border-color: var(--ty-border-secondary);
|
|
226
|
-
}
|
|
227
|
-
:host([flavor="secondary+"]) {
|
|
228
|
-
--tag-bg: var(--ty-bg-secondary-bold);
|
|
229
|
-
--tag-color: var(--ty-color-secondary-strong);
|
|
230
|
-
--tag-border-color: var(--ty-color-secondary);
|
|
231
|
-
}
|
|
232
|
-
:host([flavor="secondary-"]) {
|
|
233
|
-
--tag-bg: var(--ty-bg-secondary-soft);
|
|
234
|
-
--tag-color: var(--ty-color-secondary);
|
|
235
|
-
--tag-border-color: var(--ty-border-secondary);
|
|
236
|
-
}
|
|
237
|
-
:host([flavor="secondary"]) .tag-container[tabindex]:hover,
|
|
238
|
-
:host([flavor="secondary+"]) .tag-container[tabindex]:hover,
|
|
239
|
-
:host([flavor="secondary-"]) .tag-container[tabindex]:hover {
|
|
240
|
-
background: var(--ty-bg-secondary-bold);
|
|
241
|
-
}
|
|
242
|
-
:host([flavor="secondary"]) .tag-container[tabindex]:focus,
|
|
243
|
-
:host([flavor="secondary+"]) .tag-container[tabindex]:focus,
|
|
244
|
-
:host([flavor="secondary-"]) .tag-container[tabindex]:focus {
|
|
245
|
-
box-shadow: 0 0 0 3px var(--ty-color-secondary-faint);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/* ----- SUCCESS ----- */
|
|
249
|
-
:host([flavor="success"]) {
|
|
250
|
-
--tag-bg: var(--ty-bg-success);
|
|
251
|
-
--tag-color: var(--ty-color-success);
|
|
252
|
-
--tag-border-color: var(--ty-border-success);
|
|
253
|
-
}
|
|
254
|
-
:host([flavor="success+"]) {
|
|
255
|
-
--tag-bg: var(--ty-bg-success-bold);
|
|
256
|
-
--tag-color: var(--ty-color-success-strong);
|
|
257
|
-
--tag-border-color: var(--ty-color-success);
|
|
258
|
-
}
|
|
259
|
-
:host([flavor="success-"]) {
|
|
260
|
-
--tag-bg: var(--ty-bg-success-soft);
|
|
261
|
-
--tag-color: var(--ty-color-success);
|
|
262
|
-
--tag-border-color: var(--ty-border-success);
|
|
263
|
-
}
|
|
264
|
-
:host([flavor="success"]) .tag-container[tabindex]:hover,
|
|
265
|
-
:host([flavor="success+"]) .tag-container[tabindex]:hover,
|
|
266
|
-
:host([flavor="success-"]) .tag-container[tabindex]:hover {
|
|
267
|
-
background: var(--ty-bg-success-bold);
|
|
268
|
-
}
|
|
269
|
-
:host([flavor="success"]) .tag-container[tabindex]:focus,
|
|
270
|
-
:host([flavor="success+"]) .tag-container[tabindex]:focus,
|
|
271
|
-
:host([flavor="success-"]) .tag-container[tabindex]:focus {
|
|
272
|
-
box-shadow: 0 0 0 3px var(--ty-color-success-faint);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/* ----- DANGER ----- */
|
|
276
|
-
:host([flavor="danger"]) {
|
|
277
|
-
--tag-bg: var(--ty-bg-danger);
|
|
278
|
-
--tag-color: var(--ty-color-danger);
|
|
279
|
-
--tag-border-color: var(--ty-border-danger);
|
|
280
|
-
}
|
|
281
|
-
:host([flavor="danger+"]) {
|
|
282
|
-
--tag-bg: var(--ty-bg-danger-bold);
|
|
283
|
-
--tag-color: var(--ty-color-danger-strong);
|
|
284
|
-
--tag-border-color: var(--ty-color-danger);
|
|
285
|
-
}
|
|
286
|
-
:host([flavor="danger-"]) {
|
|
287
|
-
--tag-bg: var(--ty-bg-danger-soft);
|
|
288
|
-
--tag-color: var(--ty-color-danger);
|
|
289
|
-
--tag-border-color: var(--ty-border-danger);
|
|
290
|
-
}
|
|
291
|
-
:host([flavor="danger"]) .tag-container[tabindex]:hover,
|
|
292
|
-
:host([flavor="danger+"]) .tag-container[tabindex]:hover,
|
|
293
|
-
:host([flavor="danger-"]) .tag-container[tabindex]:hover {
|
|
294
|
-
background: var(--ty-bg-danger-bold);
|
|
295
|
-
}
|
|
296
|
-
:host([flavor="danger"]) .tag-container[tabindex]:focus,
|
|
297
|
-
:host([flavor="danger+"]) .tag-container[tabindex]:focus,
|
|
298
|
-
:host([flavor="danger-"]) .tag-container[tabindex]:focus {
|
|
299
|
-
box-shadow: 0 0 0 3px var(--ty-color-danger-faint);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/* ----- WARNING ----- */
|
|
303
|
-
:host([flavor="warning"]) {
|
|
304
|
-
--tag-bg: var(--ty-bg-warning);
|
|
305
|
-
--tag-color: var(--ty-color-warning);
|
|
306
|
-
--tag-border-color: var(--ty-border-warning);
|
|
307
|
-
}
|
|
308
|
-
:host([flavor="warning+"]) {
|
|
309
|
-
--tag-bg: var(--ty-bg-warning-bold);
|
|
310
|
-
--tag-color: var(--ty-color-warning-strong);
|
|
311
|
-
--tag-border-color: var(--ty-color-warning);
|
|
312
|
-
}
|
|
313
|
-
:host([flavor="warning-"]) {
|
|
314
|
-
--tag-bg: var(--ty-bg-warning-soft);
|
|
315
|
-
--tag-color: var(--ty-color-warning);
|
|
316
|
-
--tag-border-color: var(--ty-border-warning);
|
|
317
|
-
}
|
|
318
|
-
:host([flavor="warning"]) .tag-container[tabindex]:hover,
|
|
319
|
-
:host([flavor="warning+"]) .tag-container[tabindex]:hover,
|
|
320
|
-
:host([flavor="warning-"]) .tag-container[tabindex]:hover {
|
|
321
|
-
background: var(--ty-bg-warning-bold);
|
|
322
|
-
}
|
|
323
|
-
:host([flavor="warning"]) .tag-container[tabindex]:focus,
|
|
324
|
-
:host([flavor="warning+"]) .tag-container[tabindex]:focus,
|
|
325
|
-
:host([flavor="warning-"]) .tag-container[tabindex]:focus {
|
|
326
|
-
box-shadow: 0 0 0 3px var(--ty-color-warning-faint);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
:host([flavor="info"]) .tag-container[tabindex]:focus {
|
|
330
|
-
box-shadow: 0 0 0 3px var(--ty-color-info-faint);
|
|
331
|
-
}
|
|
224
|
+
or '-' for a softer shade (soft background, base color).
|
|
225
|
+
Generated per flavor above; neutral diverges (text/border tokens) and
|
|
226
|
+
stays hand-written below. */
|
|
332
227
|
|
|
228
|
+
${COLOR_FLAVORS.map(tagFlavor).join('')}
|
|
333
229
|
/* ----- NEUTRAL ----- */
|
|
334
230
|
:host([flavor="neutral"]) {
|
|
335
231
|
--tag-color: var(--ty-text-bold);
|
package/lib/styles/tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../src/styles/tag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../src/styles/tag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C;gDACgD;AAChD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;AAE5D,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC;WACtB,CAAC,CAAC,WAAW,EAAE;iBACT,CAAC;0BACQ,CAAC;gCACK,CAAC;wCACO,CAAC;;iBAExB,CAAC;0BACQ,CAAC;gCACK,CAAC;uCACM,CAAC;;iBAEvB,CAAC;0BACQ,CAAC;gCACK,CAAC;wCACO,CAAC;;iBAExB,CAAC;iBACD,CAAC;iBACD,CAAC;4BACU,CAAC;;iBAEZ,CAAC;iBACD,CAAC;iBACD,CAAC;yCACuB,CAAC;;CAEzC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+LvB,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EtC,CAAC"}
|
package/lib/types/common.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* for a softer shade — e.g. `primary`, `primary+`, `primary-`. Matches the
|
|
7
7
|
* design system's `ty-bg-primary+` / `ty-text-primary-` class convention.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare const FLAVORS: readonly ["primary", "secondary", "success", "danger", "warning", "neutral"];
|
|
10
|
+
export type FlavorBase = (typeof FLAVORS)[number];
|
|
10
11
|
/**
|
|
11
12
|
* A flavor with optional shade suffix: `primary | primary+ | primary-`.
|
|
12
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,OAAO,8EAOV,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,UAAU,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;AAE/E;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjD,8BAA8B;AA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AiB;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iBAAiB;IACjB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,sBAAsB;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAGtC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAG3B,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,wBAAwB;AACxB,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,oCAAoC;IACpC,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ"}
|
package/lib/types/common.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ty Component Common Types
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Built-in semantic color flavor names. Append `+` for a stronger shade or `-`
|
|
6
|
+
* for a softer shade — e.g. `primary`, `primary+`, `primary-`. Matches the
|
|
7
|
+
* design system's `ty-bg-primary+` / `ty-text-primary-` class convention.
|
|
8
|
+
*/
|
|
9
|
+
export const FLAVORS = [
|
|
10
|
+
'primary',
|
|
11
|
+
'secondary',
|
|
12
|
+
'success',
|
|
13
|
+
'danger',
|
|
14
|
+
'warning',
|
|
15
|
+
'neutral',
|
|
16
|
+
];
|
|
5
17
|
//# sourceMappingURL=common.js.map
|
package/lib/types/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,SAAS;IACT,WAAW;IACX,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;CACD,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom (non-built-in) flavor support.
|
|
3
|
+
*
|
|
4
|
+
* Built-in flavors get static per-flavor CSS in each component's stylesheet.
|
|
5
|
+
* Any other flavor string is a custom flavor: the component generates the
|
|
6
|
+
* same wiring at runtime, pointed at the user's design tokens
|
|
7
|
+
* (--ty-color-X / --ty-bg-X / --ty-solid-X / ...), and adopts it as a
|
|
8
|
+
* constructed stylesheet.
|
|
9
|
+
*
|
|
10
|
+
* Why an adopted sheet: render() implementations replace shadowRoot.innerHTML
|
|
11
|
+
* (which would destroy an injected <style> element), and inline style on the
|
|
12
|
+
* host would defeat page-level overrides. Adopted sheets survive renders, and
|
|
13
|
+
* outer-document rules on the host still take precedence over :host rules —
|
|
14
|
+
* so `ty-tag[flavor="X"] { --tag-bg: ... }` escape hatches keep working.
|
|
15
|
+
*/
|
|
16
|
+
export interface CustomFlavorParts {
|
|
17
|
+
/** Full flavor string as given, e.g. "brand+" */
|
|
18
|
+
flavor: string;
|
|
19
|
+
/** Flavor with any +/- shade suffix stripped, e.g. "brand" */
|
|
20
|
+
base: string;
|
|
21
|
+
/** "" | "+" | "-" */
|
|
22
|
+
shade: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Keep a shadow root's custom-flavor sheet in sync with the current flavor.
|
|
26
|
+
*
|
|
27
|
+
* Built-in flavors (and anything that isn't a plain identifier, so attribute
|
|
28
|
+
* values can't inject CSS) remove the sheet. Custom flavors get `css(parts)`
|
|
29
|
+
* adopted into the shadow root. Returns the sheet to store for the next call.
|
|
30
|
+
*/
|
|
31
|
+
export declare function syncCustomFlavorSheet(shadow: ShadowRoot, sheet: CSSStyleSheet | null, flavor: unknown, css: (parts: CustomFlavorParts) => string): CSSStyleSheet | null;
|
|
32
|
+
//# sourceMappingURL=flavor-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flavor-sheet.d.ts","sourceRoot":"","sources":["../../src/utils/flavor-sheet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,aAAa,GAAG,IAAI,EAC3B,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,GACxC,aAAa,GAAG,IAAI,CAetB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom (non-built-in) flavor support.
|
|
3
|
+
*
|
|
4
|
+
* Built-in flavors get static per-flavor CSS in each component's stylesheet.
|
|
5
|
+
* Any other flavor string is a custom flavor: the component generates the
|
|
6
|
+
* same wiring at runtime, pointed at the user's design tokens
|
|
7
|
+
* (--ty-color-X / --ty-bg-X / --ty-solid-X / ...), and adopts it as a
|
|
8
|
+
* constructed stylesheet.
|
|
9
|
+
*
|
|
10
|
+
* Why an adopted sheet: render() implementations replace shadowRoot.innerHTML
|
|
11
|
+
* (which would destroy an injected <style> element), and inline style on the
|
|
12
|
+
* host would defeat page-level overrides. Adopted sheets survive renders, and
|
|
13
|
+
* outer-document rules on the host still take precedence over :host rules —
|
|
14
|
+
* so `ty-tag[flavor="X"] { --tag-bg: ... }` escape hatches keep working.
|
|
15
|
+
*/
|
|
16
|
+
import { FLAVORS } from '../types/common.js';
|
|
17
|
+
/**
|
|
18
|
+
* Keep a shadow root's custom-flavor sheet in sync with the current flavor.
|
|
19
|
+
*
|
|
20
|
+
* Built-in flavors (and anything that isn't a plain identifier, so attribute
|
|
21
|
+
* values can't inject CSS) remove the sheet. Custom flavors get `css(parts)`
|
|
22
|
+
* adopted into the shadow root. Returns the sheet to store for the next call.
|
|
23
|
+
*/
|
|
24
|
+
export function syncCustomFlavorSheet(shadow, sheet, flavor, css) {
|
|
25
|
+
const full = String(flavor || '');
|
|
26
|
+
const base = full.replace(/[+-]$/, '');
|
|
27
|
+
if (FLAVORS.includes(base) || !/^[A-Za-z][A-Za-z0-9_-]*$/.test(base)) {
|
|
28
|
+
if (sheet) {
|
|
29
|
+
shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.filter((s) => s !== sheet);
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
if (!sheet) {
|
|
34
|
+
sheet = new CSSStyleSheet();
|
|
35
|
+
shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, sheet];
|
|
36
|
+
}
|
|
37
|
+
sheet.replaceSync(css({ flavor: full, base, shade: full.slice(base.length) }));
|
|
38
|
+
return sheet;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=flavor-sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flavor-sheet.js","sourceRoot":"","sources":["../../src/utils/flavor-sheet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAW5C;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAkB,EAClB,KAA2B,EAC3B,MAAe,EACf,GAAyC;IAEzC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACtC,IAAK,OAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5F,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAA;QAClF,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG,IAAI,aAAa,EAAE,CAAA;QAC3B,MAAM,CAAC,kBAAkB,GAAG,CAAC,GAAG,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;IACnE,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9E,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED