soma-kit 0.1.6 → 0.1.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.
- package/README.md +5 -5
- package/package.json +2 -2
- package/spec/generated/kit-app.schema.json +27 -0
- package/spec/generated/kit-page.schema.json +7 -0
- package/spec/kit-grammar.json +105 -6
- package/src/app/app-config.ts +558 -20
- package/src/app/component-gate.ts +203 -0
- package/src/app/define-kit-app.ts +3 -0
- package/src/app/index.ts +9 -2
- package/src/app/server.ts +10 -1
- package/src/base/shared.ts +48 -5
- package/src/base/text.ts +8 -2
- package/src/biz/index.ts +30 -0
- package/src/biz/page-templates/domain-templates.ts +184 -0
- package/src/compile/compile-page.ts +149 -4
- package/src/compile/parse.ts +4 -0
- package/src/compile/types.ts +5 -1
- package/src/data/embed.ts +2 -0
- package/src/data/navbar.ts +2 -2
- package/src/generated/kit-grammar-runtime.ts +7 -4
- package/src/theme/nine-dim-palettes.ts +1274 -0
- package/src/theme/theme-tokens.ts +17 -3
|
@@ -57,9 +57,23 @@ function tableDiff(base: Readonly<Record<string, string>>, next: Readonly<Record
|
|
|
57
57
|
|
|
58
58
|
/** 令牌表 -> CSS 文本(极性决定发哪几块,格式与 soma-lite / soma-ui 同一份 foundation 规则) */
|
|
59
59
|
export function serializeTokenTables(tables: TokenTables): string {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const light: Record<string, string> = {
|
|
61
|
+
...tables.light,
|
|
62
|
+
'--soma-border-hairline': 'rgba(15, 23, 42, 0.08)',
|
|
63
|
+
'--soma-border-strong': 'rgba(15, 23, 42, 0.14)',
|
|
64
|
+
'--soma-border-control': 'rgba(15, 23, 42, 0.14)',
|
|
65
|
+
'--soma-border-divider': 'rgba(15, 23, 42, 0.06)',
|
|
66
|
+
};
|
|
67
|
+
const dark: Record<string, string> = {
|
|
68
|
+
...tables.dark,
|
|
69
|
+
'--soma-border-hairline': 'rgba(255, 255, 255, 0.10)',
|
|
70
|
+
'--soma-border-strong': 'rgba(255, 255, 255, 0.16)',
|
|
71
|
+
'--soma-border-control': 'rgba(255, 255, 255, 0.14)',
|
|
72
|
+
'--soma-border-divider': 'rgba(255, 255, 255, 0.07)',
|
|
73
|
+
};
|
|
74
|
+
if (tables.polarity === 'dark') return tokenBlock(':root', dark, ['color-scheme: dark;']);
|
|
75
|
+
const parts = [tokenBlock(':root', light, ['color-scheme: light;'])];
|
|
76
|
+
const darkOnly = tableDiff(light, dark);
|
|
63
77
|
const system = tables.polarity === 'system';
|
|
64
78
|
if (Object.keys(darkOnly).length > 0) {
|
|
65
79
|
parts.push(...darkSchemeRules(undefined, ['color-scheme: dark;', ...Object.entries(darkOnly).map(([k, v]) => `${k}: ${v};`)], system));
|