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
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// 关窗回焦的通则(OV15 / KT-K-overlay;结构第三批 ①):回焦目标 = 稳定标识,不是节点引用。
|
|
2
|
+
//
|
|
3
|
+
// 新建 / 编辑(对话框或整页表单视图)保存成功后,入口所在的区块常随「写后重取」整片重画:记着的按钮节点脱离文档,
|
|
4
|
+
// 或者焦点已经还给它、几百毫秒后它又被换掉(焦点随旧节点丢到 body)。所以回焦分两步:
|
|
5
|
+
// 1. 打开时记下入口的稳定标识(focusKeyOf):动作 id(data-kit-act)或可见文字 + 入口外层的编译期 id 链(data-soma-id)+ 所在行(虚拟滚动行号 / 行序号);
|
|
6
|
+
// 2. 关闭时回焦并「守着」(returnFocus):焦点先给入口(还在就用原节点,不在就按标识在容器里重新找);找不到时落到兜底目标(页标题锚);
|
|
7
|
+
// 之后每当焦点又变空闲(落到 body、落进隐藏区、或还停在兜底目标上)就按标识再找一次——重画后的同一个入口出现即移过去。
|
|
8
|
+
// 守护在用户有任何操作(按键 / 指针按下)、再次打开面板或组件卸载时结束;它只在焦点空闲时动手,绝不从用户放下的位置抢焦点,也绝不主动落 body。
|
|
9
|
+
// 不含数字:没有超时常数,结束条件全是事件。
|
|
10
|
+
|
|
11
|
+
import { KIT_ATTR_ACT, KIT_ATTR_INDEX, KIT_ATTR_LEAVING, KIT_ATTR_ROWS, kitAttrSel } from '../../shared/dom-attrs';
|
|
12
|
+
|
|
13
|
+
export interface KitFocusKey {
|
|
14
|
+
/** 动作 id(入口或其祖先的 data-kit-act);没有时为 null,按可见文字比对 */
|
|
15
|
+
readonly act: string | null;
|
|
16
|
+
/** 入口的可见文字(去首尾空白);act 为 null 时据此比对 */
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** 入口到容器之间带非空 data-soma-id 的祖先 id,由近及远(编译期 id,重画后不变) */
|
|
19
|
+
readonly chain: readonly string[];
|
|
20
|
+
/** 入口在行容器里时的行:虚拟滚动行号(data-kit-index)或非 TEMPLATE 子元素序号;不在行里为 null */
|
|
21
|
+
readonly row: { readonly stamped: string } | { readonly position: number } | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const CANDIDATES = 'button, a[href], [tabindex], input, select, textarea, [role="button"], [role="menuitem"]';
|
|
25
|
+
|
|
26
|
+
const rowChildrenOf = (listEl: Element): Element[] => [...listEl.children].filter((c) => c.tagName !== 'TEMPLATE');
|
|
27
|
+
const hasTemplateChild = (el: Element): boolean => [...el.children].some((c) => c.tagName === 'TEMPLATE');
|
|
28
|
+
|
|
29
|
+
function chainOf(el: Element, container: Element): string[] {
|
|
30
|
+
const out: string[] = [];
|
|
31
|
+
for (let p = el.parentElement; p !== null && p !== container; p = p.parentElement) {
|
|
32
|
+
const id = p.getAttribute('data-soma-id') ?? '';
|
|
33
|
+
if (id !== '') out.push(id);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 行容器:优先 data-kit-rows;没有(普通静态表格)就取容器内第一个「有直接 <template> 子元素」的祖先 */
|
|
39
|
+
function rowsHostOf(el: Element, container: Element): Element | null {
|
|
40
|
+
const marked = el.closest(kitAttrSel(KIT_ATTR_ROWS));
|
|
41
|
+
if (marked !== null && container.contains(marked)) return marked;
|
|
42
|
+
for (let p = el.parentElement; p !== null && p !== container; p = p.parentElement) if (hasTemplateChild(p)) return p;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function rowOf(el: Element, container: Element): KitFocusKey['row'] {
|
|
47
|
+
const list = rowsHostOf(el, container);
|
|
48
|
+
if (list === null) return null;
|
|
49
|
+
const stampedEl = el.closest(kitAttrSel(KIT_ATTR_INDEX));
|
|
50
|
+
const stamped = stampedEl !== null && list.contains(stampedEl) ? stampedEl.getAttribute(KIT_ATTR_INDEX) : null;
|
|
51
|
+
if (typeof stamped === 'string') return { stamped };
|
|
52
|
+
let rowNode: Element = el;
|
|
53
|
+
while (rowNode.parentElement !== null && rowNode.parentElement !== list) rowNode = rowNode.parentElement;
|
|
54
|
+
if (rowNode.parentElement !== list) return null;
|
|
55
|
+
const position = rowChildrenOf(list).indexOf(rowNode);
|
|
56
|
+
return position >= 0 ? { position } : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const labelOf = (el: Element): string => (el.getAttribute('aria-label') ?? el.textContent ?? '').trim();
|
|
60
|
+
|
|
61
|
+
/** 入口的稳定标识;入口不在容器里、或既无动作 id 又无可见文字时为 null(只能靠原节点) */
|
|
62
|
+
export function focusKeyOf(el: Element | null, container: Element | null | undefined): KitFocusKey | null {
|
|
63
|
+
if (!(el instanceof HTMLElement) || !container || !container.contains(el) || el === container) return null;
|
|
64
|
+
const act = el.closest(kitAttrSel(KIT_ATTR_ACT))?.getAttribute(KIT_ATTR_ACT) ?? null;
|
|
65
|
+
const label = labelOf(el);
|
|
66
|
+
if ((act === null || act === '') && label === '') return null;
|
|
67
|
+
return { act: act === '' ? null : act, label, chain: chainOf(el, container), row: rowOf(el, container) };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const sameRow = (a: KitFocusKey['row'], b: KitFocusKey['row']): boolean => {
|
|
71
|
+
if (a === null || b === null) return a === b;
|
|
72
|
+
if ('stamped' in a) return 'stamped' in b && a.stamped === b.stamped;
|
|
73
|
+
return 'position' in b && a.position === b.position;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** 可交焦点:在文档里、不在隐藏区(hidden 属性 / hidden 类 / 退场中 / inert)、未禁用 */
|
|
77
|
+
export function focusUsable(el: Element | null): el is HTMLElement {
|
|
78
|
+
if (!(el instanceof HTMLElement) || !el.isConnected) return false;
|
|
79
|
+
if (el.closest(`[hidden], .hidden, ${kitAttrSel(KIT_ATTR_LEAVING)}, [inert]`) !== null) return false;
|
|
80
|
+
return !(el as HTMLButtonElement).disabled;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** 按稳定标识在容器里找回入口(同动作 / 同文字 + 同一条 id 链 + 同一行);找到的节点可能暂时不可交焦点(还在隐藏区里) */
|
|
84
|
+
export function resolveFocusKey(key: KitFocusKey, container: Element): HTMLElement | null {
|
|
85
|
+
const pool = key.act !== null
|
|
86
|
+
? [...container.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_ACT))].filter((n) => n.getAttribute(KIT_ATTR_ACT) === key.act)
|
|
87
|
+
: [...container.querySelectorAll<HTMLElement>(CANDIDATES)].filter((n) => labelOf(n) === key.label);
|
|
88
|
+
const hits = pool.filter((n) => {
|
|
89
|
+
const c = chainOf(n, container);
|
|
90
|
+
return c.length === key.chain.length && c.every((id, i) => id === key.chain[i]) && sameRow(rowOf(n, container), key.row);
|
|
91
|
+
});
|
|
92
|
+
return hits.find(focusUsable) ?? hits[0] ?? null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ReturnFocusOptions {
|
|
96
|
+
/** 入口所在的容器(按标识重找的范围,也是观察重画的范围) */
|
|
97
|
+
readonly container: HTMLElement;
|
|
98
|
+
/** 打开时的入口节点(仍可用就直接用) */
|
|
99
|
+
readonly element: HTMLElement | null;
|
|
100
|
+
readonly key: KitFocusKey | null;
|
|
101
|
+
/** 入口找不回时的兜底(按序;每次重新求值,如页标题锚) */
|
|
102
|
+
readonly fallbacks: ReadonlyArray<() => HTMLElement | null>;
|
|
103
|
+
/** 焦点算不算「空闲」(在 body / 隐藏区 / 收起的表单里);空闲时守护才会动手 */
|
|
104
|
+
readonly idle: () => boolean;
|
|
105
|
+
/** 组件仍挂着 */
|
|
106
|
+
readonly alive: () => boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 回焦并守着,直到用户有操作;返回结束函数。
|
|
111
|
+
* 第一拍:原节点仍连接就无条件还给它(与以前一致:面板打开期间焦点在面板里);其余时候只在焦点空闲时动手。
|
|
112
|
+
*/
|
|
113
|
+
export function returnFocus(o: ReturnFocusOptions): () => void {
|
|
114
|
+
const doc = o.container.ownerDocument;
|
|
115
|
+
let stopped = false;
|
|
116
|
+
let placedFallback: HTMLElement | null = null;
|
|
117
|
+
let placedTarget: HTMLElement | null = null;
|
|
118
|
+
let tid: ReturnType<typeof setTimeout> | undefined;
|
|
119
|
+
let observer: MutationObserver | undefined;
|
|
120
|
+
const holds = (el: HTMLElement | null): boolean => el !== null && doc.activeElement === el;
|
|
121
|
+
const target = (): HTMLElement | null => {
|
|
122
|
+
if (o.element !== null && o.element.isConnected && o.container.contains(o.element)) return o.element;
|
|
123
|
+
return o.key === null ? null : resolveFocusKey(o.key, o.container);
|
|
124
|
+
};
|
|
125
|
+
const attempt = (first: boolean): void => {
|
|
126
|
+
if (stopped) return;
|
|
127
|
+
if (!o.alive()) { stop(); return; }
|
|
128
|
+
// 焦点已稳在入口上:不动
|
|
129
|
+
if (placedTarget !== null && holds(placedTarget) && focusUsable(placedTarget)) return;
|
|
130
|
+
const onFallback = placedFallback !== null && holds(placedFallback);
|
|
131
|
+
if (!first && !onFallback && !o.idle()) { stop(); return; } // 用户已把焦点放到别处
|
|
132
|
+
const t = target();
|
|
133
|
+
if (t !== null && focusUsable(t)) {
|
|
134
|
+
t.focus();
|
|
135
|
+
if (holds(t)) { placedTarget = t; placedFallback = null; }
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
// 入口还在(只是暂时在隐藏区里)或已在兜底上:等下一次变化
|
|
139
|
+
if (t !== null || onFallback) return;
|
|
140
|
+
for (const pick of o.fallbacks) {
|
|
141
|
+
const f = pick();
|
|
142
|
+
if (!focusUsable(f)) continue;
|
|
143
|
+
if (!f.matches(CANDIDATES)) f.setAttribute('tabindex', '-1');
|
|
144
|
+
f.focus();
|
|
145
|
+
if (holds(f)) { placedFallback = f; return; }
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const schedule = (): void => {
|
|
149
|
+
if (stopped || tid !== undefined) return;
|
|
150
|
+
tid = setTimeout(() => { tid = undefined; attempt(false); }, 0);
|
|
151
|
+
};
|
|
152
|
+
const onUser = (): void => stop();
|
|
153
|
+
const onFocusOut = (): void => schedule();
|
|
154
|
+
function stop(): void {
|
|
155
|
+
if (stopped) return;
|
|
156
|
+
stopped = true;
|
|
157
|
+
if (tid !== undefined) clearTimeout(tid);
|
|
158
|
+
observer?.disconnect();
|
|
159
|
+
doc.removeEventListener('keydown', onUser, true);
|
|
160
|
+
doc.removeEventListener('pointerdown', onUser, true);
|
|
161
|
+
doc.removeEventListener('focusout', onFocusOut, true);
|
|
162
|
+
}
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
attempt(true);
|
|
165
|
+
if (stopped) return;
|
|
166
|
+
doc.addEventListener('keydown', onUser, true);
|
|
167
|
+
doc.addEventListener('pointerdown', onUser, true);
|
|
168
|
+
doc.addEventListener('focusout', onFocusOut, true);
|
|
169
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
170
|
+
observer = new MutationObserver(schedule);
|
|
171
|
+
observer.observe(o.container, { childList: true, subtree: true, attributes: true, attributeFilter: ['hidden', 'class'] });
|
|
172
|
+
}
|
|
173
|
+
}, 0);
|
|
174
|
+
return stop;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 页标题锚:文档里第一个可见的 h1(页头标题),没有 tabindex 时回焦补 -1 */
|
|
178
|
+
export function pageTitleAnchor(doc: Document): HTMLElement | null {
|
|
179
|
+
return [...doc.querySelectorAll<HTMLElement>('h1')].find(focusUsable) ?? null;
|
|
180
|
+
}
|
|
@@ -17,6 +17,7 @@ const isRec = (v: unknown): v is Record<string, unknown> => v !== null && typeof
|
|
|
17
17
|
export const KIT_GROUP_ROLE_PREFIX: Readonly<Record<string, Readonly<Record<string, string>>>> = Object.freeze({
|
|
18
18
|
StepForm: { steps: 'step_' },
|
|
19
19
|
MultiObjectBoard: { panels: 'panel_' },
|
|
20
|
+
ReportBoard: { panels: 'panel_' },
|
|
20
21
|
RecordDetail: { subs: 'sub_', groups: 'grp_' },
|
|
21
22
|
LandingPage: { sections: 'sec_' },
|
|
22
23
|
});
|
|
@@ -37,7 +38,12 @@ export interface KitDeclaredObject {
|
|
|
37
38
|
readonly decl: Readonly<Record<string, unknown>>;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
/**
|
|
42
|
+
* 「对象声明」的判据(只此一处):单个对象、分组表的成员、浮层表的成员都按它认;编译期组件入参的声明名出口(compile/view-check.ts)同用它,
|
|
43
|
+
* 与本契约认对象同一个走法(否则编译期改写与运行期 / `soma kit check` 解析会对同一页认出不同的对象表)
|
|
44
|
+
*/
|
|
45
|
+
export const isKitObjectDeclLike = (v: unknown): v is Record<string, unknown> => isRec(v) && ('schema' in v || 'behavior' in v || 'view' in v || 'title' in v);
|
|
46
|
+
const isObjectDecl = isKitObjectDeclLike;
|
|
41
47
|
|
|
42
48
|
/** 一个产品声明的全部对象:声明名 -> 运行期名 */
|
|
43
49
|
export function declaredObjectsOfPlan(plan: KitObjectPlan): KitDeclaredObject[] {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// 一个附加浮层 = 一个附加关联对象(可选读接口 / 写死形状组件 / 表单)+ 浮层壳(dialog / drawer)。协作链写死:
|
|
4
4
|
// 行动作 builtin: openOverlay + targetOverlay -> semantic crud_open_overlay -> 协调组件写 focus(ov.<名> + 当前行)
|
|
5
|
+
// 工具条动作(StandardCrud,SCON-170)-> semantic crud_open_overlay_<动作 id> -> 协调组件以空行写 focus(ov.<名> + 预填行,ovMode = create);
|
|
6
|
+
// 这类浮层(args.rowless)的表单 mode 绑 focus.ovMode 镜像,只被行动作打开的浮层仍写死 edit
|
|
5
7
|
// -> 镜像驱动浮层显隐 / 读接口 params(当前行主键)/ 表单 initial;协调组件打开后重取附加对象
|
|
6
8
|
// 浮层里的组件事件(saved / cancel / close / reload 约定名,或 events 映射)交协调组件;`{ action }` 绑一条具名动作 / request 管道,
|
|
7
9
|
// request 成功后由页面级动作宿主固定「关窗 + 重取」(closeOnSuccess),失败保持打开(编辑不丢)。
|
|
@@ -14,16 +16,19 @@ import { emitObject } from '../../object-renderer/emit-object';
|
|
|
14
16
|
import { viewMethodPipe } from '../../object-renderer/emit-events';
|
|
15
17
|
import { classifyEventBinding } from '../../object-renderer/view-binding';
|
|
16
18
|
import { isRequestLikeAction, registerRequestAction } from '../../object-renderer/request-actions';
|
|
17
|
-
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
19
|
+
import { kitOwnBusyChannels, viewAnchor } from '../../object-renderer/emit-static';
|
|
18
20
|
import type { KitAction, KitDiagnostic, KitObject, KitView, KitViewForm } from '../../object-renderer/types';
|
|
19
|
-
import { busyActionOf } from '../../base/action-busy';
|
|
21
|
+
import { busyActionOf, kitObjectBusyChannel } from '../../base/action-busy';
|
|
20
22
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
21
23
|
import type { KitBizContext, KitOverlayDecl, KitOverlayEventAction } from '../types';
|
|
22
24
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS, overlayMirrorKey } from './coordinator';
|
|
23
25
|
import { addEmit, IDENT, isRec, labelDiagnostics, mirrorPath, patchProps, type Parts, type Rec } from '../link/shared';
|
|
24
26
|
import { semanticPipe, wireDialogForm } from './pipes';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
+
import { overlayHtml, overlayIds } from './overlay-shell';
|
|
28
|
+
import { dialogWidthOf, drawerWidthOf, editContainerOf, footerPlanOf } from '../../object-renderer/overlay-decide';
|
|
29
|
+
import { kitText } from '../../i18n/kit-text';
|
|
30
|
+
import { wireOverlayPageForm } from './page-form';
|
|
31
|
+
import { isNextPipeline, kitObjectAnchor } from './pipeline';
|
|
27
32
|
|
|
28
33
|
/**
|
|
29
34
|
* 抽屉里有没有提交动作:返回原因(无则 null)。判据:表单视图、behavior.write、事件接到具名动作 / saved 语义、
|
|
@@ -45,6 +50,28 @@ export function drawerSubmitReason(decl: KitOverlayDecl, view: KitView, staticCo
|
|
|
45
50
|
return null;
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
const FOOTER_REASON: Readonly<Record<string, string>> = Object.freeze({
|
|
54
|
+
'left-over': '左侧次级动作超过上限',
|
|
55
|
+
extras: '有动作想放进底栏却没有位置',
|
|
56
|
+
'visible-over': '底栏可见按钮总数超过上限',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 窗口底栏排法(KIT-OVL-004,先以告警落地):右侧固定「取消 + 一个主动作」,左侧至多一个次级动作,其余进「更多」或改成正文控件。
|
|
61
|
+
* 判定在引擎(arrangeOverlayFooter,规则 kit-arrange#overlay.footer),这里只取事实(表单的 footerActions 数)并出诊断。
|
|
62
|
+
*/
|
|
63
|
+
export function adviseDialogFooter(ctx: KitBizContext, formView: unknown, path: string): void {
|
|
64
|
+
if (ctx.advise === undefined) return;
|
|
65
|
+
const plan = footerPlanOf(formView);
|
|
66
|
+
if (plan.ok) return;
|
|
67
|
+
ctx.advise({
|
|
68
|
+
code: 'KIT-OVL-004',
|
|
69
|
+
path,
|
|
70
|
+
message: `窗口底栏排不下:${FOOTER_REASON[plan.reason] ?? plan.reason}(按钮 ${plan.visible} 个)`,
|
|
71
|
+
hint: '底栏右侧只放「取消 + 主动作」,左侧至多一个次级动作;其余收进更多,或改成正文里的控件',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
48
75
|
/** 浮层里数据组件的约定事件 -> 角色(K-1) */
|
|
49
76
|
const OVERLAY_EVENT_ROLES: Record<string, string> = KIT_GRAMMAR.overlayEventRoles.conventional as Record<string, string>;
|
|
50
77
|
const OVERLAY_ROLE_SEMANTIC: Record<string, string> = {
|
|
@@ -114,6 +141,11 @@ export interface OverlayHostArgs {
|
|
|
114
141
|
editLabel: string;
|
|
115
142
|
/** 只读浮层 -> 编辑浮层(validateOverlayNames 的返回值) */
|
|
116
143
|
showEdit: Record<string, string>;
|
|
144
|
+
/**
|
|
145
|
+
* 有无行入口的浮层名(SCON-170:StandardCrud 工具条 / 页头 openOverlay 的目标):它们的表单 mode 绑协调组件的 focus.ovMode 镜像
|
|
146
|
+
* (无行打开 = create,行打开 = edit);不给 / 不在其中的浮层表单照旧写死 edit
|
|
147
|
+
*/
|
|
148
|
+
rowless?: ReadonlySet<string>;
|
|
117
149
|
}
|
|
118
150
|
|
|
119
151
|
export interface CompiledOverlay {
|
|
@@ -121,6 +153,8 @@ export interface CompiledOverlay {
|
|
|
121
153
|
mirror: SomaScopeMirrorDecl;
|
|
122
154
|
/** 附加对象名(协调组件 props.overlays 的值) */
|
|
123
155
|
object: string;
|
|
156
|
+
/** 编辑表单按容器公式得整页(同页切换的表单视图):宿主把浮层名交给协调组件 pageOverlays,并让列表 / 主从区让位 */
|
|
157
|
+
page: boolean;
|
|
124
158
|
}
|
|
125
159
|
|
|
126
160
|
/** 编一个 dialog / drawer 浮层;诊断写进 `h.out.diagnostics`,不可编返回 undefined(`expand` 种类不在此处理) */
|
|
@@ -130,31 +164,37 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
|
|
|
130
164
|
const at = `product.overlays.${name}`;
|
|
131
165
|
if (!IDENT.test(name)) return undefined;
|
|
132
166
|
// 抽屉宽度档:width 只对 kind: drawer 有效(对话框宽度由内容定档),取值闭集 narrow / default / wide
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
else dialogTier = decl.width;
|
|
142
|
-
} else {
|
|
143
|
-
fail('KIT-BIZ-003', `浮层 ${name} 的 width 只对 kind: drawer / dialog 有效`, `${at}.width`);
|
|
144
|
-
}
|
|
167
|
+
// 窗口的大小与外观由框架按内容推导(确认 400、表单 480 / 640 / 800、只读抽屉 480 / 640,尺寸规格 §5),页面不写 width / class(KIT-OVL-003)
|
|
168
|
+
// 过渡期:KIT-OVL-002 / 003 先以告警落地(不挡编译,kit check 的弃用提示段带出),应用按 apps-todo 改完后升为错误
|
|
169
|
+
const warn = (code: string, message: string, path: string, hint: string): void => {
|
|
170
|
+
if (ctx.advise !== undefined) ctx.advise({ code, path, message, hint });
|
|
171
|
+
else fail(code, message, path);
|
|
172
|
+
};
|
|
173
|
+
for (const key of ['width', 'class'] as const) {
|
|
174
|
+
if (decl[key] !== undefined) warn('KIT-OVL-003', `浮层 ${name} 写了 ${key}:窗口的宽度与外观由框架按内容推导,该键已不生效`, `${at}.${key}`, `删掉 ${key};要换档请改内容(栏数 arrange、组件):单列 480、两列或宽组件 640、三列或画布 800、只读抽屉 480 / 640`);
|
|
145
175
|
}
|
|
146
176
|
const view = normalizeOverlayView(decl.view);
|
|
147
177
|
if (view === undefined) {
|
|
148
178
|
fail('KIT-BIZ-001', `附加浮层 ${name} 缺少 view`, `${at}.view`);
|
|
149
179
|
return undefined;
|
|
150
180
|
}
|
|
181
|
+
// 形态:没写 kind 时由内容推出(带提交 → 窗口 / 整页,只读 → 抽屉);带表单的窗口再过容器公式(KT-P-window):整页 = 同页切换的表单视图
|
|
182
|
+
const kind = overlayKindOf(decl, view, ctx.staticComponents);
|
|
183
|
+
const asPage = kind === 'dialog' && view.form !== undefined && editContainerOf({ form: view.form, schema: decl.schema }, { edit: true }).container === 'page';
|
|
184
|
+
if (asPage && decl.kind === 'dialog') {
|
|
185
|
+
warn('KIT-IA-009', `浮层 ${name} 写了 kind: dialog,但它的编辑表单按容器公式是整页表单(加权字段数超过对话框上限、含重型字段或多个分组):已按整页表单视图渲染`, `${at}.kind`, '删掉 kind(带提交的浮层由框架按内容推出对话框 / 整页表单,只读的推出抽屉)');
|
|
186
|
+
}
|
|
151
187
|
// 抽屉只承载只读详情;要填写并提交、或确认后写入的浮层一律居中模态(KIT-OVL-001)
|
|
152
188
|
if (decl.kind === 'drawer') {
|
|
153
189
|
const why = drawerSubmitReason(decl, view, ctx.staticComponents);
|
|
154
190
|
if (why !== null) {
|
|
155
|
-
fail('KIT-OVL-001', `浮层 ${name} 是抽屉却承载提交动作(${why}):填写并提交、或确认后写入的浮层改写 kind: dialog
|
|
191
|
+
fail('KIT-OVL-001', `浮层 ${name} 是抽屉却承载提交动作(${why}):填写并提交、或确认后写入的浮层改写 kind: dialog(宽度由栏数与宽组件推导),抽屉只用于只读详情`, `${at}.kind`);
|
|
156
192
|
}
|
|
193
|
+
} else if (decl.kind === 'dialog' && drawerSubmitReason(decl, view, ctx.staticComponents) === null) {
|
|
194
|
+
// 只读内容一律抽屉(KIT-OVL-002):没有表单、写入、提交动作的居中窗口是错类型
|
|
195
|
+
warn('KIT-OVL-002', `浮层 ${name} 是居中窗口却只读(没有表单视图、behavior.write、具名动作或 saved 事件)`, `${at}.kind`, '只读内容改写 kind: drawer;居中窗口只给确认与带提交的表单');
|
|
157
196
|
}
|
|
197
|
+
if (kind === 'dialog') adviseDialogFooter(ctx, view.form, `${at}.view.form.footerActions`);
|
|
158
198
|
// 编辑详情(behavior.detail)与读通道(behavior.from)二选一:from 已是「按关联键取浮层对象」的读口
|
|
159
199
|
if (decl.behavior?.from !== undefined && decl.behavior?.detail !== undefined) {
|
|
160
200
|
fail('KIT-DET-001', `附加浮层 ${name} 同时写了 behavior.from 与 behavior.detail:二选一(from 已按关联键取浮层对象,detail 用于以当前行为初值的编辑表单)`, `${at}.behavior.detail`);
|
|
@@ -192,13 +232,17 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
|
|
|
192
232
|
out.scopes[ovScope] = { id: ovScope, object: ovObject, slices: [...(have?.slices ?? [])], ...(have?.mirrors !== undefined ? { mirrors: have.mirrors } : {}) };
|
|
193
233
|
}
|
|
194
234
|
// 浮层里的可编辑表单:编辑取回的单对象(或注入的当前行),保存后关窗并刷新
|
|
235
|
+
// 无行入口(SCON-170):mode 绑 focus.ovMode 镜像——工具条以空行打开时是 create(字段初值生效、提交走 write.create),行动作打开时是 edit;
|
|
236
|
+
// initial 同一条路径(无行打开时当前行 = 组件级预填 + 递增序号,表单每次按新建重建)
|
|
195
237
|
const ovFormId = viewAnchor(ovObject, 'form');
|
|
196
238
|
if (view.form !== undefined) {
|
|
197
|
-
|
|
239
|
+
const mode = h.rowless?.has(name) === true ? mirrorPath(scope, m.ovMode.key) : 'edit';
|
|
240
|
+
patchProps(out.show, ovFormId, { mode, initial: injectRow ? rowPath : `page.data.${ovObject}`, scope: `${ovObject}__form`, cancelLabel: h.cancelLabel });
|
|
198
241
|
wireDialogForm(out.events, ovFormId, scope);
|
|
199
242
|
}
|
|
200
243
|
// K-1 / M1-3:浮层里的写死形状数据组件(应用组件)按约定抛 saved / cancel / close / reload,由协调组件接;
|
|
201
244
|
// overlays.<名>.events 可再把自定义事件名映射到这四种之一。组件没抛的事件不会触发(core 对未声明的 emit 选择器惰性)
|
|
245
|
+
const submitActions = new Set<string>();
|
|
202
246
|
for (const slot of ['list', 'summary'] as const) {
|
|
203
247
|
const staticComp = view[slot]?.staticComponent;
|
|
204
248
|
if (staticComp === undefined) continue;
|
|
@@ -234,7 +278,10 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
|
|
|
234
278
|
continue;
|
|
235
279
|
}
|
|
236
280
|
out.events[`${anchor}.${emitName}`] = actionPipe;
|
|
237
|
-
|
|
281
|
+
// 忙闲通道名:声明式请求取「对象 × 动作」通道(KitActionHost 按登记时的对象名登记,契约 C2),具名动作取动作名(执行器按名登记)
|
|
282
|
+
namedOn[emitName] = declared !== undefined ? kitObjectBusyChannel(object, role.action) : role.action;
|
|
283
|
+
// 提交类事件(saved 语义)绑的应用具名动作:登记为本浮层的提交动作,成功后框架默认关窗 + 成功反馈(request 类已由宿主 closeOnSuccess)
|
|
284
|
+
if (declared === undefined && (emitName === 'saved' || OVERLAY_EVENT_ROLES[emitName] === 'saved')) submitActions.add(role.action);
|
|
238
285
|
continue;
|
|
239
286
|
}
|
|
240
287
|
// view.<方法>:浮层里组件抛出的事件调展示对象方法(载荷 = 组件 emit 的载荷;不关窗不重取,要请求走 ctx.request / ctx.action)
|
|
@@ -256,10 +303,29 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
|
|
|
256
303
|
}
|
|
257
304
|
const busyNames = busyActionOf(view[slot]!.staticComponent!, namedOn);
|
|
258
305
|
const shown = out.show[anchor];
|
|
259
|
-
|
|
306
|
+
const handwritten = isRec(shown) && isRec((shown as Rec).props) ? ((shown as Rec).props as Rec).busy_action : undefined;
|
|
307
|
+
if (typeof handwritten === 'string' && handwritten !== '') {
|
|
308
|
+
// 页面手写的 busy_action(SCON-176):浮层对象自己的声明式请求已由 emit-static 换好;这里再把点名主对象声明式 request / download
|
|
309
|
+
// (浮层事件 { action } 引用的同一个池子,KitActionHost 按主对象名登记)的 id 换成按对象的通道名;具名动作名与不认识的名字原样
|
|
310
|
+
const own = kitOwnBusyChannels(handwritten, actions, object);
|
|
311
|
+
if (own !== handwritten) patchProps(out.show, anchor, { busy_action: own });
|
|
312
|
+
} else if (busyNames !== null && handwritten === undefined && isRec(shown) && isRec((shown as Rec).props)) {
|
|
260
313
|
patchProps(out.show, anchor, { busy_action: busyNames });
|
|
261
314
|
}
|
|
262
315
|
}
|
|
316
|
+
const mirror: SomaScopeMirrorDecl = { key: overlayMirrorKey(name), slice: 'focus', path: `ov.${name}`, as: 'truthy' };
|
|
317
|
+
if (asPage) {
|
|
318
|
+
const submitLabel = view.form !== undefined && typeof (view.form as { submitLabel?: unknown }).submitLabel === 'string' && (view.form as { submitLabel: string }).submitLabel !== ''
|
|
319
|
+
? (view.form as { submitLabel: string }).submitLabel
|
|
320
|
+
: kitText('soma.kit.save', undefined, ctx.locale);
|
|
321
|
+
const html = wireOverlayPageForm(out, {
|
|
322
|
+
object: ovObject, scope, overlay: name, formId: ovFormId, formHtml: ovEmit.html, title: decl.title ?? name, submit: submitLabel,
|
|
323
|
+
...(ctx.locale !== undefined ? { locale: ctx.locale } : {}),
|
|
324
|
+
// 新模式:整页编辑面就是这个附加浮层对象的容器,给它补对象锚点(与版式契约 overlays 角色的 anchor 同一拼法)
|
|
325
|
+
...(isNextPipeline(ctx) ? { bodyAnchor: kitObjectAnchor(ovObject) } : {}),
|
|
326
|
+
});
|
|
327
|
+
return { html, mirror, object: ovObject, page: true };
|
|
328
|
+
}
|
|
263
329
|
const ids = overlayIds(object, name);
|
|
264
330
|
out.show[ids.layer] = { when: mirrorPath(scope, overlayMirrorKey(name)) };
|
|
265
331
|
out.events[`${ids.close}.click`] = semanticPipe(scope, KIT_COORD_EVENTS.close);
|
|
@@ -269,13 +335,25 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
|
|
|
269
335
|
out.events[`${ids.edit}.click`] = semanticPipe(scope, KIT_COORD_EVENTS.showEdit);
|
|
270
336
|
}
|
|
271
337
|
return {
|
|
272
|
-
//
|
|
273
|
-
html: overlayHtml(ids,
|
|
338
|
+
// 窗口宽度档只由内容经引擎推导(overlay-decide),外壳只渲染档名;页面写的宽度类(class / areaClass)被壳忽略
|
|
339
|
+
html: overlayHtml(ids, kind === 'drawer' ? 'drawer' : 'dialog', decl.title ?? name, ovEmit.html, undefined, areaClass, withEdit, h.closeLabel, '', dialogWidthOf({
|
|
274
340
|
form: view.form,
|
|
275
341
|
schema: decl.schema,
|
|
276
342
|
staticComponent: view.list?.staticComponent ?? view.summary?.staticComponent,
|
|
277
|
-
}),
|
|
278
|
-
|
|
343
|
+
}), drawerWidthOf({
|
|
344
|
+
form: view.form,
|
|
345
|
+
schema: decl.schema,
|
|
346
|
+
staticComponent: view.list?.staticComponent ?? view.summary?.staticComponent,
|
|
347
|
+
tableList: view.list !== undefined && view.list.staticComponent === undefined && (view.list.collection === undefined || view.list.collection.type === 'table'),
|
|
348
|
+
}), [...submitActions], true, isNextPipeline(ctx) ? kitObjectAnchor(ovObject) : undefined),
|
|
349
|
+
mirror,
|
|
279
350
|
object: ovObject,
|
|
351
|
+
page: false,
|
|
280
352
|
};
|
|
281
353
|
}
|
|
354
|
+
|
|
355
|
+
/** 浮层形态:写了 kind 用它;没写时带提交(表单 / 写入 / 具名动作或 saved 事件)→ dialog(再由容器公式定对话框 / 整页),只读 → drawer */
|
|
356
|
+
export function overlayKindOf(decl: KitOverlayDecl, view: KitView, staticComponents: Readonly<Record<string, { emits?: readonly string[] } | undefined>>): 'dialog' | 'drawer' | 'expand' {
|
|
357
|
+
if (decl.kind !== undefined) return decl.kind;
|
|
358
|
+
return drawerSubmitReason(decl, view, staticComponents) !== null ? 'dialog' : 'drawer';
|
|
359
|
+
}
|