soma-kit 0.1.15 → 0.1.16
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 +1 -1
- package/package.json +8 -5
- package/packs/ai/model-card.ts +3 -3
- package/packs/ops/error-budget-card.ts +3 -3
- package/packs/ops/release-readiness-card.ts +3 -3
- package/packs/security/control-evidence-card.ts +3 -3
- package/packs/security/finding-card.ts +3 -2
- package/packs/shared/card-util.ts +17 -0
- package/spec/generated/kit-app.schema.json +2148 -340
- package/spec/generated/kit-page.schema.json +1134 -139
- package/spec/kit-grammar.json +934 -92
- package/spec/kit-grammar.schema.json +167 -2
- package/src/app/app-config.ts +219 -186
- package/src/app/define-kit-actions.ts +126 -20
- package/src/app/define-kit-app.ts +49 -4
- package/src/app/index.ts +5 -0
- package/src/app/kit-view-context.ts +39 -1
- package/src/app/list-page-defaults.ts +14 -0
- package/src/app/server-pages.ts +239 -7
- package/src/app/server.ts +466 -25
- package/src/app/theme-endpoint.ts +67 -23
- package/src/app/theme-runtime.ts +414 -85
- package/src/app/theme-shards.ts +69 -0
- package/src/app/tier-compat.ts +107 -0
- package/src/base/action-busy.ts +215 -38
- package/src/base/affix.ts +137 -0
- package/src/base/alert.ts +104 -59
- package/src/base/anchored-layer.ts +7 -6
- package/src/base/avatar.ts +147 -61
- package/src/base/badge.ts +186 -0
- package/src/base/button-group.ts +227 -0
- package/src/base/button.ts +347 -50
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +143 -32
- package/src/base/check-core.ts +193 -33
- package/src/base/checkbox.ts +67 -2
- package/src/base/choice.ts +132 -31
- package/src/base/collapse.ts +249 -0
- package/src/base/color-picker.ts +399 -27
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +148 -36
- package/src/base/context-menu.ts +23 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +114 -96
- package/src/base/date.ts +481 -74
- package/src/base/delta.ts +16 -9
- package/src/base/divider.ts +51 -33
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +57 -21
- package/src/base/gap-value.ts +34 -15
- package/src/base/hint-tips.ts +99 -29
- package/src/base/identity-cells.ts +839 -0
- package/src/base/illustrations.ts +6 -4
- package/src/base/image.ts +40 -19
- package/src/base/index.ts +79 -22
- package/src/base/inline-error.ts +13 -7
- package/src/base/input.ts +135 -35
- package/src/base/kbd.ts +30 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +282 -101
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +55 -22
- package/src/base/menu-button.ts +73 -22
- package/src/base/menu-core.ts +201 -24
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +7 -5
- package/src/base/motion/hover-gallery.ts +16 -12
- package/src/base/motion/limits.ts +10 -0
- package/src/base/motion/marquee.ts +18 -11
- package/src/base/motion/text-rotate.ts +34 -16
- package/src/base/notification.ts +292 -0
- package/src/base/number.ts +93 -12
- package/src/base/otp.ts +139 -27
- package/src/base/overlay-runtime.ts +30 -23
- package/src/base/overlay-shell.ts +59 -14
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +624 -73
- package/src/base/popup.ts +187 -52
- package/src/base/portal-core.ts +99 -2
- package/src/base/price-text.ts +51 -17
- package/src/base/progress.ts +100 -18
- package/src/base/qr-code.ts +64 -17
- package/src/base/qty-stepper.ts +141 -22
- package/src/base/radio.ts +43 -2
- package/src/base/range.ts +194 -39
- package/src/base/rating.ts +117 -31
- package/src/base/reason-tip.ts +58 -16
- package/src/base/relation-cells.ts +541 -0
- package/src/base/resize-handle.ts +5 -3
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +70 -26
- package/src/base/select.ts +8 -3
- package/src/base/shared.ts +482 -71
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/sticky-edge.ts +96 -29
- package/src/base/swap.ts +39 -21
- package/src/base/switch.ts +158 -38
- package/src/base/tabs.ts +292 -0
- package/src/base/tag-input.ts +123 -54
- package/src/base/tag.ts +184 -66
- package/src/base/text.ts +461 -71
- package/src/base/textarea.ts +88 -39
- package/src/base/time-picker.ts +335 -55
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +342 -88
- package/src/base/upload.ts +604 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +70 -5
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +52 -12
- package/src/biz/auth-panel/compile.ts +13 -3
- package/src/biz/auth-panel/shell.ts +27 -7
- package/src/biz/category-crud/compile.ts +51 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +29 -9
- package/src/biz/checkout-page/compile.ts +37 -3
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +26 -9
- package/src/biz/compose.ts +6 -1
- package/src/biz/data-components.ts +2 -0
- package/src/biz/import-wizard/compile.ts +4 -1
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +32 -18
- package/src/biz/index.ts +1 -1
- package/src/biz/landing-page/compile.ts +3 -2
- package/src/biz/landing-page/shell.ts +22 -3
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +54 -15
- package/src/biz/master-sub/compile.ts +194 -57
- package/src/biz/master-sub/detail-head.ts +141 -18
- package/src/biz/master-sub/index.ts +3 -0
- package/src/biz/master-sub/shell.ts +186 -57
- package/src/biz/multi-board/compile.ts +87 -36
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +3 -2
- package/src/biz/multi-board/prose-fold.ts +15 -11
- package/src/biz/multi-board/shell.ts +148 -37
- package/src/biz/notification-center/compile.ts +20 -6
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +43 -10
- package/src/biz/page-templates/domain-templates.ts +145 -22
- package/src/biz/page-templates/result-page/compile.ts +4 -1
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +17 -4
- package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
- package/src/biz/record-detail/compile.ts +39 -11
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +41 -10
- package/src/biz/settings-center/compile.ts +4 -1
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +30 -9
- package/src/biz/shared/action-host.ts +137 -46
- package/src/biz/shared/compile-helpers.ts +130 -28
- package/src/biz/shared/coordinator.ts +628 -147
- package/src/biz/shared/focus-return.ts +180 -0
- package/src/biz/shared/object-aliases.ts +7 -1
- package/src/biz/shared/overlay-compile.ts +58 -10
- package/src/biz/shared/overlay-shell.ts +40 -10
- package/src/biz/shared/page-form-actions.ts +151 -0
- package/src/biz/shared/page-form.ts +255 -0
- package/src/biz/shared/pipeline.ts +74 -0
- package/src/biz/shared/runtime-hub.ts +101 -8
- package/src/biz/shared/verbs.ts +129 -0
- package/src/biz/single-form/compile.ts +4 -2
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +21 -11
- package/src/biz/standard-crud/compile.ts +206 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +82 -22
- package/src/biz/standard-crud/summary.ts +2 -37
- package/src/biz/step-form/compile.ts +12 -3
- package/src/biz/step-form/hub.ts +165 -50
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +31 -15
- package/src/biz/types.ts +40 -4
- package/src/cli/kit-cli.ts +145 -26
- package/src/cli/kit-init.ts +3 -3
- package/src/cli/migrate/theme-map.ts +35 -28
- package/src/cli/migrate/ts-rules.ts +2 -2
- package/src/cli/migrate/types.ts +3 -3
- package/src/cli/migrate/yaml-rules.ts +11 -9
- package/src/cli/view-writes.ts +13 -0
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +446 -53
- package/src/compile/component-candidates.ts +56 -4
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +1 -1
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/rules-composition.ts +2 -1
- package/src/compile/layout-lint/rules-table.ts +4 -19
- package/src/compile/look-page.ts +551 -0
- package/src/compile/look.ts +376 -0
- package/src/compile/page-composition.ts +382 -46
- package/src/compile/page-hierarchy.ts +131 -0
- package/src/compile/page-pipeline-look.ts +156 -0
- package/src/compile/page-pipeline.ts +200 -0
- package/src/compile/parse.ts +12 -11
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +645 -28
- package/src/compile/styles.ts +226 -26
- package/src/compile/types.ts +62 -5
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +49 -22
- package/src/data/anchor-nav.ts +73 -15
- package/src/data/approval-flow.ts +210 -124
- package/src/data/assignment-picker.ts +163 -85
- package/src/data/async-result-panel.ts +110 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +141 -19
- package/src/data/calendar.ts +434 -96
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +72 -38
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +904 -77
- package/src/data/checklist.ts +78 -35
- package/src/data/code-view.ts +106 -48
- package/src/data/comment-thread.ts +607 -87
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +198 -30
- package/src/data/context-menu.ts +95 -21
- package/src/data/d9-limits.ts +2 -0
- package/src/data/d9-util.ts +13 -5
- package/src/data/diff.ts +107 -50
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +33 -17
- package/src/data/embed.ts +142 -7
- package/src/data/engine-ports.ts +13 -4
- package/src/data/field-mapper.ts +104 -48
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +603 -142
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +85 -27
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +637 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +38 -15
- package/src/data/image-viewer.ts +261 -62
- package/src/data/index.ts +63 -1
- package/src/data/item-list.ts +217 -57
- package/src/data/json-view.ts +165 -100
- package/src/data/kanban.ts +339 -87
- package/src/data/kit-contract.ts +230 -0
- package/src/data/leaderboard.ts +343 -0
- package/src/data/level-class.ts +21 -0
- package/src/data/log-stream.ts +347 -0
- package/src/data/markdown-view.ts +155 -45
- package/src/data/matrix.ts +217 -112
- package/src/data/media-grid.ts +162 -38
- package/src/data/mega-menu.ts +39 -23
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +50 -15
- package/src/data/menu.ts +131 -47
- package/src/data/mockup.ts +30 -22
- package/src/data/modal-dialog.ts +90 -13
- package/src/data/navbar.ts +143 -61
- package/src/data/notice-list.ts +100 -48
- package/src/data/notify-renderer.ts +61 -7
- package/src/data/object-form.ts +1389 -130
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +122 -42
- package/src/data/panel-head.ts +237 -75
- package/src/data/permission-matrix.ts +371 -119
- package/src/data/permission-tree.ts +135 -80
- package/src/data/pricing-table.ts +106 -42
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +63 -31
- package/src/data/record-card.ts +239 -70
- package/src/data/record-picker.ts +56 -27
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +131 -41
- package/src/data/resident.ts +11 -1
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +206 -35
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +376 -102
- package/src/data/rule-builder.ts +129 -80
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +86 -43
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +438 -86
- package/src/data/static-lazy.ts +18 -0
- package/src/data/static-registry.ts +38 -2
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +63 -34
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +128 -47
- package/src/data/system-switcher.ts +40 -20
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +99 -31
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +110 -47
- package/src/data/transfer.ts +195 -47
- package/src/data/tree-table.ts +194 -112
- package/src/data/tree.ts +191 -70
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +242 -102
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +26 -4
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +1 -2
- package/src/frames/inherited-shell.ts +54 -13
- package/src/frames/page-bar.ts +205 -27
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +0 -2
- package/src/frames/shared.ts +64 -21
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +11 -7
- package/src/frames/split-frame/wiring.ts +14 -10
- package/src/frames/tabs-frame/shell.ts +3 -2
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +2 -0
- package/src/frames/workspace-frame/extras.ts +5 -3
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/pipeline-key.ts +6 -0
- package/src/frames/workspace-frame/shell.ts +22 -2
- package/src/frames/workspace-frame/state.ts +42 -14
- package/src/frames/workspace-frame/view.ts +697 -167
- package/src/generated/kit-grammar-runtime.ts +1015 -53
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +96 -3
- package/src/object-renderer/action-group.ts +175 -23
- package/src/object-renderer/action-more.ts +48 -17
- package/src/object-renderer/arrange.ts +241 -29
- package/src/object-renderer/category-tone.ts +96 -0
- package/src/object-renderer/collapse-wiring.ts +19 -9
- package/src/object-renderer/collection-expand.ts +3 -3
- package/src/object-renderer/collection-parts.ts +432 -107
- package/src/object-renderer/collection-table.ts +347 -45
- package/src/object-renderer/collection.ts +291 -62
- package/src/object-renderer/compile-data.ts +12 -2
- package/src/object-renderer/defaults.ts +6 -5
- package/src/object-renderer/emit-events.ts +45 -19
- package/src/object-renderer/emit-object.ts +35 -9
- package/src/object-renderer/emit-static.ts +734 -159
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +105 -18
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +18 -2
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +44 -2
- package/src/object-renderer/pick-component.ts +8 -2
- package/src/object-renderer/pipeline-mode.ts +6 -0
- package/src/object-renderer/relation-field.ts +79 -0
- package/src/object-renderer/render-object.ts +71 -26
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +424 -103
- package/src/object-renderer/table-gap.ts +2 -1
- package/src/object-renderer/table-reorder.ts +237 -0
- package/src/object-renderer/table-summary.ts +26 -12
- package/src/object-renderer/table-tools.ts +428 -128
- package/src/object-renderer/types.ts +91 -2
- package/src/object-renderer/value-present.ts +49 -0
- package/src/page-target/ai-surface.ts +15 -22
- package/src/page-target/compile.ts +5 -6
- package/src/page-target/drift.ts +0 -7
- package/src/page-target/intent-schema.ts +46 -43
- package/src/page-target/target.ts +4 -5
- package/src/page-target/writer-policy.ts +4 -5
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +15 -14
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +3 -2
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +76 -19
- package/src/recipes/control.ts +64 -5
- package/src/recipes/desc-list.ts +101 -7
- package/src/recipes/divider.ts +30 -9
- package/src/recipes/emphasis.ts +90 -5
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +3 -2
- package/src/recipes/index.ts +28 -4
- package/src/recipes/inherited-shell.ts +21 -15
- package/src/recipes/json-view.ts +6 -5
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +16 -6
- package/src/recipes/overlay.ts +47 -19
- package/src/recipes/page-width.ts +31 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +37 -19
- package/src/recipes/rail-grid.ts +6 -3
- package/src/recipes/self-owned.ts +59 -0
- package/src/recipes/slot-align.ts +5 -3
- package/src/recipes/stat-state.ts +5 -5
- package/src/recipes/state.ts +54 -3
- package/src/recipes/status.ts +14 -14
- package/src/recipes/strip.ts +47 -5
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +33 -4
- package/src/recipes/table-gap.ts +3 -2
- package/src/recipes/table-native-edit.ts +22 -9
- package/src/recipes/table-row.ts +45 -12
- package/src/recipes/tabs.ts +54 -22
- package/src/recipes/text-diff.ts +15 -8
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +68 -3
- package/src/shared/action-func.ts +106 -0
- package/src/shared/color-scheme.ts +127 -0
- package/src/shared/confirm-decl.ts +5 -2
- package/src/shared/danger-facts.ts +55 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +58 -12
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/icons.ts +28 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/shared/order-value.ts +15 -0
- package/src/shared/page-attrs-runtime.ts +327 -0
- package/src/shared/page-attrs.ts +262 -0
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +165 -24
- package/src/shared/theme-usage.ts +16 -0
- package/src/shared/value-table-contract.ts +68 -0
- package/src/spatial/action-func.ts +4 -0
- package/src/spatial/declared-actions.ts +116 -0
- package/src/spatial/emit.ts +660 -0
- package/src/spatial/expand.ts +1482 -0
- package/src/spatial/field-types.ts +48 -0
- package/src/spatial/index.ts +82 -0
- package/src/spatial/layout.ts +697 -0
- package/src/spatial/look-apply.ts +206 -0
- package/src/spatial/page-decl.ts +44 -0
- package/src/spatial/page-object.ts +349 -0
- package/src/spatial/recognize.ts +491 -0
- package/src/spatial/self-report.ts +571 -0
- package/src/spatial/shape.ts +205 -0
- package/src/spatial/spatial-map.ts +136 -0
- package/src/spatial/tone.ts +145 -0
- package/src/theme/index.ts +11 -2
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +527 -16
- package/src/theme/kit-theme.tpl +491 -16
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +522 -185
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +3 -2
- package/src/theme/theme-tokens.ts +1601 -93
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/frames/list-summary.ts +0 -123
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
|
@@ -200,7 +200,7 @@ export function zoneOfPath(rel: string): TsZone {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
// ---------------------------------------------------------------- package.json 依赖版本核对
|
|
203
|
-
const CURRENT_KIT: readonly [number, number, number] = [0, 1,
|
|
203
|
+
const CURRENT_KIT: readonly [number, number, number] = [0, 1, 15];
|
|
204
204
|
|
|
205
205
|
function versionTuple(spec: string): [number, number, number] | undefined {
|
|
206
206
|
const m = /(\d+)\.(\d+)\.(\d+)/.exec(spec);
|
|
@@ -212,7 +212,7 @@ const lessThan = (a: readonly number[], b: readonly number[]): boolean => {
|
|
|
212
212
|
return false;
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
-
/** package.json 里 soma-kit 版本低于 0.1.
|
|
215
|
+
/** package.json 里 soma-kit 版本低于 0.1.15 时出报告项(不自动改 package.json:装包与锁文件由你自己跑) */
|
|
216
216
|
export function reportPackageJson(text: string, file: string): MigrateFinding[] {
|
|
217
217
|
const out: MigrateFinding[] = [];
|
|
218
218
|
const lines = text.split(/\r?\n/);
|
package/src/cli/migrate/types.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface MigrateReport {
|
|
|
53
53
|
/** 规则册:编号 -> 一句话说明(报告分组标题与 explain 共用) */
|
|
54
54
|
export const MIGRATE_RULES: Readonly<Record<string, string>> = {
|
|
55
55
|
// 自动改写
|
|
56
|
-
'AUTO-THEME': 'kit.app.yaml
|
|
56
|
+
'AUTO-THEME': 'kit.app.yaml 的旧主题键(palette_scheme / font_scheme / color)改写为主题维度(palette / font_family)',
|
|
57
57
|
'AUTO-EYEBROW': '删除 page.eyebrow',
|
|
58
58
|
'AUTO-DENSITY': '删除 collection.density(密度只在 theme.density,KIT-OBJ-011)',
|
|
59
59
|
'AUTO-REQ-OK': '删除被应用信封覆盖的 request.ok 判定',
|
|
@@ -77,7 +77,7 @@ export const MIGRATE_RULES: Readonly<Record<string, string>> = {
|
|
|
77
77
|
'MANUAL-NATIVE-DIALOG': 'window.prompt / confirm / alert:改用 ctx.prompt / ctx.confirm / 具名动作 notify',
|
|
78
78
|
'MANUAL-DOM-OUTSIDE': 'components/ 之外的 DOM 访问与事件绑定',
|
|
79
79
|
'MANUAL-THEME': '主题映射只是最近似:需要人工看一眼配色与字体(回落默认的写了 TODO)',
|
|
80
|
-
'MANUAL-DEPS': '依赖版本:soma-kit 升到 0.1.
|
|
80
|
+
'MANUAL-DEPS': '依赖版本:soma-kit 升到 0.1.15',
|
|
81
81
|
'MANUAL-TS-CORE-IMPORT': "无法机械改写的 soma-core 导入(含 soma-kit/app 未再导出的名字或子路径)",
|
|
82
82
|
'MANUAL-TS-NEXT': '无法机械改写的 next/server 用法',
|
|
83
83
|
};
|
|
@@ -85,7 +85,7 @@ export const MIGRATE_RULES: Readonly<Record<string, string>> = {
|
|
|
85
85
|
export const MIGRATE_USAGE = [
|
|
86
86
|
'Usage:',
|
|
87
87
|
' soma kit migrate [应用目录] [--write] [--json] [--emit-views]',
|
|
88
|
-
' 把 soma-kit 0.1.6 时代的写法升级到 0.1.
|
|
88
|
+
' 把 soma-kit 0.1.6 时代的写法升级到 0.1.15:机械改写 + 只报告项(含展示对象骨架)',
|
|
89
89
|
' 缺省只演练(dry-run):列出将发生的改写与报告项,不动任何文件',
|
|
90
90
|
' --write 真正写盘(YAML 只做行内定点改动,保留注释与排版;二次运行零改动)',
|
|
91
91
|
' --json 在标准输出打印机器可读 JSON(MigrateReport)',
|
|
@@ -168,7 +168,7 @@ function planBody(pairs: readonly BodyPair[]): BodyPlan | { bad: Array<[string,
|
|
|
168
168
|
function bodyRecipe(bad: ReadonlyArray<[string, string]>): string {
|
|
169
169
|
const rows = bad.map(([k, v]) => ` ${k}: ${v}`).join('\n');
|
|
170
170
|
return [
|
|
171
|
-
'这些键值无法机械翻译(0.1.
|
|
171
|
+
'这些键值无法机械翻译(0.1.15 的 request 只认 pick / bodyMap,不再有 $ 取值路径):',
|
|
172
172
|
rows,
|
|
173
173
|
'按来源处理:',
|
|
174
174
|
' $row.<同名字段> -> pick: [字段](载荷取当前行同名字段)',
|
|
@@ -377,14 +377,14 @@ function ruleOverlayEvents(c: Ctx): void {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
// ---------------------------------------------------------------- 规则 8
|
|
380
|
+
// ---------------------------------------------------------------- 规则 8:主题维度
|
|
381
381
|
function ruleTheme(c: Ctx): void {
|
|
382
382
|
for (const l of c.ys) {
|
|
383
383
|
if (l.cont || l.key !== 'theme') continue;
|
|
384
384
|
if (l.value.startsWith('{')) {
|
|
385
385
|
if ([...LEGACY_PALETTE_KEYS, ...LEGACY_FONT_KEYS].some((k) => new RegExp(`\\b${k}\\s*:`).test(l.value))) {
|
|
386
386
|
c.covered.add(l.i);
|
|
387
|
-
finding(c, 'MANUAL-THEME', l.i, 'theme 写成了单行 flow 且含旧主题键,不做机械改写',
|
|
387
|
+
finding(c, 'MANUAL-THEME', l.i, 'theme 写成了单行 flow 且含旧主题键,不做机械改写', `改成块形式后再运行 migrate,或直接按主题维度写:theme: { palette: ${DEFAULT_PALETTE}, font_family: ${DEFAULT_FONT_FAMILY}, mode: light }`);
|
|
388
388
|
}
|
|
389
389
|
continue;
|
|
390
390
|
}
|
|
@@ -407,15 +407,15 @@ function ruleTheme(c: Ctx): void {
|
|
|
407
407
|
const map = mapPaletteScheme(pal === undefined ? undefined : unquote(pal.value));
|
|
408
408
|
fresh.push(`${pad}palette: ${map.palette} # 迁移自 ${pal !== undefined ? `${pal.key}: ${unquote(pal.value)}` : 'color(品牌色号已删除)'},请核对配色`);
|
|
409
409
|
if (map.quality === 'default') {
|
|
410
|
-
finding(c, 'MANUAL-THEME', (pal ?? color!).i, `旧配色 ${pal === undefined ? '(只有品牌色 color)' : unquote(pal.value)}
|
|
410
|
+
finding(c, 'MANUAL-THEME', (pal ?? color!).i, `旧配色 ${pal === undefined ? '(只有品牌色 color)' : unquote(pal.value)} 没有已知的对应 palette,回落 ${DEFAULT_PALETTE}`, `TODO:在色族与同族变体里选最接近的(见 soma-design 的 kit-nine-dim.json#palettes),外壳用 shell 选。`);
|
|
411
411
|
} else {
|
|
412
|
-
finding(c, 'MANUAL-THEME', pal!.i, `旧配色 ${unquote(pal!.value)} 映射为 ${map.palette}(最近似,不保证逐像素一致${map.dark ? ';这是暗色板,确认 mode' : ''})`, '
|
|
412
|
+
finding(c, 'MANUAL-THEME', pal!.i, `旧配色 ${unquote(pal!.value)} 映射为 ${map.palette}(最近似,不保证逐像素一致${map.dark ? ';这是暗色板,确认 mode' : ''})`, '打开页面核对主色、页底与文字;不满意就换一个 palette 色族。');
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
if (!hasFamily && font !== undefined) {
|
|
416
416
|
const map = mapFontScheme(unquote(font.value));
|
|
417
417
|
fresh.push(`${pad}font_family: ${map.family} # 迁移自 ${font.key}: ${unquote(font.value)}`);
|
|
418
|
-
if (map.quality === 'default') finding(c, 'MANUAL-THEME', font.i, `旧字体方案 ${unquote(font.value)}
|
|
418
|
+
if (map.quality === 'default') finding(c, 'MANUAL-THEME', font.i, `旧字体方案 ${unquote(font.value)} 没有对应的 font_family,回落 ${DEFAULT_FONT_FAMILY}`, 'TODO:在 sans / editorial-serif / display-serif 里选(真源 kit-nine-dim.json#dimensions.fontFamily)。');
|
|
419
419
|
}
|
|
420
420
|
if (color !== undefined) notes.push(`品牌色号 color: ${unquote(color.value)} 已删除,色相由 palette 决定`);
|
|
421
421
|
const legacy = [pal, font, color].filter((x): x is YLine => x !== undefined).sort((a, b) => a.i - b.i);
|
|
@@ -423,11 +423,11 @@ function ruleTheme(c: Ctx): void {
|
|
|
423
423
|
const end = k.i + 1;
|
|
424
424
|
c.edits.push({ from: k.i, to: end, replacement: n === 0 ? fresh : [] });
|
|
425
425
|
});
|
|
426
|
-
change(c, 'AUTO-THEME', legacy[0]!.i,
|
|
426
|
+
change(c, 'AUTO-THEME', legacy[0]!.i, `旧主题键改为主题维度:${legacy.map((k) => k.key).join(' / ')} -> ${fresh.length > 0 ? fresh.map((x) => /^[^:\s]+/.exec(x.trim())?.[0] ?? '').join(' / ') : '(删除)'}${notes.length > 0 ? `;${notes.join(';')}` : ''}`, legacy.map((k) => k.text).join(' | '), fresh.join(' | '));
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
// ---------------------------------------------------------------- 规则 9
|
|
430
|
+
// ---------------------------------------------------------------- 规则 9:带参词条的行数据旧拼写
|
|
431
431
|
/** 带引号的 `@row.字段`(YAML 里 `@` 不能开头一个裸标量,旧拼写必带引号) */
|
|
432
432
|
const ROW_ARG_QUOTED = /(["'])@row\.([A-Za-z_][A-Za-z0-9_]*)\1/g;
|
|
433
433
|
|
|
@@ -449,7 +449,9 @@ export function rewriteYaml(text: string, file: string, kind: 'page' | 'app', en
|
|
|
449
449
|
const { lines, eol } = splitLines(text);
|
|
450
450
|
const ys = analyzeYaml(lines);
|
|
451
451
|
const c: Ctx = { file, lines, ys, env, edits: [], changes: [], findings: [], covered: new Set() };
|
|
452
|
-
|
|
452
|
+
if (kind === 'app') {
|
|
453
|
+
ruleTheme(c);
|
|
454
|
+
}
|
|
453
455
|
if (kind === 'page') {
|
|
454
456
|
ruleEyebrow(c);
|
|
455
457
|
ruleDensity(c);
|
package/src/cli/view-writes.ts
CHANGED
|
@@ -296,6 +296,19 @@ export function checkKitViewTargetRefs(
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
+
|
|
300
|
+
// 5. ctx.onOutcome('name', ...)(SCON-175):范围名也可能是 request 的 into 名 / 逐行分槽名(不是对象名),所以只核对象名契约里能判死的一种——
|
|
301
|
+
// 同名对象的裸声明名(带不带手写的 __form 后缀):运行期按原样匹配、永远收不到这张表单的结果,静态报 KIT-VIEW-003 并给限定名
|
|
302
|
+
const outcomeRe = /\bctx\s*\.\s*onOutcome\s*\(\s*(['"`])([^'"`\\]*)\1/g;
|
|
303
|
+
const formSuffix = '__form';
|
|
304
|
+
for (const m of segment.matchAll(outcomeRe)) {
|
|
305
|
+
const raw = m[2]!;
|
|
306
|
+
if (raw.includes('${')) continue;
|
|
307
|
+
const objName = raw.endsWith(formSuffix) && raw.length > formSuffix.length ? raw.slice(0, -formSuffix.length) : raw;
|
|
308
|
+
if (target.ambiguous?.has(objName) === true) {
|
|
309
|
+
reportBadObject(target, 'onOutcome', objName, block.start + (m.index ?? 0));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
299
312
|
}
|
|
300
313
|
|
|
301
314
|
return diagnostics;
|
|
@@ -9,14 +9,18 @@
|
|
|
9
9
|
// view 下的非槽位键 KIT-OBJ-005
|
|
10
10
|
// 分组 groups[] KIT-OBJ-008
|
|
11
11
|
// schema.<字段>.options 对象(含 params 值必须是字面量) KIT-FORM-003
|
|
12
|
+
// schema.<字段>.relation / display / to(关联类属性闭集与适用形态) KIT-REL-002
|
|
12
13
|
// behavior.list KIT-FORM-004
|
|
13
14
|
// behavior.subscribe KIT-FORM-005
|
|
14
15
|
// schema.<字段>.default(字符串不得以 $ 开头) KIT-FORM-010
|
|
15
|
-
// request / request.status / request.into / download
|
|
16
|
+
// request / request.status / request.into / download(含 download.pick / bodyMap) KIT-ACT-002
|
|
17
|
+
// schema.<字段>.filterOp(精确文本条件,SCON-171:取值闭集与适用类型) KIT-PAGE-001
|
|
16
18
|
// 已删除的声明式顺序键(动作 then / after、request.then、view.form.afterSave、浮层 events 的 then)按未知键报 KIT-PAGE-001
|
|
17
19
|
// behavior.detail KIT-DET-001
|
|
18
20
|
|
|
19
21
|
import grammarJson from '../../spec/kit-grammar.json';
|
|
22
|
+
import { KIT_COPY_VERBS } from 'soma-foundation/kit-limits';
|
|
23
|
+
import { actionFunctionNames, isActionFunctionName } from 'soma-foundation/kit-control';
|
|
20
24
|
import type { KitDiagnostic } from '../object-renderer/types';
|
|
21
25
|
import { checkEnumOptionsAndEditCompatibility, checkFieldRules, checkViewFlowNodeOptions, checkViewRowColumns, dollarPathOf } from '../object-renderer/field-value';
|
|
22
26
|
import { checkRequestFieldMapping } from '../object-renderer/request-actions';
|
|
@@ -30,6 +34,8 @@ type Rec = Record<string, unknown>;
|
|
|
30
34
|
interface G {
|
|
31
35
|
objectKeys: { schema: string[]; behavior: string[]; view: string[] };
|
|
32
36
|
objectLayer: { fieldEmphasis: string[]; containerEmphasis: string[]; surface: string[] };
|
|
37
|
+
fieldRole: { values: string[]; textFilterTypes: string[] };
|
|
38
|
+
fieldRelation: { values: string[]; toFor: string[]; displayObjectFor: string[]; displayObjectProps: Record<string, string> };
|
|
33
39
|
actionKeys: string[];
|
|
34
40
|
fieldRefKeys: string[];
|
|
35
41
|
viewFormKeys: string[];
|
|
@@ -48,6 +54,7 @@ interface G {
|
|
|
48
54
|
listAdapter: { listKeys: string[] };
|
|
49
55
|
behaviorPassthrough: { subscribe: { keys: string[] } };
|
|
50
56
|
requestExt: { intoKeys: string[]; resultKeys: string[] };
|
|
57
|
+
filterOptions: { op: { key: string; values: string[] } };
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
60
|
const KIT_GRAMMAR = grammarJson as unknown as G;
|
|
@@ -152,8 +159,62 @@ function checkContainerKnobs(rec: Rec, path: string, out: KitDiagnostic[], code
|
|
|
152
159
|
}
|
|
153
160
|
}
|
|
154
161
|
|
|
162
|
+
/** 关联类属性(SCON-118,KIT-REL-002):relation 在闭集内;display / to 只跟 relation 一起写,形状与适用形态合法 */
|
|
163
|
+
function checkFieldRelation(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
|
|
164
|
+
const R = g.fieldRelation;
|
|
165
|
+
const bad = (key: string, message: string): void => { out.push({ code: 'KIT-REL-002', path: `${path}.${key}`, message: `字段 ${name}:${message}` }); };
|
|
166
|
+
const rel = def.relation;
|
|
167
|
+
if (rel !== undefined && (typeof rel !== 'string' || !R.values.includes(rel))) {
|
|
168
|
+
bad('relation', `relation "${String(rel)}" 不在闭集(允许:${R.values.join(' / ')})`);
|
|
169
|
+
}
|
|
170
|
+
const valid = typeof rel === 'string' && R.values.includes(rel);
|
|
171
|
+
if (def.display !== undefined) {
|
|
172
|
+
if (rel === undefined) bad('display', 'display 只能和 relation 一起写(它指名关联值里的名称键)');
|
|
173
|
+
else if (typeof def.display === 'string') {
|
|
174
|
+
if (def.display === '') bad('display', 'display 不能是空串');
|
|
175
|
+
} else if (isRec(def.display)) {
|
|
176
|
+
if (valid && !R.displayObjectFor.includes(rel as string)) bad('display', `display 写成对象 { name, sub, avatar } 只给 ${R.displayObjectFor.join(' / ')},${String(rel)} 请写成名称键的字符串`);
|
|
177
|
+
for (const [k, v] of Object.entries(def.display)) {
|
|
178
|
+
if (!Object.keys(R.displayObjectProps).includes(k)) bad(`display.${k}`, `display 的键只许 ${Object.keys(R.displayObjectProps).join(' / ')}`);
|
|
179
|
+
else if (typeof v !== 'string' || v === '') bad(`display.${k}`, `display.${k} 必须是非空字符串(值里对应的键名)`);
|
|
180
|
+
}
|
|
181
|
+
} else bad('display', 'display 必须是名称键的字符串,或 { name, sub, avatar } 对象(仅 person / people)');
|
|
182
|
+
}
|
|
183
|
+
if (def.to !== undefined) {
|
|
184
|
+
if (typeof def.to !== 'string' || def.to === '') bad('to', 'to 必须是非空字符串(关联对象名)');
|
|
185
|
+
else if (rel === undefined || (valid && !R.toFor.includes(rel as string))) bad('to', `to 只跟 ${R.toFor.join(' / ')} 一起写(它写明引用的是哪个对象)`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** 精确文本条件(SCON-171):键名与取值闭集读语法真源 formLinkage.filterOptions.op,适用类型读 fieldRole.textFilterTypes(与 KIT-IA-002 数搜索框同一份) */
|
|
190
|
+
const FILTER_OP = g.formLinkage.filterOptions.op;
|
|
191
|
+
const TEXT_FILTER_TYPES: readonly string[] = g.fieldRole.textFilterTypes;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* schema.<字段>.filterOp(SCON-171):取值在闭集内(eq = 按字段精确匹配);只给筛选区画成文本输入的字段
|
|
195
|
+
* (type 属 textFilterTypes 且不带 options——带选项的已是下拉,本来就是精确条件)。违例 KIT-PAGE-001
|
|
196
|
+
*/
|
|
197
|
+
function checkFilterOp(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
|
|
198
|
+
const raw = def[FILTER_OP.key];
|
|
199
|
+
if (raw === undefined) return;
|
|
200
|
+
const at = `${path}.${FILTER_OP.key}`;
|
|
201
|
+
if (typeof raw !== 'string' || !FILTER_OP.values.includes(raw)) {
|
|
202
|
+
out.push({ code: 'KIT-PAGE-001', path: at, message: `字段 ${name} 的 ${FILTER_OP.key} "${String(raw)}" 不在闭集(允许:${FILTER_OP.values.join(' / ')};不写 = 模糊关键词)` });
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const textual = typeof def.type === 'string' && TEXT_FILTER_TYPES.includes(def.type) && def.options === undefined;
|
|
206
|
+
if (!textual) {
|
|
207
|
+
out.push({
|
|
208
|
+
code: 'KIT-PAGE-001',
|
|
209
|
+
path: at,
|
|
210
|
+
message: `字段 ${name} 写了 ${FILTER_OP.key}: ${raw},它只给筛选区画成文本输入的字段(type 为 ${TEXT_FILTER_TYPES.join(' / ')} 且不带 options);带选项的字段画成下拉,本来就是精确条件`,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
155
215
|
function checkSchemaField(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
|
|
156
216
|
unknownIn(def, g.objectKeys.schema, path, out);
|
|
217
|
+
checkFilterOp(name, def, path, out);
|
|
157
218
|
if (def.access !== undefined && (typeof def.access !== "string" || !FIELD_ACCESS_VALUES.includes(def.access))) {
|
|
158
219
|
out.push({ code: "KIT-OBJ-006", path: `${path}.access`, message: `字段 ${name} 的 access "${String(def.access)}" 不合法(允许:read / write / create)` });
|
|
159
220
|
}
|
|
@@ -163,6 +224,10 @@ function checkSchemaField(name: string, def: Rec, path: string, out: KitDiagnost
|
|
|
163
224
|
if (def.readonly !== undefined && typeof def.readonly !== "boolean") {
|
|
164
225
|
out.push({ code: "KIT-PAGE-004", path: `${path}.readonly`, message: `字段 ${name} 的 readonly 必须是布尔值` });
|
|
165
226
|
}
|
|
227
|
+
if (def.role !== undefined && (typeof def.role !== "string" || !g.fieldRole.values.includes(def.role))) {
|
|
228
|
+
out.push({ code: "KIT-PAGE-001", path: `${path}.role`, message: `字段 ${name} 的 role "${String(def.role)}" 不在闭集(允许:${g.fieldRole.values.join(' / ')})` });
|
|
229
|
+
}
|
|
230
|
+
checkFieldRelation(name, def, path, out);
|
|
166
231
|
checkFieldKnobs(def, path, out);
|
|
167
232
|
if (isRec(def.options)) checkRemoteOptions(def.options, `${path}.options`, out);
|
|
168
233
|
checkFieldRules(name, def.rules, `${path}.rules`, out);
|
|
@@ -219,6 +284,8 @@ function checkDownload(raw: unknown, path: string, out: KitDiagnostic[]): void {
|
|
|
219
284
|
if (raw.filename !== undefined && typeof raw.filename !== 'string') {
|
|
220
285
|
out.push({ code: 'KIT-ACT-002', path: `${path}.filename`, message: 'download.filename 必须是字符串' });
|
|
221
286
|
}
|
|
287
|
+
// SCON-168 行级下载:pick / bodyMap 与 request 同一判据(纯字段名映射,严禁表达式 / $ 路径)
|
|
288
|
+
checkRequestFieldMapping(raw, path, out, 'download');
|
|
222
289
|
}
|
|
223
290
|
}
|
|
224
291
|
|
|
@@ -253,6 +320,13 @@ function checkActionItem(a: unknown, at: string, out: KitDiagnostic[], checkUnkn
|
|
|
253
320
|
});
|
|
254
321
|
}
|
|
255
322
|
}
|
|
323
|
+
if (a.function !== undefined && !isActionFunctionName(a.function)) {
|
|
324
|
+
out.push({
|
|
325
|
+
code: 'KIT-ACT-010',
|
|
326
|
+
path: `${at}.function`,
|
|
327
|
+
message: `动作 ${typeof a.id === 'string' ? a.id : ''} 的 function "${String(a.function)}" 不在功能名闭集(允许:${actionFunctionNames().join(' / ')})`,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
256
330
|
if (a.builtin !== undefined) {
|
|
257
331
|
if (typeof a.builtin !== 'string') {
|
|
258
332
|
out.push({ code: 'KIT-ACT-010', path: `${at}.builtin`, message: `动作 builtin 必须是字符串(收到 ${typeof a.builtin})` });
|
|
@@ -416,8 +490,17 @@ function checkBehavior(b: Rec, path: string, out: KitDiagnostic[]): void {
|
|
|
416
490
|
// ---------------------------------------------------------------- view
|
|
417
491
|
|
|
418
492
|
/** fields[] / groups[].fields 的一项:字符串 | { divider } | { name, ...字段引用键 } | { 字段名: { ...字段引用键 } } */
|
|
419
|
-
function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): void {
|
|
493
|
+
function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[], disallowKeepSlot?: string): void {
|
|
420
494
|
if (!Array.isArray(items)) return;
|
|
495
|
+
const rejectKeep = (target: Rec, keepPath: string): void => {
|
|
496
|
+
if (disallowKeepSlot !== undefined && target.keep !== undefined) {
|
|
497
|
+
out.push({
|
|
498
|
+
code: 'KIT-OBJ-009',
|
|
499
|
+
path: keepPath,
|
|
500
|
+
message: `keep(列的保留优先级)仅用于 table 集合的列,view.${disallowKeepSlot} 的字段项没有列可让位`,
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
};
|
|
421
504
|
items.forEach((item, i) => {
|
|
422
505
|
const at = `${path}[${i}]`;
|
|
423
506
|
if (typeof item === 'string') return;
|
|
@@ -433,6 +516,7 @@ function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): vo
|
|
|
433
516
|
if (typeof item.name === 'string') {
|
|
434
517
|
unknownIn(item, FIELD_ITEM_KEYS, at, out);
|
|
435
518
|
checkFieldKnobs(item, at, out);
|
|
519
|
+
rejectKeep(item, `${at}.keep`);
|
|
436
520
|
return;
|
|
437
521
|
}
|
|
438
522
|
const keys = Object.keys(item);
|
|
@@ -444,6 +528,7 @@ function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): vo
|
|
|
444
528
|
if (isRec(inner)) {
|
|
445
529
|
unknownIn(inner, FIELD_ITEM_KEYS, `${at}.${keys[0]}`, out);
|
|
446
530
|
checkFieldKnobs(inner, `${at}.${keys[0]}`, out);
|
|
531
|
+
rejectKeep(inner, `${at}.${keys[0]}.keep`);
|
|
447
532
|
}
|
|
448
533
|
else if (inner !== null && inner !== undefined) shape(`${at}.${keys[0]}`, `字段项 ${keys[0]} 的值必须是对象`, out);
|
|
449
534
|
});
|
|
@@ -478,10 +563,13 @@ function checkCollection(c: Rec, path: string, out: KitDiagnostic[]): void {
|
|
|
478
563
|
}
|
|
479
564
|
|
|
480
565
|
/** 视图槽(或视图级散键)的子层;closed = 是否同时查本层键闭集(视图级散键的闭集由 checkView 按 VIEW_KEYS 查) */
|
|
481
|
-
function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true): void {
|
|
566
|
+
function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true, slotName?: string): void {
|
|
482
567
|
if (closed) unknownIn(slot, SLOT_KEYS, path, out);
|
|
483
568
|
checkContainerKnobs(slot, path, out);
|
|
484
|
-
|
|
569
|
+
// keep(列的保留优先级,SCON-174)仅作用于 table 集合的列:view.form / view.summary / view.filter 直接在闭集阶段拒收 KIT-OBJ-009;
|
|
570
|
+
// view.list 的 cards / stack 由 object-renderer/collection.ts 拒收,treeTable 与非法取值由 collection-table.ts 拒收
|
|
571
|
+
const disallowKeepSlot = slotName !== undefined && slotName !== 'list' ? slotName : undefined;
|
|
572
|
+
checkFieldItems(slot.fields, `${path}.fields`, out, disallowKeepSlot);
|
|
485
573
|
if (isRec(slot.arrange)) unknownIn(slot.arrange, g.arrangeKeys, `${path}.arrange`, out);
|
|
486
574
|
if (isRec(slot.collection)) checkCollection(slot.collection, `${path}.collection`, out);
|
|
487
575
|
if (Array.isArray(slot.groups)) {
|
|
@@ -490,7 +578,7 @@ function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true)
|
|
|
490
578
|
if (!isRec(grp)) return;
|
|
491
579
|
unknownIn(grp, g.groupCollapse.groupKeys, at, out, 'KIT-OBJ-008');
|
|
492
580
|
checkContainerKnobs(grp, at, out, 'KIT-OBJ-008');
|
|
493
|
-
checkFieldItems(grp.fields, `${at}.fields`, out);
|
|
581
|
+
checkFieldItems(grp.fields, `${at}.fields`, out, disallowKeepSlot);
|
|
494
582
|
});
|
|
495
583
|
}
|
|
496
584
|
if (isRec(slot.result)) unknownIn(slot.result, g.formLinkage.requestExt.resultKeys, `${path}.result`, out, 'KIT-PAGE-001');
|
|
@@ -505,7 +593,7 @@ function checkView(view: Rec, path: string, out: KitDiagnostic[]): void {
|
|
|
505
593
|
unknownIn(view, VIEW_KEYS, path, out, 'KIT-OBJ-005');
|
|
506
594
|
for (const name of SLOT_NAMES) {
|
|
507
595
|
const slot = view[name];
|
|
508
|
-
if (isRec(slot)) checkSlot(slot, `${path}.${name}`, out);
|
|
596
|
+
if (isRec(slot)) checkSlot(slot, `${path}.${name}`, out, true, name);
|
|
509
597
|
}
|
|
510
598
|
// 视图级散键(fields / collection / groups / on 等简写,biz 组件会并入槽)按槽内同样的规则查其子层
|
|
511
599
|
checkSlot(view, path, out, false);
|
|
@@ -521,6 +609,14 @@ function checkView(view: Rec, path: string, out: KitDiagnostic[]): void {
|
|
|
521
609
|
*/
|
|
522
610
|
export function checkObjectClosedSet(obj: Rec, path: string, out: KitDiagnostic[]): void {
|
|
523
611
|
checkContainerKnobs(obj, path, out);
|
|
612
|
+
// 对象名 noun / 领域动词 verb(动词闭集 B1-7):非空字符串、不含空白、长度上限真源 kit-limits#copyVerbs
|
|
613
|
+
for (const [key, max] of [['noun', KIT_COPY_VERBS.nounMaxChars], ['verb', KIT_COPY_VERBS.verbMaxChars]] as const) {
|
|
614
|
+
const v = obj[key];
|
|
615
|
+
if (v === undefined) continue;
|
|
616
|
+
if (typeof v !== 'string' || v.trim() === '' || /\s/.test(v) || [...v].length > max) {
|
|
617
|
+
out.push({ code: 'KIT-PAGE-001', path: `${path}.${key}`, message: `对象 ${key} 必须是不含空白、不超过 ${max} 字的非空字符串(收到 ${JSON.stringify(v)})` });
|
|
618
|
+
}
|
|
619
|
+
}
|
|
524
620
|
const section = (key: 'schema' | 'behavior' | 'view'): Rec | undefined => {
|
|
525
621
|
const v = obj[key];
|
|
526
622
|
if (v === undefined || v === null) return undefined;
|