@flairstudio/kit 0.0.0-stage → 0.2.0-beta.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 +15 -0
- package/LICENSE +24 -0
- package/README.md +227 -2
- package/TOKENS.md +195 -0
- package/dist/fonts/OFL.txt +93 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts.css +19 -0
- package/dist/preview-host.d.ts +39 -0
- package/dist/preview-host.js +94 -0
- package/dist/preview.d.ts +37 -0
- package/dist/preview.js +211 -0
- package/dist/tokens.css +193 -0
- package/dist/tokens.json +602 -0
- package/package.json +25 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* flair-kit 0.2.0-beta.0 · generated from src/preview-host.js · do not edit */
|
|
2
|
+
|
|
3
|
+
// Flair's side of the preview: frames a site's page and sends it the theme being edited. A site's own tests use
|
|
4
|
+
// it too, to put a Flair theme on their pages without Flair running. The names and the checks come from
|
|
5
|
+
// ./preview.js, so both sides of the format are written once.
|
|
6
|
+
import { COLOR_NAMES, FORMAT_VERSION, KIT_VERSION, MESSAGE_TYPES, checkTheme } from './preview.js';
|
|
7
|
+
|
|
8
|
+
export { COLOR_NAMES, FORMAT_VERSION, KIT_VERSION };
|
|
9
|
+
|
|
10
|
+
/** An address as an origin. Only an http or https page can be framed and posted to */
|
|
11
|
+
function toOrigin(address) {
|
|
12
|
+
let url = null;
|
|
13
|
+
try {
|
|
14
|
+
url = new URL(address);
|
|
15
|
+
} catch {
|
|
16
|
+
// not a URL at all
|
|
17
|
+
}
|
|
18
|
+
if (!url || (url.protocol !== 'http:' && url.protocol !== 'https:')) {
|
|
19
|
+
throw new TypeError(`flair-kit: connect() needs an http or https origin, not ${JSON.stringify(String(address))}`);
|
|
20
|
+
}
|
|
21
|
+
return url.origin;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Connects to the page in `frame`, an <iframe> of a site at `options.origin`. Returns { send, close }.
|
|
26
|
+
* send(theme) keeps the latest theme and sends it whenever the frame says ready: now, after a reload, after a link.
|
|
27
|
+
*/
|
|
28
|
+
export function connect(frame, options) {
|
|
29
|
+
const origin = toOrigin(options?.origin);
|
|
30
|
+
const { onReady, onApplied, onRefused, onMismatch } = options;
|
|
31
|
+
const win = frame.ownerDocument.defaultView;
|
|
32
|
+
|
|
33
|
+
let names = null;
|
|
34
|
+
let latest = null;
|
|
35
|
+
let closed = false;
|
|
36
|
+
|
|
37
|
+
const toFrame = (message) => frame.contentWindow?.postMessage(message, origin);
|
|
38
|
+
|
|
39
|
+
const sendLatest = () => {
|
|
40
|
+
if (!latest || !names) return;
|
|
41
|
+
const shared = names.filter((name) => Object.hasOwn(latest.light, name));
|
|
42
|
+
if (shared.length === 0) {
|
|
43
|
+
onRefused?.('name');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const pick = (values) => Object.fromEntries(shared.map((name) => [name, values[name]]));
|
|
47
|
+
toFrame({
|
|
48
|
+
type: MESSAGE_TYPES.theme,
|
|
49
|
+
v: FORMAT_VERSION,
|
|
50
|
+
light: pick(latest.light),
|
|
51
|
+
dark: pick(latest.dark),
|
|
52
|
+
mode: latest.mode,
|
|
53
|
+
angle: latest.angle,
|
|
54
|
+
instant: latest.instant === true,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onMessage = (event) => {
|
|
59
|
+
if (event.origin !== origin || !event.source || event.source !== frame.contentWindow) return;
|
|
60
|
+
const { data } = event;
|
|
61
|
+
if (data === null || typeof data !== 'object') return;
|
|
62
|
+
if (data.type === MESSAGE_TYPES.ready) {
|
|
63
|
+
if (data.v !== FORMAT_VERSION) {
|
|
64
|
+
names = null;
|
|
65
|
+
onMismatch?.({ host: FORMAT_VERSION, frame: data.v });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
names = Array.isArray(data.names) ? data.names.filter((name) => typeof name === 'string') : [];
|
|
69
|
+
onReady?.({ kit: String(data.kit), names: [...names] });
|
|
70
|
+
sendLatest();
|
|
71
|
+
} else if (data.type === MESSAGE_TYPES.applied) {
|
|
72
|
+
onApplied?.();
|
|
73
|
+
} else if (data.type === MESSAGE_TYPES.refused) {
|
|
74
|
+
onRefused?.(String(data.reason));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
win.addEventListener('message', onMessage);
|
|
79
|
+
toFrame({ type: MESSAGE_TYPES.hello, v: FORMAT_VERSION });
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
send(theme) {
|
|
83
|
+
const reason = checkTheme(theme, COLOR_NAMES);
|
|
84
|
+
if (reason) throw new TypeError(`flair-kit: send() was given a theme the frame would refuse (${reason})`);
|
|
85
|
+
if (closed) return;
|
|
86
|
+
latest = { light: { ...theme.light }, dark: { ...theme.dark }, mode: theme.mode, angle: theme.angle, instant: theme.instant };
|
|
87
|
+
sendLatest();
|
|
88
|
+
},
|
|
89
|
+
close() {
|
|
90
|
+
closed = true;
|
|
91
|
+
win.removeEventListener('message', onMessage);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* flair-kit 0.2.0-beta.0 · generated from src/tokens.ts · do not edit */
|
|
2
|
+
|
|
3
|
+
/** The package version this listener came from */
|
|
4
|
+
export declare const KIT_VERSION: string;
|
|
5
|
+
/** The message format's version. It goes up only when a field changes meaning or a new field becomes required */
|
|
6
|
+
export declare const FORMAT_VERSION: 1;
|
|
7
|
+
/** The colour names this listener accepts, without the --color- prefix, in the package's order */
|
|
8
|
+
export declare const COLOR_NAMES: readonly ["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"];
|
|
9
|
+
/** A colour name, without the --color- prefix */
|
|
10
|
+
export type ColorName = (typeof COLOR_NAMES)[number];
|
|
11
|
+
/** A colour mode */
|
|
12
|
+
export type Mode = 'light' | 'dark';
|
|
13
|
+
/** The Flair addresses listen() allows when it's given no list: Flair's dev server and its tests */
|
|
14
|
+
export declare const DEFAULT_ALLOW: readonly ["http://localhost:3000","http://localhost:4317"];
|
|
15
|
+
/** The type of each message in the format */
|
|
16
|
+
export declare const MESSAGE_TYPES: { readonly ready: "flair-kit:ready"; readonly hello: "flair-kit:hello"; readonly theme: "flair-kit:theme"; readonly applied: "flair-kit:applied"; readonly refused: "flair-kit:refused"; };
|
|
17
|
+
/** Why a theme was refused. A refusal never echoes the values it was sent */
|
|
18
|
+
export type Reason = "type" | "version" | "mode" | "angle" | "name" | "value";
|
|
19
|
+
/** Colours by name, each a #rrggbb value */
|
|
20
|
+
export type Colors = { readonly [N in ColorName]?: string };
|
|
21
|
+
/** The detail of the flair-kit:preview event, fired on document each time a theme goes on */
|
|
22
|
+
export interface PreviewEventDetail { readonly mode: Mode; readonly first: boolean }
|
|
23
|
+
/** Options for listen() */
|
|
24
|
+
export interface ListenOptions {
|
|
25
|
+
/** The Flair addresses that may theme the page, as origins or page addresses. It replaces DEFAULT_ALLOW */
|
|
26
|
+
readonly allow?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/** Starts listening for Flair if the page is in a frame, and returns a function that stops it. A second call while it runs returns the same function */
|
|
29
|
+
export declare function listen(options?: ListenOptions): () => void;
|
|
30
|
+
/** Checks a theme's mode, angle and colours against `names`: the first reason it fails, or null. Never throws */
|
|
31
|
+
export declare function checkTheme(theme: unknown, names: readonly string[]): Reason | null;
|
|
32
|
+
|
|
33
|
+
declare global {
|
|
34
|
+
interface DocumentEventMap {
|
|
35
|
+
'flair-kit:preview': CustomEvent<PreviewEventDetail>;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/preview.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/* flair-kit 0.2.0-beta.0 · generated from src/preview.js and src/tokens.ts · do not edit */
|
|
2
|
+
|
|
3
|
+
// Written by the build from src/tokens.ts and src/preview-format.ts
|
|
4
|
+
export const KIT_VERSION = "0.2.0-beta.0";
|
|
5
|
+
export const FORMAT_VERSION = 1;
|
|
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
|
+
export const DEFAULT_ALLOW = Object.freeze(["http://localhost:3000","http://localhost:4317"]);
|
|
8
|
+
export const MESSAGE_TYPES = Object.freeze({"ready":"flair-kit:ready","hello":"flair-kit:hello","theme":"flair-kit:theme","applied":"flair-kit:applied","refused":"flair-kit:refused"});
|
|
9
|
+
const LAYER_ORDER = "@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;";
|
|
10
|
+
const PREVIEW_LAYER = "flair-kit.preview";
|
|
11
|
+
|
|
12
|
+
// The listener that lets Flair show this page in its frame, wearing the theme being edited.
|
|
13
|
+
// KIT_VERSION, FORMAT_VERSION, COLOR_NAMES, DEFAULT_ALLOW, MESSAGE_TYPES, LAYER_ORDER and PREVIEW_LAYER are
|
|
14
|
+
// written above this file by the build (scripts/lib/preview.ts). Nothing here runs until listen() is called.
|
|
15
|
+
|
|
16
|
+
const HEX = /^#[0-9a-f]{6}$/i;
|
|
17
|
+
const MODES = ['light', 'dark'];
|
|
18
|
+
const EVENT = 'flair-kit:preview';
|
|
19
|
+
const ATTRIBUTE = 'data-flair-preview';
|
|
20
|
+
/** Never 0s, so code waiting on a transition's end event still hears it */
|
|
21
|
+
const HOLD = '0.01ms';
|
|
22
|
+
/** applied waits for two animation frames; this stands behind them in case the browser holds frames back */
|
|
23
|
+
const APPLIED_FALLBACK_MS = 500;
|
|
24
|
+
|
|
25
|
+
/** The running listener for each window, so a page never has two */
|
|
26
|
+
const running = new WeakMap();
|
|
27
|
+
/** The listener's one <style> in each document, kept across a stop() and a fresh listen() */
|
|
28
|
+
const sheets = new WeakMap();
|
|
29
|
+
|
|
30
|
+
/** The preview stylesheet, built only from checked names and values, in the frame's colour order */
|
|
31
|
+
function stylesheet({ light, dark, angle }) {
|
|
32
|
+
const names = COLOR_NAMES.filter((name) => Object.hasOwn(light, name));
|
|
33
|
+
const colours = (values, pad) => names.map((name) => `${pad}--color-${name}: ${values[name]};`);
|
|
34
|
+
return [
|
|
35
|
+
LAYER_ORDER,
|
|
36
|
+
`@layer ${PREVIEW_LAYER} {`,
|
|
37
|
+
' :root,',
|
|
38
|
+
' [data-theme="light"] {',
|
|
39
|
+
' color-scheme: light;',
|
|
40
|
+
...colours(light, ' '),
|
|
41
|
+
` --gradient-angle: ${angle}deg;`,
|
|
42
|
+
' }',
|
|
43
|
+
' [data-theme="dark"] {',
|
|
44
|
+
' color-scheme: dark;',
|
|
45
|
+
...colours(dark, ' '),
|
|
46
|
+
' }',
|
|
47
|
+
' @media (prefers-color-scheme: dark) {',
|
|
48
|
+
' :root:not([data-theme="light"]) {',
|
|
49
|
+
' color-scheme: dark;',
|
|
50
|
+
...colours(dark, ' '),
|
|
51
|
+
' }',
|
|
52
|
+
' }',
|
|
53
|
+
'}',
|
|
54
|
+
'',
|
|
55
|
+
].join('\n');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** An address as an origin. Only an http or https page can frame this one and post to it */
|
|
59
|
+
function toOrigin(address) {
|
|
60
|
+
let url = null;
|
|
61
|
+
try {
|
|
62
|
+
url = new URL(address);
|
|
63
|
+
} catch {
|
|
64
|
+
// not a URL at all
|
|
65
|
+
}
|
|
66
|
+
if (!url || (url.protocol !== 'http:' && url.protocol !== 'https:')) {
|
|
67
|
+
throw new TypeError(`flair-kit: listen() allows only http and https addresses, not ${JSON.stringify(String(address))}`);
|
|
68
|
+
}
|
|
69
|
+
return url.origin;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const isColors = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Checks a theme's mode, angle and colours: the first reason it fails, or null. Never throws.
|
|
76
|
+
* `names` are the colour names that may appear, without the --color- prefix.
|
|
77
|
+
*/
|
|
78
|
+
export function checkTheme(theme, names) {
|
|
79
|
+
if (theme === null || typeof theme !== 'object' || !MODES.includes(theme.mode)) return 'mode';
|
|
80
|
+
const { angle, light, dark } = theme;
|
|
81
|
+
if (typeof angle !== 'number' || !Number.isFinite(angle) || angle < 0 || angle > 360) return 'angle';
|
|
82
|
+
if (!isColors(light) || !isColors(dark)) return 'name';
|
|
83
|
+
const keys = Object.keys(light);
|
|
84
|
+
if (keys.length === 0 || keys.length !== Object.keys(dark).length || !keys.every((key) => Object.hasOwn(dark, key))) return 'name';
|
|
85
|
+
const known = new Set(names);
|
|
86
|
+
if (!keys.every((key) => known.has(key))) return 'name';
|
|
87
|
+
const isHex = (value) => typeof value === 'string' && HEX.test(value);
|
|
88
|
+
if (!keys.every((key) => isHex(light[key]) && isHex(dark[key]))) return 'value';
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Why a message from the allowed parent can't be used, or null */
|
|
93
|
+
function messageReason(data) {
|
|
94
|
+
if (data === null || typeof data !== 'object') return 'type';
|
|
95
|
+
if (data.type !== MESSAGE_TYPES.theme && data.type !== MESSAGE_TYPES.hello) return 'type';
|
|
96
|
+
if (data.v !== FORMAT_VERSION) return 'version';
|
|
97
|
+
return data.type === MESSAGE_TYPES.theme ? checkTheme(data, COLOR_NAMES) : null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const readyMessage = () => ({ type: MESSAGE_TYPES.ready, v: FORMAT_VERSION, kit: KIT_VERSION, names: [...COLOR_NAMES] });
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Starts listening for Flair, if this page is inside a frame. Returns a function that stops it.
|
|
104
|
+
* `allow` lists the Flair addresses that may theme the page; without it, Flair's own local addresses.
|
|
105
|
+
* Calling it again while it runs returns the same stop function and changes nothing.
|
|
106
|
+
*/
|
|
107
|
+
export function listen(options = {}) {
|
|
108
|
+
const win = globalThis.window;
|
|
109
|
+
if (!win || win.self === win.top) return () => {};
|
|
110
|
+
const current = running.get(win);
|
|
111
|
+
if (current) return current.stop;
|
|
112
|
+
|
|
113
|
+
const allow = [...(options.allow ?? DEFAULT_ALLOW)].map(toOrigin);
|
|
114
|
+
const post = (message, origin) => win.parent.postMessage(message, origin);
|
|
115
|
+
|
|
116
|
+
let first = true;
|
|
117
|
+
/** True once the first theme has been drawn and its applied has gone. Until then every theme keeps the hold */
|
|
118
|
+
let firstDrawn = false;
|
|
119
|
+
let pending = null;
|
|
120
|
+
let pendingFrame = 0;
|
|
121
|
+
const waits = new Set();
|
|
122
|
+
|
|
123
|
+
/** Runs `done` once, after two animation frames or the fallback timer, whichever comes first */
|
|
124
|
+
const afterTwoFrames = (done) => {
|
|
125
|
+
const wait = { frame: 0, timer: 0 };
|
|
126
|
+
const finish = () => {
|
|
127
|
+
if (!waits.delete(wait)) return;
|
|
128
|
+
win.cancelAnimationFrame(wait.frame);
|
|
129
|
+
win.clearTimeout(wait.timer);
|
|
130
|
+
done();
|
|
131
|
+
};
|
|
132
|
+
waits.add(wait);
|
|
133
|
+
wait.frame = win.requestAnimationFrame(() => {
|
|
134
|
+
wait.frame = win.requestAnimationFrame(finish);
|
|
135
|
+
});
|
|
136
|
+
wait.timer = win.setTimeout(finish, APPLIED_FALLBACK_MS);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const apply = (theme, origin) => {
|
|
140
|
+
const doc = win.document;
|
|
141
|
+
const root = doc.documentElement;
|
|
142
|
+
let sheet = sheets.get(doc);
|
|
143
|
+
if (!sheet) {
|
|
144
|
+
sheet = doc.createElement('style');
|
|
145
|
+
sheets.set(doc, sheet);
|
|
146
|
+
}
|
|
147
|
+
// A router or hydration can rebuild <head>; put the sheet back rather than theme a detached element
|
|
148
|
+
if (!sheet.isConnected) (doc.head ?? root).append(sheet);
|
|
149
|
+
const isFirst = first;
|
|
150
|
+
first = false;
|
|
151
|
+
sheet.textContent = stylesheet(theme);
|
|
152
|
+
root.setAttribute('data-theme', theme.mode);
|
|
153
|
+
// A theme that lands before the first has been drawn keeps the hold too, or the first would fade after all
|
|
154
|
+
if (!firstDrawn || theme.instant === true) root.style.setProperty('--dur-theme', HOLD);
|
|
155
|
+
else root.style.removeProperty('--dur-theme');
|
|
156
|
+
if (isFirst) root.setAttribute(ATTRIBUTE, '');
|
|
157
|
+
doc.dispatchEvent(new win.CustomEvent(EVENT, { detail: { mode: theme.mode, first: isFirst } }));
|
|
158
|
+
afterTwoFrames(() => {
|
|
159
|
+
if (isFirst) firstDrawn = true;
|
|
160
|
+
post({ type: MESSAGE_TYPES.applied, v: FORMAT_VERSION }, origin);
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** The first theme goes on at once; later ones are coalesced, the latest once per animation frame */
|
|
165
|
+
const receiveTheme = (theme, origin) => {
|
|
166
|
+
if (first) {
|
|
167
|
+
apply(theme, origin);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
pending = { theme, origin };
|
|
171
|
+
if (pendingFrame) return;
|
|
172
|
+
pendingFrame = win.requestAnimationFrame(() => {
|
|
173
|
+
pendingFrame = 0;
|
|
174
|
+
const next = pending;
|
|
175
|
+
pending = null;
|
|
176
|
+
if (next) apply(next.theme, next.origin);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const onMessage = (event) => {
|
|
181
|
+
if (!allow.includes(event.origin)) return;
|
|
182
|
+
if (event.source !== win.parent) return;
|
|
183
|
+
const { data } = event;
|
|
184
|
+
const reason = messageReason(data);
|
|
185
|
+
if (reason) {
|
|
186
|
+
console.warn(`flair-kit: a preview message from Flair was refused (${reason})`);
|
|
187
|
+
post({ type: MESSAGE_TYPES.refused, v: FORMAT_VERSION, reason }, event.origin);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (data.type === MESSAGE_TYPES.hello) post(readyMessage(), event.origin);
|
|
191
|
+
else receiveTheme(data, event.origin);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const stop = () => {
|
|
195
|
+
win.removeEventListener('message', onMessage);
|
|
196
|
+
if (pendingFrame) win.cancelAnimationFrame(pendingFrame);
|
|
197
|
+
pendingFrame = 0;
|
|
198
|
+
pending = null;
|
|
199
|
+
for (const wait of waits) {
|
|
200
|
+
win.cancelAnimationFrame(wait.frame);
|
|
201
|
+
win.clearTimeout(wait.timer);
|
|
202
|
+
}
|
|
203
|
+
waits.clear();
|
|
204
|
+
if (running.get(win)?.stop === stop) running.delete(win);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
running.set(win, { stop });
|
|
208
|
+
win.addEventListener('message', onMessage);
|
|
209
|
+
for (const origin of allow) post(readyMessage(), origin);
|
|
210
|
+
return stop;
|
|
211
|
+
}
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/* flair-kit 0.2.0-beta.0 · generated from src/tokens.ts · do not edit */
|
|
2
|
+
|
|
3
|
+
@layer flair-kit.tokens, flair-kit.palette, flair-kit.components, flair-kit.preview;
|
|
4
|
+
|
|
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: #f6faf9; }
|
|
7
|
+
@property --color-card { syntax: '<color>'; inherits: true; initial-value: #ffffff; }
|
|
8
|
+
@property --color-muted { syntax: '<color>'; inherits: true; initial-value: #ecf2f1; }
|
|
9
|
+
@property --color-secondary { syntax: '<color>'; inherits: true; initial-value: #f0e5ed; }
|
|
10
|
+
@property --color-foreground { syntax: '<color>'; inherits: true; initial-value: #191f1e; }
|
|
11
|
+
@property --color-card-foreground { syntax: '<color>'; inherits: true; initial-value: #191f1e; }
|
|
12
|
+
@property --color-muted-foreground { syntax: '<color>'; inherits: true; initial-value: #5a6563; }
|
|
13
|
+
@property --color-on-secondary { syntax: '<color>'; inherits: true; initial-value: #6f1362; }
|
|
14
|
+
@property --color-border { syntax: '<color>'; inherits: true; initial-value: #ced6d5; }
|
|
15
|
+
@property --color-outline { syntax: '<color>'; inherits: true; initial-value: #727e7c; }
|
|
16
|
+
@property --color-primary { syntax: '<color>'; inherits: true; initial-value: #0d9488; }
|
|
17
|
+
@property --color-on-primary { syntax: '<color>'; inherits: true; initial-value: #000000; }
|
|
18
|
+
@property --color-primary-hover { syntax: '<color>'; inherits: true; initial-value: #14a093; }
|
|
19
|
+
@property --color-primary-pressed { syntax: '<color>'; inherits: true; initial-value: #1eab9d; }
|
|
20
|
+
@property --color-primary-text { syntax: '<color>'; inherits: true; initial-value: #09746a; }
|
|
21
|
+
@property --color-ring { syntax: '<color>'; inherits: true; initial-value: #09746a; }
|
|
22
|
+
@property --color-tertiary { syntax: '<color>'; inherits: true; initial-value: #b93008; }
|
|
23
|
+
@property --color-on-tertiary { syntax: '<color>'; inherits: true; initial-value: #ffffff; }
|
|
24
|
+
@property --color-accent-2 { syntax: '<color>'; inherits: true; initial-value: #ec14d2; }
|
|
25
|
+
@property --color-glow { syntax: '<color>'; inherits: true; initial-value: #f6b8a8; }
|
|
26
|
+
@property --color-destructive { syntax: '<color>'; inherits: true; initial-value: #c6101a; }
|
|
27
|
+
@property --color-on-destructive { syntax: '<color>'; inherits: true; initial-value: #ffffff; }
|
|
28
|
+
@property --color-chart-1 { syntax: '<color>'; inherits: true; initial-value: #0a8b80; }
|
|
29
|
+
@property --color-chart-2 { syntax: '<color>'; inherits: true; initial-value: #b30f9f; }
|
|
30
|
+
@property --color-chart-3 { syntax: '<color>'; inherits: true; initial-value: #95290c; }
|
|
31
|
+
@property --color-chart-4 { syntax: '<color>'; inherits: true; initial-value: #36403e; }
|
|
32
|
+
@property --color-brand { syntax: '<color>'; inherits: true; initial-value: #0d9488; }
|
|
33
|
+
@property --color-gradient-1 { syntax: '<color>'; inherits: true; initial-value: #0d9488; }
|
|
34
|
+
@property --color-gradient-2 { syntax: '<color>'; inherits: true; initial-value: #ec14d2; }
|
|
35
|
+
@property --color-gradient-3 { syntax: '<color>'; inherits: true; initial-value: #f6b8a8; }
|
|
36
|
+
|
|
37
|
+
@layer flair-kit.tokens {
|
|
38
|
+
:root {
|
|
39
|
+
--space-1: 0.25rem;
|
|
40
|
+
--space-2: 0.5rem;
|
|
41
|
+
--space-3: 0.75rem;
|
|
42
|
+
--space-4: 1rem;
|
|
43
|
+
--space-5: 1.25rem;
|
|
44
|
+
--space-6: 1.5rem;
|
|
45
|
+
--space-8: 2rem;
|
|
46
|
+
--space-10: 2.5rem;
|
|
47
|
+
--space-12: 3rem;
|
|
48
|
+
--space-16: 4rem;
|
|
49
|
+
--space-gutter: clamp(1.25rem, 5vw, 5rem);
|
|
50
|
+
--space-section: clamp(3rem, 1.5rem + 5vw, 6rem);
|
|
51
|
+
--space-section-tight: clamp(2.25rem, 1.125rem + 3.75vw, 4.5rem);
|
|
52
|
+
--text-12: 0.75rem;
|
|
53
|
+
--text-14: 0.875rem;
|
|
54
|
+
--text-16: 1rem;
|
|
55
|
+
--text-18: 1.125rem;
|
|
56
|
+
--text-20: 1.25rem;
|
|
57
|
+
--text-24: 1.5rem;
|
|
58
|
+
--text-32: 2rem;
|
|
59
|
+
--radius-sm: 4px;
|
|
60
|
+
--radius-md: 8px;
|
|
61
|
+
--radius-lg: 12px;
|
|
62
|
+
--radius-full: 9999px;
|
|
63
|
+
--z-raised: 10;
|
|
64
|
+
--z-sticky: 20;
|
|
65
|
+
--z-overlay: 40;
|
|
66
|
+
--z-toast: 100;
|
|
67
|
+
--z-tooltip: 200;
|
|
68
|
+
--dur-press: 120ms;
|
|
69
|
+
--dur-exit: 160ms;
|
|
70
|
+
--dur-state: 200ms;
|
|
71
|
+
--dur-enter: 250ms;
|
|
72
|
+
--dur-theme: 200ms;
|
|
73
|
+
--ease-out: cubic-bezier(0.2, 0, 0, 1);
|
|
74
|
+
--size-touch: 2.75rem;
|
|
75
|
+
--font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
76
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
|
|
77
|
+
--font-display: var(--font-sans);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Default palette: Flair Design default theme · DEFAULT_SPEC · seed #0d9488 · split harmony · engine version 2 · Flair commit 209d933. A site's own palette file replaces it */
|
|
81
|
+
:root,
|
|
82
|
+
[data-theme="light"] {
|
|
83
|
+
color-scheme: light;
|
|
84
|
+
--color-background: #f6faf9;
|
|
85
|
+
--color-card: #ffffff;
|
|
86
|
+
--color-muted: #ecf2f1;
|
|
87
|
+
--color-secondary: #f0e5ed;
|
|
88
|
+
--color-foreground: #191f1e;
|
|
89
|
+
--color-card-foreground: #191f1e;
|
|
90
|
+
--color-muted-foreground: #5a6563;
|
|
91
|
+
--color-on-secondary: #6f1362;
|
|
92
|
+
--color-border: #ced6d5;
|
|
93
|
+
--color-outline: #727e7c;
|
|
94
|
+
--color-primary: #0d9488;
|
|
95
|
+
--color-on-primary: #000000;
|
|
96
|
+
--color-primary-hover: #14a093;
|
|
97
|
+
--color-primary-pressed: #1eab9d;
|
|
98
|
+
--color-primary-text: #09746a;
|
|
99
|
+
--color-ring: #09746a;
|
|
100
|
+
--color-tertiary: #b93008;
|
|
101
|
+
--color-on-tertiary: #ffffff;
|
|
102
|
+
--color-accent-2: #ec14d2;
|
|
103
|
+
--color-glow: #f6b8a8;
|
|
104
|
+
--color-destructive: #c6101a;
|
|
105
|
+
--color-on-destructive: #ffffff;
|
|
106
|
+
--color-chart-1: #0a8b80;
|
|
107
|
+
--color-chart-2: #b30f9f;
|
|
108
|
+
--color-chart-3: #95290c;
|
|
109
|
+
--color-chart-4: #36403e;
|
|
110
|
+
--color-brand: #0d9488;
|
|
111
|
+
--color-gradient-1: #0d9488;
|
|
112
|
+
--color-gradient-2: #ec14d2;
|
|
113
|
+
--color-gradient-3: #f6b8a8;
|
|
114
|
+
--gradient-angle: 110deg;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-theme="dark"] {
|
|
118
|
+
color-scheme: dark;
|
|
119
|
+
--color-background: #101413;
|
|
120
|
+
--color-card: #191f1e;
|
|
121
|
+
--color-muted: #262d2c;
|
|
122
|
+
--color-secondary: #583050;
|
|
123
|
+
--color-foreground: #edf1f0;
|
|
124
|
+
--color-card-foreground: #edf1f0;
|
|
125
|
+
--color-muted-foreground: #b1bbb9;
|
|
126
|
+
--color-on-secondary: #f7e2f2;
|
|
127
|
+
--color-border: #485250;
|
|
128
|
+
--color-outline: #929e9c;
|
|
129
|
+
--color-primary: #0d9488;
|
|
130
|
+
--color-on-primary: #000000;
|
|
131
|
+
--color-primary-hover: #14a093;
|
|
132
|
+
--color-primary-pressed: #1eab9d;
|
|
133
|
+
--color-primary-text: #30bdaf;
|
|
134
|
+
--color-ring: #30bdaf;
|
|
135
|
+
--color-tertiary: #f6a48f;
|
|
136
|
+
--color-on-tertiary: #000000;
|
|
137
|
+
--color-accent-2: #ed13d2;
|
|
138
|
+
--color-glow: #f6b8a8;
|
|
139
|
+
--color-destructive: #f7a39a;
|
|
140
|
+
--color-on-destructive: #000000;
|
|
141
|
+
--color-chart-1: #20aea0;
|
|
142
|
+
--color-chart-2: #f799e3;
|
|
143
|
+
--color-chart-3: #f5cbc0;
|
|
144
|
+
--color-chart-4: #727f7d;
|
|
145
|
+
--color-brand: #0d9488;
|
|
146
|
+
--color-gradient-1: #0d9488;
|
|
147
|
+
--color-gradient-2: #ed13d2;
|
|
148
|
+
--color-gradient-3: #f6b8a8;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* No data-theme attribute: follow the system */
|
|
152
|
+
@media (prefers-color-scheme: dark) {
|
|
153
|
+
:root:not([data-theme="light"]) {
|
|
154
|
+
color-scheme: dark;
|
|
155
|
+
--color-background: #101413;
|
|
156
|
+
--color-card: #191f1e;
|
|
157
|
+
--color-muted: #262d2c;
|
|
158
|
+
--color-secondary: #583050;
|
|
159
|
+
--color-foreground: #edf1f0;
|
|
160
|
+
--color-card-foreground: #edf1f0;
|
|
161
|
+
--color-muted-foreground: #b1bbb9;
|
|
162
|
+
--color-on-secondary: #f7e2f2;
|
|
163
|
+
--color-border: #485250;
|
|
164
|
+
--color-outline: #929e9c;
|
|
165
|
+
--color-primary: #0d9488;
|
|
166
|
+
--color-on-primary: #000000;
|
|
167
|
+
--color-primary-hover: #14a093;
|
|
168
|
+
--color-primary-pressed: #1eab9d;
|
|
169
|
+
--color-primary-text: #30bdaf;
|
|
170
|
+
--color-ring: #30bdaf;
|
|
171
|
+
--color-tertiary: #f6a48f;
|
|
172
|
+
--color-on-tertiary: #000000;
|
|
173
|
+
--color-accent-2: #ed13d2;
|
|
174
|
+
--color-glow: #f6b8a8;
|
|
175
|
+
--color-destructive: #f7a39a;
|
|
176
|
+
--color-on-destructive: #000000;
|
|
177
|
+
--color-chart-1: #20aea0;
|
|
178
|
+
--color-chart-2: #f799e3;
|
|
179
|
+
--color-chart-3: #f5cbc0;
|
|
180
|
+
--color-chart-4: #727f7d;
|
|
181
|
+
--color-brand: #0d9488;
|
|
182
|
+
--color-gradient-1: #0d9488;
|
|
183
|
+
--color-gradient-2: #ed13d2;
|
|
184
|
+
--color-gradient-3: #f6b8a8;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media (prefers-reduced-motion: reduce) {
|
|
189
|
+
:root {
|
|
190
|
+
--dur-theme: 0.01ms;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|