@lobehub/ui 6.0.6 → 6.2.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.
@@ -0,0 +1,14 @@
1
+ import * as stylex from '@stylexjs/stylex';
2
+
3
+ export const media = stylex.defineConsts({
4
+ desktop: '@media (min-width: 1200px)',
5
+ laptop: '@media (max-width: 991.98px)',
6
+ lg: '@media (max-width: 991.98px)',
7
+ md: '@media (max-width: 767.98px)',
8
+ mobile: '@media (max-width: 479.98px)',
9
+ sm: '@media (max-width: 575.98px)',
10
+ tablet: '@media (max-width: 767.98px)',
11
+ xl: '@media (max-width: 1199.98px)',
12
+ xs: '@media (max-width: 479.98px)',
13
+ xxl: '@media (min-width: 1200px)',
14
+ });
@@ -0,0 +1,14 @@
1
+ import * as stylex from '@stylexjs/stylex';
2
+
3
+ export const media = stylex.defineConsts({
4
+ desktop: '@media (min-width: 1200px)',
5
+ laptop: '@media (max-width: 991.98px)',
6
+ lg: '@media (max-width: 991.98px)',
7
+ md: '@media (max-width: 767.98px)',
8
+ mobile: '@media (max-width: 479.98px)',
9
+ sm: '@media (max-width: 575.98px)',
10
+ tablet: '@media (max-width: 767.98px)',
11
+ xl: '@media (max-width: 1199.98px)',
12
+ xs: '@media (max-width: 479.98px)',
13
+ xxl: '@media (min-width: 1200px)',
14
+ });
@@ -0,0 +1,39 @@
1
+ //#region src/utils/bem.ts
2
+ const BLOCK_PREFIX = "lobe-";
3
+ const cache = /* @__PURE__ */ new Map();
4
+ /**
5
+ * Builds the stable class names of one component block, following the
6
+ * `lobe-<block>` / `lobe-<block>__<element>` BEM convention.
7
+ *
8
+ * Element names must match the component's `classNames` / `styles` slot keys, so
9
+ * a consumer reads the same part name in CSS and in props. State and variants
10
+ * belong on `data-*` attributes, never on `--modifier` classes: one source of
11
+ * truth beats two.
12
+ *
13
+ * Generated StyleX hashes are not stable between releases, so these names are
14
+ * the only surface integrations and e2e selectors may target.
15
+ *
16
+ * The factory is cached per block, so calling it at module scope, inside render,
17
+ * or from a test all hand back the same instance.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const slider = bem('slider');
22
+ *
23
+ * slider(); // 'lobe-slider'
24
+ * slider('thumb'); // 'lobe-slider__thumb'
25
+ * ```
26
+ */
27
+ const bem = (block) => {
28
+ const cached = cache.get(block);
29
+ if (cached) return cached;
30
+ const base = `${BLOCK_PREFIX}${block}`;
31
+ const factory = ((element) => element ? `${base}__${element}` : base);
32
+ factory.block = base;
33
+ cache.set(block, factory);
34
+ return factory;
35
+ };
36
+ //#endregion
37
+ export { bem };
38
+
39
+ //# sourceMappingURL=bem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bem.mjs","names":[],"sources":["../../src/utils/bem.ts"],"sourcesContent":["const BLOCK_PREFIX = 'lobe-';\n\nexport interface BEM {\n /** The block class name, e.g. `lobe-slider`. */\n block: string;\n /** The block itself, or `block__element` when a name is passed. */\n (element?: string): string;\n}\n\nconst cache = new Map<string, BEM>();\n\n/**\n * Builds the stable class names of one component block, following the\n * `lobe-<block>` / `lobe-<block>__<element>` BEM convention.\n *\n * Element names must match the component's `classNames` / `styles` slot keys, so\n * a consumer reads the same part name in CSS and in props. State and variants\n * belong on `data-*` attributes, never on `--modifier` classes: one source of\n * truth beats two.\n *\n * Generated StyleX hashes are not stable between releases, so these names are\n * the only surface integrations and e2e selectors may target.\n *\n * The factory is cached per block, so calling it at module scope, inside render,\n * or from a test all hand back the same instance.\n *\n * @example\n * ```tsx\n * const slider = bem('slider');\n *\n * slider(); // 'lobe-slider'\n * slider('thumb'); // 'lobe-slider__thumb'\n * ```\n */\nexport const bem = (block: string): BEM => {\n const cached = cache.get(block);\n if (cached) return cached;\n\n const base = `${BLOCK_PREFIX}${block}`;\n const factory = ((element?: string) => (element ? `${base}__${element}` : base)) as BEM;\n factory.block = base;\n\n cache.set(block, factory);\n return factory;\n};\n"],"mappings":";AAAA,MAAM,eAAe;AASrB,MAAM,wBAAQ,IAAI,IAAiB;;;;;;;;;;;;;;;;;;;;;;;;AAyBnC,MAAa,OAAO,UAAuB;CACzC,MAAM,SAAS,MAAM,IAAI,KAAK;CAC9B,IAAI,QAAQ,OAAO;CAEnB,MAAM,OAAO,GAAG,eAAe;CAC/B,MAAM,YAAY,YAAsB,UAAU,GAAG,KAAK,IAAI,YAAY;CAC1E,QAAQ,QAAQ;CAEhB,MAAM,IAAI,OAAO,OAAO;CACxB,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "6.0.6",
3
+ "version": "6.2.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -96,6 +96,16 @@
96
96
  "./global.css": "./es/global.css",
97
97
  "./theme.css": "./es/theme.css",
98
98
  "./style.css": "./es/style.css",
99
+ "./stylex/cssVar.stylex": {
100
+ "types": "./es/stylex/cssVar.stylex.ts",
101
+ "import": "./es/stylex/cssVar.stylex.js",
102
+ "default": "./es/stylex/cssVar.stylex.js"
103
+ },
104
+ "./stylex/media.stylex": {
105
+ "types": "./es/stylex/media.stylex.ts",
106
+ "import": "./es/stylex/media.stylex.js",
107
+ "default": "./es/stylex/media.stylex.js"
108
+ },
99
109
  "./es/*": {
100
110
  "types": "./es/*.d.mts",
101
111
  "import": "./es/*.mjs"
@@ -108,7 +118,7 @@
108
118
  "es"
109
119
  ],
110
120
  "scripts": {
111
- "build": "tsdown && tsx ./scripts/buildThemeCss.ts && tsx ./scripts/checkStylexBuild.ts && npm run build:packages",
121
+ "build": "tsdown && tsx ./scripts/buildThemeCss.ts && tsx ./scripts/publishStylexTokens.ts && tsx ./scripts/checkStylexBuild.ts && npm run build:packages",
112
122
  "build:packages": "tsx ./scripts/build.ts",
113
123
  "build:stylex-vars": "tsx ./scripts/buildStylexVars.ts",
114
124
  "build:watch": "tsdown --watch",