soma-kit 0.1.12 → 0.1.13
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 -4
- package/bin/soma-kit.mjs +31 -1
- package/bin/soma.mjs +0 -0
- package/package.json +5 -4
- package/spec/generated/kit-app.schema.json +158 -4
- package/spec/generated/kit-page.schema.json +139 -5
- package/spec/kit-grammar.json +438 -87
- package/spec/kit-grammar.schema.json +11 -3
- package/src/app/app-config.ts +83 -5
- package/src/app/component-gate.ts +271 -13
- package/src/app/define-kit-app.ts +2 -2
- package/src/app/define-kit-view.ts +9 -5
- package/src/app/dev-diagnostic.ts +5 -0
- package/src/app/index.ts +17 -5
- package/src/app/kit-view-context.ts +163 -14
- package/src/app/render-ports.ts +18 -0
- package/src/app/server-pages.ts +3 -1
- package/src/app/server.ts +40 -3
- package/src/app/theme-runtime.ts +4 -0
- package/src/base/action-busy.ts +101 -4
- package/src/base/action-slots.ts +13 -2
- package/src/base/anchored-layer.ts +50 -0
- package/src/base/button.ts +57 -12
- package/src/base/check-core.ts +8 -0
- package/src/base/checkbox.ts +2 -1
- package/src/base/choice.ts +21 -2
- package/src/base/color-picker.ts +10 -5
- package/src/base/command-palette.ts +1 -1
- package/src/base/context-menu.ts +10 -7
- package/src/base/date-range.ts +7 -7
- package/src/base/date.ts +55 -16
- package/src/base/delta.ts +72 -0
- package/src/base/end-edge.ts +49 -0
- package/src/base/fab.ts +1 -1
- package/src/base/gap-value.ts +148 -0
- package/src/base/hint-tips.ts +170 -0
- package/src/base/icons.ts +8 -0
- package/src/base/illustrations.ts +94 -0
- package/src/base/index.ts +27 -9
- package/src/base/listbox-core.ts +6 -5
- package/src/base/loading-gate.ts +140 -87
- package/src/base/mentions.ts +2 -1
- package/src/base/menu-button.ts +23 -12
- package/src/base/menu-core.ts +37 -8
- package/src/base/motion/hover-3d.ts +1 -1
- package/src/base/motion/marquee.ts +1 -1
- package/src/base/otp.ts +5 -4
- package/src/base/overlay-runtime.ts +235 -0
- package/src/base/popover.ts +9 -9
- package/src/base/popup.ts +67 -8
- package/src/base/portal-core.ts +4 -0
- package/src/base/qty-stepper.ts +5 -5
- package/src/base/radio.ts +2 -1
- package/src/base/range.ts +19 -2
- package/src/base/rating.ts +11 -6
- package/src/base/reason-tip.ts +150 -0
- package/src/base/segmented.ts +24 -22
- package/src/base/shared.ts +169 -23
- package/src/base/state-panel.ts +346 -0
- package/src/base/status-tone.ts +27 -0
- package/src/base/sticky-edge.ts +116 -0
- package/src/base/swap.ts +6 -6
- package/src/base/switch.ts +10 -5
- package/src/base/tag-input.ts +6 -6
- package/src/base/tag.ts +63 -33
- package/src/base/text.ts +42 -13
- package/src/base/time-picker.ts +7 -5
- package/src/base/tree-select.ts +6 -4
- package/src/base/trend-tone.ts +9 -0
- package/src/base/upload.ts +15 -10
- package/src/base/view-transition.ts +77 -0
- package/src/biz/approval-desk/shell.ts +11 -8
- package/src/biz/auth-panel/shell.ts +5 -4
- package/src/biz/category-crud/compile.ts +2 -2
- package/src/biz/category-crud/shell.ts +2 -1
- package/src/biz/checkout-page/compile.ts +2 -1
- package/src/biz/checkout-page/shell.ts +4 -3
- package/src/biz/import-wizard/shell.ts +2 -1
- package/src/biz/link/hub.ts +23 -5
- package/src/biz/link/shared.ts +23 -12
- package/src/biz/master-sub/compile.ts +102 -10
- package/src/biz/master-sub/index.ts +5 -2
- package/src/biz/master-sub/shell.ts +95 -18
- package/src/biz/multi-board/compile.ts +4 -1
- package/src/biz/multi-board/shell.ts +8 -5
- package/src/biz/notification-center/shell.ts +6 -4
- package/src/biz/page-templates/result-page/shell.ts +2 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +2 -2
- package/src/biz/record-detail/compile.ts +2 -2
- package/src/biz/record-detail/shell.ts +8 -6
- package/src/biz/settings-center/compile.ts +2 -1
- package/src/biz/settings-center/shell.ts +6 -4
- package/src/biz/shared/action-host.ts +6 -0
- package/src/biz/shared/compile-helpers.ts +18 -0
- package/src/biz/shared/coordinator.ts +7 -30
- package/src/biz/shared/index.ts +5 -0
- package/src/biz/shared/object-aliases.ts +154 -0
- package/src/biz/shared/overlay-compile.ts +239 -0
- package/src/biz/shared/overlay-shell.ts +139 -10
- package/src/biz/shared/pipes.ts +11 -5
- package/src/biz/shared/remove-wire.ts +4 -19
- package/src/biz/shared/runtime-hub.ts +10 -0
- package/src/biz/single-form/compile.ts +3 -2
- package/src/biz/single-form/shell.ts +4 -3
- package/src/biz/standard-crud/compile.ts +22 -160
- package/src/biz/standard-crud/shell.ts +16 -44
- package/src/biz/step-form/shell.ts +5 -5
- package/src/cli/kit-cli.ts +138 -13
- package/src/cli/kit-init.ts +6 -1
- package/src/cli/layout-cli.ts +167 -0
- package/src/cli/migrate/index.ts +10 -0
- package/src/cli/migrate/migrate.ts +248 -0
- package/src/cli/migrate/text-utils.ts +306 -0
- package/src/cli/migrate/theme-map.ts +104 -0
- package/src/cli/migrate/ts-rules.ts +235 -0
- package/src/cli/migrate/types.ts +95 -0
- package/src/cli/migrate/view-skeleton.ts +159 -0
- package/src/cli/migrate/yaml-report.ts +376 -0
- package/src/cli/migrate/yaml-rules.ts +465 -0
- package/src/cli/view-writes.ts +69 -60
- package/src/compile/closed-set.ts +65 -4
- package/src/compile/compile-page.ts +51 -7
- package/src/compile/component-candidates.ts +12 -1
- package/src/compile/layout-lint/engine.ts +82 -0
- package/src/compile/layout-lint/index.ts +55 -0
- package/src/compile/layout-lint/rules-composition.ts +218 -0
- package/src/compile/layout-lint/rules-form.ts +192 -0
- package/src/compile/layout-lint/rules-table.ts +194 -0
- package/src/compile/layout-lint/score.ts +52 -0
- package/src/compile/layout-lint/types.ts +51 -0
- package/src/compile/remove-guard.ts +10 -7
- package/src/compile/styles.ts +36 -8
- package/src/compile/types.ts +13 -1
- package/src/compile/view-check.ts +149 -16
- package/src/data/amount-breakdown.ts +6 -1
- package/src/data/approval-flow.ts +1 -1
- package/src/data/assignment-picker.ts +53 -27
- package/src/data/async-result-panel.ts +49 -3
- package/src/data/breadcrumbs.ts +3 -2
- package/src/data/calendar.ts +2 -2
- package/src/data/carousel.ts +8 -6
- package/src/data/chart.ts +141 -10
- package/src/data/checklist.ts +18 -5
- package/src/data/code-view.ts +8 -4
- package/src/data/comment-thread.ts +2 -2
- package/src/data/confirm-dialog.ts +71 -18
- package/src/data/context-menu.ts +3 -3
- package/src/data/dock.ts +1 -1
- package/src/data/embed.ts +231 -29
- package/src/data/field-mapper.ts +4 -4
- package/src/data/flow-editor-contract.ts +7 -0
- package/src/data/flow-editor.ts +25 -9
- package/src/data/flow-node-options.ts +33 -3
- package/src/data/gantt.ts +5 -2
- package/src/data/hero.ts +2 -1
- package/src/data/image-viewer.ts +7 -4
- package/src/data/index.ts +6 -1
- package/src/data/item-list.ts +18 -10
- package/src/data/kanban.ts +39 -10
- package/src/data/media-grid.ts +6 -1
- package/src/data/mega-menu.ts +6 -4
- package/src/data/menu-dom.ts +4 -2
- package/src/data/menu.ts +45 -13
- package/src/data/mockup.ts +8 -4
- package/src/data/modal-dialog.ts +29 -9
- package/src/data/navbar.ts +5 -5
- package/src/data/notice-list.ts +268 -0
- package/src/data/notify-renderer.ts +21 -6
- package/src/data/object-form.ts +354 -48
- package/src/data/outcome-watch.ts +61 -2
- package/src/data/pager.ts +17 -7
- package/src/data/permission-matrix.ts +33 -11
- package/src/data/permission-tree.ts +47 -22
- package/src/data/pricing-table.ts +21 -11
- package/src/data/prompt-dialog.ts +165 -0
- package/src/data/reaction-bar.ts +6 -4
- package/src/data/record-card.ts +23 -2
- package/src/data/record-picker.ts +13 -7
- package/src/data/result-panel.ts +4 -2
- package/src/data/rich-text.ts +17 -1
- package/src/data/row-editor.ts +79 -26
- package/src/data/rule-builder.ts +8 -8
- package/src/data/shape-util.ts +23 -9
- package/src/data/stat-group.ts +170 -29
- package/src/data/static-lazy.ts +1 -0
- package/src/data/static-registry.ts +2 -0
- package/src/data/steps.ts +8 -3
- package/src/data/survey.ts +3 -3
- package/src/data/system-switcher.ts +1 -1
- package/src/data/text-action-button.ts +17 -0
- package/src/data/timeline.ts +17 -6
- package/src/data/tour-guide.ts +1 -1
- package/src/data/transfer.ts +36 -16
- package/src/data/tree-table.ts +62 -36
- package/src/data/tree.ts +22 -2
- package/src/data/virtual-rows.ts +19 -10
- package/src/data/wrapped-candidates.ts +10 -0
- package/src/frames/page-bar.ts +14 -13
- package/src/frames/page-status.ts +7 -5
- package/src/frames/shared.ts +15 -10
- package/src/frames/split-frame/shell.ts +1 -1
- package/src/frames/tabs-frame/shell.ts +2 -1
- package/src/frames/tabs-frame/wiring.ts +1 -0
- package/src/frames/top-main-frame.ts +2 -2
- package/src/frames/workspace-frame/extras.ts +1 -1
- package/src/frames/workspace-frame/shell.ts +2 -2
- package/src/frames/workspace-frame/view.ts +141 -33
- package/src/generated/kit-grammar-runtime.ts +239 -55
- package/src/i18n/kit-text.ts +63 -4
- package/src/i18n/resolve-text-refs.ts +22 -6
- package/src/object-renderer/arrange.ts +42 -8
- package/src/object-renderer/collection-parts.ts +241 -60
- package/src/object-renderer/collection-table.ts +109 -5
- package/src/object-renderer/collection.ts +174 -36
- package/src/object-renderer/compile-data.ts +28 -3
- package/src/object-renderer/defaults.ts +30 -2
- package/src/object-renderer/display-checks.ts +1 -1
- package/src/object-renderer/emit-events.ts +43 -9
- package/src/object-renderer/emit-static.ts +370 -30
- package/src/object-renderer/form-detail.ts +1 -2
- package/src/object-renderer/form-notify.ts +45 -0
- package/src/object-renderer/layout-facts.ts +386 -0
- package/src/object-renderer/layout-plan.ts +132 -0
- package/src/object-renderer/layout-plan.types.ts +22 -0
- package/src/object-renderer/parts.ts +252 -1
- package/src/object-renderer/render-object.ts +54 -6
- package/src/object-renderer/request-actions.ts +4 -2
- package/src/object-renderer/skeleton.ts +58 -19
- package/src/object-renderer/table-actions.ts +135 -27
- package/src/object-renderer/table-tools.ts +12 -11
- package/src/object-renderer/types.ts +78 -7
- package/src/object-renderer/view-binding.ts +205 -8
- package/src/page-target/intent-schema.ts +11 -0
- package/src/page-target/target.ts +5 -1
- package/src/recipes/container.ts +46 -1
- package/src/recipes/control.ts +70 -12
- package/src/recipes/index.ts +49 -0
- package/src/recipes/nowrap.ts +16 -0
- package/src/recipes/overlay.ts +75 -17
- package/src/recipes/placeholder.ts +79 -0
- package/src/recipes/rail-grid.ts +45 -0
- package/src/recipes/slot-align.ts +56 -0
- package/src/recipes/state.ts +34 -5
- package/src/recipes/status.ts +139 -0
- package/src/recipes/surface.ts +40 -0
- package/src/recipes/table-row.ts +40 -3
- package/src/recipes/title-row.ts +37 -0
- package/src/recipes/typography.ts +13 -1
- package/src/shared/confirm-decl.ts +118 -0
- package/src/shared/envelope.ts +2 -2
- package/src/shared/paged-list-adapter.ts +15 -240
- package/src/shared/theme-runtime-shared.ts +6 -1
- package/src/theme/index.ts +1 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +372 -12
- package/src/theme/kit-theme.tpl +372 -12
- package/src/theme/nine-dim-structure.ts +177 -7
- package/src/theme/surface-layers.ts +4 -0
- package/src/theme/theme-tokens.ts +53 -13
- package/src/theme/theme-types.ts +32 -0
- package/src/biz/shared/remove-key.ts +0 -6
|
@@ -24,8 +24,10 @@ import { registerSliceReload } from './filter-reload';
|
|
|
24
24
|
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow } from '../base/action-slots';
|
|
25
25
|
import { checkRequestFieldMapping, isRequestLikeAction, registerRequestAction } from './request-actions';
|
|
26
26
|
import { isValidBuiltinName, isValidPermissionCode, formatBuiltinInvalidMessage, formatPermissionInvalidMessage } from '../shared/action-field-guard';
|
|
27
|
+
import { checkKitConfirmObject, checkKitConfirmText, confirmScopeOfAction, confirmSegmentOfText, confirmToneOfAction, isConfirmObject } from '../shared/confirm-decl';
|
|
28
|
+
import { classifyEventBinding } from './view-binding';
|
|
27
29
|
export { checkRequestFieldMapping };
|
|
28
|
-
import { cellAnchor, ctxMenuAnchor, expandCellAnchor, expandToggleAnchor, opsAnchor, rowsAnchor, selAnchor, staticCtxAnchor, toolbarAnchor, toolsAnchor, treeAnchor, viewAnchor, virtualAnchor } from './emit-static';
|
|
30
|
+
import { cellAnchor, collectionMetaOf, ctxMenuAnchor, expandCellAnchor, expandToggleAnchor, metaAnchor, opsAnchor, rowsAnchor, selAnchor, staticCtxAnchor, stateAnchor, toolbarAnchor, toolsAnchor, treeAnchor, viewAnchor, virtualAnchor } from './emit-static';
|
|
29
31
|
|
|
30
32
|
export interface KitEventOptions {
|
|
31
33
|
/** behavior.actions 全表(解析 cell.action 与工具栏动作) */
|
|
@@ -90,6 +92,11 @@ function permissionOf(action: KitAction, at: string, diagnostics: KitDiagnostic[
|
|
|
90
92
|
return p;
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
/** 事件绑展示对象方法的管道(动作 submit: view.<方法>、view.on / 浮层 events 的 view.<方法> 共用):UI_REFRESH | page.<方法>,载荷(组件 emit 的载荷 / 行动作信息)交方法第二参 */
|
|
96
|
+
export function viewMethodPipe(method: string): string {
|
|
97
|
+
return `UI_REFRESH | page.${method}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
93
100
|
/** 一个动作 -> 管道串;失败返回 null 并记诊断 */
|
|
94
101
|
export function actionPipeline(
|
|
95
102
|
action: KitAction,
|
|
@@ -141,25 +148,42 @@ export function actionPipeline(
|
|
|
141
148
|
return null;
|
|
142
149
|
}
|
|
143
150
|
}
|
|
151
|
+
let confirmSegment: string | undefined;
|
|
144
152
|
if (action.confirm !== undefined) {
|
|
145
|
-
if (
|
|
146
|
-
|
|
153
|
+
if (isConfirmObject(action.confirm)) {
|
|
154
|
+
// 对象形(字面量版):编成 core 的结构化确认段 confirm:{…JSON};规则与诊断在 shared/confirm-decl(判据是 core 的 checkConfirmSpec)
|
|
155
|
+
const checked = checkKitConfirmObject(action.confirm, confirmScopeOfAction(action.on), confirmToneOfAction(action));
|
|
156
|
+
if (!checked.ok) {
|
|
157
|
+
diagnostics.push({ code: 'KIT-ACT-010', path: `${at}.confirm`, message: `动作 ${action.id ?? ''} 的 confirm:${checked.error}` });
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
confirmSegment = checked.segment;
|
|
161
|
+
} else if (typeof action.confirm !== 'string') {
|
|
162
|
+
diagnostics.push({ code: 'KIT-ACT-010', path: `${at}.confirm`, message: `动作 ${action.id ?? ''} 的 confirm 必须是字符串或 { level, text, phrase?, impact? } 对象(收到 ${Array.isArray(action.confirm) ? 'array' : typeof action.confirm})` });
|
|
147
163
|
return null;
|
|
148
164
|
}
|
|
149
|
-
if (action.confirm
|
|
150
|
-
|
|
151
|
-
|
|
165
|
+
if (typeof action.confirm === 'string') {
|
|
166
|
+
const problem = checkKitConfirmText(action.confirm, confirmScopeOfAction(action.on));
|
|
167
|
+
if (problem !== null) {
|
|
168
|
+
diagnostics.push({ code: 'KIT-ACT-010', message: `动作 ${action.id} 的 confirm ${problem}`, path: `${at}.confirm` });
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
152
171
|
}
|
|
153
172
|
}
|
|
154
173
|
|
|
155
174
|
let name: string;
|
|
156
175
|
let segments: string[] = [];
|
|
176
|
+
const submitEvt = classifyEventBinding(action.submit, 'submit');
|
|
157
177
|
if (isRequestLikeAction(action)) {
|
|
158
178
|
name = '';
|
|
159
179
|
// 声明式请求 / 下载:编成交页面级 KitActionHost 的语义事件(尾段 confirm / permission 与其它动作同口径)
|
|
160
180
|
const base = registerRequestAction(action, options.object ?? '', at, diagnostics, options.keyField === undefined ? {} : { keyField: options.keyField });
|
|
161
181
|
if (base === null) return null;
|
|
162
182
|
segments = base.split(' | ');
|
|
183
|
+
} else if (submitEvt.kind === 'method') {
|
|
184
|
+
// 事件绑展示对象方法(submit: view.<方法>):编成 UI_REFRESH | page.<方法>,载荷(行 / 动作信息)交方法第二参;方法是否登记由 compile/view-check 核(KIT-VIEW-002 / 004)
|
|
185
|
+
name = '';
|
|
186
|
+
segments = viewMethodPipe(submitEvt.name).split(' | ');
|
|
163
187
|
} else if (action.submit !== undefined && action.submit !== '') {
|
|
164
188
|
name = action.submit;
|
|
165
189
|
if (options.registeredActions !== undefined && !options.registeredActions.has(name)) {
|
|
@@ -172,9 +196,10 @@ export function actionPipeline(
|
|
|
172
196
|
diagnostics.push({ code: 'KIT-EVT-001', message: `动作 ${action.id} 既没有 submit / builtin,也没有 request / download`, path: at });
|
|
173
197
|
return null;
|
|
174
198
|
}
|
|
175
|
-
if (!isRequestLikeAction(action)) segments = ['ACTION', name];
|
|
176
|
-
if (
|
|
177
|
-
|
|
199
|
+
if (!isRequestLikeAction(action) && segments.length === 0) segments = ['ACTION', name];
|
|
200
|
+
if (confirmSegment !== undefined) segments.push(confirmSegment);
|
|
201
|
+
else if (typeof action.confirm === 'string' && action.confirm !== '') {
|
|
202
|
+
segments.push(confirmSegmentOfText(action.confirm, confirmToneOfAction(action)));
|
|
178
203
|
}
|
|
179
204
|
const permission = permissionOf(action, at, diagnostics);
|
|
180
205
|
if (permission !== null) segments.push(`permission:${permission}`);
|
|
@@ -213,6 +238,9 @@ function viewOnEvent(
|
|
|
213
238
|
return undefined;
|
|
214
239
|
};
|
|
215
240
|
if (typeof value === 'string') {
|
|
241
|
+
// view.<方法>:组件抛出的事件调展示对象方法(载荷 = 组件 emit 的载荷);组件事件不经具名动作、不写数据,方法里要写请求走 ctx.request / ctx.action
|
|
242
|
+
const evt = classifyEventBinding(value, at);
|
|
243
|
+
if (evt.kind === 'method') return viewMethodPipe(evt.name);
|
|
216
244
|
const hit = requestLike(value);
|
|
217
245
|
if (hit !== undefined) return actionPipeline(hit, `behavior.actions.${hit.id}`, options, diagnostics);
|
|
218
246
|
// 只认自有键:动作名叫 constructor / toString 时不能命中原型上的函数
|
|
@@ -314,6 +342,12 @@ export function emitEvents(ir: KitObjectIR, rawOptions: KitEventOptions): KitEve
|
|
|
314
342
|
events[`${id}.submit`] = apply;
|
|
315
343
|
events[`${id}.reset`] = apply;
|
|
316
344
|
registerSliceReload({ scope, slice: 'filter', reload: [{ scope }] });
|
|
345
|
+
// 集合的「清除筛选」兜底(空态面板 / 标题旁提示;优先点筛选栏自己的「重置」,找不到才抛 clear_filter):同一条 SCOPE | set filter 管道,不直调数据写入
|
|
346
|
+
const listLayout = ir.views.list?.layout;
|
|
347
|
+
if (listLayout !== undefined && (listLayout.kind === 'table' || listLayout.kind === 'cards' || listLayout.kind === 'stack')) {
|
|
348
|
+
events[`${stateAnchor(object)}.clear_filter`] = apply;
|
|
349
|
+
if (collectionMetaOf(ir)?.hint === true) events[`${metaAnchor(object)}.clear_filter`] = apply;
|
|
350
|
+
}
|
|
317
351
|
}
|
|
318
352
|
|
|
319
353
|
// 可编辑表单:提交走内置 data.submit,载荷由 KitObjectForm 自己组装 { object, model, mode, scope }
|