@flairjs/client 0.0.1-beta.4 → 0.0.1-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.
@@ -7,10 +7,14 @@ type Paths<T, P extends string = ""> = T extends object ? {
7
7
  [K in keyof T & Key]: Paths<T[K], Join<P, K>>;
8
8
  }[keyof T & Key] : P;
9
9
  export type TokensOf<T> = `$${Paths<T>}`;
10
- export type Tokens = TokensOf<FlairTheme["tokens"]>;
11
- type BreakPointTokens = `@screen ${keyof FlairTheme["breakpoints"]}`;
12
- type FlairObject = {
13
- [K in keyof CSS.Properties]?: CSS.Properties[K] | Tokens | (string & {}) | number;
10
+ export type ThemeTokens<T extends FlairTheme = FlairTheme> = T extends {
11
+ tokens: any;
12
+ } ? TokensOf<T["tokens"]> : never;
13
+ export type BreakPointTokens<T extends FlairTheme = FlairTheme> = T extends {
14
+ breakpoints: any;
15
+ } ? `$screen ${Extract<keyof T["breakpoints"], string>}` : never;
16
+ type FlairObject<T extends FlairTheme = FlairTheme> = {
17
+ [K in keyof CSS.Properties]?: CSS.Properties[K] | ThemeTokens<T> | (string & {}) | number;
14
18
  };
15
19
  type FlairCSS = {
16
20
  [K in string]?: FlairObject | FlairCSS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flairjs/client",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.6",
4
4
  "module": "./dist/esm/index.js",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -67,7 +67,7 @@
67
67
  "csstype": "^3.1.3",
68
68
  "rolldown": "1.0.0-beta.37",
69
69
  "typescript": "^5.8.3",
70
- "@flairjs/core": "0.0.1-beta.4"
70
+ "@flairjs/core": "0.0.1-beta.7"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "rolldown -c",
@@ -1,4 +0,0 @@
1
- import { c, cn, css, flair } from "./packages/client/src/utils.js";
2
- import { buildThemeTokens, defineConfig } from "./packages/client/src/theme.js";
3
-
4
- export { buildThemeTokens, c, cn, css, defineConfig, flair };
@@ -1,23 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@rollup+plugin-typescript@12.1.4_rollup@4.50.0_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.js
2
- var __assign = function() {
3
- __assign = Object.assign || function __assign$1(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- function __spreadArray(to, from, pack) {
13
- if (pack || arguments.length === 2) {
14
- for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- }
21
-
22
- //#endregion
23
- export { __assign, __spreadArray };
@@ -1,7 +0,0 @@
1
- //#region src/preact/style.tsx
2
- var Style = function(props) {
3
- return null;
4
- };
5
-
6
- //#endregion
7
- export { Style };
@@ -1,7 +0,0 @@
1
- //#region src/react/style.tsx
2
- var Style = function(props) {
3
- return null;
4
- };
5
-
6
- //#endregion
7
- export { Style };
@@ -1,7 +0,0 @@
1
- //#region src/solidjs/style.tsx
2
- var Style = function(props) {
3
- return null;
4
- };
5
-
6
- //#endregion
7
- export { Style };
@@ -1,37 +0,0 @@
1
- import { __assign, __spreadArray } from "../../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.50.0_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.js";
2
-
3
- //#region src/theme.ts
4
- function defineConfig(config) {
5
- return config;
6
- }
7
- var buildThemeTokens = function(theme, themeName) {
8
- var _a;
9
- var css = "";
10
- var tokens = theme.tokens, selector = theme.selector;
11
- if (typeof selector === "string") css += "".concat(selector, " {\n");
12
- css += tokensToCSSVars(tokens, theme.prefix ? [theme.prefix] : []);
13
- if (typeof selector === "string") css += "}\n";
14
- else css = selector(css, themeName);
15
- Object.entries((_a = theme.themes) !== null && _a !== void 0 ? _a : {}).forEach(function(_a$1) {
16
- var name = _a$1[0], themeConfig = _a$1[1];
17
- css += buildThemeTokens(__assign({
18
- prefix: theme.prefix,
19
- selector: theme.selector
20
- }, themeConfig), name);
21
- });
22
- return css;
23
- };
24
- function tokensToCSSVars(tokens, prefix) {
25
- if (prefix === void 0) prefix = [];
26
- var css = "";
27
- for (var _i = 0, _a = Object.entries(tokens); _i < _a.length; _i++) {
28
- var _b = _a[_i], key = _b[0], value = _b[1];
29
- var newPrefix = __spreadArray(__spreadArray([], prefix, true), [key], false);
30
- if (typeof value === "string" || typeof value === "number") css += "--".concat(newPrefix.join("-"), ": ").concat(value, ";\n");
31
- else if (typeof value === "object" && value !== null) css += tokensToCSSVars(value, newPrefix);
32
- }
33
- return css;
34
- }
35
-
36
- //#endregion
37
- export { buildThemeTokens, defineConfig };
@@ -1,12 +0,0 @@
1
- //#region src/utils.ts
2
- var flair = function(styles) {
3
- return "";
4
- };
5
- var c = function(className) {
6
- return className;
7
- };
8
- var cn = c;
9
- var css = String.raw;
10
-
11
- //#endregion
12
- export { c, cn, css, flair };
@@ -1,3 +0,0 @@
1
- import { Style } from "../packages/client/src/preact/style.js";
2
-
3
- export { Style };
@@ -1,3 +0,0 @@
1
- import { Style } from "../packages/client/src/react/style.js";
2
-
3
- export { Style };
@@ -1,3 +0,0 @@
1
- import { Style } from "../packages/client/src/solidjs/style.js";
2
-
3
- export { Style };