@kbach/ui 0.1.0-beta.4 → 0.1.0-beta.5

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 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-800 rounded-xl p-4 shadow-md');
195
- * const Button = styled(TouchableOpacity, 'bg-blue-500 pressed:bg-blue-700 dark:bg-blue-600 rounded-lg p-3');
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-900 p-4');
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-500 pressed:bg-blue-700', { pressed });
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-900 rounded-xl']);
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-900 p-4') as string} />
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-500', undefined)
324
- * // → 'bg-white p-4 border-2 border-blue-500'
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;
@@ -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 };
@@ -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 };
@@ -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
  });
@@ -3773,6 +3774,23 @@ function extractClassStrings(code) {
3773
3774
  clsxCallRe.lastIndex = i + 1;
3774
3775
  pushClassLikeStrings(block, found);
3775
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;
3792
+ pushClassLikeStrings(block, found);
3793
+ }
3776
3794
  const templateRe = /`([^`]{1,2000})`/g;
3777
3795
  while ((m = templateRe.exec(code)) !== null) pushTemplateLiteralBody(m[1], found);
3778
3796
  return [...found];
@@ -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
  });
@@ -3738,6 +3738,23 @@ function extractClassStrings(code) {
3738
3738
  clsxCallRe.lastIndex = i + 1;
3739
3739
  pushClassLikeStrings(block, found);
3740
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;
3756
+ pushClassLikeStrings(block, found);
3757
+ }
3741
3758
  const templateRe = /`([^`]{1,2000})`/g;
3742
3759
  while ((m = templateRe.exec(code)) !== null) pushTemplateLiteralBody(m[1], found);
3743
3760
  return [...found];
@@ -3991,6 +4008,7 @@ ${code}`,
3991
4008
  };
3992
4009
  }
3993
4010
  export {
4011
+ extractClassStrings,
3994
4012
  formatKbachCSS,
3995
4013
  kbach
3996
4014
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/ui",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "Tailwind-like utility classes and components for React — web, React Native, and Expo",
5
5
  "license": "MIT",
6
6
  "repository": {