burne-ui 1.7.7 → 1.8.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/README.md CHANGED
@@ -44,7 +44,7 @@ import "burne-ui/styles.css";
44
44
  В нём:
45
45
 
46
46
  - **Дизайн-токены** как CSS-переменные: `--color-*`, `--space` / `--space-*`, `--size` / `--size-*`, `--radius`, `--text-scale-*`, и др. Полный перечень имён — экспорт **`designTokenNames`** из `burne-ui`; исходные значения по умолчанию смотрите в репозитории в `src/tokens/styles.css`.
47
- - **Мост Tailwind** (`@theme inline`): цвета в утилитах вида `bg-background`, `text-foreground`, `border-border`, отступы `gap-large`, `p-mid`, радиусы `rounded-base` и т.д.
47
+ - **Мост Tailwind** (`@theme inline` в ките + consumer-файл **`burne-ui/theme-bridge.css`**): цвета `bg-background`, отступы `gap-large` / `px-2xlarge`, радиусы `rounded-base` и т.д. Prebuilt `ui.css` содержит только классы, встретившиеся при сборке кита — мост нужен, чтобы Tailwind приложения догенерировал остальные.
48
48
  - **Кастомные утилиты** (`@utility`): например `border-token`, `border-t-token`, `text-header-1`, `text-mid`, `max-w-component-base`, `min-w-button-base`.
49
49
 
50
50
  Имена переменных **не** с префиксом `brn-`; это обычные `--color-background`, `--space-large` и т.п.
@@ -60,7 +60,7 @@ import "burne-ui/styles.css";
60
60
 
61
61
  `--space-*` и `--spacing-*` — разные имена **намеренно**: у Tailwind namespace отступов — `spacing`.
62
62
 
63
- Шкала spacing: `xsmall` 0.5 · `small` 0.75 · `base` 1 · `mid` 1.5 · `large` 2 · `xlarge` 2.5 · `2xlarge` 3 · `3xlarge` 3.875 (× `--space`).
63
+ Шкала spacing: `xsmall` 0.618 · `small` 0.875 · `base` 1 · `mid` 1.5 · `large` 2 · `xlarge` 2.5 · `2xlarge` 4 · `3xlarge` 6 (× `--space`).
64
64
 
65
65
  ### Типографика
66
66
 
@@ -72,7 +72,7 @@ import "burne-ui/styles.css";
72
72
  | `small` / `text-small` | 0.75 |
73
73
  | `base` / `text-base` | 0.875 |
74
74
  | `mid` / `text-mid` | 1 |
75
- | `large` / `text-large` | 1.25 |
75
+ | `large` / `text-large` | 1.15 |
76
76
  | `xlarge` → `text-header-2` | 1.5 |
77
77
  | `2xlarge` → `text-header-1` | 1.875 |
78
78
  | `3xlarge` → `text-accent-header` | 2.25 |
package/cli/init.js CHANGED
@@ -7,18 +7,15 @@ import * as prompts from "./prompts.js";
7
7
 
8
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
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);
10
+ const THEME_BRIDGE_IMPORT = `@import "burne-ui/theme-bridge.css";`;
11
+
12
+ /** @param {string} css */
13
+ function hasThemeBridge(css) {
14
+ return (
15
+ css.includes("burne-ui/theme-bridge.css") ||
16
+ css.includes("--text-base: var(--text-base-size)")
17
+ );
20
18
  }
