dyeworks 0.0.1 → 1.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/CHANGELOG.md +26 -0
- package/README.md +132 -2
- package/dist/boot.d.ts +7 -0
- package/dist/boot.js +10 -0
- package/dist/chooser.d.ts +33 -0
- package/dist/chooser.js +99 -0
- package/dist/contract-check.d.ts +32 -0
- package/dist/contract-check.js +153 -0
- package/dist/internal/boot-text.d.ts +12 -0
- package/dist/internal/boot-text.js +23 -0
- package/dist/internal/resolve.d.ts +34 -0
- package/dist/internal/resolve.js +44 -0
- package/dist/react/IntensityControl.d.ts +8 -0
- package/dist/react/IntensityControl.js +14 -0
- package/dist/react/ThemeMenu.d.ts +5 -0
- package/dist/react/ThemeMenu.js +15 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +3 -0
- package/dist/react/useChooser.d.ts +3 -0
- package/dist/react/useChooser.js +11 -0
- package/dist/reference.html +73 -0
- package/dist/registry.d.ts +14 -0
- package/dist/registry.js +24 -0
- package/dist/themes.css +68 -0
- package/dist/tokens.css +36 -0
- package/dist/tokens.d.ts +3 -0
- package/dist/tokens.js +2 -0
- package/package.json +81 -5
- package/slots.css +90 -0
- package/slots.json +74 -0
- package/themes/default/theme.css +65 -0
- package/themes/default/theme.json +7 -0
- package/tokens.json +233 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChooser } from "./useChooser.js";
|
|
3
|
+
const SEP = ":";
|
|
4
|
+
/** A native `<select>` labelled "Theme" over the registry's menu options. Carries no style of its own. */
|
|
5
|
+
export function ThemeMenu({ chooser }) {
|
|
6
|
+
useChooser(chooser);
|
|
7
|
+
const options = chooser.registry.options();
|
|
8
|
+
const stored = chooser.get();
|
|
9
|
+
const theme = chooser.registry.themes.find((t) => t.id === stored.theme);
|
|
10
|
+
const scheme = theme && theme.schemes.length === 1 ? theme.schemes[0] : stored.scheme;
|
|
11
|
+
return (_jsxs("label", { children: ["Theme", " ", _jsx("select", { value: `${stored.theme}${SEP}${scheme}`, onChange: (e) => {
|
|
12
|
+
const [id, chosen] = e.currentTarget.value.split(SEP);
|
|
13
|
+
chooser.set({ theme: id, scheme: chosen });
|
|
14
|
+
}, children: options.map((o) => (_jsx("option", { value: `${o.theme}${SEP}${o.scheme}`, children: o.label }, `${o.theme}${SEP}${o.scheme}`))) })] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
/** Re-render on every change the chooser announces; returns a key that changes with the choice. */
|
|
3
|
+
export function useChooser(chooser) {
|
|
4
|
+
const subscribe = useCallback((fn) => chooser.subscribe(fn), [chooser]);
|
|
5
|
+
const snapshot = () => {
|
|
6
|
+
const s = chooser.get();
|
|
7
|
+
const r = chooser.resolved();
|
|
8
|
+
return `${s.theme}|${s.scheme}|${s.intensity}|${r.scheme}`;
|
|
9
|
+
};
|
|
10
|
+
return useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
11
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!-- Generated by dyeworks scripts/build.mjs from tokens.json and slots.json; do not edit. -->
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>dyeworks: the Token contract</title>
|
|
7
|
+
<link rel="stylesheet" href="./tokens.css">
|
|
8
|
+
<style>
|
|
9
|
+
body { margin: 2rem auto; max-width: 72rem; padding: 0 1.5rem; background: var(--bg); color: var(--fg); font-family: var(--font-sans); line-height: 1.5; }
|
|
10
|
+
table { border-collapse: collapse; width: 100%; margin-bottom: 2rem; }
|
|
11
|
+
th, td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
|
|
12
|
+
th { color: var(--muted); font-weight: 600; }
|
|
13
|
+
code { font-family: var(--font-mono); font-size: 0.9em; }
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<h1>The Token contract</h1>
|
|
18
|
+
<p>Format <code>dyeworks-tokens/1</code>; Schemes <code>light</code>, <code>dark</code>. The default is the value the <code>default</code> Theme uses in its light Scheme.</p>
|
|
19
|
+
<table>
|
|
20
|
+
<thead><tr><th>Token</th><th>Tier</th><th>Type</th><th>Meaning</th><th>Default</th></tr></thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr><td><code>--bg</code></td><td>surface</td><td>color</td><td>The page's base surface.</td><td><code>#fcfcfd</code></td></tr>
|
|
23
|
+
<tr><td><code>--bg-raised</code></td><td>surface</td><td>color</td><td>A surface raised above the page, such as a card or panel.</td><td><code>#f3f4f7</code></td></tr>
|
|
24
|
+
<tr><td><code>--bg-sunken</code></td><td>surface</td><td>color</td><td>A surface set into the page, such as a well or code block.</td><td><code>#e9ebf0</code></td></tr>
|
|
25
|
+
<tr><td><code>--fg</code></td><td>surface</td><td>color</td><td>The main text colour.</td><td><code>#16181d</code></td></tr>
|
|
26
|
+
<tr><td><code>--muted</code></td><td>surface</td><td>color</td><td>Secondary text such as captions, hints and timestamps.</td><td><code>#656b7a</code></td></tr>
|
|
27
|
+
<tr><td><code>--border</code></td><td>surface</td><td>color</td><td>Lines that separate or outline surfaces.</td><td><code>#d9dce3</code></td></tr>
|
|
28
|
+
<tr><td><code>--accent</code></td><td>surface</td><td>color</td><td>The interactive colour of links, focus and primary controls.</td><td><code>#3246c8</code></td></tr>
|
|
29
|
+
<tr><td><code>--accent-fg</code></td><td>surface</td><td>color</td><td>Text and icons drawn on an accent fill.</td><td><code>#ffffff</code></td></tr>
|
|
30
|
+
<tr><td><code>--selected</code></td><td>surface</td><td>color</td><td>The background of a selected item.</td><td><code>#e6eafb</code></td></tr>
|
|
31
|
+
<tr><td><code>--radius</code></td><td>surface</td><td>length</td><td>The corner radius of surfaces and controls.</td><td><code>8px</code></td></tr>
|
|
32
|
+
<tr><td><code>--font-sans</code></td><td>surface</td><td>font_family</td><td>The body typeface.</td><td><code>system-ui, -apple-system, sans-serif</code></td></tr>
|
|
33
|
+
<tr><td><code>--font-mono</code></td><td>surface</td><td>font_family</td><td>The monospaced typeface for code and identifiers.</td><td><code>ui-monospace, "SF Mono", Menlo, monospace</code></td></tr>
|
|
34
|
+
<tr><td><code>--series-1</code></td><td>data</td><td>color</td><td>Categorical colour 1 of three, for kinds of thing shown together.</td><td><code>#3246c8</code></td></tr>
|
|
35
|
+
<tr><td><code>--series-2</code></td><td>data</td><td>color</td><td>Categorical colour 2 of three, for kinds of thing shown together.</td><td><code>#1f7a45</code></td></tr>
|
|
36
|
+
<tr><td><code>--series-3</code></td><td>data</td><td>color</td><td>Categorical colour 3 of three, for kinds of thing shown together.</td><td><code>#b83c0a</code></td></tr>
|
|
37
|
+
<tr><td><code>--state-active</code></td><td>data</td><td>color</td><td>The state colour of something in progress.</td><td><code>#1a63b8</code></td></tr>
|
|
38
|
+
<tr><td><code>--state-quiet</code></td><td>data</td><td>color</td><td>The state colour of something idle, paused or waiting without need of attention.</td><td><code>#5f6572</code></td></tr>
|
|
39
|
+
<tr><td><code>--state-attention</code></td><td>data</td><td>color</td><td>The state colour of something that needs a person's attention.</td><td><code>#a85400</code></td></tr>
|
|
40
|
+
<tr><td><code>--state-success</code></td><td>data</td><td>color</td><td>The state colour of something that ended well.</td><td><code>#1f7a45</code></td></tr>
|
|
41
|
+
<tr><td><code>--state-failure</code></td><td>data</td><td>color</td><td>The state colour of something that ended in failure.</td><td><code>#c22a2a</code></td></tr>
|
|
42
|
+
<tr><td><code>--state-halted</code></td><td>data</td><td>color</td><td>The state colour of something deliberately stopped before it ended.</td><td><code>#5b3cc4</code></td></tr>
|
|
43
|
+
<tr><td><code>--danger</code></td><td>data</td><td>color</td><td>Destructive actions and error text.</td><td><code>#c22a2a</code></td></tr>
|
|
44
|
+
<tr><td><code>--warning-bg</code></td><td>data</td><td>color</td><td>The background of a warning notice.</td><td><code>#fff3df</code></td></tr>
|
|
45
|
+
<tr><td><code>--warning-fg</code></td><td>data</td><td>color</td><td>The text of a warning notice.</td><td><code>#874800</code></td></tr>
|
|
46
|
+
<tr><td><code>--glow</code></td><td>decoration</td><td>box_shadow</td><td>The glow around a primary action and an active navigation underline.</td><td><code>none</code></td></tr>
|
|
47
|
+
<tr><td><code>--glow-svg</code></td><td>decoration</td><td>filter</td><td>The filter applied to a selected mark.</td><td><code>none</code></td></tr>
|
|
48
|
+
<tr><td><code>--accent-gradient</code></td><td>decoration</td><td>background_image</td><td>The fill of a primary action and an active navigation underline.</td><td><code>var(--accent)</code></td></tr>
|
|
49
|
+
<tr><td><code>--font-display</code></td><td>decoration</td><td>font_family</td><td>The typeface of wordmarks, headings and counts.</td><td><code>var(--font-sans)</code></td></tr>
|
|
50
|
+
<tr><td><code>--asset-backdrop</code></td><td>decoration</td><td>image</td><td>The image behind all content.</td><td><code>none</code></td></tr>
|
|
51
|
+
<tr><td><code>--asset-ornament</code></td><td>decoration</td><td>image</td><td>A small decorative image beside a wordmark or heading.</td><td><code>none</code></td></tr>
|
|
52
|
+
<tr><td><code>--asset-empty</code></td><td>decoration</td><td>image</td><td>The illustration shown where there is nothing to show.</td><td><code>none</code></td></tr>
|
|
53
|
+
<tr><td><code>--asset-opacity</code></td><td>decoration</td><td>number</td><td>The opacity of the backdrop and ornament images.</td><td><code>1</code></td></tr>
|
|
54
|
+
</tbody>
|
|
55
|
+
</table>
|
|
56
|
+
<h2>The Slot vocabulary</h2>
|
|
57
|
+
<p>Format <code>dyeworks-slots/1</code>. <code>slots.css</code> implements each treatment on <code>[data-slot="<kind>"]</code>.</p>
|
|
58
|
+
<table>
|
|
59
|
+
<thead><tr><th>Kind</th><th>Reads</th><th>Treatment</th></tr></thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr><td><code>backdrop</code></td><td><code>--asset-backdrop</code>, <code>--asset-opacity</code></td><td>The image covers the viewport, centred, below all content, at --asset-opacity.</td></tr>
|
|
62
|
+
<tr><td><code>ornament</code></td><td><code>--asset-ornament</code>, <code>--asset-opacity</code></td><td>A 28 by 28 CSS px image at --asset-opacity; absent when --asset-ornament is none.</td></tr>
|
|
63
|
+
<tr><td><code>wordmark</code></td><td><code>--font-display</code></td><td>The display face only; the colour stays --fg.</td></tr>
|
|
64
|
+
<tr><td><code>heading</code></td><td><code>--font-display</code></td><td>The display face only.</td></tr>
|
|
65
|
+
<tr><td><code>count</code></td><td><code>--font-display</code></td><td>The display face only, with tabular figures.</td></tr>
|
|
66
|
+
<tr><td><code>primary_action</code></td><td><code>--accent-gradient</code>, <code>--glow</code>, <code>--accent-fg</code></td><td>Filled with --accent-gradient, --accent-fg text, --glow as its box-shadow.</td></tr>
|
|
67
|
+
<tr><td><code>active_navigation</code></td><td><code>--accent-gradient</code>, <code>--glow</code></td><td>A 2 px underline painted with --accent-gradient, with --glow on the underline.</td></tr>
|
|
68
|
+
<tr><td><code>selected_mark</code></td><td><code>--glow-svg</code>, <code>--selected</code></td><td>--glow-svg as the filter of the selected element only; --selected as its fill where it has one.</td></tr>
|
|
69
|
+
<tr><td><code>empty_illustration</code></td><td><code>--asset-empty</code></td><td>--asset-empty shown at most 320 CSS px wide; not scaled by Intensity.</td></tr>
|
|
70
|
+
</tbody>
|
|
71
|
+
</table>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The types of the generated registry module (dist/registry.js); the build copies this file to dist/registry.d.ts.
|
|
2
|
+
export type Scheme = "light" | "dark";
|
|
3
|
+
export interface AssetEntry { fallback: string; image?: string }
|
|
4
|
+
export type Asset = AssetEntry | Partial<Record<Scheme, AssetEntry>>;
|
|
5
|
+
export interface ThemeEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
schemes: Scheme[];
|
|
9
|
+
intensity: boolean;
|
|
10
|
+
assets: Partial<Record<"backdrop" | "ornament" | "empty", Asset>>;
|
|
11
|
+
}
|
|
12
|
+
export interface ThemeOption { theme: string; scheme: Scheme | "auto"; label: string }
|
|
13
|
+
export declare const themes: ThemeEntry[];
|
|
14
|
+
export declare function options(): ThemeOption[];
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by dyeworks scripts/build.mjs from the Theme directories; do not edit.
|
|
2
|
+
|
|
3
|
+
/** Every Theme, in directory order with `default` first. */
|
|
4
|
+
export const themes = [
|
|
5
|
+
{
|
|
6
|
+
"id": "default",
|
|
7
|
+
"label": "Default",
|
|
8
|
+
"schemes": [
|
|
9
|
+
"light",
|
|
10
|
+
"dark"
|
|
11
|
+
],
|
|
12
|
+
"intensity": false,
|
|
13
|
+
"assets": {}
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
/** The menu options: one per single-Scheme Theme; auto, light and dark for a Theme with both. */
|
|
18
|
+
export function options() {
|
|
19
|
+
return themes.flatMap((t) =>
|
|
20
|
+
t.schemes.length === 1
|
|
21
|
+
? [{ theme: t.id, scheme: t.schemes[0], label: t.label }]
|
|
22
|
+
: ["auto", "light", "dark"].map((scheme) => ({ theme: t.id, scheme, label: `${t.label} · ${scheme}` })),
|
|
23
|
+
);
|
|
24
|
+
}
|
package/dist/themes.css
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* Generated by dyeworks scripts/build.mjs from the repository's sources; do not edit. */
|
|
2
|
+
|
|
3
|
+
/* themes/default/theme.css */
|
|
4
|
+
/* default: the plain Theme on system fonts, light and dark. Decoration Tokens stay at the contract defaults. */
|
|
5
|
+
|
|
6
|
+
html[data-theme="default"] {
|
|
7
|
+
--radius: 8px;
|
|
8
|
+
--font-sans: system-ui, -apple-system, sans-serif;
|
|
9
|
+
--font-mono: ui-monospace, "SF Mono", Menlo, monospace;
|
|
10
|
+
--glow: none;
|
|
11
|
+
--glow-svg: none;
|
|
12
|
+
--accent-gradient: var(--accent);
|
|
13
|
+
--font-display: var(--font-sans);
|
|
14
|
+
--asset-backdrop: none;
|
|
15
|
+
--asset-ornament: none;
|
|
16
|
+
--asset-empty: none;
|
|
17
|
+
--asset-opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
html[data-theme="default"][data-scheme="light"] {
|
|
21
|
+
color-scheme: light;
|
|
22
|
+
--bg: #fcfcfd;
|
|
23
|
+
--bg-raised: #f3f4f7;
|
|
24
|
+
--bg-sunken: #e9ebf0;
|
|
25
|
+
--fg: #16181d;
|
|
26
|
+
--muted: #656b7a;
|
|
27
|
+
--border: #d9dce3;
|
|
28
|
+
--accent: #3246c8;
|
|
29
|
+
--accent-fg: #ffffff;
|
|
30
|
+
--selected: #e6eafb;
|
|
31
|
+
--series-1: #3246c8;
|
|
32
|
+
--series-2: #1f7a45;
|
|
33
|
+
--series-3: #b83c0a;
|
|
34
|
+
--state-active: #1a63b8;
|
|
35
|
+
--state-quiet: #5f6572;
|
|
36
|
+
--state-attention: #a85400;
|
|
37
|
+
--state-success: #1f7a45;
|
|
38
|
+
--state-failure: #c22a2a;
|
|
39
|
+
--state-halted: #5b3cc4;
|
|
40
|
+
--danger: #c22a2a;
|
|
41
|
+
--warning-bg: #fff3df;
|
|
42
|
+
--warning-fg: #874800;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
html[data-theme="default"][data-scheme="dark"] {
|
|
46
|
+
color-scheme: dark;
|
|
47
|
+
--bg: #14161c;
|
|
48
|
+
--bg-raised: #1c1f27;
|
|
49
|
+
--bg-sunken: #0f1116;
|
|
50
|
+
--fg: #eceef3;
|
|
51
|
+
--muted: #9aa1b0;
|
|
52
|
+
--border: #30343f;
|
|
53
|
+
--accent: #8a98ff;
|
|
54
|
+
--accent-fg: #0d0f14;
|
|
55
|
+
--selected: #2a2f4a;
|
|
56
|
+
--series-1: #8a98ff;
|
|
57
|
+
--series-2: #5fd38a;
|
|
58
|
+
--series-3: #ff9f66;
|
|
59
|
+
--state-active: #58aef5;
|
|
60
|
+
--state-quiet: #a3a9b6;
|
|
61
|
+
--state-attention: #ffb257;
|
|
62
|
+
--state-success: #5fd38a;
|
|
63
|
+
--state-failure: #ff6f6f;
|
|
64
|
+
--state-halted: #b59cff;
|
|
65
|
+
--danger: #ff6f6f;
|
|
66
|
+
--warning-bg: #3a2a12;
|
|
67
|
+
--warning-fg: #ffc47a;
|
|
68
|
+
}
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* Generated by dyeworks scripts/build.mjs from the repository's sources; do not edit. */
|
|
2
|
+
:root {
|
|
3
|
+
color-scheme: light;
|
|
4
|
+
--bg: #fcfcfd;
|
|
5
|
+
--bg-raised: #f3f4f7;
|
|
6
|
+
--bg-sunken: #e9ebf0;
|
|
7
|
+
--fg: #16181d;
|
|
8
|
+
--muted: #656b7a;
|
|
9
|
+
--border: #d9dce3;
|
|
10
|
+
--accent: #3246c8;
|
|
11
|
+
--accent-fg: #ffffff;
|
|
12
|
+
--selected: #e6eafb;
|
|
13
|
+
--radius: 8px;
|
|
14
|
+
--font-sans: system-ui, -apple-system, sans-serif;
|
|
15
|
+
--font-mono: ui-monospace, "SF Mono", Menlo, monospace;
|
|
16
|
+
--series-1: #3246c8;
|
|
17
|
+
--series-2: #1f7a45;
|
|
18
|
+
--series-3: #b83c0a;
|
|
19
|
+
--state-active: #1a63b8;
|
|
20
|
+
--state-quiet: #5f6572;
|
|
21
|
+
--state-attention: #a85400;
|
|
22
|
+
--state-success: #1f7a45;
|
|
23
|
+
--state-failure: #c22a2a;
|
|
24
|
+
--state-halted: #5b3cc4;
|
|
25
|
+
--danger: #c22a2a;
|
|
26
|
+
--warning-bg: #fff3df;
|
|
27
|
+
--warning-fg: #874800;
|
|
28
|
+
--glow: none;
|
|
29
|
+
--glow-svg: none;
|
|
30
|
+
--accent-gradient: var(--accent);
|
|
31
|
+
--font-display: var(--font-sans);
|
|
32
|
+
--asset-backdrop: none;
|
|
33
|
+
--asset-ornament: none;
|
|
34
|
+
--asset-empty: none;
|
|
35
|
+
--asset-opacity: 1;
|
|
36
|
+
}
|
package/dist/tokens.d.ts
ADDED
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Generated by dyeworks scripts/build.mjs from tokens.json; do not edit.
|
|
2
|
+
export const tokenNames = ["--bg","--bg-raised","--bg-sunken","--fg","--muted","--border","--accent","--accent-fg","--selected","--radius","--font-sans","--font-mono","--series-1","--series-2","--series-3","--state-active","--state-quiet","--state-attention","--state-success","--state-failure","--state-halted","--danger","--warning-bg","--warning-fg","--glow","--glow-svg","--accent-gradient","--font-display","--asset-backdrop","--asset-ornament","--asset-empty","--asset-opacity"];
|
package/package.json
CHANGED
|
@@ -1,9 +1,85 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dyeworks",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A theme library: one Token contract, a Slot vocabulary and Themes as directories, for any web framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/vertix-solutions/dyeworks.git"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"*.css"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
"./tokens.css": "./dist/tokens.css",
|
|
19
|
+
"./themes.css": "./dist/themes.css",
|
|
20
|
+
"./slots.css": "./slots.css",
|
|
21
|
+
"./registry": {
|
|
22
|
+
"types": "./dist/registry.d.ts",
|
|
23
|
+
"default": "./dist/registry.js"
|
|
24
|
+
},
|
|
25
|
+
"./chooser": {
|
|
26
|
+
"types": "./dist/chooser.d.ts",
|
|
27
|
+
"default": "./dist/chooser.js"
|
|
28
|
+
},
|
|
29
|
+
"./boot": {
|
|
30
|
+
"types": "./dist/boot.d.ts",
|
|
31
|
+
"default": "./dist/boot.js"
|
|
32
|
+
},
|
|
33
|
+
"./react": {
|
|
34
|
+
"types": "./dist/react/index.d.ts",
|
|
35
|
+
"default": "./dist/react/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./contract-check": {
|
|
38
|
+
"types": "./dist/contract-check.d.ts",
|
|
39
|
+
"default": "./dist/contract-check.js"
|
|
40
|
+
},
|
|
41
|
+
"./tokens.json": "./tokens.json",
|
|
42
|
+
"./slots.json": "./slots.json",
|
|
43
|
+
"./themes/*": "./themes/*",
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"themes",
|
|
49
|
+
"tokens.json",
|
|
50
|
+
"slots.json",
|
|
51
|
+
"slots.css",
|
|
52
|
+
"README.md",
|
|
53
|
+
"CHANGELOG.md",
|
|
54
|
+
"LICENSE"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "node scripts/build.mjs",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"demo": "node scripts/build.mjs && node scripts/serve.mjs",
|
|
60
|
+
"screenshots": "node scripts/screenshots.mjs",
|
|
61
|
+
"theme-assets": "node scripts/theme_assets.mjs"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": ">=18"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"react": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@types/react": "19.3.0",
|
|
73
|
+
"@types/react-dom": "19.3.0",
|
|
74
|
+
"happy-dom": "21.0.4",
|
|
75
|
+
"playwright": "1.64.1",
|
|
76
|
+
"react": "19.3.1",
|
|
77
|
+
"react-dom": "19.3.1",
|
|
78
|
+
"sharp": "0.35.5",
|
|
79
|
+
"typescript": "7.0.2",
|
|
80
|
+
"vitest": "5.0.5"
|
|
81
|
+
},
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
}
|
|
9
85
|
}
|
package/slots.css
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* dyeworks Slot treatments. Apply data-slot="<kind>" at each Slot, or write the same treatment yourself.
|
|
2
|
+
Each rule reads contract Tokens only; under the default Theme every decoration is inert. */
|
|
3
|
+
|
|
4
|
+
[data-slot="backdrop"] {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
z-index: -1;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
background-image: var(--asset-backdrop);
|
|
10
|
+
background-position: center;
|
|
11
|
+
background-size: cover;
|
|
12
|
+
background-repeat: no-repeat;
|
|
13
|
+
opacity: var(--asset-opacity);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-slot="ornament"] {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
flex: none;
|
|
19
|
+
width: 28px;
|
|
20
|
+
height: 28px;
|
|
21
|
+
background-image: var(--asset-ornament);
|
|
22
|
+
background-position: center;
|
|
23
|
+
background-size: contain;
|
|
24
|
+
background-repeat: no-repeat;
|
|
25
|
+
opacity: var(--asset-opacity);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-slot="wordmark"] {
|
|
29
|
+
font-family: var(--font-display);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[data-slot="heading"] {
|
|
33
|
+
font-family: var(--font-display);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-slot="count"] {
|
|
37
|
+
font-family: var(--font-display);
|
|
38
|
+
font-variant-numeric: tabular-nums;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-slot="primary_action"] {
|
|
42
|
+
background: var(--accent-gradient);
|
|
43
|
+
color: var(--accent-fg);
|
|
44
|
+
box-shadow: var(--glow);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-slot="active_navigation"] {
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-slot="active_navigation"]::after {
|
|
52
|
+
content: "";
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
height: 2px;
|
|
58
|
+
background: var(--accent-gradient);
|
|
59
|
+
box-shadow: var(--glow);
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-slot="selected_mark"][data-selected="true"] {
|
|
64
|
+
filter: var(--glow-svg);
|
|
65
|
+
fill: var(--selected);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-slot="empty_illustration"] {
|
|
69
|
+
display: block;
|
|
70
|
+
width: 100%;
|
|
71
|
+
max-width: 320px;
|
|
72
|
+
aspect-ratio: 3 / 2;
|
|
73
|
+
background-image: var(--asset-empty);
|
|
74
|
+
background-position: center;
|
|
75
|
+
background-size: contain;
|
|
76
|
+
background-repeat: no-repeat;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* An image Slot whose Token is none takes no room (where style queries are supported). */
|
|
80
|
+
@container style(--asset-ornament: none) {
|
|
81
|
+
[data-slot="ornament"] {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@container style(--asset-empty: none) {
|
|
87
|
+
[data-slot="empty_illustration"] {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
package/slots.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "dyeworks-slots/1",
|
|
3
|
+
"slots": [
|
|
4
|
+
{
|
|
5
|
+
"kind": "backdrop",
|
|
6
|
+
"reads": [
|
|
7
|
+
"--asset-backdrop",
|
|
8
|
+
"--asset-opacity"
|
|
9
|
+
],
|
|
10
|
+
"treatment": "The image covers the viewport, centred, below all content, at --asset-opacity."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"kind": "ornament",
|
|
14
|
+
"reads": [
|
|
15
|
+
"--asset-ornament",
|
|
16
|
+
"--asset-opacity"
|
|
17
|
+
],
|
|
18
|
+
"treatment": "A 28 by 28 CSS px image at --asset-opacity; absent when --asset-ornament is none."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "wordmark",
|
|
22
|
+
"reads": [
|
|
23
|
+
"--font-display"
|
|
24
|
+
],
|
|
25
|
+
"treatment": "The display face only; the colour stays --fg."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"kind": "heading",
|
|
29
|
+
"reads": [
|
|
30
|
+
"--font-display"
|
|
31
|
+
],
|
|
32
|
+
"treatment": "The display face only."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"kind": "count",
|
|
36
|
+
"reads": [
|
|
37
|
+
"--font-display"
|
|
38
|
+
],
|
|
39
|
+
"treatment": "The display face only, with tabular figures."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"kind": "primary_action",
|
|
43
|
+
"reads": [
|
|
44
|
+
"--accent-gradient",
|
|
45
|
+
"--glow",
|
|
46
|
+
"--accent-fg"
|
|
47
|
+
],
|
|
48
|
+
"treatment": "Filled with --accent-gradient, --accent-fg text, --glow as its box-shadow."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "active_navigation",
|
|
52
|
+
"reads": [
|
|
53
|
+
"--accent-gradient",
|
|
54
|
+
"--glow"
|
|
55
|
+
],
|
|
56
|
+
"treatment": "A 2 px underline painted with --accent-gradient, with --glow on the underline."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"kind": "selected_mark",
|
|
60
|
+
"reads": [
|
|
61
|
+
"--glow-svg",
|
|
62
|
+
"--selected"
|
|
63
|
+
],
|
|
64
|
+
"treatment": "--glow-svg as the filter of the selected element only; --selected as its fill where it has one."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"kind": "empty_illustration",
|
|
68
|
+
"reads": [
|
|
69
|
+
"--asset-empty"
|
|
70
|
+
],
|
|
71
|
+
"treatment": "--asset-empty shown at most 320 CSS px wide; not scaled by Intensity."
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* default: the plain Theme on system fonts, light and dark. Decoration Tokens stay at the contract defaults. */
|
|
2
|
+
|
|
3
|
+
html[data-theme="default"] {
|
|
4
|
+
--radius: 8px;
|
|
5
|
+
--font-sans: system-ui, -apple-system, sans-serif;
|
|
6
|
+
--font-mono: ui-monospace, "SF Mono", Menlo, monospace;
|
|
7
|
+
--glow: none;
|
|
8
|
+
--glow-svg: none;
|
|
9
|
+
--accent-gradient: var(--accent);
|
|
10
|
+
--font-display: var(--font-sans);
|
|
11
|
+
--asset-backdrop: none;
|
|
12
|
+
--asset-ornament: none;
|
|
13
|
+
--asset-empty: none;
|
|
14
|
+
--asset-opacity: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html[data-theme="default"][data-scheme="light"] {
|
|
18
|
+
color-scheme: light;
|
|
19
|
+
--bg: #fcfcfd;
|
|
20
|
+
--bg-raised: #f3f4f7;
|
|
21
|
+
--bg-sunken: #e9ebf0;
|
|
22
|
+
--fg: #16181d;
|
|
23
|
+
--muted: #656b7a;
|
|
24
|
+
--border: #d9dce3;
|
|
25
|
+
--accent: #3246c8;
|
|
26
|
+
--accent-fg: #ffffff;
|
|
27
|
+
--selected: #e6eafb;
|
|
28
|
+
--series-1: #3246c8;
|
|
29
|
+
--series-2: #1f7a45;
|
|
30
|
+
--series-3: #b83c0a;
|
|
31
|
+
--state-active: #1a63b8;
|
|
32
|
+
--state-quiet: #5f6572;
|
|
33
|
+
--state-attention: #a85400;
|
|
34
|
+
--state-success: #1f7a45;
|
|
35
|
+
--state-failure: #c22a2a;
|
|
36
|
+
--state-halted: #5b3cc4;
|
|
37
|
+
--danger: #c22a2a;
|
|
38
|
+
--warning-bg: #fff3df;
|
|
39
|
+
--warning-fg: #874800;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
html[data-theme="default"][data-scheme="dark"] {
|
|
43
|
+
color-scheme: dark;
|
|
44
|
+
--bg: #14161c;
|
|
45
|
+
--bg-raised: #1c1f27;
|
|
46
|
+
--bg-sunken: #0f1116;
|
|
47
|
+
--fg: #eceef3;
|
|
48
|
+
--muted: #9aa1b0;
|
|
49
|
+
--border: #30343f;
|
|
50
|
+
--accent: #8a98ff;
|
|
51
|
+
--accent-fg: #0d0f14;
|
|
52
|
+
--selected: #2a2f4a;
|
|
53
|
+
--series-1: #8a98ff;
|
|
54
|
+
--series-2: #5fd38a;
|
|
55
|
+
--series-3: #ff9f66;
|
|
56
|
+
--state-active: #58aef5;
|
|
57
|
+
--state-quiet: #a3a9b6;
|
|
58
|
+
--state-attention: #ffb257;
|
|
59
|
+
--state-success: #5fd38a;
|
|
60
|
+
--state-failure: #ff6f6f;
|
|
61
|
+
--state-halted: #b59cff;
|
|
62
|
+
--danger: #ff6f6f;
|
|
63
|
+
--warning-bg: #3a2a12;
|
|
64
|
+
--warning-fg: #ffc47a;
|
|
65
|
+
}
|