@flairjs/client 0.0.1-beta.5 → 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.
- package/dist/types/utils.d.ts +6 -4
- package/package.json +1 -1
- package/dist/types/index.js +0 -4
- package/dist/types/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 +0 -23
- package/dist/types/packages/client/src/preact/style.js +0 -7
- package/dist/types/packages/client/src/react/style.js +0 -7
- package/dist/types/packages/client/src/solidjs/style.js +0 -7
- package/dist/types/packages/client/src/theme.js +0 -37
- package/dist/types/packages/client/src/utils.js +0 -12
- package/dist/types/preact/index.js +0 -3
- package/dist/types/react/index.js +0 -3
- package/dist/types/solidjs/index.js +0 -3
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type * as CSS from "csstype";
|
|
2
2
|
export interface FlairTheme {
|
|
3
|
-
tokens: Record<string, unknown>;
|
|
4
|
-
breakpoints: Record<string, unknown>;
|
|
5
3
|
}
|
|
6
4
|
type Key = string | number;
|
|
7
5
|
type Join<P extends string, K extends Key> = `${P}${P extends "" ? "" : "."}${K}`;
|
|
@@ -9,8 +7,12 @@ type Paths<T, P extends string = ""> = T extends object ? {
|
|
|
9
7
|
[K in keyof T & Key]: Paths<T[K], Join<P, K>>;
|
|
10
8
|
}[keyof T & Key] : P;
|
|
11
9
|
export type TokensOf<T> = `$${Paths<T>}`;
|
|
12
|
-
export type ThemeTokens<T extends FlairTheme = FlairTheme> =
|
|
13
|
-
|
|
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;
|
|
14
16
|
type FlairObject<T extends FlairTheme = FlairTheme> = {
|
|
15
17
|
[K in keyof CSS.Properties]?: CSS.Properties[K] | ThemeTokens<T> | (string & {}) | number;
|
|
16
18
|
};
|
package/package.json
CHANGED
package/dist/types/index.js
DELETED
|
@@ -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,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 };
|