@nadicodeai/ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -4
- package/README.md +12 -7
- package/dist/components/ai-elements/code-block.d.ts +8 -1
- package/dist/components/ai-elements/code-block.d.ts.map +1 -1
- package/dist/components/ai-elements/code-block.js +77 -19
- package/dist/components/ai-elements/model-selector.d.ts +1 -1
- package/dist/components/ai-elements/model-selector.d.ts.map +1 -1
- package/dist/components/ai-elements/open-in-chat.d.ts +0 -2
- package/dist/components/ai-elements/open-in-chat.d.ts.map +1 -1
- package/dist/components/ai-elements/open-in-chat.js +0 -11
- package/dist/components/chart.d.ts +5 -1
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/chart.js +23 -4
- package/dist/components/sonner.d.ts +1 -1
- package/dist/components/sonner.d.ts.map +1 -1
- package/dist/components/sonner.js +2 -2
- package/dist/components/theme-mode-switcher.d.ts +17 -0
- package/dist/components/theme-mode-switcher.d.ts.map +1 -0
- package/dist/components/theme-mode-switcher.js +24 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/theme-mode.d.ts +4 -0
- package/dist/lib/theme-mode.d.ts.map +1 -0
- package/dist/lib/theme-mode.js +4 -0
- package/dist/styles/globals.css +85 -81
- package/package.json +7 -3
- package/skills/nadicodeai-ui/SKILL.md +2 -1
package/AGENTS.md
CHANGED
|
@@ -6,9 +6,10 @@ When this file is read from an installed package, use it as the consumer agent
|
|
|
6
6
|
contract: import `@nadicodeai/ui/globals.css` and
|
|
7
7
|
`@nadicodeai/design-system/css` once at the app root, import components from
|
|
8
8
|
`@nadicodeai/ui/components/*` or `@nadicodeai/ui/ai-elements`, and keep all
|
|
9
|
-
new UI token-only. Dark mode is a `.dark` selector remap
|
|
10
|
-
|
|
11
|
-
OS dark-mode branching, or
|
|
9
|
+
new UI token-only. Dark mode is a `.dark` selector remap: the design-system
|
|
10
|
+
theme owns standard shadcn roles, while `globals.css` owns UI-local product
|
|
11
|
+
aliases. Components must not add `dark:` utilities, OS dark-mode branching, or
|
|
12
|
+
raw palette values. The package also ships `llms.txt`,
|
|
12
13
|
`docs/agents/nadicodeai-ui.md`, `docs/migration/`, and
|
|
13
14
|
`skills/nadicodeai-ui/SKILL.md` for agents that index package documentation or
|
|
14
15
|
skills.
|
|
@@ -16,9 +17,10 @@ skills.
|
|
|
16
17
|
## Invariants
|
|
17
18
|
|
|
18
19
|
- **Token-only, no raw literals.** Components style through brand tokens only — the `nadicode.theme.css` role vars bridged into Tailwind utilities (`bg-background`, `text-foreground`, `border-input`, …) plus UI-local product aliases defined in `globals.css` such as `--nc-app-surface`, `--nc-chat-tool-surface`, and `--nc-terminal-bg`. No raw `#hex` / `rgb()` / `hsl()` in any `.tsx`; a new source value goes to `design-system/DESIGN.md` first and flows through generated tokens. Enforced by `tests/no-raw-literal.test.ts` and `tests/token-reference-integrity.test.ts`.
|
|
19
|
-
- **Dark-ready roles, no component `dark:` styling.**
|
|
20
|
+
- **Dark-ready roles, no component `dark:` styling.** The generated design-system Tailwind theme owns the standard shadcn `:root` and `.dark` role maps; `globals.css` owns the Tailwind `@theme inline` bridge and UI-local product aliases. Components consume semantic utilities or product aliases such as `var(--nc-app-surface)`; they must not ship `dark:` Tailwind utilities, OS dark-mode branching, or raw dark palette utilities such as `dark:bg-slate-950` / `dark:text-white`. Enforced by `tests/no-dark.test.ts`, `tests/dark-semantic-roles.test.ts`, and `tests/token-reference-integrity.test.ts`.
|
|
20
21
|
- **Components inherit the brand theme.** Consumers import `@nadicodeai/ui/globals.css` (Tailwind + the generated brand `@theme` + semantic role/alias maps) and `@nadicodeai/design-system/css` (kept `nc-*` geometry, type scale, chat CSS components, motion, and display components). Components carry no theme of their own — they resolve every color/radius from bridged brand tokens, UI-local aliases, and design-system CSS.
|
|
21
22
|
- **Source-authored, built package.** Components are authored as shadcn-style source in this workspace, then emitted to `dist/` for consumption by other apps. Package exports must point at built JS/declarations/CSS, not raw `src/*.tsx`, and `npm pack --dry-run` must include only intentional consumer artifacts.
|
|
23
|
+
- **Public surface changes require a release decision.** Any change to exported components, `src/index.ts`, `src/ai-elements.ts`, package `exports`, `globals.css`, UI-local semantic aliases, theme behavior, package docs, package skills, or design-system token/CSS/theme output consumed by this package must end with an explicit npm release decision before handoff. If the change should reach external consumers, bump the relevant package version(s), run `npm pack --dry-run -w @nadicodeai/ui`, and follow `../docs/agents/npm-publishing.md`. When the UI change depends on modified `@nadicodeai/design-system` output, bump/publish `@nadicodeai/design-system` first, then update `@nadicodeai/ui`'s dependency and publish UI. Never claim a UI package change is shipped to npm until `npm view @nadicodeai/ui version` reports the intended published version.
|
|
22
24
|
- **shadcn and AI Elements are package surface.** The installed shadcn source components under `src/components/` and all 48 Vercel AI Elements under `src/components/ai-elements/` are intentional ready-to-use exports. Keep `src/index.ts`, `src/ai-elements.ts`, package `exports`, README/agent docs, and `website/app/ui-check/elements` synchronized whenever this surface changes.
|
|
23
25
|
- **Named shadcn blocks stay named.** When a user, plan, or issue selects a shadcn block/example such as `login-02`, `signup-02`, `dashboard-01`, or `sidebar-*`, use that registry item as the source of truth through shadcn CLI/MCP. Do not replace it with a package-authored abstraction unless the plan explicitly records the substitution, the reason, and the true consumer route that proves it.
|
|
24
26
|
- **Package surface is source-backed.** `src/components/` is intentionally flat shadcn-style source. Do not document folders or package namespaces that do not exist. Do not add top-level exports for recipes, blocks, agent, or terminal groupings unless a later package API decision adds concrete source, built files, docs, and tests in the same change.
|
|
@@ -111,4 +113,5 @@ through `docs/terminal-tui-semantics.md`.
|
|
|
111
113
|
| Command | When |
|
|
112
114
|
| --- | --- |
|
|
113
115
|
| `npm run build -w @nadicodeai/ui` | Emit the consumable `dist/` package surface before packing or app builds |
|
|
116
|
+
| `npm pack --dry-run -w @nadicodeai/ui` | Verify exactly what external npm consumers would receive after package surface, export, CSS, docs, or skill changes |
|
|
114
117
|
| `npm run test -w @nadicodeai/ui` | Run this workspace's guards (browser-free; also runs inside the root `npm run test` gate) |
|
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@ The package ships:
|
|
|
20
20
|
- React adapters over the design-system grammar and assets
|
|
21
21
|
- reusable marketing/section compositions
|
|
22
22
|
- presentational product components such as `SettingsSection`,
|
|
23
|
-
`DashboardShell`, `AgentChat`, `InstallerShell`,
|
|
23
|
+
`DashboardShell`, `AgentChat`, `InstallerShell`, `PluginSlotBoundary`, and
|
|
24
|
+
`ThemeModeSwitcher`
|
|
24
25
|
- package-local agent guidance: `AGENTS.md`, `llms.txt`,
|
|
25
26
|
`docs/agents/nadicodeai-ui.md`, `docs/migration/`, and
|
|
26
27
|
`skills/nadicodeai-ui/SKILL.md`
|
|
@@ -56,11 +57,12 @@ import "@nadicodeai/design-system/css";
|
|
|
56
57
|
|
|
57
58
|
`@nadicodeai/ui/globals.css` imports Tailwind v4, the generated NadicodeAI
|
|
58
59
|
Tailwind theme, the shadcn role bridge, and the package-local semantic
|
|
59
|
-
`:root`/`.dark`
|
|
60
|
-
|
|
61
|
-
terminal/ANSI, trace/status,
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
`:root`/`.dark` product aliases. The design-system theme owns the standard
|
|
61
|
+
shadcn light and dark role maps; the UI package owns app shell/surface,
|
|
62
|
+
chat/tool/composer, approval, diff/code, terminal/ANSI, trace/status,
|
|
63
|
+
provider/model, and plugin permission aliases. Those aliases reference
|
|
64
|
+
generated `--nc-*` tokens or semantic roles; they are not a new source-token
|
|
65
|
+
group. `@nadicodeai/design-system/css` provides the kept
|
|
64
66
|
`nc-*` page grammar, type scale, geometry, chat CSS components, motion, and
|
|
65
67
|
brand display components that many UI components compose.
|
|
66
68
|
|
|
@@ -71,7 +73,9 @@ needed. Do not add component-level Tailwind `dark:` utilities, OS dark-mode
|
|
|
71
73
|
branching, raw color literals, or raw palette utilities.
|
|
72
74
|
|
|
73
75
|
For Next.js App Router apps, place both imports in the root layout. The app still
|
|
74
|
-
owns its PostCSS setup
|
|
76
|
+
owns its PostCSS setup, theme provider, and persisted light/dark/system
|
|
77
|
+
preference. `ThemeModeSwitcher` is controlled and app-agnostic; the app decides
|
|
78
|
+
how to set `.dark` on the document. This package does not export a PostCSS config.
|
|
75
79
|
|
|
76
80
|
## Imports
|
|
77
81
|
|
|
@@ -128,6 +132,7 @@ Current product subpaths:
|
|
|
128
132
|
- `@nadicodeai/ui/components/installer-shell`
|
|
129
133
|
- `@nadicodeai/ui/components/plugin-slot-boundary`
|
|
130
134
|
- `@nadicodeai/ui/components/settings-section`
|
|
135
|
+
- `@nadicodeai/ui/components/theme-mode-switcher`
|
|
131
136
|
|
|
132
137
|
Recommended migration order is documented in
|
|
133
138
|
`docs/migration/nadia-consumer-readiness.md`: web admin or portal first,
|
|
@@ -2,15 +2,22 @@ import { Button } from "../button";
|
|
|
2
2
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select";
|
|
3
3
|
import type { ComponentProps, HTMLAttributes } from "react";
|
|
4
4
|
import type { BundledLanguage, ThemedToken } from "shiki";
|
|
5
|
+
type CodeThemeToken = ThemedToken & {
|
|
6
|
+
darkBgColor?: string;
|
|
7
|
+
darkColor?: string;
|
|
8
|
+
darkFontStyle?: ThemedToken["fontStyle"];
|
|
9
|
+
};
|
|
5
10
|
type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
11
|
code: string;
|
|
7
12
|
language: BundledLanguage;
|
|
8
13
|
showLineNumbers?: boolean;
|
|
9
14
|
};
|
|
10
15
|
interface TokenizedCode {
|
|
11
|
-
tokens:
|
|
16
|
+
tokens: CodeThemeToken[][];
|
|
12
17
|
fg: string;
|
|
13
18
|
bg: string;
|
|
19
|
+
darkFg: string;
|
|
20
|
+
darkBg: string;
|
|
14
21
|
}
|
|
15
22
|
export declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void) => TokenizedCode | null;
|
|
16
23
|
export declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAC;AAW3E,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAC;AAW3E,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,EAEZ,MAAM,OAAO,CAAC;AAYf,KAAK,cAAc,GAAG,WAAW,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC;AAsGF,KAAK,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,UAAU,aAAa;IACrB,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;I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AAM,yBAAyB,GACpC,OAAO,8BAA8B,gCACb,CAAC;AAE3B,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,yBAG9C,qCAAqC,gCASvC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,cAAc,CAC9D,OAAO,WAAW,CACnB,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,OAAO,mCAAmC,gCACb,CAAC;AAEhC,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,qBAG9C,qCAAqC,gCAEvC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAC7D,OAAO,UAAU,CAClB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,gCACb,CAAC"}
|
|
@@ -21,15 +21,45 @@ const addKeysToTokens = (lines) => lines.map((line, lineIdx) => ({
|
|
|
21
21
|
token,
|
|
22
22
|
})),
|
|
23
23
|
}));
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const tokenStyle = (token) => {
|
|
25
|
+
const htmlStyle = { ...token.htmlStyle };
|
|
26
|
+
delete htmlStyle.background;
|
|
27
|
+
delete htmlStyle.backgroundColor;
|
|
28
|
+
delete htmlStyle.color;
|
|
29
|
+
delete htmlStyle.fontStyle;
|
|
30
|
+
delete htmlStyle.fontWeight;
|
|
31
|
+
delete htmlStyle.textDecoration;
|
|
32
|
+
const darkFontStyle = token.darkFontStyle ?? token.fontStyle;
|
|
33
|
+
return {
|
|
34
|
+
...htmlStyle,
|
|
35
|
+
"--shiki-code-token-dark-bg": token.darkBgColor ?? token.bgColor,
|
|
36
|
+
"--shiki-code-token-dark-color": token.darkColor ?? token.color,
|
|
37
|
+
"--shiki-code-token-dark-font-style": isItalic(darkFontStyle)
|
|
38
|
+
? "italic"
|
|
39
|
+
: "normal",
|
|
40
|
+
"--shiki-code-token-dark-font-weight": isBold(darkFontStyle)
|
|
41
|
+
? "bold"
|
|
42
|
+
: "normal",
|
|
43
|
+
"--shiki-code-token-dark-text-decoration": isUnderline(darkFontStyle)
|
|
44
|
+
? "underline"
|
|
45
|
+
: "none",
|
|
46
|
+
"--shiki-code-token-light-bg": token.bgColor,
|
|
47
|
+
"--shiki-code-token-light-color": token.color,
|
|
48
|
+
"--shiki-code-token-light-font-style": isItalic(token.fontStyle)
|
|
49
|
+
? "italic"
|
|
50
|
+
: "normal",
|
|
51
|
+
"--shiki-code-token-light-font-weight": isBold(token.fontStyle)
|
|
52
|
+
? "bold"
|
|
53
|
+
: "normal",
|
|
54
|
+
"--shiki-code-token-light-text-decoration": isUnderline(token.fontStyle)
|
|
55
|
+
? "underline"
|
|
56
|
+
: "none",
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
// Syntax colors are resolved by the shared UI globals stylesheet so light/dark
|
|
60
|
+
// can switch without re-tokenizing. Importing that stylesheet is part of the
|
|
61
|
+
// package contract for CodeBlock consumers.
|
|
62
|
+
const TokenSpan = ({ token }) => (_jsx("span", { "data-nc-code-token": "", style: tokenStyle(token), children: token.content }));
|
|
33
63
|
// Line number styles using CSS counters
|
|
34
64
|
const LINE_NUMBER_CLASSES = cn("block", "before:content-[counter(line)]", "before:inline-block", "before:[counter-increment:line]", "before:w-8", "before:mr-4", "before:text-right", "before:text-muted-foreground/50", "before:font-mono", "before:select-none");
|
|
35
65
|
// Line rendering component
|
|
@@ -58,14 +88,31 @@ const getHighlighter = (language) => {
|
|
|
58
88
|
}
|
|
59
89
|
const highlighterPromise = createHighlighter({
|
|
60
90
|
langs: [language],
|
|
61
|
-
themes: ["github-light"],
|
|
91
|
+
themes: ["github-light", "github-dark"],
|
|
62
92
|
});
|
|
63
93
|
highlighterCache.set(language, highlighterPromise);
|
|
64
94
|
return highlighterPromise;
|
|
65
95
|
};
|
|
96
|
+
const tokenFromThemeVariants = (token) => {
|
|
97
|
+
const light = token.variants.light ?? {};
|
|
98
|
+
const dark = token.variants.dark ?? light;
|
|
99
|
+
return {
|
|
100
|
+
bgColor: light.bgColor,
|
|
101
|
+
color: light.color,
|
|
102
|
+
content: token.content,
|
|
103
|
+
darkBgColor: dark.bgColor,
|
|
104
|
+
darkColor: dark.color,
|
|
105
|
+
darkFontStyle: dark.fontStyle,
|
|
106
|
+
fontStyle: light.fontStyle,
|
|
107
|
+
htmlStyle: light.htmlStyle,
|
|
108
|
+
offset: token.offset,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
66
111
|
// Create raw tokens for immediate display while highlighting loads
|
|
67
112
|
const createRawTokens = (code) => ({
|
|
68
113
|
bg: "transparent",
|
|
114
|
+
darkBg: "transparent",
|
|
115
|
+
darkFg: "inherit",
|
|
69
116
|
fg: "inherit",
|
|
70
117
|
tokens: code.split("\n").map((line) => line === ""
|
|
71
118
|
? []
|
|
@@ -73,6 +120,8 @@ const createRawTokens = (code) => ({
|
|
|
73
120
|
{
|
|
74
121
|
color: "inherit",
|
|
75
122
|
content: line,
|
|
123
|
+
darkColor: "inherit",
|
|
124
|
+
darkFontStyle: undefined,
|
|
76
125
|
},
|
|
77
126
|
]),
|
|
78
127
|
});
|
|
@@ -99,14 +148,21 @@ callback) => {
|
|
|
99
148
|
.then((highlighter) => {
|
|
100
149
|
const availableLangs = highlighter.getLoadedLanguages();
|
|
101
150
|
const langToUse = availableLangs.includes(language) ? language : "text";
|
|
102
|
-
const
|
|
151
|
+
const tokens = highlighter.codeToTokensWithThemes(code, {
|
|
103
152
|
lang: langToUse,
|
|
104
|
-
|
|
153
|
+
themes: {
|
|
154
|
+
dark: "github-dark",
|
|
155
|
+
light: "github-light",
|
|
156
|
+
},
|
|
105
157
|
});
|
|
158
|
+
const lightTheme = highlighter.getTheme("github-light");
|
|
159
|
+
const darkTheme = highlighter.getTheme("github-dark");
|
|
106
160
|
const tokenized = {
|
|
107
|
-
bg:
|
|
108
|
-
|
|
109
|
-
|
|
161
|
+
bg: lightTheme.bg ?? "transparent",
|
|
162
|
+
darkBg: darkTheme.bg ?? "transparent",
|
|
163
|
+
darkFg: darkTheme.fg ?? "inherit",
|
|
164
|
+
fg: lightTheme.fg ?? "inherit",
|
|
165
|
+
tokens: tokens.map((line) => line.map(tokenFromThemeVariants)),
|
|
110
166
|
};
|
|
111
167
|
// Cache the result
|
|
112
168
|
tokensCache.set(tokensCacheKey, tokenized);
|
|
@@ -128,11 +184,13 @@ callback) => {
|
|
|
128
184
|
};
|
|
129
185
|
const CodeBlockBody = memo(({ tokenized, showLineNumbers, className, }) => {
|
|
130
186
|
const preStyle = useMemo(() => ({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
187
|
+
"--shiki-code-block-dark-bg": tokenized.darkBg,
|
|
188
|
+
"--shiki-code-block-dark-fg": tokenized.darkFg,
|
|
189
|
+
"--shiki-code-block-light-bg": tokenized.bg,
|
|
190
|
+
"--shiki-code-block-light-fg": tokenized.fg,
|
|
191
|
+
}), [tokenized.bg, tokenized.darkBg, tokenized.darkFg, tokenized.fg]);
|
|
134
192
|
const keyedLines = useMemo(() => addKeysToTokens(tokenized.tokens), [tokenized.tokens]);
|
|
135
|
-
return (_jsx("pre", { className: cn("m-0 p-4 text-sm", className), style: preStyle, children: _jsx("code", { className: cn("font-mono text-sm", showLineNumbers && "[counter-increment:line_0] [counter-reset:line]"), children: keyedLines.map((keyedLine) => (_jsx(LineSpan, { keyedLine: keyedLine, showLineNumbers: showLineNumbers }, keyedLine.key))) }) }));
|
|
193
|
+
return (_jsx("pre", { className: cn("m-0 p-4 text-sm", className), "data-nc-code-block-body": "", style: preStyle, children: _jsx("code", { className: cn("font-mono text-sm", showLineNumbers && "[counter-increment:line_0] [counter-reset:line]"), children: keyedLines.map((keyedLine) => (_jsx(LineSpan, { keyedLine: keyedLine, showLineNumbers: showLineNumbers }, keyedLine.key))) }) }));
|
|
136
194
|
}, (prevProps, nextProps) => prevProps.tokenized === nextProps.tokenized &&
|
|
137
195
|
prevProps.showLineNumbers === nextProps.showLineNumbers &&
|
|
138
196
|
prevProps.className === nextProps.className);
|
|
@@ -26,7 +26,7 @@ export declare const ModelSelectorShortcut: (props: ModelSelectorShortcutProps)
|
|
|
26
26
|
export type ModelSelectorSeparatorProps = ComponentProps<typeof CommandSeparator>;
|
|
27
27
|
export declare const ModelSelectorSeparator: (props: ModelSelectorSeparatorProps) => import("react").JSX.Element;
|
|
28
28
|
export type ModelSelectorLogoProps = Omit<ComponentProps<"img">, "src" | "alt"> & {
|
|
29
|
-
provider: "moonshotai-cn" | "lucidquery" | "moonshotai" | "zai-coding-plan" | "alibaba" | "xai" | "vultr" | "nvidia" | "upstage" | "groq" | "github-copilot" | "mistral" | "vercel" | "nebius" | "deepseek" | "alibaba-cn" | "google-vertex-anthropic" | "venice" | "chutes" | "cortecs" | "github-models" | "togetherai" | "azure" | "baseten" | "huggingface" | "opencode" | "fastrouter" | "google" | "google-vertex" | "cloudflare-workers-ai" | "inception" | "wandb" | "openai" | "zhipuai-coding-plan" | "perplexity" | "openrouter" | "zenmux" | "
|
|
29
|
+
provider: "moonshotai-cn" | "lucidquery" | "moonshotai" | "zai-coding-plan" | "alibaba" | "xai" | "vultr" | "nvidia" | "upstage" | "groq" | "github-copilot" | "mistral" | "vercel" | "nebius" | "deepseek" | "alibaba-cn" | "google-vertex-anthropic" | "venice" | "chutes" | "cortecs" | "github-models" | "togetherai" | "azure" | "baseten" | "huggingface" | "opencode" | "fastrouter" | "google" | "google-vertex" | "cloudflare-workers-ai" | "inception" | "wandb" | "openai" | "zhipuai-coding-plan" | "perplexity" | "openrouter" | "zenmux" | "iflowcn" | "synthetic" | "deepinfra" | "zhipuai" | "submodel" | "zai" | "inference" | "requesty" | "morph" | "lmstudio" | "anthropic" | "aihubmix" | "fireworks-ai" | "modelscope" | "llama" | "scaleway" | "amazon-bedrock" | "cerebras" | (string & {});
|
|
30
30
|
};
|
|
31
31
|
export declare const ModelSelectorLogo: ({ provider, className, ...props }: ModelSelectorLogoProps) => import("react").JSX.Element;
|
|
32
32
|
export type ModelSelectorLogoGroupProps = ComponentProps<"div">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-selector.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/model-selector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,MAAM,EACN,aAAa,EAEb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,gCAEtD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,gCAEpE,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,0CAKlC,yBAAyB,gCAc3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,gCAElE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB,GAAI,yBA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GACvB,WAAW,GACX,OAAO,GACP,QAAQ,GACR,qBAAqB,GACrB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,cAAc,GACd,YAAY,GACZ,OAAO,GACP,UAAU,GACV,gBAAgB,GAChB,UAAU,GAEV,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,gCASxB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB,GAAI,yBAGpC,2BAA2B,gCAQ7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,sBAAsB,gCAExB,CAAC"}
|
|
@@ -22,8 +22,6 @@ export type OpenInT3Props = ComponentProps<typeof DropdownMenuItem>;
|
|
|
22
22
|
export declare const OpenInT3: (props: OpenInT3Props) => import("react").JSX.Element;
|
|
23
23
|
export type OpenInSciraProps = ComponentProps<typeof DropdownMenuItem>;
|
|
24
24
|
export declare const OpenInScira: (props: OpenInSciraProps) => import("react").JSX.Element;
|
|
25
|
-
export type OpenInv0Props = ComponentProps<typeof DropdownMenuItem>;
|
|
26
|
-
export declare const OpenInv0: (props: OpenInv0Props) => import("react").JSX.Element;
|
|
27
25
|
export type OpenInCursorProps = ComponentProps<typeof DropdownMenuItem>;
|
|
28
26
|
export declare const OpenInCursor: (props: OpenInCursorProps) => import("react").JSX.Element;
|
|
29
27
|
//# sourceMappingURL=open-in-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-in-chat.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/open-in-chat.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"open-in-chat.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/open-in-chat.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAiK5C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,GAAG;IAC9D,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,qBAAqB,WAAW,gCAQtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,aAAa,GAAI,yBAAyB,kBAAkB,gCAMxE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEtE,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,gCAEhD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAExE,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,gCAElD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEhF,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,gCAE1D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,aAAa,GAAI,wBAAwB,kBAAkB,gCASvE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEzE,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,gCAgBtD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCAgBpD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,gCAgB5C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvE,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,gCAgBlD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCAgBpD,CAAC"}
|
|
@@ -49,13 +49,6 @@ const providers = {
|
|
|
49
49
|
icon: _jsx(MessageCircleIcon, {}),
|
|
50
50
|
title: "Open in T3 Chat",
|
|
51
51
|
},
|
|
52
|
-
v0: {
|
|
53
|
-
createUrl: (q) => `https://v0.app?${new URLSearchParams({
|
|
54
|
-
q,
|
|
55
|
-
})}`,
|
|
56
|
-
icon: (_jsxs("svg", { fill: "currentColor", viewBox: "0 0 147 70", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("title", { children: "v0" }), _jsx("path", { d: "M56 50.2031V14H70V60.1562C70 65.5928 65.5928 70 60.1562 70C57.5605 70 54.9982 68.9992 53.1562 67.1573L0 14H19.7969L56 50.2031Z" }), _jsx("path", { d: "M147 56H133V23.9531L100.953 56H133V70H96.6875C85.8144 70 77 61.1856 77 50.3125V14H91V46.1562L123.156 14H91V0H127.312C138.186 0 147 8.81439 147 19.6875V56Z" })] })),
|
|
57
|
-
title: "Open in v0",
|
|
58
|
-
},
|
|
59
52
|
};
|
|
60
53
|
const OpenInContext = createContext(undefined);
|
|
61
54
|
const useOpenInContext = () => {
|
|
@@ -90,10 +83,6 @@ export const OpenInScira = (props) => {
|
|
|
90
83
|
const { query } = useOpenInContext();
|
|
91
84
|
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.scira.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.scira.icon }), _jsx("span", { className: "flex-1", children: providers.scira.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
92
85
|
};
|
|
93
|
-
export const OpenInv0 = (props) => {
|
|
94
|
-
const { query } = useOpenInContext();
|
|
95
|
-
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.v0.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.v0.icon }), _jsx("span", { className: "flex-1", children: providers.v0.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
96
|
-
};
|
|
97
86
|
export const OpenInCursor = (props) => {
|
|
98
87
|
const { query } = useOpenInContext();
|
|
99
88
|
return (_jsx(DropdownMenuItem, { asChild: true, ...props, children: _jsxs("a", { className: "flex items-center gap-2", href: providers.cursor.createUrl(query), rel: "noopener", target: "_blank", children: [_jsx("span", { className: "shrink-0", children: providers.cursor.icon }), _jsx("span", { className: "flex-1", children: providers.cursor.title }), _jsx(ExternalLinkIcon, { className: "size-4 shrink-0" })] }) }));
|
|
@@ -3,8 +3,12 @@ import * as RechartsPrimitive from "recharts";
|
|
|
3
3
|
import type { TooltipValueType } from "recharts";
|
|
4
4
|
declare const THEMES: {
|
|
5
5
|
readonly light: "";
|
|
6
|
+
readonly dark: ".dark";
|
|
6
7
|
};
|
|
7
8
|
type TooltipNameType = number | string;
|
|
9
|
+
type ChartTheme = Partial<Record<keyof typeof THEMES, string>> & {
|
|
10
|
+
light: string;
|
|
11
|
+
};
|
|
8
12
|
export type ChartConfig = Record<string, {
|
|
9
13
|
label?: React.ReactNode;
|
|
10
14
|
icon?: React.ComponentType;
|
|
@@ -13,7 +17,7 @@ export type ChartConfig = Record<string, {
|
|
|
13
17
|
theme?: never;
|
|
14
18
|
} | {
|
|
15
19
|
color?: never;
|
|
16
|
-
theme:
|
|
20
|
+
theme: ChartTheme;
|
|
17
21
|
})>;
|
|
18
22
|
declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: React.ComponentProps<"div"> & {
|
|
19
23
|
config: ChartConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,QAAA,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,QAAA,MAAM,MAAM;;;CAAwC,CAAA;AAGpD,KAAK,eAAe,GAAG,MAAM,GAAG,MAAM,CAAA;AACtC,KAAK,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAyBD,MAAM,MAAM,WAAW,GAA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,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CACN,iBAAiB,CAAC,0BAA0B,CAC1C,gBAAgB,EAChB,eAAe,CAChB,EACD,oBAAoB,CACrB,4BA6HF;AAED,QAAA,MAAM,WAAW,sGAA2B,CAAA;AAE5C,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAgB,EAChB,OAAO,EACP,aAAwB,EACxB,OAAO,GACR,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,iBAAiB,CAAC,yBAAyB,4BA4C9C;AAuCD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,UAAU,GACX,CAAA"}
|
package/dist/components/chart.js
CHANGED
|
@@ -3,8 +3,25 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as RechartsPrimitive from "recharts";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
|
-
const THEMES = { light: "" };
|
|
6
|
+
const THEMES = { light: "", dark: ".dark" };
|
|
7
7
|
const INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
8
|
+
function sanitizeChartToken(value) {
|
|
9
|
+
const sanitized = value
|
|
10
|
+
.trim()
|
|
11
|
+
.replace(/[^A-Za-z0-9_-]+/g, "-")
|
|
12
|
+
.replace(/^-+|-+$/g, "");
|
|
13
|
+
return sanitized || "chart";
|
|
14
|
+
}
|
|
15
|
+
function isSafeChartColor(value) {
|
|
16
|
+
const color = value.trim();
|
|
17
|
+
return color.length > 0 && !/[;{}]/.test(color) && !/\burl\s*\(/i.test(color);
|
|
18
|
+
}
|
|
19
|
+
function chartColorDeclaration(key, color) {
|
|
20
|
+
if (!color || !isSafeChartColor(color)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return ` --color-${sanitizeChartToken(key)}: ${color.trim()};`;
|
|
24
|
+
}
|
|
8
25
|
const ChartContext = React.createContext(null);
|
|
9
26
|
function useChart() {
|
|
10
27
|
const context = React.useContext(ChartContext);
|
|
@@ -15,10 +32,11 @@ function useChart() {
|
|
|
15
32
|
}
|
|
16
33
|
function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
|
|
17
34
|
const uniqueId = React.useId();
|
|
18
|
-
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}
|
|
35
|
+
const chartId = sanitizeChartToken(`chart-${id ?? uniqueId.replace(/:/g, "")}`);
|
|
19
36
|
return (_jsx(ChartContext.Provider, { value: { config }, children: _jsxs("div", { "data-slot": "chart", "data-chart": chartId, className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-layer]:outline-hidden [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden", className), ...props, children: [_jsx(ChartStyle, { id: chartId, config: config }), _jsx(RechartsPrimitive.ResponsiveContainer, { initialDimension: initialDimension, children: children })] }) }));
|
|
20
37
|
}
|
|
21
38
|
const ChartStyle = ({ id, config }) => {
|
|
39
|
+
const chartId = sanitizeChartToken(id);
|
|
22
40
|
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
|
|
23
41
|
if (!colorConfig.length) {
|
|
24
42
|
return null;
|
|
@@ -26,12 +44,13 @@ const ChartStyle = ({ id, config }) => {
|
|
|
26
44
|
return (_jsx("style", { dangerouslySetInnerHTML: {
|
|
27
45
|
__html: Object.entries(THEMES)
|
|
28
46
|
.map(([theme, prefix]) => `
|
|
29
|
-
${prefix} [data-chart
|
|
47
|
+
${prefix} [data-chart="${chartId}"] {
|
|
30
48
|
${colorConfig
|
|
31
49
|
.map(([key, itemConfig]) => {
|
|
32
50
|
const color = itemConfig.theme?.[theme] ??
|
|
51
|
+
itemConfig.theme?.light ??
|
|
33
52
|
itemConfig.color;
|
|
34
|
-
return
|
|
53
|
+
return chartColorDeclaration(key, color);
|
|
35
54
|
})
|
|
36
55
|
.join("\n")}
|
|
37
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ToasterProps } from "sonner";
|
|
2
|
-
declare const Toaster: ({ ...props }: ToasterProps) => import("react").JSX.Element;
|
|
2
|
+
declare const Toaster: ({ theme, ...props }: ToasterProps) => import("react").JSX.Element;
|
|
3
3
|
export { Toaster };
|
|
4
4
|
//# sourceMappingURL=sonner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../src/components/sonner.tsx"],"names":[],"mappings":"AASA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE7D,QAAA,MAAM,OAAO,GAAI,
|
|
1
|
+
{"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../src/components/sonner.tsx"],"names":[],"mappings":"AASA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE7D,QAAA,MAAM,OAAO,GAAI,qBAA+B,YAAY,gCAuB3D,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, } from "lucide-react";
|
|
4
4
|
import { Toaster as Sonner } from "sonner";
|
|
5
|
-
const Toaster = ({ ...props }) => {
|
|
5
|
+
const Toaster = ({ theme = "light", ...props }) => {
|
|
6
6
|
return (_jsx(Sonner, { className: "toaster group", icons: {
|
|
7
7
|
success: _jsx(CircleCheckIcon, { className: "size-4" }),
|
|
8
8
|
info: _jsx(InfoIcon, { className: "size-4" }),
|
|
@@ -14,6 +14,6 @@ const Toaster = ({ ...props }) => {
|
|
|
14
14
|
"--normal-text": "var(--popover-foreground)",
|
|
15
15
|
"--normal-border": "var(--border)",
|
|
16
16
|
"--border-radius": "var(--radius)",
|
|
17
|
-
}, ...props, theme:
|
|
17
|
+
}, ...props, theme: theme }));
|
|
18
18
|
};
|
|
19
19
|
export { Toaster };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ToggleGroup } from "./toggle-group";
|
|
3
|
+
import { isThemeMode, themeModes, type ThemeMode } from "../lib/theme-mode";
|
|
4
|
+
export { isThemeMode, themeModes };
|
|
5
|
+
export type { ThemeMode };
|
|
6
|
+
export type ThemeModeOptionLabels = Record<ThemeMode, string>;
|
|
7
|
+
export type ThemeModeSwitcherProps = Omit<React.ComponentProps<typeof ToggleGroup>, "children" | "defaultValue" | "onValueChange" | "type" | "value"> & {
|
|
8
|
+
"aria-label": string;
|
|
9
|
+
compact?: boolean;
|
|
10
|
+
itemClassName?: string;
|
|
11
|
+
labels: ThemeModeOptionLabels;
|
|
12
|
+
onValueChange: (value: ThemeMode) => void;
|
|
13
|
+
value: ThemeMode;
|
|
14
|
+
};
|
|
15
|
+
declare function ThemeModeSwitcher({ "aria-label": ariaLabel, className, compact, disabled, itemClassName, labels, onValueChange, value, ...props }: ThemeModeSwitcherProps): React.JSX.Element;
|
|
16
|
+
export { ThemeModeSwitcher };
|
|
17
|
+
//# sourceMappingURL=theme-mode-switcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-mode-switcher.d.ts","sourceRoot":"","sources":["../../src/components/theme-mode-switcher.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,WAAW,EAAmB,MAAM,2BAA2B,CAAA;AACxE,OAAO,EACL,WAAW,EACX,UAAU,EACV,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAA;AAClC,YAAY,EAAE,SAAS,EAAE,CAAA;AAEzB,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AAE7D,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EACxC,UAAU,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,GAAG,OAAO,CACjE,GAAG;IACF,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,qBAAqB,CAAA;IAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACzC,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAQD,iBAAS,iBAAiB,CAAC,EACzB,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,OAAe,EACf,QAAQ,EACR,aAAa,EACb,MAAM,EACN,aAAa,EACb,KAAK,EACL,GAAG,KAAK,EACT,EAAE,sBAAsB,qBAuCxB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
|
|
4
|
+
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
5
|
+
import { isThemeMode, themeModes, } from "../lib/theme-mode.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
export { isThemeMode, themeModes };
|
|
8
|
+
const themeModeIcons = {
|
|
9
|
+
light: SunIcon,
|
|
10
|
+
dark: MoonIcon,
|
|
11
|
+
system: MonitorIcon,
|
|
12
|
+
};
|
|
13
|
+
function ThemeModeSwitcher({ "aria-label": ariaLabel, className, compact = false, disabled, itemClassName, labels, onValueChange, value, ...props }) {
|
|
14
|
+
return (_jsx(ToggleGroup, { "aria-label": ariaLabel, className: cn("max-w-full", className), disabled: disabled, onValueChange: (nextValue) => {
|
|
15
|
+
if (isThemeMode(nextValue)) {
|
|
16
|
+
onValueChange(nextValue);
|
|
17
|
+
}
|
|
18
|
+
}, type: "single", value: value, variant: "outline", ...props, children: themeModes.map((mode) => {
|
|
19
|
+
const Icon = themeModeIcons[mode];
|
|
20
|
+
const label = labels[mode];
|
|
21
|
+
return (_jsxs(ToggleGroupItem, { "aria-label": label, className: cn("min-w-0 gap-1.5 px-2.5", compact ? "h-8 text-xs" : "h-9", itemClassName), disabled: disabled, value: mode, children: [_jsx(Icon, { "aria-hidden": "true", className: "size-4", "data-icon": true }), _jsx("span", { className: "min-w-0 truncate", children: label })] }, mode));
|
|
22
|
+
}) }));
|
|
23
|
+
}
|
|
24
|
+
export { ThemeModeSwitcher };
|
package/dist/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./components/table";
|
|
|
93
93
|
export * from "./components/tabs";
|
|
94
94
|
export * from "./components/testimonials";
|
|
95
95
|
export * from "./components/textarea";
|
|
96
|
+
export * from "./components/theme-mode-switcher";
|
|
96
97
|
export * from "./components/toggle";
|
|
97
98
|
export * from "./components/toggle-group";
|
|
98
99
|
export * from "./components/tooltip";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,C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AqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kCAAkC,CAAA;AAChD,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iCAAiC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ export * from "./components/table.js";
|
|
|
93
93
|
export * from "./components/tabs.js";
|
|
94
94
|
export * from "./components/testimonials.js";
|
|
95
95
|
export * from "./components/textarea.js";
|
|
96
|
+
export * from "./components/theme-mode-switcher.js";
|
|
96
97
|
export * from "./components/toggle.js";
|
|
97
98
|
export * from "./components/toggle-group.js";
|
|
98
99
|
export * from "./components/tooltip.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-mode.d.ts","sourceRoot":"","sources":["../../src/lib/theme-mode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,sCAAuC,CAAA;AAE9D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,IAAI,SAAS,CAEzE"}
|
package/dist/styles/globals.css
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @nadicodeai/ui — Tailwind v4 + shadcn entry stylesheet.
|
|
3
3
|
*
|
|
4
|
-
* Import order is load-bearing: Tailwind first, then the design-system
|
|
5
|
-
* bridge (the brand @theme + the :root shadcn role
|
|
6
|
-
* DESIGN.md by Style Dictionary
|
|
4
|
+
* Import order is load-bearing: Tailwind first, then the design-system theme
|
|
5
|
+
* bridge (the brand @theme + the :root/.dark shadcn role maps, generated from
|
|
6
|
+
* DESIGN.md by Style Dictionary). The @theme inline block below
|
|
7
7
|
* lifts semantic role vars into Tailwind's --color-* utility namespace so
|
|
8
8
|
* shadcn utilities (bg-background, text-foreground, border-border, …) resolve
|
|
9
9
|
* to brand tokens.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* roles/aliases and do not carry raw palette utilities or dark: utility classes.
|
|
17
|
-
* DESIGN.md remains the only source of literal values.
|
|
11
|
+
* Standard shadcn roles are generated by @nadicodeai/design-system. This file
|
|
12
|
+
* keeps package-local product aliases only; their --nc-* names are package-local
|
|
13
|
+
* declarations, while source values remain generated tokens or semantic roles.
|
|
14
|
+
* Components consume those roles/aliases and do not carry raw palette utilities
|
|
15
|
+
* or dark: utility classes. DESIGN.md remains the only source of literal values.
|
|
18
16
|
*/
|
|
19
17
|
@import "tailwindcss";
|
|
20
18
|
@import "@nadicodeai/design-system/tailwind/theme.css";
|
|
@@ -22,9 +20,10 @@
|
|
|
22
20
|
@import "@xyflow/react/dist/style.css";
|
|
23
21
|
|
|
24
22
|
/*
|
|
25
|
-
* Tailwind v4's dark: variant defaults to an OS media query.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Tailwind v4's dark: variant defaults to an OS media query. Match shadcn's
|
|
24
|
+
* class strategy so apps can drive light/dark/system from the root `.dark`
|
|
25
|
+
* class, usually through next-themes. Shared components still do not ship
|
|
26
|
+
* dark: color utilities; semantic role remaps carry dark mode.
|
|
28
27
|
*/
|
|
29
28
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
30
29
|
|
|
@@ -74,40 +73,6 @@
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
:root {
|
|
77
|
-
--radius: var(--nc-rounded-md);
|
|
78
|
-
--background: var(--nc-canvas);
|
|
79
|
-
--foreground: var(--nc-ink);
|
|
80
|
-
--card: var(--nc-canvas);
|
|
81
|
-
--card-foreground: var(--nc-ink);
|
|
82
|
-
--popover: var(--nc-canvas);
|
|
83
|
-
--popover-foreground: var(--nc-ink);
|
|
84
|
-
--primary: var(--nc-primary);
|
|
85
|
-
--primary-foreground: var(--nc-on-primary);
|
|
86
|
-
--secondary: var(--nc-canvas-soft);
|
|
87
|
-
--secondary-foreground: var(--nc-ink);
|
|
88
|
-
--muted: var(--nc-canvas-soft);
|
|
89
|
-
--muted-foreground: var(--nc-muted);
|
|
90
|
-
--accent: var(--nc-canvas-soft-2);
|
|
91
|
-
--accent-foreground: var(--nc-ink);
|
|
92
|
-
--destructive: var(--nc-error);
|
|
93
|
-
--destructive-foreground: var(--nc-on-primary);
|
|
94
|
-
--border: var(--nc-line);
|
|
95
|
-
--input: var(--nc-line);
|
|
96
|
-
--ring: var(--nc-link);
|
|
97
|
-
--chart-1: var(--nc-link);
|
|
98
|
-
--chart-2: var(--nc-cyan);
|
|
99
|
-
--chart-3: var(--nc-flag-red);
|
|
100
|
-
--chart-4: var(--nc-gradient-ship-end);
|
|
101
|
-
--chart-5: var(--nc-error);
|
|
102
|
-
--sidebar: var(--nc-canvas-soft);
|
|
103
|
-
--sidebar-foreground: var(--nc-ink);
|
|
104
|
-
--sidebar-primary: var(--nc-primary);
|
|
105
|
-
--sidebar-primary-foreground: var(--nc-on-primary);
|
|
106
|
-
--sidebar-accent: var(--nc-canvas-soft-2);
|
|
107
|
-
--sidebar-accent-foreground: var(--nc-ink);
|
|
108
|
-
--sidebar-border: var(--nc-line);
|
|
109
|
-
--sidebar-ring: var(--nc-link);
|
|
110
|
-
|
|
111
76
|
--nc-app-surface: var(--background);
|
|
112
77
|
--nc-app-surface-chrome: var(--sidebar);
|
|
113
78
|
--nc-app-surface-sidebar: var(--sidebar);
|
|
@@ -217,40 +182,6 @@
|
|
|
217
182
|
}
|
|
218
183
|
|
|
219
184
|
.dark {
|
|
220
|
-
--radius: var(--nc-rounded-md);
|
|
221
|
-
--background: var(--nc-ink);
|
|
222
|
-
--foreground: var(--nc-on-primary);
|
|
223
|
-
--card: var(--nc-primary);
|
|
224
|
-
--card-foreground: var(--nc-on-primary);
|
|
225
|
-
--popover: var(--nc-primary);
|
|
226
|
-
--popover-foreground: var(--nc-on-primary);
|
|
227
|
-
--primary: var(--nc-on-primary);
|
|
228
|
-
--primary-foreground: var(--nc-ink);
|
|
229
|
-
--secondary: var(--nc-body);
|
|
230
|
-
--secondary-foreground: var(--nc-on-primary);
|
|
231
|
-
--muted: var(--nc-body);
|
|
232
|
-
--muted-foreground: var(--nc-cross);
|
|
233
|
-
--accent: var(--nc-body);
|
|
234
|
-
--accent-foreground: var(--nc-on-primary);
|
|
235
|
-
--destructive: var(--nc-error);
|
|
236
|
-
--destructive-foreground: var(--nc-on-primary);
|
|
237
|
-
--border: var(--nc-body);
|
|
238
|
-
--input: var(--nc-body);
|
|
239
|
-
--ring: var(--nc-cyan);
|
|
240
|
-
--chart-1: var(--nc-cyan);
|
|
241
|
-
--chart-2: var(--nc-link-bg-soft);
|
|
242
|
-
--chart-3: var(--nc-warning);
|
|
243
|
-
--chart-4: var(--nc-flag-red);
|
|
244
|
-
--chart-5: var(--nc-link);
|
|
245
|
-
--sidebar: var(--nc-primary);
|
|
246
|
-
--sidebar-foreground: var(--nc-on-primary);
|
|
247
|
-
--sidebar-primary: var(--nc-cyan);
|
|
248
|
-
--sidebar-primary-foreground: var(--nc-ink);
|
|
249
|
-
--sidebar-accent: var(--nc-body);
|
|
250
|
-
--sidebar-accent-foreground: var(--nc-on-primary);
|
|
251
|
-
--sidebar-border: var(--nc-body);
|
|
252
|
-
--sidebar-ring: var(--nc-cyan);
|
|
253
|
-
|
|
254
185
|
--nc-app-surface: var(--background);
|
|
255
186
|
--nc-app-surface-chrome: var(--sidebar);
|
|
256
187
|
--nc-app-surface-sidebar: var(--sidebar);
|
|
@@ -359,4 +290,77 @@
|
|
|
359
290
|
--nc-plugin-permission-foreground: var(--foreground);
|
|
360
291
|
}
|
|
361
292
|
|
|
293
|
+
[data-nc-code-block-body] {
|
|
294
|
+
background-color: var(--shiki-code-block-light-bg, var(--background));
|
|
295
|
+
color: var(--shiki-code-block-light-fg, var(--foreground));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.dark [data-nc-code-block-body] {
|
|
299
|
+
background-color: var(
|
|
300
|
+
--shiki-code-block-dark-bg,
|
|
301
|
+
var(--shiki-code-block-light-bg, var(--background))
|
|
302
|
+
);
|
|
303
|
+
color: var(
|
|
304
|
+
--shiki-code-block-dark-fg,
|
|
305
|
+
var(--shiki-code-block-light-fg, var(--foreground))
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
[data-nc-code-token] {
|
|
310
|
+
background-color: var(--shiki-code-token-light-bg, transparent);
|
|
311
|
+
color: var(--shiki-code-token-light-color, var(--foreground));
|
|
312
|
+
font-style: var(--shiki-code-token-light-font-style, normal);
|
|
313
|
+
font-weight: var(--shiki-code-token-light-font-weight, normal);
|
|
314
|
+
text-decoration: var(--shiki-code-token-light-text-decoration, none);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.dark [data-nc-code-token] {
|
|
318
|
+
background-color: var(
|
|
319
|
+
--shiki-code-token-dark-bg,
|
|
320
|
+
var(--shiki-code-token-light-bg, transparent)
|
|
321
|
+
);
|
|
322
|
+
color: var(
|
|
323
|
+
--shiki-code-token-dark-color,
|
|
324
|
+
var(--shiki-code-token-light-color, var(--foreground))
|
|
325
|
+
);
|
|
326
|
+
font-style: var(
|
|
327
|
+
--shiki-code-token-dark-font-style,
|
|
328
|
+
var(--shiki-code-token-light-font-style, normal)
|
|
329
|
+
);
|
|
330
|
+
font-weight: var(
|
|
331
|
+
--shiki-code-token-dark-font-weight,
|
|
332
|
+
var(--shiki-code-token-light-font-weight, normal)
|
|
333
|
+
);
|
|
334
|
+
text-decoration: var(
|
|
335
|
+
--shiki-code-token-dark-text-decoration,
|
|
336
|
+
var(--shiki-code-token-light-text-decoration, none)
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.toaster [data-sonner-toast][data-styled="true"] [data-description] {
|
|
341
|
+
color: var(--muted-foreground);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.toaster [data-sonner-toast][data-styled="true"] [data-button] {
|
|
345
|
+
background: var(--popover-foreground);
|
|
346
|
+
color: var(--popover);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.toaster [data-sonner-toast][data-styled="true"] [data-cancel] {
|
|
350
|
+
background: var(--muted);
|
|
351
|
+
color: var(--popover-foreground);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.toaster [data-sonner-toast][data-styled="true"] [data-close-button] {
|
|
355
|
+
background: var(--popover);
|
|
356
|
+
border-color: var(--border);
|
|
357
|
+
color: var(--popover-foreground);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.toaster [data-sonner-toast][data-styled="true"] [data-close-button]:hover {
|
|
361
|
+
background: var(--accent);
|
|
362
|
+
border-color: var(--border);
|
|
363
|
+
color: var(--accent-foreground);
|
|
364
|
+
}
|
|
365
|
+
|
|
362
366
|
@source "../components";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadicodeai/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"types": "./dist/lib/utils.d.ts",
|
|
24
24
|
"import": "./dist/lib/utils.js"
|
|
25
25
|
},
|
|
26
|
+
"./lib/theme-mode": {
|
|
27
|
+
"types": "./dist/lib/theme-mode.d.ts",
|
|
28
|
+
"import": "./dist/lib/theme-mode.js"
|
|
29
|
+
},
|
|
26
30
|
"./components/*": {
|
|
27
31
|
"types": "./dist/components/*.d.ts",
|
|
28
32
|
"import": "./dist/components/*.js"
|
|
@@ -37,13 +41,13 @@
|
|
|
37
41
|
"skills"
|
|
38
42
|
],
|
|
39
43
|
"scripts": {
|
|
40
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/fix-dist-imports.mjs && cp -R src/styles dist/styles",
|
|
44
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/fix-dist-imports.mjs && rm -rf dist/styles && cp -R src/styles dist/styles",
|
|
41
45
|
"prepack": "npm run build",
|
|
42
46
|
"test": "vitest run"
|
|
43
47
|
},
|
|
44
48
|
"dependencies": {
|
|
45
49
|
"@base-ui/react": "^1.6.0",
|
|
46
|
-
"@nadicodeai/design-system": "0.
|
|
50
|
+
"@nadicodeai/design-system": "0.2.0",
|
|
47
51
|
"@radix-ui/react-use-controllable-state": "^1.2.3",
|
|
48
52
|
"@rive-app/react-webgl2": "^4.29.1",
|
|
49
53
|
"@streamdown/cjk": "^1.0.3",
|
|
@@ -68,7 +68,8 @@ import { AgentChat } from "@nadicodeai/ui/components/agent-chat";
|
|
|
68
68
|
- Use token-backed shadcn utilities: `bg-background`, `text-foreground`, `border-border`, `text-muted-foreground`, `text-destructive`.
|
|
69
69
|
- Use UI-local product aliases when a product role is needed: `bg-[var(--nc-app-surface)]`, `ring-[var(--nc-composer-ring)]`.
|
|
70
70
|
- Use brand tokens through arbitrary values when needed: `text-[var(--nc-link-deep)]`.
|
|
71
|
-
- Dark mode
|
|
71
|
+
- Dark mode uses generated design-system `:root` and `.dark` shadcn roles plus UI-local product aliases in `@nadicodeai/ui/globals.css`. Consuming apps own the runtime `.dark` class and persisted light/dark/system preference. Do not add component-level `dark:` utilities, `.dark` CSS outside package globals/theme files, OS dark-mode branching, raw color literals, or raw Tailwind palette utilities.
|
|
72
|
+
- Use `ThemeModeSwitcher` only as a controlled, app-agnostic control; do not import `next-themes` or app persistence into the UI package.
|
|
72
73
|
- Compose app pages/screens from existing package components; extract new shared UI only after a second concrete consumer, a plan-approved shared component, or a named validation slice proves the package boundary.
|
|
73
74
|
- For source maintenance, run shadcn commands with `--dry-run` before writing and do not use `--overwrite` without explicit maintainer approval.
|
|
74
75
|
|