tyrell-components 1.0.0-TC28 → 1.0.0-TC30
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/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
|
@@ -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