@kbach/ui 0.1.0-beta.4 → 0.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -8
- package/dist/vite-plugin.d.mts +2 -1
- package/dist/vite-plugin.d.ts +2 -1
- package/dist/vite-plugin.js +22 -3
- package/dist/vite-plugin.mjs +21 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -191,8 +191,8 @@ type OmittedKeys = 'style';
|
|
|
191
191
|
* Create a styled component from any React / React Native component.
|
|
192
192
|
*
|
|
193
193
|
* ```tsx
|
|
194
|
-
* const Card = styled(View, 'bg-white dark:bg-gray-
|
|
195
|
-
* const Button = styled(TouchableOpacity, 'bg-blue-
|
|
194
|
+
* const Card = styled(View, 'bg-white dark:bg-gray-9 rounded-xl p-4 shadow-md');
|
|
195
|
+
* const Button = styled(TouchableOpacity, 'bg-blue-6 pressed:bg-blue-8 dark:bg-blue-7 rounded-lg p-3');
|
|
196
196
|
*
|
|
197
197
|
* // Use it:
|
|
198
198
|
* <Card kb="mt-4">...</Card>
|
|
@@ -217,14 +217,14 @@ interface InteractionState {
|
|
|
217
217
|
*
|
|
218
218
|
* ```tsx
|
|
219
219
|
* // Basic usage
|
|
220
|
-
* const styles = useStyles('bg-white dark:bg-gray-
|
|
220
|
+
* const styles = useStyles('bg-white dark:bg-gray-9 p-4');
|
|
221
221
|
*
|
|
222
222
|
* // With interaction state
|
|
223
223
|
* const [pressed, setPressed] = useState(false);
|
|
224
|
-
* const styles = useStyles('bg-blue-
|
|
224
|
+
* const styles = useStyles('bg-blue-6 pressed:bg-blue-8', { pressed });
|
|
225
225
|
*
|
|
226
226
|
* // Multiple class strings (merged left-to-right)
|
|
227
|
-
* const styles = useStyles(['bg-white p-4', 'dark:bg-gray-
|
|
227
|
+
* const styles = useStyles(['bg-white p-4', 'dark:bg-gray-9 rounded-xl']);
|
|
228
228
|
* ```
|
|
229
229
|
*/
|
|
230
230
|
declare function useStyles(classString: string | string[], state?: InteractionState): StyleValue;
|
|
@@ -309,7 +309,7 @@ declare const InteractiveWrapper: React__default.ForwardRefExoticComponent<Inter
|
|
|
309
309
|
* });
|
|
310
310
|
*
|
|
311
311
|
* // Web: use as className
|
|
312
|
-
* <div className={kb('bg-white dark:bg-gray-
|
|
312
|
+
* <div className={kb('bg-white dark:bg-gray-9 p-4') as string} />
|
|
313
313
|
* ```
|
|
314
314
|
*
|
|
315
315
|
* @param classString Space-separated utility classes
|
|
@@ -320,8 +320,8 @@ declare function kb(classString: string, isDark?: boolean): StyleValue | string;
|
|
|
320
320
|
* Conditionally join class names. Falsy values are ignored.
|
|
321
321
|
*
|
|
322
322
|
* ```ts
|
|
323
|
-
* cx('bg-white p-4', isActive && 'border-2 border-blue-
|
|
324
|
-
* // → 'bg-white p-4 border-2 border-blue-
|
|
323
|
+
* cx('bg-white p-4', isActive && 'border-2 border-blue-6', undefined)
|
|
324
|
+
* // → 'bg-white p-4 border-2 border-blue-6'
|
|
325
325
|
* ```
|
|
326
326
|
*/
|
|
327
327
|
declare function cx(...classes: Array<string | false | null | undefined>): string;
|
package/dist/vite-plugin.d.mts
CHANGED
|
@@ -145,6 +145,7 @@ interface FrameworkConfig {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
declare function formatKbachCSS(tokenCSS: Map<string, string>, theme: ThemeConfig, responsiveRe: RegExp): string;
|
|
148
|
+
declare function extractClassStrings(code: string): string[];
|
|
148
149
|
interface KbachPluginOptions {
|
|
149
150
|
framework?: FrameworkConfig;
|
|
150
151
|
/** Directories to scan for class strings (relative to Vite root). Defaults to common source dirs. */
|
|
@@ -152,4 +153,4 @@ interface KbachPluginOptions {
|
|
|
152
153
|
}
|
|
153
154
|
declare function kbach(userConfigOrOptions?: FrameworkConfig | KbachPluginOptions): Plugin;
|
|
154
155
|
|
|
155
|
-
export { type KbachPluginOptions, formatKbachCSS, kbach };
|
|
156
|
+
export { type KbachPluginOptions, extractClassStrings, formatKbachCSS, kbach };
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ interface FrameworkConfig {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
declare function formatKbachCSS(tokenCSS: Map<string, string>, theme: ThemeConfig, responsiveRe: RegExp): string;
|
|
148
|
+
declare function extractClassStrings(code: string): string[];
|
|
148
149
|
interface KbachPluginOptions {
|
|
149
150
|
framework?: FrameworkConfig;
|
|
150
151
|
/** Directories to scan for class strings (relative to Vite root). Defaults to common source dirs. */
|
|
@@ -152,4 +153,4 @@ interface KbachPluginOptions {
|
|
|
152
153
|
}
|
|
153
154
|
declare function kbach(userConfigOrOptions?: FrameworkConfig | KbachPluginOptions): Plugin;
|
|
154
155
|
|
|
155
|
-
export { type KbachPluginOptions, formatKbachCSS, kbach };
|
|
156
|
+
export { type KbachPluginOptions, extractClassStrings, formatKbachCSS, kbach };
|
package/dist/vite-plugin.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/vite-plugin.ts
|
|
31
31
|
var vite_plugin_exports = {};
|
|
32
32
|
__export(vite_plugin_exports, {
|
|
33
|
+
extractClassStrings: () => extractClassStrings,
|
|
33
34
|
formatKbachCSS: () => formatKbachCSS,
|
|
34
35
|
kbach: () => kbach
|
|
35
36
|
});
|
|
@@ -3756,8 +3757,8 @@ function extractClassStrings(code) {
|
|
|
3756
3757
|
jsxExprRe.lastIndex = i + 1;
|
|
3757
3758
|
pushClassLikeStrings(block, found);
|
|
3758
3759
|
}
|
|
3759
|
-
const
|
|
3760
|
-
while ((m =
|
|
3760
|
+
const classComposerCallRe = /(?:clsx|cn|classnames|cx|kb)\(/g;
|
|
3761
|
+
while ((m = classComposerCallRe.exec(code)) !== null) {
|
|
3761
3762
|
let depth = 1;
|
|
3762
3763
|
let i = m.index + m[0].length;
|
|
3763
3764
|
let block = "";
|
|
@@ -3770,7 +3771,24 @@ function extractClassStrings(code) {
|
|
|
3770
3771
|
block += ch;
|
|
3771
3772
|
i++;
|
|
3772
3773
|
}
|
|
3773
|
-
|
|
3774
|
+
classComposerCallRe.lastIndex = i + 1;
|
|
3775
|
+
pushClassLikeStrings(block, found);
|
|
3776
|
+
}
|
|
3777
|
+
const styledCallRe = /\bstyled\(/g;
|
|
3778
|
+
while ((m = styledCallRe.exec(code)) !== null) {
|
|
3779
|
+
let depth = 1;
|
|
3780
|
+
let i = m.index + m[0].length;
|
|
3781
|
+
let block = "";
|
|
3782
|
+
while (i < code.length && depth > 0) {
|
|
3783
|
+
const ch = code[i];
|
|
3784
|
+
if (ch === "(") depth++;
|
|
3785
|
+
else if (ch === ")") {
|
|
3786
|
+
if (--depth === 0) break;
|
|
3787
|
+
}
|
|
3788
|
+
block += ch;
|
|
3789
|
+
i++;
|
|
3790
|
+
}
|
|
3791
|
+
styledCallRe.lastIndex = i + 1;
|
|
3774
3792
|
pushClassLikeStrings(block, found);
|
|
3775
3793
|
}
|
|
3776
3794
|
const templateRe = /`([^`]{1,2000})`/g;
|
|
@@ -4027,6 +4045,7 @@ ${code}`,
|
|
|
4027
4045
|
}
|
|
4028
4046
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4029
4047
|
0 && (module.exports = {
|
|
4048
|
+
extractClassStrings,
|
|
4030
4049
|
formatKbachCSS,
|
|
4031
4050
|
kbach
|
|
4032
4051
|
});
|
package/dist/vite-plugin.mjs
CHANGED
|
@@ -3721,8 +3721,8 @@ function extractClassStrings(code) {
|
|
|
3721
3721
|
jsxExprRe.lastIndex = i + 1;
|
|
3722
3722
|
pushClassLikeStrings(block, found);
|
|
3723
3723
|
}
|
|
3724
|
-
const
|
|
3725
|
-
while ((m =
|
|
3724
|
+
const classComposerCallRe = /(?:clsx|cn|classnames|cx|kb)\(/g;
|
|
3725
|
+
while ((m = classComposerCallRe.exec(code)) !== null) {
|
|
3726
3726
|
let depth = 1;
|
|
3727
3727
|
let i = m.index + m[0].length;
|
|
3728
3728
|
let block = "";
|
|
@@ -3735,7 +3735,24 @@ function extractClassStrings(code) {
|
|
|
3735
3735
|
block += ch;
|
|
3736
3736
|
i++;
|
|
3737
3737
|
}
|
|
3738
|
-
|
|
3738
|
+
classComposerCallRe.lastIndex = i + 1;
|
|
3739
|
+
pushClassLikeStrings(block, found);
|
|
3740
|
+
}
|
|
3741
|
+
const styledCallRe = /\bstyled\(/g;
|
|
3742
|
+
while ((m = styledCallRe.exec(code)) !== null) {
|
|
3743
|
+
let depth = 1;
|
|
3744
|
+
let i = m.index + m[0].length;
|
|
3745
|
+
let block = "";
|
|
3746
|
+
while (i < code.length && depth > 0) {
|
|
3747
|
+
const ch = code[i];
|
|
3748
|
+
if (ch === "(") depth++;
|
|
3749
|
+
else if (ch === ")") {
|
|
3750
|
+
if (--depth === 0) break;
|
|
3751
|
+
}
|
|
3752
|
+
block += ch;
|
|
3753
|
+
i++;
|
|
3754
|
+
}
|
|
3755
|
+
styledCallRe.lastIndex = i + 1;
|
|
3739
3756
|
pushClassLikeStrings(block, found);
|
|
3740
3757
|
}
|
|
3741
3758
|
const templateRe = /`([^`]{1,2000})`/g;
|
|
@@ -3991,6 +4008,7 @@ ${code}`,
|
|
|
3991
4008
|
};
|
|
3992
4009
|
}
|
|
3993
4010
|
export {
|
|
4011
|
+
extractClassStrings,
|
|
3994
4012
|
formatKbachCSS,
|
|
3995
4013
|
kbach
|
|
3996
4014
|
};
|