@civitai/theme 0.1.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/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/generate.d.ts +57 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +273 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/inject.d.ts +8 -0
- package/dist/inject.d.ts.map +1 -0
- package/dist/inject.js +25 -0
- package/dist/inject.js.map +1 -0
- package/dist/theme.source.d.ts +43 -0
- package/dist/theme.source.d.ts.map +1 -0
- package/dist/theme.source.js +172 -0
- package/dist/theme.source.js.map +1 -0
- package/dist/tokens.css +120 -0
- package/dist/tokens.dtcg.json +151 -0
- package/dist/tokens.generated.d.ts +57 -0
- package/dist/tokens.generated.d.ts.map +1 -0
- package/dist/tokens.generated.js +58 -0
- package/dist/tokens.generated.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Civitai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @civitai/theme
|
|
2
|
+
|
|
3
|
+
Framework-agnostic **design tokens**, derived at build time from civitai's real
|
|
4
|
+
Mantine theme. Ships three forms of the same `--civitai-*` token contract:
|
|
5
|
+
|
|
6
|
+
- `dist/tokens.css` — a `:root` + `[data-theme='light'|'dark']` stylesheet
|
|
7
|
+
(`--civitai-*` custom properties; `<color>` tokens registered via `@property`).
|
|
8
|
+
- typed JS — `import { tokens, darkTokens, tokenVars, tokensCss } from '@civitai/theme'`.
|
|
9
|
+
- `dist/tokens.dtcg.json` — a W3C **Design Tokens Community Group** export
|
|
10
|
+
(`$value`/`$type`/`$description`) for interop with token tooling.
|
|
11
|
+
|
|
12
|
+
## Why generated (not hand-authored)
|
|
13
|
+
|
|
14
|
+
The tokens are produced by feeding a vendored copy of civitai's `createTheme`
|
|
15
|
+
override (`src/theme.source.ts`) through Mantine's **public** pipeline —
|
|
16
|
+
`mergeMantineTheme` → `defaultCssVariablesResolver` → transitive `var()`
|
|
17
|
+
resolution → re-namespaced `--civitai-*`. This is the same primitive civitai
|
|
18
|
+
uses in `mantine-css-variables.ts`. `--mantine-*` is fully resolved away, so the
|
|
19
|
+
`--civitai-*` contract is self-contained.
|
|
20
|
+
|
|
21
|
+
Two guards keep it honest (`pnpm --filter @civitai/theme test`):
|
|
22
|
+
|
|
23
|
+
- **drift guard** — reads civitai/civitai's live `ThemeProvider.tsx` and fails
|
|
24
|
+
if the vendored palette/`white`/`black` diverge (set `CIVITAI_REPO`; skips
|
|
25
|
+
with a clear message when the checkout is absent).
|
|
26
|
+
- **generation parity** — the committed generated source + built artifacts must
|
|
27
|
+
byte-match a fresh generation, so a stale hand-edit can't slip through.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@civitai/theme/styles.css" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { injectTokens, tokens } from '@civitai/theme';
|
|
37
|
+
injectTokens(); // inject the stylesheet at runtime (JS consumers)
|
|
38
|
+
tokens.colorPrimary; // "#228BE6"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Theme by setting `data-theme="light" | "dark"` on any ancestor.
|
|
42
|
+
|
|
43
|
+
## Build
|
|
44
|
+
|
|
45
|
+
`pnpm --filter @civitai/theme build` regenerates `src/tokens.generated.ts`,
|
|
46
|
+
`dist/tokens.css`, and `dist/tokens.dtcg.json`, then compiles with `tsc`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@civitai/theme` token GENERATOR.
|
|
3
|
+
*
|
|
4
|
+
* Feeds the vendored civitai `createTheme` override (`theme.source.ts`) through
|
|
5
|
+
* Mantine's PUBLIC theme resolver — the same primitives civitai/civitai uses in
|
|
6
|
+
* `mantine-css-variables.ts`:
|
|
7
|
+
* `mergeMantineTheme(DEFAULT_THEME, override)` -> `defaultCssVariablesResolver`
|
|
8
|
+
* (yields the `{ variables, light, dark }` map of `--mantine-*` values).
|
|
9
|
+
* From there this generator does its OWN thing (it does NOT call Mantine's
|
|
10
|
+
* `convertCssVariables`): a hand-rolled transitive `var()` resolver reduces each
|
|
11
|
+
* selected Mantine variable to a concrete literal, which is then re-namespaced
|
|
12
|
+
* and emitted as the `--civitai-*` CSS / typed-JS / DTCG artifacts.
|
|
13
|
+
*
|
|
14
|
+
* The output is a re-namespaced `--civitai-*` token contract. We deliberately
|
|
15
|
+
* do NOT expose `--mantine-*` as the public surface: every `--civitai-*` value
|
|
16
|
+
* is fully resolved down to a concrete literal (hex / rem), so consumers need
|
|
17
|
+
* only this package's tokens, never Mantine's variables.
|
|
18
|
+
*
|
|
19
|
+
* `buildArtifacts()` is PURE (no fs) so both the build writer
|
|
20
|
+
* (`scripts/build-tokens.ts`) and the generation-parity test consume it.
|
|
21
|
+
*/
|
|
22
|
+
import { type MantineThemeOverride } from '@mantine/core';
|
|
23
|
+
/** A single public token, mapped to the Mantine variable it derives from. */
|
|
24
|
+
interface TokenSpec {
|
|
25
|
+
/** Public name WITHOUT the `--civitai-` prefix, e.g. `color-primary`. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Source Mantine variable name (with `--mantine-` prefix). */
|
|
28
|
+
source: string;
|
|
29
|
+
/** Typed-syntax category — drives `@property` registration + DTCG `$type`. */
|
|
30
|
+
type: 'color' | 'length' | 'font';
|
|
31
|
+
description: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ResolvedTokens {
|
|
34
|
+
/** Base + light-scheme value keyed by the FULL `--civitai-*` var name. */
|
|
35
|
+
root: Record<string, string>;
|
|
36
|
+
/** Dark-scheme overrides (only tokens whose value differs from light). */
|
|
37
|
+
dark: Record<string, string>;
|
|
38
|
+
/** Per-token metadata in spec order. */
|
|
39
|
+
meta: {
|
|
40
|
+
varName: string;
|
|
41
|
+
camel: string;
|
|
42
|
+
type: TokenSpec['type'];
|
|
43
|
+
description: string;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
/** Resolve the token spec against the vendored theme into concrete values. */
|
|
47
|
+
export declare function resolveTokens(themeOverride?: MantineThemeOverride): ResolvedTokens;
|
|
48
|
+
export interface Artifacts {
|
|
49
|
+
'tokens.css': string;
|
|
50
|
+
'tokens.dtcg.json': string;
|
|
51
|
+
/** Generated TS module (compiled by tsc into dist/tokens.generated.js/.d.ts). */
|
|
52
|
+
'tokens.generated.ts': string;
|
|
53
|
+
}
|
|
54
|
+
/** Build every artifact string. PURE — no fs. */
|
|
55
|
+
export declare function buildArtifacts(themeOverride?: MantineThemeOverride): Artifacts;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAIvB,6EAA6E;AAC7E,UAAU,SAAS;IACjB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;CACrB;AAoJD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,wCAAwC;IACxC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1F;AAKD,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,aAAa,GAAE,oBAAyC,GAAG,cAAc,CAqBtG;AASD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iFAAiF;IACjF,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAMD,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,aAAa,GAAE,oBAAyC,GAAG,SAAS,CAsFlG"}
|
package/dist/generate.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@civitai/theme` token GENERATOR.
|
|
3
|
+
*
|
|
4
|
+
* Feeds the vendored civitai `createTheme` override (`theme.source.ts`) through
|
|
5
|
+
* Mantine's PUBLIC theme resolver — the same primitives civitai/civitai uses in
|
|
6
|
+
* `mantine-css-variables.ts`:
|
|
7
|
+
* `mergeMantineTheme(DEFAULT_THEME, override)` -> `defaultCssVariablesResolver`
|
|
8
|
+
* (yields the `{ variables, light, dark }` map of `--mantine-*` values).
|
|
9
|
+
* From there this generator does its OWN thing (it does NOT call Mantine's
|
|
10
|
+
* `convertCssVariables`): a hand-rolled transitive `var()` resolver reduces each
|
|
11
|
+
* selected Mantine variable to a concrete literal, which is then re-namespaced
|
|
12
|
+
* and emitted as the `--civitai-*` CSS / typed-JS / DTCG artifacts.
|
|
13
|
+
*
|
|
14
|
+
* The output is a re-namespaced `--civitai-*` token contract. We deliberately
|
|
15
|
+
* do NOT expose `--mantine-*` as the public surface: every `--civitai-*` value
|
|
16
|
+
* is fully resolved down to a concrete literal (hex / rem), so consumers need
|
|
17
|
+
* only this package's tokens, never Mantine's variables.
|
|
18
|
+
*
|
|
19
|
+
* `buildArtifacts()` is PURE (no fs) so both the build writer
|
|
20
|
+
* (`scripts/build-tokens.ts`) and the generation-parity test consume it.
|
|
21
|
+
*/
|
|
22
|
+
import { DEFAULT_THEME, defaultCssVariablesResolver, mergeMantineTheme, } from '@mantine/core';
|
|
23
|
+
import { civitaiThemeSource } from './theme.source.js';
|
|
24
|
+
/**
|
|
25
|
+
* The curated public token contract. ORDER is significant (drives deterministic
|
|
26
|
+
* CSS/JSON output). Each token derives from a real resolved Mantine variable —
|
|
27
|
+
* change the map here, never hand-edit a value.
|
|
28
|
+
*/
|
|
29
|
+
const TOKEN_SPEC = [
|
|
30
|
+
// --- Typography / shape (color-scheme independent) ---
|
|
31
|
+
{
|
|
32
|
+
name: 'font',
|
|
33
|
+
source: '--mantine-font-family',
|
|
34
|
+
type: 'font',
|
|
35
|
+
description: 'Base UI font stack (Mantine default system stack).',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'font-mono',
|
|
39
|
+
source: '--mantine-font-family-monospace',
|
|
40
|
+
type: 'font',
|
|
41
|
+
description: 'Monospace font stack.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'radius',
|
|
45
|
+
source: '--mantine-radius-default',
|
|
46
|
+
type: 'length',
|
|
47
|
+
description: "Default corner radius (civitai leaves Mantine's `sm` default).",
|
|
48
|
+
},
|
|
49
|
+
// --- Semantic surfaces / text (color-scheme dependent) ---
|
|
50
|
+
{
|
|
51
|
+
name: 'color-text',
|
|
52
|
+
source: '--mantine-color-text',
|
|
53
|
+
type: 'color',
|
|
54
|
+
description: 'Primary body text color.',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'color-text-dimmed',
|
|
58
|
+
source: '--mantine-color-dimmed',
|
|
59
|
+
type: 'color',
|
|
60
|
+
description: 'Secondary / muted text color.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'color-surface',
|
|
64
|
+
source: '--mantine-color-body',
|
|
65
|
+
type: 'color',
|
|
66
|
+
description: 'Primary surface / page background.',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'color-surface-2',
|
|
70
|
+
source: '--mantine-color-default',
|
|
71
|
+
type: 'color',
|
|
72
|
+
description: 'Secondary surface (inputs, insets).',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'color-border',
|
|
76
|
+
source: '--mantine-color-default-border',
|
|
77
|
+
type: 'color',
|
|
78
|
+
description: 'Default border / divider color.',
|
|
79
|
+
},
|
|
80
|
+
// --- Primary accent (blue @ civitai primaryShade {light:6,dark:8}) ---
|
|
81
|
+
{
|
|
82
|
+
name: 'color-primary',
|
|
83
|
+
source: '--mantine-primary-color-filled',
|
|
84
|
+
type: 'color',
|
|
85
|
+
description: 'Primary accent (filled) color.',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'color-primary-hover',
|
|
89
|
+
source: '--mantine-primary-color-filled-hover',
|
|
90
|
+
type: 'color',
|
|
91
|
+
description: 'Primary accent hover color.',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'color-primary-fg',
|
|
95
|
+
source: '--mantine-primary-color-contrast',
|
|
96
|
+
type: 'color',
|
|
97
|
+
description: 'Foreground/text color on a filled primary surface.',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'color-primary-light',
|
|
101
|
+
source: '--mantine-primary-color-light',
|
|
102
|
+
type: 'color',
|
|
103
|
+
description: 'Translucent primary tint (light variant background).',
|
|
104
|
+
},
|
|
105
|
+
// --- Semantic status colors ---
|
|
106
|
+
{
|
|
107
|
+
name: 'color-error',
|
|
108
|
+
source: '--mantine-color-error',
|
|
109
|
+
type: 'color',
|
|
110
|
+
description: 'Error / destructive color.',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'color-success',
|
|
114
|
+
source: '--mantine-color-success-filled',
|
|
115
|
+
type: 'color',
|
|
116
|
+
description: "Success color (civitai's custom `success` palette).",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'color-warning',
|
|
120
|
+
source: '--mantine-color-orange-filled',
|
|
121
|
+
type: 'color',
|
|
122
|
+
description: 'Warning color (derived from the orange palette).',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'color-info',
|
|
126
|
+
source: '--mantine-color-blue-filled',
|
|
127
|
+
type: 'color',
|
|
128
|
+
description: 'Informational color (derived from the blue palette).',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
const VAR_RE = /var\(\s*(--[a-zA-Z0-9-]+)\s*(?:,\s*([^)]*))?\)/;
|
|
132
|
+
/**
|
|
133
|
+
* Resolve a raw CSS value to a concrete literal by transitively substituting
|
|
134
|
+
* every `var(--mantine-*)` reference from `dict`. Uses the declared fallback
|
|
135
|
+
* when a referenced variable is absent; throws on a genuinely unresolvable
|
|
136
|
+
* reference (a real bug, not something to paper over).
|
|
137
|
+
*/
|
|
138
|
+
function resolveValue(raw, dict, trail = []) {
|
|
139
|
+
let value = raw.trim();
|
|
140
|
+
let guard = 0;
|
|
141
|
+
while (VAR_RE.test(value)) {
|
|
142
|
+
if (guard++ > 50) {
|
|
143
|
+
throw new Error(`Cyclic/overlong var() resolution for "${raw}" (trail: ${trail.join(' -> ')})`);
|
|
144
|
+
}
|
|
145
|
+
value = value.replace(VAR_RE, (_m, name, fallback) => {
|
|
146
|
+
if (Object.prototype.hasOwnProperty.call(dict, name)) {
|
|
147
|
+
if (trail.includes(name)) {
|
|
148
|
+
throw new Error(`Cyclic var() reference at ${name} (trail: ${trail.join(' -> ')})`);
|
|
149
|
+
}
|
|
150
|
+
return resolveValue(dict[name], dict, [...trail, name]);
|
|
151
|
+
}
|
|
152
|
+
if (fallback != null)
|
|
153
|
+
return fallback.trim();
|
|
154
|
+
throw new Error(`Unresolved CSS variable ${name} while resolving "${raw}"`);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// Collapse Mantine's trivial scale wrapper `calc(<x> * 1)` / `calc(1 * <x>)`
|
|
158
|
+
// (scale defaults to 1) to the bare value — exact, and keeps radius a clean
|
|
159
|
+
// dimension token rather than a calc() expression.
|
|
160
|
+
value = value
|
|
161
|
+
.trim()
|
|
162
|
+
.replace(/^calc\(\s*([^*()]+?)\s*\*\s*1\s*\)$/, '$1')
|
|
163
|
+
.replace(/^calc\(\s*1\s*\*\s*([^*()]+?)\s*\)$/, '$1');
|
|
164
|
+
return value.trim();
|
|
165
|
+
}
|
|
166
|
+
const camel = (name) => name.replace(/-([a-z0-9])/g, (_m, c) => c.toUpperCase());
|
|
167
|
+
/** Resolve the token spec against the vendored theme into concrete values. */
|
|
168
|
+
export function resolveTokens(themeOverride = civitaiThemeSource) {
|
|
169
|
+
const theme = mergeMantineTheme(DEFAULT_THEME, themeOverride);
|
|
170
|
+
const resolved = defaultCssVariablesResolver(theme);
|
|
171
|
+
const lightDict = { ...resolved.variables, ...resolved.light };
|
|
172
|
+
const darkDict = { ...resolved.variables, ...resolved.dark };
|
|
173
|
+
const root = {};
|
|
174
|
+
const dark = {};
|
|
175
|
+
const meta = [];
|
|
176
|
+
for (const spec of TOKEN_SPEC) {
|
|
177
|
+
const varName = `--civitai-${spec.name}`;
|
|
178
|
+
const lightVal = resolveValue(`var(${spec.source})`, lightDict);
|
|
179
|
+
const darkVal = resolveValue(`var(${spec.source})`, darkDict);
|
|
180
|
+
root[varName] = lightVal;
|
|
181
|
+
if (darkVal !== lightVal)
|
|
182
|
+
dark[varName] = darkVal;
|
|
183
|
+
meta.push({ varName, camel: camel(spec.name), type: spec.type, description: spec.description });
|
|
184
|
+
}
|
|
185
|
+
return { root, dark, meta };
|
|
186
|
+
}
|
|
187
|
+
/** Parse `"0.25rem"` / `"4px"` into a DTCG 2025.10 dimension object. */
|
|
188
|
+
function toDtcgDimension(value) {
|
|
189
|
+
const m = /^(-?[\d.]+)(px|rem|em)$/.exec(value.trim());
|
|
190
|
+
if (!m)
|
|
191
|
+
return value;
|
|
192
|
+
return { value: Number(m[1]), unit: m[2] };
|
|
193
|
+
}
|
|
194
|
+
const AUTOGEN_BANNER = '/* AUTOGENERATED by @civitai/theme (scripts/build-tokens.ts). DO NOT EDIT.\n' +
|
|
195
|
+
' Regenerate: pnpm --filter @civitai/theme build. Guarded by generation-parity test. */';
|
|
196
|
+
/** Build every artifact string. PURE — no fs. */
|
|
197
|
+
export function buildArtifacts(themeOverride = civitaiThemeSource) {
|
|
198
|
+
const { root, dark, meta } = resolveTokens(themeOverride);
|
|
199
|
+
// ---- tokens.css ----
|
|
200
|
+
// Register only `<color>` tokens with @property: their hex/rgba values are
|
|
201
|
+
// computationally-independent (valid `initial-value`). Length tokens (radius)
|
|
202
|
+
// resolve to rem, which is font-relative and therefore NOT a valid
|
|
203
|
+
// @property initial-value, so registering them would make the browser drop
|
|
204
|
+
// the whole rule — we skip them and rely on the plain custom-property
|
|
205
|
+
// declaration (which applies identically). `font` is untyped.
|
|
206
|
+
const propertyRules = meta
|
|
207
|
+
.filter((m) => m.type === 'color')
|
|
208
|
+
.map((m) => {
|
|
209
|
+
const initial = root[m.varName];
|
|
210
|
+
return `@property ${m.varName} {\n syntax: '<color>';\n inherits: true;\n initial-value: ${initial};\n}`;
|
|
211
|
+
})
|
|
212
|
+
.join('\n');
|
|
213
|
+
const rootBlock = meta.map((m) => ` ${m.varName}: ${root[m.varName]};`).join('\n');
|
|
214
|
+
// Explicit light block mirrors the :root defaults so `[data-theme='light']`
|
|
215
|
+
// (used by @civitai/components) always wins over an ambient dark ancestor.
|
|
216
|
+
const lightBlock = meta.map((m) => ` ${m.varName}: ${root[m.varName]};`).join('\n');
|
|
217
|
+
const darkBlock = meta
|
|
218
|
+
.filter((m) => m.varName in dark)
|
|
219
|
+
.map((m) => ` ${m.varName}: ${dark[m.varName]};`)
|
|
220
|
+
.join('\n');
|
|
221
|
+
const tokensCss = `${AUTOGEN_BANNER}\n` +
|
|
222
|
+
`${propertyRules}\n\n` +
|
|
223
|
+
`:root {\n${rootBlock}\n}\n\n` +
|
|
224
|
+
`[data-theme='light'] {\n${lightBlock}\n}\n\n` +
|
|
225
|
+
`[data-theme='dark'] {\n${darkBlock}\n}\n`;
|
|
226
|
+
// ---- tokens.dtcg.json (W3C DTCG 2025.10) ----
|
|
227
|
+
const dtcg = {};
|
|
228
|
+
for (const m of meta) {
|
|
229
|
+
const [group, ...restParts] = m.camel.replace(/([A-Z])/g, ' $1').trim().split(' ');
|
|
230
|
+
// Group by leading segment of the token name (color / font / radius).
|
|
231
|
+
const segParts = m.varName.replace('--civitai-', '').split('-');
|
|
232
|
+
const groupKey = segParts[0];
|
|
233
|
+
const leafKey = camel(segParts.slice(1).join('-')) || groupKey;
|
|
234
|
+
void group;
|
|
235
|
+
void restParts;
|
|
236
|
+
const $type = m.type === 'color' ? 'color' : m.type === 'length' ? 'dimension' : 'fontFamily';
|
|
237
|
+
const lightVal = root[m.varName];
|
|
238
|
+
const token = {
|
|
239
|
+
$type,
|
|
240
|
+
$value: $type === 'dimension' ? toDtcgDimension(lightVal) : lightVal,
|
|
241
|
+
$description: m.description,
|
|
242
|
+
};
|
|
243
|
+
if (m.varName in dark) {
|
|
244
|
+
token.$extensions = {
|
|
245
|
+
'com.civitai.theme': {
|
|
246
|
+
dark: $type === 'dimension' ? toDtcgDimension(dark[m.varName]) : dark[m.varName],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
(dtcg[groupKey] ??= {})[leafKey] = token;
|
|
251
|
+
}
|
|
252
|
+
const tokensDtcgJson = JSON.stringify(dtcg, null, 2) + '\n';
|
|
253
|
+
// ---- tokens.generated.ts (typed JS export) ----
|
|
254
|
+
const tokensObj = Object.fromEntries(meta.map((m) => [m.camel, root[m.varName]]));
|
|
255
|
+
const darkObj = Object.fromEntries(meta.filter((m) => m.varName in dark).map((m) => [m.camel, dark[m.varName]]));
|
|
256
|
+
const varsObj = Object.fromEntries(meta.map((m) => [m.camel, `var(${m.varName})`]));
|
|
257
|
+
const tokensGeneratedTs = `${AUTOGEN_BANNER}\n\n` +
|
|
258
|
+
`/** Resolved light/base token values, keyed by camelCase name. */\n` +
|
|
259
|
+
`export const tokens = ${JSON.stringify(tokensObj, null, 2)} as const;\n\n` +
|
|
260
|
+
`/** Dark-scheme overrides (only tokens that differ from light). */\n` +
|
|
261
|
+
`export const darkTokens = ${JSON.stringify(darkObj, null, 2)} as const;\n\n` +
|
|
262
|
+
`/** \`var(--civitai-*)\` reference strings for inline JS styling. */\n` +
|
|
263
|
+
`export const tokenVars = ${JSON.stringify(varsObj, null, 2)} as const;\n\n` +
|
|
264
|
+
`/** The full \`--civitai-*\` stylesheet (\`:root\` + light/dark). Also emitted to dist/tokens.css. */\n` +
|
|
265
|
+
`export const tokensCss = ${JSON.stringify(tokensCss)};\n\n` +
|
|
266
|
+
`export type TokenName = keyof typeof tokens;\n`;
|
|
267
|
+
return {
|
|
268
|
+
'tokens.css': tokensCss,
|
|
269
|
+
'tokens.dtcg.json': tokensDtcgJson,
|
|
270
|
+
'tokens.generated.ts': tokensGeneratedTs,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,iBAAiB,GAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAavD;;;;GAIG;AACH,MAAM,UAAU,GAAyB;IACvC,wDAAwD;IACxD;QACE,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,uBAAuB;QAC/B,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,oDAAoD;KAClE;IACD;QACE,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,iCAAiC;QACzC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,uBAAuB;KACrC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gEAAgE;KAC9E;IACD,4DAA4D;IAC5D;QACE,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,sBAAsB;QAC9B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,0BAA0B;KACxC;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,wBAAwB;QAChC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,+BAA+B;KAC7C;IACD;QACE,IAAI,EAAE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 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@civitai/theme` — framework-agnostic design tokens.
|
|
3
|
+
*
|
|
4
|
+
* Public surface:
|
|
5
|
+
* - `tokens` / `darkTokens` / `tokenVars` — typed token values (generated).
|
|
6
|
+
* - `tokensCss` — the full `--civitai-*` stylesheet string.
|
|
7
|
+
* - `injectTokens(doc?)` — inject the stylesheet at runtime (JS consumers).
|
|
8
|
+
*
|
|
9
|
+
* Non-JS consumers link the stylesheet directly:
|
|
10
|
+
* `<link rel="stylesheet" href="@civitai/theme/styles.css">`
|
|
11
|
+
* or fetch the DTCG export at `@civitai/theme/tokens.json`.
|
|
12
|
+
*/
|
|
13
|
+
export { tokens, darkTokens, tokenVars, tokensCss, type TokenName } from './tokens.generated.js';
|
|
14
|
+
export { injectTokens } from './inject.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@civitai/theme` — framework-agnostic design tokens.
|
|
3
|
+
*
|
|
4
|
+
* Public surface:
|
|
5
|
+
* - `tokens` / `darkTokens` / `tokenVars` — typed token values (generated).
|
|
6
|
+
* - `tokensCss` — the full `--civitai-*` stylesheet string.
|
|
7
|
+
* - `injectTokens(doc?)` — inject the stylesheet at runtime (JS consumers).
|
|
8
|
+
*
|
|
9
|
+
* Non-JS consumers link the stylesheet directly:
|
|
10
|
+
* `<link rel="stylesheet" href="@civitai/theme/styles.css">`
|
|
11
|
+
* or fetch the DTCG export at `@civitai/theme/tokens.json`.
|
|
12
|
+
*/
|
|
13
|
+
export { tokens, darkTokens, tokenVars, tokensCss } from './tokens.generated.js';
|
|
14
|
+
export { injectTokens } from './inject.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAkB,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/inject.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject the `--civitai-*` token stylesheet into a document's `<head>` exactly
|
|
3
|
+
* once. Idempotent (marker `<style>` detected -> no-op). No-op with no document
|
|
4
|
+
* (SSR). Mirrors `@civitai/blocks-react`'s inject approach so the two packages
|
|
5
|
+
* behave identically for JS consumers that can't use a `<link>`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function injectTokens(doc?: Document): void;
|
|
8
|
+
//# sourceMappingURL=inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAUjD"}
|
package/dist/inject.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tokensCss } from './tokens.generated.js';
|
|
2
|
+
/** Marker attribute on the injected `<style>` so injection is idempotent. */
|
|
3
|
+
const STYLE_MARKER = 'data-civitai-theme';
|
|
4
|
+
/**
|
|
5
|
+
* Inject the `--civitai-*` token stylesheet into a document's `<head>` exactly
|
|
6
|
+
* once. Idempotent (marker `<style>` detected -> no-op). No-op with no document
|
|
7
|
+
* (SSR). Mirrors `@civitai/blocks-react`'s inject approach so the two packages
|
|
8
|
+
* behave identically for JS consumers that can't use a `<link>`.
|
|
9
|
+
*/
|
|
10
|
+
export function injectTokens(doc) {
|
|
11
|
+
const target = doc ?? (typeof document !== 'undefined' ? document : undefined);
|
|
12
|
+
if (!target)
|
|
13
|
+
return;
|
|
14
|
+
if (target.querySelector(`style[${STYLE_MARKER}]`))
|
|
15
|
+
return;
|
|
16
|
+
const style = target.createElement('style');
|
|
17
|
+
style.setAttribute(STYLE_MARKER, 'true');
|
|
18
|
+
style.textContent = tokensCss;
|
|
19
|
+
const head = target.head ?? target.getElementsByTagName('head')[0];
|
|
20
|
+
if (head)
|
|
21
|
+
head.appendChild(style);
|
|
22
|
+
else
|
|
23
|
+
target.documentElement.appendChild(style);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,6EAA6E;AAC7E,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAc;IACzC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/E,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,IAAI,MAAM,CAAC,aAAa,CAAC,SAAS,YAAY,GAAG,CAAC;QAAE,OAAO;IAC3D,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5C,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,IAAI;QAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;;QAC7B,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VENDORED civitai theme override — the GENERATOR INPUT for `@civitai/theme`.
|
|
3
|
+
*
|
|
4
|
+
* This is a byte-faithful copy of the CSS-variable-relevant fields of the
|
|
5
|
+
* `createTheme({...})` override in civitai/civitai's
|
|
6
|
+
* `src/providers/ThemeProvider.tsx`. civitai/civitai is NOT published as a
|
|
7
|
+
* package, so we vendor the override here and feed it through Mantine's public
|
|
8
|
+
* theme -> CSS-variable pipeline (see `generate.ts`) to derive the `--civitai-*`
|
|
9
|
+
* token contract.
|
|
10
|
+
*
|
|
11
|
+
* ONLY the fields that influence Mantine's resolved CSS variables are vendored:
|
|
12
|
+
* - `colors` (palette tuples — incl. civitai's custom `success`/`accent`/… )
|
|
13
|
+
* - `white` / `black`
|
|
14
|
+
* - `primaryColor` / `primaryShade` / `defaultRadius` / `fontFamily`
|
|
15
|
+
* (civitai does NOT override these, so they are ABSENT here and the
|
|
16
|
+
* Mantine defaults apply — that is intentional and faithful).
|
|
17
|
+
*
|
|
18
|
+
* The override's `components: {...}` block (Modal.extend, defaultProps, …) is
|
|
19
|
+
* deliberately NOT vendored: component styles/defaultProps do not participate
|
|
20
|
+
* in `defaultCssVariablesResolver`, so they cannot affect the token output.
|
|
21
|
+
*
|
|
22
|
+
* A drift-guard test (`test/theme-drift.test.ts`) reads civitai/civitai's live
|
|
23
|
+
* `ThemeProvider.tsx` and FAILS if any vendored value below diverges from it —
|
|
24
|
+
* so this copy can never silently rot.
|
|
25
|
+
*/
|
|
26
|
+
import type { MantineThemeOverride } from '@mantine/core';
|
|
27
|
+
export declare const civitaiThemeSource: MantineThemeOverride;
|
|
28
|
+
/**
|
|
29
|
+
* The subset of theme fields the drift-guard compares against civitai/civitai's
|
|
30
|
+
* live source. Kept in one place so the guard and the vendored object cannot
|
|
31
|
+
* disagree about scope.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DRIFT_GUARDED_COLOR_KEYS: readonly ["dark", "gray", "yellow", "green", "blue", "red", "orange", "lime", "gold", "accent", "success"];
|
|
34
|
+
/**
|
|
35
|
+
* Theme fields civitai deliberately does NOT override today, so the derived
|
|
36
|
+
* `--civitai-*` tokens fall back to the Mantine defaults (blue primary,
|
|
37
|
+
* primaryShade {light:6,dark:8}, `sm` radius, the system font stack). This
|
|
38
|
+
* vendored source omits them on purpose. The drift guard asserts civitai's live
|
|
39
|
+
* `ThemeProvider.tsx` STILL omits them — if civitai adds an override the
|
|
40
|
+
* vendored source doesn't mirror, CI fails so we notice and re-vendor.
|
|
41
|
+
*/
|
|
42
|
+
export declare const DRIFT_GUARDED_ABSENT_KEYS: readonly ["primaryColor", "primaryShade", "defaultRadius", "fontFamily"];
|
|
43
|
+
//# sourceMappingURL=theme.source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.source.d.ts","sourceRoot":"","sources":["../src/theme.source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,eAAO,MAAM,kBAAkB,EAAE,oBA0IhC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4GAY3B,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,0EAK5B,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export const civitaiThemeSource = {
|
|
2
|
+
colors: {
|
|
3
|
+
dark: [
|
|
4
|
+
'#C1C2C5',
|
|
5
|
+
'#A6A7AB',
|
|
6
|
+
'#8c8fa3',
|
|
7
|
+
'#5C5F66',
|
|
8
|
+
'#373A40',
|
|
9
|
+
'#2C2E33',
|
|
10
|
+
'#25262B',
|
|
11
|
+
'#1A1B1E',
|
|
12
|
+
'#141517',
|
|
13
|
+
'#101113',
|
|
14
|
+
],
|
|
15
|
+
gray: [
|
|
16
|
+
'#f8f9fa',
|
|
17
|
+
'#f1f3f5',
|
|
18
|
+
'#e9ecef',
|
|
19
|
+
'#dee2e6',
|
|
20
|
+
'#ced4da',
|
|
21
|
+
'#adb5bd',
|
|
22
|
+
'#868e96',
|
|
23
|
+
'#495057',
|
|
24
|
+
'#343a40',
|
|
25
|
+
'#212529',
|
|
26
|
+
],
|
|
27
|
+
yellow: [
|
|
28
|
+
'#FFF9DB',
|
|
29
|
+
'#FFF3BF',
|
|
30
|
+
'#FFEC99',
|
|
31
|
+
'#FFE066',
|
|
32
|
+
'#FFD43B',
|
|
33
|
+
'#FCC419',
|
|
34
|
+
'#FAB005',
|
|
35
|
+
'#F59F00',
|
|
36
|
+
'#F08C00',
|
|
37
|
+
'#E67700',
|
|
38
|
+
],
|
|
39
|
+
green: [
|
|
40
|
+
'#EBFBEE',
|
|
41
|
+
'#D3F9D8',
|
|
42
|
+
'#B2F2BB',
|
|
43
|
+
'#8CE99A',
|
|
44
|
+
'#69DB7C',
|
|
45
|
+
'#51CF66',
|
|
46
|
+
'#40C057',
|
|
47
|
+
'#37B24D',
|
|
48
|
+
'#2F9E44',
|
|
49
|
+
'#2B8A3E',
|
|
50
|
+
],
|
|
51
|
+
blue: [
|
|
52
|
+
'#E7F5FF',
|
|
53
|
+
'#D0EBFF',
|
|
54
|
+
'#A5D8FF',
|
|
55
|
+
'#74C0FC',
|
|
56
|
+
'#4DABF7',
|
|
57
|
+
'#339AF0',
|
|
58
|
+
'#228BE6',
|
|
59
|
+
'#1C7ED6',
|
|
60
|
+
'#1971C2',
|
|
61
|
+
'#1864AB',
|
|
62
|
+
],
|
|
63
|
+
red: [
|
|
64
|
+
'#fff5f5',
|
|
65
|
+
'#ffe3e3',
|
|
66
|
+
'#ffc9c9',
|
|
67
|
+
'#ffa8a8',
|
|
68
|
+
'#ff8787',
|
|
69
|
+
'#ff6b6b',
|
|
70
|
+
'#fa5252',
|
|
71
|
+
'#f03e3e',
|
|
72
|
+
'#e03131',
|
|
73
|
+
'#c92a2a',
|
|
74
|
+
],
|
|
75
|
+
orange: [
|
|
76
|
+
'#fff4e6',
|
|
77
|
+
'#ffe8cc',
|
|
78
|
+
'#ffd8a8',
|
|
79
|
+
'#ffc078',
|
|
80
|
+
'#ffa94d',
|
|
81
|
+
'#ff922b',
|
|
82
|
+
'#fd7e14',
|
|
83
|
+
'#f76707',
|
|
84
|
+
'#e8590c',
|
|
85
|
+
'#d9480f',
|
|
86
|
+
],
|
|
87
|
+
lime: [
|
|
88
|
+
'#f4fce3',
|
|
89
|
+
'#e9fac8',
|
|
90
|
+
'#d8f5a2',
|
|
91
|
+
'#c0eb75',
|
|
92
|
+
'#a9e34b',
|
|
93
|
+
'#94d82d',
|
|
94
|
+
'#82c91e',
|
|
95
|
+
'#74b816',
|
|
96
|
+
'#66a80f',
|
|
97
|
+
'#5c940d',
|
|
98
|
+
],
|
|
99
|
+
gold: [
|
|
100
|
+
'#F6EDDF',
|
|
101
|
+
'#F2E4CF',
|
|
102
|
+
'#EDDBBF',
|
|
103
|
+
'#E9D2AF',
|
|
104
|
+
'#E5C99F',
|
|
105
|
+
'#E0C08F',
|
|
106
|
+
'#DCB77F',
|
|
107
|
+
'#D8AE6F',
|
|
108
|
+
'#D3A55F',
|
|
109
|
+
'#CD9848',
|
|
110
|
+
],
|
|
111
|
+
accent: [
|
|
112
|
+
'#F4F0EA',
|
|
113
|
+
'#E8DBCA',
|
|
114
|
+
'#E2C8A9',
|
|
115
|
+
'#E3B785',
|
|
116
|
+
'#EBA95C',
|
|
117
|
+
'#FC9C2D',
|
|
118
|
+
'#E48C27',
|
|
119
|
+
'#C37E2D',
|
|
120
|
+
'#A27036',
|
|
121
|
+
'#88643B',
|
|
122
|
+
],
|
|
123
|
+
success: [
|
|
124
|
+
'#9EC3B8',
|
|
125
|
+
'#84BCAC',
|
|
126
|
+
'#69BAA2',
|
|
127
|
+
'#4CBD9C',
|
|
128
|
+
'#32BE95',
|
|
129
|
+
'#1EBD8E',
|
|
130
|
+
'#299C7A',
|
|
131
|
+
'#2F826A',
|
|
132
|
+
'#326D5C',
|
|
133
|
+
'#325D51',
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
white: '#fefefe',
|
|
137
|
+
black: '#222',
|
|
138
|
+
respectReducedMotion: true,
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* The subset of theme fields the drift-guard compares against civitai/civitai's
|
|
142
|
+
* live source. Kept in one place so the guard and the vendored object cannot
|
|
143
|
+
* disagree about scope.
|
|
144
|
+
*/
|
|
145
|
+
export const DRIFT_GUARDED_COLOR_KEYS = [
|
|
146
|
+
'dark',
|
|
147
|
+
'gray',
|
|
148
|
+
'yellow',
|
|
149
|
+
'green',
|
|
150
|
+
'blue',
|
|
151
|
+
'red',
|
|
152
|
+
'orange',
|
|
153
|
+
'lime',
|
|
154
|
+
'gold',
|
|
155
|
+
'accent',
|
|
156
|
+
'success',
|
|
157
|
+
];
|
|
158
|
+
/**
|
|
159
|
+
* Theme fields civitai deliberately does NOT override today, so the derived
|
|
160
|
+
* `--civitai-*` tokens fall back to the Mantine defaults (blue primary,
|
|
161
|
+
* primaryShade {light:6,dark:8}, `sm` radius, the system font stack). This
|
|
162
|
+
* vendored source omits them on purpose. The drift guard asserts civitai's live
|
|
163
|
+
* `ThemeProvider.tsx` STILL omits them — if civitai adds an override the
|
|
164
|
+
* vendored source doesn't mirror, CI fails so we notice and re-vendor.
|
|
165
|
+
*/
|
|
166
|
+
export const DRIFT_GUARDED_ABSENT_KEYS = [
|
|
167
|
+
'primaryColor',
|
|
168
|
+
'primaryShade',
|
|
169
|
+
'defaultRadius',
|
|
170
|
+
'fontFamily',
|
|
171
|
+
];
|
|
172
|
+
//# sourceMappingURL=theme.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.source.js","sourceRoot":"","sources":["../src/theme.source.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,MAAM,kBAAkB,GAAyB;IACtD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,IAAI,EAAE;YACJ,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,MAAM,EAAE;YACN,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,KAAK,EAAE;YACL,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,IAAI,EAAE;YACJ,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,GAAG,EAAE;YACH,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,MAAM,EAAE;YACN,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,IAAI,EAAE;YACJ,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,IAAI,EAAE;YACJ,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,MAAM,EAAE;YACN,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;QACD,OAAO,EAAE;YACP,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;KACF;IACD,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,MAAM;IACb,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;CACD,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,cAAc;IACd,cAAc;IACd,eAAe;IACf,YAAY;CACJ,CAAC"}
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* AUTOGENERATED by @civitai/theme (scripts/build-tokens.ts). DO NOT EDIT.
|
|
2
|
+
Regenerate: pnpm --filter @civitai/theme build. Guarded by generation-parity test. */
|
|
3
|
+
@property --civitai-color-text {
|
|
4
|
+
syntax: '<color>';
|
|
5
|
+
inherits: true;
|
|
6
|
+
initial-value: #222;
|
|
7
|
+
}
|
|
8
|
+
@property --civitai-color-text-dimmed {
|
|
9
|
+
syntax: '<color>';
|
|
10
|
+
inherits: true;
|
|
11
|
+
initial-value: #868e96;
|
|
12
|
+
}
|
|
13
|
+
@property --civitai-color-surface {
|
|
14
|
+
syntax: '<color>';
|
|
15
|
+
inherits: true;
|
|
16
|
+
initial-value: #fefefe;
|
|
17
|
+
}
|
|
18
|
+
@property --civitai-color-surface-2 {
|
|
19
|
+
syntax: '<color>';
|
|
20
|
+
inherits: true;
|
|
21
|
+
initial-value: #fefefe;
|
|
22
|
+
}
|
|
23
|
+
@property --civitai-color-border {
|
|
24
|
+
syntax: '<color>';
|
|
25
|
+
inherits: true;
|
|
26
|
+
initial-value: #ced4da;
|
|
27
|
+
}
|
|
28
|
+
@property --civitai-color-primary {
|
|
29
|
+
syntax: '<color>';
|
|
30
|
+
inherits: true;
|
|
31
|
+
initial-value: #228BE6;
|
|
32
|
+
}
|
|
33
|
+
@property --civitai-color-primary-hover {
|
|
34
|
+
syntax: '<color>';
|
|
35
|
+
inherits: true;
|
|
36
|
+
initial-value: #1C7ED6;
|
|
37
|
+
}
|
|
38
|
+
@property --civitai-color-primary-fg {
|
|
39
|
+
syntax: '<color>';
|
|
40
|
+
inherits: true;
|
|
41
|
+
initial-value: #fefefe;
|
|
42
|
+
}
|
|
43
|
+
@property --civitai-color-primary-light {
|
|
44
|
+
syntax: '<color>';
|
|
45
|
+
inherits: true;
|
|
46
|
+
initial-value: rgba(34, 139, 230, 0.1);
|
|
47
|
+
}
|
|
48
|
+
@property --civitai-color-error {
|
|
49
|
+
syntax: '<color>';
|
|
50
|
+
inherits: true;
|
|
51
|
+
initial-value: #fa5252;
|
|
52
|
+
}
|
|
53
|
+
@property --civitai-color-success {
|
|
54
|
+
syntax: '<color>';
|
|
55
|
+
inherits: true;
|
|
56
|
+
initial-value: #299C7A;
|
|
57
|
+
}
|
|
58
|
+
@property --civitai-color-warning {
|
|
59
|
+
syntax: '<color>';
|
|
60
|
+
inherits: true;
|
|
61
|
+
initial-value: #fd7e14;
|
|
62
|
+
}
|
|
63
|
+
@property --civitai-color-info {
|
|
64
|
+
syntax: '<color>';
|
|
65
|
+
inherits: true;
|
|
66
|
+
initial-value: #228BE6;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:root {
|
|
70
|
+
--civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
|
|
71
|
+
--civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
72
|
+
--civitai-radius: 0.25rem;
|
|
73
|
+
--civitai-color-text: #222;
|
|
74
|
+
--civitai-color-text-dimmed: #868e96;
|
|
75
|
+
--civitai-color-surface: #fefefe;
|
|
76
|
+
--civitai-color-surface-2: #fefefe;
|
|
77
|
+
--civitai-color-border: #ced4da;
|
|
78
|
+
--civitai-color-primary: #228BE6;
|
|
79
|
+
--civitai-color-primary-hover: #1C7ED6;
|
|
80
|
+
--civitai-color-primary-fg: #fefefe;
|
|
81
|
+
--civitai-color-primary-light: rgba(34, 139, 230, 0.1);
|
|
82
|
+
--civitai-color-error: #fa5252;
|
|
83
|
+
--civitai-color-success: #299C7A;
|
|
84
|
+
--civitai-color-warning: #fd7e14;
|
|
85
|
+
--civitai-color-info: #228BE6;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-theme='light'] {
|
|
89
|
+
--civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
|
|
90
|
+
--civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
91
|
+
--civitai-radius: 0.25rem;
|
|
92
|
+
--civitai-color-text: #222;
|
|
93
|
+
--civitai-color-text-dimmed: #868e96;
|
|
94
|
+
--civitai-color-surface: #fefefe;
|
|
95
|
+
--civitai-color-surface-2: #fefefe;
|
|
96
|
+
--civitai-color-border: #ced4da;
|
|
97
|
+
--civitai-color-primary: #228BE6;
|
|
98
|
+
--civitai-color-primary-hover: #1C7ED6;
|
|
99
|
+
--civitai-color-primary-fg: #fefefe;
|
|
100
|
+
--civitai-color-primary-light: rgba(34, 139, 230, 0.1);
|
|
101
|
+
--civitai-color-error: #fa5252;
|
|
102
|
+
--civitai-color-success: #299C7A;
|
|
103
|
+
--civitai-color-warning: #fd7e14;
|
|
104
|
+
--civitai-color-info: #228BE6;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[data-theme='dark'] {
|
|
108
|
+
--civitai-color-text: #C1C2C5;
|
|
109
|
+
--civitai-color-text-dimmed: #8c8fa3;
|
|
110
|
+
--civitai-color-surface: #1A1B1E;
|
|
111
|
+
--civitai-color-surface-2: #25262B;
|
|
112
|
+
--civitai-color-border: #373A40;
|
|
113
|
+
--civitai-color-primary: #1971C2;
|
|
114
|
+
--civitai-color-primary-hover: #1864AB;
|
|
115
|
+
--civitai-color-primary-light: rgba(34, 139, 230, 0.15);
|
|
116
|
+
--civitai-color-error: #e03131;
|
|
117
|
+
--civitai-color-success: #326D5C;
|
|
118
|
+
--civitai-color-warning: #e8590c;
|
|
119
|
+
--civitai-color-info: #1971C2;
|
|
120
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"font": {
|
|
3
|
+
"font": {
|
|
4
|
+
"$type": "fontFamily",
|
|
5
|
+
"$value": "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
|
|
6
|
+
"$description": "Base UI font stack (Mantine default system stack)."
|
|
7
|
+
},
|
|
8
|
+
"mono": {
|
|
9
|
+
"$type": "fontFamily",
|
|
10
|
+
"$value": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
|
|
11
|
+
"$description": "Monospace font stack."
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"radius": {
|
|
15
|
+
"radius": {
|
|
16
|
+
"$type": "dimension",
|
|
17
|
+
"$value": {
|
|
18
|
+
"value": 0.25,
|
|
19
|
+
"unit": "rem"
|
|
20
|
+
},
|
|
21
|
+
"$description": "Default corner radius (civitai leaves Mantine's `sm` default)."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"color": {
|
|
25
|
+
"text": {
|
|
26
|
+
"$type": "color",
|
|
27
|
+
"$value": "#222",
|
|
28
|
+
"$description": "Primary body text color.",
|
|
29
|
+
"$extensions": {
|
|
30
|
+
"com.civitai.theme": {
|
|
31
|
+
"dark": "#C1C2C5"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"textDimmed": {
|
|
36
|
+
"$type": "color",
|
|
37
|
+
"$value": "#868e96",
|
|
38
|
+
"$description": "Secondary / muted text color.",
|
|
39
|
+
"$extensions": {
|
|
40
|
+
"com.civitai.theme": {
|
|
41
|
+
"dark": "#8c8fa3"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"surface": {
|
|
46
|
+
"$type": "color",
|
|
47
|
+
"$value": "#fefefe",
|
|
48
|
+
"$description": "Primary surface / page background.",
|
|
49
|
+
"$extensions": {
|
|
50
|
+
"com.civitai.theme": {
|
|
51
|
+
"dark": "#1A1B1E"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"surface2": {
|
|
56
|
+
"$type": "color",
|
|
57
|
+
"$value": "#fefefe",
|
|
58
|
+
"$description": "Secondary surface (inputs, insets).",
|
|
59
|
+
"$extensions": {
|
|
60
|
+
"com.civitai.theme": {
|
|
61
|
+
"dark": "#25262B"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"border": {
|
|
66
|
+
"$type": "color",
|
|
67
|
+
"$value": "#ced4da",
|
|
68
|
+
"$description": "Default border / divider color.",
|
|
69
|
+
"$extensions": {
|
|
70
|
+
"com.civitai.theme": {
|
|
71
|
+
"dark": "#373A40"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"primary": {
|
|
76
|
+
"$type": "color",
|
|
77
|
+
"$value": "#228BE6",
|
|
78
|
+
"$description": "Primary accent (filled) color.",
|
|
79
|
+
"$extensions": {
|
|
80
|
+
"com.civitai.theme": {
|
|
81
|
+
"dark": "#1971C2"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"primaryHover": {
|
|
86
|
+
"$type": "color",
|
|
87
|
+
"$value": "#1C7ED6",
|
|
88
|
+
"$description": "Primary accent hover color.",
|
|
89
|
+
"$extensions": {
|
|
90
|
+
"com.civitai.theme": {
|
|
91
|
+
"dark": "#1864AB"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"primaryFg": {
|
|
96
|
+
"$type": "color",
|
|
97
|
+
"$value": "#fefefe",
|
|
98
|
+
"$description": "Foreground/text color on a filled primary surface."
|
|
99
|
+
},
|
|
100
|
+
"primaryLight": {
|
|
101
|
+
"$type": "color",
|
|
102
|
+
"$value": "rgba(34, 139, 230, 0.1)",
|
|
103
|
+
"$description": "Translucent primary tint (light variant background).",
|
|
104
|
+
"$extensions": {
|
|
105
|
+
"com.civitai.theme": {
|
|
106
|
+
"dark": "rgba(34, 139, 230, 0.15)"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"error": {
|
|
111
|
+
"$type": "color",
|
|
112
|
+
"$value": "#fa5252",
|
|
113
|
+
"$description": "Error / destructive color.",
|
|
114
|
+
"$extensions": {
|
|
115
|
+
"com.civitai.theme": {
|
|
116
|
+
"dark": "#e03131"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"success": {
|
|
121
|
+
"$type": "color",
|
|
122
|
+
"$value": "#299C7A",
|
|
123
|
+
"$description": "Success color (civitai's custom `success` palette).",
|
|
124
|
+
"$extensions": {
|
|
125
|
+
"com.civitai.theme": {
|
|
126
|
+
"dark": "#326D5C"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"warning": {
|
|
131
|
+
"$type": "color",
|
|
132
|
+
"$value": "#fd7e14",
|
|
133
|
+
"$description": "Warning color (derived from the orange palette).",
|
|
134
|
+
"$extensions": {
|
|
135
|
+
"com.civitai.theme": {
|
|
136
|
+
"dark": "#e8590c"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"info": {
|
|
141
|
+
"$type": "color",
|
|
142
|
+
"$value": "#228BE6",
|
|
143
|
+
"$description": "Informational color (derived from the blue palette).",
|
|
144
|
+
"$extensions": {
|
|
145
|
+
"com.civitai.theme": {
|
|
146
|
+
"dark": "#1971C2"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Resolved light/base token values, keyed by camelCase name. */
|
|
2
|
+
export declare const tokens: {
|
|
3
|
+
readonly font: "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji";
|
|
4
|
+
readonly fontMono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace";
|
|
5
|
+
readonly radius: "0.25rem";
|
|
6
|
+
readonly colorText: "#222";
|
|
7
|
+
readonly colorTextDimmed: "#868e96";
|
|
8
|
+
readonly colorSurface: "#fefefe";
|
|
9
|
+
readonly colorSurface2: "#fefefe";
|
|
10
|
+
readonly colorBorder: "#ced4da";
|
|
11
|
+
readonly colorPrimary: "#228BE6";
|
|
12
|
+
readonly colorPrimaryHover: "#1C7ED6";
|
|
13
|
+
readonly colorPrimaryFg: "#fefefe";
|
|
14
|
+
readonly colorPrimaryLight: "rgba(34, 139, 230, 0.1)";
|
|
15
|
+
readonly colorError: "#fa5252";
|
|
16
|
+
readonly colorSuccess: "#299C7A";
|
|
17
|
+
readonly colorWarning: "#fd7e14";
|
|
18
|
+
readonly colorInfo: "#228BE6";
|
|
19
|
+
};
|
|
20
|
+
/** Dark-scheme overrides (only tokens that differ from light). */
|
|
21
|
+
export declare const darkTokens: {
|
|
22
|
+
readonly colorText: "#C1C2C5";
|
|
23
|
+
readonly colorTextDimmed: "#8c8fa3";
|
|
24
|
+
readonly colorSurface: "#1A1B1E";
|
|
25
|
+
readonly colorSurface2: "#25262B";
|
|
26
|
+
readonly colorBorder: "#373A40";
|
|
27
|
+
readonly colorPrimary: "#1971C2";
|
|
28
|
+
readonly colorPrimaryHover: "#1864AB";
|
|
29
|
+
readonly colorPrimaryLight: "rgba(34, 139, 230, 0.15)";
|
|
30
|
+
readonly colorError: "#e03131";
|
|
31
|
+
readonly colorSuccess: "#326D5C";
|
|
32
|
+
readonly colorWarning: "#e8590c";
|
|
33
|
+
readonly colorInfo: "#1971C2";
|
|
34
|
+
};
|
|
35
|
+
/** `var(--civitai-*)` reference strings for inline JS styling. */
|
|
36
|
+
export declare const tokenVars: {
|
|
37
|
+
readonly font: "var(--civitai-font)";
|
|
38
|
+
readonly fontMono: "var(--civitai-font-mono)";
|
|
39
|
+
readonly radius: "var(--civitai-radius)";
|
|
40
|
+
readonly colorText: "var(--civitai-color-text)";
|
|
41
|
+
readonly colorTextDimmed: "var(--civitai-color-text-dimmed)";
|
|
42
|
+
readonly colorSurface: "var(--civitai-color-surface)";
|
|
43
|
+
readonly colorSurface2: "var(--civitai-color-surface-2)";
|
|
44
|
+
readonly colorBorder: "var(--civitai-color-border)";
|
|
45
|
+
readonly colorPrimary: "var(--civitai-color-primary)";
|
|
46
|
+
readonly colorPrimaryHover: "var(--civitai-color-primary-hover)";
|
|
47
|
+
readonly colorPrimaryFg: "var(--civitai-color-primary-fg)";
|
|
48
|
+
readonly colorPrimaryLight: "var(--civitai-color-primary-light)";
|
|
49
|
+
readonly colorError: "var(--civitai-color-error)";
|
|
50
|
+
readonly colorSuccess: "var(--civitai-color-success)";
|
|
51
|
+
readonly colorWarning: "var(--civitai-color-warning)";
|
|
52
|
+
readonly colorInfo: "var(--civitai-color-info)";
|
|
53
|
+
};
|
|
54
|
+
/** The full `--civitai-*` stylesheet (`:root` + light/dark). Also emitted to dist/tokens.css. */
|
|
55
|
+
export declare const tokensCss = "/* AUTOGENERATED by @civitai/theme (scripts/build-tokens.ts). DO NOT EDIT.\n Regenerate: pnpm --filter @civitai/theme build. Guarded by generation-parity test. */\n@property --civitai-color-text {\n syntax: '<color>';\n inherits: true;\n initial-value: #222;\n}\n@property --civitai-color-text-dimmed {\n syntax: '<color>';\n inherits: true;\n initial-value: #868e96;\n}\n@property --civitai-color-surface {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-surface-2 {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-border {\n syntax: '<color>';\n inherits: true;\n initial-value: #ced4da;\n}\n@property --civitai-color-primary {\n syntax: '<color>';\n inherits: true;\n initial-value: #228BE6;\n}\n@property --civitai-color-primary-hover {\n syntax: '<color>';\n inherits: true;\n initial-value: #1C7ED6;\n}\n@property --civitai-color-primary-fg {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-primary-light {\n syntax: '<color>';\n inherits: true;\n initial-value: rgba(34, 139, 230, 0.1);\n}\n@property --civitai-color-error {\n syntax: '<color>';\n inherits: true;\n initial-value: #fa5252;\n}\n@property --civitai-color-success {\n syntax: '<color>';\n inherits: true;\n initial-value: #299C7A;\n}\n@property --civitai-color-warning {\n syntax: '<color>';\n inherits: true;\n initial-value: #fd7e14;\n}\n@property --civitai-color-info {\n syntax: '<color>';\n inherits: true;\n initial-value: #228BE6;\n}\n\n:root {\n --civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;\n --civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n --civitai-radius: 0.25rem;\n --civitai-color-text: #222;\n --civitai-color-text-dimmed: #868e96;\n --civitai-color-surface: #fefefe;\n --civitai-color-surface-2: #fefefe;\n --civitai-color-border: #ced4da;\n --civitai-color-primary: #228BE6;\n --civitai-color-primary-hover: #1C7ED6;\n --civitai-color-primary-fg: #fefefe;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.1);\n --civitai-color-error: #fa5252;\n --civitai-color-success: #299C7A;\n --civitai-color-warning: #fd7e14;\n --civitai-color-info: #228BE6;\n}\n\n[data-theme='light'] {\n --civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;\n --civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n --civitai-radius: 0.25rem;\n --civitai-color-text: #222;\n --civitai-color-text-dimmed: #868e96;\n --civitai-color-surface: #fefefe;\n --civitai-color-surface-2: #fefefe;\n --civitai-color-border: #ced4da;\n --civitai-color-primary: #228BE6;\n --civitai-color-primary-hover: #1C7ED6;\n --civitai-color-primary-fg: #fefefe;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.1);\n --civitai-color-error: #fa5252;\n --civitai-color-success: #299C7A;\n --civitai-color-warning: #fd7e14;\n --civitai-color-info: #228BE6;\n}\n\n[data-theme='dark'] {\n --civitai-color-text: #C1C2C5;\n --civitai-color-text-dimmed: #8c8fa3;\n --civitai-color-surface: #1A1B1E;\n --civitai-color-surface-2: #25262B;\n --civitai-color-border: #373A40;\n --civitai-color-primary: #1971C2;\n --civitai-color-primary-hover: #1864AB;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.15);\n --civitai-color-error: #e03131;\n --civitai-color-success: #326D5C;\n --civitai-color-warning: #e8590c;\n --civitai-color-info: #1971C2;\n}\n";
|
|
56
|
+
export type TokenName = keyof typeof tokens;
|
|
57
|
+
//# sourceMappingURL=tokens.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.generated.d.ts","sourceRoot":"","sources":["../src/tokens.generated.ts"],"names":[],"mappings":"AAGA,iEAAiE;AACjE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;CAiBT,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAab,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAiBZ,CAAC;AAEX,iGAAiG;AACjG,eAAO,MAAM,SAAS,+oHAA+oH,CAAC;AAEtqH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* AUTOGENERATED by @civitai/theme (scripts/build-tokens.ts). DO NOT EDIT.
|
|
2
|
+
Regenerate: pnpm --filter @civitai/theme build. Guarded by generation-parity test. */
|
|
3
|
+
/** Resolved light/base token values, keyed by camelCase name. */
|
|
4
|
+
export const tokens = {
|
|
5
|
+
"font": "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
|
|
6
|
+
"fontMono": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
|
|
7
|
+
"radius": "0.25rem",
|
|
8
|
+
"colorText": "#222",
|
|
9
|
+
"colorTextDimmed": "#868e96",
|
|
10
|
+
"colorSurface": "#fefefe",
|
|
11
|
+
"colorSurface2": "#fefefe",
|
|
12
|
+
"colorBorder": "#ced4da",
|
|
13
|
+
"colorPrimary": "#228BE6",
|
|
14
|
+
"colorPrimaryHover": "#1C7ED6",
|
|
15
|
+
"colorPrimaryFg": "#fefefe",
|
|
16
|
+
"colorPrimaryLight": "rgba(34, 139, 230, 0.1)",
|
|
17
|
+
"colorError": "#fa5252",
|
|
18
|
+
"colorSuccess": "#299C7A",
|
|
19
|
+
"colorWarning": "#fd7e14",
|
|
20
|
+
"colorInfo": "#228BE6"
|
|
21
|
+
};
|
|
22
|
+
/** Dark-scheme overrides (only tokens that differ from light). */
|
|
23
|
+
export const darkTokens = {
|
|
24
|
+
"colorText": "#C1C2C5",
|
|
25
|
+
"colorTextDimmed": "#8c8fa3",
|
|
26
|
+
"colorSurface": "#1A1B1E",
|
|
27
|
+
"colorSurface2": "#25262B",
|
|
28
|
+
"colorBorder": "#373A40",
|
|
29
|
+
"colorPrimary": "#1971C2",
|
|
30
|
+
"colorPrimaryHover": "#1864AB",
|
|
31
|
+
"colorPrimaryLight": "rgba(34, 139, 230, 0.15)",
|
|
32
|
+
"colorError": "#e03131",
|
|
33
|
+
"colorSuccess": "#326D5C",
|
|
34
|
+
"colorWarning": "#e8590c",
|
|
35
|
+
"colorInfo": "#1971C2"
|
|
36
|
+
};
|
|
37
|
+
/** `var(--civitai-*)` reference strings for inline JS styling. */
|
|
38
|
+
export const tokenVars = {
|
|
39
|
+
"font": "var(--civitai-font)",
|
|
40
|
+
"fontMono": "var(--civitai-font-mono)",
|
|
41
|
+
"radius": "var(--civitai-radius)",
|
|
42
|
+
"colorText": "var(--civitai-color-text)",
|
|
43
|
+
"colorTextDimmed": "var(--civitai-color-text-dimmed)",
|
|
44
|
+
"colorSurface": "var(--civitai-color-surface)",
|
|
45
|
+
"colorSurface2": "var(--civitai-color-surface-2)",
|
|
46
|
+
"colorBorder": "var(--civitai-color-border)",
|
|
47
|
+
"colorPrimary": "var(--civitai-color-primary)",
|
|
48
|
+
"colorPrimaryHover": "var(--civitai-color-primary-hover)",
|
|
49
|
+
"colorPrimaryFg": "var(--civitai-color-primary-fg)",
|
|
50
|
+
"colorPrimaryLight": "var(--civitai-color-primary-light)",
|
|
51
|
+
"colorError": "var(--civitai-color-error)",
|
|
52
|
+
"colorSuccess": "var(--civitai-color-success)",
|
|
53
|
+
"colorWarning": "var(--civitai-color-warning)",
|
|
54
|
+
"colorInfo": "var(--civitai-color-info)"
|
|
55
|
+
};
|
|
56
|
+
/** The full `--civitai-*` stylesheet (`:root` + light/dark). Also emitted to dist/tokens.css. */
|
|
57
|
+
export const tokensCss = "/* AUTOGENERATED by @civitai/theme (scripts/build-tokens.ts). DO NOT EDIT.\n Regenerate: pnpm --filter @civitai/theme build. Guarded by generation-parity test. */\n@property --civitai-color-text {\n syntax: '<color>';\n inherits: true;\n initial-value: #222;\n}\n@property --civitai-color-text-dimmed {\n syntax: '<color>';\n inherits: true;\n initial-value: #868e96;\n}\n@property --civitai-color-surface {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-surface-2 {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-border {\n syntax: '<color>';\n inherits: true;\n initial-value: #ced4da;\n}\n@property --civitai-color-primary {\n syntax: '<color>';\n inherits: true;\n initial-value: #228BE6;\n}\n@property --civitai-color-primary-hover {\n syntax: '<color>';\n inherits: true;\n initial-value: #1C7ED6;\n}\n@property --civitai-color-primary-fg {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\n}\n@property --civitai-color-primary-light {\n syntax: '<color>';\n inherits: true;\n initial-value: rgba(34, 139, 230, 0.1);\n}\n@property --civitai-color-error {\n syntax: '<color>';\n inherits: true;\n initial-value: #fa5252;\n}\n@property --civitai-color-success {\n syntax: '<color>';\n inherits: true;\n initial-value: #299C7A;\n}\n@property --civitai-color-warning {\n syntax: '<color>';\n inherits: true;\n initial-value: #fd7e14;\n}\n@property --civitai-color-info {\n syntax: '<color>';\n inherits: true;\n initial-value: #228BE6;\n}\n\n:root {\n --civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;\n --civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n --civitai-radius: 0.25rem;\n --civitai-color-text: #222;\n --civitai-color-text-dimmed: #868e96;\n --civitai-color-surface: #fefefe;\n --civitai-color-surface-2: #fefefe;\n --civitai-color-border: #ced4da;\n --civitai-color-primary: #228BE6;\n --civitai-color-primary-hover: #1C7ED6;\n --civitai-color-primary-fg: #fefefe;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.1);\n --civitai-color-error: #fa5252;\n --civitai-color-success: #299C7A;\n --civitai-color-warning: #fd7e14;\n --civitai-color-info: #228BE6;\n}\n\n[data-theme='light'] {\n --civitai-font: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;\n --civitai-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n --civitai-radius: 0.25rem;\n --civitai-color-text: #222;\n --civitai-color-text-dimmed: #868e96;\n --civitai-color-surface: #fefefe;\n --civitai-color-surface-2: #fefefe;\n --civitai-color-border: #ced4da;\n --civitai-color-primary: #228BE6;\n --civitai-color-primary-hover: #1C7ED6;\n --civitai-color-primary-fg: #fefefe;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.1);\n --civitai-color-error: #fa5252;\n --civitai-color-success: #299C7A;\n --civitai-color-warning: #fd7e14;\n --civitai-color-info: #228BE6;\n}\n\n[data-theme='dark'] {\n --civitai-color-text: #C1C2C5;\n --civitai-color-text-dimmed: #8c8fa3;\n --civitai-color-surface: #1A1B1E;\n --civitai-color-surface-2: #25262B;\n --civitai-color-border: #373A40;\n --civitai-color-primary: #1971C2;\n --civitai-color-primary-hover: #1864AB;\n --civitai-color-primary-light: rgba(34, 139, 230, 0.15);\n --civitai-color-error: #e03131;\n --civitai-color-success: #326D5C;\n --civitai-color-warning: #e8590c;\n --civitai-color-info: #1971C2;\n}\n";
|
|
58
|
+
//# sourceMappingURL=tokens.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.generated.js","sourceRoot":"","sources":["../src/tokens.generated.ts"],"names":[],"mappings":"AAAA;wFACwF;AAExF,iEAAiE;AACjE,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,sHAAsH;IAC9H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,EAAE,2BAA2B;CAChC,CAAC;AAEX,iGAAiG;AACjG,MAAM,CAAC,MAAM,SAAS,GAAG,4oHAA4oH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@civitai/theme",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Framework-agnostic --civitai-* design tokens, derived build-time from civitai's real Mantine theme. CSS + typed JS + W3C DTCG.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./styles.css": "./dist/tokens.css",
|
|
15
|
+
"./tokens.json": "./dist/tokens.dtcg.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@mantine/core": "^7.17.7",
|
|
26
|
+
"@types/node": "^25.9.1",
|
|
27
|
+
"react": "^19.0.0",
|
|
28
|
+
"react-dom": "^19.0.0",
|
|
29
|
+
"tsx": "^4.19.2",
|
|
30
|
+
"typescript": "^5.9.2",
|
|
31
|
+
"vitest": "^4.1.7"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"civitai",
|
|
38
|
+
"design-tokens",
|
|
39
|
+
"theme",
|
|
40
|
+
"css-variables",
|
|
41
|
+
"dtcg",
|
|
42
|
+
"mantine"
|
|
43
|
+
],
|
|
44
|
+
"homepage": "https://github.com/civitai/civitai-app-starters/tree/main/packages/civitai-theme#readme",
|
|
45
|
+
"bugs": "https://github.com/civitai/civitai-app-starters/issues",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/civitai/civitai-app-starters.git",
|
|
49
|
+
"directory": "packages/civitai-theme"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"generate": "tsx scripts/build-tokens.ts",
|
|
53
|
+
"build": "tsx scripts/build-tokens.ts && tsc -p tsconfig.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:self": "vitest run test/generation-parity.test.ts",
|
|
57
|
+
"test:drift": "vitest run test/theme-drift.test.ts",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|