burne-ui 1.5.4 → 1.5.9
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 +4 -3
- package/cli/init.js +71 -5
- package/dist/components/core/Popover/index.d.ts +3 -1
- package/dist/components/core/Popover/popoverParts.d.ts +4 -2
- package/dist/components/core/Popover/popoverTypes.d.ts +4 -1
- package/dist/components/core/Tooltip/index.d.ts +3 -1
- package/dist/components/core/Tooltip/tooltipParts.d.ts +4 -2
- package/dist/components/core/Tooltip/tooltipTypes.d.ts +4 -1
- package/dist/index.cjs +13 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13442 -14479
- package/dist/theme/ThemeProvider.d.ts +0 -1
- package/dist/theme/index.d.ts +4 -5
- package/dist/theme/themeConfig.d.ts +30 -14
- package/dist/theme/themeDefaults.d.ts +14 -185
- package/dist/theme/themePalettes.d.ts +1 -114
- package/dist/tokens/config.d.ts +0 -1
- package/dist/tokens/index.d.ts +1 -1
- package/dist/ui.css +5 -25
- package/package.json +1 -1
- package/dist/theme/colorPresets.d.ts +0 -13
package/README.md
CHANGED
|
@@ -56,18 +56,19 @@ import "burne-ui/styles.css";
|
|
|
56
56
|
"use client";
|
|
57
57
|
|
|
58
58
|
import { BurneUIProvider } from "burne-ui";
|
|
59
|
-
|
|
59
|
+
import burneTheme from "./burne-theme";
|
|
60
60
|
|
|
61
61
|
export function AppProviders({ children }: { children: React.ReactNode }) {
|
|
62
62
|
return (
|
|
63
|
-
<BurneUIProvider defaultTheme="system" toast>
|
|
63
|
+
<BurneUIProvider config={burneTheme} defaultTheme="system" toast>
|
|
64
64
|
{children}
|
|
65
65
|
</BurneUIProvider>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Scaffold (`create-burne-app` / `burne-ui init`) уже кладёт `burne-theme.ts` с **`tokens`** (shared), **`colors.light` / `colors.dark`** и **`motion`**.
|
|
71
|
+
|
|
71
72
|
|
|
72
73
|
Только переключение `data-theme`: `ThemeProvider` + `useBurneTheme()`. Подробности — [docs/SETUP.md](./docs/SETUP.md).
|
|
73
74
|
|
package/cli/init.js
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
5
|
|
|
5
6
|
import * as prompts from "./prompts.js";
|
|
6
7
|
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
const THEME_BRIDGE_CSS = `
|
|
11
|
+
/*
|
|
12
|
+
* Tailwind v4 can regenerate theme tokens — bind them back to burne runtime vars.
|
|
13
|
+
*/
|
|
14
|
+
@theme {
|
|
15
|
+
--text-base: var(--text-base-size);
|
|
16
|
+
--text-base--line-height: var(--text-base-line-height);
|
|
17
|
+
--text-base--font-weight: var(--text-base-weight);
|
|
18
|
+
--font-sans: var(--font-family-sans);
|
|
19
|
+
--font-mono: var(--font-family-mono);
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @returns {Promise<string>}
|
|
25
|
+
*/
|
|
26
|
+
async function loadDefaultThemeSource() {
|
|
27
|
+
const distEntry = path.join(__dirname, "../dist/index.js");
|
|
28
|
+
if (!fs.existsSync(distEntry)) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"burne-ui dist missing — reinstall the package (need burne-ui ≥ 1.5.9 with exportDefaultBurneThemeConfigSource).",
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const mod = await import(pathToFileURL(distEntry).href);
|
|
34
|
+
if (typeof mod.exportDefaultBurneThemeConfigSource !== "function") {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"This burne-ui build has no exportDefaultBurneThemeConfigSource — upgrade to ≥ 1.5.9.",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return mod.exportDefaultBurneThemeConfigSource();
|
|
40
|
+
}
|
|
41
|
+
|
|
7
42
|
/** @typedef {"npm" | "pnpm" | "bun" | "yarn"} PackageManager */
|
|
8
43
|
/** @typedef {"system" | "dark" | "light"} ThemeMode */
|
|
9
44
|
/** @typedef {"next" | "vite" | "unknown"} Framework */
|
|
@@ -78,6 +113,7 @@ export function patchCssFile(cssPath) {
|
|
|
78
113
|
let css = fs.readFileSync(cssPath, "utf8");
|
|
79
114
|
const hadBurne = css.includes("burne-ui/styles.css");
|
|
80
115
|
const hadTailwind = /@import\s+["']tailwindcss["']/.test(css);
|
|
116
|
+
const hadThemeBridge = css.includes("--text-base: var(--text-base-size)");
|
|
81
117
|
|
|
82
118
|
if (!hadBurne) {
|
|
83
119
|
if (hadTailwind) {
|
|
@@ -105,8 +141,18 @@ export function patchCssFile(cssPath) {
|
|
|
105
141
|
css += `\n@import "burne-ui/styles.css";\n`;
|
|
106
142
|
}
|
|
107
143
|
|
|
144
|
+
if (!hadThemeBridge) {
|
|
145
|
+
const burneImport = css.match(/@import\s+["']burne-ui\/styles\.css["']\s*;/);
|
|
146
|
+
if (burneImport && burneImport.index != null) {
|
|
147
|
+
const insertAt = burneImport.index + burneImport[0].length;
|
|
148
|
+
css = css.slice(0, insertAt) + "\n" + THEME_BRIDGE_CSS + css.slice(insertAt);
|
|
149
|
+
} else {
|
|
150
|
+
css += "\n" + THEME_BRIDGE_CSS;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
108
154
|
fs.writeFileSync(cssPath, css);
|
|
109
|
-
return { hadBurne, hadTailwind };
|
|
155
|
+
return { hadBurne, hadTailwind, hadThemeBridge };
|
|
110
156
|
}
|
|
111
157
|
|
|
112
158
|
/**
|
|
@@ -119,13 +165,15 @@ function providerSource(theme, toast) {
|
|
|
119
165
|
|
|
120
166
|
import { BurneUIProvider } from "burne-ui";
|
|
121
167
|
|
|
168
|
+
import burneTheme from "./burne-theme";
|
|
169
|
+
|
|
122
170
|
/**
|
|
123
171
|
* Generated by \`burne-ui init\`.
|
|
124
|
-
*
|
|
172
|
+
* Theme tokens live in \`burne-theme.ts\` (replace via docs site → Copy config).
|
|
125
173
|
*/
|
|
126
174
|
export function BurneProviders({ children }: { children: React.ReactNode }) {
|
|
127
175
|
return (
|
|
128
|
-
<BurneUIProvider defaultTheme="${theme}"${toastLine}>
|
|
176
|
+
<BurneUIProvider config={burneTheme} defaultTheme="${theme}"${toastLine}>
|
|
129
177
|
{children}
|
|
130
178
|
</BurneUIProvider>
|
|
131
179
|
);
|
|
@@ -369,8 +417,9 @@ export async function runInit(argv, cliVersion) {
|
|
|
369
417
|
if (cssRel) {
|
|
370
418
|
const abs = path.resolve(cwd, cssRel);
|
|
371
419
|
if (!fs.existsSync(abs)) throw new Error(`CSS not found: ${cssRel}`);
|
|
372
|
-
const { hadBurne, hadTailwind } = patchCssFile(abs);
|
|
420
|
+
const { hadBurne, hadTailwind, hadThemeBridge } = patchCssFile(abs);
|
|
373
421
|
console.log(hadBurne ? `CSS OK (already linked): ${cssRel}` : `Patched CSS: ${cssRel}`);
|
|
422
|
+
if (!hadThemeBridge) console.log("Added @theme bridge (text-base / font-sans).");
|
|
374
423
|
if (!hadTailwind) {
|
|
375
424
|
console.log('Note: no @import "tailwindcss" — add Tailwind v4 for className utilities.');
|
|
376
425
|
}
|
|
@@ -380,6 +429,23 @@ export async function runInit(argv, cliVersion) {
|
|
|
380
429
|
|
|
381
430
|
fs.mkdirSync(provider.dir, { recursive: true });
|
|
382
431
|
const relProvider = path.relative(cwd, provider.file);
|
|
432
|
+
const themeFile = path.join(provider.dir, "burne-theme.ts");
|
|
433
|
+
const relTheme = path.relative(cwd, themeFile);
|
|
434
|
+
|
|
435
|
+
const themeSource = await loadDefaultThemeSource();
|
|
436
|
+
if (fs.existsSync(themeFile) && interactive) {
|
|
437
|
+
const overwriteTheme = await prompts.confirm({
|
|
438
|
+
message: `Overwrite ${relTheme}?`,
|
|
439
|
+
initialValue: false,
|
|
440
|
+
});
|
|
441
|
+
if (overwriteTheme) {
|
|
442
|
+
fs.writeFileSync(themeFile, themeSource);
|
|
443
|
+
console.log(`Wrote ${relTheme}`);
|
|
444
|
+
}
|
|
445
|
+
} else if (!fs.existsSync(themeFile)) {
|
|
446
|
+
fs.writeFileSync(themeFile, themeSource);
|
|
447
|
+
console.log(`Wrote ${relTheme}`);
|
|
448
|
+
}
|
|
383
449
|
|
|
384
450
|
if (fs.existsSync(provider.file) && interactive) {
|
|
385
451
|
const overwrite = await prompts.confirm({
|
|
@@ -394,5 +460,5 @@ export async function runInit(argv, cliVersion) {
|
|
|
394
460
|
|
|
395
461
|
const snippet = layoutSnippet(fw, provider.importHint);
|
|
396
462
|
console.log(`\n── Wrap your root layout ──\n\n${snippet}`);
|
|
397
|
-
console.log("
|
|
463
|
+
console.log("Theme: edit burne-theme.ts, or replace via docs site → Copy config.\n");
|
|
398
464
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PopoverArrow, PopoverBody, PopoverHeader, PopoverHint, PopoverRoot } from './Popover';
|
|
2
2
|
export declare const Popover: typeof PopoverRoot & {
|
|
3
|
-
Trigger: import('react').ForwardRefExoticComponent<import('
|
|
3
|
+
Trigger: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
4
6
|
Content: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
5
7
|
showArrow?: boolean;
|
|
6
8
|
offset?: number;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { PopoverArrowProps, PopoverBodyProps, PopoverHeaderProps, PopoverHintProps, PopoverLabelProps
|
|
2
|
-
export declare const PopoverTrigger: import('react').ForwardRefExoticComponent<
|
|
1
|
+
import { PopoverArrowProps, PopoverBodyProps, PopoverHeaderProps, PopoverHintProps, PopoverLabelProps } from './popoverTypes';
|
|
2
|
+
export declare const PopoverTrigger: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
3
5
|
export declare function PopoverArrow({ className, ...rest }: PopoverArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
4
6
|
export declare namespace PopoverArrow {
|
|
5
7
|
var displayName: string;
|
|
@@ -51,7 +51,10 @@ export type PopoverClassNamesProviderProps = {
|
|
|
51
51
|
children: ReactNode;
|
|
52
52
|
};
|
|
53
53
|
export type UsePopoverRootStateProps = Omit<PopoverRootProps, "classNames">;
|
|
54
|
-
export type PopoverTriggerProps = HTMLAttributes<HTMLButtonElement
|
|
54
|
+
export type PopoverTriggerProps = HTMLAttributes<HTMLButtonElement> & {
|
|
55
|
+
/** Merge props onto the single child (Button, etc.) instead of rendering a `<button>` wrapper. */
|
|
56
|
+
asChild?: boolean;
|
|
57
|
+
};
|
|
55
58
|
export type PopoverArrowProps = HTMLAttributes<HTMLSpanElement>;
|
|
56
59
|
export type PopoverHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
57
60
|
export type PopoverLabelProps = HTMLAttributes<HTMLHeadingElement>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TooltipArrow, TooltipDescription, TooltipIcon, TooltipIndicator, TooltipMessage, TooltipPanel, TooltipRoot, TooltipTitle } from './Tooltip';
|
|
2
2
|
export declare const Tooltip: typeof TooltipRoot & {
|
|
3
|
-
Trigger: import('react').ForwardRefExoticComponent<import('
|
|
3
|
+
Trigger: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
} & import('react').RefAttributes<HTMLSpanElement>>;
|
|
4
6
|
Content: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
5
7
|
showArrow?: boolean;
|
|
6
8
|
offset?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TooltipArrowProps, TooltipDescriptionProps, TooltipIconProps, TooltipIndicatorProps, TooltipMessageProps, TooltipPanelProps, TooltipTitleProps
|
|
1
|
+
import { TooltipArrowProps, TooltipDescriptionProps, TooltipIconProps, TooltipIndicatorProps, TooltipMessageProps, TooltipPanelProps, TooltipTitleProps } from './tooltipTypes';
|
|
2
2
|
export declare function TooltipIndicator({ className, children, showIcon: showIconProp, ...rest }: TooltipIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export declare namespace TooltipIndicator {
|
|
4
4
|
var displayName: string;
|
|
@@ -23,7 +23,9 @@ export declare function TooltipPanel({ variant, surface, size, icon, showIcon, t
|
|
|
23
23
|
export declare namespace TooltipPanel {
|
|
24
24
|
var displayName: string;
|
|
25
25
|
}
|
|
26
|
-
export declare const TooltipTrigger: import('react').ForwardRefExoticComponent<
|
|
26
|
+
export declare const TooltipTrigger: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLSpanElement> & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
} & import('react').RefAttributes<HTMLSpanElement>>;
|
|
27
29
|
export declare function TooltipArrow({ className, ...rest }: TooltipArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
export declare namespace TooltipArrow {
|
|
29
31
|
var displayName: string;
|
|
@@ -29,7 +29,10 @@ export type TooltipRootProps = {
|
|
|
29
29
|
showIcon?: boolean;
|
|
30
30
|
classNames?: TooltipClassNames;
|
|
31
31
|
};
|
|
32
|
-
export type TooltipTriggerProps = HTMLAttributes<HTMLSpanElement
|
|
32
|
+
export type TooltipTriggerProps = HTMLAttributes<HTMLSpanElement> & {
|
|
33
|
+
/** Merge props onto the single child (Button, etc.) instead of wrapping in `<span>`. */
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
};
|
|
33
36
|
export type TooltipContentProps = HTMLAttributes<HTMLDivElement> & {
|
|
34
37
|
showArrow?: boolean;
|
|
35
38
|
offset?: number;
|