@kbach/react 0.6.51 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -418
- package/dist/chunk-AD3G6RHY.mjs +32 -0
- package/dist/chunk-FOQWQDF4.mjs +446 -0
- package/dist/chunk-ROZXCQSM.mjs +100 -0
- package/dist/index.d.mts +117 -0
- package/dist/index.d.ts +84 -295
- package/dist/index.js +650 -1101
- package/dist/index.mjs +143 -550
- package/dist/jsx-dev-runtime.d.mts +22 -0
- package/dist/jsx-dev-runtime.d.ts +6 -5
- package/dist/jsx-dev-runtime.js +485 -695
- package/dist/jsx-dev-runtime.mjs +3 -3
- package/dist/jsx-runtime.d.mts +22 -0
- package/dist/jsx-runtime.d.ts +11 -6
- package/dist/jsx-runtime.js +487 -706
- package/dist/jsx-runtime.mjs +4 -9
- package/dist/theme-BKAb78KP.d.mts +20 -0
- package/dist/theme-BKAb78KP.d.ts +20 -0
- package/dist/vite-plugin.d.mts +20 -147
- package/dist/vite-plugin.d.ts +20 -147
- package/dist/vite-plugin.js +1411 -3721
- package/dist/vite-plugin.mjs +994 -3713
- package/package.json +20 -46
- package/KBACH.md +0 -1044
- package/dist/chunk-KRRGLJLA.mjs +0 -4187
- package/dist/chunk-LIUJPOTS.mjs +0 -208
- package/dist/core/index.d.ts +0 -1346
- package/dist/core/index.js +0 -3712
- package/dist/native.d.ts +0 -314
- package/dist/native.js +0 -99
- package/dist/web-substitute-CfpYFnE7.d.ts +0 -22
- package/jsx-dev-runtime.js +0 -3
- package/jsx-runtime.js +0 -3
- package/kbach-react.md +0 -889
- package/scripts/postinstall.js +0 -28
- package/src/native/babel/index.js +0 -30
- package/src/native/babel-plugin/index.js +0 -605
- package/src/native/babel-plugin/index.test.ts +0 -86
- package/types.d.ts +0 -1
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import {
|
|
3
2
|
Fragment,
|
|
4
|
-
_invalidateDefaultFontCache,
|
|
5
3
|
jsx,
|
|
6
4
|
jsxs
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
} from "./chunk-KRRGLJLA.mjs";
|
|
5
|
+
} from "./chunk-AD3G6RHY.mjs";
|
|
6
|
+
import "./chunk-ROZXCQSM.mjs";
|
|
7
|
+
import "./chunk-FOQWQDF4.mjs";
|
|
11
8
|
export {
|
|
12
9
|
Fragment,
|
|
13
|
-
_invalidateDefaultFontCache,
|
|
14
10
|
jsx,
|
|
15
|
-
jsxs
|
|
16
|
-
registerWebElement
|
|
11
|
+
jsxs
|
|
17
12
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A plain hex color, or a mode-aware pair auto-expanded into a light/dark class pair by the Rust engine. */
|
|
2
|
+
type ColorEntry = string | {
|
|
3
|
+
light: string;
|
|
4
|
+
dark: string;
|
|
5
|
+
};
|
|
6
|
+
type DarkModeStrategy = 'attribute' | 'class' | 'media';
|
|
7
|
+
interface ThemeConfig {
|
|
8
|
+
/** e.g. "blue-6" -> "#2563eb", or "surface" -> { light, dark } */
|
|
9
|
+
colors: Record<string, ColorEntry>;
|
|
10
|
+
/** e.g. "4" -> 16 (px) */
|
|
11
|
+
spacing: Record<string, number>;
|
|
12
|
+
/** e.g. "sm" -> 640 (min-width px) */
|
|
13
|
+
screens: Record<string, number>;
|
|
14
|
+
darkMode: DarkModeStrategy;
|
|
15
|
+
}
|
|
16
|
+
declare const defaultTheme: ThemeConfig;
|
|
17
|
+
declare function setTheme(theme: ThemeConfig): void;
|
|
18
|
+
declare function getTheme(): ThemeConfig;
|
|
19
|
+
|
|
20
|
+
export { type ThemeConfig as T, defaultTheme as d, getTheme as g, setTheme as s };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A plain hex color, or a mode-aware pair auto-expanded into a light/dark class pair by the Rust engine. */
|
|
2
|
+
type ColorEntry = string | {
|
|
3
|
+
light: string;
|
|
4
|
+
dark: string;
|
|
5
|
+
};
|
|
6
|
+
type DarkModeStrategy = 'attribute' | 'class' | 'media';
|
|
7
|
+
interface ThemeConfig {
|
|
8
|
+
/** e.g. "blue-6" -> "#2563eb", or "surface" -> { light, dark } */
|
|
9
|
+
colors: Record<string, ColorEntry>;
|
|
10
|
+
/** e.g. "4" -> 16 (px) */
|
|
11
|
+
spacing: Record<string, number>;
|
|
12
|
+
/** e.g. "sm" -> 640 (min-width px) */
|
|
13
|
+
screens: Record<string, number>;
|
|
14
|
+
darkMode: DarkModeStrategy;
|
|
15
|
+
}
|
|
16
|
+
declare const defaultTheme: ThemeConfig;
|
|
17
|
+
declare function setTheme(theme: ThemeConfig): void;
|
|
18
|
+
declare function getTheme(): ThemeConfig;
|
|
19
|
+
|
|
20
|
+
export { type ThemeConfig as T, defaultTheme as d, getTheme as g, setTheme as s };
|
package/dist/vite-plugin.d.mts
CHANGED
|
@@ -1,155 +1,28 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { T as ThemeConfig } from './theme-BKAb78KP.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* 2. Done — parser, resolver, CSS generator, and JSX runtime all derive
|
|
9
|
-
* their behavior from this data automatically.
|
|
10
|
-
*
|
|
11
|
-
* Plugin authors can register custom modifiers via registerModifier().
|
|
12
|
-
*/
|
|
13
|
-
interface ModifierDef {
|
|
14
|
-
/**
|
|
15
|
-
* Cascade priority for CSS rule ORDER — NOT specificity. Two rules that
|
|
16
|
-
* differ only by modifier (e.g. `.hover\:bg-blue-6:hover` and
|
|
17
|
-
* `.focus\:bg-red-6:focus`) have equal CSS specificity, so when both
|
|
18
|
-
* conditions are true at once (hovering AND focused), the winner is
|
|
19
|
-
* whichever rule appears LATER in the stylesheet — CSS's normal same-
|
|
20
|
-
* specificity tiebreak. Without a fixed priority, "later" would depend on
|
|
21
|
-
* encounter order (whichever class the app happens to render/scan first),
|
|
22
|
-
* making the winner effectively random and inconsistent across reloads/
|
|
23
|
-
* builds. `order` fixes that: rules are emitted/injected sorted by this
|
|
24
|
-
* value (ascending — higher wins ties), regardless of source order, so
|
|
25
|
-
* e.g. `disabled:` always beats `hover:` on the same element no matter
|
|
26
|
-
* which one was written first in the className or rendered first in the
|
|
27
|
-
* app. Omit for the default (0). See getModifierOrder() below.
|
|
28
|
-
*/
|
|
29
|
-
order?: number;
|
|
30
|
-
/** CSS pseudo-class or pseudo-element appended to the selector (e.g. ':hover', '::before') */
|
|
31
|
-
pseudo?: string;
|
|
32
|
-
/** Ancestor selector prefix INCLUDING trailing space (e.g. '.group:hover ', '.peer:focus ~ ') */
|
|
33
|
-
ancestorSelector?: string;
|
|
34
|
-
/** Directionality attribute selector prefix INCLUDING trailing space (e.g. '[dir="rtl"] ') */
|
|
35
|
-
dirSelector?: string;
|
|
36
|
-
/** @media query body WITHOUT the '@media ' prefix (e.g. 'print', '(orientation: landscape)') */
|
|
37
|
-
mediaQuery?: string;
|
|
38
|
-
/** Dark/light mode scheme — triggers the configured darkMode strategy in CSS output */
|
|
39
|
-
darkScheme?: 'dark' | 'light';
|
|
40
|
-
/** True for responsive modifiers — wraps in @media (min-width: theme.screens[name]) */
|
|
41
|
-
isResponsive?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Forces !important on all declarations in the generated CSS rule.
|
|
44
|
-
* Applied automatically for structural / ancestor / media modifiers that must
|
|
45
|
-
* win over base inline styles.
|
|
46
|
-
*/
|
|
47
|
-
forcesImportant?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* How the JSX runtime routes this modifier:
|
|
50
|
-
* 'interactive' — managed by InteractiveWrapper (hover, focus, pressed, …)
|
|
51
|
-
* 'mode' — managed by DarkWrapper (dark, light, not-dark, …)
|
|
52
|
-
* 'responsive' — managed by DarkWrapper (sm, md, lg, xl, 2xl)
|
|
53
|
-
* 'css-only' — CSS injection only; matchModifier always returns false
|
|
54
|
-
*/
|
|
55
|
-
jsBehavior: 'interactive' | 'mode' | 'responsive' | 'css-only';
|
|
56
|
-
/**
|
|
57
|
-
* Evaluates whether this modifier's condition is met at runtime.
|
|
58
|
-
* Omit for 'css-only' modifiers — they never apply as inline styles.
|
|
59
|
-
*/
|
|
60
|
-
jsMatch?: (isDark: boolean, state: Record<string, boolean | undefined>, breakpoints: Set<string>) => boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface StyleValue {
|
|
64
|
-
[key: string]: string | number | undefined | null | StyleValue | StyleValue[];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A color value is either a plain string (hex/rgb/alias-to-another-color-name)
|
|
68
|
-
* or a mode-aware pair — resolved to `light` or `dark` per the active theme
|
|
69
|
-
* mode wherever it's actually used (className resolution, useColors()).
|
|
70
|
-
*/
|
|
71
|
-
type ColorValue = string | {
|
|
72
|
-
light: string;
|
|
73
|
-
dark: string;
|
|
74
|
-
};
|
|
75
|
-
type ColorShades = Record<string, ColorValue>;
|
|
76
|
-
type ThemeColors = Record<string, ColorValue | ColorShades>;
|
|
77
|
-
type ThemeSpacing = Record<string, number | string>;
|
|
78
|
-
interface ThemeConfig {
|
|
79
|
-
colors: ThemeColors;
|
|
80
|
-
spacing: ThemeSpacing;
|
|
81
|
-
fontSize: Record<string, number | string>;
|
|
82
|
-
fontFamily: Record<string, string | string[]>;
|
|
83
|
-
fontWeight: Record<string, string | number>;
|
|
84
|
-
borderRadius: Record<string, number | string>;
|
|
85
|
-
borderWidth: Record<string, number>;
|
|
86
|
-
opacity: Record<string, number>;
|
|
87
|
-
lineHeight: Record<string, number | string>;
|
|
88
|
-
letterSpacing: Record<string, number | string>;
|
|
89
|
-
zIndex: Record<string, number | string>;
|
|
90
|
-
flex: Record<string, number | string>;
|
|
91
|
-
shadow: Record<string, StyleValue>;
|
|
92
|
-
screens: Record<string, string | number>;
|
|
93
|
-
/**
|
|
94
|
-
* Custom @keyframes, web only. Each key is a keyframe name, its value maps
|
|
95
|
-
* percentage/from/to selectors to a plain CSS declaration object (camelCase
|
|
96
|
-
* properties, same shape as an inline style object):
|
|
97
|
-
* keyframes: { wiggle: { '0%, 100%': { transform: 'rotate(-3deg)' }, '50%': { transform: 'rotate(3deg)' } } }
|
|
98
|
-
* Referenced from `animation` below, or directly via animate-[wiggle_1s_ease-in-out].
|
|
99
|
-
*/
|
|
100
|
-
keyframes: Record<string, Record<string, StyleValue>>;
|
|
4
|
+
interface KbachPluginOptions {
|
|
5
|
+
/** Defaults to the same defaultTheme the runtime uses — pass your own to keep both in sync. */
|
|
6
|
+
theme?: ThemeConfig;
|
|
7
|
+
/** Directories to scan for class strings (relative to Vite root). */
|
|
8
|
+
include?: string[];
|
|
101
9
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* injected alongside the animation — a name with no matching keyframes entry
|
|
107
|
-
* still sets the `animation` CSS property, it just won't animate anything.
|
|
10
|
+
* Class names to always include in the generated kbach.css, even if no
|
|
11
|
+
* scan finds them literally in your source — for dynamically-built class
|
|
12
|
+
* strings static extraction can't see (e.g. `` `bg-${color}-6` ``). Same
|
|
13
|
+
* purpose as Tailwind's `safelist`.
|
|
108
14
|
*/
|
|
109
|
-
|
|
110
|
-
[key: string]: unknown;
|
|
15
|
+
safelist?: string[];
|
|
111
16
|
}
|
|
112
17
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
18
|
+
* Build-time static CSS generation for Vite — scans source files for
|
|
19
|
+
* Kbach class strings, resolves them through the same Rust engine the
|
|
20
|
+
* runtime uses (via the Node-target WASM build, see wasmNode.ts), and
|
|
21
|
+
* writes a real kbach.css. Simplified vs old-kbach's version: expects
|
|
22
|
+
* `src/kbach.css` to exist at a fixed conventional path (create it with
|
|
23
|
+
* `/* kbach:start *\/` / `/* kbach:end *\/` markers) rather than scanning
|
|
24
|
+
* the whole project for a file named kbach.css.
|
|
116
25
|
*/
|
|
117
|
-
|
|
118
|
-
interface PluginAPI {
|
|
119
|
-
addUtility(name: string, styles: StyleValue): void;
|
|
120
|
-
/**
|
|
121
|
-
* Register a custom variant.
|
|
122
|
-
*
|
|
123
|
-
* Pass a CSS selector string for simple cases — it is automatically
|
|
124
|
-
* converted into a ModifierDef that generates correct CSS rules:
|
|
125
|
-
* addVariant('hocus', ':hover, :focus') // pseudo
|
|
126
|
-
* addVariant('supports-grid', '@media (display: grid)') // media
|
|
127
|
-
* addVariant('dark-green', '.dark-green') // ancestor selector
|
|
128
|
-
*
|
|
129
|
-
* Pass a full ModifierDef object for advanced control (e.g. JS-trackable
|
|
130
|
-
* interactive variants with custom jsMatch logic).
|
|
131
|
-
*/
|
|
132
|
-
addVariant(name: string, selectorOrDef: string | ModifierDef): void;
|
|
133
|
-
theme(path: string, defaultValue?: unknown): unknown;
|
|
134
|
-
e(className: string): string;
|
|
135
|
-
}
|
|
136
|
-
interface FrameworkConfig {
|
|
137
|
-
darkMode?: DarkMode;
|
|
138
|
-
theme?: Partial<ThemeConfig>;
|
|
139
|
-
/** Additive theme extension — accepts either `extend.theme.X` or `extend.X` directly. */
|
|
140
|
-
extend?: {
|
|
141
|
-
theme?: Partial<ThemeConfig>;
|
|
142
|
-
} & Partial<ThemeConfig>;
|
|
143
|
-
plugins?: Array<(api: PluginAPI) => void>;
|
|
144
|
-
content?: string[];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function formatKbachCSS(tokenCSS: Map<string, string>, theme: ThemeConfig, responsiveRe: RegExp): string;
|
|
148
|
-
interface KbachPluginOptions {
|
|
149
|
-
framework?: FrameworkConfig;
|
|
150
|
-
/** Directories to scan for class strings (relative to Vite root). Defaults to common source dirs. */
|
|
151
|
-
include?: string[];
|
|
152
|
-
}
|
|
153
|
-
declare function kbach(userConfigOrOptions?: FrameworkConfig | KbachPluginOptions): Plugin;
|
|
26
|
+
declare function kbach(options?: KbachPluginOptions): Plugin;
|
|
154
27
|
|
|
155
|
-
export { type KbachPluginOptions,
|
|
28
|
+
export { type KbachPluginOptions, kbach };
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,155 +1,28 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { T as ThemeConfig } from './theme-BKAb78KP.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* 2. Done — parser, resolver, CSS generator, and JSX runtime all derive
|
|
9
|
-
* their behavior from this data automatically.
|
|
10
|
-
*
|
|
11
|
-
* Plugin authors can register custom modifiers via registerModifier().
|
|
12
|
-
*/
|
|
13
|
-
interface ModifierDef {
|
|
14
|
-
/**
|
|
15
|
-
* Cascade priority for CSS rule ORDER — NOT specificity. Two rules that
|
|
16
|
-
* differ only by modifier (e.g. `.hover\:bg-blue-6:hover` and
|
|
17
|
-
* `.focus\:bg-red-6:focus`) have equal CSS specificity, so when both
|
|
18
|
-
* conditions are true at once (hovering AND focused), the winner is
|
|
19
|
-
* whichever rule appears LATER in the stylesheet — CSS's normal same-
|
|
20
|
-
* specificity tiebreak. Without a fixed priority, "later" would depend on
|
|
21
|
-
* encounter order (whichever class the app happens to render/scan first),
|
|
22
|
-
* making the winner effectively random and inconsistent across reloads/
|
|
23
|
-
* builds. `order` fixes that: rules are emitted/injected sorted by this
|
|
24
|
-
* value (ascending — higher wins ties), regardless of source order, so
|
|
25
|
-
* e.g. `disabled:` always beats `hover:` on the same element no matter
|
|
26
|
-
* which one was written first in the className or rendered first in the
|
|
27
|
-
* app. Omit for the default (0). See getModifierOrder() below.
|
|
28
|
-
*/
|
|
29
|
-
order?: number;
|
|
30
|
-
/** CSS pseudo-class or pseudo-element appended to the selector (e.g. ':hover', '::before') */
|
|
31
|
-
pseudo?: string;
|
|
32
|
-
/** Ancestor selector prefix INCLUDING trailing space (e.g. '.group:hover ', '.peer:focus ~ ') */
|
|
33
|
-
ancestorSelector?: string;
|
|
34
|
-
/** Directionality attribute selector prefix INCLUDING trailing space (e.g. '[dir="rtl"] ') */
|
|
35
|
-
dirSelector?: string;
|
|
36
|
-
/** @media query body WITHOUT the '@media ' prefix (e.g. 'print', '(orientation: landscape)') */
|
|
37
|
-
mediaQuery?: string;
|
|
38
|
-
/** Dark/light mode scheme — triggers the configured darkMode strategy in CSS output */
|
|
39
|
-
darkScheme?: 'dark' | 'light';
|
|
40
|
-
/** True for responsive modifiers — wraps in @media (min-width: theme.screens[name]) */
|
|
41
|
-
isResponsive?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Forces !important on all declarations in the generated CSS rule.
|
|
44
|
-
* Applied automatically for structural / ancestor / media modifiers that must
|
|
45
|
-
* win over base inline styles.
|
|
46
|
-
*/
|
|
47
|
-
forcesImportant?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* How the JSX runtime routes this modifier:
|
|
50
|
-
* 'interactive' — managed by InteractiveWrapper (hover, focus, pressed, …)
|
|
51
|
-
* 'mode' — managed by DarkWrapper (dark, light, not-dark, …)
|
|
52
|
-
* 'responsive' — managed by DarkWrapper (sm, md, lg, xl, 2xl)
|
|
53
|
-
* 'css-only' — CSS injection only; matchModifier always returns false
|
|
54
|
-
*/
|
|
55
|
-
jsBehavior: 'interactive' | 'mode' | 'responsive' | 'css-only';
|
|
56
|
-
/**
|
|
57
|
-
* Evaluates whether this modifier's condition is met at runtime.
|
|
58
|
-
* Omit for 'css-only' modifiers — they never apply as inline styles.
|
|
59
|
-
*/
|
|
60
|
-
jsMatch?: (isDark: boolean, state: Record<string, boolean | undefined>, breakpoints: Set<string>) => boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface StyleValue {
|
|
64
|
-
[key: string]: string | number | undefined | null | StyleValue | StyleValue[];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A color value is either a plain string (hex/rgb/alias-to-another-color-name)
|
|
68
|
-
* or a mode-aware pair — resolved to `light` or `dark` per the active theme
|
|
69
|
-
* mode wherever it's actually used (className resolution, useColors()).
|
|
70
|
-
*/
|
|
71
|
-
type ColorValue = string | {
|
|
72
|
-
light: string;
|
|
73
|
-
dark: string;
|
|
74
|
-
};
|
|
75
|
-
type ColorShades = Record<string, ColorValue>;
|
|
76
|
-
type ThemeColors = Record<string, ColorValue | ColorShades>;
|
|
77
|
-
type ThemeSpacing = Record<string, number | string>;
|
|
78
|
-
interface ThemeConfig {
|
|
79
|
-
colors: ThemeColors;
|
|
80
|
-
spacing: ThemeSpacing;
|
|
81
|
-
fontSize: Record<string, number | string>;
|
|
82
|
-
fontFamily: Record<string, string | string[]>;
|
|
83
|
-
fontWeight: Record<string, string | number>;
|
|
84
|
-
borderRadius: Record<string, number | string>;
|
|
85
|
-
borderWidth: Record<string, number>;
|
|
86
|
-
opacity: Record<string, number>;
|
|
87
|
-
lineHeight: Record<string, number | string>;
|
|
88
|
-
letterSpacing: Record<string, number | string>;
|
|
89
|
-
zIndex: Record<string, number | string>;
|
|
90
|
-
flex: Record<string, number | string>;
|
|
91
|
-
shadow: Record<string, StyleValue>;
|
|
92
|
-
screens: Record<string, string | number>;
|
|
93
|
-
/**
|
|
94
|
-
* Custom @keyframes, web only. Each key is a keyframe name, its value maps
|
|
95
|
-
* percentage/from/to selectors to a plain CSS declaration object (camelCase
|
|
96
|
-
* properties, same shape as an inline style object):
|
|
97
|
-
* keyframes: { wiggle: { '0%, 100%': { transform: 'rotate(-3deg)' }, '50%': { transform: 'rotate(3deg)' } } }
|
|
98
|
-
* Referenced from `animation` below, or directly via animate-[wiggle_1s_ease-in-out].
|
|
99
|
-
*/
|
|
100
|
-
keyframes: Record<string, Record<string, StyleValue>>;
|
|
4
|
+
interface KbachPluginOptions {
|
|
5
|
+
/** Defaults to the same defaultTheme the runtime uses — pass your own to keep both in sync. */
|
|
6
|
+
theme?: ThemeConfig;
|
|
7
|
+
/** Directories to scan for class strings (relative to Vite root). */
|
|
8
|
+
include?: string[];
|
|
101
9
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* injected alongside the animation — a name with no matching keyframes entry
|
|
107
|
-
* still sets the `animation` CSS property, it just won't animate anything.
|
|
10
|
+
* Class names to always include in the generated kbach.css, even if no
|
|
11
|
+
* scan finds them literally in your source — for dynamically-built class
|
|
12
|
+
* strings static extraction can't see (e.g. `` `bg-${color}-6` ``). Same
|
|
13
|
+
* purpose as Tailwind's `safelist`.
|
|
108
14
|
*/
|
|
109
|
-
|
|
110
|
-
[key: string]: unknown;
|
|
15
|
+
safelist?: string[];
|
|
111
16
|
}
|
|
112
17
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
18
|
+
* Build-time static CSS generation for Vite — scans source files for
|
|
19
|
+
* Kbach class strings, resolves them through the same Rust engine the
|
|
20
|
+
* runtime uses (via the Node-target WASM build, see wasmNode.ts), and
|
|
21
|
+
* writes a real kbach.css. Simplified vs old-kbach's version: expects
|
|
22
|
+
* `src/kbach.css` to exist at a fixed conventional path (create it with
|
|
23
|
+
* `/* kbach:start *\/` / `/* kbach:end *\/` markers) rather than scanning
|
|
24
|
+
* the whole project for a file named kbach.css.
|
|
116
25
|
*/
|
|
117
|
-
|
|
118
|
-
interface PluginAPI {
|
|
119
|
-
addUtility(name: string, styles: StyleValue): void;
|
|
120
|
-
/**
|
|
121
|
-
* Register a custom variant.
|
|
122
|
-
*
|
|
123
|
-
* Pass a CSS selector string for simple cases — it is automatically
|
|
124
|
-
* converted into a ModifierDef that generates correct CSS rules:
|
|
125
|
-
* addVariant('hocus', ':hover, :focus') // pseudo
|
|
126
|
-
* addVariant('supports-grid', '@media (display: grid)') // media
|
|
127
|
-
* addVariant('dark-green', '.dark-green') // ancestor selector
|
|
128
|
-
*
|
|
129
|
-
* Pass a full ModifierDef object for advanced control (e.g. JS-trackable
|
|
130
|
-
* interactive variants with custom jsMatch logic).
|
|
131
|
-
*/
|
|
132
|
-
addVariant(name: string, selectorOrDef: string | ModifierDef): void;
|
|
133
|
-
theme(path: string, defaultValue?: unknown): unknown;
|
|
134
|
-
e(className: string): string;
|
|
135
|
-
}
|
|
136
|
-
interface FrameworkConfig {
|
|
137
|
-
darkMode?: DarkMode;
|
|
138
|
-
theme?: Partial<ThemeConfig>;
|
|
139
|
-
/** Additive theme extension — accepts either `extend.theme.X` or `extend.X` directly. */
|
|
140
|
-
extend?: {
|
|
141
|
-
theme?: Partial<ThemeConfig>;
|
|
142
|
-
} & Partial<ThemeConfig>;
|
|
143
|
-
plugins?: Array<(api: PluginAPI) => void>;
|
|
144
|
-
content?: string[];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function formatKbachCSS(tokenCSS: Map<string, string>, theme: ThemeConfig, responsiveRe: RegExp): string;
|
|
148
|
-
interface KbachPluginOptions {
|
|
149
|
-
framework?: FrameworkConfig;
|
|
150
|
-
/** Directories to scan for class strings (relative to Vite root). Defaults to common source dirs. */
|
|
151
|
-
include?: string[];
|
|
152
|
-
}
|
|
153
|
-
declare function kbach(userConfigOrOptions?: FrameworkConfig | KbachPluginOptions): Plugin;
|
|
26
|
+
declare function kbach(options?: KbachPluginOptions): Plugin;
|
|
154
27
|
|
|
155
|
-
export { type KbachPluginOptions,
|
|
28
|
+
export { type KbachPluginOptions, kbach };
|