devnonla-ui 0.20.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/index.js +1 -0
- package/dist/files/geist-mono-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/files/geist-mono-cyrillic-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-cyrillic-wght-normal.woff2 +0 -0
- package/dist/files/geist-mono-latin-ext-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist/files/geist-mono-latin-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-latin-wght-normal.woff2 +0 -0
- package/dist/files/geist-mono-symbols2-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-symbols2-wght-normal.woff2 +0 -0
- package/dist/files/geist-mono-vietnamese-wght-italic.woff2 +0 -0
- package/dist/files/geist-mono-vietnamese-wght-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-opsz-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-opsz-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-standard-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-standard-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-opsz-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-opsz-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-standard-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-standard-normal.woff2 +0 -0
- package/dist/files/inter-cyrillic-wght-italic.woff2 +0 -0
- package/dist/files/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-opsz-italic.woff2 +0 -0
- package/dist/files/inter-greek-ext-opsz-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-standard-italic.woff2 +0 -0
- package/dist/files/inter-greek-ext-standard-normal.woff2 +0 -0
- package/dist/files/inter-greek-ext-wght-italic.woff2 +0 -0
- package/dist/files/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/files/inter-greek-opsz-italic.woff2 +0 -0
- package/dist/files/inter-greek-opsz-normal.woff2 +0 -0
- package/dist/files/inter-greek-standard-italic.woff2 +0 -0
- package/dist/files/inter-greek-standard-normal.woff2 +0 -0
- package/dist/files/inter-greek-wght-italic.woff2 +0 -0
- package/dist/files/inter-greek-wght-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-opsz-italic.woff2 +0 -0
- package/dist/files/inter-latin-ext-opsz-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-standard-italic.woff2 +0 -0
- package/dist/files/inter-latin-ext-standard-normal.woff2 +0 -0
- package/dist/files/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/files/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/files/inter-latin-opsz-italic.woff2 +0 -0
- package/dist/files/inter-latin-opsz-normal.woff2 +0 -0
- package/dist/files/inter-latin-standard-italic.woff2 +0 -0
- package/dist/files/inter-latin-standard-normal.woff2 +0 -0
- package/dist/files/inter-latin-wght-italic.woff2 +0 -0
- package/dist/files/inter-latin-wght-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-opsz-italic.woff2 +0 -0
- package/dist/files/inter-vietnamese-opsz-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-standard-italic.woff2 +0 -0
- package/dist/files/inter-vietnamese-standard-normal.woff2 +0 -0
- package/dist/files/inter-vietnamese-wght-italic.woff2 +0 -0
- package/dist/files/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/index.js +1 -0
- package/dist/markdown-editor/index.js +1 -0
- package/dist/nonla-ui.css +2 -0
- package/package.json +14 -4
- package/src/alert/Alert.tsx +31 -34
- package/src/button/Button.tsx +5 -4
- package/src/index.ts +2 -0
- package/src/markdown-editor/MarkdownTable.tsx +8 -5
- package/src/markdown-editor/MarkdownViewer.tsx +1 -1
- package/src/scroll/OverlayScroll.tsx +1 -1
- package/src/standalone.css +3 -0
- package/src/styles.css +135 -29
- package/src/tag/Tag.tsx +2 -2
- package/src/theme.ts +4 -4
- package/src/tree/Tree.tsx +272 -0
package/src/button/Button.tsx
CHANGED
|
@@ -80,14 +80,14 @@ function tokenAppearance(color: "default" | "primary" | "danger" | "link", varia
|
|
|
80
80
|
if (variant === "nostyle") return "";
|
|
81
81
|
const g = ghost && variant !== "text" && variant !== "link";
|
|
82
82
|
if (color === "primary") {
|
|
83
|
-
if (variant === "solid" && !g) return "
|
|
83
|
+
if (variant === "solid" && !g) return "nonla-btn-brand border-transparent text-on-brand shadow-(--nonla-brand-shadow) active:scale-[0.99]";
|
|
84
84
|
if (variant === "filled") return "bg-brand-bg text-brand border-transparent hover:bg-brand-bg-hover active:bg-brand-border";
|
|
85
85
|
if (variant === "text" || variant === "icon") return "bg-transparent text-brand border-transparent hover:bg-brand-bg active:bg-brand-bg-hover";
|
|
86
86
|
if (variant === "link") return "text-brand border-transparent underline-offset-4 hover:underline";
|
|
87
87
|
return "bg-transparent text-brand border-brand hover:bg-brand-bg active:bg-brand-bg-hover";
|
|
88
88
|
}
|
|
89
89
|
if (color === "danger") {
|
|
90
|
-
if (variant === "solid" && !g) return "border-
|
|
90
|
+
if (variant === "solid" && !g) return "border-transparent bg-destructive-fill text-on-destructive hover:bg-destructive-fill-hover active:scale-[0.99] active:bg-destructive-fill-active";
|
|
91
91
|
if (variant === "filled") return "bg-destructive-bg text-destructive border-transparent hover:bg-destructive-bg-hover active:bg-destructive-border";
|
|
92
92
|
if (variant === "text" || variant === "icon") return "bg-transparent text-destructive border-transparent hover:bg-destructive-bg active:bg-destructive-bg-hover";
|
|
93
93
|
if (variant === "link") return "text-destructive border-transparent underline-offset-4 hover:underline";
|
|
@@ -97,9 +97,10 @@ function tokenAppearance(color: "default" | "primary" | "danger" | "link", varia
|
|
|
97
97
|
if (variant === "filled") return "bg-muted text-foreground border-transparent hover:bg-(--nonla-fill-strong) active:bg-ink-active";
|
|
98
98
|
if (variant === "text") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover active:bg-ink-active";
|
|
99
99
|
if (variant === "icon") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover active:bg-ink-active";
|
|
100
|
-
// Raised default
|
|
100
|
+
// Raised default, the neutral twin of primary: a faint top-lit gradient, an edge that deepens toward the bottom, a soft drop.
|
|
101
|
+
// Fill and hover live in `.nonla-btn-raised` (styles.css).
|
|
101
102
|
// No press scale on popup triggers (Radix sets `data-state`): the popup anchors to the trigger box and would jump with it.
|
|
102
|
-
return "nonla-btn-
|
|
103
|
+
return "nonla-btn-raised border-transparent text-foreground shadow-(--nonla-btn-raised-shadow) active:not-disabled:not-aria-disabled:not-data-[state]:scale-[0.97] motion-reduce:active:transform-none";
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
function presetAppearance(variant: ButtonVariant, ghost: boolean): string {
|
package/src/index.ts
CHANGED
|
@@ -132,5 +132,7 @@ export type { TimePickerProps, TimeValue } from "./timepicker/TimePicker";
|
|
|
132
132
|
export { TimePicker } from "./timepicker/TimePicker";
|
|
133
133
|
export type { TooltipPlacement, TooltipProps } from "./tooltip/Tooltip";
|
|
134
134
|
export { Tooltip } from "./tooltip/Tooltip";
|
|
135
|
+
export type { TreeExpandInfo, TreeNode, TreeProps, TreeSelectInfo } from "./tree/Tree";
|
|
136
|
+
export { Tree } from "./tree/Tree";
|
|
135
137
|
export type { TitleLevel, TypographyLinkProps, TypographyParagraphProps, TypographyProps, TypographyTextProps, TypographyTitleProps, TypographyType } from "./typography/Typography";
|
|
136
138
|
export { Link, Paragraph, Text, Title, Typography } from "./typography/Typography";
|
|
@@ -23,7 +23,7 @@ function tableToMarkdown(table: HTMLTableElement): string {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const tableClass =
|
|
26
|
-
"w-max min-w-full border-separate border-spacing-0 text-sm [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:border-b [&_th]:border-border-secondary [&_th]:px-4 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:font-medium [&_td]:border-b [&_td]:border-border-secondary [&_td]:px-4 [&_td]:py-1.5 [&_td]:align-top";
|
|
26
|
+
"w-max min-w-full border-separate border-spacing-0 text-sm [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:border-b [&_th]:border-border-secondary [&_th]:px-4 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:font-medium [&_td]:border-b [&_td]:border-border-secondary/60 [&_tr:last-child_td]:border-b-0 [&_td]:px-4 [&_td]:py-1.5 [&_td]:align-top";
|
|
27
27
|
|
|
28
28
|
export function MarkdownTable({ children }: { children: ReactNode }) {
|
|
29
29
|
const tableRef = useRef<HTMLTableElement>(null);
|
|
@@ -62,14 +62,17 @@ export function MarkdownTable({ children }: { children: ReactNode }) {
|
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
64
|
<>
|
|
65
|
-
<div className="group relative my-(--md-table-my,16px) max-w-full
|
|
66
|
-
|
|
65
|
+
<div className="group relative my-(--md-table-my,16px) max-w-full">
|
|
66
|
+
{/* Actions sit on a page-colored strip the height of the header row, faded on the left, so header text under them is hidden cleanly instead of peeking between the buttons. */}
|
|
67
|
+
<div className="absolute top-0 right-0 z-10 flex items-center gap-1 bg-linear-to-r from-transparent to-background to-[16px] py-1 pr-1 pl-4 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">
|
|
67
68
|
<Button size="small" className="bg-background" icon={<Icon name={copied ? "check" : "copy"} size={12} />} title={copied ? "Copied" : "Copy as Markdown"} aria-label={copied ? "Copied" : "Copy as Markdown"} onClick={copyMarkdown} />
|
|
68
69
|
<Button size="small" className="bg-background" icon={<Icon name="maximize" size={12} />} title="Fullscreen" aria-label="Fullscreen" onClick={openFullscreen} />
|
|
69
70
|
</div>
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
{/* Bottom padding only while the horizontal thumb shows, so it never covers the last row. */}
|
|
73
|
+
<OverlayScroll autoHeight visibility="hover" scope="table" innerClassName="overflow-x-auto group-data-overflow-x/table:pb-2">
|
|
74
|
+
{/* The last header cell reserves room for the actions, so a table that fits never has its header covered. */}
|
|
75
|
+
<table ref={tableRef} className={`${tableClass} [&_th:first-child]:pl-0 [&_td:first-child]:pl-0 [&_th:last-child]:pr-18 [&_th]:max-w-[360px] [&_td]:max-w-[360px]`}>
|
|
73
76
|
{children}
|
|
74
77
|
</table>
|
|
75
78
|
</OverlayScroll>
|
|
@@ -34,7 +34,7 @@ const documentClass = cn(
|
|
|
34
34
|
"[&_li.task-list-item>.nonla-md-task-check]:absolute [&_li.task-list-item>.nonla-md-task-check]:top-1 [&_li.task-list-item>.nonla-md-task-check]:-left-5",
|
|
35
35
|
/* Body paragraphs sit in separate blocks, so their margins do not collapse. Quote paragraphs share one block, so the next paragraph's top margin is doubled to land on that same gap. */
|
|
36
36
|
"[&_blockquote]:my-(--md-quote-my,0px) [&_blockquote>p:not(:first-child)]:mt-[calc(var(--md-p-my,1px)*2)] [&_blockquote>p:not(:last-child)]:mb-0 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-foreground",
|
|
37
|
-
"[&_a]:text-link [&_a]:underline-offset-[3px] hover:[&_a]:
|
|
37
|
+
"[&_a]:text-link [&_a]:underline [&_a]:decoration-link-border [&_a]:decoration-[1.5px] [&_a]:underline-offset-[3px] hover:[&_a]:decoration-link",
|
|
38
38
|
"[&_hr]:hidden",
|
|
39
39
|
"[&_strong]:font-(--md-strong-weight,600)",
|
|
40
40
|
"[&_img]:my-(--md-img-my,4px) [&_img]:max-w-full [&_img]:rounded-lg",
|
|
@@ -160,7 +160,7 @@ export function OverlayScroll({ visibility = "hover", scope = "scroll", autoHeig
|
|
|
160
160
|
);
|
|
161
161
|
|
|
162
162
|
return (
|
|
163
|
-
<div className={cn(scope === "table" ? "group/table" : "group/scroll", "relative min-h-0 min-w-0 w-full overflow-hidden", className)} style={style} data-scrolling={thumbVisible ? "true" : undefined}>
|
|
163
|
+
<div className={cn(scope === "table" ? "group/table" : "group/scroll", "relative min-h-0 min-w-0 w-full overflow-hidden", className)} style={style} data-scrolling={thumbVisible ? "true" : undefined} data-overflow-x={hThumb.shown ? "true" : undefined}>
|
|
164
164
|
<div
|
|
165
165
|
ref={setNode}
|
|
166
166
|
onScroll={handleScroll}
|
package/src/styles.css
CHANGED
|
@@ -32,29 +32,37 @@
|
|
|
32
32
|
--nonla-text-quaternary: #5c5c5c;
|
|
33
33
|
--nonla-text-on-solid: #ffffff;
|
|
34
34
|
/* Text on brand fills (primary button, solid brand tag). */
|
|
35
|
-
--nonla-text-on-brand: #
|
|
36
|
-
/*
|
|
37
|
-
--nonla-brand: #
|
|
35
|
+
--nonla-text-on-brand: #ffffff;
|
|
36
|
+
/* Brand: the logo's brim orange (#dd7627, see `Logo`), so buttons and the mascot share one hue. Same in light and dark, white labels. */
|
|
37
|
+
--nonla-brand: #dd7627;
|
|
38
38
|
/*
|
|
39
39
|
* Status roles. `--nonla-{role}` is text and icons (AA on the page and on its own tint).
|
|
40
40
|
* `-fill` is the solid behind a label, `--nonla-text-on-{role}` is that label.
|
|
41
|
-
*
|
|
41
|
+
* Fills are the same in light and dark; danger takes a white label, success and warn take dark ink.
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
--nonla-
|
|
46
|
-
--nonla-
|
|
47
|
-
--nonla-
|
|
48
|
-
--nonla-
|
|
49
|
-
|
|
50
|
-
--nonla-
|
|
43
|
+
/* One family with the ember brand (oklch 68% .18 42): fills share its weight; hues spread so none reads as the brand.
|
|
44
|
+
danger 22 (crimson, redder than the orange) · success 150 · warn 75 (amber, yellower) · link 258 (#005cc5; dark #7db0f9, same hue, lighter). */
|
|
45
|
+
--nonla-danger: #f66c6d;
|
|
46
|
+
--nonla-success: #51c672;
|
|
47
|
+
--nonla-warn: #f9b64f;
|
|
48
|
+
--nonla-link: #7db0f9;
|
|
49
|
+
/* Info: a fresh blue of its own (alerts, "processing" tags). Links stay the calmer reading blue. */
|
|
50
|
+
--nonla-info: #6db0f4;
|
|
51
|
+
--nonla-info-fill: #2288e8;
|
|
52
|
+
--nonla-text-on-info: #ffffff;
|
|
53
|
+
--nonla-danger-fill: #e23242;
|
|
54
|
+
--nonla-success-fill: #37bb62;
|
|
55
|
+
--nonla-warn-fill: #f9ad26;
|
|
56
|
+
--nonla-text-on-danger: #ffffff;
|
|
51
57
|
--nonla-text-on-success: #141414;
|
|
52
58
|
--nonla-text-on-warn: #141414;
|
|
59
|
+
/* The "!" in the warning triangle: a deep brown of the amber, softer than black ink. */
|
|
60
|
+
--nonla-warn-mark: color-mix(in oklch, var(--nonla-warn-fill), #000 70%);
|
|
53
61
|
/* Solid fills hover and press toward this. Dark: the page, so ink labels keep contrast. */
|
|
54
62
|
--nonla-fill-shade: var(--nonla-bg);
|
|
55
|
-
/* Brand fill
|
|
56
|
-
|
|
57
|
-
--nonla-brand-shade:
|
|
63
|
+
/* Brand fill hover brightens toward `-glow` (Cloudflare-style); press settles toward `-shade`. */
|
|
64
|
+
--nonla-brand-glow: #ffffff;
|
|
65
|
+
--nonla-brand-shade: #000000;
|
|
58
66
|
|
|
59
67
|
--nonla-sidebar: #1c1c1c;
|
|
60
68
|
--nonla-surface: #1c1c1c;
|
|
@@ -96,6 +104,12 @@
|
|
|
96
104
|
/* Default button fill on hover and press: the surface, one and two steps toward the ink. */
|
|
97
105
|
--nonla-btn-bg-hover: color-mix(in oklab, var(--nonla-surface) 95%, var(--nonla-text-main));
|
|
98
106
|
--nonla-btn-bg-active: color-mix(in oklab, var(--nonla-surface) 91%, var(--nonla-text-main));
|
|
107
|
+
/* Raised default button: fill top → bottom, edge top → bottom (alpha, over the page), and its shadow. */
|
|
108
|
+
--nonla-btn-top: color-mix(in oklab, var(--nonla-surface) 94%, var(--nonla-text-main));
|
|
109
|
+
--nonla-btn-bottom: var(--nonla-surface);
|
|
110
|
+
--nonla-btn-edge-top: rgb(255 255 255 / 13%);
|
|
111
|
+
--nonla-btn-edge-bottom: rgb(255 255 255 / 8%);
|
|
112
|
+
--nonla-btn-raised-shadow: inset 0 1px 0 rgb(255 255 255 / 5%), 0 1px 1px rgb(0 0 0 / 16%);
|
|
99
113
|
/* Switch (measured on Cloudflare): full-height thumb on a pill track, a 1px ring instead of a border. */
|
|
100
114
|
--nonla-switch-track: color-mix(in oklab, var(--nonla-text-main) 16%, var(--nonla-bg));
|
|
101
115
|
--nonla-switch-ring: color-mix(in oklab, var(--nonla-text-main) 24%, var(--nonla-bg));
|
|
@@ -159,10 +173,21 @@
|
|
|
159
173
|
* solid fill → hover 10% toward --nonla-fill-shade → press 18%
|
|
160
174
|
* tint bg 10% → hover 16%, border 35%
|
|
161
175
|
*/
|
|
162
|
-
--nonla-brand-fill-hover: color-mix(in oklab, var(--nonla-brand)
|
|
163
|
-
--nonla-brand-fill-active: color-mix(in oklab, var(--nonla-brand)
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
--nonla-brand-fill-hover: color-mix(in oklab, var(--nonla-brand) 88%, var(--nonla-brand-glow));
|
|
177
|
+
--nonla-brand-fill-active: color-mix(in oklab, var(--nonla-brand) 92%, var(--nonla-brand-shade));
|
|
178
|
+
--nonla-brand-ring: color-mix(in oklab, var(--nonla-brand) 84%, #000);
|
|
179
|
+
/* Primary button, measured on Cloudflare ("emphasis"): a top-lit gradient (brand + 15% white → brand; hover lifts the top to +30%),
|
|
180
|
+
a 1px top highlight, a 1px edge that follows the same gradient 8% darker (so top, sides and bottom keep the same contrast against the fill), soft lit insets, and a short brand-tinted drop. */
|
|
181
|
+
--nonla-brand-top: color-mix(in oklch, var(--nonla-brand), #fff 15%);
|
|
182
|
+
--nonla-brand-top-hover: color-mix(in oklch, var(--nonla-brand), #fff 30%);
|
|
183
|
+
--nonla-brand-shadow:
|
|
184
|
+
inset 0 1px 0 var(--nonla-brand-top-hover),
|
|
185
|
+
inset 0 -1px 3px color-mix(in oklch, color-mix(in oklch, var(--nonla-brand), #fff 50%) 12%, transparent),
|
|
186
|
+
inset 0 4px 8px color-mix(in oklch, color-mix(in oklch, var(--nonla-brand), #fff 50%) 12%, transparent),
|
|
187
|
+
inset 0 1px 3px color-mix(in oklch, color-mix(in oklch, var(--nonla-brand), #fff 50%) 24%, transparent),
|
|
188
|
+
0 6px 10px -4px color-mix(in oklch, var(--nonla-brand) 24%, transparent),
|
|
189
|
+
0 2px 4px -1px color-mix(in oklch, var(--nonla-brand) 12%, transparent),
|
|
190
|
+
0 1px 1px -0.5px color-mix(in oklch, var(--nonla-brand) 12%, transparent);
|
|
166
191
|
--nonla-danger-ring: color-mix(in oklab, var(--nonla-danger-fill) 78%, #000);
|
|
167
192
|
--nonla-solid-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 1px 2px rgb(0 0 0 / 12%);
|
|
168
193
|
--nonla-brand-bg: color-mix(in oklab, var(--nonla-brand) 10%, transparent);
|
|
@@ -186,6 +211,10 @@
|
|
|
186
211
|
--nonla-link-bg: color-mix(in oklab, var(--nonla-link) 10%, transparent);
|
|
187
212
|
--nonla-link-bg-hover: color-mix(in oklab, var(--nonla-link) 16%, transparent);
|
|
188
213
|
--nonla-link-border: color-mix(in oklab, var(--nonla-link) 35%, transparent);
|
|
214
|
+
--nonla-info-bg: color-mix(in oklab, var(--nonla-info-fill) 10%, transparent);
|
|
215
|
+
--nonla-info-border: color-mix(in oklab, var(--nonla-info-fill) 32%, transparent);
|
|
216
|
+
/* Tree guide lines: a quiet ink, clearly stronger than a hairline so the branches read. */
|
|
217
|
+
--nonla-tree-line: color-mix(in oklab, var(--nonla-text-main) 32%, transparent);
|
|
189
218
|
--brand: var(--nonla-brand);
|
|
190
219
|
--link: var(--nonla-link);
|
|
191
220
|
--success: var(--nonla-success);
|
|
@@ -197,7 +226,7 @@
|
|
|
197
226
|
/* Card edge. Dark adds a short drop; the ring is the border. */
|
|
198
227
|
--nonla-card-shadow: 0 1px 2px rgb(0 0 0 / 32%), 0 0 0 1px var(--nonla-border);
|
|
199
228
|
/* Default button lift: a 1px contact shadow under a surface-filled button, so it sits a hair above the page. */
|
|
200
|
-
--nonla-btn-shadow: 0 1px 2px rgb(0 0 0 /
|
|
229
|
+
--nonla-btn-shadow: 0 1px 2px rgb(0 0 0 / 16%);
|
|
201
230
|
--mask: rgb(0 0 0 / 56%);
|
|
202
231
|
|
|
203
232
|
/*
|
|
@@ -253,16 +282,20 @@
|
|
|
253
282
|
--nonla-text-quaternary: #a3a3a3;
|
|
254
283
|
--nonla-text-on-solid: #ffffff;
|
|
255
284
|
--nonla-text-on-brand: #ffffff;
|
|
256
|
-
--nonla-brand: #
|
|
257
|
-
|
|
258
|
-
--nonla-
|
|
259
|
-
--nonla-
|
|
260
|
-
--nonla-
|
|
261
|
-
--nonla-
|
|
262
|
-
--nonla-
|
|
263
|
-
--nonla-
|
|
285
|
+
--nonla-brand: #dd7627;
|
|
286
|
+
/* Text roles: deeper steps of the same hues, AA (≥ 4.5:1) on white and the #fafafa page. */
|
|
287
|
+
--nonla-danger: #ce2739;
|
|
288
|
+
--nonla-success: #11813c;
|
|
289
|
+
--nonla-warn: #a2620e;
|
|
290
|
+
--nonla-link: #005cc5;
|
|
291
|
+
--nonla-info: #006cc4;
|
|
292
|
+
--nonla-info-fill: #2288e8;
|
|
293
|
+
--nonla-text-on-info: #ffffff;
|
|
294
|
+
--nonla-danger-fill: #e23242;
|
|
295
|
+
--nonla-success-fill: #37bb62;
|
|
296
|
+
--nonla-warn-fill: #f9ad26;
|
|
264
297
|
--nonla-text-on-danger: #ffffff;
|
|
265
|
-
--nonla-text-on-success: #
|
|
298
|
+
--nonla-text-on-success: #141414;
|
|
266
299
|
--nonla-text-on-warn: #191919;
|
|
267
300
|
/* Light: black, so white labels gain contrast on hover. */
|
|
268
301
|
--nonla-fill-shade: #000000;
|
|
@@ -285,6 +318,11 @@
|
|
|
285
318
|
/* Card: hairline ring plus a 1px contact shadow. */
|
|
286
319
|
--nonla-card-shadow: 0 0 0 1px var(--nonla-border), 0 1px 2px rgb(0 0 0 / 5%);
|
|
287
320
|
--nonla-btn-shadow: 0 1px 2px rgb(0 0 0 / 5%);
|
|
321
|
+
--nonla-btn-top: var(--nonla-surface);
|
|
322
|
+
--nonla-btn-bottom: color-mix(in oklab, var(--nonla-surface) 97.5%, var(--nonla-text-main));
|
|
323
|
+
--nonla-btn-edge-top: rgb(0 0 0 / 8%);
|
|
324
|
+
--nonla-btn-edge-bottom: rgb(0 0 0 / 12%);
|
|
325
|
+
--nonla-btn-raised-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
|
288
326
|
--nonla-pill-track: color-mix(in oklab, var(--nonla-text-main) 4%, var(--nonla-bg));
|
|
289
327
|
--nonla-switch-track: color-mix(in oklab, var(--nonla-text-main) 10%, var(--nonla-bg));
|
|
290
328
|
--nonla-switch-ring: color-mix(in oklab, var(--nonla-text-main) 17%, var(--nonla-bg));
|
|
@@ -370,6 +408,11 @@
|
|
|
370
408
|
--color-link-bg: var(--nonla-link-bg);
|
|
371
409
|
--color-link-bg-hover: var(--nonla-link-bg-hover);
|
|
372
410
|
--color-link-border: var(--nonla-link-border);
|
|
411
|
+
--color-info: var(--nonla-info);
|
|
412
|
+
--color-info-fill: var(--nonla-info-fill);
|
|
413
|
+
--color-info-bg: var(--nonla-info-bg);
|
|
414
|
+
--color-info-border: var(--nonla-info-border);
|
|
415
|
+
--color-on-info: var(--nonla-text-on-info);
|
|
373
416
|
--color-tertiary-foreground: var(--tertiary-foreground);
|
|
374
417
|
--color-quaternary-foreground: var(--quaternary-foreground);
|
|
375
418
|
--color-ink-hover: var(--nonla-ink-hover);
|
|
@@ -618,6 +661,69 @@
|
|
|
618
661
|
}
|
|
619
662
|
}
|
|
620
663
|
|
|
664
|
+
/* Default button fill: a faint top-lit gradient in the padding box and an alpha edge that deepens toward the bottom in
|
|
665
|
+
the border box, so it sits a hair above the page like the primary. Hover and press darken both stops a step. */
|
|
666
|
+
@property --nonla-btn-lit-top {
|
|
667
|
+
syntax: "<color>";
|
|
668
|
+
inherits: false;
|
|
669
|
+
initial-value: transparent;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
@property --nonla-btn-lit-bottom {
|
|
673
|
+
syntax: "<color>";
|
|
674
|
+
inherits: false;
|
|
675
|
+
initial-value: transparent;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.nonla-ui .nonla-btn-raised {
|
|
679
|
+
--nonla-btn-lit-top: var(--nonla-btn-top);
|
|
680
|
+
--nonla-btn-lit-bottom: var(--nonla-btn-bottom);
|
|
681
|
+
background:
|
|
682
|
+
linear-gradient(to bottom, var(--nonla-btn-lit-top), var(--nonla-btn-lit-bottom)) padding-box,
|
|
683
|
+
linear-gradient(to bottom, var(--nonla-btn-edge-top), var(--nonla-btn-edge-bottom)) border-box;
|
|
684
|
+
transition:
|
|
685
|
+
--nonla-btn-lit-top var(--nonla-dur-fast) var(--nonla-ease-out),
|
|
686
|
+
--nonla-btn-lit-bottom var(--nonla-dur-fast) var(--nonla-ease-out),
|
|
687
|
+
transform var(--nonla-dur-fast) var(--nonla-ease-out);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.nonla-ui .nonla-btn-raised:not(:disabled, [aria-disabled="true"]):hover {
|
|
691
|
+
--nonla-btn-lit-top: var(--nonla-btn-bg-hover);
|
|
692
|
+
--nonla-btn-lit-bottom: color-mix(in oklab, var(--nonla-btn-bg-hover) 97.5%, var(--nonla-text-main));
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
.nonla-ui .nonla-btn-raised:not(:disabled, [aria-disabled="true"]):active {
|
|
696
|
+
--nonla-btn-lit-top: var(--nonla-btn-bg-active);
|
|
697
|
+
--nonla-btn-lit-bottom: var(--nonla-btn-bg-active);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/* Primary button fill: the lit gradient inside the padding box, and the same gradient 8% darker in the 1px border box,
|
|
701
|
+
so the edge tracks the fill (light at the top, deeper at the bottom) and no side reads heavier than another.
|
|
702
|
+
`--nonla-brand-lit` is registered so hover / press animate the gradient. */
|
|
703
|
+
@property --nonla-brand-lit {
|
|
704
|
+
syntax: "<color>";
|
|
705
|
+
inherits: false;
|
|
706
|
+
initial-value: transparent;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.nonla-ui .nonla-btn-brand {
|
|
710
|
+
--nonla-brand-lit: var(--nonla-brand-top);
|
|
711
|
+
background:
|
|
712
|
+
linear-gradient(to bottom, var(--nonla-brand-lit), var(--nonla-brand)) padding-box,
|
|
713
|
+
linear-gradient(to bottom, color-mix(in oklch, var(--nonla-brand-lit), #000 8%), color-mix(in oklch, var(--nonla-brand), #000 8%)) border-box;
|
|
714
|
+
transition:
|
|
715
|
+
--nonla-brand-lit var(--nonla-dur-fast) var(--nonla-ease-out),
|
|
716
|
+
transform var(--nonla-dur-fast) var(--nonla-ease-out);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
.nonla-ui .nonla-btn-brand:not(:disabled, [aria-disabled="true"]):hover {
|
|
720
|
+
--nonla-brand-lit: var(--nonla-brand-top-hover);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
.nonla-ui .nonla-btn-brand:not(:disabled, [aria-disabled="true"]):active {
|
|
724
|
+
--nonla-brand-lit: var(--nonla-brand);
|
|
725
|
+
}
|
|
726
|
+
|
|
621
727
|
/* Tooltip: scale from the trigger side and fade, both ways (Cloudflare: 0.9, 150ms). */
|
|
622
728
|
@keyframes nonla-tooltip-in {
|
|
623
729
|
from {
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -25,7 +25,7 @@ const NAMED_VAR: Record<string, string> = {
|
|
|
25
25
|
success: "var(--success)",
|
|
26
26
|
error: "var(--destructive)",
|
|
27
27
|
warning: "var(--warn)",
|
|
28
|
-
processing: "var(--
|
|
28
|
+
processing: "var(--nonla-info)",
|
|
29
29
|
brand: "var(--brand)",
|
|
30
30
|
blue: "light-dark(#3b7fc4, #7bafe9)",
|
|
31
31
|
purple: "light-dark(#6d5bd0, #9386f2)",
|
|
@@ -50,7 +50,7 @@ const ROLE_SOLID: Record<string, { fill: string; ink: string }> = {
|
|
|
50
50
|
success: { fill: "var(--nonla-success-fill)", ink: "var(--nonla-text-on-success)" },
|
|
51
51
|
error: { fill: "var(--nonla-danger-fill)", ink: "var(--nonla-text-on-danger)" },
|
|
52
52
|
warning: { fill: "var(--nonla-warn-fill)", ink: "var(--nonla-text-on-warn)" },
|
|
53
|
-
processing: { fill: "var(--nonla-
|
|
53
|
+
processing: { fill: "var(--nonla-info-fill)", ink: "var(--nonla-text-on-info)" },
|
|
54
54
|
brand: { fill: "var(--nonla-brand)", ink: "var(--nonla-text-on-brand)" },
|
|
55
55
|
};
|
|
56
56
|
|
package/src/theme.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Paint `light` or `dark` on the Nonla host (`.nonla-ui`).
|
|
2
|
+
* Paint `light` or `dark` on the Nonla host (`.nonla-ui`). With no saved choice it follows the OS (`system`).
|
|
3
3
|
* The stored choice may be `system`, which follows the OS and still paints one of those two.
|
|
4
4
|
*
|
|
5
5
|
* `App` binds the host via `bindColorModeTarget`. Callers can still pass an explicit
|
|
@@ -17,7 +17,7 @@ export const NONLA_COLOR_MODE_KEY = "nonla-color-mode";
|
|
|
17
17
|
|
|
18
18
|
const listeners = new Set<() => void>();
|
|
19
19
|
let mode: NonlaColorMode = "dark";
|
|
20
|
-
let preference: NonlaColorPreference = "
|
|
20
|
+
let preference: NonlaColorPreference = "system";
|
|
21
21
|
let ready = false;
|
|
22
22
|
let schemeQuery: MediaQueryList | null = null;
|
|
23
23
|
let boundTarget: HTMLElement | null = null;
|
|
@@ -123,7 +123,7 @@ export function setColorMode(next: NonlaColorMode, target?: HTMLElement) {
|
|
|
123
123
|
setColorPreference(next, target);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
/** Apply the saved mode once. Falls back to
|
|
126
|
+
/** Apply the saved mode once. Falls back to `system` (follows the OS). A stored `system` choice follows the OS. */
|
|
127
127
|
export function initColorMode(target?: HTMLElement): NonlaColorMode {
|
|
128
128
|
if (typeof document === "undefined") return mode;
|
|
129
129
|
const el = colorTarget(target);
|
|
@@ -133,7 +133,7 @@ export function initColorMode(target?: HTMLElement): NonlaColorMode {
|
|
|
133
133
|
}
|
|
134
134
|
ready = true;
|
|
135
135
|
const fromClass = modeFromClass(el) ?? modeFromClass(document.documentElement);
|
|
136
|
-
const next = readStored() ?? fromClass ?? "
|
|
136
|
+
const next = readStored() ?? fromClass ?? "system";
|
|
137
137
|
preference = next;
|
|
138
138
|
if (next === "system") watchSystem();
|
|
139
139
|
applyColorMode(resolved(next), el);
|