@civitai/blocks-react 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ui/Badge.d.ts.map +1 -1
- package/dist/ui/Badge.js +17 -2
- package/dist/ui/Badge.js.map +1 -1
- package/dist/ui/BlockGate.js +4 -4
- package/dist/ui/BlockGate.js.map +1 -1
- package/dist/ui/Button.d.ts +1 -1
- package/dist/ui/Button.js +3 -3
- package/dist/ui/Button.js.map +1 -1
- package/dist/ui/Slider.d.ts +1 -1
- package/dist/ui/Slider.js +1 -1
- package/dist/ui/styles.d.ts +20 -5
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/styles.js +95 -330
- package/dist/ui/styles.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -594,7 +594,7 @@ export function App() {
|
|
|
594
594
|
| `Loader` | CSS-keyframe spinner; `size`, `color`; `role="status"`. |
|
|
595
595
|
| `Badge` | `variant`, `size`, `color`. |
|
|
596
596
|
| `Modal` | `opened` + `onClose`, `title`, `size`; `role="dialog"` + `aria-modal`, Escape- and overlay-click-to-close, focuses the panel on open and restores focus on close. |
|
|
597
|
-
| `Slider` | controlled range (`value: number`, `onChange`, `min`/`max`/`step`, `showValue`). Native `input[type=range]` — keyboard-operable, implicit `role="slider"`; accent tracks `--
|
|
597
|
+
| `Slider` | controlled range (`value: number`, `onChange`, `min`/`max`/`step`, `showValue`). Native `input[type=range]` — keyboard-operable, implicit `role="slider"`; accent tracks `--civitai-color-primary`. Same `label`/`description`/`error`/`required` wiring as `TextInput`. |
|
|
598
598
|
| `NumberInput` | controlled numeric (`value: number \| null`, `onChange`, `min`/`max`/`step`). Rejects non-numeric (never emits `NaN`), clamps to `[min,max]` on blur, empty → `null`. Same label/description/error wiring. |
|
|
599
599
|
| `Select` | controlled dropdown (`value: string`, `onChange`, `options: {value,label,disabled}[]` **or** `<option>` children, `placeholder`). Native `<select>`, `role="combobox"`. Same label/description/error wiring. |
|
|
600
600
|
| `Collapse` | controlled disclosure (`open` + `onOpenChange`, `title`, `disabled`) for the "advanced params reveal". `aria-expanded` + `aria-controls`; content region `role="region"`, `hidden` when closed. |
|
package/dist/ui/Badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/ui/Badge.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,uCAAuC;IACvC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC9E;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/ui/Badge.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,uCAAuC;IACvC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC9E;AAyBD;;GAEG;AACH,eAAO,MAAM,KAAK,wGAyBhB,CAAC"}
|
package/dist/ui/Badge.js
CHANGED
|
@@ -2,11 +2,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useBlocksStyles } from './styles.js';
|
|
4
4
|
const SEMANTIC_COLORS = new Set(['error', 'success', 'warning', 'info']);
|
|
5
|
+
/**
|
|
6
|
+
* Design-system reconciliation (0.35.0):
|
|
7
|
+
*
|
|
8
|
+
* `@civitai/components` 0.1.2 added a `data-color` intent contract to its Badge
|
|
9
|
+
* (info / success / warning / error), mirroring Alert. We deliberately DO NOT
|
|
10
|
+
* emit `data-color` here and keep the pre-existing inline-CSS-var override
|
|
11
|
+
* instead (now `--civitai-color-primary`, renamed from `--ci-color-primary`).
|
|
12
|
+
* Rationale: this Badge's public `color` prop also accepts ANY CSS color string
|
|
13
|
+
* (e.g. `#ff00ff`, `hsl(...)`), which `data-color` cannot express — it only
|
|
14
|
+
* covers the 4 named intents. Overriding `--civitai-color-primary` inline keeps
|
|
15
|
+
* the FULL public API working unchanged (the component's variant rules read that
|
|
16
|
+
* token), so this is the least-breaking choice. Named intents resolve to the
|
|
17
|
+
* design-system's `--civitai-color-<intent>` token, so they still track the
|
|
18
|
+
* theme correctly.
|
|
19
|
+
*/
|
|
5
20
|
function resolveAccent(color) {
|
|
6
21
|
if (!color || color === 'primary')
|
|
7
22
|
return undefined;
|
|
8
23
|
if (SEMANTIC_COLORS.has(color))
|
|
9
|
-
return `var(--
|
|
24
|
+
return `var(--civitai-color-${color})`;
|
|
10
25
|
return color;
|
|
11
26
|
}
|
|
12
27
|
/**
|
|
@@ -17,7 +32,7 @@ export const Badge = forwardRef(function Badge({ variant = 'light', size = 'md',
|
|
|
17
32
|
const accent = resolveAccent(color);
|
|
18
33
|
return (_jsx("span", { ref: ref, ...rest, "data-civitai-ui": "badge", "data-variant": variant, "data-size": size, style: accent
|
|
19
34
|
? {
|
|
20
|
-
['--
|
|
35
|
+
['--civitai-color-primary']: accent,
|
|
21
36
|
...style,
|
|
22
37
|
}
|
|
23
38
|
: style, children: children }));
|
package/dist/ui/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/ui/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkB9C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzE,SAAS,aAAa,CAAC,KAA0B;IAC/C,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/ui/Badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkB9C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AACH,SAAS,aAAa,CAAC,KAA0B;IAC/C,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,uBAAuB,KAAK,GAAG,CAAC;IACvE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA8B,SAAS,KAAK,CACzE,EAAE,OAAO,GAAG,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAC/E,GAAG;IAEH,eAAe,EAAE,CAAC;IAClB,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CACL,eACE,GAAG,EAAE,GAAG,KACJ,IAAI,qBACQ,OAAO,kBACT,OAAO,eACV,IAAI,EACf,KAAK,EACH,MAAM;YACJ,CAAC,CAAE;gBACC,CAAC,yBAAmC,CAAC,EAAE,MAAM;gBAC7C,GAAG,KAAK;aACe;YAC3B,CAAC,CAAC,KAAK,YAGV,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/ui/BlockGate.js
CHANGED
|
@@ -56,21 +56,21 @@ const wrapperStyle = {
|
|
|
56
56
|
justifyContent: 'center',
|
|
57
57
|
padding: 24,
|
|
58
58
|
boxSizing: 'border-box',
|
|
59
|
-
background: 'var(--
|
|
60
|
-
color: 'var(--
|
|
59
|
+
background: 'var(--civitai-color-surface-2)',
|
|
60
|
+
color: 'var(--civitai-color-text)',
|
|
61
61
|
};
|
|
62
62
|
const brandStyle = {
|
|
63
63
|
fontSize: 12,
|
|
64
64
|
fontWeight: 700,
|
|
65
65
|
letterSpacing: '0.08em',
|
|
66
66
|
textTransform: 'uppercase',
|
|
67
|
-
color: 'var(--
|
|
67
|
+
color: 'var(--civitai-color-primary)',
|
|
68
68
|
};
|
|
69
69
|
const titleStyle = { fontSize: 18, fontWeight: 700 };
|
|
70
70
|
const bodyStyle = {
|
|
71
71
|
fontSize: 14,
|
|
72
72
|
lineHeight: 1.5,
|
|
73
|
-
color: 'var(--
|
|
73
|
+
color: 'var(--civitai-color-text-dimmed)',
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
76
|
* The branded "Open on Civitai" landing shown when a block is loaded DIRECTLY
|
package/dist/ui/BlockGate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockGate.js","sourceRoot":"","sources":["../../src/ui/BlockGate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;GAOG;AACH,SAAS,qBAAqB;IAC5B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAU,GAAG,EAAE;QAC7C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAC3F,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO;QACrF,IAAI,GAAmB,CAAC;QACxB,IAAI,CAAC;YACH,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,MAAM,QAAQ,GAAG,CAAC,CAAsB,EAAE,EAAE,CAAC,OAAO,CAAC,C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,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,cAAc,GACC;IACf,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAChD,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CACL,4BAAG,QAAQ,IAAI,KAAC,kBAAkB,IAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,GAAI,GAAI,CAC9F,CAAC;IACJ,CAAC;IACD,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC"}
|
package/dist/ui/Button.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
8
8
|
/**
|
|
9
9
|
* Accent color. `'primary'` (default) or a semantic token name
|
|
10
10
|
* (`'error' | 'success' | 'warning' | 'info'`), or any CSS color string —
|
|
11
|
-
* it overrides the `--
|
|
11
|
+
* it overrides the `--civitai-color-primary` the variant styling reads.
|
|
12
12
|
*/
|
|
13
13
|
color?: 'primary' | 'error' | 'success' | 'warning' | 'info' | (string & {});
|
|
14
14
|
/**
|
package/dist/ui/Button.js
CHANGED
|
@@ -7,7 +7,7 @@ function resolveAccent(color) {
|
|
|
7
7
|
if (!color || color === 'primary')
|
|
8
8
|
return undefined;
|
|
9
9
|
if (SEMANTIC_COLORS.has(color))
|
|
10
|
-
return `var(--
|
|
10
|
+
return `var(--civitai-color-${color})`;
|
|
11
11
|
return color;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -40,8 +40,8 @@ export const Button = forwardRef(function Button({ variant = 'filled', size = 'm
|
|
|
40
40
|
onClick?.(e);
|
|
41
41
|
}, style: accent
|
|
42
42
|
? {
|
|
43
|
-
['--
|
|
44
|
-
['--
|
|
43
|
+
['--civitai-color-primary']: accent,
|
|
44
|
+
['--civitai-color-primary-hover']: accent,
|
|
45
45
|
...style,
|
|
46
46
|
}
|
|
47
47
|
: style, children: [loading ? _jsx(Loader, { size: "sm", "aria-hidden": "true" }) : null, leftSection != null ? (_jsx("span", { "data-civitai-ui-section": "left", children: leftSection })) : null, children, rightSection != null ? (_jsx("span", { "data-civitai-ui-section": "right", children: rightSection })) : null] }));
|
package/dist/ui/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+B9C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzE,SAAS,aAAa,CAAC,KAA2B;IAChD,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+B9C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzE,SAAS,aAAa,CAAC,KAA2B;IAChD,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,uBAAuB,KAAK,GAAG,CAAC;IACvE,OAA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AC,CAAC,IAAI,EACxD,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,CACrB,0CAA8B,MAAM,YAAE,WAAW,GAAQ,CAC1D,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,EACR,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,CACtB,0CAA8B,OAAO,YAAE,YAAY,GAAQ,CAC5D,CAAC,CAAC,CAAC,IAAI,IACD,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/ui/Slider.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
31
31
|
* implicit `role="slider"` with `aria-valuemin`/`max`/`now` for free. The label,
|
|
32
32
|
* description and error are wired via `htmlFor` / `id` / `aria-describedby` /
|
|
33
33
|
* `aria-invalid`. Auto-themed via `useBlocksStyles()`; the accent tracks
|
|
34
|
-
* `--
|
|
34
|
+
* `--civitai-color-primary`.
|
|
35
35
|
*/
|
|
36
36
|
export declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
37
37
|
//# sourceMappingURL=Slider.d.ts.map
|
package/dist/ui/Slider.js
CHANGED
|
@@ -8,7 +8,7 @@ import { useBlocksStyles } from './styles.js';
|
|
|
8
8
|
* implicit `role="slider"` with `aria-valuemin`/`max`/`now` for free. The label,
|
|
9
9
|
* description and error are wired via `htmlFor` / `id` / `aria-describedby` /
|
|
10
10
|
* `aria-invalid`. Auto-themed via `useBlocksStyles()`; the accent tracks
|
|
11
|
-
* `--
|
|
11
|
+
* `--civitai-color-primary`.
|
|
12
12
|
*/
|
|
13
13
|
export const Slider = forwardRef(function Slider({ value, onChange, min = 0, max = 100, step = 1, label, description, error, required, showValue = false, className, inputClassName, id, style, ...rest }, ref) {
|
|
14
14
|
useBlocksStyles();
|
package/dist/ui/styles.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
/** The full stylesheet shipped by the pack. Exported for SSR/manual use. */
|
|
2
|
-
export declare const BLOCKS_UI_STYLES = "\n:root {\n --ci-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --ci-radius: 8px;\n --ci-color-text: #1a1a1a;\n --ci-color-text-dimmed: #6b7280;\n --ci-color-surface: #ffffff;\n --ci-color-surface-2: #f4f4f5;\n --ci-color-border: #e0e0e3;\n --ci-color-primary: #228be6;\n --ci-color-primary-hover: #1c7ed6;\n --ci-color-primary-fg: #ffffff;\n --ci-color-error: #e03131;\n --ci-color-success: #2f9e44;\n --ci-color-warning: #f08c00;\n --ci-color-info: #1971c2;\n}\n\n[data-theme='light'] {\n --ci-color-text: #1a1a1a;\n --ci-color-text-dimmed: #6b7280;\n --ci-color-surface: #ffffff;\n --ci-color-surface-2: #f4f4f5;\n --ci-color-border: #e0e0e3;\n}\n\n[data-theme='dark'] {\n --ci-color-text: #e6e6e6;\n --ci-color-text-dimmed: #909296;\n --ci-color-surface: #1a1b1e;\n --ci-color-surface-2: #25262b;\n --ci-color-border: #2c2e33;\n --ci-color-primary: #228be6;\n --ci-color-primary-hover: #339af0;\n --ci-color-primary-fg: #ffffff;\n --ci-color-error: #ff6b6b;\n --ci-color-success: #51cf66;\n --ci-color-warning: #ffa94d;\n --ci-color-info: #4dabf7;\n}\n\n\n[data-civitai-ui] {\n box-sizing: border-box;\n font-family: var(--ci-font);\n}\n[data-civitai-ui] *,\n[data-civitai-ui] *::before,\n[data-civitai-ui] *::after {\n box-sizing: border-box;\n}\n\n/* ----- Button ----- */\n[data-civitai-ui='button'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n border: 1px solid transparent;\n border-radius: var(--ci-radius);\n font-family: var(--ci-font);\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n user-select: none;\n text-decoration: none;\n transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;\n background: var(--ci-color-primary);\n color: var(--ci-color-primary-fg);\n}\n[data-civitai-ui='button'][data-size='sm'] { height: 30px; padding: 0 14px; font-size: 13px; }\n[data-civitai-ui='button'][data-size='md'] { height: 36px; padding: 0 18px; font-size: 14px; }\n[data-civitai-ui='button'][data-size='lg'] { height: 44px; padding: 0 22px; font-size: 16px; }\n[data-civitai-ui='button'][data-full-width='true'] { width: 100%; }\n[data-civitai-ui='button'][data-variant='filled'] {\n background: var(--ci-color-primary);\n color: var(--ci-color-primary-fg);\n border-color: var(--ci-color-primary);\n}\n[data-civitai-ui='button'][data-variant='filled']:hover:not(:disabled) {\n background: var(--ci-color-primary-hover);\n border-color: var(--ci-color-primary-hover);\n}\n[data-civitai-ui='button'][data-variant='light'] {\n background: color-mix(in srgb, var(--ci-color-primary) 12%, transparent);\n color: var(--ci-color-primary);\n border-color: transparent;\n}\n[data-civitai-ui='button'][data-variant='light']:hover:not(:disabled) {\n background: color-mix(in srgb, var(--ci-color-primary) 22%, transparent);\n}\n[data-civitai-ui='button'][data-variant='outline'] {\n background: transparent;\n color: var(--ci-color-primary);\n border-color: var(--ci-color-primary);\n}\n[data-civitai-ui='button'][data-variant='outline']:hover:not(:disabled) {\n background: color-mix(in srgb, var(--ci-color-primary) 10%, transparent);\n}\n[data-civitai-ui='button'][data-variant='subtle'] {\n background: transparent;\n color: var(--ci-color-primary);\n border-color: transparent;\n}\n[data-civitai-ui='button'][data-variant='subtle']:hover:not(:disabled) {\n background: color-mix(in srgb, var(--ci-color-primary) 10%, transparent);\n}\n[data-civitai-ui='button']:disabled,\n[data-civitai-ui='button'][aria-busy='true'] {\n opacity: 0.6;\n cursor: not-allowed;\n}\n[data-civitai-ui='button'] [data-civitai-ui-section] {\n display: inline-flex;\n align-items: center;\n}\n\n/* ----- TextInput / Textarea / NumberInput / Select / Slider ----- */\n[data-civitai-ui='text-input'],\n[data-civitai-ui='textarea'],\n[data-civitai-ui='number-input'],\n[data-civitai-ui='select'],\n[data-civitai-ui='slider'] {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n[data-civitai-ui-label] {\n font-size: 14px;\n font-weight: 600;\n color: var(--ci-color-text);\n}\n[data-civitai-ui-required] {\n color: var(--ci-color-error);\n margin-left: 2px;\n}\n[data-civitai-ui-description] {\n font-size: 12px;\n color: var(--ci-color-text-dimmed);\n}\n[data-civitai-ui-error] {\n font-size: 12px;\n color: var(--ci-color-error);\n}\n[data-civitai-ui-control] {\n width: 100%;\n font-family: var(--ci-font);\n font-size: 14px;\n color: var(--ci-color-text);\n background: var(--ci-color-surface);\n border: 1px solid var(--ci-color-border);\n border-radius: var(--ci-radius);\n padding: 8px 12px;\n transition: border-color 120ms ease;\n}\n[data-civitai-ui-control]:focus {\n outline: none;\n border-color: var(--ci-color-primary);\n}\n[data-civitai-ui-control][aria-invalid='true'] {\n border-color: var(--ci-color-error);\n}\n[data-civitai-ui-control]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\ntextarea[data-civitai-ui-control] {\n resize: vertical;\n line-height: 1.5;\n}\n\n/* ----- Card ----- */\n[data-civitai-ui='card'] {\n background: var(--ci-color-surface);\n border-radius: var(--ci-radius);\n color: var(--ci-color-text);\n}\n[data-civitai-ui='card'][data-with-border='true'] {\n border: 1px solid var(--ci-color-border);\n}\n[data-civitai-ui='card'][data-padding='sm'] { padding: 10px; }\n[data-civitai-ui='card'][data-padding='md'] { padding: 16px; }\n[data-civitai-ui='card'][data-padding='lg'] { padding: 24px; }\n\n/* ----- Stack / Group ----- */\n[data-civitai-ui='stack'] {\n display: flex;\n flex-direction: column;\n}\n[data-civitai-ui='group'] {\n display: flex;\n flex-direction: row;\n}\n\n/* ----- Alert ----- */\n[data-civitai-ui='alert'] {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n padding: 12px 14px;\n border-radius: var(--ci-radius);\n border: 1px solid transparent;\n font-size: 14px;\n color: var(--ci-color-text);\n}\n[data-civitai-ui='alert'][data-color='info'] {\n background: color-mix(in srgb, var(--ci-color-info) 12%, transparent);\n border-color: color-mix(in srgb, var(--ci-color-info) 35%, transparent);\n}\n[data-civitai-ui='alert'][data-color='success'] {\n background: color-mix(in srgb, var(--ci-color-success) 12%, transparent);\n border-color: color-mix(in srgb, var(--ci-color-success) 35%, transparent);\n}\n[data-civitai-ui='alert'][data-color='warning'] {\n background: color-mix(in srgb, var(--ci-color-warning) 14%, transparent);\n border-color: color-mix(in srgb, var(--ci-color-warning) 35%, transparent);\n}\n[data-civitai-ui='alert'][data-color='error'] {\n background: color-mix(in srgb, var(--ci-color-error) 12%, transparent);\n border-color: color-mix(in srgb, var(--ci-color-error) 35%, transparent);\n}\n[data-civitai-ui='alert'] [data-civitai-ui-alert-body] {\n flex: 1;\n min-width: 0;\n}\n[data-civitai-ui='alert'] [data-civitai-ui-alert-title] {\n font-weight: 600;\n margin-bottom: 2px;\n}\n[data-civitai-ui='alert'] [data-civitai-ui-alert-close] {\n background: transparent;\n border: none;\n cursor: pointer;\n color: inherit;\n font-size: 16px;\n line-height: 1;\n padding: 0;\n opacity: 0.7;\n}\n[data-civitai-ui='alert'] [data-civitai-ui-alert-close]:hover {\n opacity: 1;\n}\n\n/* ----- Loader ----- */\n[data-civitai-ui='loader'] {\n display: inline-block;\n border-radius: 50%;\n border-style: solid;\n border-color: color-mix(in srgb, currentColor 25%, transparent);\n border-top-color: currentColor;\n color: var(--ci-color-primary);\n animation: civitai-ui-spin 0.7s linear infinite;\n}\n[data-civitai-ui='loader'][data-size='sm'] { width: 16px; height: 16px; border-width: 2px; }\n[data-civitai-ui='loader'][data-size='md'] { width: 22px; height: 22px; border-width: 3px; }\n[data-civitai-ui='loader'][data-size='lg'] { width: 32px; height: 32px; border-width: 4px; }\n@keyframes civitai-ui-spin {\n to { transform: rotate(360deg); }\n}\n[data-civitai-ui='button'] [data-civitai-ui='loader'] {\n color: currentColor;\n}\n\n/* ----- Badge ----- */\n[data-civitai-ui='badge'] {\n display: inline-flex;\n align-items: center;\n border: 1px solid transparent;\n border-radius: 999px;\n font-weight: 600;\n line-height: 1;\n white-space: nowrap;\n text-transform: uppercase;\n letter-spacing: 0.02em;\n}\n[data-civitai-ui='badge'][data-size='sm'] { height: 18px; padding: 0 8px; font-size: 10px; }\n[data-civitai-ui='badge'][data-size='md'] { height: 22px; padding: 0 10px; font-size: 11px; }\n[data-civitai-ui='badge'][data-size='lg'] { height: 26px; padding: 0 12px; font-size: 13px; }\n[data-civitai-ui='badge'][data-variant='filled'] {\n background: var(--ci-color-primary);\n color: var(--ci-color-primary-fg);\n border-color: var(--ci-color-primary);\n}\n[data-civitai-ui='badge'][data-variant='light'] {\n background: color-mix(in srgb, var(--ci-color-primary) 14%, transparent);\n color: var(--ci-color-primary);\n}\n[data-civitai-ui='badge'][data-variant='outline'] {\n background: transparent;\n color: var(--ci-color-primary);\n border-color: var(--ci-color-primary);\n}\n\n/* ----- Modal ----- */\n[data-civitai-ui='modal-overlay'] {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.55);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 32px 16px;\n overflow-y: auto;\n z-index: 1000;\n}\n[data-civitai-ui='modal'] {\n background: var(--ci-color-surface);\n color: var(--ci-color-text);\n border: 1px solid var(--ci-color-border);\n border-radius: var(--ci-radius);\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);\n width: 100%;\n max-width: 440px;\n outline: none;\n}\n[data-civitai-ui='modal'][data-size='sm'] { max-width: 340px; }\n[data-civitai-ui='modal'][data-size='md'] { max-width: 440px; }\n[data-civitai-ui='modal'][data-size='lg'] { max-width: 620px; }\n[data-civitai-ui='modal'] [data-civitai-ui-modal-header] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 16px 18px;\n border-bottom: 1px solid var(--ci-color-border);\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-title] {\n font-size: 16px;\n font-weight: 700;\n margin: 0;\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-close] {\n background: transparent;\n border: none;\n cursor: pointer;\n color: var(--ci-color-text-dimmed);\n font-size: 20px;\n line-height: 1;\n padding: 0;\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-close]:hover {\n color: var(--ci-color-text);\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-body] {\n padding: 18px;\n}\n\n/* ----- Slider ----- */\n[data-civitai-ui='slider'] [data-civitai-ui-label] {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n gap: 8px;\n}\n[data-civitai-ui-slider-value] {\n font-weight: 500;\n color: var(--ci-color-text-dimmed);\n font-variant-numeric: tabular-nums;\n}\n[data-civitai-ui-range] {\n width: 100%;\n margin: 0;\n accent-color: var(--ci-color-primary);\n cursor: pointer;\n}\n[data-civitai-ui-range]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n[data-civitai-ui-range]:focus-visible {\n outline: 2px solid var(--ci-color-primary);\n outline-offset: 2px;\n}\n\n/* ----- Collapse ----- */\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-trigger] {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 6px 0;\n background: transparent;\n border: none;\n font-family: var(--ci-font);\n font-size: 14px;\n font-weight: 600;\n color: var(--ci-color-text);\n text-align: left;\n cursor: pointer;\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-trigger]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-chevron] {\n display: inline-block;\n width: 1em;\n color: var(--ci-color-text-dimmed);\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-region] {\n padding-top: 4px;\n}\n\n/* ----- SegmentedControl ----- */\n[data-civitai-ui='segmented-control'] {\n display: inline-flex;\n flex-direction: row;\n gap: 2px;\n padding: 3px;\n background: var(--ci-color-surface-2);\n border: 1px solid var(--ci-color-border);\n border-radius: var(--ci-radius);\n vertical-align: middle;\n}\n[data-civitai-ui='segmented-control'][data-full-width='true'] {\n display: flex;\n width: 100%;\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment] {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: calc(var(--ci-radius) - 3px);\n background: transparent;\n color: var(--ci-color-text-dimmed);\n font-family: var(--ci-font);\n font-weight: 600;\n line-height: 1;\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;\n}\n[data-civitai-ui='segmented-control'][data-full-width='true'] [data-civitai-ui-segment] {\n flex: 1 1 0;\n}\n[data-civitai-ui='segmented-control'][data-size='sm'] [data-civitai-ui-segment] { height: 24px; padding: 0 12px; font-size: 13px; }\n[data-civitai-ui='segmented-control'][data-size='md'] [data-civitai-ui-segment] { height: 30px; padding: 0 16px; font-size: 14px; }\n[data-civitai-ui='segmented-control'][data-size='lg'] [data-civitai-ui-segment] { height: 38px; padding: 0 20px; font-size: 16px; }\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:hover:not(:disabled):not([data-active]) {\n color: var(--ci-color-text);\n background: color-mix(in srgb, var(--ci-color-text) 6%, transparent);\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment][data-active] {\n background: var(--ci-color-surface);\n color: var(--ci-color-primary);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:focus-visible {\n outline: 2px solid var(--ci-color-primary);\n outline-offset: 1px;\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n[data-civitai-ui='segmented-control'][data-disabled='true'] {\n opacity: 0.7;\n}\n";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* The full stylesheet shipped by the pack, composed as a single string for
|
|
3
|
+
* SSR / manual (non-JS-inject) consumers: the `--civitai-*` tokens, the
|
|
4
|
+
* `@civitai/components` presentational CSS, then this package's interactive-5
|
|
5
|
+
* CSS. (At RUNTIME, `injectBlocksStyles()` injects these as three separately
|
|
6
|
+
* marked `<style>` elements instead — see below.)
|
|
7
|
+
*/
|
|
8
|
+
export declare const BLOCKS_UI_STYLES = "/* 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-body {\n syntax: '<color>';\n inherits: true;\n initial-value: #fefefe;\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@property --civitai-color-gray-0 {\n syntax: '<color>';\n inherits: true;\n initial-value: #f8f9fa;\n}\n@property --civitai-color-gray-1 {\n syntax: '<color>';\n inherits: true;\n initial-value: #f1f3f5;\n}\n@property --civitai-color-gray-2 {\n syntax: '<color>';\n inherits: true;\n initial-value: #e9ecef;\n}\n@property --civitai-color-gray-3 {\n syntax: '<color>';\n inherits: true;\n initial-value: #dee2e6;\n}\n@property --civitai-color-gray-4 {\n syntax: '<color>';\n inherits: true;\n initial-value: #ced4da;\n}\n@property --civitai-color-gray-5 {\n syntax: '<color>';\n inherits: true;\n initial-value: #adb5bd;\n}\n@property --civitai-color-gray-6 {\n syntax: '<color>';\n inherits: true;\n initial-value: #868e96;\n}\n@property --civitai-color-gray-7 {\n syntax: '<color>';\n inherits: true;\n initial-value: #495057;\n}\n@property --civitai-color-gray-8 {\n syntax: '<color>';\n inherits: true;\n initial-value: #343a40;\n}\n@property --civitai-color-gray-9 {\n syntax: '<color>';\n inherits: true;\n initial-value: #212529;\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-body: #fefefe;\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 --civitai-color-gray-0: #f8f9fa;\n --civitai-color-gray-1: #f1f3f5;\n --civitai-color-gray-2: #e9ecef;\n --civitai-color-gray-3: #dee2e6;\n --civitai-color-gray-4: #ced4da;\n --civitai-color-gray-5: #adb5bd;\n --civitai-color-gray-6: #868e96;\n --civitai-color-gray-7: #495057;\n --civitai-color-gray-8: #343a40;\n --civitai-color-gray-9: #212529;\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-body: #fefefe;\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 --civitai-color-gray-0: #f8f9fa;\n --civitai-color-gray-1: #f1f3f5;\n --civitai-color-gray-2: #e9ecef;\n --civitai-color-gray-3: #dee2e6;\n --civitai-color-gray-4: #ced4da;\n --civitai-color-gray-5: #adb5bd;\n --civitai-color-gray-6: #868e96;\n --civitai-color-gray-7: #495057;\n --civitai-color-gray-8: #343a40;\n --civitai-color-gray-9: #212529;\n}\n\n[data-theme='dark'] {\n --civitai-color-text: #C1C2C5;\n --civitai-color-text-dimmed: #8c8fa3;\n --civitai-color-body: #1A1B1E;\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-fg: #fefefe;\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\n/*\n * @civitai/components \u2014 attribute-driven, framework-agnostic component CSS.\n *\n * Contract: style is selected by `data-civitai-ui=\"<name>\"` + `data-variant` +\n * `data-size` (+ a few component-specific `data-*`). Theme via an ancestor\n * `[data-theme='light'|'dark']`. Tokens come from @civitai/theme's `--civitai-*`\n * custom properties (link `@civitai/theme/styles.css` alongside this file, or\n * call `injectStyles()` which injects both).\n *\n * ALL rules live in `@layer civitai.components` so a consumer's own unlayered\n * CSS always wins the cascade WITHOUT specificity fights. State colors are\n * derived with `color-mix()` from base tokens (no shade enumeration), and\n * structure uses native CSS nesting (no preprocessor).\n *\n * See MARKUP.md for the full per-component markup + ARIA contract.\n */\n@layer civitai.components {\n [data-civitai-ui] {\n box-sizing: border-box;\n font-family: var(--civitai-font);\n\n & *,\n & *::before,\n & *::after {\n box-sizing: border-box;\n }\n }\n\n /* ----- Button ----- */\n [data-civitai-ui='button'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n border: 1px solid transparent;\n border-radius: var(--civitai-radius);\n font-family: var(--civitai-font);\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n user-select: none;\n text-decoration: none;\n transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;\n background: var(--civitai-color-primary);\n color: var(--civitai-color-primary-fg);\n\n &[data-size='sm'] { height: 30px; padding: 0 14px; font-size: 13px; }\n &[data-size='md'] { height: 36px; padding: 0 18px; font-size: 14px; }\n &[data-size='lg'] { height: 44px; padding: 0 22px; font-size: 16px; }\n &[data-full-width='true'] { width: 100%; }\n\n &[data-variant='filled'] {\n background: var(--civitai-color-primary);\n color: var(--civitai-color-primary-fg);\n border-color: var(--civitai-color-primary);\n\n &:hover:not(:disabled) {\n background: var(--civitai-color-primary-hover);\n border-color: var(--civitai-color-primary-hover);\n }\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-primary) 12%, transparent);\n color: var(--civitai-color-primary);\n border-color: transparent;\n\n &:hover:not(:disabled) {\n background: color-mix(in srgb, var(--civitai-color-primary) 22%, transparent);\n }\n }\n &[data-variant='outline'] {\n background: transparent;\n color: var(--civitai-color-primary);\n border-color: var(--civitai-color-primary);\n\n &:hover:not(:disabled) {\n background: color-mix(in srgb, var(--civitai-color-primary) 10%, transparent);\n }\n }\n &[data-variant='subtle'] {\n background: transparent;\n color: var(--civitai-color-primary);\n border-color: transparent;\n\n &:hover:not(:disabled) {\n background: color-mix(in srgb, var(--civitai-color-primary) 10%, transparent);\n }\n }\n &:disabled,\n &[aria-busy='true'] {\n opacity: 0.6;\n cursor: not-allowed;\n }\n & [data-civitai-ui-section] {\n display: inline-flex;\n align-items: center;\n }\n }\n\n /* ----- TextInput / Textarea / NumberInput / Select ----- */\n [data-civitai-ui='text-input'],\n [data-civitai-ui='textarea'],\n [data-civitai-ui='number-input'],\n [data-civitai-ui='select'] {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n [data-civitai-ui-label] {\n font-size: 14px;\n font-weight: 600;\n color: var(--civitai-color-text);\n }\n [data-civitai-ui-required] {\n color: var(--civitai-color-error);\n margin-left: 2px;\n }\n [data-civitai-ui-description] {\n font-size: 12px;\n color: var(--civitai-color-text-dimmed);\n }\n [data-civitai-ui-error] {\n font-size: 12px;\n color: var(--civitai-color-error);\n }\n [data-civitai-ui-control] {\n width: 100%;\n font-family: var(--civitai-font);\n font-size: 14px;\n color: var(--civitai-color-text);\n background: var(--civitai-color-surface);\n border: 1px solid var(--civitai-color-border);\n border-radius: var(--civitai-radius);\n padding: 8px 12px;\n transition: border-color 120ms ease;\n\n &:focus {\n outline: none;\n border-color: var(--civitai-color-primary);\n }\n &[aria-invalid='true'] {\n border-color: var(--civitai-color-error);\n }\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n }\n textarea[data-civitai-ui-control] {\n resize: vertical;\n line-height: 1.5;\n }\n /*\n * Select (issue #181 F6): a native <select> reusing the shared\n * `-control` field chrome (border/background/radius/focus/invalid, above).\n * Keep the native disclosure caret (most robust + accessible); just make the\n * control feel interactive and reserve room on the right so the caret never\n * overlaps a long option label.\n */\n select[data-civitai-ui-control] {\n cursor: pointer;\n padding-right: 28px;\n line-height: 1.4;\n }\n select[data-civitai-ui-control]:disabled {\n cursor: not-allowed;\n }\n\n /* ----- Checkbox / Radio (issue #181 F6) ----- */\n /*\n * Themed native <input type=\"checkbox\">/<input type=\"radio\">: `accent-color`\n * carries the primary tint (native control, so keyboard/indeterminate/tab all\n * work for free), plus custom sizing, a token focus ring, and disabled state.\n * The box + its inline label sit in a `-choice` row; description + error live\n * below, reusing the shared field markers. The inputs deliberately do NOT\n * carry `data-civitai-ui-control` (that is the full-width field-input chrome).\n */\n [data-civitai-ui='checkbox'],\n [data-civitai-ui='radio'] {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n [data-civitai-ui-choice] {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n [data-civitai-ui='checkbox'] [data-civitai-ui-label],\n [data-civitai-ui='radio'] [data-civitai-ui-label] {\n font-weight: 500;\n cursor: pointer;\n user-select: none;\n }\n [data-civitai-ui='checkbox'] input[type='checkbox'],\n [data-civitai-ui='radio'] input[type='radio'] {\n accent-color: var(--civitai-color-primary);\n width: 16px;\n height: 16px;\n margin: 0;\n flex: none;\n cursor: pointer;\n }\n [data-civitai-ui='checkbox'] input[type='checkbox']:focus-visible,\n [data-civitai-ui='radio'] input[type='radio']:focus-visible {\n outline: 2px solid var(--civitai-color-primary);\n outline-offset: 2px;\n }\n [data-civitai-ui='checkbox'] input[type='checkbox']:disabled,\n [data-civitai-ui='radio'] input[type='radio']:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n [data-civitai-ui='checkbox'] input[type='checkbox']:disabled ~ [data-civitai-ui-label],\n [data-civitai-ui='radio'] input[type='radio']:disabled ~ [data-civitai-ui-label] {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* ----- RadioGroup (issue #181 F6) \u2014 role=radiogroup layout ----- */\n [data-civitai-ui='radio-group'] {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n [data-civitai-ui-radio-options] {\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n &[data-orientation='horizontal'] {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n }\n }\n /*\n * RadioGroup group-level error (0.2.0): mirrors the field `-error` treatment.\n * The message reuses the shared `[data-civitai-ui-error]` styling (12px, error\n * token); the invalid state (`data-invalid` on the group, set alongside\n * `aria-invalid`) tints the child radios' `accent-color` to the error token so\n * the invalid cue reads on the group, not just the message text \u2014 the group\n * analogue of a field control's error-colored border.\n */\n [data-civitai-ui='radio-group'] [data-civitai-ui-error] {\n font-size: 12px;\n color: var(--civitai-color-error);\n }\n [data-civitai-ui='radio-group'][data-invalid] input[type='radio'] {\n accent-color: var(--civitai-color-error);\n }\n\n /* ----- Card ----- */\n /*\n * F5 (issue #181): in LIGHT mode --civitai-color-surface == --civitai-color-body\n * (both #fefefe), so a borderless card is invisible against the page. Give\n * every card a subtle DEFAULT hairline (a low-alpha mix of the border token)\n * so a card WITHOUT `data-with-border` is still visible. `data-with-border`\n * stays the stronger, explicit, fully-opaque border. Dark mode already\n * differentiates surface from body, so the default hairline is removed there\n * (see the [data-theme='dark'] rule below) \u2014 no over-adding. The default\n * (no [data-theme]) light palette keeps the hairline, matching light mode.\n */\n [data-civitai-ui='card'] {\n background: var(--civitai-color-surface);\n border-radius: var(--civitai-radius);\n color: var(--civitai-color-text);\n border: 1px solid color-mix(in srgb, var(--civitai-color-border) 55%, transparent);\n\n &[data-with-border='true'] {\n border: 1px solid var(--civitai-color-border);\n }\n &[data-padding='sm'] { padding: 10px; }\n &[data-padding='md'] { padding: 16px; }\n &[data-padding='lg'] { padding: 24px; }\n }\n /*\n * Dark already differentiates surface (#1A1B1E) from body \u2014 drop the default\n * hairline on a borderless card so dark is visually unchanged. An explicit\n * `data-with-border` still renders its full border.\n */\n [data-theme='dark'] [data-civitai-ui='card']:not([data-with-border='true']) {\n border: 0;\n }\n\n /* ----- Stack / Group ----- */\n [data-civitai-ui='stack'] {\n display: flex;\n flex-direction: column;\n gap: 12px;\n\n &[data-gap='sm'] { gap: 8px; }\n &[data-gap='md'] { gap: 16px; }\n &[data-gap='lg'] { gap: 24px; }\n }\n [data-civitai-ui='group'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n\n &[data-gap='sm'] { gap: 6px; }\n &[data-gap='md'] { gap: 16px; }\n &[data-gap='lg'] { gap: 24px; }\n }\n\n /* ----- Alert ----- */\n [data-civitai-ui='alert'] {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n padding: 12px 14px;\n border-radius: var(--civitai-radius);\n border: 1px solid transparent;\n font-size: 14px;\n color: var(--civitai-color-text);\n\n &[data-color='info'] {\n background: color-mix(in srgb, var(--civitai-color-info) 12%, transparent);\n border-color: color-mix(in srgb, var(--civitai-color-info) 35%, transparent);\n }\n &[data-color='success'] {\n background: color-mix(in srgb, var(--civitai-color-success) 12%, transparent);\n border-color: color-mix(in srgb, var(--civitai-color-success) 35%, transparent);\n }\n &[data-color='warning'] {\n background: color-mix(in srgb, var(--civitai-color-warning) 14%, transparent);\n border-color: color-mix(in srgb, var(--civitai-color-warning) 35%, transparent);\n }\n &[data-color='error'] {\n background: color-mix(in srgb, var(--civitai-color-error) 12%, transparent);\n border-color: color-mix(in srgb, var(--civitai-color-error) 35%, transparent);\n }\n & [data-civitai-ui-alert-body] {\n flex: 1;\n min-width: 0;\n }\n & [data-civitai-ui-alert-title] {\n font-weight: 600;\n margin-bottom: 2px;\n }\n & [data-civitai-ui-alert-close] {\n background: transparent;\n border: none;\n cursor: pointer;\n color: inherit;\n font-size: 16px;\n line-height: 1;\n padding: 0;\n opacity: 0.7;\n\n &:hover { opacity: 1; }\n }\n }\n\n /* ----- Loader ----- */\n [data-civitai-ui='loader'] {\n display: inline-block;\n border-radius: 50%;\n border-style: solid;\n border-color: color-mix(in srgb, currentColor 25%, transparent);\n border-top-color: currentColor;\n color: var(--civitai-color-primary);\n animation: civitai-ui-spin 0.7s linear infinite;\n\n &[data-size='sm'] { width: 16px; height: 16px; border-width: 2px; }\n &[data-size='md'] { width: 22px; height: 22px; border-width: 3px; }\n &[data-size='lg'] { width: 32px; height: 32px; border-width: 4px; }\n }\n [data-civitai-ui='button'] [data-civitai-ui='loader'] {\n color: currentColor;\n }\n @keyframes civitai-ui-spin {\n to { transform: rotate(360deg); }\n }\n\n /* ----- Badge ----- */\n [data-civitai-ui='badge'] {\n display: inline-flex;\n align-items: center;\n border: 1px solid transparent;\n border-radius: 999px;\n font-weight: 600;\n line-height: 1;\n white-space: nowrap;\n text-transform: uppercase;\n letter-spacing: 0.02em;\n\n &[data-size='sm'] { height: 18px; padding: 0 8px; font-size: 10px; }\n &[data-size='md'] { height: 22px; padding: 0 10px; font-size: 11px; }\n &[data-size='lg'] { height: 26px; padding: 0 12px; font-size: 13px; }\n &[data-variant='filled'] {\n background: var(--civitai-color-primary);\n color: var(--civitai-color-primary-fg);\n border-color: var(--civitai-color-primary);\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-primary) 14%, transparent);\n color: var(--civitai-color-primary);\n }\n &[data-variant='outline'] {\n background: transparent;\n color: var(--civitai-color-primary);\n border-color: var(--civitai-color-primary);\n }\n\n /*\n * Intent color via `data-color`, mirroring Alert's `data-color` contract\n * (info / success / warning / error). Absent `data-color` => the default\n * primary above (non-breaking). Each intent recolors the `filled`, `light`\n * and `outline` variants with the same `color-mix()` token approach Alert\n * uses; `filled` keeps the white `--civitai-color-primary-fg` text. These\n * `[data-color][data-variant]` rules out-specify the plain-variant rules\n * above, so order-independence holds.\n */\n &[data-color='info'] {\n &[data-variant='filled'] {\n background: var(--civitai-color-info);\n border-color: var(--civitai-color-info);\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-info) 14%, transparent);\n color: var(--civitai-color-info);\n }\n &[data-variant='outline'] {\n color: var(--civitai-color-info);\n border-color: var(--civitai-color-info);\n }\n }\n &[data-color='success'] {\n &[data-variant='filled'] {\n background: var(--civitai-color-success);\n border-color: var(--civitai-color-success);\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-success) 14%, transparent);\n color: var(--civitai-color-success);\n }\n &[data-variant='outline'] {\n color: var(--civitai-color-success);\n border-color: var(--civitai-color-success);\n }\n }\n &[data-color='warning'] {\n &[data-variant='filled'] {\n background: var(--civitai-color-warning);\n border-color: var(--civitai-color-warning);\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-warning) 14%, transparent);\n color: var(--civitai-color-warning);\n }\n &[data-variant='outline'] {\n color: var(--civitai-color-warning);\n border-color: var(--civitai-color-warning);\n }\n }\n &[data-color='error'] {\n &[data-variant='filled'] {\n background: var(--civitai-color-error);\n border-color: var(--civitai-color-error);\n }\n &[data-variant='light'] {\n background: color-mix(in srgb, var(--civitai-color-error) 14%, transparent);\n color: var(--civitai-color-error);\n }\n &[data-variant='outline'] {\n color: var(--civitai-color-error);\n border-color: var(--civitai-color-error);\n }\n }\n }\n}\n\n\n/* ----- Select / Slider field wrappers -----\n The shared -control/-label/-required/-description/-error primitives come from\n @civitai/components (layered). Only the select/slider WRAPPERS live here \u2014 the\n design-system package scopes its field-wrapper rule to the presentational\n inputs (text-input/textarea/number-input). */\n[data-civitai-ui='select'],\n[data-civitai-ui='slider'] {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n/* ----- Modal ----- */\n[data-civitai-ui='modal-overlay'] {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.55);\n display: flex;\n align-items: flex-start;\n justify-content: center;\n padding: 32px 16px;\n overflow-y: auto;\n z-index: 1000;\n}\n[data-civitai-ui='modal'] {\n background: var(--civitai-color-surface);\n color: var(--civitai-color-text);\n border: 1px solid var(--civitai-color-border);\n border-radius: var(--civitai-radius);\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);\n width: 100%;\n max-width: 440px;\n outline: none;\n}\n[data-civitai-ui='modal'][data-size='sm'] { max-width: 340px; }\n[data-civitai-ui='modal'][data-size='md'] { max-width: 440px; }\n[data-civitai-ui='modal'][data-size='lg'] { max-width: 620px; }\n[data-civitai-ui='modal'] [data-civitai-ui-modal-header] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 16px 18px;\n border-bottom: 1px solid var(--civitai-color-border);\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-title] {\n font-size: 16px;\n font-weight: 700;\n margin: 0;\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-close] {\n background: transparent;\n border: none;\n cursor: pointer;\n color: var(--civitai-color-text-dimmed);\n font-size: 20px;\n line-height: 1;\n padding: 0;\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-close]:hover {\n color: var(--civitai-color-text);\n}\n[data-civitai-ui='modal'] [data-civitai-ui-modal-body] {\n padding: 18px;\n}\n\n/* ----- Slider ----- */\n[data-civitai-ui='slider'] [data-civitai-ui-label] {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n gap: 8px;\n}\n[data-civitai-ui-slider-value] {\n font-weight: 500;\n color: var(--civitai-color-text-dimmed);\n font-variant-numeric: tabular-nums;\n}\n[data-civitai-ui-range] {\n width: 100%;\n margin: 0;\n accent-color: var(--civitai-color-primary);\n cursor: pointer;\n}\n[data-civitai-ui-range]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n[data-civitai-ui-range]:focus-visible {\n outline: 2px solid var(--civitai-color-primary);\n outline-offset: 2px;\n}\n\n/* ----- Collapse ----- */\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-trigger] {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 6px 0;\n background: transparent;\n border: none;\n font-family: var(--civitai-font);\n font-size: 14px;\n font-weight: 600;\n color: var(--civitai-color-text);\n text-align: left;\n cursor: pointer;\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-trigger]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-chevron] {\n display: inline-block;\n width: 1em;\n color: var(--civitai-color-text-dimmed);\n}\n[data-civitai-ui='collapse'] [data-civitai-ui-collapse-region] {\n padding-top: 4px;\n}\n\n/* ----- SegmentedControl ----- */\n[data-civitai-ui='segmented-control'] {\n display: inline-flex;\n flex-direction: row;\n gap: 2px;\n padding: 3px;\n background: var(--civitai-color-surface-2);\n border: 1px solid var(--civitai-color-border);\n border-radius: var(--civitai-radius);\n vertical-align: middle;\n}\n[data-civitai-ui='segmented-control'][data-full-width='true'] {\n display: flex;\n width: 100%;\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment] {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: calc(var(--civitai-radius) - 3px);\n background: transparent;\n color: var(--civitai-color-text-dimmed);\n font-family: var(--civitai-font);\n font-weight: 600;\n line-height: 1;\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;\n}\n[data-civitai-ui='segmented-control'][data-full-width='true'] [data-civitai-ui-segment] {\n flex: 1 1 0;\n}\n[data-civitai-ui='segmented-control'][data-size='sm'] [data-civitai-ui-segment] { height: 24px; padding: 0 12px; font-size: 13px; }\n[data-civitai-ui='segmented-control'][data-size='md'] [data-civitai-ui-segment] { height: 30px; padding: 0 16px; font-size: 14px; }\n[data-civitai-ui='segmented-control'][data-size='lg'] [data-civitai-ui-segment] { height: 38px; padding: 0 20px; font-size: 16px; }\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:hover:not(:disabled):not([data-active]) {\n color: var(--civitai-color-text);\n background: color-mix(in srgb, var(--civitai-color-text) 6%, transparent);\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment][data-active] {\n background: var(--civitai-color-surface);\n color: var(--civitai-color-primary);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:focus-visible {\n outline: 2px solid var(--civitai-color-primary);\n outline-offset: 1px;\n}\n[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n[data-civitai-ui='segmented-control'][data-disabled='true'] {\n opacity: 0.7;\n}\n";
|
|
9
|
+
/**
|
|
10
|
+
* Inject the pack's stylesheets into a document's `<head>`, idempotently.
|
|
11
|
+
*
|
|
12
|
+
* Injects THREE separately-marked `<style>` elements so they coexist cleanly in
|
|
13
|
+
* the block's sandbox iframe (and with any other consumer of the design-system
|
|
14
|
+
* packages in the same document):
|
|
15
|
+
* 1. `@civitai/theme` tokens (`data-civitai-theme`)
|
|
16
|
+
* 2. `@civitai/components` CSS (`data-civitai-components`)
|
|
17
|
+
* 3. this package's interactive-5 (`data-civitai-blocks-ui`)
|
|
18
|
+
* (1) and (2) are handled by `@civitai/components`'s `injectStyles()` (which
|
|
19
|
+
* injects the tokens first so the component rules always resolve their vars).
|
|
20
|
+
* Each has its own marker, so subsequent calls (including from other components,
|
|
21
|
+
* or from a block that also imports `@civitai/components` directly) no-op.
|
|
7
22
|
*
|
|
8
23
|
* @param doc Target document. Defaults to the ambient `document`. No-op when
|
|
9
24
|
* no document is available (e.g. SSR) — callers in the browser get styling,
|
package/dist/ui/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAqPA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,i/1BAA0D,CAAC;AAExF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAmBvD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAItC"}
|
package/dist/ui/styles.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { componentsCss, injectStyles as injectComponentsStyles } from '@civitai/components';
|
|
3
|
+
import { tokensCss } from '@civitai/theme';
|
|
2
4
|
/**
|
|
3
5
|
* W6 component pack — runtime style injection.
|
|
4
6
|
*
|
|
@@ -10,317 +12,62 @@ import { useEffect } from 'react';
|
|
|
10
12
|
* `injectBlocksStyles()`), so simply rendering any `/ui` component is enough
|
|
11
13
|
* to get the styling — no CSS import, no setup step.
|
|
12
14
|
*
|
|
15
|
+
* Design-system delegation (0.35.0):
|
|
16
|
+
* The pack no longer bundles its own tokens or presentational-component CSS.
|
|
17
|
+
* It delegates to the PUBLISHED design-system packages:
|
|
18
|
+
* - `@civitai/theme` — the `--civitai-*` design tokens.
|
|
19
|
+
* - `@civitai/components` — the attribute-driven CSS for the 10
|
|
20
|
+
* presentational components (Button, TextInput, Textarea, NumberInput,
|
|
21
|
+
* Card, Stack, Group, Alert, Loader, Badge), wrapped in
|
|
22
|
+
* `@layer civitai.components`.
|
|
23
|
+
* Only the 5 INTERACTIVE components that live entirely in this package
|
|
24
|
+
* (Modal, Select, Slider, Collapse, SegmentedControl) keep their CSS here,
|
|
25
|
+
* repointed onto the `--civitai-*` tokens. This is a VISIBLE repaint — the
|
|
26
|
+
* design-system tokens differ from the pack's retired `--ci-*` palette
|
|
27
|
+
* (radius 8px→4px, teal success, dark primary `#1971C2`, etc.).
|
|
28
|
+
*
|
|
29
|
+
* `injectBlocksStyles()` injects THREE `<style>` elements, each with its own
|
|
30
|
+
* idempotency marker so they compose cleanly in the sandbox iframe:
|
|
31
|
+
* 1. `data-civitai-theme` — the `--civitai-*` tokens (from @civitai/theme)
|
|
32
|
+
* 2. `data-civitai-components` — the presentational-10 CSS (from @civitai/components)
|
|
33
|
+
* 3. `data-civitai-blocks-ui` — the interactive-5-only CSS (below)
|
|
34
|
+
* (1) and (2) are injected by `@civitai/components`'s `injectStyles()`.
|
|
35
|
+
*
|
|
13
36
|
* Theming (gotcha #60): a block sets `data-theme={theme}` on its OWN root
|
|
14
37
|
* (from `BLOCK_INIT.theme`); the host can't reach across the iframe boundary.
|
|
15
|
-
*
|
|
16
|
-
* default (no `data-theme`, i.e. light) matches
|
|
17
|
-
* `
|
|
38
|
+
* The `--civitai-*` tokens theme via an ancestor `[data-theme='dark']`
|
|
39
|
+
* selector; the default (no `data-theme`, i.e. light) matches @civitai/theme's
|
|
40
|
+
* `:root` palette.
|
|
18
41
|
*/
|
|
19
|
-
/** Marker attribute on the injected `<style>` so injection is idempotent. */
|
|
42
|
+
/** Marker attribute on the injected interactive-5 `<style>` so injection is idempotent. */
|
|
20
43
|
const STYLE_MARKER = 'data-civitai-blocks-ui';
|
|
21
44
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
--ci-color-border: #e0e0e3;
|
|
36
|
-
--ci-color-primary: #228be6;
|
|
37
|
-
--ci-color-primary-hover: #1c7ed6;
|
|
38
|
-
--ci-color-primary-fg: #ffffff;
|
|
39
|
-
--ci-color-error: #e03131;
|
|
40
|
-
--ci-color-success: #2f9e44;
|
|
41
|
-
--ci-color-warning: #f08c00;
|
|
42
|
-
--ci-color-info: #1971c2;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
[data-theme='light'] {
|
|
46
|
-
--ci-color-text: #1a1a1a;
|
|
47
|
-
--ci-color-text-dimmed: #6b7280;
|
|
48
|
-
--ci-color-surface: #ffffff;
|
|
49
|
-
--ci-color-surface-2: #f4f4f5;
|
|
50
|
-
--ci-color-border: #e0e0e3;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
[data-theme='dark'] {
|
|
54
|
-
--ci-color-text: #e6e6e6;
|
|
55
|
-
--ci-color-text-dimmed: #909296;
|
|
56
|
-
--ci-color-surface: #1a1b1e;
|
|
57
|
-
--ci-color-surface-2: #25262b;
|
|
58
|
-
--ci-color-border: #2c2e33;
|
|
59
|
-
--ci-color-primary: #228be6;
|
|
60
|
-
--ci-color-primary-hover: #339af0;
|
|
61
|
-
--ci-color-primary-fg: #ffffff;
|
|
62
|
-
--ci-color-error: #ff6b6b;
|
|
63
|
-
--ci-color-success: #51cf66;
|
|
64
|
-
--ci-color-warning: #ffa94d;
|
|
65
|
-
--ci-color-info: #4dabf7;
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
/**
|
|
69
|
-
* Component CSS. All selectors hang off the `data-civitai-ui="<name>"`
|
|
70
|
-
* attribute each component renders, so the pack never leaks styles onto the
|
|
71
|
-
* author's own markup.
|
|
45
|
+
* Interactive-5 component CSS — the styles that live ONLY in this package
|
|
46
|
+
* (Modal / Select / Slider / Collapse / SegmentedControl). Repointed onto the
|
|
47
|
+
* `--civitai-*` tokens supplied by `@civitai/theme`.
|
|
48
|
+
*
|
|
49
|
+
* These rules are intentionally UNLAYERED (unlike @civitai/components' rules,
|
|
50
|
+
* which live in `@layer civitai.components`). Their selectors are DISJOINT from
|
|
51
|
+
* the presentational-10 selectors, so the two never conflict. The one exception
|
|
52
|
+
* is the shared field primitives (`-control` / `-label` / `-required` /
|
|
53
|
+
* `-description` / `-error`): those are now owned by @civitai/components and are
|
|
54
|
+
* NOT redefined here — Select and Slider reuse them and only add their own
|
|
55
|
+
* field WRAPPER (@civitai/components scopes its wrapper rule to
|
|
56
|
+
* text-input/textarea/number-input) plus a couple of scoped overrides (the
|
|
57
|
+
* slider label row).
|
|
72
58
|
*/
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[data-civitai-ui] *::before,
|
|
80
|
-
[data-civitai-ui] *::after {
|
|
81
|
-
box-sizing: border-box;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* ----- Button ----- */
|
|
85
|
-
[data-civitai-ui='button'] {
|
|
86
|
-
display: inline-flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
justify-content: center;
|
|
89
|
-
gap: 8px;
|
|
90
|
-
border: 1px solid transparent;
|
|
91
|
-
border-radius: var(--ci-radius);
|
|
92
|
-
font-family: var(--ci-font);
|
|
93
|
-
font-weight: 600;
|
|
94
|
-
line-height: 1;
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
user-select: none;
|
|
97
|
-
text-decoration: none;
|
|
98
|
-
transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
|
|
99
|
-
background: var(--ci-color-primary);
|
|
100
|
-
color: var(--ci-color-primary-fg);
|
|
101
|
-
}
|
|
102
|
-
[data-civitai-ui='button'][data-size='sm'] { height: 30px; padding: 0 14px; font-size: 13px; }
|
|
103
|
-
[data-civitai-ui='button'][data-size='md'] { height: 36px; padding: 0 18px; font-size: 14px; }
|
|
104
|
-
[data-civitai-ui='button'][data-size='lg'] { height: 44px; padding: 0 22px; font-size: 16px; }
|
|
105
|
-
[data-civitai-ui='button'][data-full-width='true'] { width: 100%; }
|
|
106
|
-
[data-civitai-ui='button'][data-variant='filled'] {
|
|
107
|
-
background: var(--ci-color-primary);
|
|
108
|
-
color: var(--ci-color-primary-fg);
|
|
109
|
-
border-color: var(--ci-color-primary);
|
|
110
|
-
}
|
|
111
|
-
[data-civitai-ui='button'][data-variant='filled']:hover:not(:disabled) {
|
|
112
|
-
background: var(--ci-color-primary-hover);
|
|
113
|
-
border-color: var(--ci-color-primary-hover);
|
|
114
|
-
}
|
|
115
|
-
[data-civitai-ui='button'][data-variant='light'] {
|
|
116
|
-
background: color-mix(in srgb, var(--ci-color-primary) 12%, transparent);
|
|
117
|
-
color: var(--ci-color-primary);
|
|
118
|
-
border-color: transparent;
|
|
119
|
-
}
|
|
120
|
-
[data-civitai-ui='button'][data-variant='light']:hover:not(:disabled) {
|
|
121
|
-
background: color-mix(in srgb, var(--ci-color-primary) 22%, transparent);
|
|
122
|
-
}
|
|
123
|
-
[data-civitai-ui='button'][data-variant='outline'] {
|
|
124
|
-
background: transparent;
|
|
125
|
-
color: var(--ci-color-primary);
|
|
126
|
-
border-color: var(--ci-color-primary);
|
|
127
|
-
}
|
|
128
|
-
[data-civitai-ui='button'][data-variant='outline']:hover:not(:disabled) {
|
|
129
|
-
background: color-mix(in srgb, var(--ci-color-primary) 10%, transparent);
|
|
130
|
-
}
|
|
131
|
-
[data-civitai-ui='button'][data-variant='subtle'] {
|
|
132
|
-
background: transparent;
|
|
133
|
-
color: var(--ci-color-primary);
|
|
134
|
-
border-color: transparent;
|
|
135
|
-
}
|
|
136
|
-
[data-civitai-ui='button'][data-variant='subtle']:hover:not(:disabled) {
|
|
137
|
-
background: color-mix(in srgb, var(--ci-color-primary) 10%, transparent);
|
|
138
|
-
}
|
|
139
|
-
[data-civitai-ui='button']:disabled,
|
|
140
|
-
[data-civitai-ui='button'][aria-busy='true'] {
|
|
141
|
-
opacity: 0.6;
|
|
142
|
-
cursor: not-allowed;
|
|
143
|
-
}
|
|
144
|
-
[data-civitai-ui='button'] [data-civitai-ui-section] {
|
|
145
|
-
display: inline-flex;
|
|
146
|
-
align-items: center;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/* ----- TextInput / Textarea / NumberInput / Select / Slider ----- */
|
|
150
|
-
[data-civitai-ui='text-input'],
|
|
151
|
-
[data-civitai-ui='textarea'],
|
|
152
|
-
[data-civitai-ui='number-input'],
|
|
59
|
+
const INTERACTIVE_STYLES = `
|
|
60
|
+
/* ----- Select / Slider field wrappers -----
|
|
61
|
+
The shared -control/-label/-required/-description/-error primitives come from
|
|
62
|
+
@civitai/components (layered). Only the select/slider WRAPPERS live here — the
|
|
63
|
+
design-system package scopes its field-wrapper rule to the presentational
|
|
64
|
+
inputs (text-input/textarea/number-input). */
|
|
153
65
|
[data-civitai-ui='select'],
|
|
154
66
|
[data-civitai-ui='slider'] {
|
|
155
67
|
display: flex;
|
|
156
68
|
flex-direction: column;
|
|
157
69
|
gap: 4px;
|
|
158
70
|
}
|
|
159
|
-
[data-civitai-ui-label] {
|
|
160
|
-
font-size: 14px;
|
|
161
|
-
font-weight: 600;
|
|
162
|
-
color: var(--ci-color-text);
|
|
163
|
-
}
|
|
164
|
-
[data-civitai-ui-required] {
|
|
165
|
-
color: var(--ci-color-error);
|
|
166
|
-
margin-left: 2px;
|
|
167
|
-
}
|
|
168
|
-
[data-civitai-ui-description] {
|
|
169
|
-
font-size: 12px;
|
|
170
|
-
color: var(--ci-color-text-dimmed);
|
|
171
|
-
}
|
|
172
|
-
[data-civitai-ui-error] {
|
|
173
|
-
font-size: 12px;
|
|
174
|
-
color: var(--ci-color-error);
|
|
175
|
-
}
|
|
176
|
-
[data-civitai-ui-control] {
|
|
177
|
-
width: 100%;
|
|
178
|
-
font-family: var(--ci-font);
|
|
179
|
-
font-size: 14px;
|
|
180
|
-
color: var(--ci-color-text);
|
|
181
|
-
background: var(--ci-color-surface);
|
|
182
|
-
border: 1px solid var(--ci-color-border);
|
|
183
|
-
border-radius: var(--ci-radius);
|
|
184
|
-
padding: 8px 12px;
|
|
185
|
-
transition: border-color 120ms ease;
|
|
186
|
-
}
|
|
187
|
-
[data-civitai-ui-control]:focus {
|
|
188
|
-
outline: none;
|
|
189
|
-
border-color: var(--ci-color-primary);
|
|
190
|
-
}
|
|
191
|
-
[data-civitai-ui-control][aria-invalid='true'] {
|
|
192
|
-
border-color: var(--ci-color-error);
|
|
193
|
-
}
|
|
194
|
-
[data-civitai-ui-control]:disabled {
|
|
195
|
-
opacity: 0.6;
|
|
196
|
-
cursor: not-allowed;
|
|
197
|
-
}
|
|
198
|
-
textarea[data-civitai-ui-control] {
|
|
199
|
-
resize: vertical;
|
|
200
|
-
line-height: 1.5;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/* ----- Card ----- */
|
|
204
|
-
[data-civitai-ui='card'] {
|
|
205
|
-
background: var(--ci-color-surface);
|
|
206
|
-
border-radius: var(--ci-radius);
|
|
207
|
-
color: var(--ci-color-text);
|
|
208
|
-
}
|
|
209
|
-
[data-civitai-ui='card'][data-with-border='true'] {
|
|
210
|
-
border: 1px solid var(--ci-color-border);
|
|
211
|
-
}
|
|
212
|
-
[data-civitai-ui='card'][data-padding='sm'] { padding: 10px; }
|
|
213
|
-
[data-civitai-ui='card'][data-padding='md'] { padding: 16px; }
|
|
214
|
-
[data-civitai-ui='card'][data-padding='lg'] { padding: 24px; }
|
|
215
|
-
|
|
216
|
-
/* ----- Stack / Group ----- */
|
|
217
|
-
[data-civitai-ui='stack'] {
|
|
218
|
-
display: flex;
|
|
219
|
-
flex-direction: column;
|
|
220
|
-
}
|
|
221
|
-
[data-civitai-ui='group'] {
|
|
222
|
-
display: flex;
|
|
223
|
-
flex-direction: row;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/* ----- Alert ----- */
|
|
227
|
-
[data-civitai-ui='alert'] {
|
|
228
|
-
display: flex;
|
|
229
|
-
gap: 10px;
|
|
230
|
-
align-items: flex-start;
|
|
231
|
-
padding: 12px 14px;
|
|
232
|
-
border-radius: var(--ci-radius);
|
|
233
|
-
border: 1px solid transparent;
|
|
234
|
-
font-size: 14px;
|
|
235
|
-
color: var(--ci-color-text);
|
|
236
|
-
}
|
|
237
|
-
[data-civitai-ui='alert'][data-color='info'] {
|
|
238
|
-
background: color-mix(in srgb, var(--ci-color-info) 12%, transparent);
|
|
239
|
-
border-color: color-mix(in srgb, var(--ci-color-info) 35%, transparent);
|
|
240
|
-
}
|
|
241
|
-
[data-civitai-ui='alert'][data-color='success'] {
|
|
242
|
-
background: color-mix(in srgb, var(--ci-color-success) 12%, transparent);
|
|
243
|
-
border-color: color-mix(in srgb, var(--ci-color-success) 35%, transparent);
|
|
244
|
-
}
|
|
245
|
-
[data-civitai-ui='alert'][data-color='warning'] {
|
|
246
|
-
background: color-mix(in srgb, var(--ci-color-warning) 14%, transparent);
|
|
247
|
-
border-color: color-mix(in srgb, var(--ci-color-warning) 35%, transparent);
|
|
248
|
-
}
|
|
249
|
-
[data-civitai-ui='alert'][data-color='error'] {
|
|
250
|
-
background: color-mix(in srgb, var(--ci-color-error) 12%, transparent);
|
|
251
|
-
border-color: color-mix(in srgb, var(--ci-color-error) 35%, transparent);
|
|
252
|
-
}
|
|
253
|
-
[data-civitai-ui='alert'] [data-civitai-ui-alert-body] {
|
|
254
|
-
flex: 1;
|
|
255
|
-
min-width: 0;
|
|
256
|
-
}
|
|
257
|
-
[data-civitai-ui='alert'] [data-civitai-ui-alert-title] {
|
|
258
|
-
font-weight: 600;
|
|
259
|
-
margin-bottom: 2px;
|
|
260
|
-
}
|
|
261
|
-
[data-civitai-ui='alert'] [data-civitai-ui-alert-close] {
|
|
262
|
-
background: transparent;
|
|
263
|
-
border: none;
|
|
264
|
-
cursor: pointer;
|
|
265
|
-
color: inherit;
|
|
266
|
-
font-size: 16px;
|
|
267
|
-
line-height: 1;
|
|
268
|
-
padding: 0;
|
|
269
|
-
opacity: 0.7;
|
|
270
|
-
}
|
|
271
|
-
[data-civitai-ui='alert'] [data-civitai-ui-alert-close]:hover {
|
|
272
|
-
opacity: 1;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/* ----- Loader ----- */
|
|
276
|
-
[data-civitai-ui='loader'] {
|
|
277
|
-
display: inline-block;
|
|
278
|
-
border-radius: 50%;
|
|
279
|
-
border-style: solid;
|
|
280
|
-
border-color: color-mix(in srgb, currentColor 25%, transparent);
|
|
281
|
-
border-top-color: currentColor;
|
|
282
|
-
color: var(--ci-color-primary);
|
|
283
|
-
animation: civitai-ui-spin 0.7s linear infinite;
|
|
284
|
-
}
|
|
285
|
-
[data-civitai-ui='loader'][data-size='sm'] { width: 16px; height: 16px; border-width: 2px; }
|
|
286
|
-
[data-civitai-ui='loader'][data-size='md'] { width: 22px; height: 22px; border-width: 3px; }
|
|
287
|
-
[data-civitai-ui='loader'][data-size='lg'] { width: 32px; height: 32px; border-width: 4px; }
|
|
288
|
-
@keyframes civitai-ui-spin {
|
|
289
|
-
to { transform: rotate(360deg); }
|
|
290
|
-
}
|
|
291
|
-
[data-civitai-ui='button'] [data-civitai-ui='loader'] {
|
|
292
|
-
color: currentColor;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/* ----- Badge ----- */
|
|
296
|
-
[data-civitai-ui='badge'] {
|
|
297
|
-
display: inline-flex;
|
|
298
|
-
align-items: center;
|
|
299
|
-
border: 1px solid transparent;
|
|
300
|
-
border-radius: 999px;
|
|
301
|
-
font-weight: 600;
|
|
302
|
-
line-height: 1;
|
|
303
|
-
white-space: nowrap;
|
|
304
|
-
text-transform: uppercase;
|
|
305
|
-
letter-spacing: 0.02em;
|
|
306
|
-
}
|
|
307
|
-
[data-civitai-ui='badge'][data-size='sm'] { height: 18px; padding: 0 8px; font-size: 10px; }
|
|
308
|
-
[data-civitai-ui='badge'][data-size='md'] { height: 22px; padding: 0 10px; font-size: 11px; }
|
|
309
|
-
[data-civitai-ui='badge'][data-size='lg'] { height: 26px; padding: 0 12px; font-size: 13px; }
|
|
310
|
-
[data-civitai-ui='badge'][data-variant='filled'] {
|
|
311
|
-
background: var(--ci-color-primary);
|
|
312
|
-
color: var(--ci-color-primary-fg);
|
|
313
|
-
border-color: var(--ci-color-primary);
|
|
314
|
-
}
|
|
315
|
-
[data-civitai-ui='badge'][data-variant='light'] {
|
|
316
|
-
background: color-mix(in srgb, var(--ci-color-primary) 14%, transparent);
|
|
317
|
-
color: var(--ci-color-primary);
|
|
318
|
-
}
|
|
319
|
-
[data-civitai-ui='badge'][data-variant='outline'] {
|
|
320
|
-
background: transparent;
|
|
321
|
-
color: var(--ci-color-primary);
|
|
322
|
-
border-color: var(--ci-color-primary);
|
|
323
|
-
}
|
|
324
71
|
|
|
325
72
|
/* ----- Modal ----- */
|
|
326
73
|
[data-civitai-ui='modal-overlay'] {
|
|
@@ -335,10 +82,10 @@ textarea[data-civitai-ui-control] {
|
|
|
335
82
|
z-index: 1000;
|
|
336
83
|
}
|
|
337
84
|
[data-civitai-ui='modal'] {
|
|
338
|
-
background: var(--
|
|
339
|
-
color: var(--
|
|
340
|
-
border: 1px solid var(--
|
|
341
|
-
border-radius: var(--
|
|
85
|
+
background: var(--civitai-color-surface);
|
|
86
|
+
color: var(--civitai-color-text);
|
|
87
|
+
border: 1px solid var(--civitai-color-border);
|
|
88
|
+
border-radius: var(--civitai-radius);
|
|
342
89
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
|
|
343
90
|
width: 100%;
|
|
344
91
|
max-width: 440px;
|
|
@@ -353,7 +100,7 @@ textarea[data-civitai-ui-control] {
|
|
|
353
100
|
justify-content: space-between;
|
|
354
101
|
gap: 12px;
|
|
355
102
|
padding: 16px 18px;
|
|
356
|
-
border-bottom: 1px solid var(--
|
|
103
|
+
border-bottom: 1px solid var(--civitai-color-border);
|
|
357
104
|
}
|
|
358
105
|
[data-civitai-ui='modal'] [data-civitai-ui-modal-title] {
|
|
359
106
|
font-size: 16px;
|
|
@@ -364,13 +111,13 @@ textarea[data-civitai-ui-control] {
|
|
|
364
111
|
background: transparent;
|
|
365
112
|
border: none;
|
|
366
113
|
cursor: pointer;
|
|
367
|
-
color: var(--
|
|
114
|
+
color: var(--civitai-color-text-dimmed);
|
|
368
115
|
font-size: 20px;
|
|
369
116
|
line-height: 1;
|
|
370
117
|
padding: 0;
|
|
371
118
|
}
|
|
372
119
|
[data-civitai-ui='modal'] [data-civitai-ui-modal-close]:hover {
|
|
373
|
-
color: var(--
|
|
120
|
+
color: var(--civitai-color-text);
|
|
374
121
|
}
|
|
375
122
|
[data-civitai-ui='modal'] [data-civitai-ui-modal-body] {
|
|
376
123
|
padding: 18px;
|
|
@@ -385,13 +132,13 @@ textarea[data-civitai-ui-control] {
|
|
|
385
132
|
}
|
|
386
133
|
[data-civitai-ui-slider-value] {
|
|
387
134
|
font-weight: 500;
|
|
388
|
-
color: var(--
|
|
135
|
+
color: var(--civitai-color-text-dimmed);
|
|
389
136
|
font-variant-numeric: tabular-nums;
|
|
390
137
|
}
|
|
391
138
|
[data-civitai-ui-range] {
|
|
392
139
|
width: 100%;
|
|
393
140
|
margin: 0;
|
|
394
|
-
accent-color: var(--
|
|
141
|
+
accent-color: var(--civitai-color-primary);
|
|
395
142
|
cursor: pointer;
|
|
396
143
|
}
|
|
397
144
|
[data-civitai-ui-range]:disabled {
|
|
@@ -399,7 +146,7 @@ textarea[data-civitai-ui-control] {
|
|
|
399
146
|
cursor: not-allowed;
|
|
400
147
|
}
|
|
401
148
|
[data-civitai-ui-range]:focus-visible {
|
|
402
|
-
outline: 2px solid var(--
|
|
149
|
+
outline: 2px solid var(--civitai-color-primary);
|
|
403
150
|
outline-offset: 2px;
|
|
404
151
|
}
|
|
405
152
|
|
|
@@ -412,10 +159,10 @@ textarea[data-civitai-ui-control] {
|
|
|
412
159
|
padding: 6px 0;
|
|
413
160
|
background: transparent;
|
|
414
161
|
border: none;
|
|
415
|
-
font-family: var(--
|
|
162
|
+
font-family: var(--civitai-font);
|
|
416
163
|
font-size: 14px;
|
|
417
164
|
font-weight: 600;
|
|
418
|
-
color: var(--
|
|
165
|
+
color: var(--civitai-color-text);
|
|
419
166
|
text-align: left;
|
|
420
167
|
cursor: pointer;
|
|
421
168
|
}
|
|
@@ -426,7 +173,7 @@ textarea[data-civitai-ui-control] {
|
|
|
426
173
|
[data-civitai-ui='collapse'] [data-civitai-ui-collapse-chevron] {
|
|
427
174
|
display: inline-block;
|
|
428
175
|
width: 1em;
|
|
429
|
-
color: var(--
|
|
176
|
+
color: var(--civitai-color-text-dimmed);
|
|
430
177
|
}
|
|
431
178
|
[data-civitai-ui='collapse'] [data-civitai-ui-collapse-region] {
|
|
432
179
|
padding-top: 4px;
|
|
@@ -438,9 +185,9 @@ textarea[data-civitai-ui-control] {
|
|
|
438
185
|
flex-direction: row;
|
|
439
186
|
gap: 2px;
|
|
440
187
|
padding: 3px;
|
|
441
|
-
background: var(--
|
|
442
|
-
border: 1px solid var(--
|
|
443
|
-
border-radius: var(--
|
|
188
|
+
background: var(--civitai-color-surface-2);
|
|
189
|
+
border: 1px solid var(--civitai-color-border);
|
|
190
|
+
border-radius: var(--civitai-radius);
|
|
444
191
|
vertical-align: middle;
|
|
445
192
|
}
|
|
446
193
|
[data-civitai-ui='segmented-control'][data-full-width='true'] {
|
|
@@ -453,10 +200,10 @@ textarea[data-civitai-ui-control] {
|
|
|
453
200
|
align-items: center;
|
|
454
201
|
justify-content: center;
|
|
455
202
|
border: none;
|
|
456
|
-
border-radius: calc(var(--
|
|
203
|
+
border-radius: calc(var(--civitai-radius) - 3px);
|
|
457
204
|
background: transparent;
|
|
458
|
-
color: var(--
|
|
459
|
-
font-family: var(--
|
|
205
|
+
color: var(--civitai-color-text-dimmed);
|
|
206
|
+
font-family: var(--civitai-font);
|
|
460
207
|
font-weight: 600;
|
|
461
208
|
line-height: 1;
|
|
462
209
|
white-space: nowrap;
|
|
@@ -471,16 +218,16 @@ textarea[data-civitai-ui-control] {
|
|
|
471
218
|
[data-civitai-ui='segmented-control'][data-size='md'] [data-civitai-ui-segment] { height: 30px; padding: 0 16px; font-size: 14px; }
|
|
472
219
|
[data-civitai-ui='segmented-control'][data-size='lg'] [data-civitai-ui-segment] { height: 38px; padding: 0 20px; font-size: 16px; }
|
|
473
220
|
[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:hover:not(:disabled):not([data-active]) {
|
|
474
|
-
color: var(--
|
|
475
|
-
background: color-mix(in srgb, var(--
|
|
221
|
+
color: var(--civitai-color-text);
|
|
222
|
+
background: color-mix(in srgb, var(--civitai-color-text) 6%, transparent);
|
|
476
223
|
}
|
|
477
224
|
[data-civitai-ui='segmented-control'] [data-civitai-ui-segment][data-active] {
|
|
478
|
-
background: var(--
|
|
479
|
-
color: var(--
|
|
225
|
+
background: var(--civitai-color-surface);
|
|
226
|
+
color: var(--civitai-color-primary);
|
|
480
227
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
|
|
481
228
|
}
|
|
482
229
|
[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:focus-visible {
|
|
483
|
-
outline: 2px solid var(--
|
|
230
|
+
outline: 2px solid var(--civitai-color-primary);
|
|
484
231
|
outline-offset: 1px;
|
|
485
232
|
}
|
|
486
233
|
[data-civitai-ui='segmented-control'] [data-civitai-ui-segment]:disabled {
|
|
@@ -491,12 +238,27 @@ textarea[data-civitai-ui-control] {
|
|
|
491
238
|
opacity: 0.7;
|
|
492
239
|
}
|
|
493
240
|
`;
|
|
494
|
-
/** The full stylesheet shipped by the pack. Exported for SSR/manual use. */
|
|
495
|
-
export const BLOCKS_UI_STYLES = `${TOKENS}\n${COMPONENT_CSS}`;
|
|
496
241
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
242
|
+
* The full stylesheet shipped by the pack, composed as a single string for
|
|
243
|
+
* SSR / manual (non-JS-inject) consumers: the `--civitai-*` tokens, the
|
|
244
|
+
* `@civitai/components` presentational CSS, then this package's interactive-5
|
|
245
|
+
* CSS. (At RUNTIME, `injectBlocksStyles()` injects these as three separately
|
|
246
|
+
* marked `<style>` elements instead — see below.)
|
|
247
|
+
*/
|
|
248
|
+
export const BLOCKS_UI_STYLES = `${tokensCss}\n${componentsCss}\n${INTERACTIVE_STYLES}`;
|
|
249
|
+
/**
|
|
250
|
+
* Inject the pack's stylesheets into a document's `<head>`, idempotently.
|
|
251
|
+
*
|
|
252
|
+
* Injects THREE separately-marked `<style>` elements so they coexist cleanly in
|
|
253
|
+
* the block's sandbox iframe (and with any other consumer of the design-system
|
|
254
|
+
* packages in the same document):
|
|
255
|
+
* 1. `@civitai/theme` tokens (`data-civitai-theme`)
|
|
256
|
+
* 2. `@civitai/components` CSS (`data-civitai-components`)
|
|
257
|
+
* 3. this package's interactive-5 (`data-civitai-blocks-ui`)
|
|
258
|
+
* (1) and (2) are handled by `@civitai/components`'s `injectStyles()` (which
|
|
259
|
+
* injects the tokens first so the component rules always resolve their vars).
|
|
260
|
+
* Each has its own marker, so subsequent calls (including from other components,
|
|
261
|
+
* or from a block that also imports `@civitai/components` directly) no-op.
|
|
500
262
|
*
|
|
501
263
|
* @param doc Target document. Defaults to the ambient `document`. No-op when
|
|
502
264
|
* no document is available (e.g. SSR) — callers in the browser get styling,
|
|
@@ -506,12 +268,15 @@ export function injectBlocksStyles(doc) {
|
|
|
506
268
|
const target = doc ?? (typeof document !== 'undefined' ? document : undefined);
|
|
507
269
|
if (!target)
|
|
508
270
|
return;
|
|
509
|
-
//
|
|
271
|
+
// Tokens (@civitai/theme) + presentational-10 (@civitai/components). Idempotent
|
|
272
|
+
// via their own markers; injects tokens first so var() refs always resolve.
|
|
273
|
+
injectComponentsStyles(target);
|
|
274
|
+
// Interactive-5-only CSS. Already injected → no-op (idempotent).
|
|
510
275
|
if (target.querySelector(`style[${STYLE_MARKER}]`))
|
|
511
276
|
return;
|
|
512
277
|
const style = target.createElement('style');
|
|
513
278
|
style.setAttribute(STYLE_MARKER, 'true');
|
|
514
|
-
style.textContent =
|
|
279
|
+
style.textContent = INTERACTIVE_STYLES;
|
|
515
280
|
const head = target.head ?? target.getElementsByTagName('head')[0];
|
|
516
281
|
if (head) {
|
|
517
282
|
head.appendChild(style);
|
package/dist/ui/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,2FAA2F;AAC3F,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C;;;;;;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5C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,kBAAkB,EAAE,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@civitai/blocks-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "React hooks and iframe transport for Civitai Apps. Pairs with @civitai/app-sdk/blocks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=20"
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@civitai/components": "0.2.0",
|
|
32
|
+
"@civitai/theme": "0.2.0"
|
|
33
|
+
},
|
|
30
34
|
"peerDependencies": {
|
|
31
35
|
"@civitai/app-sdk": "^0.26.0",
|
|
32
36
|
"react": "^18.0.0 || ^19.0.0"
|