@flairstudio/kit 0.2.0-beta.1 → 0.2.0-beta.2
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 +19 -1
- package/README.md +27 -10
- package/TOKENS.md +1 -1
- package/dist/fonts.css +1 -1
- package/dist/preview-host.d.ts +4 -4
- package/dist/preview-host.js +1 -1
- package/dist/preview.d.ts +3 -3
- package/dist/preview.js +75 -35
- package/dist/tokens.css +121 -121
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Renaming or removing a token is a breaking change. Adding a token, or changing a value, is a minor release. Before 1.0, a breaking change bumps the minor version.
|
|
4
4
|
|
|
5
|
+
## 0.2.0-beta.2
|
|
6
|
+
|
|
7
|
+
A beta, published under npm's `next` tag. `latest` stays at 0.1.0 until 0.2.0.
|
|
8
|
+
|
|
9
|
+
- **Changed, can break tests:** `tokens.css` writes every `--color-*` value, and each `@property` `initial-value`, as `color(srgb R G B)` instead of hex, and the preview writes a host's colours the same way. Hosts still send `#rrggbb`. Browsers fade a hex or `rgb()` colour in gamma-encoded sRGB, and between distant hues that passes through dark grey: the package's own fade between themes dipped. Chrome and Safari fade a `color(srgb …)` value in Oklab, which keeps its lightness. Firefox, checked in 159, fades it through sRGB as it does hex, so there the dip stays. `color()` needs Chrome 111, Firefox 113 or Safari 15, and an older browser drops the colours; hex worked in every browser. A script that reads a token with `getComputedStyle` and passes it to a colour parser now gets `color(srgb …)`, which some parsers don't read. The package's default colours, and the colours a host sends, now read back as `color(srgb …)` instead of `rgb(…)`, so a site test that matches them as `rgb()` strings needs updating. A site palette written in hex still reads back as `rgb(…)`. `tokens.json` and `TOKENS.md` stay hex.
|
|
10
|
+
- **Changed:** `listen()` checks its `allow` list before anything else, so a mistake throws a `TypeError` whether or not the page is in a frame. Before, outside a frame it was never checked.
|
|
11
|
+
- A string, such as `allow: 'https://flair.example'`, now throws, saying `allow` is a list. Before, it was split into characters, and the error named the first one.
|
|
12
|
+
- An empty list now throws, since no host could theme the page.
|
|
13
|
+
- A second `listen()` while one runs still changes nothing. If its `allow` holds other origins than the running one's, it now logs a console warning that the first list stands.
|
|
14
|
+
- **Changed:** in `preview-host.d.ts`, `Connection`'s `send` and `close` are typed as properties, `send: (theme: Theme) => void`, instead of methods. That matches the script, which returns them as plain functions, keeps `send`'s parameter strictly checked, and satisfies lint rules such as `unbound-method`.
|
|
15
|
+
- **Docs:** the README's opening names the layer order line, `@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;`, that `tokens.css` opens with.
|
|
16
|
+
- **Docs:** the published beta.1's README, changelog and a comment in `preview.js` said only Chrome and Safari name the parent's origin through `location.ancestorOrigins`, and that Firefox doesn't. Current Firefox does too. It names it `"null"` when the frame has `referrerpolicy="no-referrer"`, and there the listener sends `ready` to each allowed address, as it does where no origin is named. Nothing in the listener changed.
|
|
17
|
+
- **Docs:** the README's Playwright recipe, "Testing a site's pages with a Flair theme", now runs in Chromium. It failed there: Chromium's Local Network Access check blocked the framed site, because the host page comes from `page.route`. The test now grants `local-network-access` in Chromium only, since WebKit throws on that permission. The recipe also says `SITE` is the site's own address, ends with a sample check that the theme's mode reached the page, and says which lines need a cast in TypeScript.
|
|
18
|
+
- **Docs:** `onApplied` and the README's Playwright recipe no longer say `applied` means the frame is ready to be seen. It can come before the frame has drawn the theme: the listener sends it after two animation frames or after 500ms, whichever comes first. The recipe now waits two animation frames inside the frame after `applied`, before it checks the page. Found by a site's framed tests: 7 of 140 framed runs read the site's own palette without the wait, 0 of 280 with it.
|
|
19
|
+
- **Docs:** "A site's palette and overrides" warns that labels on primary can be dark in a Flair theme. The default theme's `on-primary` is black (5.61:1 on `#0d9488`, where white is 3.74:1), so a site that forces white labels or shades its primary fills toward black fails contrast under it.
|
|
20
|
+
- **Internal:** `preview.js` takes its theme selectors, event and attribute names, `--dur-theme` and its hold, `--gradient-angle` and the `--color-` prefix from the build, from the same places as `tokens.css` and the type declarations. This change alone changes no output.
|
|
21
|
+
- **Tests:** fixes to the package's own tests. None changes what the package does.
|
|
22
|
+
|
|
5
23
|
## 0.2.0-beta.1
|
|
6
24
|
|
|
7
25
|
A beta, published under npm's `next` tag. `latest` stays at 0.1.0 until 0.2.0.
|
|
8
26
|
|
|
9
27
|
- **Added:** FlairDesigner's local addresses, `http://localhost:3300` (its dev server) and `http://localhost:4330` (its tests), to `DEFAULT_ALLOW`. A page that FlairDesigner frames now needs no `allow` list of its own. Flair Design's two addresses stay.
|
|
10
28
|
- **Changed:** a message from the host that isn't flair-kit's, one whose `type` doesn't start with `flair-kit:`, such as a browser extension's, is now ignored without a word. In beta.0 it got a console warning and a `refused` answer with the reason `type`, so the host showed a refusal while the theme was on. An unknown `flair-kit:` type is still refused.
|
|
11
|
-
- **Changed:**
|
|
29
|
+
- **Changed:** where the browser names the parent's origin, as current Chrome, Safari and Firefox do, the listener now sends `ready` only to that origin, or to none if it isn't allowed. A framed page no longer logs a console warning for each other allowed address. Where the browser doesn't name the parent, or names it `"null"`, `ready` still goes to each allowed address.
|
|
12
30
|
- **Docs:** "Showing a site in Flair" in the README names FlairDesigner as the app that frames the page, and calls it the host.
|
|
13
31
|
- Two of its subheadings are renamed: "Which Flair may theme the page" is now "Which hosts may theme the page", and "Flair's side: `preview-host.js`" is now "The host's side: `preview-host.js`".
|
|
14
32
|
- The Playwright recipe's host address is now `HOST`, on `http://localhost:4330`, instead of `FLAIR`, on `http://localhost:4317`. Both are allowed, so a test copied from beta.0's recipe still runs.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# flair-kit
|
|
2
2
|
|
|
3
|
-
Published on npm as `@flairstudio/kit`. Design tokens as plain CSS: colours with light and dark modes, spacing, type sizes, radius, layers, motion and fonts. No build step is needed to use them. The colour names are the ones the Flair Design theme tool uses.
|
|
3
|
+
Published on npm as `@flairstudio/kit`. Design tokens as plain CSS: colours with light and dark modes, spacing, type sizes, radius, layers, motion and fonts. No build step is needed to use them. The colour names are the ones the Flair Design theme tool uses. `tokens.css` opens with the order of its cascade layers, `@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;`, and puts every token in the first (see "A site's palette and overrides").
|
|
4
4
|
- A Flair theme exported in the `data-theme` style becomes a site's palette file once it sits inside the palette layer (see below). Until Flair's Export writes that wrapper, add it by hand.
|
|
5
5
|
- Flair's `light-dark()` export can't be used that way, because it can't follow `data-theme`.
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Every token is listed in `TOKENS.md`, which ships in the package.
|
|
|
9
9
|
## Use it in a site with a build
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install @flairstudio/kit@0.2.0-beta.
|
|
12
|
+
npm install @flairstudio/kit@0.2.0-beta.2 --save-exact
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Import in this order:
|
|
@@ -69,6 +69,10 @@ Override a colour with those same three selectors. A colour set only on `:root`
|
|
|
69
69
|
- it misses every element with its own `data-theme`;
|
|
70
70
|
- alongside a palette file, `data-theme="dark"` on `<html>` picks it up, but the system's dark mode doesn't.
|
|
71
71
|
|
|
72
|
+
`tokens.css` writes every colour as `color(srgb R G B)`, each channel from 0 to 1, and the preview writes a host's colours the same way. Browsers fade a hex or `rgb()` colour through gamma-encoded sRGB, so a fade between distant hues dips through dark grey. Chrome and Safari fade a `color(srgb …)` value in Oklab, which keeps its lightness. Firefox, checked in 159, fades it through sRGB as it does hex, so there the dip stays. A palette file may still write hex, but write `color(srgb …)` for a fade between themes that keeps its lightness in Chrome and Safari. `color()` needs Chrome 111, Firefox 113 or Safari 15; an older browser drops the colours. The package's default colours, and the colours a host sends, read back as `color(srgb …)` when computed, not `rgb(…)`, so a test that compares them should use that form. So should a script that reads a token with `getComputedStyle` and passes it to a colour parser: some parsers read `rgb(…)` but not `color(…)`. A palette written in hex still reads back as `rgb(…)`.
|
|
73
|
+
|
|
74
|
+
Labels on a primary fill take `--color-on-primary`, and in a Flair theme that can be dark: the package's default theme has a primary of `#0d9488` with a black `on-primary` (5.61:1), where white would be 3.74:1. A site that forces white labels on primary, or shades a primary fill toward black, fails contrast under such a theme. Use `--color-on-primary` for the label and `--color-primary` for the fill, and test the site under the default theme.
|
|
75
|
+
|
|
72
76
|
Check colour values carefully. The colours are registered as `<color>`, so a misspelt value (`#1f2a3`, `banana`) doesn't fail loudly. The element quietly takes its parent's colour instead, which inside a `data-theme` region can mean a light colour in a dark region.
|
|
73
77
|
|
|
74
78
|
Every token declaration in the package sits in the `flair-kit.tokens` cascade layer. The `@property` registrations in `tokens.css` and the `@font-face` rules in `fonts.css` sit outside it by design, because neither needs overriding. A site's own CSS outside a layer always wins, whatever its selectors, so no override needs `!important`, and overrides stay outside a layer. From lowest to highest, the order is the package's defaults, the site's palette, components, the preview, then the site's unlayered CSS:
|
|
@@ -109,7 +113,7 @@ A site without a build, with `dist/` copied to `assets/flair-kit/`, after its st
|
|
|
109
113
|
</script>
|
|
110
114
|
```
|
|
111
115
|
|
|
112
|
-
Outside a frame, `listen()`
|
|
116
|
+
Outside a frame, `listen()` adds no listener and sends nothing, though it still checks its `allow` list (see below). Calling it again while it runs changes nothing, and it returns a function that stops it.
|
|
113
117
|
|
|
114
118
|
### Which hosts may theme the page
|
|
115
119
|
|
|
@@ -124,9 +128,11 @@ import('@flairstudio/kit/preview.js').then(({ listen, DEFAULT_ALLOW }) =>
|
|
|
124
128
|
listen({ allow: [...DEFAULT_ALLOW, 'https://flair.example'] }));
|
|
125
129
|
```
|
|
126
130
|
|
|
131
|
+
`allow` is a list, even of one address. `listen()` checks it first, framed or not, and throws a `TypeError` on a string, an empty list, or an address that isn't `http` or `https`. A second `listen()` while one runs keeps the first list: if its own `allow` holds other origins, it logs a console warning that the first list stands.
|
|
132
|
+
|
|
127
133
|
Addresses must match exactly: `http://127.0.0.1:3300` isn't `http://localhost:3300`. A message from any other address, or from a window that isn't the page's parent, is ignored without a word. So is a message from the host that isn't flair-kit's, one whose `type` doesn't start with `flair-kit:`, such as a browser extension's. Only colour names the package knows and `#rrggbb` values get through, so a message can't add any other CSS.
|
|
128
134
|
|
|
129
|
-
When it starts, the listener tells the page's parent it's ready. Chrome and
|
|
135
|
+
When it starts, the listener tells the page's parent it's ready. Current Chrome, Safari and Firefox name the parent's origin (`location.ancestorOrigins`), so there it sends to that origin alone, or to none if the origin isn't allowed. Where the browser doesn't name the parent, or names it `"null"` (Firefox does when the frame has `referrerpolicy="no-referrer"`), the listener sends to each allowed address, and the browser drops the ones that don't match. A browser may log a console warning for each one it drops.
|
|
130
136
|
|
|
131
137
|
### What the listener changes
|
|
132
138
|
|
|
@@ -154,7 +160,7 @@ document.addEventListener('flair-kit:preview', (event) => {
|
|
|
154
160
|
});
|
|
155
161
|
```
|
|
156
162
|
|
|
157
|
-
The host shows the page
|
|
163
|
+
The event fires once the theme is written, and the listeners run before the listener starts waiting to send `applied`. The host shows the page on `applied`, which comes after two animation frames, or after 500ms if the browser holds frames back, so a change made in the handler is in place by then, though the frame may not have drawn it yet (see "Testing a site's pages with a Flair theme").
|
|
158
164
|
|
|
159
165
|
### Two rules
|
|
160
166
|
|
|
@@ -171,7 +177,7 @@ import { connect } from '@flairstudio/kit/preview-host.js';
|
|
|
171
177
|
const { send, close } = connect(iframe, {
|
|
172
178
|
origin: 'http://localhost:5173', // the site's address
|
|
173
179
|
onReady: ({ kit, names }) => {}, // the frame's package version and colour names
|
|
174
|
-
onApplied: () => {}, // the theme is
|
|
180
|
+
onApplied: () => {}, // the theme is written; the frame may not have drawn it yet
|
|
175
181
|
onRefused: (reason) => {}, // a short code, such as 'value'
|
|
176
182
|
onMismatch: ({ host, frame }) => {}, // the frame speaks another format version
|
|
177
183
|
});
|
|
@@ -190,7 +196,7 @@ import { createRequire } from 'node:module';
|
|
|
190
196
|
import { dirname, join } from 'node:path';
|
|
191
197
|
|
|
192
198
|
const HOST = 'http://localhost:4330'; // an allowed address; nothing needs to run there
|
|
193
|
-
const SITE = 'http://localhost:5173/'; // the page under test
|
|
199
|
+
const SITE = 'http://localhost:5173/'; // the page under test: change it to your site's own address
|
|
194
200
|
const require = createRequire(import.meta.url);
|
|
195
201
|
const dist = dirname(require.resolve('@flairstudio/kit/preview-host.js'));
|
|
196
202
|
// The package's default palette; use a Flair export's values to test a real theme
|
|
@@ -209,7 +215,9 @@ const HOST_PAGE = `<!doctype html>
|
|
|
209
215
|
});
|
|
210
216
|
</script>`;
|
|
211
217
|
|
|
212
|
-
test('the home page wears a Flair theme', async ({ page }) => {
|
|
218
|
+
test('the home page wears a Flair theme', async ({ page, browserName }) => {
|
|
219
|
+
// Chromium's Local Network Access check blocks the framed site without this; WebKit doesn't know the permission
|
|
220
|
+
if (browserName === 'chromium') await page.context().grantPermissions(['local-network-access']);
|
|
213
221
|
await page.route(`${HOST}/**`, (route) => {
|
|
214
222
|
const { pathname } = new URL(route.request().url());
|
|
215
223
|
if (pathname === '/') return route.fulfill({ contentType: 'text/html', body: HOST_PAGE });
|
|
@@ -219,11 +227,20 @@ test('the home page wears a Flair theme', async ({ page }) => {
|
|
|
219
227
|
await page.evaluate((theme) => window.flairKit.host.send(theme), { light, dark, mode: 'dark', angle: 110 });
|
|
220
228
|
await expect.poll(() => page.evaluate(() => window.flairKit.applied)).toBeGreaterThan(0);
|
|
221
229
|
const site = page.frameLocator('iframe');
|
|
222
|
-
//
|
|
230
|
+
// `applied` can come before the frame has drawn the theme (see below), so let it draw two frames first
|
|
231
|
+
await site.locator('html').evaluate(
|
|
232
|
+
() => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done))),
|
|
233
|
+
);
|
|
234
|
+
await expect(site.locator('html')).toHaveAttribute('data-theme', 'dark');
|
|
235
|
+
// check the rest of the site's page through `site`
|
|
223
236
|
});
|
|
224
237
|
```
|
|
225
238
|
|
|
226
|
-
|
|
239
|
+
The `grantPermissions` line is there because the host page comes from `page.route`, so Chromium treats it as a page from outside the local network, and blocks its frame on `localhost`. Without it, the frame shows Chromium's error page and the test fails waiting for `applied`. To grant it for every test instead, add `permissions: ['local-network-access']` to the `use` of the Chromium project in `playwright.config`. Don't add it to the other projects: WebKit throws on a permission it doesn't know.
|
|
240
|
+
|
|
241
|
+
The two-frame wait is there because `applied` means the theme is written, not that the frame has drawn it. The listener sends `applied` after two animation frames, or after 500ms if the browser holds frames back, and a young frame under load can draw nothing for longer than that. Then the theme's colour transitions are still pending, and a page read straight after `applied` shows the site's own palette. Wait two animation frames inside the frame, as above, before checking colours.
|
|
242
|
+
|
|
243
|
+
In a TypeScript test, `window.flairKit` needs a cast in the two `page.evaluate` lines, such as `(window as any).flairKit`. The `window.flairKit` in `HOST_PAGE` is browser code in a string, so it needs none. Lint rules such as Biome's `noExplicitAny` warn on `as any`.
|
|
227
244
|
|
|
228
245
|
## Versions
|
|
229
246
|
|
package/TOKENS.md
CHANGED
package/dist/fonts.css
CHANGED
package/dist/preview-host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* flair-kit 0.2.0-beta.
|
|
1
|
+
/* flair-kit 0.2.0-beta.2 · generated from src/tokens.ts · do not edit */
|
|
2
2
|
|
|
3
3
|
import type { Colors, Mode } from './preview.js';
|
|
4
4
|
|
|
@@ -22,7 +22,7 @@ export interface ConnectOptions {
|
|
|
22
22
|
readonly origin: string;
|
|
23
23
|
/** The frame is listening: its package version and the colour names it accepts */
|
|
24
24
|
readonly onReady?: (info: ReadyInfo) => void;
|
|
25
|
-
/** The
|
|
25
|
+
/** The theme is written; the frame may not have drawn it yet (after two frames, or 500ms) */
|
|
26
26
|
readonly onApplied?: () => void;
|
|
27
27
|
/** The frame refused the theme, or shares no colour names with it ("name") */
|
|
28
28
|
readonly onRefused?: (reason: string) => void;
|
|
@@ -31,9 +31,9 @@ export interface ConnectOptions {
|
|
|
31
31
|
}
|
|
32
32
|
export interface Connection {
|
|
33
33
|
/** Checks the theme, keeps it, and sends it now and whenever the frame says ready again. Throws a TypeError on a theme the frame would refuse */
|
|
34
|
-
send(theme: Theme)
|
|
34
|
+
send: (theme: Theme) => void;
|
|
35
35
|
/** Stops listening to the frame */
|
|
36
|
-
close()
|
|
36
|
+
close: () => void;
|
|
37
37
|
}
|
|
38
38
|
/** Connects to the page in an <iframe> of a site */
|
|
39
39
|
export declare function connect(frame: HTMLIFrameElement, options: ConnectOptions): Connection;
|
package/dist/preview-host.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* flair-kit 0.2.0-beta.
|
|
1
|
+
/* flair-kit 0.2.0-beta.2 · generated from src/preview-host.js · do not edit */
|
|
2
2
|
|
|
3
3
|
// The host's side of the preview: frames a site's page and sends it the theme being edited. A site's own tests use
|
|
4
4
|
// it too, to put a Flair theme on their pages without the host running. The names and the checks come from
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* flair-kit 0.2.0-beta.
|
|
1
|
+
/* flair-kit 0.2.0-beta.2 · generated from src/tokens.ts · do not edit */
|
|
2
2
|
|
|
3
3
|
/** The package version this listener came from */
|
|
4
4
|
export declare const KIT_VERSION: string;
|
|
@@ -22,10 +22,10 @@ export type Colors = { readonly [N in ColorName]?: string };
|
|
|
22
22
|
export interface PreviewEventDetail { readonly mode: Mode; readonly first: boolean }
|
|
23
23
|
/** Options for listen() */
|
|
24
24
|
export interface ListenOptions {
|
|
25
|
-
/** The host addresses that may theme the page, as origins or page addresses. It replaces DEFAULT_ALLOW */
|
|
25
|
+
/** The host addresses that may theme the page, as origins or page addresses. It replaces DEFAULT_ALLOW. A string, an empty list or an address that isn't http or https throws a TypeError, framed or not */
|
|
26
26
|
readonly allow?: readonly string[];
|
|
27
27
|
}
|
|
28
|
-
/** Starts listening for the host if the page is in a frame, and returns a function that stops it. A second call while it runs returns the same function */
|
|
28
|
+
/** Starts listening for the host if the page is in a frame, and returns a function that stops it. A second call while it runs returns the same function and changes nothing; if its allow list differs, it logs a warning that the first stands */
|
|
29
29
|
export declare function listen(options?: ListenOptions): () => void;
|
|
30
30
|
/** Checks a theme's mode, angle and colours against `names`: the first reason it fails, or null. Never throws */
|
|
31
31
|
export declare function checkTheme(theme: unknown, names: readonly string[]): Reason | null;
|
package/dist/preview.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* flair-kit 0.2.0-beta.
|
|
1
|
+
/* flair-kit 0.2.0-beta.2 · generated from src/preview.js and src/tokens.ts · do not edit */
|
|
2
2
|
|
|
3
3
|
// Written by the build from src/tokens.ts and src/preview-format.ts
|
|
4
|
-
export const KIT_VERSION = "0.2.0-beta.
|
|
4
|
+
export const KIT_VERSION = "0.2.0-beta.2";
|
|
5
5
|
export const FORMAT_VERSION = 1;
|
|
6
6
|
export const COLOR_NAMES = Object.freeze(["background","card","muted","secondary","foreground","card-foreground","muted-foreground","on-secondary","border","outline","primary","on-primary","primary-hover","primary-pressed","primary-text","ring","tertiary","on-tertiary","accent-2","glow","destructive","on-destructive","chart-1","chart-2","chart-3","chart-4","brand","gradient-1","gradient-2","gradient-3"]);
|
|
7
7
|
export const DEFAULT_ALLOW = Object.freeze(["http://localhost:3000","http://localhost:4317","http://localhost:3300","http://localhost:4330"]);
|
|
@@ -9,17 +9,23 @@ export const MESSAGE_TYPES = Object.freeze({"ready":"flair-kit:ready","hello":"f
|
|
|
9
9
|
const MESSAGE_PREFIX = "flair-kit:";
|
|
10
10
|
const LAYER_ORDER = "@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;";
|
|
11
11
|
const PREVIEW_LAYER = "flair-kit.preview";
|
|
12
|
+
const THEME_SELECTORS = Object.freeze({"light":[":root","[data-theme=\"light\"]"],"dark":["[data-theme=\"dark\"]"],"systemMedia":"(prefers-color-scheme: dark)","systemDark":[":root:not([data-theme=\"light\"])"]});
|
|
13
|
+
const COLOR_PREFIX = "--color-";
|
|
14
|
+
const GRADIENT_ANGLE = "--gradient-angle";
|
|
15
|
+
const THEME_FADE = "--dur-theme";
|
|
16
|
+
const HOLD = "0.01ms";
|
|
17
|
+
const PREVIEW_EVENT = "flair-kit:preview";
|
|
18
|
+
const PREVIEW_ATTRIBUTE = "data-flair-preview";
|
|
12
19
|
|
|
13
20
|
// The listener that lets a host, such as FlairDesigner, show this page in its frame, wearing the theme being edited.
|
|
14
|
-
// KIT_VERSION, FORMAT_VERSION, COLOR_NAMES, DEFAULT_ALLOW, MESSAGE_TYPES, MESSAGE_PREFIX, LAYER_ORDER
|
|
15
|
-
//
|
|
21
|
+
// KIT_VERSION, FORMAT_VERSION, COLOR_NAMES, DEFAULT_ALLOW, MESSAGE_TYPES, MESSAGE_PREFIX, LAYER_ORDER, PREVIEW_LAYER,
|
|
22
|
+
// THEME_SELECTORS, COLOR_PREFIX, GRADIENT_ANGLE, THEME_FADE, HOLD, PREVIEW_EVENT and PREVIEW_ATTRIBUTE are written
|
|
23
|
+
// above this file by the build (scripts/lib/preview.ts), from the same places tokens.css and the types use.
|
|
24
|
+
// HOLD is reduced motion's fade: never 0s, so code waiting on a transition's end event still hears it.
|
|
25
|
+
// Nothing here runs until listen() is called.
|
|
16
26
|
|
|
17
27
|
const HEX = /^#[0-9a-f]{6}$/i;
|
|
18
28
|
const MODES = ['light', 'dark'];
|
|
19
|
-
const EVENT = 'flair-kit:preview';
|
|
20
|
-
const ATTRIBUTE = 'data-flair-preview';
|
|
21
|
-
/** Never 0s, so code waiting on a transition's end event still hears it */
|
|
22
|
-
const HOLD = '0.01ms';
|
|
23
29
|
/** applied waits for two animation frames; this stands behind them in case the browser holds frames back */
|
|
24
30
|
const APPLIED_FALLBACK_MS = 500;
|
|
25
31
|
|
|
@@ -28,28 +34,36 @@ const running = new WeakMap();
|
|
|
28
34
|
/** The listener's one <style> in each document, kept across a stop() and a fresh listen() */
|
|
29
35
|
const sheets = new WeakMap();
|
|
30
36
|
|
|
37
|
+
/**
|
|
38
|
+
* A checked #rrggbb, in either case, as color(srgb R G B), written as tokens.css writes its colours. Browsers fade
|
|
39
|
+
* hex in gamma-encoded sRGB, through dark grey between distant hues; Chrome and Safari fade color() in Oklab, which holds it.
|
|
40
|
+
*/
|
|
41
|
+
function srgb(hex) {
|
|
42
|
+
const channel = (at) => {
|
|
43
|
+
const byte = Number.parseInt(hex.slice(at, at + 2), 16);
|
|
44
|
+
return byte === 0 ? '0' : byte === 255 ? '1' : (byte / 255).toFixed(6);
|
|
45
|
+
};
|
|
46
|
+
return `color(srgb ${channel(1)} ${channel(3)} ${channel(5)})`;
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
/** The preview stylesheet, built only from checked names and values, in the frame's colour order */
|
|
32
50
|
function stylesheet({ light, dark, angle }) {
|
|
33
51
|
const names = COLOR_NAMES.filter((name) => Object.hasOwn(light, name));
|
|
34
|
-
|
|
52
|
+
/** A rule: its selectors, one per line, then color-scheme, the colours and any more lines, one level in */
|
|
53
|
+
const block = (selectors, scheme, values, more, pad) => [
|
|
54
|
+
...selectors.map((selector, i) => `${pad}${selector}${i < selectors.length - 1 ? ',' : ' {'}`),
|
|
55
|
+
`${pad} color-scheme: ${scheme};`,
|
|
56
|
+
...names.map((name) => `${pad} ${COLOR_PREFIX}${name}: ${srgb(values[name])};`),
|
|
57
|
+
...more.map((line) => `${pad} ${line}`),
|
|
58
|
+
`${pad}}`,
|
|
59
|
+
];
|
|
35
60
|
return [
|
|
36
61
|
LAYER_ORDER,
|
|
37
62
|
`@layer ${PREVIEW_LAYER} {`,
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
|
|
41
|
-
...
|
|
42
|
-
` --gradient-angle: ${angle}deg;`,
|
|
43
|
-
' }',
|
|
44
|
-
' [data-theme="dark"] {',
|
|
45
|
-
' color-scheme: dark;',
|
|
46
|
-
...colours(dark, ' '),
|
|
47
|
-
' }',
|
|
48
|
-
' @media (prefers-color-scheme: dark) {',
|
|
49
|
-
' :root:not([data-theme="light"]) {',
|
|
50
|
-
' color-scheme: dark;',
|
|
51
|
-
...colours(dark, ' '),
|
|
52
|
-
' }',
|
|
63
|
+
...block(THEME_SELECTORS.light, 'light', light, [`${GRADIENT_ANGLE}: ${angle}deg;`], ' '),
|
|
64
|
+
...block(THEME_SELECTORS.dark, 'dark', dark, [], ' '),
|
|
65
|
+
` @media ${THEME_SELECTORS.systemMedia} {`,
|
|
66
|
+
...block(THEME_SELECTORS.systemDark, 'dark', dark, [], ' '),
|
|
53
67
|
' }',
|
|
54
68
|
'}',
|
|
55
69
|
'',
|
|
@@ -70,11 +84,28 @@ function toOrigin(address) {
|
|
|
70
84
|
return url.origin;
|
|
71
85
|
}
|
|
72
86
|
|
|
87
|
+
/** The allow list as origins. A string or an empty list throws, as does any address that isn't http or https */
|
|
88
|
+
function allowedOrigins(allow) {
|
|
89
|
+
if (typeof allow === 'string') {
|
|
90
|
+
throw new TypeError(`flair-kit: listen()'s allow is a list of addresses, not a string: write allow: [${JSON.stringify(allow)}]`);
|
|
91
|
+
}
|
|
92
|
+
const origins = [...allow].map(toOrigin);
|
|
93
|
+
if (origins.length === 0) throw new TypeError("flair-kit: listen()'s allow lists no addresses, so no host could theme the page");
|
|
94
|
+
return origins;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** True when two lists of origins hold the same origins, in any order */
|
|
98
|
+
function sameOrigins(a, b) {
|
|
99
|
+
const first = new Set(a);
|
|
100
|
+
const second = new Set(b);
|
|
101
|
+
return first.size === second.size && [...first].every((origin) => second.has(origin));
|
|
102
|
+
}
|
|
103
|
+
|
|
73
104
|
const isColors = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
74
105
|
|
|
75
106
|
/**
|
|
76
107
|
* Checks a theme's mode, angle and colours: the first reason it fails, or null. Never throws.
|
|
77
|
-
* `names` are the colour names that may appear, without the
|
|
108
|
+
* `names` are the colour names that may appear, without the colour prefix.
|
|
78
109
|
*/
|
|
79
110
|
export function checkTheme(theme, names) {
|
|
80
111
|
if (theme === null || typeof theme !== 'object' || !MODES.includes(theme.mode)) return 'mode';
|
|
@@ -105,18 +136,27 @@ const readyMessage = () => ({ type: MESSAGE_TYPES.ready, v: FORMAT_VERSION, kit:
|
|
|
105
136
|
/**
|
|
106
137
|
* Starts listening for the host, if this page is inside a frame. Returns a function that stops it.
|
|
107
138
|
* `allow` lists the host addresses that may theme the page; without it, DEFAULT_ALLOW, the hosts' own local addresses.
|
|
108
|
-
*
|
|
139
|
+
* It's checked first, so a string, an empty list or an address that isn't http or https throws a TypeError, framed or not.
|
|
140
|
+
* Calling it again while it runs returns the same stop function and changes nothing. If that call's `allow` holds
|
|
141
|
+
* other origins than the running one's, it logs a console warning that the first list stands.
|
|
109
142
|
*/
|
|
110
143
|
export function listen(options = {}) {
|
|
144
|
+
const given = options?.allow ?? null;
|
|
145
|
+
const allow = allowedOrigins(given ?? DEFAULT_ALLOW);
|
|
111
146
|
const win = globalThis.window;
|
|
112
147
|
if (!win || win.self === win.top) return () => {};
|
|
113
148
|
const current = running.get(win);
|
|
114
|
-
if (current)
|
|
149
|
+
if (current) {
|
|
150
|
+
if (given !== null && !sameOrigins(allow, current.allow)) {
|
|
151
|
+
console.warn('flair-kit: listen() is already running, so its first allow list stands and this call changed nothing');
|
|
152
|
+
}
|
|
153
|
+
return current.stop;
|
|
154
|
+
}
|
|
115
155
|
|
|
116
|
-
const allow = [...(options.allow ?? DEFAULT_ALLOW)].map(toOrigin);
|
|
117
156
|
const post = (message, origin) => win.parent.postMessage(message, origin);
|
|
118
|
-
// Chrome and
|
|
119
|
-
// post fails with a console warning.
|
|
157
|
+
// Current Chrome, Safari and Firefox name the parent's origin, so ready goes there alone, or nowhere if it isn't
|
|
158
|
+
// allowed, and no post fails with a console warning. Where it's missing, or hidden as "null" (Firefox, under
|
|
159
|
+
// referrerpolicy="no-referrer"), ready goes to each allowed origin.
|
|
120
160
|
const parentOrigin = win.location?.ancestorOrigins?.[0];
|
|
121
161
|
const named = typeof parentOrigin === 'string' && parentOrigin !== 'null';
|
|
122
162
|
const readyTo = named ? allow.filter((origin) => origin === parentOrigin).slice(0, 1) : allow;
|
|
@@ -159,10 +199,10 @@ export function listen(options = {}) {
|
|
|
159
199
|
sheet.textContent = stylesheet(theme);
|
|
160
200
|
root.setAttribute('data-theme', theme.mode);
|
|
161
201
|
// A theme that lands before the first has been drawn keeps the hold too, or the first would fade after all
|
|
162
|
-
if (!firstDrawn || theme.instant === true) root.style.setProperty(
|
|
163
|
-
else root.style.removeProperty(
|
|
164
|
-
if (isFirst) root.setAttribute(
|
|
165
|
-
doc.dispatchEvent(new win.CustomEvent(
|
|
202
|
+
if (!firstDrawn || theme.instant === true) root.style.setProperty(THEME_FADE, HOLD);
|
|
203
|
+
else root.style.removeProperty(THEME_FADE);
|
|
204
|
+
if (isFirst) root.setAttribute(PREVIEW_ATTRIBUTE, '');
|
|
205
|
+
doc.dispatchEvent(new win.CustomEvent(PREVIEW_EVENT, { detail: { mode: theme.mode, first: isFirst } }));
|
|
166
206
|
afterTwoFrames(() => {
|
|
167
207
|
if (isFirst) firstDrawn = true;
|
|
168
208
|
post({ type: MESSAGE_TYPES.applied, v: FORMAT_VERSION }, origin);
|
|
@@ -213,7 +253,7 @@ export function listen(options = {}) {
|
|
|
213
253
|
if (running.get(win)?.stop === stop) running.delete(win);
|
|
214
254
|
};
|
|
215
255
|
|
|
216
|
-
running.set(win, { stop });
|
|
256
|
+
running.set(win, { stop, allow });
|
|
217
257
|
win.addEventListener('message', onMessage);
|
|
218
258
|
for (const origin of readyTo) post(readyMessage(), origin);
|
|
219
259
|
return stop;
|
package/dist/tokens.css
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
/* flair-kit 0.2.0-beta.
|
|
1
|
+
/* flair-kit 0.2.0-beta.2 · generated from src/tokens.ts · do not edit */
|
|
2
2
|
|
|
3
3
|
@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;
|
|
4
4
|
|
|
5
5
|
/* Registered so colours can fade between themes; inherits: true so a data-theme region gets its own values */
|
|
6
|
-
@property --color-background { syntax: '<color>'; inherits: true; initial-value:
|
|
7
|
-
@property --color-card { syntax: '<color>'; inherits: true; initial-value:
|
|
8
|
-
@property --color-muted { syntax: '<color>'; inherits: true; initial-value:
|
|
9
|
-
@property --color-secondary { syntax: '<color>'; inherits: true; initial-value:
|
|
10
|
-
@property --color-foreground { syntax: '<color>'; inherits: true; initial-value:
|
|
11
|
-
@property --color-card-foreground { syntax: '<color>'; inherits: true; initial-value:
|
|
12
|
-
@property --color-muted-foreground { syntax: '<color>'; inherits: true; initial-value:
|
|
13
|
-
@property --color-on-secondary { syntax: '<color>'; inherits: true; initial-value:
|
|
14
|
-
@property --color-border { syntax: '<color>'; inherits: true; initial-value:
|
|
15
|
-
@property --color-outline { syntax: '<color>'; inherits: true; initial-value:
|
|
16
|
-
@property --color-primary { syntax: '<color>'; inherits: true; initial-value:
|
|
17
|
-
@property --color-on-primary { syntax: '<color>'; inherits: true; initial-value:
|
|
18
|
-
@property --color-primary-hover { syntax: '<color>'; inherits: true; initial-value:
|
|
19
|
-
@property --color-primary-pressed { syntax: '<color>'; inherits: true; initial-value:
|
|
20
|
-
@property --color-primary-text { syntax: '<color>'; inherits: true; initial-value:
|
|
21
|
-
@property --color-ring { syntax: '<color>'; inherits: true; initial-value:
|
|
22
|
-
@property --color-tertiary { syntax: '<color>'; inherits: true; initial-value:
|
|
23
|
-
@property --color-on-tertiary { syntax: '<color>'; inherits: true; initial-value:
|
|
24
|
-
@property --color-accent-2 { syntax: '<color>'; inherits: true; initial-value:
|
|
25
|
-
@property --color-glow { syntax: '<color>'; inherits: true; initial-value:
|
|
26
|
-
@property --color-destructive { syntax: '<color>'; inherits: true; initial-value:
|
|
27
|
-
@property --color-on-destructive { syntax: '<color>'; inherits: true; initial-value:
|
|
28
|
-
@property --color-chart-1 { syntax: '<color>'; inherits: true; initial-value:
|
|
29
|
-
@property --color-chart-2 { syntax: '<color>'; inherits: true; initial-value:
|
|
30
|
-
@property --color-chart-3 { syntax: '<color>'; inherits: true; initial-value:
|
|
31
|
-
@property --color-chart-4 { syntax: '<color>'; inherits: true; initial-value:
|
|
32
|
-
@property --color-brand { syntax: '<color>'; inherits: true; initial-value:
|
|
33
|
-
@property --color-gradient-1 { syntax: '<color>'; inherits: true; initial-value:
|
|
34
|
-
@property --color-gradient-2 { syntax: '<color>'; inherits: true; initial-value:
|
|
35
|
-
@property --color-gradient-3 { syntax: '<color>'; inherits: true; initial-value:
|
|
6
|
+
@property --color-background { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.964706 0.980392 0.976471); }
|
|
7
|
+
@property --color-card { syntax: '<color>'; inherits: true; initial-value: color(srgb 1 1 1); }
|
|
8
|
+
@property --color-muted { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.925490 0.949020 0.945098); }
|
|
9
|
+
@property --color-secondary { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.941176 0.898039 0.929412); }
|
|
10
|
+
@property --color-foreground { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.098039 0.121569 0.117647); }
|
|
11
|
+
@property --color-card-foreground { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.098039 0.121569 0.117647); }
|
|
12
|
+
@property --color-muted-foreground { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.352941 0.396078 0.388235); }
|
|
13
|
+
@property --color-on-secondary { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.435294 0.074510 0.384314); }
|
|
14
|
+
@property --color-border { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.807843 0.839216 0.835294); }
|
|
15
|
+
@property --color-outline { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.447059 0.494118 0.486275); }
|
|
16
|
+
@property --color-primary { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.050980 0.580392 0.533333); }
|
|
17
|
+
@property --color-on-primary { syntax: '<color>'; inherits: true; initial-value: color(srgb 0 0 0); }
|
|
18
|
+
@property --color-primary-hover { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.078431 0.627451 0.576471); }
|
|
19
|
+
@property --color-primary-pressed { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.117647 0.670588 0.615686); }
|
|
20
|
+
@property --color-primary-text { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.035294 0.454902 0.415686); }
|
|
21
|
+
@property --color-ring { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.035294 0.454902 0.415686); }
|
|
22
|
+
@property --color-tertiary { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.725490 0.188235 0.031373); }
|
|
23
|
+
@property --color-on-tertiary { syntax: '<color>'; inherits: true; initial-value: color(srgb 1 1 1); }
|
|
24
|
+
@property --color-accent-2 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.925490 0.078431 0.823529); }
|
|
25
|
+
@property --color-glow { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.964706 0.721569 0.658824); }
|
|
26
|
+
@property --color-destructive { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.776471 0.062745 0.101961); }
|
|
27
|
+
@property --color-on-destructive { syntax: '<color>'; inherits: true; initial-value: color(srgb 1 1 1); }
|
|
28
|
+
@property --color-chart-1 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.039216 0.545098 0.501961); }
|
|
29
|
+
@property --color-chart-2 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.701961 0.058824 0.623529); }
|
|
30
|
+
@property --color-chart-3 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.584314 0.160784 0.047059); }
|
|
31
|
+
@property --color-chart-4 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.211765 0.250980 0.243137); }
|
|
32
|
+
@property --color-brand { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.050980 0.580392 0.533333); }
|
|
33
|
+
@property --color-gradient-1 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.050980 0.580392 0.533333); }
|
|
34
|
+
@property --color-gradient-2 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.925490 0.078431 0.823529); }
|
|
35
|
+
@property --color-gradient-3 { syntax: '<color>'; inherits: true; initial-value: color(srgb 0.964706 0.721569 0.658824); }
|
|
36
36
|
|
|
37
37
|
@layer flair-kit.tokens {
|
|
38
38
|
:root {
|
|
@@ -81,107 +81,107 @@
|
|
|
81
81
|
:root,
|
|
82
82
|
[data-theme="light"] {
|
|
83
83
|
color-scheme: light;
|
|
84
|
-
--color-background:
|
|
85
|
-
--color-card:
|
|
86
|
-
--color-muted:
|
|
87
|
-
--color-secondary:
|
|
88
|
-
--color-foreground:
|
|
89
|
-
--color-card-foreground:
|
|
90
|
-
--color-muted-foreground:
|
|
91
|
-
--color-on-secondary:
|
|
92
|
-
--color-border:
|
|
93
|
-
--color-outline:
|
|
94
|
-
--color-primary:
|
|
95
|
-
--color-on-primary:
|
|
96
|
-
--color-primary-hover:
|
|
97
|
-
--color-primary-pressed:
|
|
98
|
-
--color-primary-text:
|
|
99
|
-
--color-ring:
|
|
100
|
-
--color-tertiary:
|
|
101
|
-
--color-on-tertiary:
|
|
102
|
-
--color-accent-2:
|
|
103
|
-
--color-glow:
|
|
104
|
-
--color-destructive:
|
|
105
|
-
--color-on-destructive:
|
|
106
|
-
--color-chart-1:
|
|
107
|
-
--color-chart-2:
|
|
108
|
-
--color-chart-3:
|
|
109
|
-
--color-chart-4:
|
|
110
|
-
--color-brand:
|
|
111
|
-
--color-gradient-1:
|
|
112
|
-
--color-gradient-2:
|
|
113
|
-
--color-gradient-3:
|
|
84
|
+
--color-background: color(srgb 0.964706 0.980392 0.976471);
|
|
85
|
+
--color-card: color(srgb 1 1 1);
|
|
86
|
+
--color-muted: color(srgb 0.925490 0.949020 0.945098);
|
|
87
|
+
--color-secondary: color(srgb 0.941176 0.898039 0.929412);
|
|
88
|
+
--color-foreground: color(srgb 0.098039 0.121569 0.117647);
|
|
89
|
+
--color-card-foreground: color(srgb 0.098039 0.121569 0.117647);
|
|
90
|
+
--color-muted-foreground: color(srgb 0.352941 0.396078 0.388235);
|
|
91
|
+
--color-on-secondary: color(srgb 0.435294 0.074510 0.384314);
|
|
92
|
+
--color-border: color(srgb 0.807843 0.839216 0.835294);
|
|
93
|
+
--color-outline: color(srgb 0.447059 0.494118 0.486275);
|
|
94
|
+
--color-primary: color(srgb 0.050980 0.580392 0.533333);
|
|
95
|
+
--color-on-primary: color(srgb 0 0 0);
|
|
96
|
+
--color-primary-hover: color(srgb 0.078431 0.627451 0.576471);
|
|
97
|
+
--color-primary-pressed: color(srgb 0.117647 0.670588 0.615686);
|
|
98
|
+
--color-primary-text: color(srgb 0.035294 0.454902 0.415686);
|
|
99
|
+
--color-ring: color(srgb 0.035294 0.454902 0.415686);
|
|
100
|
+
--color-tertiary: color(srgb 0.725490 0.188235 0.031373);
|
|
101
|
+
--color-on-tertiary: color(srgb 1 1 1);
|
|
102
|
+
--color-accent-2: color(srgb 0.925490 0.078431 0.823529);
|
|
103
|
+
--color-glow: color(srgb 0.964706 0.721569 0.658824);
|
|
104
|
+
--color-destructive: color(srgb 0.776471 0.062745 0.101961);
|
|
105
|
+
--color-on-destructive: color(srgb 1 1 1);
|
|
106
|
+
--color-chart-1: color(srgb 0.039216 0.545098 0.501961);
|
|
107
|
+
--color-chart-2: color(srgb 0.701961 0.058824 0.623529);
|
|
108
|
+
--color-chart-3: color(srgb 0.584314 0.160784 0.047059);
|
|
109
|
+
--color-chart-4: color(srgb 0.211765 0.250980 0.243137);
|
|
110
|
+
--color-brand: color(srgb 0.050980 0.580392 0.533333);
|
|
111
|
+
--color-gradient-1: color(srgb 0.050980 0.580392 0.533333);
|
|
112
|
+
--color-gradient-2: color(srgb 0.925490 0.078431 0.823529);
|
|
113
|
+
--color-gradient-3: color(srgb 0.964706 0.721569 0.658824);
|
|
114
114
|
--gradient-angle: 110deg;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
[data-theme="dark"] {
|
|
118
118
|
color-scheme: dark;
|
|
119
|
-
--color-background:
|
|
120
|
-
--color-card:
|
|
121
|
-
--color-muted:
|
|
122
|
-
--color-secondary:
|
|
123
|
-
--color-foreground:
|
|
124
|
-
--color-card-foreground:
|
|
125
|
-
--color-muted-foreground:
|
|
126
|
-
--color-on-secondary:
|
|
127
|
-
--color-border:
|
|
128
|
-
--color-outline:
|
|
129
|
-
--color-primary:
|
|
130
|
-
--color-on-primary:
|
|
131
|
-
--color-primary-hover:
|
|
132
|
-
--color-primary-pressed:
|
|
133
|
-
--color-primary-text:
|
|
134
|
-
--color-ring:
|
|
135
|
-
--color-tertiary:
|
|
136
|
-
--color-on-tertiary:
|
|
137
|
-
--color-accent-2:
|
|
138
|
-
--color-glow:
|
|
139
|
-
--color-destructive:
|
|
140
|
-
--color-on-destructive:
|
|
141
|
-
--color-chart-1:
|
|
142
|
-
--color-chart-2:
|
|
143
|
-
--color-chart-3:
|
|
144
|
-
--color-chart-4:
|
|
145
|
-
--color-brand:
|
|
146
|
-
--color-gradient-1:
|
|
147
|
-
--color-gradient-2:
|
|
148
|
-
--color-gradient-3:
|
|
119
|
+
--color-background: color(srgb 0.062745 0.078431 0.074510);
|
|
120
|
+
--color-card: color(srgb 0.098039 0.121569 0.117647);
|
|
121
|
+
--color-muted: color(srgb 0.149020 0.176471 0.172549);
|
|
122
|
+
--color-secondary: color(srgb 0.345098 0.188235 0.313725);
|
|
123
|
+
--color-foreground: color(srgb 0.929412 0.945098 0.941176);
|
|
124
|
+
--color-card-foreground: color(srgb 0.929412 0.945098 0.941176);
|
|
125
|
+
--color-muted-foreground: color(srgb 0.694118 0.733333 0.725490);
|
|
126
|
+
--color-on-secondary: color(srgb 0.968627 0.886275 0.949020);
|
|
127
|
+
--color-border: color(srgb 0.282353 0.321569 0.313725);
|
|
128
|
+
--color-outline: color(srgb 0.572549 0.619608 0.611765);
|
|
129
|
+
--color-primary: color(srgb 0.050980 0.580392 0.533333);
|
|
130
|
+
--color-on-primary: color(srgb 0 0 0);
|
|
131
|
+
--color-primary-hover: color(srgb 0.078431 0.627451 0.576471);
|
|
132
|
+
--color-primary-pressed: color(srgb 0.117647 0.670588 0.615686);
|
|
133
|
+
--color-primary-text: color(srgb 0.188235 0.741176 0.686275);
|
|
134
|
+
--color-ring: color(srgb 0.188235 0.741176 0.686275);
|
|
135
|
+
--color-tertiary: color(srgb 0.964706 0.643137 0.560784);
|
|
136
|
+
--color-on-tertiary: color(srgb 0 0 0);
|
|
137
|
+
--color-accent-2: color(srgb 0.929412 0.074510 0.823529);
|
|
138
|
+
--color-glow: color(srgb 0.964706 0.721569 0.658824);
|
|
139
|
+
--color-destructive: color(srgb 0.968627 0.639216 0.603922);
|
|
140
|
+
--color-on-destructive: color(srgb 0 0 0);
|
|
141
|
+
--color-chart-1: color(srgb 0.125490 0.682353 0.627451);
|
|
142
|
+
--color-chart-2: color(srgb 0.968627 0.600000 0.890196);
|
|
143
|
+
--color-chart-3: color(srgb 0.960784 0.796078 0.752941);
|
|
144
|
+
--color-chart-4: color(srgb 0.447059 0.498039 0.490196);
|
|
145
|
+
--color-brand: color(srgb 0.050980 0.580392 0.533333);
|
|
146
|
+
--color-gradient-1: color(srgb 0.050980 0.580392 0.533333);
|
|
147
|
+
--color-gradient-2: color(srgb 0.929412 0.074510 0.823529);
|
|
148
|
+
--color-gradient-3: color(srgb 0.964706 0.721569 0.658824);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/* No data-theme attribute: follow the system */
|
|
152
152
|
@media (prefers-color-scheme: dark) {
|
|
153
153
|
:root:not([data-theme="light"]) {
|
|
154
154
|
color-scheme: dark;
|
|
155
|
-
--color-background:
|
|
156
|
-
--color-card:
|
|
157
|
-
--color-muted:
|
|
158
|
-
--color-secondary:
|
|
159
|
-
--color-foreground:
|
|
160
|
-
--color-card-foreground:
|
|
161
|
-
--color-muted-foreground:
|
|
162
|
-
--color-on-secondary:
|
|
163
|
-
--color-border:
|
|
164
|
-
--color-outline:
|
|
165
|
-
--color-primary:
|
|
166
|
-
--color-on-primary:
|
|
167
|
-
--color-primary-hover:
|
|
168
|
-
--color-primary-pressed:
|
|
169
|
-
--color-primary-text:
|
|
170
|
-
--color-ring:
|
|
171
|
-
--color-tertiary:
|
|
172
|
-
--color-on-tertiary:
|
|
173
|
-
--color-accent-2:
|
|
174
|
-
--color-glow:
|
|
175
|
-
--color-destructive:
|
|
176
|
-
--color-on-destructive:
|
|
177
|
-
--color-chart-1:
|
|
178
|
-
--color-chart-2:
|
|
179
|
-
--color-chart-3:
|
|
180
|
-
--color-chart-4:
|
|
181
|
-
--color-brand:
|
|
182
|
-
--color-gradient-1:
|
|
183
|
-
--color-gradient-2:
|
|
184
|
-
--color-gradient-3:
|
|
155
|
+
--color-background: color(srgb 0.062745 0.078431 0.074510);
|
|
156
|
+
--color-card: color(srgb 0.098039 0.121569 0.117647);
|
|
157
|
+
--color-muted: color(srgb 0.149020 0.176471 0.172549);
|
|
158
|
+
--color-secondary: color(srgb 0.345098 0.188235 0.313725);
|
|
159
|
+
--color-foreground: color(srgb 0.929412 0.945098 0.941176);
|
|
160
|
+
--color-card-foreground: color(srgb 0.929412 0.945098 0.941176);
|
|
161
|
+
--color-muted-foreground: color(srgb 0.694118 0.733333 0.725490);
|
|
162
|
+
--color-on-secondary: color(srgb 0.968627 0.886275 0.949020);
|
|
163
|
+
--color-border: color(srgb 0.282353 0.321569 0.313725);
|
|
164
|
+
--color-outline: color(srgb 0.572549 0.619608 0.611765);
|
|
165
|
+
--color-primary: color(srgb 0.050980 0.580392 0.533333);
|
|
166
|
+
--color-on-primary: color(srgb 0 0 0);
|
|
167
|
+
--color-primary-hover: color(srgb 0.078431 0.627451 0.576471);
|
|
168
|
+
--color-primary-pressed: color(srgb 0.117647 0.670588 0.615686);
|
|
169
|
+
--color-primary-text: color(srgb 0.188235 0.741176 0.686275);
|
|
170
|
+
--color-ring: color(srgb 0.188235 0.741176 0.686275);
|
|
171
|
+
--color-tertiary: color(srgb 0.964706 0.643137 0.560784);
|
|
172
|
+
--color-on-tertiary: color(srgb 0 0 0);
|
|
173
|
+
--color-accent-2: color(srgb 0.929412 0.074510 0.823529);
|
|
174
|
+
--color-glow: color(srgb 0.964706 0.721569 0.658824);
|
|
175
|
+
--color-destructive: color(srgb 0.968627 0.639216 0.603922);
|
|
176
|
+
--color-on-destructive: color(srgb 0 0 0);
|
|
177
|
+
--color-chart-1: color(srgb 0.125490 0.682353 0.627451);
|
|
178
|
+
--color-chart-2: color(srgb 0.968627 0.600000 0.890196);
|
|
179
|
+
--color-chart-3: color(srgb 0.960784 0.796078 0.752941);
|
|
180
|
+
--color-chart-4: color(srgb 0.447059 0.498039 0.490196);
|
|
181
|
+
--color-brand: color(srgb 0.050980 0.580392 0.533333);
|
|
182
|
+
--color-gradient-1: color(srgb 0.050980 0.580392 0.533333);
|
|
183
|
+
--color-gradient-2: color(srgb 0.929412 0.074510 0.823529);
|
|
184
|
+
--color-gradient-3: color(srgb 0.964706 0.721569 0.658824);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
package/dist/tokens.json
CHANGED
package/package.json
CHANGED