soma-kit 0.1.7 → 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/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/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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soma-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "SOMA 第三条 UI 路线:写死模板与规则,DSL 显式传入,基础组件 + 数据组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"jiti": "1.21.7",
|
|
47
47
|
"js-yaml": "4.3.2",
|
|
48
|
-
"soma-core": "^2.2.
|
|
48
|
+
"soma-core": "^2.2.5",
|
|
49
49
|
"soma-foundation": "^0.1.2",
|
|
50
50
|
"tailwindcss": "^4.1.0"
|
|
51
51
|
},
|
|
@@ -34,6 +34,33 @@
|
|
|
34
34
|
"additionalProperties": false,
|
|
35
35
|
"description": "主题声明,交 soma-foundation 求解令牌",
|
|
36
36
|
"properties": {
|
|
37
|
+
"palette": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"color_depth": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"color_saturation": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"font_family": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"font_scale": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"boundary": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
},
|
|
55
|
+
"shape": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
},
|
|
58
|
+
"surface_texture": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"density": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
37
64
|
"palette_scheme": {
|
|
38
65
|
"type": "string"
|
|
39
66
|
},
|
|
@@ -119,6 +119,13 @@
|
|
|
119
119
|
"description": "成功时数据在响应里的点路径(缺省不拆)"
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
},
|
|
123
|
+
"inherit_layout": {
|
|
124
|
+
"description": "kit-grammar.json#pageKeys.inherit_layout"
|
|
125
|
+
},
|
|
126
|
+
"layout": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"description": "应用级默认页面外框与导航继承配置"
|
|
122
129
|
}
|
|
123
130
|
},
|
|
124
131
|
"description": "kit-grammar.json#pageTopKeys.page"
|
package/spec/kit-grammar.json
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"locale",
|
|
29
29
|
"dir",
|
|
30
30
|
"theme",
|
|
31
|
-
"envelope"
|
|
31
|
+
"envelope",
|
|
32
|
+
"inherit_layout"
|
|
32
33
|
],
|
|
33
34
|
"frameKeys": [
|
|
34
35
|
"kind",
|
|
@@ -4279,7 +4280,7 @@
|
|
|
4279
4280
|
"appOptions": {
|
|
4280
4281
|
"packs": "领域包列表",
|
|
4281
4282
|
"extraPagesDirs": "额外页面目录(绝对路径或相对应用根),与 pagesDir 一起扫描,URL 重复报 KIT-PAGE-004",
|
|
4282
|
-
"defaultTheme": "kit.app.yaml 没写 theme 时使用的主题(写了 theme 则以 yaml
|
|
4283
|
+
"defaultTheme": "kit.app.yaml 没写 theme 时使用的主题(写了 theme 则以 yaml 为准,不字段级合并;支持 9 维正交主题 DSL)"
|
|
4283
4284
|
}
|
|
4284
4285
|
},
|
|
4285
4286
|
"componentLayers": [
|
|
@@ -4927,7 +4928,7 @@
|
|
|
4927
4928
|
"KIT-PAGE-004": "页面结构非法(缺 page / product 或形状不对),或应用内页面 URL 重复",
|
|
4928
4929
|
"KIT-PAGE-005": "对象名或角色名用了保留名(frame / tabs / page / p / ctrl)或非字母数字下划线,或字段名含点号",
|
|
4929
4930
|
"KIT-APP-001": "kit.app.yaml 非法,或其登记(组件 accept 等)与 soma.app.ts 代码登记不一致",
|
|
4930
|
-
"KIT-APP-002": "kit.app.yaml 的 theme 取值不在闭集内(
|
|
4931
|
+
"KIT-APP-002": "kit.app.yaml 的 theme 取值不在闭集内(9 维正交页面主题 DSL:palette、color_depth、color_saturation、font_family、font_scale、boundary、shape、surface_texture、density,或兼容旧字段)",
|
|
4931
4932
|
"KIT-APP-003": "theme 交 soma-foundation 令牌求解失败(折叠或求解阶段返回错误诊断)",
|
|
4932
4933
|
"KIT-THEME-001": "块级 theme 形状非法:不是简写字符串或对象、空对象、或对象里的值不是字符串(page.theme / product.theme)",
|
|
4933
4934
|
"KIT-THEME-002": "块级 theme 含未知词:对象键不在 mode / color,简写不在闭集,词条不属于该维度",
|
|
@@ -5004,7 +5005,9 @@
|
|
|
5004
5005
|
"KIT-AIT-003": "AI 页意图蓝图含未知键,或取值在闭集之外(意图词 frame / product、字段 type、字段 display、内置动作、tone、permission 档)",
|
|
5005
5006
|
"KIT-AIT-004": "AI 页意图蓝图引用了授权接口之外的 api / write_api / delete_api,或 delete_api 指向的不是授权表里的写类方法",
|
|
5006
5007
|
"KIT-AIT-005": "AI 页意图蓝图的对象描述不足以编译(form 视图没有 write_api、角色缺必填对象、既无接口也无样本、display 与字段类型不匹配或不在 list / summary 视图、remove 缺 delete_api 等)",
|
|
5007
|
-
"KIT-AIT-006": "AI 页提交面拒收:persist 取了 registry(kit 目标只取 runtime / memory),或提交的源不是本目标 accept 出的"
|
|
5008
|
+
"KIT-AIT-006": "AI 页提交面拒收:persist 取了 registry(kit 目标只取 runtime / memory),或提交的源不是本目标 accept 出的",
|
|
5009
|
+
"KIT-APP-004": "应用扩展组件未经唯一接入路径登记(必须经 wrapKitDataComponent、composeKitDataComponents 或 declareKitUses 显式声明依赖组件与候选类,且候选类不得含非法任意值、依赖组件名必须在内置闭集内)",
|
|
5010
|
+
"KIT-APP-005": "应用扩展组件或组件目录源码私造已被 soma-kit 标准组件接管的非标原生控件(如原生 select、range、date/time)或书写内联 style 属性"
|
|
5008
5011
|
},
|
|
5009
5012
|
"diagnosticExamples": {
|
|
5010
5013
|
"note": "`soma kit explain <诊断码>` 的常见原因与正反示例;说明正文读 diagnostics 同码条目,这里只补原因与示例(YAML 片段)。未登记的码只打印说明。",
|
|
@@ -5101,6 +5104,22 @@
|
|
|
5101
5104
|
],
|
|
5102
5105
|
"bad": "{ \"frame\": \"topnav\", \"product\": \"crud\" }",
|
|
5103
5106
|
"good": "{ \"frame\": \"top-nav\", \"product\": \"crud\" }"
|
|
5107
|
+
},
|
|
5108
|
+
"KIT-APP-004": {
|
|
5109
|
+
"causes": [
|
|
5110
|
+
"在 soma.app.ts 的 baseComponents 或 staticObjectComponents 中直接传入未包装的野生组件定义,未调用 wrapKitDataComponent / composeKitDataComponents / declareKitUses",
|
|
5111
|
+
"declareKitUses 传入的 uses 含拼写错误的内置组件名,或 candidates 含方括号任意值类"
|
|
5112
|
+
],
|
|
5113
|
+
"bad": "staticObjectComponents: {\n AppPanel: RawCustomComponent\n}",
|
|
5114
|
+
"good": "staticObjectComponents: {\n AppPanel: declareKitUses(AppPanel, ['Select', 'Button'], APP_PANEL_CLASS_CANDIDATES)\n}"
|
|
5115
|
+
},
|
|
5116
|
+
"KIT-APP-005": {
|
|
5117
|
+
"causes": [
|
|
5118
|
+
"应用组件 templateHtml、控制器或 components/ 子模块手写原生 <select>、<input type=\"range\">、<input type=\"date\"> 等已被 soma-kit 标准组件接管的标签",
|
|
5119
|
+
"应用组件 templateHtml 含内联 style 属性"
|
|
5120
|
+
],
|
|
5121
|
+
"bad": "<select name=\"kind\"><option value=\"a\">甲</option></select>",
|
|
5122
|
+
"good": "mountKitSelectField({ options: [{ value: 'a', label: '甲' }], value: 'a' })"
|
|
5104
5123
|
}
|
|
5105
5124
|
},
|
|
5106
5125
|
"blockTheme": {
|
|
@@ -5110,7 +5129,86 @@
|
|
|
5110
5129
|
"page",
|
|
5111
5130
|
"product"
|
|
5112
5131
|
],
|
|
5113
|
-
"wrapperClass": "bg-surface text-fg"
|
|
5132
|
+
"wrapperClass": "bg-surface text-fg",
|
|
5133
|
+
"appTheme": {
|
|
5134
|
+
"note": "kit.app.yaml#app.theme 9 维正交页面主题 DSL 规格",
|
|
5135
|
+
"palette": [
|
|
5136
|
+
"CLASSIC_TECH_BLUE",
|
|
5137
|
+
"BUSINESS_INDIGO_BLUE",
|
|
5138
|
+
"FAR_MOUNTAIN_SKY",
|
|
5139
|
+
"GLACIER_STEEL_BLUE",
|
|
5140
|
+
"GOVERNMENT_RED",
|
|
5141
|
+
"PROSPEROUS_CHINA_RED",
|
|
5142
|
+
"AMBER_TERRACOTTA",
|
|
5143
|
+
"GILT_BUSINESS_BROWN",
|
|
5144
|
+
"FINANCIAL_EMERALD",
|
|
5145
|
+
"BAMBOO_FOREST_CYAN",
|
|
5146
|
+
"TURQUOISE_LAKE",
|
|
5147
|
+
"OLIVE_EARTH_GREEN",
|
|
5148
|
+
"INNOVATIVE_VIOLET",
|
|
5149
|
+
"LILAC_TWILIGHT",
|
|
5150
|
+
"CORAL_PEACH_PINK",
|
|
5151
|
+
"NEBULA_PLUM_PURPLE",
|
|
5152
|
+
"MINIMAL_MONOCHROME",
|
|
5153
|
+
"INDUSTRIAL_STEEL_GRAY",
|
|
5154
|
+
"WARM_XUAN_PAPER",
|
|
5155
|
+
"MATCHA_EYE_CARE",
|
|
5156
|
+
"DEEP_OCEAN_DARK",
|
|
5157
|
+
"GEEK_VIOLET_DARK",
|
|
5158
|
+
"OBSIDIAN_NIGHT_DARK",
|
|
5159
|
+
"FOREST_PINE_DARK"
|
|
5160
|
+
],
|
|
5161
|
+
"color_depth": [
|
|
5162
|
+
"NORMAL",
|
|
5163
|
+
"LIGHTENED",
|
|
5164
|
+
"DARKENED",
|
|
5165
|
+
"VERY_LIGHT",
|
|
5166
|
+
"SLIGHTLY_LIGHT",
|
|
5167
|
+
"STANDARD_DEPTH",
|
|
5168
|
+
"SLIGHTLY_DEEP",
|
|
5169
|
+
"VERY_DEEP"
|
|
5170
|
+
],
|
|
5171
|
+
"color_saturation": [
|
|
5172
|
+
"VIVID",
|
|
5173
|
+
"STANDARD_SATURATION",
|
|
5174
|
+
"SOFT_MUTED",
|
|
5175
|
+
"LOW_COLOR"
|
|
5176
|
+
],
|
|
5177
|
+
"font_family": [
|
|
5178
|
+
"SYSTEM_SANS",
|
|
5179
|
+
"GEOMETRIC_ROUNDED",
|
|
5180
|
+
"INDUSTRIAL_REPORT",
|
|
5181
|
+
"EDITORIAL_SERIF",
|
|
5182
|
+
"GEEK_MONO",
|
|
5183
|
+
"BOLD_DISPLAY"
|
|
5184
|
+
],
|
|
5185
|
+
"font_scale": [
|
|
5186
|
+
"SMALL_COMPACT",
|
|
5187
|
+
"MEDIUM_STANDARD",
|
|
5188
|
+
"LARGE_LOOSE",
|
|
5189
|
+
"XLARGE_DISPLAY"
|
|
5190
|
+
],
|
|
5191
|
+
"boundary": [
|
|
5192
|
+
"HAIRLINE_BORDER",
|
|
5193
|
+
"BORDERLESS_SHADOW"
|
|
5194
|
+
],
|
|
5195
|
+
"shape": [
|
|
5196
|
+
"STANDARD_ROUNDED",
|
|
5197
|
+
"SMALL_SHARP",
|
|
5198
|
+
"PILL_CAPSULE",
|
|
5199
|
+
"PURE_SQUARE"
|
|
5200
|
+
],
|
|
5201
|
+
"surface_texture": [
|
|
5202
|
+
"SOLID_MATTE",
|
|
5203
|
+
"FROSTED_GLASS",
|
|
5204
|
+
"SUBTLE_RELIEF"
|
|
5205
|
+
],
|
|
5206
|
+
"density": [
|
|
5207
|
+
"COMPACT_DENSE",
|
|
5208
|
+
"STANDARD_BALANCED",
|
|
5209
|
+
"SPACIOUS_AIRY"
|
|
5210
|
+
]
|
|
5211
|
+
}
|
|
5114
5212
|
},
|
|
5115
5213
|
"aiWriter": {
|
|
5116
5214
|
"limitsRef": "kit-limits#aiWriter",
|
|
@@ -5138,7 +5236,8 @@
|
|
|
5138
5236
|
"locale": "ai",
|
|
5139
5237
|
"dir": "human-only",
|
|
5140
5238
|
"theme": "ai",
|
|
5141
|
-
"envelope": "human-only"
|
|
5239
|
+
"envelope": "human-only",
|
|
5240
|
+
"inherit_layout": "human-only"
|
|
5142
5241
|
},
|
|
5143
5242
|
"frame": {
|
|
5144
5243
|
"kind": "ai",
|