@dixy-ui/themes 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +21 -0
- package/README.md +139 -2
- package/dist/ansi/ornament.d.ts +3 -0
- package/dist/ansi/ornament.js +8 -0
- package/dist/ansi-panes.css +929 -0
- package/dist/art-deco.css +850 -0
- package/dist/atelier/ornament.d.ts +4 -0
- package/dist/atelier/ornament.js +9 -0
- package/dist/atomic/ornament.d.ts +3 -0
- package/dist/atomic/ornament.js +8 -0
- package/dist/atomic-lounge.css +946 -0
- package/dist/authoring.d.ts +142 -0
- package/dist/authoring.js +83 -0
- package/dist/azulejo/ornament.d.ts +3 -0
- package/dist/azulejo/ornament.js +8 -0
- package/dist/azulejo-tile.css +962 -0
- package/dist/blueprint/ornament.d.ts +3 -0
- package/dist/blueprint/ornament.js +8 -0
- package/dist/blueprint.css +897 -0
- package/dist/brutalist/ornament.d.ts +3 -0
- package/dist/brutalist/ornament.js +8 -0
- package/dist/brutalist-concrete.css +936 -0
- package/dist/bytes.json +162 -0
- package/dist/candy-clay.css +778 -0
- package/dist/catalog.d.ts +1346 -0
- package/dist/catalog.js +1379 -0
- package/dist/character.d.ts +103 -0
- package/dist/character.js +477 -0
- package/dist/chrome.d.ts +114 -0
- package/dist/chrome.js +247 -0
- package/dist/clay/ornament.d.ts +3 -0
- package/dist/clay/ornament.js +8 -0
- package/dist/compile-css.d.ts +3 -0
- package/dist/compile-css.js +133 -0
- package/dist/deco/ornament.d.ts +3 -0
- package/dist/deco/ornament.js +8 -0
- package/dist/diwali/ornament.d.ts +3 -0
- package/dist/diwali/ornament.js +8 -0
- package/dist/diwali-lights.css +894 -0
- package/dist/documents.d.ts +104 -0
- package/dist/documents.js +1411 -0
- package/dist/forest/ornament.d.ts +3 -0
- package/dist/forest/ornament.js +12 -0
- package/dist/foundations.d.ts +105 -0
- package/dist/foundations.js +140 -0
- package/dist/frame-corners.d.ts +5 -0
- package/dist/frame-corners.js +5 -0
- package/dist/frame-styles.d.ts +36 -0
- package/dist/frame-styles.js +146 -0
- package/dist/freeze.d.ts +2 -0
- package/dist/freeze.js +9 -0
- package/dist/freighter/ornament.d.ts +3 -0
- package/dist/freighter/ornament.js +8 -0
- package/dist/freighter.css +942 -0
- package/dist/glass/ornament.d.ts +3 -0
- package/dist/glass/ornament.js +8 -0
- package/dist/glass-ui.css +923 -0
- package/dist/hardware/ornament.d.ts +4 -0
- package/dist/hardware/ornament.js +10 -0
- package/dist/holi/ornament.d.ts +3 -0
- package/dist/holi/ornament.js +8 -0
- package/dist/holi-colours.css +887 -0
- package/dist/hud/ornament.d.ts +3 -0
- package/dist/hud/ornament.js +8 -0
- package/dist/light/ornament.d.ts +3 -0
- package/dist/light/ornament.js +10 -0
- package/dist/living-forest.css +917 -0
- package/dist/lunar/ornament.d.ts +3 -0
- package/dist/lunar/ornament.js +8 -0
- package/dist/lunar-new-year.css +811 -0
- package/dist/manifests.d.ts +2485 -0
- package/dist/manifests.js +264 -0
- package/dist/material-light.css +880 -0
- package/dist/neon/ornament.d.ts +3 -0
- package/dist/neon/ornament.js +8 -0
- package/dist/neon-night-market.css +944 -0
- package/dist/ocean/ornament.d.ts +3 -0
- package/dist/ocean/ornament.js +8 -0
- package/dist/ocean-depths.css +825 -0
- package/dist/orbital-hud.css +973 -0
- package/dist/organic-css.d.ts +3 -0
- package/dist/organic-css.js +23 -0
- package/dist/organic-geometry.d.ts +20 -0
- package/dist/organic-geometry.js +74 -0
- package/dist/organic-ornament.d.ts +9 -0
- package/dist/organic-ornament.js +28 -0
- package/dist/organic-paint-launch.d.ts +43 -0
- package/dist/organic-paint-launch.js +1156 -0
- package/dist/organic-paint-world.d.ts +24 -0
- package/dist/organic-paint-world.js +676 -0
- package/dist/organic-paint.d.ts +50 -0
- package/dist/organic-paint.js +695 -0
- package/dist/organic-runtime.d.ts +4 -0
- package/dist/organic-runtime.js +231 -0
- package/dist/organic-settings.d.ts +680 -0
- package/dist/organic-settings.js +433 -0
- package/dist/ornament-parts.d.ts +20 -0
- package/dist/ornament-parts.js +15 -0
- package/dist/papel-picado.css +904 -0
- package/dist/phosphor/ornament.d.ts +3 -0
- package/dist/phosphor/ornament.js +8 -0
- package/dist/phosphor-terminal.css +1011 -0
- package/dist/picado/ornament.d.ts +3 -0
- package/dist/picado/ornament.js +8 -0
- package/dist/prism/ornament.d.ts +4 -0
- package/dist/prism/ornament.js +9 -0
- package/dist/prism-glass.css +970 -0
- package/dist/recipes.d.ts +938 -0
- package/dist/recipes.js +939 -0
- package/dist/resolve.d.ts +40 -0
- package/dist/resolve.js +24 -0
- package/dist/retro/ornament.d.ts +5 -0
- package/dist/retro/ornament.js +10 -0
- package/dist/retro-os.css +867 -0
- package/dist/riso/ornament.d.ts +3 -0
- package/dist/riso/ornament.js +8 -0
- package/dist/riso-zine.css +786 -0
- package/dist/sail/ornament.d.ts +3 -0
- package/dist/sail/ornament.js +8 -0
- package/dist/scrapbook.css +685 -0
- package/dist/signal/ornament.d.ts +4 -0
- package/dist/signal/ornament.js +11 -0
- package/dist/skins/ansi-panes.d.ts +68 -0
- package/dist/skins/ansi-panes.js +68 -0
- package/dist/skins/art-deco.d.ts +68 -0
- package/dist/skins/art-deco.js +68 -0
- package/dist/skins/atomic-lounge.d.ts +68 -0
- package/dist/skins/atomic-lounge.js +68 -0
- package/dist/skins/azulejo-tile.d.ts +68 -0
- package/dist/skins/azulejo-tile.js +68 -0
- package/dist/skins/blueprint.d.ts +68 -0
- package/dist/skins/blueprint.js +68 -0
- package/dist/skins/brutalist-concrete.d.ts +68 -0
- package/dist/skins/brutalist-concrete.js +68 -0
- package/dist/skins/candy-clay.d.ts +57 -0
- package/dist/skins/candy-clay.js +57 -0
- package/dist/skins/diwali-lights.d.ts +68 -0
- package/dist/skins/diwali-lights.js +68 -0
- package/dist/skins/freighter.d.ts +68 -0
- package/dist/skins/freighter.js +68 -0
- package/dist/skins/glass-ui.d.ts +68 -0
- package/dist/skins/glass-ui.js +68 -0
- package/dist/skins/holi-colours.d.ts +68 -0
- package/dist/skins/holi-colours.js +68 -0
- package/dist/skins/living-forest.d.ts +68 -0
- package/dist/skins/living-forest.js +68 -0
- package/dist/skins/lunar-new-year.d.ts +68 -0
- package/dist/skins/lunar-new-year.js +68 -0
- package/dist/skins/material-light.d.ts +57 -0
- package/dist/skins/material-light.js +57 -0
- package/dist/skins/neon-night-market.d.ts +68 -0
- package/dist/skins/neon-night-market.js +68 -0
- package/dist/skins/ocean-depths.d.ts +57 -0
- package/dist/skins/ocean-depths.js +57 -0
- package/dist/skins/orbital-hud.d.ts +68 -0
- package/dist/skins/orbital-hud.js +68 -0
- package/dist/skins/papel-picado.d.ts +68 -0
- package/dist/skins/papel-picado.js +68 -0
- package/dist/skins/phosphor-terminal.d.ts +68 -0
- package/dist/skins/phosphor-terminal.js +68 -0
- package/dist/skins/prism-glass.d.ts +57 -0
- package/dist/skins/prism-glass.js +57 -0
- package/dist/skins/retro-os.d.ts +57 -0
- package/dist/skins/retro-os.js +57 -0
- package/dist/skins/riso-zine.d.ts +68 -0
- package/dist/skins/riso-zine.js +68 -0
- package/dist/skins/scrapbook.d.ts +57 -0
- package/dist/skins/scrapbook.js +57 -0
- package/dist/skins/solar-sail.d.ts +68 -0
- package/dist/skins/solar-sail.js +68 -0
- package/dist/skins/studio-hardware.d.ts +57 -0
- package/dist/skins/studio-hardware.js +57 -0
- package/dist/skins/sumi-ink.d.ts +68 -0
- package/dist/skins/sumi-ink.js +68 -0
- package/dist/skins/swiss-poster.d.ts +68 -0
- package/dist/skins/swiss-poster.js +68 -0
- package/dist/skins/tactile-atelier.d.ts +57 -0
- package/dist/skins/tactile-atelier.js +57 -0
- package/dist/skins/tokyo-transit.d.ts +68 -0
- package/dist/skins/tokyo-transit.js +68 -0
- package/dist/skins/winamp-signal.d.ts +57 -0
- package/dist/skins/winamp-signal.js +57 -0
- package/dist/skins/y2k-titanium.d.ts +57 -0
- package/dist/skins/y2k-titanium.js +57 -0
- package/dist/skins/yule-knit.d.ts +68 -0
- package/dist/skins/yule-knit.js +68 -0
- package/dist/solar-sail.css +901 -0
- package/dist/starters-launch.d.ts +361 -0
- package/dist/starters-launch.js +808 -0
- package/dist/studio-hardware.css +867 -0
- package/dist/sumi/ornament.d.ts +3 -0
- package/dist/sumi/ornament.js +8 -0
- package/dist/sumi-ink.css +733 -0
- package/dist/swiss/ornament.d.ts +3 -0
- package/dist/swiss/ornament.js +8 -0
- package/dist/swiss-poster.css +727 -0
- package/dist/tactile-atelier.css +922 -0
- package/dist/theme-document.schema.json +790 -0
- package/dist/theme-schema.d.ts +453 -0
- package/dist/theme-schema.js +416 -0
- package/dist/titanium/ornament.d.ts +3 -0
- package/dist/titanium/ornament.js +11 -0
- package/dist/tokyo-transit.css +756 -0
- package/dist/transit/ornament.d.ts +3 -0
- package/dist/transit/ornament.js +8 -0
- package/dist/winamp-signal.css +1048 -0
- package/dist/y2k-titanium.css +979 -0
- package/dist/yule/ornament.d.ts +3 -0
- package/dist/yule/ornament.js +8 -0
- package/dist/yule-knit.css +850 -0
- package/package.json +351 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type ThemeChrome } from "./chrome.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Character is the behavioural and control-level half of a theme. Materials and
|
|
4
|
+
* frames paint surfaces; character reshapes the controls inside them, gives them
|
|
5
|
+
* a motion signature, a typographic voice, state cues, small details and a page
|
|
6
|
+
* backdrop. Everything compiles to scoped CSS on existing parts and state hooks:
|
|
7
|
+
* no markup, labels, hit targets, refs or semantics change.
|
|
8
|
+
*/
|
|
9
|
+
export declare const controlStyles: readonly ["standard", "botanical", "pixel", "instrument", "hardware", "glass", "stitched", "pearl", "clay", "brass", "chrome", "halo"];
|
|
10
|
+
export declare const motionStyles: readonly ["standard", "snappy", "stepped", "springy", "weighted", "drift"];
|
|
11
|
+
export declare const stateStyles: readonly ["standard", "led", "marching", "inlay", "glow", "stamp"];
|
|
12
|
+
export declare const focusStyles: readonly ["ring", "double", "dashed", "glow", "offset"];
|
|
13
|
+
export declare const dividerStyles: readonly ["line", "dashed", "dotted", "double", "groove"];
|
|
14
|
+
export declare const selectionStyles: readonly ["accent", "inverse", "highlighter"];
|
|
15
|
+
export declare const scrollbarStyles: readonly ["native", "thin", "accent"];
|
|
16
|
+
export declare const backdropPatterns: readonly ["none", "grid", "scanlines", "sunburst", "caustics", "fibre", "dots", "topo", "halftone"];
|
|
17
|
+
export declare const headingCases: readonly ["none", "uppercase", "small-caps"];
|
|
18
|
+
export declare const headingWeights: readonly [300, 400, 500, 600, 700, 800, 900];
|
|
19
|
+
export declare const numeralStyles: readonly ["proportional", "tabular", "oldstyle"];
|
|
20
|
+
export type ControlStyle = (typeof controlStyles)[number];
|
|
21
|
+
export type MotionStyle = (typeof motionStyles)[number];
|
|
22
|
+
export type StateStyle = (typeof stateStyles)[number];
|
|
23
|
+
export type BackdropPattern = (typeof backdropPatterns)[number];
|
|
24
|
+
export interface ThemeCharacter {
|
|
25
|
+
readonly controls: ControlStyle;
|
|
26
|
+
readonly motion: {
|
|
27
|
+
readonly style: MotionStyle;
|
|
28
|
+
readonly press: number;
|
|
29
|
+
readonly tempo: number;
|
|
30
|
+
};
|
|
31
|
+
readonly type: {
|
|
32
|
+
readonly headingCase: (typeof headingCases)[number];
|
|
33
|
+
readonly headingTracking: number;
|
|
34
|
+
readonly headingWeight: (typeof headingWeights)[number];
|
|
35
|
+
readonly numerals: (typeof numeralStyles)[number];
|
|
36
|
+
};
|
|
37
|
+
readonly states: StateStyle;
|
|
38
|
+
readonly details: {
|
|
39
|
+
readonly focus: (typeof focusStyles)[number];
|
|
40
|
+
readonly divider: (typeof dividerStyles)[number];
|
|
41
|
+
readonly selection: (typeof selectionStyles)[number];
|
|
42
|
+
readonly scrollbar: (typeof scrollbarStyles)[number];
|
|
43
|
+
readonly iconStroke: number;
|
|
44
|
+
};
|
|
45
|
+
readonly backdrop: {
|
|
46
|
+
readonly pattern: BackdropPattern;
|
|
47
|
+
readonly intensity: number;
|
|
48
|
+
readonly scale: number;
|
|
49
|
+
};
|
|
50
|
+
/** Window structure: title bar, edge, display well and corners. */
|
|
51
|
+
readonly chrome: ThemeChrome;
|
|
52
|
+
}
|
|
53
|
+
/** Neutral character: compiles to no extra rules, so migrated documents look unchanged. */
|
|
54
|
+
export declare const defaultCharacter: ThemeCharacter;
|
|
55
|
+
export declare const characterLabels: {
|
|
56
|
+
readonly controls: {
|
|
57
|
+
readonly standard: "Standard";
|
|
58
|
+
readonly botanical: "Botanical leaves";
|
|
59
|
+
readonly pixel: "Pixel bevel";
|
|
60
|
+
readonly instrument: "Instrument LEDs";
|
|
61
|
+
readonly hardware: "Machined knurl";
|
|
62
|
+
readonly glass: "Glass beads";
|
|
63
|
+
readonly stitched: "Hand stitched";
|
|
64
|
+
readonly pearl: "Pearl";
|
|
65
|
+
readonly clay: "Squishy clay";
|
|
66
|
+
readonly brass: "Brass levers";
|
|
67
|
+
readonly chrome: "Chrome chamfer";
|
|
68
|
+
readonly halo: "Porcelain halo";
|
|
69
|
+
};
|
|
70
|
+
readonly motion: {
|
|
71
|
+
readonly standard: "Standard";
|
|
72
|
+
readonly snappy: "Snappy";
|
|
73
|
+
readonly stepped: "Stepped frames";
|
|
74
|
+
readonly springy: "Springy overshoot";
|
|
75
|
+
readonly weighted: "Weighted settle";
|
|
76
|
+
readonly drift: "Slow drift";
|
|
77
|
+
};
|
|
78
|
+
readonly states: {
|
|
79
|
+
readonly standard: "Standard";
|
|
80
|
+
readonly led: "Lit LEDs";
|
|
81
|
+
readonly marching: "Marching ants";
|
|
82
|
+
readonly inlay: "Double inlay";
|
|
83
|
+
readonly glow: "Soft glow";
|
|
84
|
+
readonly stamp: "Stamped hatch";
|
|
85
|
+
};
|
|
86
|
+
readonly backdrop: {
|
|
87
|
+
readonly none: "None";
|
|
88
|
+
readonly grid: "Drafting grid";
|
|
89
|
+
readonly scanlines: "Scanlines";
|
|
90
|
+
readonly sunburst: "Sunburst";
|
|
91
|
+
readonly caustics: "Caustic light";
|
|
92
|
+
readonly fibre: "Paper fibre";
|
|
93
|
+
readonly dots: "Dot grid";
|
|
94
|
+
readonly topo: "Topographic";
|
|
95
|
+
readonly halftone: "Halftone";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
type Scope = (parts: string, state?: string) => string;
|
|
99
|
+
/** Variables for the tokens layer (inherited by every part). */
|
|
100
|
+
export declare function characterTokenCSS(c: ThemeCharacter): string;
|
|
101
|
+
/** Rules for the components layer, all scoped to the skin's own parts. */
|
|
102
|
+
export declare function characterComponentCSS(c: ThemeCharacter, theme: string, S: Scope): string;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { typography } from "@dixy-ui/tokens";
|
|
2
|
+
import { chromeCSS, defaultChrome } from "./chrome.js";
|
|
3
|
+
/**
|
|
4
|
+
* Character is the behavioural and control-level half of a theme. Materials and
|
|
5
|
+
* frames paint surfaces; character reshapes the controls inside them, gives them
|
|
6
|
+
* a motion signature, a typographic voice, state cues, small details and a page
|
|
7
|
+
* backdrop. Everything compiles to scoped CSS on existing parts and state hooks:
|
|
8
|
+
* no markup, labels, hit targets, refs or semantics change.
|
|
9
|
+
*/
|
|
10
|
+
export const controlStyles = [
|
|
11
|
+
"standard",
|
|
12
|
+
"botanical",
|
|
13
|
+
"pixel",
|
|
14
|
+
"instrument",
|
|
15
|
+
"hardware",
|
|
16
|
+
"glass",
|
|
17
|
+
"stitched",
|
|
18
|
+
"pearl",
|
|
19
|
+
"clay",
|
|
20
|
+
"brass",
|
|
21
|
+
"chrome",
|
|
22
|
+
"halo",
|
|
23
|
+
];
|
|
24
|
+
export const motionStyles = [
|
|
25
|
+
"standard",
|
|
26
|
+
"snappy",
|
|
27
|
+
"stepped",
|
|
28
|
+
"springy",
|
|
29
|
+
"weighted",
|
|
30
|
+
"drift",
|
|
31
|
+
];
|
|
32
|
+
export const stateStyles = [
|
|
33
|
+
"standard",
|
|
34
|
+
"led",
|
|
35
|
+
"marching",
|
|
36
|
+
"inlay",
|
|
37
|
+
"glow",
|
|
38
|
+
"stamp",
|
|
39
|
+
];
|
|
40
|
+
export const focusStyles = [
|
|
41
|
+
"ring",
|
|
42
|
+
"double",
|
|
43
|
+
"dashed",
|
|
44
|
+
"glow",
|
|
45
|
+
"offset",
|
|
46
|
+
];
|
|
47
|
+
export const dividerStyles = [
|
|
48
|
+
"line",
|
|
49
|
+
"dashed",
|
|
50
|
+
"dotted",
|
|
51
|
+
"double",
|
|
52
|
+
"groove",
|
|
53
|
+
];
|
|
54
|
+
export const selectionStyles = ["accent", "inverse", "highlighter"];
|
|
55
|
+
export const scrollbarStyles = ["native", "thin", "accent"];
|
|
56
|
+
export const backdropPatterns = [
|
|
57
|
+
"none",
|
|
58
|
+
"grid",
|
|
59
|
+
"scanlines",
|
|
60
|
+
"sunburst",
|
|
61
|
+
"caustics",
|
|
62
|
+
"fibre",
|
|
63
|
+
"dots",
|
|
64
|
+
"topo",
|
|
65
|
+
"halftone",
|
|
66
|
+
];
|
|
67
|
+
export const headingCases = ["none", "uppercase", "small-caps"];
|
|
68
|
+
export const headingWeights = [300, 400, 500, 600, 700, 800, 900];
|
|
69
|
+
export const numeralStyles = ["proportional", "tabular", "oldstyle"];
|
|
70
|
+
/** Neutral character: compiles to no extra rules, so migrated documents look unchanged. */
|
|
71
|
+
export const defaultCharacter = {
|
|
72
|
+
controls: "standard",
|
|
73
|
+
motion: { style: "standard", press: 1, tempo: 1 },
|
|
74
|
+
type: {
|
|
75
|
+
headingCase: "none",
|
|
76
|
+
headingTracking: 0,
|
|
77
|
+
headingWeight: 600,
|
|
78
|
+
numerals: "proportional",
|
|
79
|
+
},
|
|
80
|
+
states: "standard",
|
|
81
|
+
details: {
|
|
82
|
+
focus: "ring",
|
|
83
|
+
divider: "line",
|
|
84
|
+
selection: "accent",
|
|
85
|
+
scrollbar: "native",
|
|
86
|
+
iconStroke: 2,
|
|
87
|
+
},
|
|
88
|
+
backdrop: { pattern: "none", intensity: 0.5, scale: 1 },
|
|
89
|
+
chrome: defaultChrome,
|
|
90
|
+
};
|
|
91
|
+
export const characterLabels = {
|
|
92
|
+
controls: {
|
|
93
|
+
standard: "Standard",
|
|
94
|
+
botanical: "Botanical leaves",
|
|
95
|
+
pixel: "Pixel bevel",
|
|
96
|
+
instrument: "Instrument LEDs",
|
|
97
|
+
hardware: "Machined knurl",
|
|
98
|
+
glass: "Glass beads",
|
|
99
|
+
stitched: "Hand stitched",
|
|
100
|
+
pearl: "Pearl",
|
|
101
|
+
clay: "Squishy clay",
|
|
102
|
+
brass: "Brass levers",
|
|
103
|
+
chrome: "Chrome chamfer",
|
|
104
|
+
halo: "Porcelain halo",
|
|
105
|
+
},
|
|
106
|
+
motion: {
|
|
107
|
+
standard: "Standard",
|
|
108
|
+
snappy: "Snappy",
|
|
109
|
+
stepped: "Stepped frames",
|
|
110
|
+
springy: "Springy overshoot",
|
|
111
|
+
weighted: "Weighted settle",
|
|
112
|
+
drift: "Slow drift",
|
|
113
|
+
},
|
|
114
|
+
states: {
|
|
115
|
+
standard: "Standard",
|
|
116
|
+
led: "Lit LEDs",
|
|
117
|
+
marching: "Marching ants",
|
|
118
|
+
inlay: "Double inlay",
|
|
119
|
+
glow: "Soft glow",
|
|
120
|
+
stamp: "Stamped hatch",
|
|
121
|
+
},
|
|
122
|
+
backdrop: {
|
|
123
|
+
none: "None",
|
|
124
|
+
grid: "Drafting grid",
|
|
125
|
+
scanlines: "Scanlines",
|
|
126
|
+
sunburst: "Sunburst",
|
|
127
|
+
caustics: "Caustic light",
|
|
128
|
+
fibre: "Paper fibre",
|
|
129
|
+
dots: "Dot grid",
|
|
130
|
+
topo: "Topographic",
|
|
131
|
+
halftone: "Halftone",
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
const ACCENT = "var(--dixy-color-background-action-primary)";
|
|
135
|
+
const EDGE = "var(--dixy-skin-edge)";
|
|
136
|
+
const SF = "var(--dixy-motion-spatial-factor)";
|
|
137
|
+
const mix = (color, amount, other = "transparent") => `color-mix(in srgb,${color} ${amount}%,${other})`;
|
|
138
|
+
const checks = ".dixy-checkbox-root";
|
|
139
|
+
const radios = ".dixy-radio-root";
|
|
140
|
+
const choices = ".dixy-checkbox-root,.dixy-radio-root";
|
|
141
|
+
const thumbs = ".dixy-switch-thumb";
|
|
142
|
+
const sliderThumb = ".dixy-slider-thumb";
|
|
143
|
+
const trackParts = ".dixy-slider-track,.dixy-progress-track,.dixy-meter-track";
|
|
144
|
+
const fillParts = ".dixy-slider-indicator,.dixy-progress-indicator,.dixy-meter-indicator";
|
|
145
|
+
const fieldParts = ".dixy-input,.dixy-textarea,.dixy-native-select,.dixy-select-trigger,.dixy-input-group,.dixy-number-field-group";
|
|
146
|
+
const sliderFace = (S, transform, rules) => `${S(sliderThumb)}::before { transform:translate(-50%,-50%) ${transform}; ${rules} }`;
|
|
147
|
+
/** Each control language reshapes switch, choices, slider, tracks and button press. */
|
|
148
|
+
function controlCSS(style, S) {
|
|
149
|
+
switch (style) {
|
|
150
|
+
case "standard":
|
|
151
|
+
return "";
|
|
152
|
+
case "botanical":
|
|
153
|
+
return `
|
|
154
|
+
${S(thumbs)} { border-radius:60% 4% 60% 4%; }
|
|
155
|
+
${S(".dixy-switch-root")}::before { border-radius:999px; }
|
|
156
|
+
${S(checks)}::before { border-radius:3px 55% 3px 55%; }
|
|
157
|
+
${S(radios)}::before { box-shadow:inset 0 0 0 2px var(--dixy-color-background-surface),inset 0 0 0 3px ${mix(EDGE, 45)}; }
|
|
158
|
+
${sliderFace(S, "rotate(45deg)", "border-radius:60% 4% 60% 4%;")}
|
|
159
|
+
${S(trackParts)} { border-radius:999px; }
|
|
160
|
+
${S(fillParts)} { background-image:linear-gradient(90deg,${mix(ACCENT, 70, "#e8d58a")},${ACCENT}); }`;
|
|
161
|
+
case "pixel":
|
|
162
|
+
return `
|
|
163
|
+
${S(".dixy-switch-root")}::before { border-radius:0; box-shadow:inset -2px -2px 0 #0003,inset 2px 2px 0 #fff8; }
|
|
164
|
+
${S(thumbs)} { border-radius:0; box-shadow:2px 2px 0 ${EDGE}; }
|
|
165
|
+
${S(choices)}::before { box-shadow:2px 2px 0 ${EDGE}; }
|
|
166
|
+
${S(checks)}::before { border-radius:0; }
|
|
167
|
+
${S(radios)}::before { border-radius:30%; }
|
|
168
|
+
${sliderFace(S, "", "border-radius:0; inline-size:calc(var(--dixy-slider-thumb-size) * .6); box-shadow:2px 2px 0 " + EDGE + ";")}
|
|
169
|
+
${S(trackParts)} { border-radius:0; }
|
|
170
|
+
${S(fillParts)} { border-radius:0; -webkit-mask:repeating-linear-gradient(90deg,#000 0 8px,transparent 8px 10px); mask:repeating-linear-gradient(90deg,#000 0 8px,transparent 8px 10px); }
|
|
171
|
+
${S(".dixy-button", ':is([data-variant="solid"],[data-variant="outline"],[data-variant="soft"]):not([data-disabled])')} { box-shadow:3px 3px 0 ${EDGE}; }
|
|
172
|
+
${S(".dixy-button", ':is([data-variant="solid"],[data-variant="outline"],[data-variant="soft"]):not([data-disabled]):active')} { box-shadow:0 0 0 ${EDGE}; transform:translate(calc(3px * ${SF}),calc(3px * ${SF})); }`;
|
|
173
|
+
case "instrument":
|
|
174
|
+
return `
|
|
175
|
+
${S(".dixy-switch-root")}::before { border-radius:3px; background-color:${mix("var(--dixy-color-base-12)", 88, ACCENT)}; }
|
|
176
|
+
${S(thumbs)} { border-radius:2px; }
|
|
177
|
+
${S(thumbs)}::after { content:""; position:absolute; inset:50% auto auto 50%; inline-size:6px; block-size:6px; translate:-50% -50%; border-radius:50%; background:${mix("var(--dixy-color-base-12)", 40, "var(--dixy-color-base-6)")}; }
|
|
178
|
+
${S(thumbs, "[data-checked]")}::after { background:${ACCENT}; box-shadow:0 0 6px 1px ${ACCENT}; }
|
|
179
|
+
${S(checks)}::before { border-radius:2px; }
|
|
180
|
+
${S(choices, "[data-checked]")}::before { box-shadow:0 0 8px ${mix(ACCENT, 70)}; }
|
|
181
|
+
${sliderFace(S, "", `border-radius:2px; inline-size:calc(var(--dixy-slider-thumb-size) * .55); block-size:calc(var(--dixy-slider-thumb-size) * 1.25); background-image:repeating-linear-gradient(0deg,transparent 0 2px,#0004 2px 3px),var(--dixy-skin-thumb);`)}
|
|
182
|
+
${S(trackParts)} { border-radius:2px; background-color:${mix("var(--dixy-color-base-12)", 90, ACCENT)}; }
|
|
183
|
+
${S(fillParts)} { border-radius:1px; box-shadow:0 0 8px ${mix(ACCENT, 80)}; -webkit-mask:repeating-linear-gradient(90deg,#000 0 4px,transparent 4px 6px); mask:repeating-linear-gradient(90deg,#000 0 4px,transparent 4px 6px); }`;
|
|
184
|
+
case "hardware":
|
|
185
|
+
return `
|
|
186
|
+
${S(".dixy-switch-root")}::before { border-radius:7px; box-shadow:inset 0 2px 4px #0003; }
|
|
187
|
+
${S(thumbs)} { border-radius:5px; background-image:repeating-linear-gradient(90deg,transparent 0 2px,#0002 2px 3px),var(--dixy-skin-thumb); }
|
|
188
|
+
${S(checks)}::before { border-radius:4px; box-shadow:inset 0 1px 2px #0003; }
|
|
189
|
+
${S(choices, "[data-checked]")}::before { box-shadow:inset 0 2px 3px #0004; }
|
|
190
|
+
${sliderFace(S, "", `border-width:2px; background-image:linear-gradient(90deg,transparent 46%,${EDGE} 46% 54%,transparent 54%),repeating-conic-gradient(from 0deg,transparent 0 7deg,#0002 7deg 14deg),radial-gradient(circle at 35% 30%,#fff 0 18%,#d9d9d4 60%,#a9aaa5);`)}
|
|
191
|
+
${S(trackParts)} { border-radius:3px; box-shadow:inset 0 2px 3px #0003; }`;
|
|
192
|
+
case "glass":
|
|
193
|
+
return `
|
|
194
|
+
${S(thumbs)} { background-color:${mix("#fff", 62)}; box-shadow:inset 0 1px 0 #fff,0 4px 14px ${mix(ACCENT, 35)}; }
|
|
195
|
+
${S(".dixy-switch-root", "[data-checked]")}::before { box-shadow:0 0 0 4px ${mix(ACCENT, 16)}; }
|
|
196
|
+
${S(choices, "[data-checked]")}::before { box-shadow:0 0 0 4px ${mix(ACCENT, 16)},inset 0 1px 0 #fff8; }
|
|
197
|
+
${sliderFace(S, "", `background-color:${mix("#fff", 70)}; box-shadow:inset 0 1px 0 #fff,0 0 0 4px ${mix(ACCENT, 18)},0 6px 16px ${mix(ACCENT, 30)};`)}
|
|
198
|
+
${S(fillParts)} { background-image:linear-gradient(90deg,${mix(ACCENT, 55, "#fff")},${ACCENT}); box-shadow:0 0 12px ${mix(ACCENT, 45)}; }
|
|
199
|
+
${S(trackParts)} { border-radius:999px; background-color:${mix("#fff", 35)}; }`;
|
|
200
|
+
case "stitched":
|
|
201
|
+
return `
|
|
202
|
+
${S(".dixy-switch-root")}::before { outline:1px dashed ${mix(EDGE, 70)}; outline-offset:-4px; }
|
|
203
|
+
${S(checks)}::before { outline:1px dashed ${mix(EDGE, 70)}; outline-offset:-4px; border-radius:3px; }
|
|
204
|
+
${S(choices, "[data-checked]")}::before { outline-color:${mix("#fff", 75)}; }
|
|
205
|
+
${sliderFace(S, "", `outline:1px dashed ${mix("#fff", 80)}; outline-offset:-4px;`)}
|
|
206
|
+
${S(trackParts)} { border-style:dashed; }
|
|
207
|
+
${S(fieldParts)} { border-style:dashed; }`;
|
|
208
|
+
case "pearl": {
|
|
209
|
+
const pearl = `radial-gradient(circle at 32% 28%,#fff 0 14%,${mix(ACCENT, 18, "#fff")} 42%,${mix(ACCENT, 45, "#f4efe6")} 100%)`;
|
|
210
|
+
return `
|
|
211
|
+
${S(thumbs)} { border-radius:999px; background-image:${pearl}; box-shadow:0 3px 8px ${mix(ACCENT, 30)},inset 0 -2px 3px ${mix(ACCENT, 25)}; }
|
|
212
|
+
${S(".dixy-switch-root")}::before { border-radius:999px; }
|
|
213
|
+
${S(radios, "[data-checked]")}::before { background-image:${pearl}; }
|
|
214
|
+
${sliderFace(S, "", `background-image:${pearl}; box-shadow:0 3px 10px ${mix(ACCENT, 35)};`)}
|
|
215
|
+
${S(trackParts)} { border-radius:999px; }
|
|
216
|
+
${S(fillParts)} { background-image:linear-gradient(90deg,${mix(ACCENT, 60, "#bfe9e4")},${ACCENT},${mix(ACCENT, 60, "#f2d7e8")}); }`;
|
|
217
|
+
}
|
|
218
|
+
case "clay":
|
|
219
|
+
return `
|
|
220
|
+
${S(thumbs)} { border-radius:999px; transition:transform var(--dixy-switch-motion-thumb),scale var(--dixy-motion-duration-fast) var(--dixy-motion-easing-spatial,var(--dixy-motion-easing-standard)); }
|
|
221
|
+
${S(".dixy-switch-root")}::before { border-radius:999px; }
|
|
222
|
+
${S(".dixy-switch-root", ":active:not([data-disabled])")} .dixy-switch-thumb { scale:1 calc(1 - .18 * ${SF}); }
|
|
223
|
+
${S(checks)}::before { border-radius:42%; }
|
|
224
|
+
${S(choices, ":active:not([data-disabled])")}::before { scale:calc(1 + .1 * ${SF}) calc(1 - .1 * ${SF}); }
|
|
225
|
+
${S(sliderThumb, ":active")}::before { scale:calc(1 + .18 * ${SF}) calc(1 - .16 * ${SF}); }
|
|
226
|
+
${S(".dixy-button", ":active:not([data-disabled])")} { scale:calc(1 + .04 * ${SF}) calc(1 - .07 * ${SF}); }
|
|
227
|
+
${S(".dixy-button")} { transition:background-color var(--dixy-button-motion-feedback),color var(--dixy-button-motion-feedback),border-color var(--dixy-button-motion-feedback),transform var(--dixy-button-motion-feedback-duration) var(--dixy-motion-easing-spatial,var(--dixy-motion-easing-standard)),scale var(--dixy-motion-duration-fast) var(--dixy-motion-easing-spatial,var(--dixy-motion-easing-standard)); }
|
|
228
|
+
${S(trackParts)} { border-radius:999px; }`;
|
|
229
|
+
case "brass": {
|
|
230
|
+
// Switch thumbs travel with `transform`, which CSS applies after `rotate`/`scale`;
|
|
231
|
+
// a rotated or x-scaled thumb would slide diagonally or overshoot, so shape it with clip-path.
|
|
232
|
+
const brass = "linear-gradient(135deg,#f6e3a1,#c79b48 48%,#7c5b22)";
|
|
233
|
+
return `
|
|
234
|
+
${S(checks)}::before { transform:rotate(45deg) scale(.76); border-radius:1px; border-width:1.5px; }
|
|
235
|
+
${S(radios)}::before { box-shadow:0 0 0 2px var(--dixy-color-background-surface),0 0 0 3px ${EDGE}; }
|
|
236
|
+
${S(".dixy-switch-root")}::before { border-radius:2px; }
|
|
237
|
+
${S(thumbs)} { clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%); border-radius:0; background-image:${brass}; }
|
|
238
|
+
${sliderFace(S, "rotate(45deg) scale(.8)", `border-radius:1px; background-image:${brass};`)}
|
|
239
|
+
${S(trackParts)} { border-radius:0; box-shadow:0 0 0 1px ${EDGE},inset 0 1px 2px #0004; }
|
|
240
|
+
${S(fillParts)} { background-image:${brass}; }`;
|
|
241
|
+
}
|
|
242
|
+
case "chrome": {
|
|
243
|
+
const chamfer = "polygon(4px 0,calc(100% - 4px) 0,100% 4px,100% calc(100% - 4px),calc(100% - 4px) 100%,4px 100%,0 calc(100% - 4px),0 4px)";
|
|
244
|
+
const brushed = "repeating-linear-gradient(90deg,#fff3 0 1px,#0001 1px 2px),linear-gradient(180deg,#f4f7f9,#aab6bd)";
|
|
245
|
+
return `
|
|
246
|
+
${S(".dixy-switch-root")}::before { border-radius:0; clip-path:${chamfer}; }
|
|
247
|
+
${S(thumbs)} { border-radius:0; clip-path:${chamfer}; background-image:${brushed}; }
|
|
248
|
+
${S(checks)}::before { border-radius:0; clip-path:${chamfer}; }
|
|
249
|
+
${sliderFace(S, "", `border-radius:0; clip-path:${chamfer}; background-image:${brushed};`)}
|
|
250
|
+
${S(fillParts)} { background-image:linear-gradient(90deg,${ACCENT},${mix(ACCENT, 45, "#c8fbff")}); box-shadow:0 0 10px ${mix(ACCENT, 70)}; }
|
|
251
|
+
${S(trackParts)} { border-radius:2px; }`;
|
|
252
|
+
}
|
|
253
|
+
case "halo":
|
|
254
|
+
return `
|
|
255
|
+
${S(".dixy-switch-root")}::before { border-radius:999px; }
|
|
256
|
+
${S(".dixy-switch-root", "[data-checked]")}::before { border-color:transparent; }
|
|
257
|
+
${S(thumbs)} { border-radius:999px; box-shadow:0 1px 3px #0002,0 2px 8px #0001; }
|
|
258
|
+
${S(thumbs, "[data-checked]")} { box-shadow:0 0 0 4px ${mix(ACCENT, 16)},0 2px 6px #0002; }
|
|
259
|
+
${S(checks)}::before { border-radius:6px; }
|
|
260
|
+
${S(choices, ":hover:not([data-disabled])")}::before { box-shadow:0 0 0 6px ${mix(ACCENT, 12)}; }
|
|
261
|
+
${sliderFace(S, "", `box-shadow:0 0 0 5px ${mix(ACCENT, 14)},0 2px 6px #0002;`)}
|
|
262
|
+
${S(trackParts)} { border-radius:999px; }`;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const durations = { fast: 120, normal: 200, deliberate: 280, slow: 400 };
|
|
266
|
+
/**
|
|
267
|
+
* `easing` drives every feedback transition, including colours, so it must
|
|
268
|
+
* never overshoot: an overshooting curve extrapolates colours past their
|
|
269
|
+
* target (a hover tint briefly flashes white). Bouncy curves belong in
|
|
270
|
+
* `spatial`, which only reaches transform/scale/indicator motion.
|
|
271
|
+
*/
|
|
272
|
+
const motionRecipes = {
|
|
273
|
+
standard: { scale: 1 },
|
|
274
|
+
snappy: { easing: "cubic-bezier(0.2,0,0,1)", scale: 0.7 },
|
|
275
|
+
stepped: { easing: "steps(3,end)", enter: "steps(4,end)", scale: 1.2 },
|
|
276
|
+
springy: {
|
|
277
|
+
easing: "cubic-bezier(0.22,1,0.36,1)",
|
|
278
|
+
spatial: "linear(0,0.22 8%,0.72 22%,1.06 38%,1.12 48%,1.03 64%,0.99 78%,1)",
|
|
279
|
+
scale: 1.4,
|
|
280
|
+
},
|
|
281
|
+
weighted: { easing: "cubic-bezier(0.5,0,0.1,1)", scale: 1.3 },
|
|
282
|
+
drift: { easing: "cubic-bezier(0.25,0.1,0.25,1)", scale: 1.7 },
|
|
283
|
+
};
|
|
284
|
+
/** Component easing tokens whose transitions move things but never paint colour. */
|
|
285
|
+
const spatialEasingTokens = [
|
|
286
|
+
"--dixy-switch-motion-thumb-easing",
|
|
287
|
+
"--dixy-checkbox-motion-indicator-easing",
|
|
288
|
+
"--dixy-radio-motion-indicator-easing",
|
|
289
|
+
"--dixy-tabs-motion-indicator-easing",
|
|
290
|
+
];
|
|
291
|
+
/** Durations only grow when motion is allowed, so reduced-motion scopes still resolve to 0ms. */
|
|
292
|
+
function motionCSS(c, theme) {
|
|
293
|
+
const recipe = motionRecipes[c.motion.style];
|
|
294
|
+
const k = recipe.scale * c.motion.tempo;
|
|
295
|
+
// Movement-only tokens may take the bouncy curve; colour-carrying ones may not.
|
|
296
|
+
const spatial = recipe.spatial
|
|
297
|
+
? `--dixy-motion-easing-spatial:${recipe.spatial}; ${spatialEasingTokens
|
|
298
|
+
.map((token) => `${token}:${recipe.spatial};`)
|
|
299
|
+
.join(" ")}`
|
|
300
|
+
: "";
|
|
301
|
+
const easing = recipe.easing
|
|
302
|
+
? `--dixy-motion-easing-standard:${recipe.easing}; --dixy-motion-easing-enter:${recipe.enter ?? recipe.spatial ?? recipe.easing}; ${spatial}`
|
|
303
|
+
: "";
|
|
304
|
+
const timing = k === 1
|
|
305
|
+
? ""
|
|
306
|
+
: `@media (prefers-reduced-motion:no-preference) { ${theme}:not([data-motion="reduced"]) { ${Object.entries(durations)
|
|
307
|
+
.map(([name, ms]) => `--dixy-motion-duration-${name}:${Math.round(ms * k)}ms;`)
|
|
308
|
+
.join(" ")} } }`;
|
|
309
|
+
const press = c.motion.press === 1
|
|
310
|
+
? ""
|
|
311
|
+
: `--dixy-personality-press-distance:${c.motion.press}px;`;
|
|
312
|
+
return `${easing || press ? `${theme} { ${easing} ${press} }` : ""}\n ${timing}`;
|
|
313
|
+
}
|
|
314
|
+
const headingRoles = Object.keys(typography).filter((role) => role.startsWith("display.") ||
|
|
315
|
+
role.startsWith("heading.") ||
|
|
316
|
+
role.startsWith("title."));
|
|
317
|
+
function typeVariables(c) {
|
|
318
|
+
const t = c.type;
|
|
319
|
+
if (t.headingWeight === defaultCharacter.type.headingWeight &&
|
|
320
|
+
t.headingTracking === 0)
|
|
321
|
+
return "";
|
|
322
|
+
return headingRoles
|
|
323
|
+
.map((role) => {
|
|
324
|
+
const key = role.replaceAll(".", "-");
|
|
325
|
+
return `--dixy-font-${key}-weight:${t.headingWeight}; ${t.headingTracking
|
|
326
|
+
? `--dixy-font-${key}-letter-spacing:${t.headingTracking}em;`
|
|
327
|
+
: ""}`;
|
|
328
|
+
})
|
|
329
|
+
.join(" ");
|
|
330
|
+
}
|
|
331
|
+
function typeCSS(c, theme) {
|
|
332
|
+
const t = c.type;
|
|
333
|
+
const rules = [];
|
|
334
|
+
if (t.headingCase === "uppercase")
|
|
335
|
+
rules.push(`${theme} :is(h1,h2,h3,.dixy-heading) { text-transform:uppercase; }`);
|
|
336
|
+
if (t.headingCase === "small-caps")
|
|
337
|
+
rules.push(`${theme} :is(h1,h2,h3,.dixy-heading) { font-variant-caps:all-small-caps; }`);
|
|
338
|
+
if (t.headingTracking)
|
|
339
|
+
rules.push(`${theme} :is(h1,h2,h3,.dixy-heading) { letter-spacing:${t.headingTracking}em; }`);
|
|
340
|
+
if (t.headingWeight !== defaultCharacter.type.headingWeight)
|
|
341
|
+
rules.push(`${theme} :is(h1,h2,h3,.dixy-heading) { font-weight:${t.headingWeight}; }`);
|
|
342
|
+
if (t.numerals !== "proportional")
|
|
343
|
+
rules.push(`${theme} { font-variant-numeric:${t.numerals === "tabular" ? "tabular-nums" : "oldstyle-nums"}; }`);
|
|
344
|
+
return rules.join("\n ");
|
|
345
|
+
}
|
|
346
|
+
const DANGER = "var(--dixy-color-border-danger)";
|
|
347
|
+
const invalid = ':is([data-invalid],[aria-invalid="true"])';
|
|
348
|
+
function stateCSS(style, S, theme) {
|
|
349
|
+
const busy = '[aria-busy="true"]';
|
|
350
|
+
const tab = ".dixy-tabs-indicator";
|
|
351
|
+
const animate = (rule) => `@media (prefers-reduced-motion:no-preference) { ${theme}:not([data-motion="reduced"]):not([data-effects="reduced"]) ${rule} }`;
|
|
352
|
+
switch (style) {
|
|
353
|
+
case "standard":
|
|
354
|
+
return "";
|
|
355
|
+
case "led":
|
|
356
|
+
return `
|
|
357
|
+
${S(tab)} { box-shadow:0 0 10px ${mix(ACCENT, 55)},inset 0 0 0 1px ${mix(ACCENT, 60)}; }
|
|
358
|
+
${S(fieldParts, invalid)} { box-shadow:0 0 0 3px ${mix(DANGER, 25)},0 0 10px ${mix(DANGER, 35)}; }
|
|
359
|
+
${S(".dixy-button", busy)} { box-shadow:0 0 12px ${mix(ACCENT, 60)}; }`;
|
|
360
|
+
case "marching":
|
|
361
|
+
return `
|
|
362
|
+
${S(tab)} { border-style:dashed; }
|
|
363
|
+
${S(fieldParts, invalid)} { border-style:dashed; border-color:${DANGER}; }
|
|
364
|
+
${S(".dixy-button", busy)} { background-image:repeating-linear-gradient(-45deg,#fff3 0 6px,transparent 6px 12px); background-size:17px 17px; }
|
|
365
|
+
${animate(`.dixy-button${busy}[data-dixy-skin] { animation:dixy-character-march 600ms linear infinite; }`)}
|
|
366
|
+
@keyframes dixy-character-march { to { background-position:17px 0; } }`;
|
|
367
|
+
case "inlay":
|
|
368
|
+
return `
|
|
369
|
+
${S(tab)} { box-shadow:inset 0 0 0 1px ${EDGE},inset 0 0 0 3px var(--dixy-color-background-surface),inset 0 0 0 4px ${EDGE}; }
|
|
370
|
+
${S(fieldParts, invalid)} { border-style:double; border-width:3px; border-color:${DANGER}; }`;
|
|
371
|
+
case "glow":
|
|
372
|
+
return `
|
|
373
|
+
${S(tab)} { box-shadow:0 4px 18px ${mix(ACCENT, 30)}; }
|
|
374
|
+
${S(fieldParts, invalid)} { box-shadow:0 0 0 4px ${mix(DANGER, 18)}; }
|
|
375
|
+
${S(".dixy-button", busy)} { box-shadow:0 0 0 4px ${mix(ACCENT, 20)}; }`;
|
|
376
|
+
case "stamp":
|
|
377
|
+
return `
|
|
378
|
+
${S(tab)} { border:2px solid ${EDGE}; }
|
|
379
|
+
${S(fieldParts, invalid)} { background-image:repeating-linear-gradient(-45deg,${mix(DANGER, 14)} 0 4px,transparent 4px 9px); border-color:${DANGER}; }
|
|
380
|
+
${S(".dixy-button", busy)} { background-image:repeating-linear-gradient(-45deg,#0002 0 4px,transparent 4px 9px); }`;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function detailCSS(c, S, theme) {
|
|
384
|
+
const d = c.details;
|
|
385
|
+
const rules = [];
|
|
386
|
+
// Raised specificity so the skin's focus treatment wins over component defaults; width never drops below 2px.
|
|
387
|
+
const focus = `${theme} [data-dixy-skin]:focus-visible, ${theme} [data-dixy-skin] :focus-visible`;
|
|
388
|
+
if (d.focus === "double")
|
|
389
|
+
rules.push(`${focus} { outline-style:double; outline-width:4px; outline-offset:2px; }`);
|
|
390
|
+
if (d.focus === "dashed")
|
|
391
|
+
rules.push(`${focus} { outline-style:dashed; outline-width:2px; outline-offset:3px; }`);
|
|
392
|
+
if (d.focus === "glow")
|
|
393
|
+
rules.push(`${focus} { outline-width:2px; outline-offset:2px; box-shadow:0 0 0 6px ${mix("var(--dixy-color-border-focus)", 28)}; }`);
|
|
394
|
+
if (d.focus === "offset")
|
|
395
|
+
rules.push(`${focus} { outline-width:2px; outline-offset:5px; }`);
|
|
396
|
+
const lines = {
|
|
397
|
+
dashed: (a) => `repeating-linear-gradient(${a},${EDGE} 0 6px,transparent 6px 10px)`,
|
|
398
|
+
dotted: (a) => `repeating-linear-gradient(${a},${EDGE} 0 2px,transparent 2px 5px)`,
|
|
399
|
+
double: (a) => `linear-gradient(${a === "90deg" ? "180deg" : "90deg"},${EDGE} 0 1px,transparent 1px calc(100% - 1px),${EDGE} calc(100% - 1px))`,
|
|
400
|
+
groove: (a) => `linear-gradient(${a === "90deg" ? "180deg" : "90deg"},${mix(EDGE, 80)} 0 50%,${mix("#fff", 60)} 50%)`,
|
|
401
|
+
};
|
|
402
|
+
if (d.divider !== "line") {
|
|
403
|
+
const thick = d.divider === "double" ? "4px" : d.divider === "groove" ? "2px" : "";
|
|
404
|
+
rules.push(`${S(".dixy-separator", ':not([aria-orientation="vertical"])')} { background:${lines[d.divider]("90deg")}; ${thick ? `block-size:${thick};` : ""} }`, `${S(".dixy-separator", '[aria-orientation="vertical"]')} { background:${lines[d.divider]("180deg")}; ${thick ? `inline-size:${thick};` : ""} }`);
|
|
405
|
+
}
|
|
406
|
+
if (d.selection === "inverse")
|
|
407
|
+
rules.push(`${theme} ::selection { background:var(--dixy-color-base-12); color:var(--dixy-color-base-1); }`);
|
|
408
|
+
if (d.selection === "highlighter")
|
|
409
|
+
rules.push(`${theme} ::selection { background:${mix(ACCENT, 30, "#ffe96b")}; color:var(--dixy-color-base-12); }`);
|
|
410
|
+
if (d.scrollbar === "thin")
|
|
411
|
+
rules.push(`${theme} { scrollbar-width:thin; scrollbar-color:${EDGE} transparent; }`);
|
|
412
|
+
if (d.scrollbar === "accent")
|
|
413
|
+
rules.push(`${theme} { scrollbar-color:${ACCENT} ${mix(ACCENT, 12)}; }`);
|
|
414
|
+
if (d.iconStroke !== 2)
|
|
415
|
+
rules.push(`${theme} svg[stroke="currentColor"]:not(.dixy-skin-ornament svg) { stroke-width:${d.iconStroke}; }`);
|
|
416
|
+
return rules.join("\n ");
|
|
417
|
+
}
|
|
418
|
+
/** Gradient-only patterns: no image requests, and removed by reduced effects/contrast/transparency preferences. */
|
|
419
|
+
function backdropImage(pattern, s) {
|
|
420
|
+
const ink = "var(--dixy-skin-pattern-ink)";
|
|
421
|
+
const px = (n) => `${Math.round(n * s * 10) / 10}px`;
|
|
422
|
+
switch (pattern) {
|
|
423
|
+
case "none":
|
|
424
|
+
return "";
|
|
425
|
+
case "grid":
|
|
426
|
+
return `background-image:linear-gradient(${ink} 1px,transparent 1px),linear-gradient(90deg,${ink} 1px,transparent 1px); background-size:${px(28)} ${px(28)};`;
|
|
427
|
+
case "scanlines":
|
|
428
|
+
return `background-image:repeating-linear-gradient(0deg,${ink} 0 1px,transparent 1px ${px(4)});`;
|
|
429
|
+
case "sunburst":
|
|
430
|
+
return `background-image:repeating-conic-gradient(from 0deg at 50% 0%,${ink} 0 3deg,transparent 3deg ${Math.round(12 * s)}deg); -webkit-mask:radial-gradient(ellipse at 50% 0%,#000,transparent 75%); mask:radial-gradient(ellipse at 50% 0%,#000,transparent 75%);`;
|
|
431
|
+
case "caustics":
|
|
432
|
+
return `background-image:radial-gradient(ellipse 30% 18% at 20% 30%,${ink},transparent 70%),radial-gradient(ellipse 22% 30% at 70% 20%,${ink},transparent 70%),radial-gradient(ellipse 34% 20% at 55% 75%,${ink},transparent 70%),radial-gradient(ellipse 18% 26% at 15% 80%,${ink},transparent 70%); background-size:${px(520)} ${px(420)};`;
|
|
433
|
+
case "fibre":
|
|
434
|
+
return `background-image:repeating-linear-gradient(35deg,${ink} 0 1px,transparent 1px ${px(7)}),repeating-linear-gradient(-55deg,${ink} 0 1px,transparent 1px ${px(11)});`;
|
|
435
|
+
case "dots":
|
|
436
|
+
return `background-image:radial-gradient(${ink} 1.2px,transparent 1.7px); background-size:${px(20)} ${px(20)};`;
|
|
437
|
+
case "topo":
|
|
438
|
+
return `background-image:repeating-radial-gradient(circle at 28% 36%,transparent 0 ${px(14)},${ink} ${px(14)} ${px(15)}),repeating-radial-gradient(circle at 78% 72%,transparent 0 ${px(18)},${ink} ${px(18)} ${px(19)});`;
|
|
439
|
+
case "halftone":
|
|
440
|
+
return `background-image:radial-gradient(${ink} 32%,transparent 34%); background-size:${px(10)} ${px(10)}; -webkit-mask:linear-gradient(160deg,#000,transparent 70%); mask:linear-gradient(160deg,#000,transparent 70%);`;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function backdropCSS(c, theme) {
|
|
444
|
+
const image = backdropImage(c.backdrop.pattern, c.backdrop.scale);
|
|
445
|
+
if (!image)
|
|
446
|
+
return "";
|
|
447
|
+
return `
|
|
448
|
+
${theme}:not(.dixy-portal-scope)::before { content:""; position:absolute; inset:0; z-index:-1; pointer-events:none; border-radius:inherit; opacity:${c.backdrop.intensity}; --dixy-skin-pattern-ink:${mix(EDGE, 40)}; ${image} }
|
|
449
|
+
${theme}[data-effects="reduced"]::before { display:none; }
|
|
450
|
+
@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active) { ${theme}::before { display:none; } }`;
|
|
451
|
+
}
|
|
452
|
+
/** An explicit Square radius beats a control language's own corner shapes. */
|
|
453
|
+
function squareCSS(style, theme) {
|
|
454
|
+
if (style === "standard")
|
|
455
|
+
return "";
|
|
456
|
+
const square = `${theme}[data-radius="none"]`;
|
|
457
|
+
return `${square} :is(.dixy-switch-thumb,${trackParts},${fillParts})[data-dixy-skin], ${square} :is(.dixy-switch-root,${checks},${sliderThumb})[data-dixy-skin]::before { border-radius:0; }`;
|
|
458
|
+
}
|
|
459
|
+
/** Variables for the tokens layer (inherited by every part). */
|
|
460
|
+
export function characterTokenCSS(c) {
|
|
461
|
+
return typeVariables(c);
|
|
462
|
+
}
|
|
463
|
+
/** Rules for the components layer, all scoped to the skin's own parts. */
|
|
464
|
+
export function characterComponentCSS(c, theme, S) {
|
|
465
|
+
return [
|
|
466
|
+
controlCSS(c.controls, S),
|
|
467
|
+
squareCSS(c.controls, theme),
|
|
468
|
+
motionCSS(c, theme),
|
|
469
|
+
typeCSS(c, theme),
|
|
470
|
+
stateCSS(c.states, S, theme),
|
|
471
|
+
detailCSS(c, S, theme),
|
|
472
|
+
backdropCSS(c, theme),
|
|
473
|
+
chromeCSS(c.chrome, theme, S),
|
|
474
|
+
]
|
|
475
|
+
.filter((part) => part.trim())
|
|
476
|
+
.join("\n ");
|
|
477
|
+
}
|