@kbach/react 0.5.7 → 0.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.
@@ -2988,6 +2988,13 @@ function getActiveBreakpoints(width) {
2988
2988
 
2989
2989
  // src/core/resolver.ts
2990
2990
  var styleCache = new LRUCache(1e4);
2991
+ var _defaultFontFamily;
2992
+ function setDefaultFontFamily(font) {
2993
+ _defaultFontFamily = font;
2994
+ }
2995
+ function getDefaultFontFamily() {
2996
+ return _defaultFontFamily;
2997
+ }
2991
2998
  var _styleEl = null;
2992
2999
  var _injectedRules = /* @__PURE__ */ new Set();
2993
3000
  function getStyleEl() {
@@ -3256,6 +3263,7 @@ function resolve(classString, theme, darkMode = "attribute") {
3256
3263
  }
3257
3264
  function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3258
3265
  const result = {};
3266
+ if (_defaultFontFamily) result.fontFamily = _defaultFontFamily;
3259
3267
  const entries = Object.entries(resolved);
3260
3268
  entries.sort((a, b) => {
3261
3269
  const pa = a[0] === "base" ? -1 : a[0].split(":").length;
@@ -3432,6 +3440,9 @@ function buildConfig(userConfig) {
3432
3440
  for (const plugin of resolved.plugins) {
3433
3441
  plugin(pluginAPI);
3434
3442
  }
3443
+ const rawSans = theme.fontFamily.sans;
3444
+ const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3445
+ setDefaultFontFamily(sansFontValue && sansFontValue !== "System" ? sansFontValue : void 0);
3435
3446
  injectGlobalStyles(resolved.theme);
3436
3447
  return resolved;
3437
3448
  }
@@ -3716,6 +3727,7 @@ export {
3716
3727
  syncGlobalScreens,
3717
3728
  setGlobalWidth,
3718
3729
  getActiveBreakpoints,
3730
+ getDefaultFontFamily,
3719
3731
  resolve,
3720
3732
  flatten,
3721
3733
  getConfig,
@@ -4,11 +4,12 @@ import {
4
4
  flatten,
5
5
  getActiveBreakpoints,
6
6
  getConfig,
7
+ getDefaultFontFamily,
7
8
  isWeb,
8
9
  resolve,
9
10
  useConditionalWidth,
10
11
  useGlobalDarkMode
11
- } from "./chunk-YLT5TFLD.mjs";
12
+ } from "./chunk-OBFLMVLT.mjs";
12
13
 
13
14
  // src/jsx-runtime.tsx
14
15
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
@@ -190,7 +191,13 @@ function processElement(type, rawProps, key, isStaticChildren) {
190
191
  const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
191
192
  const classStr = className ?? kbProp ?? __kbachClasses;
192
193
  if (!classStr && !__kbachStyles) {
193
- return makeElement(isStaticChildren, type, rawProps, key);
194
+ const defaultFont = getDefaultFontFamily();
195
+ if (!defaultFont) {
196
+ return makeElement(isStaticChildren, type, rawProps, key);
197
+ }
198
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
199
+ const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
200
+ return makeElement(isStaticChildren, type, { ...passProps2, style: finalStyle2 }, key);
194
201
  }
195
202
  const config = getConfig();
196
203
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
package/dist/index.js CHANGED
@@ -3118,6 +3118,10 @@ function getActiveBreakpoints(width) {
3118
3118
 
3119
3119
  // src/core/resolver.ts
3120
3120
  var styleCache = new LRUCache(1e4);
3121
+ var _defaultFontFamily;
3122
+ function setDefaultFontFamily(font) {
3123
+ _defaultFontFamily = font;
3124
+ }
3121
3125
  var _styleEl = null;
3122
3126
  var _injectedRules = /* @__PURE__ */ new Set();
3123
3127
  function getStyleEl() {
@@ -3386,6 +3390,7 @@ function resolve(classString, theme, darkMode = "attribute") {
3386
3390
  }
3387
3391
  function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3388
3392
  const result = {};
3393
+ if (_defaultFontFamily) result.fontFamily = _defaultFontFamily;
3389
3394
  const entries = Object.entries(resolved);
3390
3395
  entries.sort((a, b) => {
3391
3396
  const pa = a[0] === "base" ? -1 : a[0].split(":").length;
@@ -3562,6 +3567,9 @@ function buildConfig(userConfig) {
3562
3567
  for (const plugin of resolved.plugins) {
3563
3568
  plugin(pluginAPI);
3564
3569
  }
3570
+ const rawSans = theme.fontFamily.sans;
3571
+ const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3572
+ setDefaultFontFamily(sansFontValue && sansFontValue !== "System" ? sansFontValue : void 0);
3565
3573
  injectGlobalStyles(resolved.theme);
3566
3574
  return resolved;
3567
3575
  }
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  useConditionalWidth,
24
24
  useGlobalDarkMode,
25
25
  useGlobalWidth
26
- } from "./chunk-YLT5TFLD.mjs";
26
+ } from "./chunk-OBFLMVLT.mjs";
27
27
 
28
28
  // src/context.tsx
29
29
  import { createContext, useContext } from "react";
@@ -3009,6 +3009,13 @@ function getActiveBreakpoints(width) {
3009
3009
 
3010
3010
  // src/core/resolver.ts
3011
3011
  var styleCache = new LRUCache(1e4);
3012
+ var _defaultFontFamily;
3013
+ function setDefaultFontFamily(font) {
3014
+ _defaultFontFamily = font;
3015
+ }
3016
+ function getDefaultFontFamily() {
3017
+ return _defaultFontFamily;
3018
+ }
3012
3019
  var _styleEl = null;
3013
3020
  var _injectedRules = /* @__PURE__ */ new Set();
3014
3021
  function getStyleEl() {
@@ -3277,6 +3284,7 @@ function resolve(classString, theme, darkMode = "attribute") {
3277
3284
  }
3278
3285
  function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3279
3286
  const result = {};
3287
+ if (_defaultFontFamily) result.fontFamily = _defaultFontFamily;
3280
3288
  const entries = Object.entries(resolved);
3281
3289
  entries.sort((a, b) => {
3282
3290
  const pa = a[0] === "base" ? -1 : a[0].split(":").length;
@@ -3445,6 +3453,9 @@ function buildConfig(userConfig) {
3445
3453
  for (const plugin of resolved.plugins) {
3446
3454
  plugin(pluginAPI);
3447
3455
  }
3456
+ const rawSans = theme.fontFamily.sans;
3457
+ const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3458
+ setDefaultFontFamily(sansFontValue && sansFontValue !== "System" ? sansFontValue : void 0);
3448
3459
  injectGlobalStyles(resolved.theme);
3449
3460
  return resolved;
3450
3461
  }
@@ -3860,7 +3871,13 @@ function processElement(type, rawProps, key, isStaticChildren) {
3860
3871
  const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
3861
3872
  const classStr = className ?? kbProp ?? __kbachClasses;
3862
3873
  if (!classStr && !__kbachStyles) {
3863
- return makeElement(isStaticChildren, type, rawProps, key);
3874
+ const defaultFont = getDefaultFontFamily();
3875
+ if (!defaultFont) {
3876
+ return makeElement(isStaticChildren, type, rawProps, key);
3877
+ }
3878
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
3879
+ const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
3880
+ return makeElement(isStaticChildren, type, { ...passProps2, style: finalStyle2 }, key);
3864
3881
  }
3865
3882
  const config = getConfig();
3866
3883
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-3SF5YHWG.mjs";
6
- import "./chunk-YLT5TFLD.mjs";
5
+ } from "./chunk-QG3EWTVW.mjs";
6
+ import "./chunk-OBFLMVLT.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -3008,6 +3008,13 @@ function getActiveBreakpoints(width) {
3008
3008
 
3009
3009
  // src/core/resolver.ts
3010
3010
  var styleCache = new LRUCache(1e4);
3011
+ var _defaultFontFamily;
3012
+ function setDefaultFontFamily(font) {
3013
+ _defaultFontFamily = font;
3014
+ }
3015
+ function getDefaultFontFamily() {
3016
+ return _defaultFontFamily;
3017
+ }
3011
3018
  var _styleEl = null;
3012
3019
  var _injectedRules = /* @__PURE__ */ new Set();
3013
3020
  function getStyleEl() {
@@ -3276,6 +3283,7 @@ function resolve(classString, theme, darkMode = "attribute") {
3276
3283
  }
3277
3284
  function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3278
3285
  const result = {};
3286
+ if (_defaultFontFamily) result.fontFamily = _defaultFontFamily;
3279
3287
  const entries = Object.entries(resolved);
3280
3288
  entries.sort((a, b) => {
3281
3289
  const pa = a[0] === "base" ? -1 : a[0].split(":").length;
@@ -3444,6 +3452,9 @@ function buildConfig(userConfig) {
3444
3452
  for (const plugin of resolved.plugins) {
3445
3453
  plugin(pluginAPI);
3446
3454
  }
3455
+ const rawSans = theme.fontFamily.sans;
3456
+ const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3457
+ setDefaultFontFamily(sansFontValue && sansFontValue !== "System" ? sansFontValue : void 0);
3447
3458
  injectGlobalStyles(resolved.theme);
3448
3459
  return resolved;
3449
3460
  }
@@ -3859,7 +3870,13 @@ function processElement(type, rawProps, key, isStaticChildren) {
3859
3870
  const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
3860
3871
  const classStr = className ?? kbProp ?? __kbachClasses;
3861
3872
  if (!classStr && !__kbachStyles) {
3862
- return makeElement(isStaticChildren, type, rawProps, key);
3873
+ const defaultFont = getDefaultFontFamily();
3874
+ if (!defaultFont) {
3875
+ return makeElement(isStaticChildren, type, rawProps, key);
3876
+ }
3877
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
3878
+ const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
3879
+ return makeElement(isStaticChildren, type, { ...passProps2, style: finalStyle2 }, key);
3863
3880
  }
3864
3881
  const config = getConfig();
3865
3882
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-3SF5YHWG.mjs";
6
- import "./chunk-YLT5TFLD.mjs";
5
+ } from "./chunk-QG3EWTVW.mjs";
6
+ import "./chunk-OBFLMVLT.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",