@evolve.ui/theme-system 1.0.1 → 1.2.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/{allThemes-CFS_9-tk.cjs → allThemes-3d8nhymo.cjs} +12 -2
- package/allThemes-3d8nhymo.cjs.map +1 -0
- package/{allThemes-OV-ayn4C.mjs → allThemes-Abn6KDm7.mjs} +7 -3
- package/allThemes-Abn6KDm7.mjs.map +1 -0
- package/allThemes.cjs +1 -1
- package/allThemes.d.cts +1 -0
- package/allThemes.d.cts.map +1 -1
- package/allThemes.d.mts +1 -0
- package/allThemes.d.mts.map +1 -1
- package/allThemes.mjs +1 -1
- package/brands-CE0wIkKX.d.cts +58 -0
- package/brands-CE0wIkKX.d.cts.map +1 -0
- package/brands-CE0wIkKX.d.mts +58 -0
- package/brands-CE0wIkKX.d.mts.map +1 -0
- package/brands.cjs +16 -13
- package/brands.cjs.map +1 -1
- package/brands.d.cts +2 -2
- package/brands.d.mts +2 -2
- package/brands.mjs +16 -13
- package/brands.mjs.map +1 -1
- package/css/EverydayHarbor.css +377 -0
- package/css/EverydayHarbor.effects.css +650 -0
- package/{default-b-tgfyxR.cjs → default-B6VWF0Js.cjs} +237 -36
- package/default-B6VWF0Js.cjs.map +1 -0
- package/{default-B2n4PnsJ.mjs → default-BogJDhKE.mjs} +238 -37
- package/default-BogJDhKE.mjs.map +1 -0
- package/effects.cjs +26 -0
- package/effects.cjs.map +1 -0
- package/effects.d.cts +22 -0
- package/effects.d.cts.map +1 -0
- package/effects.d.mts +22 -0
- package/effects.d.mts.map +1 -0
- package/effects.mjs +22 -0
- package/effects.mjs.map +1 -0
- package/evolve-ui.entries.json +51 -0
- package/index.cjs +12 -5
- package/index.cjs.map +1 -1
- package/index.d.cts +108 -4
- package/index.d.cts.map +1 -1
- package/index.d.mts +108 -4
- package/index.d.mts.map +1 -1
- package/index.mjs +9 -6
- package/index.mjs.map +1 -1
- package/package.json +5 -1
- package/{plugin-DPtvp4lp.cjs → plugin-B3PF4RMI.cjs} +299 -110
- package/plugin-B3PF4RMI.cjs.map +1 -0
- package/{plugin-D4eCyUJe.mjs → plugin-D6aLCeNB.mjs} +258 -111
- package/plugin-D6aLCeNB.mjs.map +1 -0
- package/src/effects/__fixtures__/fixtureLayer.ts +88 -0
- package/src/effects/brands/EverydayHarbor.ts +392 -0
- package/src/effects/classes.ts +19 -0
- package/src/effects/emit.ts +314 -0
- package/src/effects/hooks.ts +493 -0
- package/src/effects/index.ts +2 -0
- package/src/effects/layers.ts +18 -0
- package/src/effects/rules.ts +90 -0
- package/src/effects/rules.typecheck.ts +50 -0
- package/src/effects/tokens.ts +148 -0
- package/src/effects/validate.ts +683 -0
- package/src/effects/vocabulary.ts +32 -0
- package/src/index.ts +40 -0
- package/src/tailwind/animation.ts +30 -0
- package/src/tailwind/borderRadius.ts +32 -0
- package/src/tailwind/borderWidth.ts +14 -0
- package/src/tailwind/boxShadow.ts +19 -0
- package/src/tailwind/colors.ts +332 -0
- package/src/tailwind/cssVars.ts +301 -0
- package/src/tailwind/fontFamily.ts +14 -0
- package/src/tailwind/plugin.ts +299 -0
- package/src/tailwind/reducedMotion.ts +164 -0
- package/src/tailwind/screens.ts +22 -0
- package/src/tailwind/spacing.ts +20 -0
- package/src/tailwind/text.ts +172 -0
- package/src/tailwind/width.ts +14 -0
- package/src/themeValues.snapshot.ts +6735 -0
- package/src/themes/BasketballTraining.ts +166 -0
- package/src/themes/Default.ts +165 -0
- package/src/themes/EverydayHarbor.ts +147 -0
- package/src/themes/ProfessionalBrand.ts +166 -0
- package/src/themes/allThemes.ts +14 -0
- package/src/themes/brandSources.ts +37 -0
- package/src/themes/brands.ts +63 -0
- package/src/themes/common.ts +65 -0
- package/src/themes/contrastFloors.ts +26 -0
- package/src/themes/generateCSSVars.ts +123 -0
- package/src/themes/inkRamps.ts +43 -0
- package/src/themes/runtime/basketballTraining.ts +3 -0
- package/src/themes/runtime/buildTheme.ts +411 -0
- package/src/themes/runtime/default.ts +3 -0
- package/src/themes/runtime/everydayHarbor.ts +3 -0
- package/src/themes/runtime/professionalBrand.ts +3 -0
- package/src/themes/semanticColorTokenSteps.ts +23 -0
- package/src/themes/themeType.ts +169 -0
- package/src/themes/themeValues.ts +374 -0
- package/src/themes/wcag.ts +48 -0
- package/src/themes/writeToCSSFile.ts +11 -0
- package/src/utils/cn.ts +35 -0
- package/src/utils/color.ts +82 -0
- package/src/utils/wrapVar.ts +24 -0
- package/tailwind/plugin.cjs +5 -1
- package/tailwind/plugin.d.cts +458 -1
- package/tailwind/plugin.d.cts.map +1 -1
- package/tailwind/plugin.d.mts +458 -1
- package/tailwind/plugin.d.mts.map +1 -1
- package/tailwind/plugin.mjs +2 -2
- package/themes/runtime/default.cjs +1 -1
- package/themes/runtime/default.mjs +1 -1
- package/themes/themeType.d.cts +1 -1
- package/themes/themeType.d.mts +1 -1
- package/allThemes-CFS_9-tk.cjs.map +0 -1
- package/allThemes-OV-ayn4C.mjs.map +0 -1
- package/brands-n30rolHQ.d.cts +0 -33
- package/brands-n30rolHQ.d.cts.map +0 -1
- package/brands-n30rolHQ.d.mts +0 -33
- package/brands-n30rolHQ.d.mts.map +0 -1
- package/default-B2n4PnsJ.mjs.map +0 -1
- package/default-b-tgfyxR.cjs.map +0 -1
- package/plugin-D4eCyUJe.mjs.map +0 -1
- package/plugin-DPtvp4lp.cjs.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effect tokens live in their own `--effect-*` namespace.
|
|
3
|
+
* A name added to `CSSVariables` would have to be declared by every locked brand and would change dist CSS.
|
|
4
|
+
* Literal colours are allowed in token values. Rules may only carry `fx` references.
|
|
5
|
+
* `opaque` is what a token becomes when backdrop-filter is missing or transparency is unwanted.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type EffectTokenKind = 'paint' | 'filter' | 'shadow' | 'channels' | 'length' | 'font';
|
|
9
|
+
|
|
10
|
+
export type EffectTokenSpec = {
|
|
11
|
+
readonly kind: EffectTokenKind;
|
|
12
|
+
readonly opaque?: string;
|
|
13
|
+
readonly default?: string;
|
|
14
|
+
readonly doc: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const effectTokens = {
|
|
18
|
+
'solid-fill': { kind: 'paint', doc: 'Opaque colour every translucent fill collapses to in the fallbacks.' },
|
|
19
|
+
edge: { kind: 'paint', opaque: 'none', doc: 'Gradient painted through the 1px masked edge pseudo-element.' },
|
|
20
|
+
|
|
21
|
+
'surface-fill': { kind: 'paint', opaque: 'solid-fill', doc: 'Glass surface background (cards, panels).' },
|
|
22
|
+
'surface-filter': { kind: 'filter', opaque: 'none', doc: 'backdrop-filter for the surface tier.' },
|
|
23
|
+
'surface-shadow': { kind: 'shadow', doc: 'Full box-shadow list for the surface tier (inner highlight + drop).' },
|
|
24
|
+
'surface-radius': {
|
|
25
|
+
kind: 'length',
|
|
26
|
+
default: 'var(--container-border-radius)',
|
|
27
|
+
doc: 'Default-strength radius for opt-in glass; any radius utility on the element wins.',
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
'raised-fill': { kind: 'paint', opaque: 'solid-fill', doc: 'Raised tier background (dialogs, sheets, popovers).' },
|
|
31
|
+
'raised-filter': { kind: 'filter', opaque: 'none', doc: 'backdrop-filter for the raised tier.' },
|
|
32
|
+
'raised-shadow': { kind: 'shadow', doc: 'Full box-shadow list for the raised tier (highlight + halo + drop).' },
|
|
33
|
+
|
|
34
|
+
'scrim-fill': { kind: 'paint', opaque: 'solid-fill', doc: 'Scrim background (drag overlays). No edge, no shadow.' },
|
|
35
|
+
'scrim-filter': { kind: 'filter', opaque: 'none', doc: 'backdrop-filter for the scrim tier.' },
|
|
36
|
+
|
|
37
|
+
'tooltip-text': {
|
|
38
|
+
kind: 'paint',
|
|
39
|
+
default: 'rgb(var(--color-text-primary))',
|
|
40
|
+
doc: 'Text colour of the default tooltip (the semantic colour vars hold bare channels, hence rgb()). react-tooltip paints its own text colour (#222) and core only sets the background, so a dark-canvas brand must set it.',
|
|
41
|
+
},
|
|
42
|
+
'tooltip-text-inverse': {
|
|
43
|
+
kind: 'paint',
|
|
44
|
+
default: 'rgb(var(--color-text-inverse))',
|
|
45
|
+
doc: 'Text colour of the inverse tooltip (react-tooltip dark variant paints #fff on the inverse background).',
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
'overlay-text': {
|
|
49
|
+
kind: 'paint',
|
|
50
|
+
default: 'rgb(var(--color-text-primary))',
|
|
51
|
+
doc: 'Text colour of the valid-drag message in the drop overlay. Core hard-codes text-blue-600 there, which is unreadable on a dark scrim.',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
'hover-fill': { kind: 'paint', opaque: 'solid-fill', doc: 'Surface background while hovered.' },
|
|
55
|
+
|
|
56
|
+
featured: { kind: 'shadow', doc: 'Gold featured card.' },
|
|
57
|
+
halo: { kind: 'shadow', doc: 'Blue navigation halo.' },
|
|
58
|
+
glow: { kind: 'shadow', doc: 'Primary glow.' },
|
|
59
|
+
hover: { kind: 'shadow', doc: 'Hovered drop target.' },
|
|
60
|
+
selected: { kind: 'shadow', doc: 'Selected file card.' },
|
|
61
|
+
success: { kind: 'shadow', doc: 'Completed file card.' },
|
|
62
|
+
error: { kind: 'shadow', doc: 'Errored file card.' },
|
|
63
|
+
'accept-glow': { kind: 'shadow', doc: 'Drag-accept frame glow (decoration).' },
|
|
64
|
+
'reject-glow': { kind: 'shadow', doc: 'Drag-reject frame glow (decoration).' },
|
|
65
|
+
|
|
66
|
+
dash: { kind: 'paint', doc: 'Drop zone frame at rest.' },
|
|
67
|
+
'dash-strong': { kind: 'paint', doc: 'Drop zone frame while hovered.' },
|
|
68
|
+
'dash-disabled': { kind: 'paint', doc: 'Drop zone frame while disabled.' },
|
|
69
|
+
'dash-accept': { kind: 'paint', doc: 'Overlay frame while a valid drag is over the zone.' },
|
|
70
|
+
'dash-reject': { kind: 'paint', doc: 'Overlay frame while an invalid drag is over the zone.' },
|
|
71
|
+
|
|
72
|
+
'cta-fill': { kind: 'paint', doc: 'Gold CTA background.' },
|
|
73
|
+
'cta-fill-hover': { kind: 'paint', doc: 'Gold CTA background while hovered.' },
|
|
74
|
+
'cta-ink-rgb': {
|
|
75
|
+
kind: 'channels',
|
|
76
|
+
doc: 'Ink channels remapped onto --color-text-inverse / --color-icon-inverse.',
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
'text-muted-rgb': {
|
|
80
|
+
kind: 'channels',
|
|
81
|
+
opaque: 'text-muted-solid-rgb',
|
|
82
|
+
doc: 'Muted text channels on translucent glass.',
|
|
83
|
+
},
|
|
84
|
+
'text-muted-solid-rgb': { kind: 'channels', doc: 'Muted text channels on the opaque fallback fill.' },
|
|
85
|
+
|
|
86
|
+
'text-success-rgb': {
|
|
87
|
+
kind: 'channels',
|
|
88
|
+
opaque: 'text-success-solid-rgb',
|
|
89
|
+
doc: 'Success (olive) text channels on translucent glass.',
|
|
90
|
+
},
|
|
91
|
+
'text-success-solid-rgb': { kind: 'channels', doc: 'Success text channels on the opaque fallback fill.' },
|
|
92
|
+
'text-critical-glass-rgb': {
|
|
93
|
+
kind: 'channels',
|
|
94
|
+
opaque: 'text-critical-solid-rgb',
|
|
95
|
+
doc: 'Critical text channels on translucent glass (lighter than the theme critical so it holds 4.5:1 over the brightest backdrop).',
|
|
96
|
+
},
|
|
97
|
+
'text-critical-solid-rgb': { kind: 'channels', doc: 'Critical text channels on the opaque fallback fill.' },
|
|
98
|
+
|
|
99
|
+
'font-accent': {
|
|
100
|
+
kind: 'font',
|
|
101
|
+
default: 'var(--font-family-primary)',
|
|
102
|
+
doc: 'Display font for hui-fx-accent-font. Serif stays off until hui-fx-serif remaps this token.',
|
|
103
|
+
},
|
|
104
|
+
'font-serif': { kind: 'font', doc: 'Serif stack assigned to --effect-font-accent by hui-fx-serif.' },
|
|
105
|
+
backdrop: { kind: 'paint', doc: 'Page backdrop layers for hui-fx-backdrop.' },
|
|
106
|
+
} as const satisfies Record<string, EffectTokenSpec>;
|
|
107
|
+
|
|
108
|
+
export type EffectTokenName = keyof typeof effectTokens;
|
|
109
|
+
|
|
110
|
+
type TokensWithDefault = {
|
|
111
|
+
[K in EffectTokenName]: (typeof effectTokens)[K] extends { default: string } ? K : never;
|
|
112
|
+
}[EffectTokenName];
|
|
113
|
+
|
|
114
|
+
/** What an effect brand must provide. Tokens with a registry default may be omitted. */
|
|
115
|
+
export type EffectTokenValues = { readonly [K in Exclude<EffectTokenName, TokensWithDefault>]: string } & {
|
|
116
|
+
readonly [K in TokensWithDefault]?: string;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type EffectTokenRef<K extends EffectTokenName = EffectTokenName> = `var(--effect-${K})`;
|
|
120
|
+
|
|
121
|
+
export type TokensOfKind<Kind extends EffectTokenKind> = {
|
|
122
|
+
[K in EffectTokenName]: (typeof effectTokens)[K]['kind'] extends Kind ? K : never;
|
|
123
|
+
}[EffectTokenName];
|
|
124
|
+
|
|
125
|
+
type Camel<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize<Camel<Tail>>}` : S;
|
|
126
|
+
|
|
127
|
+
/** Typed token references: `fx.surfaceFill === 'var(--effect-surface-fill)'`. */
|
|
128
|
+
export type Fx = { readonly [K in EffectTokenName as Camel<K>]: EffectTokenRef<K> };
|
|
129
|
+
|
|
130
|
+
const camelKey = (key: string): string => key.replace(/-([a-z0-9])/g, (_match, char: string) => char.toUpperCase());
|
|
131
|
+
|
|
132
|
+
const buildFx = (): Fx =>
|
|
133
|
+
Object.fromEntries(
|
|
134
|
+
(Object.keys(effectTokens) as EffectTokenName[]).map((key) => [camelKey(key), `var(--effect-${key})`])
|
|
135
|
+
) as Fx;
|
|
136
|
+
|
|
137
|
+
export const fx: Fx = buildFx();
|
|
138
|
+
|
|
139
|
+
const TOKEN_REF = /^var\(--effect-([a-z0-9-]+)\)$/;
|
|
140
|
+
|
|
141
|
+
/** `'var(--effect-surface-fill)'` -> `'surface-fill'`. Anything else is undefined. */
|
|
142
|
+
export const tokenOf = (ref: string): EffectTokenName | undefined => {
|
|
143
|
+
const name = TOKEN_REF.exec(ref)?.[1];
|
|
144
|
+
if (name === undefined || !Object.prototype.hasOwnProperty.call(effectTokens, name)) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
return name as EffectTokenName;
|
|
148
|
+
};
|