soma-kit 0.1.14 → 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/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- 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 -338
- package/spec/generated/kit-page.schema.json +1152 -87
- package/spec/kit-grammar.json +1084 -136
- package/spec/kit-grammar.schema.json +167 -26
- package/src/app/app-config.ts +220 -187
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +200 -22
- package/src/app/define-kit-app.ts +54 -8
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +12 -7
- package/src/app/kit-view-context.ts +50 -3
- 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 +68 -24
- package/src/app/theme-runtime.ts +421 -87
- 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 +107 -59
- package/src/base/anchored-layer.ts +8 -7
- 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 +365 -53
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +147 -32
- package/src/base/check-core.ts +196 -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 +404 -28
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +155 -37
- package/src/base/context-menu.ts +26 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +115 -94
- package/src/base/date.ts +487 -76
- package/src/base/delta.ts +20 -11
- package/src/base/divider.ts +64 -97
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +64 -23
- package/src/base/gap-value.ts +35 -16
- package/src/base/hint-tips.ts +100 -30
- 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 +92 -24
- package/src/base/inline-error.ts +90 -0
- package/src/base/input.ts +174 -38
- package/src/base/kbd.ts +31 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +324 -95
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +58 -22
- package/src/base/menu-button.ts +129 -42
- package/src/base/menu-core.ts +210 -26
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +10 -5
- package/src/base/motion/hover-gallery.ts +19 -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 +143 -27
- package/src/base/overlay-runtime.ts +32 -24
- package/src/base/overlay-shell.ts +186 -0
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +625 -74
- package/src/base/popup.ts +219 -78
- 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 +145 -21
- 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 +60 -18
- package/src/base/relation-cells.ts +541 -0
- package/src/{frames → base}/resize-handle.ts +6 -4
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +99 -56
- package/src/base/select.ts +8 -2
- package/src/base/shared.ts +520 -73
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/status-tone.ts +1 -1
- 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 +129 -55
- package/src/base/tag.ts +203 -91
- package/src/base/text.ts +491 -77
- package/src/base/textarea.ts +89 -40
- package/src/base/time-picker.ts +341 -57
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +346 -89
- package/src/base/upload.ts +612 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +98 -6
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +53 -13
- package/src/biz/auth-panel/compile.ts +14 -4
- package/src/biz/auth-panel/shell.ts +28 -8
- package/src/biz/category-crud/compile.ts +64 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +30 -8
- package/src/biz/checkout-page/compile.ts +38 -4
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +28 -10
- package/src/biz/compose.ts +9 -4
- package/src/biz/data-components.ts +2 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +5 -2
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +36 -20
- package/src/biz/index.ts +5 -4
- package/src/biz/landing-page/compile.ts +4 -3
- package/src/biz/landing-page/shell.ts +25 -5
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +62 -16
- package/src/biz/master-sub/compile.ts +318 -38
- package/src/biz/master-sub/detail-head.ts +145 -21
- package/src/biz/master-sub/index.ts +6 -3
- package/src/biz/master-sub/shell.ts +232 -66
- package/src/biz/multi-board/compile.ts +89 -38
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +25 -9
- package/src/biz/multi-board/prose-fold.ts +17 -13
- package/src/biz/multi-board/shell.ts +153 -38
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +28 -7
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +51 -11
- package/src/biz/page-templates/domain-templates.ts +147 -20
- package/src/biz/page-templates/result-page/compile.ts +5 -2
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +20 -6
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +20 -9
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +30 -14
- package/src/biz/record-detail/compile.ts +43 -12
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +42 -11
- package/src/biz/settings-center/compile.ts +5 -2
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +33 -9
- package/src/biz/shared/action-host.ts +146 -48
- package/src/biz/shared/compile-helpers.ts +134 -32
- package/src/biz/shared/coordinator.ts +727 -163
- 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 +102 -24
- package/src/biz/shared/overlay-shell.ts +97 -116
- 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 +6 -4
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +22 -8
- package/src/biz/standard-crud/compile.ts +213 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +90 -13
- package/src/biz/standard-crud/summary.ts +2 -35
- package/src/biz/step-form/compile.ts +13 -4
- package/src/biz/step-form/hub.ts +168 -49
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +35 -17
- package/src/biz/types.ts +49 -6
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +179 -33
- package/src/cli/kit-init.ts +152 -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/access-gate-attach.ts +1 -1
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +461 -273
- package/src/compile/component-candidates.ts +58 -5
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +6 -59
- package/src/compile/index.ts +2 -2
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +44 -13
- 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 +405 -67
- 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/redirect.ts +1 -1
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +786 -0
- package/src/compile/styles.ts +286 -48
- package/src/compile/types.ts +63 -6
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +52 -23
- package/src/data/anchor-nav.ts +77 -16
- package/src/data/approval-flow.ts +217 -126
- package/src/data/assignment-picker.ts +182 -94
- package/src/data/async-result-panel.ts +114 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +150 -24
- package/src/data/calendar.ts +436 -97
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +81 -41
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +1053 -96
- package/src/data/checklist.ts +82 -38
- package/src/data/code-view.ts +296 -44
- package/src/data/comment-thread.ts +611 -86
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +250 -39
- 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 +109 -49
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +38 -18
- package/src/data/embed.ts +143 -8
- package/src/data/engine-ports.ts +135 -0
- package/src/data/field-mapper.ts +116 -54
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +695 -158
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +88 -26
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +640 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +40 -13
- package/src/data/image-viewer.ts +265 -62
- package/src/data/index.ts +75 -6
- package/src/data/item-list.ts +219 -58
- package/src/data/json-view.ts +909 -0
- package/src/data/kanban.ts +346 -91
- 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 +597 -0
- package/src/data/matrix.ts +234 -120
- package/src/data/media-grid.ts +165 -38
- package/src/data/mega-menu.ts +43 -26
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +55 -19
- package/src/data/menu.ts +138 -48
- package/src/data/mockup.ts +37 -25
- package/src/data/modal-dialog.ts +126 -98
- package/src/data/navbar.ts +152 -66
- package/src/data/notice-list.ts +101 -49
- package/src/data/notify-renderer.ts +80 -15
- package/src/data/object-form.ts +1504 -164
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +129 -45
- package/src/data/panel-head.ts +238 -76
- package/src/data/permission-matrix.ts +379 -120
- package/src/data/permission-tree.ts +146 -78
- package/src/data/pricing-table.ts +112 -43
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +67 -32
- package/src/data/record-card.ts +245 -72
- package/src/data/record-picker.ts +61 -28
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +141 -38
- package/src/data/resident.ts +11 -13
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +260 -127
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +384 -105
- package/src/data/rule-builder.ts +136 -81
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +90 -36
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +493 -100
- package/src/data/static-lazy.ts +21 -0
- package/src/data/static-registry.ts +46 -4
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +69 -36
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +134 -47
- package/src/data/system-switcher.ts +53 -24
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +731 -0
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +113 -47
- package/src/data/transfer.ts +204 -47
- package/src/data/tree-table.ts +228 -81
- package/src/data/tree.ts +193 -69
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +248 -98
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +28 -6
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +4 -4
- package/src/frames/inherited-shell.ts +219 -0
- package/src/frames/page-bar.ts +208 -28
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +18 -0
- package/src/frames/shared.ts +73 -26
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +27 -17
- package/src/frames/split-frame/wiring.ts +16 -12
- package/src/frames/tabs-frame/shell.ts +14 -7
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +5 -2
- package/src/frames/workspace-frame/extras.ts +23 -7
- 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 +24 -3
- package/src/frames/workspace-frame/state.ts +42 -8
- package/src/frames/workspace-frame/view.ts +773 -194
- package/src/generated/kit-grammar-runtime.ts +1061 -77
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +210 -5
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +204 -22
- package/src/object-renderer/action-more.ts +66 -19
- package/src/object-renderer/arrange.ts +270 -28
- 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 +459 -103
- package/src/object-renderer/collection-table.ts +406 -59
- package/src/object-renderer/collection.ts +333 -71
- package/src/object-renderer/compile-data.ts +13 -3
- package/src/object-renderer/defaults.ts +14 -5
- package/src/object-renderer/emit-events.ts +46 -20
- package/src/object-renderer/emit-object.ts +35 -6
- package/src/object-renderer/emit-static.ts +831 -153
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +190 -0
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/{compile → object-renderer}/fragment.ts +2 -2
- package/src/object-renderer/index.ts +1 -1
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +55 -7
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +124 -0
- 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 +72 -27
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +479 -111
- 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 +437 -130
- package/src/object-renderer/types.ts +100 -17
- 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/app-blocks.ts +66 -0
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +57 -0
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +32 -0
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +93 -26
- package/src/recipes/control.ts +85 -8
- package/src/recipes/desc-list.ts +108 -0
- package/src/recipes/divider.ts +74 -0
- package/src/recipes/emphasis.ts +102 -13
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +6 -5
- package/src/recipes/index.ts +39 -5
- package/src/recipes/inherited-shell.ts +43 -0
- package/src/recipes/json-view.ts +50 -0
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +96 -0
- package/src/recipes/overlay.ts +151 -37
- package/src/recipes/page-width.ts +51 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +38 -20
- 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 +6 -6
- package/src/recipes/state.ts +64 -11
- package/src/recipes/status.ts +21 -20
- package/src/recipes/strip.ts +114 -0
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +40 -7
- package/src/recipes/table-gap.ts +4 -3
- package/src/recipes/table-native-edit.ts +25 -12
- package/src/recipes/table-row.ts +56 -20
- package/src/recipes/tabs.ts +140 -31
- package/src/recipes/text-diff.ts +97 -0
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +72 -5
- package/src/recipes/typography.ts +2 -2
- 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/diagnostics.ts +16 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +292 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +40 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- 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/path-guard.ts +1 -1
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +181 -21
- 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 +563 -28
- package/src/theme/kit-theme.tpl +527 -28
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +538 -176
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +12 -3
- package/src/theme/theme-tokens.ts +1602 -90
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- package/src/frames/list-summary.ts +0 -100
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
- /package/src/{base → shared}/class-candidates.ts +0 -0
package/src/compile/types.ts
CHANGED
|
@@ -6,6 +6,8 @@ import type { KitBizDefinition } from '../biz/types';
|
|
|
6
6
|
import type { KitFrameDefinition } from '../frames/types';
|
|
7
7
|
import type { KitObject, KitDiagnostic } from '../object-renderer/types';
|
|
8
8
|
import type { KitRedirectDecl } from './redirect';
|
|
9
|
+
import type { KitArtifactApplyStats, KitArtifactWriteStats } from '../spatial';
|
|
10
|
+
import type { KitPipelineReport } from './page-pipeline';
|
|
9
11
|
|
|
10
12
|
export type { KitDiagnostic } from '../object-renderer/types';
|
|
11
13
|
|
|
@@ -31,12 +33,12 @@ export interface KitProductDecl {
|
|
|
31
33
|
areaClass?: Record<string, string>;
|
|
32
34
|
/** 产品级专属配置(仅 acceptConfig: true 的包装/定制业务组件可用) */
|
|
33
35
|
config?: Record<string, unknown>;
|
|
34
|
-
/** 产品块级主题(已过 checkBlockTheme):简写 inverse / dark / light,或 { mode?, color? } 词条对象 */
|
|
35
|
-
theme?: string | Record<string, unknown>;
|
|
36
36
|
/** 区块级语义强调档位 */
|
|
37
37
|
emphasis?: "primary" | "normal" | "subtle";
|
|
38
38
|
/** 区块级容器表面配方 */
|
|
39
39
|
surface?: "card" | "flush" | "plain";
|
|
40
|
+
/** 列表窗格形态(product.list_layout,缺省 side):side 列表在侧栏 / top 上方条件框 + 下方整宽列表;只有有列表窗格的业务组件可写 */
|
|
41
|
+
listLayout?: "side" | "top";
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** 页签槽的一项 */
|
|
@@ -48,7 +50,7 @@ export interface KitTabDecl {
|
|
|
48
50
|
|
|
49
51
|
/** 解析后的页面声明 */
|
|
50
52
|
export interface KitPageDecl {
|
|
51
|
-
page: { url: string; title: string; subtitle?: string; eyebrow?: string; roles?: string[]; breadcrumbs?: Array<{ label: string; href?: string }>; redirect?: KitRedirectDecl; params?: Record<string, Record<string, unknown>>; query?: Record<string, Record<string, unknown>>; locale?: string; dir?: 'ltr' | 'rtl';
|
|
53
|
+
page: { url: string; title: string; subtitle?: string; eyebrow?: string; roles?: string[]; breadcrumbs?: Array<{ label: string; href?: string }>; redirect?: KitRedirectDecl; params?: Record<string, Record<string, unknown>>; query?: Record<string, Record<string, unknown>>; locale?: string; dir?: 'ltr' | 'rtl'; envelope?: import('../shared/envelope').KitEnvelope; inheritLayout?: boolean; view?: string; /** 版心档(maxWidth)是编排层从应用缺省 layout.maxWidth 补上的,不是页面自己写的(compile/stages.ts#planSize 写;页面线版心据此区分页面声明与应用缺省) */ maxWidthFromApp?: boolean; /** 页面规则(page.look,界面规则 L2,原样保留,由 compile/look-page.ts 解析) */ look?: unknown } & Pick<import('../frames/types').KitPageMeta, 'actions' | 'back' | 'status' | 'statusFollow' | 'maxWidth' | 'sticky'>;
|
|
52
54
|
frame: {
|
|
53
55
|
kind: string;
|
|
54
56
|
/** 页面是否显式声明了 frame.kind(未显式声明时可继承 kit.app.yaml#layout.frame) */
|
|
@@ -77,17 +79,37 @@ export interface KitAppContext {
|
|
|
77
79
|
/** 令牌 CSS(soma-foundation 求解的 `:root` 亮色 + 暗色块),拼在主题头前面;缺省不拼(测试可不给) */
|
|
78
80
|
themeTokensCss?: string;
|
|
79
81
|
/** 业务信封约定(规整后的 kit.app.yaml#envelope):页面 page.envelope 可覆写;编进 core 数据声明的 failWhen / messagePath,也交给详情预取 */
|
|
80
|
-
envelope?: import('../
|
|
82
|
+
envelope?: import('../shared/envelope').KitEnvelope;
|
|
81
83
|
/** 整站主题声明(规整后的 kit.app.yaml#theme):块级主题求解以它为页面基底;缺省走 foundation 默认 */
|
|
82
84
|
themeConfig?: import('../theme/theme-tokens').KitThemeConfig;
|
|
83
85
|
/** 整站 9 维正交主题声明(规整后的 kit.app.yaml#theme) */
|
|
84
86
|
theme?: import('../app/app-config').KitAppTheme;
|
|
85
|
-
/** 九维主题求解产生的降级清单(供 CLI 检查展示) */
|
|
86
|
-
themeDegradations?: readonly import('../theme/theme-tokens').NineDimDegradation[];
|
|
87
87
|
/** 应用级默认页面布局继承配置(kit.app.yaml 的 layout:) */
|
|
88
88
|
layout?: import('../app/app-config').KitAppLayout;
|
|
89
89
|
/** 布局规则版本钉(kit.app.yaml 的 layout.rules,RV-1117):缺省 0 = 现状,输出逐字节不变 */
|
|
90
90
|
layoutRules?: number;
|
|
91
|
+
/**
|
|
92
|
+
* 主题流水线新旧开关(kit.app.yaml 的 layout.pipeline):缺省 legacy = 现有编译流程,新流水线只旁路运行、结果进编译结果的 pageAttrs;
|
|
93
|
+
* next = 页面属性写进产物、取值表随主题令牌下发。没写时没有这个键
|
|
94
|
+
*/
|
|
95
|
+
pipeline?: import('./page-pipeline').KitPipelineMode;
|
|
96
|
+
/**
|
|
97
|
+
* 应用的外壳形态:有没有侧栏外壳、顶栏、是否多页签工作台。取自应用的布局配置(layout 段,不是 theme 段),
|
|
98
|
+
* 交给页面流水线的展开事件建页面框区域;没有就当全 false
|
|
99
|
+
*/
|
|
100
|
+
shellFacts?: import('../spatial').KitExpandShell;
|
|
101
|
+
/**
|
|
102
|
+
* 应用自有组件的静态自报声明(组件名 → 契约顶层 selfReport 段,spatial/self-report.ts#KitComponentSelfDecl):由应用装配从已登记的组件定义收集,
|
|
103
|
+
* 编译每页时建成补登表交给页面流水线的展开事件。只影响页面线(旧版下只进旁路报告,不改产物);没有组件声明时没有这个键(上下文与缓存键与改动前一致)
|
|
104
|
+
*/
|
|
105
|
+
selfReports?: Readonly<Record<string, import('../spatial').KitComponentSelfDecl>>;
|
|
106
|
+
/** 组合核对算出的允许层级策略档(只在 next 下由应用装配写入);换肤端点据此拒绝不允许的档 */
|
|
107
|
+
allowedLayering?: readonly string[];
|
|
108
|
+
/**
|
|
109
|
+
* 只在 next 下由应用装配写入:文档头主题引导数据里的应用基底(与旧版页面根主题属性同口径:预设展开、写过任一维度时补缺省档),
|
|
110
|
+
* 运行期启动时无条件写到文档根上(页面不再写根节点主题属性与内嵌引导数据)
|
|
111
|
+
*/
|
|
112
|
+
runtimeBaseTheme?: Readonly<Record<string, string>>;
|
|
91
113
|
/** 应用扩展的业务组件(与内置同名需自行保证不重名;重名以应用的为准) */
|
|
92
114
|
bizComponents?: Record<string, KitBizDefinition>;
|
|
93
115
|
/** 应用扩展的页面框 */
|
|
@@ -106,6 +128,8 @@ export interface KitAppContext {
|
|
|
106
128
|
defaultLocale?: string;
|
|
107
129
|
/** 应用词条表 `{ 语言: { 键: 文案 } }`(`locales/*.yaml` 读成后交入);`$t:键` 在编译期按页面语言展开 */
|
|
108
130
|
locales?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
131
|
+
/** 应用规则(kit.app.yaml#look,界面规则 L1):对本应用全部页面(含 AI 生成页)生效;缺省 = 没有应用规则 */
|
|
132
|
+
look?: unknown;
|
|
109
133
|
/** 应用级共享枚举字典(kit.app.yaml#dicts):供字段 options: '$dict.<name>' 在编译期静态展开 */
|
|
110
134
|
dicts?: import("../app/app-config").KitAppDicts;
|
|
111
135
|
/** 应用级共享实体定义(kit.app.yaml#entities):供对象 schema: '$entity.<name>' 或 { $ref: '$entity.<name>', pick?, omit?, override? } 在编译期静态展开 */
|
|
@@ -121,6 +145,17 @@ export interface KitPageArtifact {
|
|
|
121
145
|
version: string;
|
|
122
146
|
}
|
|
123
147
|
|
|
148
|
+
export interface KitSpatialPlan {
|
|
149
|
+
readonly envelope: import('soma-foundation/arrange').ArrangePageEnvelopePlan;
|
|
150
|
+
readonly supportsMaxWidth: boolean;
|
|
151
|
+
readonly explicitMaxWidth: boolean;
|
|
152
|
+
readonly maxTableCols: number;
|
|
153
|
+
readonly tableIdealRem: number;
|
|
154
|
+
readonly hasUncappedCol: boolean;
|
|
155
|
+
readonly formWeight: number;
|
|
156
|
+
readonly formGroups: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
124
159
|
export interface KitCompileResult {
|
|
125
160
|
artifact?: KitPageArtifact;
|
|
126
161
|
diagnostics: KitDiagnostic[];
|
|
@@ -134,6 +169,28 @@ export interface KitCompileResult {
|
|
|
134
169
|
* 旁路通道:不影响 diagnostics / ok;没有弃用写法时不出现这个键。
|
|
135
170
|
*/
|
|
136
171
|
deprecations?: import('../object-renderer/types').KitAdvisory[];
|
|
172
|
+
/** 界面规则来源记录(每条规则最终生效的命中;`soma kit explain look` 读它):只在页面用到规则时给,不进四件套 */
|
|
173
|
+
look?: readonly import('./look-page').KitLookReportRow[];
|
|
174
|
+
/** 编译期空间规划只读旁路元数据(五档包络、内容表宽与表单权重等,不进四件套产物) */
|
|
175
|
+
spatialPlan?: KitSpatialPlan;
|
|
176
|
+
/**
|
|
177
|
+
* 页面属性报告(主题流水线六个事件的结论 + 页面侧门禁):只在编译成功(有 artifact)时给。
|
|
178
|
+
* legacy 下纯旁路,不进产物、不参与版本号;next 下产物里写入的就是这份报告里的属性
|
|
179
|
+
*/
|
|
180
|
+
pageAttrs?: KitPageAttrsSidecar;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** 编译结果的页面属性旁路:流水线的报告,另带本页界面规则没能对上节点的条数与 next 下的写入统计 */
|
|
184
|
+
export interface KitPageAttrsSidecar extends KitPipelineReport {
|
|
185
|
+
/** 本次编译所处的开关 */
|
|
186
|
+
readonly mode: import('./page-pipeline').KitPipelineMode;
|
|
187
|
+
/** 现有界面规则的求解结果里,没能可靠对应到组件树节点、因而没传给流水线的规则条数 */
|
|
188
|
+
readonly lookSkipped: number;
|
|
189
|
+
/**
|
|
190
|
+
* next 下写入产物的统计:写上了多少、因什么没写上,以及写入时的说明(没落上的跟数据走的界面规则,逐条写明原因);
|
|
191
|
+
* legacy 下没有这个键
|
|
192
|
+
*/
|
|
193
|
+
readonly applied?: { readonly written: KitArtifactWriteStats; readonly skipped: KitArtifactApplyStats; readonly notes: readonly string[] };
|
|
137
194
|
}
|
|
138
195
|
|
|
139
196
|
/** 业务对象表里的对象(供类型引用) */
|
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
// KIT-VIEW-004 view.form.onDraft 的方法没在展示对象 methods 里
|
|
6
6
|
// KIT-VIEW-007 绑定的成员性质不对:hidden / disabled / required / 动作 disabled 要标量,绑到数组 / 对象成员报;options 要数组、nodeOptions 要对象,绑到别的形状也报(形状来自 state 初值的扫描)
|
|
7
7
|
// 没写 page.view 的页面(含 AI 生成页)使用默认空展示对象,不允许带任何绑定。纯函数。
|
|
8
|
+
// 另有组件入参的声明名出口(SCON-175,resolveSourceObjectRefs):写死形状组件 props.source_object 写的对象名按对象名契约在编译期解析成运行期名,
|
|
9
|
+
// 写错报 KIT-VIEW-003(与 `soma kit check` 核展示对象 ctx.form / data … 的对象名同一个码、同一份契约 biz/shared/object-aliases.ts)。
|
|
8
10
|
|
|
9
11
|
import { checkBindingKind, type ViewBindingSite, type ViewShapeKind, type ViewStateShape } from 'soma-foundation/view-state';
|
|
12
|
+
import grammarJson from '../../spec/kit-grammar.json';
|
|
13
|
+
import { buildKitObjectNameMap, declaredObjectsOfPlan, isKitObjectDeclLike, qualifiedNamesOf, type KitObjectNameMap, type KitObjectPlan } from '../biz/shared/object-aliases';
|
|
14
|
+
import { KIT_VIEW_SLOTS } from '../object-renderer/defaults';
|
|
10
15
|
import { readKitViewInfo } from '../shared/view-info';
|
|
11
16
|
import { normalizeRef } from '../object-renderer/arrange';
|
|
12
17
|
import { classifyBindingValue, classifyEventBinding, classifyParamBinding, collectFieldState, isViewMethodName, isViewPath, viewPathMember, KIT_FIELD_STATE_KEYS } from '../object-renderer/view-binding';
|
|
@@ -76,7 +81,8 @@ interface Usage {
|
|
|
76
81
|
syntaxDiags: KitDiagnostic[];
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
/** 视图槽闭集(语法真源 viewSlots,object-renderer/defaults#KIT_VIEW_SLOTS),本文件不另抄 */
|
|
85
|
+
const VIEW_SLOTS = KIT_VIEW_SLOTS;
|
|
80
86
|
|
|
81
87
|
/** 一个视图槽位里全部字段项(fields / groups[].fields,已规范化) */
|
|
82
88
|
function fieldRefsOfSlot(slotView: Rec, at: string): Array<{ ref: Rec; at: string }> {
|
|
@@ -282,3 +288,186 @@ export function checkPageView(decl: KitPageDecl, app: KitAppContext): KitDiagnos
|
|
|
282
288
|
}
|
|
283
289
|
return diags;
|
|
284
290
|
}
|
|
291
|
+
|
|
292
|
+
// ---------------------------------------------------------------- 组件入参的声明名出口(SCON-175)
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 组件入参里引用页面数据对象的键(kit 约定,语法真源 viewObject.objectNames.sourceObjectProp,即 source_object):写死形状组件(含应用组件 App*)的
|
|
296
|
+
* props.<这个键> 写一个或多个页面数据对象名(逗号分隔的字符串,或字符串数组),组件据它经 core 数据端口取对象、判已解析 / 重取。
|
|
297
|
+
*/
|
|
298
|
+
export const KIT_SOURCE_OBJECT_PROP: string = (grammarJson as unknown as { viewObject: { objectNames: { sourceObjectProp: string } } }).viewObject.objectNames.sourceObjectProp;
|
|
299
|
+
|
|
300
|
+
/** 一个槽 / 页签的产品计划:对象名契约的输入,另带产品在页面声明里的路径(诊断用) */
|
|
301
|
+
export interface KitObjectRefPlan extends KitObjectPlan {
|
|
302
|
+
readonly path: string;
|
|
303
|
+
readonly objects: Record<string, unknown>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface KitObjectRefResolution {
|
|
307
|
+
/** 与输入计划一一对应:改写过的对象表;没有要改的为 undefined(原声明原样保留,产物逐字节不变) */
|
|
308
|
+
readonly objects: ReadonlyArray<Record<string, unknown> | undefined>;
|
|
309
|
+
/** 写错的对象名(KIT-VIEW-003):不是本页的对象,或声明名在本页有多个同名对象 */
|
|
310
|
+
readonly diagnostics: readonly KitDiagnostic[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** 不是对象名的值:view.<成员> 绑定、page. / row. 前缀与 $ 路径(绑定成员由上面核 KIT-VIEW-003 / 011,原始运行期路径由渲染层核 KIT-VIEW-010) */
|
|
314
|
+
const NOT_OBJECT_NAME_RE = /^(?:view|page|row)\.|\$/;
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
interface ObjectRefCtx {
|
|
318
|
+
readonly map: KitObjectNameMap;
|
|
319
|
+
/** 本页全部对象的运行期名(运行期名原样放行) */
|
|
320
|
+
readonly runtime: ReadonlySet<string>;
|
|
321
|
+
/** 诊断里列给作者的可写名字:整页唯一的声明名;同名的写成「名(同名,须写 限定名…)」 */
|
|
322
|
+
readonly offer: string;
|
|
323
|
+
readonly diags: KitDiagnostic[];
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** 一个对象名 → 运行期名:声明名 / 限定名按契约解析,运行期名原样;写错(不是本页对象、同名歧义)记一条 KIT-VIEW-003 并返回 null */
|
|
327
|
+
function resolveObjectRefName(name: string, at: string, ctx: ObjectRefCtx): string | null {
|
|
328
|
+
const hit = ctx.map[name];
|
|
329
|
+
if (typeof hit === 'string') return hit;
|
|
330
|
+
if (Array.isArray(hit)) {
|
|
331
|
+
ctx.diags.push({
|
|
332
|
+
code: 'KIT-VIEW-003', path: at,
|
|
333
|
+
message: `组件入参 ${KIT_SOURCE_OBJECT_PROP} 的对象名「${name}」在本页有多个同名对象,歧义`,
|
|
334
|
+
hint: `改写成限定名 <页签 id 或槽名>.${name}:${qualifiedNamesOf(ctx.map, hit as readonly string[]).join(' / ')}`,
|
|
335
|
+
});
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
if (ctx.runtime.has(name)) return name;
|
|
339
|
+
ctx.diags.push({
|
|
340
|
+
code: 'KIT-VIEW-003', path: at,
|
|
341
|
+
message: `组件入参 ${KIT_SOURCE_OBJECT_PROP} 的对象名「${name}」不是本页的数据对象(可写:${ctx.offer})`,
|
|
342
|
+
hint: '写本页声明过的对象名(面板名 / 对象名;同名对象写 <页签 id 或槽名>.<声明名>),编译期解析成运行期名;运行期名照旧可用',
|
|
343
|
+
});
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** source_object 的值 → 解析后的值;不用改(全是运行期名、不是对象名写法、有写错)为 undefined。字符串按逗号分开逐个解析,数组逐项 */
|
|
348
|
+
function resolveSourceObjectValue(raw: unknown, at: string, ctx: ObjectRefCtx): unknown {
|
|
349
|
+
if (typeof raw === 'string') {
|
|
350
|
+
const out: string[] = [];
|
|
351
|
+
let changed = false;
|
|
352
|
+
let ok = true;
|
|
353
|
+
// 逐个名字判「是不是对象名写法」(与数组分支同口径):`head, $row.x` 照样改写 head、原样留下 $row.x;`head, view.extra` 不把 view.extra 当对象名报错
|
|
354
|
+
for (const name of raw.split(',').map((s) => s.trim()).filter((s) => s !== '')) {
|
|
355
|
+
if (NOT_OBJECT_NAME_RE.test(name)) {
|
|
356
|
+
out.push(name);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const r = resolveObjectRefName(name, at, ctx);
|
|
360
|
+
if (r === null) ok = false;
|
|
361
|
+
else if (r !== name) changed = true;
|
|
362
|
+
out.push(r ?? name);
|
|
363
|
+
}
|
|
364
|
+
return ok && changed ? out.join(',') : undefined;
|
|
365
|
+
}
|
|
366
|
+
if (Array.isArray(raw)) {
|
|
367
|
+
const items: readonly unknown[] = raw;
|
|
368
|
+
const out: unknown[] = [];
|
|
369
|
+
let changed = false;
|
|
370
|
+
let ok = true;
|
|
371
|
+
for (const [i, item] of items.entries()) {
|
|
372
|
+
const name = typeof item === 'string' ? item.trim() : '';
|
|
373
|
+
if (name === '' || NOT_OBJECT_NAME_RE.test(name)) {
|
|
374
|
+
out.push(item);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const r = resolveObjectRefName(name, `${at}[${i}]`, ctx);
|
|
378
|
+
if (r === null) ok = false;
|
|
379
|
+
else if (r !== item) changed = true;
|
|
380
|
+
out.push(r ?? item);
|
|
381
|
+
}
|
|
382
|
+
return ok && changed ? out : undefined;
|
|
383
|
+
}
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const hasStaticComponent = (v: Rec): boolean => typeof v.staticComponent === 'string' && v.staticComponent !== '';
|
|
388
|
+
/** 视图槽里的写死形状组件:staticComponent,没写取 component(与 compile/stages.ts#staticComponentNamesOf、spatial/expand.ts 取槽组件同口径) */
|
|
389
|
+
const hasSlotComponent = (v: Rec): boolean => hasStaticComponent(v) || (typeof v.component === 'string' && v.component !== '');
|
|
390
|
+
|
|
391
|
+
/** 一个写死形状组件的位置(整视图或某个视图槽):改写 props.source_object;没有要改的为 undefined */
|
|
392
|
+
function patchSourceObjectProp(holder: Rec, at: string, ctx: ObjectRefCtx): Rec | undefined {
|
|
393
|
+
const props = holder.props;
|
|
394
|
+
if (!isRec(props) || !Object.hasOwn(props, KIT_SOURCE_OBJECT_PROP)) return undefined;
|
|
395
|
+
const next = resolveSourceObjectValue(props[KIT_SOURCE_OBJECT_PROP], `${at}.props.${KIT_SOURCE_OBJECT_PROP}`, ctx);
|
|
396
|
+
return next === undefined ? undefined : { ...holder, props: { ...props, [KIT_SOURCE_OBJECT_PROP]: next } };
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** 对象视图:view 下直接写的整视图件,或各视图槽里写的写死形状组件(与展开、版心事实取组件同口径) */
|
|
400
|
+
function patchSourceObjectView(view: Rec, at: string, ctx: ObjectRefCtx): Rec | undefined {
|
|
401
|
+
if (hasStaticComponent(view)) return patchSourceObjectProp(view, at, ctx);
|
|
402
|
+
let out: Rec | undefined;
|
|
403
|
+
for (const slot of VIEW_SLOTS) {
|
|
404
|
+
const sv = view[slot];
|
|
405
|
+
if (!isRec(sv) || !hasSlotComponent(sv)) continue;
|
|
406
|
+
const next = patchSourceObjectProp(sv, `${at}.${slot}`, ctx);
|
|
407
|
+
if (next !== undefined) out = { ...(out ?? view), [slot]: next };
|
|
408
|
+
}
|
|
409
|
+
return out;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* 一个对象声明(连同它的从属对象 subs):有改写返回新对象,否则 undefined。
|
|
414
|
+
* 从属对象 subs 里的组件同样可以引用本页对象(引用方);从属对象自己不进对象名契约(不是 source_object 的可写目标,declaredObjectsOfPlan 只登记产品对象表一层)
|
|
415
|
+
*/
|
|
416
|
+
function patchSourceObjectDecl(decl: Rec, at: string, ctx: ObjectRefCtx): Rec | undefined {
|
|
417
|
+
let out: Rec | undefined;
|
|
418
|
+
if (isRec(decl.view)) {
|
|
419
|
+
const view = patchSourceObjectView(decl.view, `${at}.view`, ctx);
|
|
420
|
+
if (view !== undefined) out = { ...decl, view };
|
|
421
|
+
}
|
|
422
|
+
if (isRec(decl.subs)) {
|
|
423
|
+
const subsDecl = decl.subs;
|
|
424
|
+
let subs: Rec | undefined;
|
|
425
|
+
for (const [name, sub] of Object.entries(subsDecl)) {
|
|
426
|
+
if (!isRec(sub)) continue;
|
|
427
|
+
const next = patchSourceObjectDecl(sub, `${at}.subs.${name}`, ctx);
|
|
428
|
+
if (next !== undefined) subs = { ...(subs ?? subsDecl), [name]: next };
|
|
429
|
+
}
|
|
430
|
+
if (subs !== undefined) out = { ...(out ?? decl), subs };
|
|
431
|
+
}
|
|
432
|
+
return out;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** 产品的对象表:单个对象、分组表(panels / steps / subs / sections …)与浮层表的成员(与对象名契约认对象同一个走法) */
|
|
436
|
+
function patchSourceObjectObjects(objects: Record<string, unknown>, at: string, ctx: ObjectRefCtx): Record<string, unknown> | undefined {
|
|
437
|
+
let out: Record<string, unknown> | undefined;
|
|
438
|
+
for (const [key, val] of Object.entries(objects)) {
|
|
439
|
+
if (!isRec(val)) continue;
|
|
440
|
+
let next: Rec | undefined;
|
|
441
|
+
if (key !== 'overlays' && isKitObjectDeclLike(val)) {
|
|
442
|
+
next = patchSourceObjectDecl(val, `${at}.${key}`, ctx);
|
|
443
|
+
} else if (key === 'overlays' || (Object.keys(val).length > 0 && Object.values(val).every(isRec))) {
|
|
444
|
+
let group: Rec | undefined;
|
|
445
|
+
for (const [name, member] of Object.entries(val)) {
|
|
446
|
+
if (!isRec(member)) continue;
|
|
447
|
+
const m = patchSourceObjectDecl(member, `${at}.${key}.${name}`, ctx);
|
|
448
|
+
if (m !== undefined) group = { ...(group ?? val), [name]: m };
|
|
449
|
+
}
|
|
450
|
+
next = group;
|
|
451
|
+
}
|
|
452
|
+
if (next !== undefined) out = { ...(out ?? objects), [key]: next };
|
|
453
|
+
}
|
|
454
|
+
return out;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* 组件入参 source_object 的声明名出口(SCON-175):按对象名契约(biz/shared/object-aliases.ts,展示对象 ctx.form / data … 与 `soma kit check` 同一份)
|
|
459
|
+
* 把写死形状组件 props.source_object 里的声明名 / 限定名解析成运行期名——组件拿到的仍是 core 数据端口认的运行期名,组件代码不用改;
|
|
460
|
+
* 运行期名原样保留(向后兼容),全是运行期名的值不改写(产物逐字节不变);写错的(不是本页对象、同名歧义)报 KIT-VIEW-003 并给出可写的名字。
|
|
461
|
+
* 值是 view.<成员> 绑定或 page. / row. / $ 路径的不碰(绑定与原始运行期路径另有核对)。纯函数:不改入参,有改写的计划返回新的对象表
|
|
462
|
+
*/
|
|
463
|
+
export function resolveSourceObjectRefs(plans: readonly KitObjectRefPlan[]): KitObjectRefResolution {
|
|
464
|
+
const declared = plans.flatMap((p) => declaredObjectsOfPlan(p));
|
|
465
|
+
const countOf = new Map<string, number>();
|
|
466
|
+
for (const o of declared) countOf.set(o.declared, (countOf.get(o.declared) ?? 0) + 1);
|
|
467
|
+
const offer = [...new Set(declared.map((o) => o.declared))]
|
|
468
|
+
.map((n) => ((countOf.get(n) ?? 0) > 1 ? `${n}(同名,须写 ${declared.filter((o) => o.declared === n).map((o) => `${o.pageId}.${n}`).join(' / ')})` : n))
|
|
469
|
+
.join(' / ') || '无';
|
|
470
|
+
const ctx: ObjectRefCtx = { map: buildKitObjectNameMap(plans), runtime: new Set(declared.map((o) => o.runtime)), offer, diags: [] };
|
|
471
|
+
const objects = plans.map((p) => (isRec(p.objects) ? patchSourceObjectObjects(p.objects, `${p.path}.objects`, ctx) : undefined));
|
|
472
|
+
return { objects, diagnostics: ctx.diags };
|
|
473
|
+
}
|
package/src/data/access-gate.ts
CHANGED
|
@@ -11,9 +11,10 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
11
11
|
import { arrangeReadFailure } from 'soma-foundation/arrange/table';
|
|
12
12
|
import { KIT_ACCESS_STATE_LIMITS } from 'soma-foundation/kit-limits';
|
|
13
13
|
import { splitHttpErrorPrefix, kitStatePanel } from '../base/state-panel';
|
|
14
|
-
import { CLASS_PROP, createKitController } from '../base/shared';
|
|
14
|
+
import { CLASS_PROP, createKitController, joinClass, toggleKitHidden } from '../base/shared';
|
|
15
15
|
import { kitText } from '../i18n/kit-text';
|
|
16
16
|
import { KIT_STATE_DENIED_PAGE, KIT_STATE_DENIED_TITLE, KIT_STATE_DENIED_WRAP } from '../recipes/placeholder';
|
|
17
|
+
import { KIT_ATTR_ACCESS_DENIED } from '../shared/dom-attrs';
|
|
17
18
|
|
|
18
19
|
/** 状态码集合真源(kit-limits#accessState):这里再导出,供编译期 / 测试对账;判据本身在 foundation arrangeReadFailure */
|
|
19
20
|
export { KIT_ACCESS_STATE_LIMITS };
|
|
@@ -22,7 +23,7 @@ interface ReadMeta { readState?: unknown; errorStatus?: unknown; errorMessage?:
|
|
|
22
23
|
interface DataPortLike { getObject?: (name: string) => unknown }
|
|
23
24
|
|
|
24
25
|
const FRAME_SELECTOR = ':scope > [data-soma-id$="frame__root"]';
|
|
25
|
-
const SHOWN_ATTR =
|
|
26
|
+
const SHOWN_ATTR = KIT_ATTR_ACCESS_DENIED;
|
|
26
27
|
|
|
27
28
|
/** 数据对象上 core 挂的读状态(没有 = 还没落定) */
|
|
28
29
|
function metaOf(port: DataPortLike | undefined, name: string): ReadMeta | null {
|
|
@@ -63,9 +64,9 @@ export function createKitAccessGate(): SomaComponentDefinition {
|
|
|
63
64
|
const port = (): DataPortLike | undefined => (api.services as { data?: DataPortLike } | undefined)?.data;
|
|
64
65
|
|
|
65
66
|
const restore = (root: HTMLElement): void => {
|
|
66
|
-
if (hiddenFrame !== null) { hiddenFrame
|
|
67
|
-
root.
|
|
68
|
-
root
|
|
67
|
+
if (hiddenFrame !== null) { toggleKitHidden(hiddenFrame, false); hiddenFrame = null; }
|
|
68
|
+
root.className = joinClass('', api.props().class);
|
|
69
|
+
toggleKitHidden(root, true);
|
|
69
70
|
root.removeAttribute(SHOWN_ATTR);
|
|
70
71
|
root.textContent = '';
|
|
71
72
|
};
|
|
@@ -84,17 +85,24 @@ export function createKitAccessGate(): SomaComponentDefinition {
|
|
|
84
85
|
// 标题 + 说明两级字号(标题走区块标题字阶,说明沿用次要色小字),标题不带句号
|
|
85
86
|
const head = panel.firstElementChild;
|
|
86
87
|
if (head instanceof HTMLElement) { head.className = KIT_STATE_DENIED_TITLE; head.textContent = (head.textContent ?? '').replace(/[。.\s]+$/, ''); }
|
|
87
|
-
root.className = KIT_STATE_DENIED_WRAP;
|
|
88
|
+
root.className = joinClass(KIT_STATE_DENIED_WRAP, api.props().class);
|
|
88
89
|
root.replaceChildren(panel);
|
|
89
90
|
root.setAttribute(SHOWN_ATTR, '');
|
|
90
|
-
root
|
|
91
|
+
toggleKitHidden(root, false);
|
|
91
92
|
const frame = api.host.parentElement?.querySelector<HTMLElement>(FRAME_SELECTOR) ?? null;
|
|
92
|
-
if (frame !== null) { frame
|
|
93
|
+
if (frame !== null) { toggleKitHidden(frame, true); hiddenFrame = frame; }
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
96
|
if (verdict.message === null) {
|
|
96
97
|
if (!verdict.unsettled) armed = false;
|
|
97
98
|
if (root.hasAttribute(SHOWN_ATTR)) restore(root);
|
|
99
|
+
else {
|
|
100
|
+
root.className = joinClass('', api.props().class);
|
|
101
|
+
toggleKitHidden(root, true);
|
|
102
|
+
}
|
|
103
|
+
} else if (!root.hasAttribute(SHOWN_ATTR)) {
|
|
104
|
+
root.className = joinClass('', api.props().class);
|
|
105
|
+
toggleKitHidden(root, true);
|
|
98
106
|
}
|
|
99
107
|
};
|
|
100
108
|
|
|
@@ -102,7 +110,7 @@ export function createKitAccessGate(): SomaComponentDefinition {
|
|
|
102
110
|
attach(root) {
|
|
103
111
|
rootEl = root;
|
|
104
112
|
evaluate(root);
|
|
105
|
-
return () => { if (hiddenFrame !== null) hiddenFrame
|
|
113
|
+
return () => { if (hiddenFrame !== null) { toggleKitHidden(hiddenFrame, false); hiddenFrame = null; } rootEl = null; };
|
|
106
114
|
},
|
|
107
115
|
render(root) { evaluate(root); },
|
|
108
116
|
onDataObjectsChange() { if (rootEl !== null) evaluate(rootEl); },
|
|
@@ -5,40 +5,49 @@
|
|
|
5
5
|
// (soma-foundation/values 写法,如 currency:CNY)才格式化。末行 / 任一行 `total` 为真走合计样式(上分隔线、加粗)。
|
|
6
6
|
// `level`(0–3)决定缩进。`row_action` 配 { key, label } 时每行末尾出一个小按钮,点击抛 `action { key, id }`(如「异议」)。
|
|
7
7
|
|
|
8
|
+
import { kitApplyLevelClass } from './level-class';
|
|
8
9
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
10
|
+
import { kitMarkDataFacts, kitMarkLevel, kitMarkPart } from './kit-contract';
|
|
9
11
|
import { kitText } from '../i18n/kit-text';
|
|
10
12
|
import { createKitController, formatValue, joinClass, num, str } from '../base/shared';
|
|
11
13
|
import { applyKitReadState, KIT_READ_STATE_EMIT_DEFS, KIT_READ_STATE_PROP_DEFS } from '../base/state-panel';
|
|
12
14
|
import { kitTypographyRecipe } from '../recipes/typography';
|
|
13
|
-
import { mergeClass } from '../
|
|
15
|
+
import { mergeClass } from '../shared/merge-class';
|
|
16
|
+
import { KIT_DIVIDER_FOOT_CLASS, kitDividerRecipe } from '../recipes/divider';
|
|
17
|
+
import { KIT_ATTR_ACTION, KIT_ATTR_ROW, kitAttrSel } from '../shared/dom-attrs';
|
|
14
18
|
import {
|
|
15
|
-
actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, keyMap, mk, recOf, rowsOf, shapeToneOf, textOf,
|
|
19
|
+
actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, keyMap, mk, recOf, rowsOf, shapeToneOf, textOf, TONE_TEXT,
|
|
16
20
|
type ShapeTone,
|
|
17
21
|
} from './shape-util';
|
|
18
22
|
|
|
19
23
|
export const KIT_AMOUNT_DEFAULT_MAP = Object.freeze({ id: 'id', label: 'label', amount: 'amount', level: 'level', tone: 'tone', note: 'note', total: 'total' });
|
|
20
24
|
|
|
21
25
|
const ROOT_CLASS = 'flex flex-col gap-1 text-sm text-fg';
|
|
26
|
+
const DL_CLASS = 'm-0 flex flex-col gap-1 p-0';
|
|
22
27
|
const TITLE_CLASS = mergeClass('pb-1', kitTypographyRecipe('sectionTitle'));
|
|
23
28
|
const ROW_CLASS = 'flex items-start justify-between gap-4 py-1';
|
|
24
|
-
|
|
29
|
+
// 合计行上方的线 = 分隔线出口(KT-B5)
|
|
30
|
+
const ROW_TOTAL = `flex items-start justify-between gap-4 ${KIT_DIVIDER_FOOT_CLASS} pt-2 text-base font-semibold`;
|
|
31
|
+
const DT_CLASS = 'min-w-0 flex-1';
|
|
25
32
|
const LEFT_CLASS = 'flex flex-col gap-0.5';
|
|
33
|
+
const CHILD_GUIDE_CLASS = mergeClass(LEFT_CLASS, mergeClass('ps-3', kitDividerRecipe('start')));
|
|
26
34
|
const INDENT: readonly string[] = Object.freeze(['ps-0', 'ps-4', 'ps-8', 'ps-12']);
|
|
27
35
|
const LABEL_CLASS = 'text-fg';
|
|
28
36
|
const NOTE_CLASS = 'text-xs text-fg-subtle';
|
|
29
|
-
const
|
|
37
|
+
const DD_CLASS = 'm-0 flex shrink-0 items-center gap-3 whitespace-nowrap tabular-nums';
|
|
30
38
|
const AMOUNT_CLASS = 'text-end tabular-nums text-fg';
|
|
39
|
+
// 自由数值不许有底(《Kit 主题公式》§7):纯文字色 TONE_TEXT,严禁 TONE_SOFT 带底色
|
|
31
40
|
const AMOUNT_TONE: Readonly<Record<ShapeTone, string>> = Object.freeze({
|
|
32
41
|
neutral: AMOUNT_CLASS,
|
|
33
|
-
primary: `text-end tabular-nums ${
|
|
34
|
-
info: `text-end tabular-nums ${
|
|
35
|
-
success: `text-end tabular-nums ${
|
|
36
|
-
warning: `text-end tabular-nums ${
|
|
37
|
-
danger: `text-end tabular-nums ${
|
|
42
|
+
primary: `text-end tabular-nums ${TONE_TEXT.primary}`,
|
|
43
|
+
info: `text-end tabular-nums ${TONE_TEXT.info}`,
|
|
44
|
+
success: `text-end tabular-nums ${TONE_TEXT.success}`,
|
|
45
|
+
warning: `text-end tabular-nums ${TONE_TEXT.warning}`,
|
|
46
|
+
danger: `text-end tabular-nums ${TONE_TEXT.danger}`,
|
|
38
47
|
});
|
|
39
48
|
|
|
40
49
|
export const KIT_AMOUNT_BREAKDOWN_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
41
|
-
ROOT_CLASS, TITLE_CLASS, ROW_CLASS, ROW_TOTAL, LEFT_CLASS, INDENT, LABEL_CLASS, NOTE_CLASS,
|
|
50
|
+
ROOT_CLASS, DL_CLASS, TITLE_CLASS, ROW_CLASS, ROW_TOTAL, DT_CLASS, LEFT_CLASS, CHILD_GUIDE_CLASS, INDENT, LABEL_CLASS, NOTE_CLASS, DD_CLASS,
|
|
42
51
|
Object.values(AMOUNT_TONE), BUTTON_CLASS_TOKENS,
|
|
43
52
|
);
|
|
44
53
|
|
|
@@ -96,21 +105,27 @@ export function createAmountBreakdown(): SomaComponentDefinition {
|
|
|
96
105
|
controllerFactory: createKitController(() => ({
|
|
97
106
|
attach(root, api) {
|
|
98
107
|
const onClick = (event: Event): void => {
|
|
99
|
-
const btn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(
|
|
108
|
+
const btn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION));
|
|
100
109
|
if (!btn || btn.disabled) return;
|
|
101
|
-
const row = btn.closest<HTMLElement>(
|
|
102
|
-
api.emit('action', { key: btn.getAttribute(
|
|
110
|
+
const row = btn.closest<HTMLElement>(kitAttrSel(KIT_ATTR_ROW));
|
|
111
|
+
api.emit('action', { key: btn.getAttribute(KIT_ATTR_ACTION) ?? '', id: row?.getAttribute(KIT_ATTR_ROW) ?? '' });
|
|
103
112
|
};
|
|
104
113
|
root.addEventListener('click', onClick);
|
|
105
114
|
return () => root.removeEventListener('click', onClick);
|
|
106
115
|
},
|
|
107
116
|
render(root, p, api) {
|
|
108
117
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
118
|
+
const active = root.ownerDocument.activeElement;
|
|
119
|
+
const focusedRowKey = active instanceof HTMLElement && root.contains(active) && active.hasAttribute(KIT_ATTR_ACTION)
|
|
120
|
+
? active.closest<HTMLElement>(kitAttrSel(KIT_ATTR_ROW))?.getAttribute(KIT_ATTR_ROW) ?? null
|
|
121
|
+
: null;
|
|
109
122
|
root.textContent = '';
|
|
110
123
|
const title = str(p.title);
|
|
111
|
-
if (title !== '')
|
|
124
|
+
if (title !== '') { const h = mk('h3', TITLE_CLASS, title); kitMarkPart(h, 'block-title'); root.appendChild(h); }
|
|
112
125
|
const rows = amountRowsOf(p.data, p.map, str(p.format), str(p.locale));
|
|
113
126
|
// 读状态(加载中 / 读取失败 + 重试):与集合三态同一画法(base/state-panel.ts)
|
|
127
|
+
// 数据状态自报(每次渲染都写):与读状态面板同一判据,出错 > 加载 > 空;data-kit-state 面板标记照旧
|
|
128
|
+
kitMarkDataFacts(root, { error: str(p.error_text) !== '', loading: p.loading === true || p.loading === 'true', empty: !(rows.length > 0) });
|
|
114
129
|
if (applyKitReadState(root, p, { hasContent: rows.length > 0, onRetry: () => api.emit('retry', {}), repaint: () => api.refresh() })) return;
|
|
115
130
|
if (rows.length === 0) {
|
|
116
131
|
root.appendChild(emptyNode(str(p.empty_text, kitText('soma.kit.empty_detail', undefined, root))));
|
|
@@ -120,18 +135,32 @@ export function createAmountBreakdown(): SomaComponentDefinition {
|
|
|
120
135
|
const rowAction = textOf(ra.key) !== '' && textOf(ra.label) !== ''
|
|
121
136
|
? { key: textOf(ra.key), label: textOf(ra.label), tone: 'neutral' as const, disabled: false, reason: '' }
|
|
122
137
|
: null;
|
|
138
|
+
const dl = mk('dl', DL_CLASS);
|
|
123
139
|
for (const r of rows) {
|
|
124
140
|
const row = mk('div', r.total ? ROW_TOTAL : ROW_CLASS);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
// 明细行 = 描述项(条目);合计行 = 淡底带(汇总行,§8.2)
|
|
142
|
+
kitMarkLevel(row, r.total ? 'band' : 'item'); kitApplyLevelClass(row);
|
|
143
|
+
row.setAttribute(KIT_ATTR_ROW, r.key);
|
|
144
|
+
const dt = mk('dt', `${DT_CLASS} ${INDENT[r.level]}`);
|
|
145
|
+
const left = mk('span', r.level >= 1 ? CHILD_GUIDE_CLASS : LEFT_CLASS);
|
|
146
|
+
const labelEl = mk('span', LABEL_CLASS, r.label);
|
|
147
|
+
kitMarkPart(labelEl, 'field-name');
|
|
148
|
+
left.appendChild(labelEl);
|
|
128
149
|
if (r.note !== '') left.appendChild(mk('span', NOTE_CLASS, r.note));
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
150
|
+
dt.appendChild(left);
|
|
151
|
+
const dd = mk('dd', DD_CLASS);
|
|
152
|
+
const amountEl = mk('span', AMOUNT_TONE[r.tone], r.amount);
|
|
153
|
+
kitMarkPart(amountEl, 'value');
|
|
154
|
+
dd.appendChild(amountEl);
|
|
155
|
+
if (rowAction) dd.appendChild(actionButton(rowAction));
|
|
156
|
+
row.appendChild(dt);
|
|
157
|
+
row.appendChild(dd);
|
|
158
|
+
dl.appendChild(row);
|
|
159
|
+
}
|
|
160
|
+
root.appendChild(dl);
|
|
161
|
+
if (focusedRowKey !== null) {
|
|
162
|
+
const hitRow = Array.from(dl.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_ROW))).find((el) => el.getAttribute(KIT_ATTR_ROW) === focusedRowKey);
|
|
163
|
+
hitRow?.querySelector<HTMLButtonElement>(`${kitAttrSel(KIT_ATTR_ACTION)}:not(:disabled)`)?.focus({ preventScroll: true });
|
|
135
164
|
}
|
|
136
165
|
},
|
|
137
166
|
})),
|