21
- `;
22
19
 
23
20
  /**
24
21
  * @returns {Promise<string>}
@@ -113,7 +110,7 @@ export function patchCssFile(cssPath) {
113
110
  let css = fs.readFileSync(cssPath, "utf8");
114
111
  const hadBurne = css.includes("burne-ui/styles.css");
115
112
  const hadTailwind = /@import\s+["']tailwindcss["']/.test(css);
116
- const hadThemeBridge = css.includes("--text-base: var(--text-base-size)");
113
+ const hadThemeBridge = hasThemeBridge(css);
117
114
 
118
115
  if (!hadBurne) {
119
116
  if (hadTailwind) {
@@ -141,13 +138,16 @@ export function patchCssFile(cssPath) {
141
138
  css += `\n@import "burne-ui/styles.css";\n`;
142
139
  }
143
140
 
144
- if (!hadThemeBridge) {
141
+ if (!css.includes("burne-ui/theme-bridge.css")) {
145
142
  const burneImport = css.match(/@import\s+["']burne-ui\/styles\.css["']\s*;/);
146
143
  if (burneImport && burneImport.index != null) {
147
144
  const insertAt = burneImport.index + burneImport[0].length;
148
- css = css.slice(0, insertAt) + "\n" + THEME_BRIDGE_CSS + css.slice(insertAt);
145
+ css =
146
+ css.slice(0, insertAt) +
147
+ `\n${THEME_BRIDGE_IMPORT}\n` +
148
+ css.slice(insertAt);
149
149
  } else {
150
- css += "\n" + THEME_BRIDGE_CSS;
150
+ css += `\n${THEME_BRIDGE_IMPORT}\n`;
151
151
  }
152
152
  }
153
153
 
@@ -425,7 +425,7 @@ export async function runInit(argv, cliVersion) {
425
425
  if (!fs.existsSync(abs)) throw new Error(`CSS not found: ${cssRel}`);
426
426
  const { hadBurne, hadTailwind, hadThemeBridge } = patchCssFile(abs);
427
427
  console.log(hadBurne ? `CSS OK (already linked): ${cssRel}` : `Patched CSS: ${cssRel}`);
428
- if (!hadThemeBridge) console.log("Added @theme bridge (text-base / font-sans).");
428
+ if (!hadThemeBridge) console.log("Added @theme bridge (burne-ui/theme-bridge.css).");
429
429
  if (!hadTailwind) {
430
430
  console.log('Note: no @import "tailwindcss" — add Tailwind v4 for className utilities.');
431
431
  }
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Consumer Tailwind v4 theme bridge.
3
+ *
4
+ * Prebuilt `burne-ui/styles.css` (ui.css) only emits utilities that were used when
5
+ * building the kit. Apps that run their own `@import "tailwindcss"` + `@source`
6
+ * must re-bind kit tokens here so classes like `px-2xlarge`, `bg-primary`,
7
+ * `rounded-base` generate against runtime CSS variables.
8
+ *
9
+ * Use `@theme inline` so identity mappings (`--color-background: var(--color-background)`)
10
+ * do not emit circular `:root` custom properties.
11
+ *
12
+ * Import after `burne-ui/styles.css`:
13
+ * @import "burne-ui/theme-bridge.css";
14
+ */
15
+ @theme inline {
16
+ --font-sans: var(--font-family-sans);
17
+ --font-mono: var(--font-family-mono);
18
+
19
+ --color-background: var(--color-background);
20
+ --color-foreground: var(--color-foreground);
21
+ --color-muted: var(--color-muted);
22
+ --color-muted-foreground: var(--color-muted-foreground);
23
+ --color-surface: var(--color-surface);
24
+ --color-border: var(--color-border);
25
+
26
+ --color-primary: var(--color-primary);
27
+ --color-primary-foreground: var(--color-primary-foreground);
28
+ --color-primary-hover: var(--color-primary-hover);
29
+
30
+ --color-default-hover: var(--color-default-hover);
31
+ --color-transparent-hover: var(--color-transparent-hover);
32
+
33
+ --color-indicator: var(--color-indicator);
34
+ --color-indicator-foreground: var(--color-indicator-foreground);
35
+
36
+ --color-focus-ring: var(--color-focus-ring);
37
+ --color-focus-ring-danger: var(--color-focus-ring-danger);
38
+ --color-focus-ring-success: var(--color-focus-ring-success);
39
+ --color-focus-ring-info: var(--color-focus-ring-info);
40
+ --color-focus-ring-warning: var(--color-focus-ring-warning);
41
+ --focus-ring-width: var(--focus-ring-width);
42
+ --focus-ring-offset: var(--focus-ring-offset);
43
+
44
+ --z-index-dialog: var(--z-dialog);
45
+ --z-index-dropdown: var(--z-dropdown);
46
+ --z-index-dropdown-sub: var(--z-dropdown-sub);
47
+ --z-index-popover: var(--z-popover);
48
+ --z-index-toast: var(--z-toast);
49
+ --z-index-tooltip: var(--z-tooltip);
50
+
51
+ --color-primary-tint: var(--color-primary-tint);
52
+ --color-primary-tint-strong: var(--color-primary-tint-strong);
53
+
54
+ --color-secondary: var(--color-secondary);
55
+ --color-secondary-foreground: var(--color-secondary-foreground);
56
+ --color-secondary-hover: var(--color-secondary-hover);
57
+ --color-tertiary: var(--color-tertiary);
58
+ --color-tertiary-foreground: var(--color-tertiary-foreground);
59
+ --color-tertiary-hover: var(--color-tertiary-hover);
60
+
61
+ --color-danger: var(--color-danger);
62
+ --color-danger-fill-hover: var(--color-danger-fill-hover);
63
+ --color-danger-foreground: var(--color-danger-foreground);
64
+ --color-success: var(--color-success);
65
+ --color-success-foreground: var(--color-success-foreground);
66
+ --color-success-fill-hover: var(--color-success-fill-hover);
67
+ --color-info: var(--color-info);
68
+ --color-info-foreground: var(--color-info-foreground);
69
+ --color-info-fill-hover: var(--color-info-fill-hover);
70
+ --color-warning: var(--color-warning);
71
+ --color-warning-foreground: var(--color-warning-foreground);
72
+ --color-warning-fill-hover: var(--color-warning-fill-hover);
73
+ --color-surface-tint-danger: var(--color-surface-tint-danger);
74
+ --color-surface-tint-success: var(--color-surface-tint-success);
75
+ --color-surface-tint-info: var(--color-surface-tint-info);
76
+ --color-surface-tint-warning: var(--color-surface-tint-warning);
77
+ --color-surface-tint-danger-hover: var(--color-surface-tint-danger-hover);
78
+ --color-surface-tint-success-hover: var(--color-surface-tint-success-hover);
79
+ --color-surface-tint-info-hover: var(--color-surface-tint-info-hover);
80
+ --color-surface-tint-warning-hover: var(--color-surface-tint-warning-hover);
81
+
82
+ --spacing-xsmall: var(--space-xsmall);
83
+ --spacing-small: var(--space-small);
84
+ --spacing-base: var(--space-base);
85
+ --spacing-mid: var(--space-mid);
86
+ --spacing-large: var(--space-large);
87
+ --spacing-xlarge: var(--space-xlarge);
88
+ --spacing-2xlarge: var(--space-2xlarge);
89
+ --spacing-3xlarge: var(--space-3xlarge);
90
+
91
+ --radius-xsmall: var(--radius-xsmall);
92
+ --radius-small: var(--radius-small);
93
+ --radius-base: var(--radius-base);
94
+ --radius-mid: var(--radius-mid);
95
+ --radius-large: var(--radius-large);
96
+
97
+ --shadow-token-base: var(--shadow-base);
98
+ --shadow-token-mid: var(--shadow-mid);
99
+ --shadow-token-large: var(--shadow-large);
100
+
101
+ --text-base: var(--text-base-size);
102
+ --text-base--line-height: var(--text-base-line-height);
103
+ --text-base--font-weight: var(--text-base-weight);
104
+
105
+ --border-width-DEFAULT: var(--border-width, 1px);
106
+ --border-width-1: var(--border-width, 1px);
107
+ }
@@ -52,7 +52,8 @@ export type AccordionBodyProps = HTMLAttributes<HTMLDivElement>;
52
52
  export type AccordionContextValue = {
53
53
  value: string | null;
54
54
  setValue: (value: string | null) => void;
55
- getItemId: (explicit?: string) => string;
55
+ /** Stable auto-id for an Item without explicit `value` (call once per Item mount). */
56
+ allocateAutoItemId: () => string;
56
57
  size: ExpandableSize;
57
58
  };
58
59
  export type AccordionClassNamesProviderProps = {
@@ -16,4 +16,5 @@ export declare function useButtonAnimations({ variant, asyncState, isControlled,
16
16
  handleKeyDown: (e: import('react').KeyboardEvent<HTMLButtonElement>) => void;
17
17
  createAsyncClickHandler: (onClick: ((e: MouseEvent<HTMLButtonElement>) => void) | undefined, onAsyncClick: ((e: MouseEvent<HTMLButtonElement>) => Promise<boolean>) | undefined, isControlledArg: boolean, internalAsync: ButtonAsyncState, setUncontrolledAsync: (next: ButtonAsyncState) => void, scheduleAsyncIdleReset: () => void) => (e: MouseEvent<HTMLButtonElement>) => void;
18
18
  asyncInFlight: import('react').RefObject<boolean>;
19
+ asyncMotionReady: boolean;
19
20
  };
@@ -24,8 +24,12 @@ export declare const BUTTON_LABEL_LAYER_CLASS = "col-start-1 row-start-1 inline-
24
24
  export declare const BUTTON_LEFT_ICON_SLOT_CLASS = "inline-flex shrink-0 items-center justify-center";
25
25
  export declare const BUTTON_LABEL_TEXT_CLASS = "min-w-0 shrink";
26
26
  export declare const BUTTON_ASYNC_GRID_LAYER_CLASS = "col-start-1 row-start-1 flex items-center justify-center";
27
- /** SSR: inactive layers hidden in `styles.css` via `[data-button-async-layer][aria-hidden="true"]` */
28
- export declare const BUTTON_ASYNC_LAYER_DATA_ATTR = "data-button-async-layer";
27
+ /**
28
+ * First paint / pre-motion: hide inactive async layers via Tailwind.
29
+ * After `asyncMotionReady`, GSAP owns visibility (inline autoAlpha) — do not keep this class
30
+ * on inactive layers or crossfade will snap.
31
+ */
32
+ export declare const BUTTON_ASYNC_LAYER_INACTIVE_CLASS = "invisible opacity-0 pointer-events-none";
29
33
  export declare const BUTTON_SUCCESS_LAYER_CLASS = "text-success";
30
34
  export declare const BUTTON_ERROR_LAYER_CLASS = "text-danger";
31
35
  export declare const BUTTON_SPINNER_MOTION_CLASS = "animate-spin motion-reduce:animate-none";
@@ -49,16 +53,18 @@ export declare function buttonContentClass({ groupSegment, slotClass, className,
49
53
  slotClass?: string;
50
54
  className?: string;
51
55
  }): string;
52
- export declare function buttonLabelClass({ slotClass, className, layoutClass, }: {
56
+ export declare function buttonLabelClass({ slotClass, className, layoutClass, cssHidden, }: {
53
57
  slotClass?: string;
54
58
  className?: string;
55
59
  layoutClass?: string;
60
+ /** Pre-motion hide when label is not the active async layer. */
61
+ cssHidden?: boolean;
56
62
  }): string;
57
63
  export declare function buttonIconClass(size: ComponentSize, slotClass?: string): string;
58
64
  export declare function buttonTextClass(slotClass?: string, className?: string): string;
59
- export declare function buttonLoaderLayerClass(loaderTextClass: string, slotClass?: string): string;
60
- export declare function buttonSuccessLayerClass(slotClass?: string): string;
61
- export declare function buttonErrorLayerClass(slotClass?: string): string;
65
+ export declare function buttonLoaderLayerClass(loaderTextClass: string, slotClass?: string, cssHidden?: boolean): string;
66
+ export declare function buttonSuccessLayerClass(slotClass?: string, cssHidden?: boolean): string;
67
+ export declare function buttonErrorLayerClass(slotClass?: string, cssHidden?: boolean): string;
62
68
  export declare function buttonIconSvgClass(): string;
63
69
  export declare function buttonRippleTone(variant: ButtonVariant, status?: ButtonStatus): string;
64
70
  /**
@@ -28,6 +28,11 @@ export type ButtonContextValue = {
28
28
  variant: ButtonVariant;
29
29
  status: ButtonStatus;
30
30
  asyncState: ButtonAsyncState;
31
+ /**
32
+ * After first GSAP sync, motion owns layer visibility (inline autoAlpha).
33
+ * Before that, parts hide inactive layers via Tailwind for SSR / first paint.
34
+ */
35
+ asyncMotionReady: boolean;
31
36
  groupSegment: ButtonGroupSegment | undefined;
32
37
  loaderTextClass: string;
33
38
  bindLabelRef: (node: HTMLSpanElement | null) => void;
@@ -1,10 +1,10 @@
1
1
  import { TextVariant } from '../Text';
2
2
  import { LinkSize } from './linkTypes';
3
- export declare const LINK_ANCHOR_CLASS = "group/link inline-flex max-w-full min-w-0 items-center gap-xsmall rounded-mid no-underline outline-none w-fit text-primary focus-ring";
3
+ export declare const LINK_ANCHOR_CLASS = "group/link inline-flex max-w-full min-w-0 items-center gap-xsmall rounded-mid no-underline outline-none w-fit text-foreground focus-ring";
4
4
  export declare const LINK_TEXT_BASE_CLASS = "min-w-0 truncate font-w-mid";
5
5
  export declare const LINK_TEXT_UNDERLINE_CLASS = "underline decoration-current/70 underline-offset-[0.2em]";
6
- export declare const LINK_ICON_MUTED_CLASS = "text-muted group-hover/link:text-primary group-focus-visible/link:text-primary";
7
- export declare const LINK_ICON_PRIMARY_CLASS = "text-primary";
6
+ export declare const LINK_ICON_MUTED_CLASS = "text-muted group-hover/link:text-foreground group-focus-visible/link:text-foreground";
7
+ export declare const LINK_ICON_FOREGROUND_CLASS = "text-foreground";
8
8
  export declare const LINK_DEFAULT_ICON_ROTATE_CLASS = "rotate-[-45deg]";
9
9
  export declare const LINK_TEXT_VARIANT: Record<LinkSize, TextVariant>;
10
10
  export declare const LINK_ICON_SIZE_CLASS: Record<LinkSize, string>;
@@ -1,7 +1,7 @@
1
1
  export type SelectionIndicatorSize = "xsmall" | "small" | "base" | "mid" | "large";
2
2
  export type SelectionIndicatorVariant = "default" | "secondary" | "outline" | "gloss";
3
3
  export declare const SELECTION_INDICATOR_SIZE_CLASS: Record<SelectionIndicatorSize, string>;
4
- /** Corner radius from `--selection-indicator-radius-*` (`--radius-*` × 0.75). */
4
+ /** Corner radius from `--selection-indicator-radius-*` (`--radius-*` × 0.618). */
5
5
  export declare const SELECTION_INDICATOR_RADIUS_CLASS: Record<SelectionIndicatorSize, string>;
6
6
  /** Mark icon box — `--icon-size-*` × 0.75 so marks fit inside the indicator ring. */
7
7
  export declare const SELECTION_INDICATOR_ICON_CLASS: Record<SelectionIndicatorSize, string>;