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
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
// single-frame:页面头 + 全幅主产品工作区(缺省框)。
|
|
2
|
+
// 舞台基线:frame__root / frame__width / frame__main 沿纵向 flex-1 贯通,仅让主动声明 flex-1 的列表型工作台(StandardCrud / CategoryCrud / MasterSub)
|
|
3
|
+
// 在 0 行/稀疏数据时自然落底撑满视口;表单 / 设置 / 结果 / 登录页自身不带 flex-1,保持固有内容高度不被拉伸。
|
|
2
4
|
|
|
3
|
-
import type { KitFrameDefinition } from './types';
|
|
4
|
-
import {
|
|
5
|
+
import type { KitFrameDefinition, KitFrameInput } from './types';
|
|
6
|
+
import { mergeClass } from '../shared/merge-class';
|
|
7
|
+
import { checkFrameClasses, checkSlots, classAttr, finishFrame, headerFragment, maxWidthClass, rootClass, slotFragment, slotWrapper, widthCandidates } from './shared';
|
|
8
|
+
|
|
9
|
+
const STAGE_WIDTH_CLASS = 'flex flex-1 flex-col';
|
|
10
|
+
// next 模式下 frame__width 挂 data-kit-envelope(取值表写 container-type: inline-size + margin-inline: auto),
|
|
11
|
+
// 在 flex-col 画布根内必须显式 w-full min-w-0(对齐 legacy 的 mx-auto w-full 与 import-wizard/step-form 约定),避免固有宽归零塌缩为 0px。
|
|
12
|
+
const NEXT_STAGE_WIDTH_CLASS = `w-full min-w-0 ${STAGE_WIDTH_CLASS}`;
|
|
13
|
+
|
|
14
|
+
function singleWidthWrap(input: KitFrameInput, inner: string): string {
|
|
15
|
+
if (input.pipeline === 'next') return `<div data-soma-id="frame__width"${classAttr(NEXT_STAGE_WIDTH_CLASS)}>${inner}</div>`;
|
|
16
|
+
const maxW = maxWidthClass(input);
|
|
17
|
+
return maxW === '' ? inner : `<div data-soma-id="frame__width"${classAttr(mergeClass(maxW, STAGE_WIDTH_CLASS))}>${inner}</div>`;
|
|
18
|
+
}
|
|
5
19
|
|
|
6
20
|
export const singleFrame: KitFrameDefinition = {
|
|
7
21
|
kind: 'single-frame',
|
|
@@ -11,7 +25,9 @@ export const singleFrame: KitFrameDefinition = {
|
|
|
11
25
|
const diagnostics = [...checkSlots('single-frame', ['main'], ['main'], input), ...checkFrameClasses(input)];
|
|
12
26
|
const head = headerFragment(input);
|
|
13
27
|
const main = slotFragment(input.slots.main);
|
|
14
|
-
const
|
|
15
|
-
|
|
28
|
+
const rootCls = mergeClass(rootClass(input), 'flex flex-col');
|
|
29
|
+
const html = `<div data-soma-id="frame__root"${classAttr(rootCls)}>${singleWidthWrap(input, `${head.html}${slotWrapper('main', STAGE_WIDTH_CLASS, input, main.html)}`)}</div>`;
|
|
30
|
+
const extra = input.pipeline === 'next' ? ['w-full', 'min-w-0', 'flex', 'flex-1', 'flex-col'] : ['flex', 'flex-1', 'flex-col'];
|
|
31
|
+
return finishFrame([head, main], html, [...widthCandidates(input), ...extra], diagnostics);
|
|
16
32
|
},
|
|
17
33
|
};
|
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
// 不写 config = 原样 6:6,行为与原先完全一致。
|
|
10
10
|
|
|
11
11
|
import type { KitDiagnostic } from '../../object-renderer/types';
|
|
12
|
+
import { KIT_FOCUS_RING } from '../../recipes/state';
|
|
12
13
|
import type { KitFrameDefinition, KitFrameInput } from '../types';
|
|
13
14
|
import { checkFrameClasses, checkNoMaxWidth, checkSlots, classAttr, esc, finishFrame, headerFragment, rootClass, slotFragment, slotWrapper } from '../shared';
|
|
14
15
|
|
|
15
|
-
import { kitIconHtml, type KitIconName } from '../../
|
|
16
|
+
import { kitIconHtml, type KitIconName } from '../../shared/icons';
|
|
17
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
18
|
+
import {
|
|
19
|
+
KIT_ATTR_FACE, KIT_ATTR_SPLIT_CELL, KIT_ATTR_SPLIT_FRAME, KIT_ATTR_SPLIT_GRID, KIT_ATTR_SPLIT_HANDLE, KIT_ATTR_SPLIT_HANDLE_WRAP, KIT_ATTR_SPLIT_TOGGLE,
|
|
20
|
+
} from '../../shared/dom-attrs';
|
|
21
|
+
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
16
22
|
import { SPLIT_G, splitSpanClass, splitSpanClasses, type SplitDirection, type SplitSide } from './span';
|
|
17
23
|
|
|
18
24
|
// 限值与档位类在 ./span(接线件在浏览器面只取那里);这里再导出保持原导出面
|
|
@@ -21,31 +27,35 @@ export type { SplitDirection, SplitSide } from './span';
|
|
|
21
27
|
|
|
22
28
|
const WRAP_CLASS = '@container';
|
|
23
29
|
const GRID_CLASS = 'grid grid-cols-12 gap-4';
|
|
30
|
+
// 可拖宽 / 可折叠分栏使用 gap-6(24px)与折叠钮 h-6 w-6(24px)等宽:按钮用 -end-6 / -start-6 精准落在间隙正中,绝不压住右栏标题文字
|
|
31
|
+
const RESIZABLE_GRID_CLASS = 'grid grid-cols-12 gap-6';
|
|
24
32
|
const CELL_CLASS = 'col-span-12 @md:col-span-6';
|
|
25
33
|
|
|
26
34
|
// ── 手柄与折叠按钮的静态类 ──────────────────────────────────────────────
|
|
27
35
|
// 外层只放定位(无显示类,接线件在折叠时给它 hidden),内层是真正的 separator
|
|
28
|
-
const H_HANDLE_WRAP = 'absolute inset-y-0 -end-
|
|
29
|
-
const V_HANDLE_WRAP = 'absolute inset-x-0 -bottom-
|
|
30
|
-
const HANDLE_COMMON = 'group h-full w-full rounded-
|
|
36
|
+
const H_HANDLE_WRAP = 'absolute inset-y-0 -end-4 z-10 w-2';
|
|
37
|
+
const V_HANDLE_WRAP = 'absolute inset-x-0 -bottom-4 z-10 h-2';
|
|
38
|
+
const HANDLE_COMMON = 'group h-full w-full rounded-item touch-none ' + KIT_FOCUS_RING.button;
|
|
31
39
|
const H_HANDLE = `hidden @md:block cursor-col-resize ${HANDLE_COMMON}`;
|
|
32
40
|
const V_HANDLE = `block cursor-row-resize ${HANDLE_COMMON}`;
|
|
33
41
|
const BAR_COMMON = 'bg-border-subtle transition-colors group-hover:bg-primary group-focus-visible:bg-primary group-data-kit-dragging:bg-primary';
|
|
34
42
|
const H_BAR = `mx-auto block h-full w-1 rounded-full ${BAR_COMMON}`;
|
|
35
43
|
const V_BAR = `block h-1 w-full mt-0.5 rounded-full ${BAR_COMMON}`;
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
44
|
+
// 折叠钮浮在分隔条上 = 浮起表面(发丝描边 + 浮起阴影,KT-B4),胶囊圆角是构件形体
|
|
45
|
+
const TOGGLE_FACE = mergeClass(kitSurfaceRecipe('raised'), 'rounded-full');
|
|
46
|
+
const TOGGLE_COMMON = 'z-20 items-center justify-center ' + TOGGLE_FACE + ' text-xs text-fg-muted transition-colors state-layer hover:text-fg ' + KIT_FOCUS_RING.button;
|
|
47
|
+
const H_TOGGLE_RIGHT = `absolute top-2 -end-6 hidden h-6 w-6 @md:flex ${TOGGLE_COMMON}`;
|
|
48
|
+
const H_TOGGLE_LEFT = `absolute top-2 -start-6 hidden h-6 w-6 @md:flex ${TOGGLE_COMMON}`;
|
|
49
|
+
const V_TOGGLE_BOTTOM = `absolute start-2 -bottom-6 flex h-6 w-6 ${TOGGLE_COMMON}`;
|
|
50
|
+
const V_TOGGLE_TOP = `absolute start-2 -top-6 flex h-6 w-6 ${TOGGLE_COMMON}`;
|
|
41
51
|
const V_BODY = 'h-full overflow-auto';
|
|
42
|
-
const V_GRID = 'grid grid-cols-1 grid-rows-12 gap-
|
|
52
|
+
const V_GRID = 'grid grid-cols-1 grid-rows-12 gap-6';
|
|
43
53
|
const H_CELL_RESIZABLE = 'relative col-span-12';
|
|
44
54
|
const V_CELL_RESIZABLE = 'relative min-h-0';
|
|
45
55
|
|
|
46
56
|
export const KIT_SPLIT_CLASS_CANDIDATES: string[] = [...new Set<string>([
|
|
47
57
|
...splitSpanClasses('horizontal'), ...splitSpanClasses('vertical'),
|
|
48
|
-
...[H_HANDLE_WRAP, V_HANDLE_WRAP, H_HANDLE, V_HANDLE, H_BAR, V_BAR, H_TOGGLE_RIGHT, H_TOGGLE_LEFT, V_TOGGLE_BOTTOM, V_TOGGLE_TOP, V_BODY, V_GRID, H_CELL_RESIZABLE, V_CELL_RESIZABLE]
|
|
58
|
+
...[RESIZABLE_GRID_CLASS, H_HANDLE_WRAP, V_HANDLE_WRAP, H_HANDLE, V_HANDLE, H_BAR, V_BAR, H_TOGGLE_RIGHT, H_TOGGLE_LEFT, V_TOGGLE_BOTTOM, V_TOGGLE_TOP, V_BODY, V_GRID, H_CELL_RESIZABLE, V_CELL_RESIZABLE]
|
|
49
59
|
.flatMap((s) => s.split(/\s+/)),
|
|
50
60
|
...Object.values(SPLIT_G.heightTiers),
|
|
51
61
|
].filter((c) => c !== ''))].sort();
|
|
@@ -166,9 +176,9 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
166
176
|
: `${V_CELL_RESIZABLE} ${splitSpanClass(dir, 'right', cfg.ratio, collapsedSide === 'left')}`;
|
|
167
177
|
|
|
168
178
|
const body = (frag: { html: string }): string => horizontal ? frag.html : `<div class="${V_BODY}">${frag.html}</div>`;
|
|
169
|
-
const sepAttrs =
|
|
179
|
+
const sepAttrs = `${KIT_ATTR_SPLIT_HANDLE}="" `;
|
|
170
180
|
const handle = cfg.resizable
|
|
171
|
-
? `<div
|
|
181
|
+
? `<div ${KIT_ATTR_SPLIT_HANDLE_WRAP}="" data-soma-id="frame__handle_wrap" class="${horizontal ? H_HANDLE_WRAP : V_HANDLE_WRAP}"${collapsedSide === '' ? '' : ' hidden'}><div ${sepAttrs}data-soma-id="frame__handle" class="${horizontal ? H_HANDLE : V_HANDLE}"><span class="${horizontal ? H_BAR : V_BAR}"></span></div></div>`
|
|
172
182
|
: '';
|
|
173
183
|
// 折叠按钮挂在「另一栏」边缘:可折叠 left → 按钮在 right 栏;可折叠 right → 在 left 栏
|
|
174
184
|
const glyph = (side: SplitSide, collapsed: boolean): KitIconName => {
|
|
@@ -181,7 +191,7 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
181
191
|
const cls = horizontal ? (side === 'right' ? H_TOGGLE_RIGHT : H_TOGGLE_LEFT) : (side === 'right' ? V_TOGGLE_BOTTOM : V_TOGGLE_TOP);
|
|
182
192
|
const isCollapsed = collapsedSide === side;
|
|
183
193
|
const label = isCollapsed ? cfg.expandLabel : cfg.collapseLabel;
|
|
184
|
-
return `<button type="button"
|
|
194
|
+
return `<button type="button" ${KIT_ATTR_FACE}="raised" ${KIT_ATTR_SPLIT_TOGGLE}="${side}" data-soma-id="frame__toggle" aria-expanded="${isCollapsed ? 'false' : 'true'}" aria-controls="${esc(`frame__${side}`)}" aria-label="${esc(label)}" data-icon-open="${glyph(side, false)}" data-icon-closed="${glyph(side, true)}"${classAttr(cls)}>${kitIconHtml(glyph(side, isCollapsed), 'sm', 'rtl:-scale-x-100')}</button>`;
|
|
185
195
|
};
|
|
186
196
|
// 按钮放在另一栏:left 可折叠 → right 栏里;right 可折叠 → left 栏里
|
|
187
197
|
const leftInner = `${body(left)}${handle}${toggleFor('right')}`;
|
|
@@ -190,10 +200,10 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
190
200
|
const cell = (slot: SplitSide, base: string, inner: string): string => {
|
|
191
201
|
const tag = slotWrapper(slot, base, input, inner);
|
|
192
202
|
const hide = collapsedSide === slot ? ' hidden' : '';
|
|
193
|
-
return tag.replace('<div data-soma-id="', `<div id="frame__${slot}"
|
|
203
|
+
return tag.replace('<div data-soma-id="', `<div id="frame__${slot}" ${KIT_ATTR_SPLIT_CELL}="${slot}"${hide} data-soma-id="`);
|
|
194
204
|
};
|
|
195
|
-
const gridClass = horizontal ? GRID_CLASS : `${V_GRID} ${SPLIT_G.heightTiers[cfg.height] ?? ''}`;
|
|
196
|
-
const grid = `<div data-soma-id="frame__split"
|
|
205
|
+
const gridClass = horizontal ? (cfg.resizable ? RESIZABLE_GRID_CLASS : GRID_CLASS) : `${V_GRID} ${SPLIT_G.heightTiers[cfg.height] ?? ''}`;
|
|
206
|
+
const grid = `<div data-soma-id="frame__split" ${KIT_ATTR_SPLIT_FRAME}=""${classAttr(WRAP_CLASS)}><div ${KIT_ATTR_SPLIT_GRID}="" data-soma-id="frame__grid"${classAttr(gridClass)}>${cell('left', leftClass(), leftInner)}${cell('right', rightClass(), rightInner)}</div></div>`;
|
|
197
207
|
const wiring = cfg.resizable ? '<div data-soma-component="KitSplitWiring" data-soma-id="frame__split_wiring" hidden></div>' : '';
|
|
198
208
|
const head = headerFragment(input);
|
|
199
209
|
const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input))}>${head.html}${grid}${wiring}</div>`;
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
11
11
|
import { createKitController, num, str, type KitProps } from '../../base/shared';
|
|
12
|
-
import { attachResizeHandle, type ResizeHandle } from '
|
|
12
|
+
import { attachResizeHandle, type ResizeHandle } from '../../base/resize-handle';
|
|
13
13
|
import { kitDirAt } from '../../i18n/kit-text';
|
|
14
|
-
import { kitIcon, type KitIconName } from '../../
|
|
14
|
+
import { kitIcon, type KitIconName } from '../../shared/icons';
|
|
15
|
+
import {
|
|
16
|
+
KIT_ATTR_SPLIT_CELL, KIT_ATTR_SPLIT_FRAME, KIT_ATTR_SPLIT_GRID, KIT_ATTR_SPLIT_HANDLE, KIT_ATTR_SPLIT_HANDLE_WRAP, KIT_ATTR_SPLIT_TOGGLE, kitAttrSel,
|
|
17
|
+
} from '../../shared/dom-attrs';
|
|
15
18
|
import { SPLIT_G, splitSpanClass, splitSpanClasses, type SplitDirection, type SplitSide } from './span';
|
|
16
19
|
|
|
17
20
|
interface WiringState { key: string; destroy(): void }
|
|
@@ -77,10 +80,11 @@ export function createKitSplitWiring(): SomaComponentDefinition {
|
|
|
77
80
|
|
|
78
81
|
const host = api.host;
|
|
79
82
|
const prev = host.previousElementSibling;
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
?? host.
|
|
83
|
-
??
|
|
83
|
+
const frameSel = kitAttrSel(KIT_ATTR_SPLIT_FRAME);
|
|
84
|
+
const frame = (prev instanceof HTMLElement && prev.hasAttribute(KIT_ATTR_SPLIT_FRAME) ? prev : null)
|
|
85
|
+
?? host.closest<HTMLElement>(frameSel)
|
|
86
|
+
?? host.parentElement?.querySelector<HTMLElement>(frameSel)
|
|
87
|
+
?? root.parentElement?.querySelector<HTMLElement>(frameSel)
|
|
84
88
|
?? null;
|
|
85
89
|
if (!frame) return;
|
|
86
90
|
const direction: SplitDirection = str(p.direction) === 'vertical' ? 'vertical' : 'horizontal';
|
|
@@ -96,14 +100,14 @@ export function createKitSplitWiring(): SomaComponentDefinition {
|
|
|
96
100
|
collapsed: collapsible !== '' && (saved.collapsed ?? str(p.collapsed)) === collapsible ? collapsible : '',
|
|
97
101
|
};
|
|
98
102
|
|
|
99
|
-
const grid = frame.querySelector<HTMLElement>(
|
|
103
|
+
const grid = frame.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SPLIT_GRID));
|
|
100
104
|
const cells: Record<SplitSide, HTMLElement | null> = {
|
|
101
|
-
left: frame.querySelector<HTMLElement>('
|
|
102
|
-
right: frame.querySelector<HTMLElement>('
|
|
105
|
+
left: frame.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SPLIT_CELL, 'left')),
|
|
106
|
+
right: frame.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SPLIT_CELL, 'right')),
|
|
103
107
|
};
|
|
104
|
-
const wrap = frame.querySelector<HTMLElement>(
|
|
105
|
-
const handleEl = frame.querySelector<HTMLElement>(
|
|
106
|
-
const toggle = frame.querySelector<HTMLButtonElement>(
|
|
108
|
+
const wrap = frame.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SPLIT_HANDLE_WRAP));
|
|
109
|
+
const handleEl = frame.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SPLIT_HANDLE));
|
|
110
|
+
const toggle = frame.querySelector<HTMLButtonElement>(kitAttrSel(KIT_ATTR_SPLIT_TOGGLE));
|
|
107
111
|
if (!grid || !cells.left || !cells.right || !handleEl) return;
|
|
108
112
|
|
|
109
113
|
const allSpan = splitSpanClasses(direction);
|
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
// 首签默认显示,其余面板初始 hidden。槽位按页签 id 取(slots[id]);没有同名槽位时,取 slots.tabs 数组里同序号的片段。
|
|
6
6
|
// 页签 id 限字母数字下划线,供锚点使用(锚点不含点号)。
|
|
7
7
|
|
|
8
|
-
import type { KitFragment } from '../../
|
|
8
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
9
9
|
import type { KitDiagnostic } from '../../object-renderer/types';
|
|
10
10
|
import type { KitFrameDefinition, KitFrameInput } from '../types';
|
|
11
11
|
import { KIT_TAB_BAR_BLEED_CLASS, asList, bleedMark, checkFrameClasses, classAttr, checkNoMaxWidth, esc, finishFrame, headerFragment, rootClass, slotFragment } from '../shared';
|
|
12
|
-
import { mergeClass } from '../../
|
|
12
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
13
|
+
import { KIT_ATTR_TABS_FRAME, KIT_ATTR_TAB_PANEL, KIT_ATTR_VT } from '../../shared/dom-attrs';
|
|
13
14
|
import { kitTabRecipe } from '../../recipes/tabs';
|
|
15
|
+
import { projectTabOverflow } from '../../object-renderer/action-group';
|
|
14
16
|
|
|
15
17
|
// 页签呈现唯一出口 recipes/tabs(页内页签 / 分组页签 / 外壳页签条同一套);选中态用 aria-selected 变体(接线件写 aria-selected,类串仍是静态字面量)
|
|
16
18
|
const TAB_RECIPE = kitTabRecipe();
|
|
17
19
|
const BAR_CLASS = `mb-4 ${TAB_RECIPE.bar}`;
|
|
18
|
-
const TAB_CLASS = TAB_RECIPE.tab;
|
|
19
20
|
|
|
20
21
|
const ID_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
21
22
|
|
|
@@ -68,7 +69,10 @@ export const tabsFrame: KitFrameDefinition = {
|
|
|
68
69
|
const buttons: string[] = [];
|
|
69
70
|
const panels: string[] = [];
|
|
70
71
|
const parts: KitFragment[] = [];
|
|
72
|
+
// KT-K-tabs-3(§6.1 G-16):放不下的尾部页签编译期估宽、按容器档隐藏,收进「更多」;选中页签恒可见
|
|
73
|
+
const overflow = projectTabOverflow(tabs.map((t) => t.title), TAB_RECIPE.tab);
|
|
71
74
|
tabs.forEach((t, i) => {
|
|
75
|
+
const TAB_CLASS = overflow.tabClasses[i] ?? TAB_RECIPE.tab;
|
|
72
76
|
const frag = slotFragment(tabFragment(input, t.id, i));
|
|
73
77
|
if (frag.html === '') {
|
|
74
78
|
diagnostics.push({ code: 'KIT-FRAME-001', path: `frame.${t.id}`, message: `页签 ${t.id} 没有挂载产品` });
|
|
@@ -78,17 +82,20 @@ export const tabsFrame: KitFrameDefinition = {
|
|
|
78
82
|
const cls = mergeClass('', input.slotClass?.[t.id]);
|
|
79
83
|
// 外层只放 hidden(无 preflight:与 grid / flex 同元素会让隐藏失效),slotClass 在内层
|
|
80
84
|
// data-kit-vt:页面过渡的内容区命名点(样式 view-transition-name: kit-content;同一时刻只有显示的那块参与,不会重名)
|
|
81
|
-
panels.push(`<div data-soma-id="${esc(panelAnchor(t.id, input.frameId))}"
|
|
85
|
+
panels.push(`<div data-soma-id="${esc(panelAnchor(t.id, input.frameId))}" ${KIT_ATTR_TAB_PANEL}="" ${KIT_ATTR_VT}=""${i === 0 ? '' : ' hidden'}><div data-soma-id="${esc(`${fp}tabs__body__${t.id}`)}"${bleedMark(input)}${classAttr(cls)}>${frag.html}</div></div>`);
|
|
82
86
|
});
|
|
83
87
|
|
|
84
88
|
const barId = `${fp}tabs__bar`;
|
|
85
89
|
const wiringId = `${fp}tabs__wiring`;
|
|
86
|
-
const
|
|
90
|
+
const moreShell = overflow.hasMore
|
|
91
|
+
? `<div${classAttr(`${overflow.moreClass} -mb-px`)}><div data-soma-component="KitActionMore" data-soma-id="${esc(`${fp}tabs__more`)}"></div></div>`
|
|
92
|
+
: '';
|
|
93
|
+
const bar = `<div data-soma-id="${esc(barId)}" role="tablist"${classAttr(input.bleed === true ? mergeClass(BAR_CLASS, KIT_TAB_BAR_BLEED_CLASS) : BAR_CLASS)}>${buttons.join('')}${moreShell}</div>`;
|
|
87
94
|
// 隐藏接线件:给页签栏补 ARIA 与键盘,并切面板 hidden(见 wiring.ts)
|
|
88
95
|
const wiring = `<div data-soma-component="KitTabsWiring" data-soma-id="${esc(wiringId)}" hidden></div>`;
|
|
89
96
|
// data-kit-tabs-frame:接线件从自身往上找到它,只在本框内查锚点
|
|
90
97
|
const head = headerFragment(input, fp);
|
|
91
|
-
const html = `<div data-soma-id="${esc(`${fp}frame__root`)}"
|
|
98
|
+
const html = `<div data-soma-id="${esc(`${fp}frame__root`)}" ${KIT_ATTR_TABS_FRAME}=""${classAttr(rootClass(input))}>${head.html}${bar}${wiring}<div data-soma-id="${esc(`${fp}tabs__panels`)}">${panels.join('')}</div></div>`;
|
|
92
99
|
const out = finishFrame([head, ...parts], html, [], [...diagnostics, ...checkNoMaxWidth('tabs-frame', input)]);
|
|
93
100
|
const show = (out.ui.show ??= {});
|
|
94
101
|
if (wiringId in show) {
|
|
@@ -98,7 +105,7 @@ export const tabsFrame: KitFrameDefinition = {
|
|
|
98
105
|
props: { bar: barId, tab_prefix: tabAnchor('', input.frameId), panel_prefix: panelAnchor('', input.frameId), ids: tabs.map((t) => t.id) },
|
|
99
106
|
};
|
|
100
107
|
}
|
|
101
|
-
out.components = [...new Set([...out.components, 'KitTabsWiring'])];
|
|
108
|
+
out.components = [...new Set([...out.components, 'KitTabsWiring', ...(overflow.hasMore ? ['KitActionMore'] : [])])];
|
|
102
109
|
return out;
|
|
103
110
|
},
|
|
104
111
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
8
8
|
import { createKitController, str, wireKitTablist, type KitProps } from '../../base/shared';
|
|
9
|
+
import { KIT_ATTR_TABS_FRAME, kitAttrSel } from '../../shared/dom-attrs';
|
|
9
10
|
|
|
10
11
|
interface WiringState { key: string; destroy(): void }
|
|
11
12
|
const STATES = new WeakMap<HTMLElement, WiringState>();
|
|
@@ -47,7 +48,7 @@ export function createKitTabsWiring(): SomaComponentDefinition {
|
|
|
47
48
|
state.destroy();
|
|
48
49
|
state.key = key;
|
|
49
50
|
// 从自身宿主往上找所属 tabs-frame 根,只在根内查锚点;找不到根(应用自画外壳)才退回整个文档
|
|
50
|
-
const doc: ParentNode = root.closest<HTMLElement>(
|
|
51
|
+
const doc: ParentNode = root.closest<HTMLElement>(kitAttrSel(KIT_ATTR_TABS_FRAME)) ?? root.ownerDocument;
|
|
51
52
|
const barEl = doc.querySelector<HTMLElement>(`[data-soma-id="${bar}"]`);
|
|
52
53
|
if (!barEl) return;
|
|
53
54
|
const tabOf = (id: string): HTMLElement | null => doc.querySelector<HTMLElement>(`[data-soma-id="${tabPrefix}${id}"]`);
|
|
@@ -1,9 +1,60 @@
|
|
|
1
1
|
// top-main-frame:页面头 + 上下两段(顶部概览产品槽 + 主业务产品槽),固定间距 space-y-4(面板之间统一 16)。
|
|
2
|
+
// 导航槽(top-nav 意图词对应本框):frame.config.nav = [{ id, label, href?, icon?, disabled?, children? }] 时,页头上方画一条横向菜单条(MenuBar,
|
|
3
|
+
// 项高 = 顶栏高 − 8、选中主色字 + 底部指示条);当前项 = href 等于本页地址的一项。kit.app.yaml#layout.header.nav 声明在 top-nav 页面框下由编译器
|
|
4
|
+
// 转进这里(继承外壳不再另画一份文字链接)。没有 nav 时与改动前逐字节一致。
|
|
2
5
|
|
|
3
|
-
import
|
|
6
|
+
import { kitSelfAttrs } from '../shared/page-attrs-runtime';
|
|
7
|
+
import type { KitFrameDefinition, KitFrameInput } from './types';
|
|
4
8
|
import { checkFrameClasses, checkSlots, classAttr, finishFrame, headerFragment, rootClass, slotFragment, slotWrapper, widthCandidates, widthWrap } from './shared';
|
|
9
|
+
import { emptyFragment, type KitFragment } from '../object-renderer/fragment';
|
|
10
|
+
import { KIT_STRIP_NAVBAR_CLASS } from '../recipes/strip';
|
|
11
|
+
import { KIT_DIVIDER_HEAD_CLASS } from '../recipes/divider';
|
|
12
|
+
import { KIT_SCOPE_ATTR, KIT_SCOPE_SHELL } from '../recipes/color-role';
|
|
13
|
+
import { mergeClass } from '../shared/merge-class';
|
|
14
|
+
import { escapeHtml } from '../shared/escape';
|
|
5
15
|
|
|
6
16
|
const STACK_CLASS = 'space-y-4';
|
|
17
|
+
const NAV_BAR_CLASS = mergeClass(
|
|
18
|
+
`${KIT_STRIP_NAVBAR_CLASS.md} mb-4 flex w-full min-w-0 max-w-full items-stretch overflow-x-auto bg-layer-top px-4 in-data-kit-embed:hidden`,
|
|
19
|
+
KIT_DIVIDER_HEAD_CLASS,
|
|
20
|
+
);
|
|
21
|
+
const NAV_ID = 'frame__nav';
|
|
22
|
+
const NAV_MENU_ID = 'frame__nav_menu';
|
|
23
|
+
const DARK_SHELL_MODES = new Set(['navy', 'brand', 'graphite', 'dark', 'shell']);
|
|
24
|
+
|
|
25
|
+
type NavRec = Record<string, unknown>;
|
|
26
|
+
const navTarget = (it: NavRec): string => (typeof it.href === 'string' ? it.href : typeof it.url === 'string' ? it.url : '');
|
|
27
|
+
|
|
28
|
+
/** 导航槽片段:config.nav 缺省 / 为空 → null(不画) */
|
|
29
|
+
function navFragment(input: KitFrameInput): KitFragment | null {
|
|
30
|
+
const raw = input.config?.nav;
|
|
31
|
+
if (!Array.isArray(raw) || raw.length === 0) return null;
|
|
32
|
+
const items = raw.filter((it): it is NavRec => it !== null && typeof it === 'object' && !Array.isArray(it)).map((it, i) => {
|
|
33
|
+
const target = navTarget(it);
|
|
34
|
+
return {
|
|
35
|
+
id: typeof it.id === 'string' && it.id !== '' ? it.id : `nav${i}`,
|
|
36
|
+
label: typeof it.label === 'string' ? it.label : '',
|
|
37
|
+
...(target !== '' ? { href: target } : {}),
|
|
38
|
+
...(typeof it.icon === 'string' ? { icon: it.icon } : {}),
|
|
39
|
+
...(it.disabled === true ? { disabled: true } : {}),
|
|
40
|
+
...(Array.isArray(it.children) ? { children: it.children } : {}),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
if (items.length === 0) return null;
|
|
44
|
+
const current = items.find((it) => 'href' in it && it.href === input.page.url);
|
|
45
|
+
const rawShell = typeof input.config?.shell === 'string' ? input.config.shell : '';
|
|
46
|
+
// 新模式:导航条恒自报外壳区作用域(外壳区在当前主题下是深是浅由取值表决定),不再按应用的外壳色模式在模板里判断
|
|
47
|
+
const shellAttr = input.pipeline === 'next'
|
|
48
|
+
? kitSelfAttrs({ scope: KIT_SCOPE_SHELL })
|
|
49
|
+
: DARK_SHELL_MODES.has(rawShell) || input.config?.dark_shell === true
|
|
50
|
+
? ` ${KIT_SCOPE_ATTR}="${KIT_SCOPE_SHELL}"`
|
|
51
|
+
: '';
|
|
52
|
+
const out = emptyFragment();
|
|
53
|
+
out.html = `<nav data-soma-id="${escapeHtml(NAV_ID)}"${shellAttr}${classAttr(NAV_BAR_CLASS)}><div data-soma-component="MenuBar" data-soma-id="${escapeHtml(NAV_MENU_ID)}"></div></nav>`;
|
|
54
|
+
out.ui.show = { [NAV_MENU_ID]: { props: { data: items, selected: current?.id ?? '' } } };
|
|
55
|
+
out.components = ['MenuBar'];
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
7
58
|
|
|
8
59
|
export const topMainFrame: KitFrameDefinition = {
|
|
9
60
|
kind: 'top-main-frame',
|
|
@@ -11,11 +62,12 @@ export const topMainFrame: KitFrameDefinition = {
|
|
|
11
62
|
capabilities: { supportsMaxWidth: true },
|
|
12
63
|
compile(input) {
|
|
13
64
|
const diagnostics = [...checkSlots('top-main-frame', ['top', 'main'], ['top', 'main'], input), ...checkFrameClasses(input)];
|
|
65
|
+
const nav = navFragment(input);
|
|
14
66
|
const head = headerFragment(input);
|
|
15
67
|
const top = slotFragment(input.slots.top);
|
|
16
68
|
const main = slotFragment(input.slots.main);
|
|
17
69
|
const body = `<div data-soma-id="frame__stack"${classAttr(STACK_CLASS)}>${top.html.trim() === '' ? '' : slotWrapper('top', '', input, top.html)}${slotWrapper('main', '', input, main.html)}</div>`;
|
|
18
|
-
const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input))}>${widthWrap(input, `${head.html}${body}`)}</div>`;
|
|
19
|
-
return finishFrame([head, top, main], html, widthCandidates(input), diagnostics);
|
|
70
|
+
const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input))}>${nav?.html ?? ''}${widthWrap(input, `${head.html}${body}`)}</div>`;
|
|
71
|
+
return finishFrame([...(nav === null ? [] : [nav]), head, top, main], html, widthCandidates(input), diagnostics);
|
|
20
72
|
},
|
|
21
73
|
};
|
package/src/frames/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 页面框接口(跨组接口 3):页面框是写死的模板外壳,不是组件层。纯函数。
|
|
2
2
|
|
|
3
|
-
import type { KitFragment } from '../
|
|
3
|
+
import type { KitFragment } from '../object-renderer/fragment';
|
|
4
|
+
import type { KitThemeDensity } from '../shared/primitives-types';
|
|
4
5
|
|
|
5
6
|
export interface KitPageMeta {
|
|
6
7
|
url: string;
|
|
@@ -65,7 +66,9 @@ export interface KitFrameInput {
|
|
|
65
66
|
/** 页面语言(同 KitBizContext.locale):页面框写进产物的内置文案按它取 */
|
|
66
67
|
locale?: string;
|
|
67
68
|
/** 应用级九维密度(kit.app.yaml#app.theme.density,由编译器从应用继承,页面框自己不单设):缺省与默认 STANDARD_BALANCED 及 COMPACT_DENSE 同为 p-4 标准画布,显式给 SPACIOUS_AIRY 用 p-6 宽松画布 */
|
|
68
|
-
density?:
|
|
69
|
+
density?: KitThemeDensity;
|
|
70
|
+
/** 主题流水线模式(同 KitBizContext.pipeline):只有 next 时才给;next 下页面框不写判定类属性,并给区域容器补锚点 */
|
|
71
|
+
pipeline?: 'legacy' | 'next';
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export interface KitFrameDefinition {
|
|
@@ -8,14 +8,18 @@
|
|
|
8
8
|
// · 分享 hash:见 spec workspaceFrame.shareHashNote。内部状态驱动时本模块读写地址栏,受控模式只抛 hash_open { url }。
|
|
9
9
|
|
|
10
10
|
import { KIT_GRAMMAR_RUNTIME as grammarJson } from '../../generated/kit-grammar-runtime';
|
|
11
|
+
import { KIT_FOCUS_RING } from '../../recipes/state';
|
|
11
12
|
import { createAlert } from '../../base/alert';
|
|
12
13
|
import { createButton } from '../../base/button';
|
|
13
|
-
import { kitIcon } from '../../
|
|
14
|
+
import { kitIcon } from '../../shared/icons';
|
|
14
15
|
import { safeHref } from '../../base/link';
|
|
15
16
|
import { kitText } from '../../i18n/kit-text';
|
|
16
17
|
import { createSystemSwitcher } from '../../data/system-switcher';
|
|
17
18
|
import { mountKitComponent, type KitMount } from '../../data/embed';
|
|
18
19
|
import { h, isRec, onOutsidePointer, recList, textOf, type Rec } from '../../data/menu-dom';
|
|
20
|
+
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
21
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
22
|
+
import { KIT_ATTR_SYSTEMS, KIT_ATTR_SYSTEMS_SCRIM } from '../../shared/dom-attrs';
|
|
19
23
|
|
|
20
24
|
const SHARE_PARAM = (grammarJson as unknown as { workspaceFrame: { shareHash: { param: string } } }).workspaceFrame.shareHash.param;
|
|
21
25
|
|
|
@@ -23,8 +27,10 @@ export const WORKSPACE_EXTRAS_CLASSES = {
|
|
|
23
27
|
alertsShown: 'flex shrink-0 flex-col gap-2 bg-surface px-4 pt-2',
|
|
24
28
|
alertRow: 'flex items-center gap-2',
|
|
25
29
|
alertBar: 'min-w-0 flex-1',
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
alertAction: 'shrink-0 self-center',
|
|
31
|
+
systemsScrim: 'fixed inset-0 z-0 bg-scrim',
|
|
32
|
+
systemsWrap: mergeClass(kitSurfaceRecipe('raised'), 'relative z-10 max-h-96 overflow-y-auto'),
|
|
33
|
+
systemsClose: 'absolute end-3 top-3 inline-flex size-8 cursor-pointer items-center justify-center rounded-control text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg ' + KIT_FOCUS_RING.button,
|
|
28
34
|
} as const;
|
|
29
35
|
const HIDDEN = 'hidden';
|
|
30
36
|
|
|
@@ -68,6 +74,7 @@ export function mountWorkspaceExtras(host: WorkspaceExtrasHost): WorkspaceExtras
|
|
|
68
74
|
let alertSig = '';
|
|
69
75
|
let alertMounts: KitMount[] = [];
|
|
70
76
|
let panelOpen = false;
|
|
77
|
+
let panelScrim: HTMLElement | null = null;
|
|
71
78
|
let panelWrap: HTMLElement | null = null;
|
|
72
79
|
let switcher: KitMount | null = null;
|
|
73
80
|
let offOutside: (() => void) | null = null;
|
|
@@ -96,8 +103,12 @@ export function mountWorkspaceExtras(host: WorkspaceExtrasHost): WorkspaceExtras
|
|
|
96
103
|
}, { close: () => host.emit('alert_close', { id }) }));
|
|
97
104
|
const action = isRec(a.action) ? a.action : null;
|
|
98
105
|
if (action) {
|
|
99
|
-
const box = h('div',
|
|
100
|
-
|
|
106
|
+
const box = h('div', WORKSPACE_EXTRAS_CLASSES.alertAction);
|
|
107
|
+
// 告警动作钮放入 Alert 内部动作区(关闭钮之前),不再挂在告警框外面的灰底上
|
|
108
|
+
const alertBoxEl = bar.querySelector<HTMLElement>('[data-soma-scoped-id="box"], [data-soma-id="box"]');
|
|
109
|
+
const closeBtn = alertBoxEl?.querySelector<HTMLElement>('[data-soma-scoped-id="close"], [data-soma-id="close"]');
|
|
110
|
+
if (alertBoxEl) alertBoxEl.insertBefore(box, closeBtn ?? null);
|
|
111
|
+
else row.append(box);
|
|
101
112
|
alertMounts.push(mountKitComponent(createButton(), box, { label: textOf(action.label, textOf(action.id)), variant: 'neutral', size: 'sm' }, {
|
|
102
113
|
click: () => host.emit('alert_action', { id, action: textOf(action.id) }),
|
|
103
114
|
}));
|
|
@@ -116,16 +127,21 @@ export function mountWorkspaceExtras(host: WorkspaceExtrasHost): WorkspaceExtras
|
|
|
116
127
|
switcher = null;
|
|
117
128
|
panelWrap?.remove();
|
|
118
129
|
panelWrap = null;
|
|
130
|
+
panelScrim?.remove();
|
|
131
|
+
panelScrim = null;
|
|
119
132
|
};
|
|
120
133
|
const openPanel = (): void => {
|
|
121
134
|
if (panelOpen || !isRec(cfg.systems)) return;
|
|
122
135
|
panelOpen = true;
|
|
123
|
-
const
|
|
136
|
+
const scrim = h('div', WORKSPACE_EXTRAS_CLASSES.systemsScrim, { [KIT_ATTR_SYSTEMS_SCRIM]: '', 'aria-hidden': 'true' });
|
|
137
|
+
scrim.addEventListener('click', closePanel);
|
|
138
|
+
const wrap = h('div', WORKSPACE_EXTRAS_CLASSES.systemsWrap, { [KIT_ATTR_SYSTEMS]: '' });
|
|
124
139
|
const close = h('button', WORKSPACE_EXTRAS_CLASSES.systemsClose, { type: 'button', 'aria-label': kitText('soma.kit.sw_close', undefined, host.root) }, kitIcon('close', 'md'));
|
|
125
140
|
close.addEventListener('click', closePanel);
|
|
126
141
|
const body = h('div', '');
|
|
127
142
|
wrap.append(body, close);
|
|
128
|
-
host.panelHost.append(wrap);
|
|
143
|
+
host.panelHost.append(scrim, wrap);
|
|
144
|
+
panelScrim = scrim;
|
|
129
145
|
panelWrap = wrap;
|
|
130
146
|
switcher = mountKitComponent(createSystemSwitcher(), body, { data: cfg.systems }, {
|
|
131
147
|
open: (p: unknown) => { host.emit('system_open', p); closePanel(); },
|
|
@@ -4,7 +4,7 @@ export {
|
|
|
4
4
|
createKitWorkspace, mountKitWorkspace, workspaceLabels, withFrameQuery, KIT_WORKSPACE_CLASS_CANDIDATES, KIT_SIDEBAR_TIERS,
|
|
5
5
|
workspaceBreadcrumbParts,
|
|
6
6
|
} from './view';
|
|
7
|
-
export type { KitWorkspaceHandle, KitWorkspaceEmit } from './view';
|
|
7
|
+
export type { KitWorkspaceHandle, KitWorkspaceEmit, KitWorkspaceDirtyConfirmReason, KitWorkspaceDirtyConfirmOptions } from './view';
|
|
8
8
|
export {
|
|
9
9
|
createWorkspaceState, openTab as openWorkspaceTab, switchTab as switchWorkspaceTab, closeTab as closeWorkspaceTab,
|
|
10
10
|
closeOtherTabs as closeOtherWorkspaceTabs, closeAllTabs as closeAllWorkspaceTabs, closeTabsByKeys as closeWorkspaceTabsByKeys, refreshTab as refreshWorkspaceTab,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// 多页签工作台的新旧流水线标记:编译期(shell.ts)在新模式下写进 KitWorkspace 的 config,运行期(view.ts)据它改为自报层级角色。
|
|
2
|
+
// 外壳在浏览器里由组件画出(不在本页产物的静态 html 里),编译期属性写不到它的节点上,只能把「是新模式」这一个事实带给运行期。
|
|
3
|
+
// 这是 kit 内部键,不对应用公开:应用自画外壳直接调 mountKitWorkspace(受控模式)时 config 里没有它,view.ts 另按运行期文档根的
|
|
4
|
+
// 新模式标记判(recipes/pipeline-runtime#kitIsNextRuntime),两条路对同一页面结果一致(SCON-167),应用不用写这个键。
|
|
5
|
+
// 单独成文件:shell.ts 是编译期模块、view.ts 是运行期模块,两边共用一个键名而不互相 import。
|
|
6
|
+
export const KIT_WORKSPACE_PIPELINE_KEY = 'kit_pipeline' as const;
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
// 没有槽位:内容来自菜单项的 url(每个标签一个 iframe),不挂产品;页面不写 product / frame.slots。
|
|
6
6
|
// config 键、限值全部读真源 spec/kit-grammar.json 的 workspaceFrame;config 里不许有样式类(颜色、布局都归组件)。
|
|
7
7
|
|
|
8
|
+
import { KIT_WORKSPACE_PIPELINE_KEY } from './pipeline-key';
|
|
8
9
|
import { KIT_WORKSPACE_FRAME_LIMITS } from 'soma-foundation/kit-limits';
|
|
9
10
|
import grammarJson from '../../../spec/kit-grammar.json';
|
|
10
11
|
import { safeHref } from '../../base/link';
|
|
12
|
+
import { KIT_ATTR_WORKSPACE_FRAME } from '../../shared/dom-attrs';
|
|
11
13
|
import type { KitDiagnostic } from '../../object-renderer/types';
|
|
12
14
|
import type { KitFrameDefinition } from '../types';
|
|
13
15
|
import { bleedMark, checkFrameClasses, checkNoHeaderExtras, classAttr, esc, finishFrame, rootClass } from '../shared';
|
|
@@ -15,6 +17,7 @@ import { KIT_SIDEBAR_TIERS, KIT_WORKSPACE_CLASS_CANDIDATES } from './view';
|
|
|
15
17
|
|
|
16
18
|
interface WorkspaceGrammar {
|
|
17
19
|
configKeys: string[];
|
|
20
|
+
tabOpsValues: string[];
|
|
18
21
|
navbarKeys: string[];
|
|
19
22
|
userKeys: string[];
|
|
20
23
|
homeKeys: string[];
|
|
@@ -264,6 +267,20 @@ export function checkWorkspaceConfig(config: Rec | undefined): KitDiagnostic[] {
|
|
|
264
267
|
for (const flag of ['collapsed', 'collapsible', 'favorites', 'theme_panel', 'fullscreen', 'share_hash', 'custom_stage'] as const) {
|
|
265
268
|
if (config[flag] !== undefined && typeof config[flag] !== 'boolean') out.push(bad(flag, `${flag} 必须是布尔`));
|
|
266
269
|
}
|
|
270
|
+
if (config.tab_ops !== undefined) {
|
|
271
|
+
const raw = config.tab_ops;
|
|
272
|
+
if (typeof raw !== 'boolean') {
|
|
273
|
+
if (!Array.isArray(raw)) {
|
|
274
|
+
out.push(bad('tab_ops', `tab_ops 必须是布尔或操作名数组(允许:${G.tabOpsValues.join(' / ')})`));
|
|
275
|
+
} else {
|
|
276
|
+
raw.forEach((op, i) => {
|
|
277
|
+
if (typeof op !== 'string' || !G.tabOpsValues.includes(op)) {
|
|
278
|
+
out.push(bad(`tab_ops[${i}]`, `tab_ops[${i}] 只许 ${G.tabOpsValues.join(' / ')},收到 ${JSON.stringify(op)}`));
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
267
284
|
return out;
|
|
268
285
|
}
|
|
269
286
|
|
|
@@ -274,11 +291,15 @@ export const workspaceFrame: KitFrameDefinition = {
|
|
|
274
291
|
compile(input) {
|
|
275
292
|
const diagnostics: KitDiagnostic[] = [...checkFrameClasses(input), ...checkNoHeaderExtras('workspace-frame', input), ...checkWorkspaceConfig(input.config)];
|
|
276
293
|
const id = 'workspace__view';
|
|
277
|
-
const html = `<div data-soma-id="frame__root"
|
|
294
|
+
const html = `<div data-soma-id="frame__root" ${KIT_ATTR_WORKSPACE_FRAME}=""${bleedMark(input)}${classAttr(rootClass(input, ROOT_CLASS))}><div data-soma-component="KitWorkspace" data-soma-id="${esc(id)}"></div></div>`;
|
|
278
295
|
const out = finishFrame([], html, KIT_WORKSPACE_CLASS_CANDIDATES, diagnostics);
|
|
279
296
|
const show = (out.ui.show ??= {});
|
|
280
|
-
|
|
281
|
-
|
|
297
|
+
// 新模式:把模式带给运行期外壳(它在浏览器里画,编译期写不到它的节点);旧版原样
|
|
298
|
+
show[id] = input.pipeline === 'next'
|
|
299
|
+
? { props: { config: { ...(input.config ?? {}), [KIT_WORKSPACE_PIPELINE_KEY]: 'next' } } }
|
|
300
|
+
: { props: { config: input.config ?? {} } };
|
|
301
|
+
const hasAlerts = Array.isArray(input.config?.alerts) && input.config.alerts.length > 0;
|
|
302
|
+
out.components = [...new Set([...out.components, 'KitWorkspace', ...(hasAlerts ? ['Alert'] : [])])];
|
|
282
303
|
return out;
|
|
283
304
|
},
|
|
284
305
|
};
|
|
@@ -21,6 +21,8 @@ export interface WorkspaceTab {
|
|
|
21
21
|
nonce: number;
|
|
22
22
|
/** 来源菜单项 key(算面包屑用) */
|
|
23
23
|
menuKey: string;
|
|
24
|
+
/** 打开来源(B1-5):从某页里下钻打开的标签记下打开它的标签 key;从菜单 / 地址打开的没有 */
|
|
25
|
+
opener?: string;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export interface WorkspaceState {
|
|
@@ -44,6 +46,8 @@ export interface WorkspaceTabInput {
|
|
|
44
46
|
url: string;
|
|
45
47
|
closable?: boolean;
|
|
46
48
|
menuKey?: string;
|
|
49
|
+
/** 打开来源标签 key(页内下钻打开时给) */
|
|
50
|
+
opener?: string;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
export interface WorkspaceOpenResult {
|
|
@@ -80,6 +84,7 @@ export function openTab(state: WorkspaceState, input: WorkspaceTabInput): Worksp
|
|
|
80
84
|
const tab: WorkspaceTab = {
|
|
81
85
|
key: input.key, title: input.title, url: input.url, closable: input.closable !== false, pinned: false,
|
|
82
86
|
used: clock, nonce: 0, menuKey: input.menuKey ?? '',
|
|
87
|
+
...(input.opener !== undefined && input.opener !== '' && input.opener !== input.key ? { opener: input.opener } : {}),
|
|
83
88
|
};
|
|
84
89
|
return { state: { ...state, clock, tabs: [...tabs, tab], active: input.key }, rejected: false, evicted };
|
|
85
90
|
}
|
|
@@ -144,16 +149,45 @@ export function activeTab(state: WorkspaceState): WorkspaceTab | undefined {
|
|
|
144
149
|
/** 面包屑项(纯数据) */
|
|
145
150
|
export interface WorkspaceCrumb { id: string; label: string; href?: string }
|
|
146
151
|
|
|
152
|
+
/** 菜单路径上的一节:分组节点(没有地址)不带 href */
|
|
153
|
+
export interface WorkspacePathNode { label: string; href?: string }
|
|
154
|
+
|
|
155
|
+
/** 面包屑出现的最少项数(真源 kit-limits#workspaceFrame.breadcrumbMinItems,调用方传入) */
|
|
156
|
+
export interface WorkspaceCrumbOptions {
|
|
157
|
+
minItems: number;
|
|
158
|
+
/** 打开来源链(从最早的来源到直接来源,各自的标签标题):页内下钻打开的标签才有 */
|
|
159
|
+
openers?: readonly string[];
|
|
160
|
+
}
|
|
161
|
+
|
|
147
162
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
163
|
+
* 面包屑(B1-5):[首页, ...可导航的菜单祖先, ...打开来源链, 当前]。菜单分组节点没有地址,不算一层;
|
|
164
|
+
* 项数不足 minItems(一级 / 二级菜单页 = 首页 + 当前)返回 [] —— 不画面包屑,位置由侧栏选中 + 页签 + 页标题表达。
|
|
165
|
+
* path 是从根到该菜单项(含自己)的节点链,由调用方从菜单树取;当前项取标签标题。
|
|
150
166
|
*/
|
|
151
|
-
export function crumbsForTab(homeLabel: string, tab: { title: string } | undefined,
|
|
167
|
+
export function crumbsForTab(homeLabel: string, tab: { title: string } | undefined, path: readonly WorkspacePathNode[], options: WorkspaceCrumbOptions): WorkspaceCrumb[] {
|
|
168
|
+
if (!tab) return [];
|
|
152
169
|
const out: WorkspaceCrumb[] = [];
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
170
|
+
const ancestors = path.slice(0, Math.max(0, path.length - 1)).filter((n) => typeof n.href === 'string' && n.href !== '');
|
|
171
|
+
const openers = options.openers ?? [];
|
|
172
|
+
if (homeLabel !== '' && !(ancestors.length === 0 && openers.length === 0 && tab.title === homeLabel)) out.push({ id: 'home', label: homeLabel });
|
|
173
|
+
// 地址只用来判断「可导航」:面包屑项仍不带 href(点击经 crumb 事件交宿主 / 切标签,不让浏览器整页跳走)
|
|
174
|
+
ancestors.forEach((n, i) => out.push({ id: `p${i}`, label: n.label }));
|
|
175
|
+
openers.forEach((label, i) => out.push({ id: `o${i}`, label }));
|
|
157
176
|
out.push({ id: 'current', label: tab.title });
|
|
158
|
-
return out;
|
|
177
|
+
return out.length < options.minItems ? [] : out;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** 打开来源链:沿 opener 往上走(防环、至多走完全部标签),返回从最早来源到直接来源的标签 */
|
|
181
|
+
export function openerChain<T extends { key: string; opener?: string }>(tabs: readonly T[], tab: T | undefined): T[] {
|
|
182
|
+
const chain: T[] = [];
|
|
183
|
+
const seen = new Set<string>(tab ? [tab.key] : []);
|
|
184
|
+
let key = tab?.opener;
|
|
185
|
+
while (key !== undefined && key !== '' && !seen.has(key)) {
|
|
186
|
+
seen.add(key);
|
|
187
|
+
const hit = tabs.find((t) => t.key === key);
|
|
188
|
+
if (!hit) break;
|
|
189
|
+
chain.unshift(hit);
|
|
190
|
+
key = hit.opener;
|
|
191
|
+
}
|
|
192
|
+
return chain;
|
|
159
193
|
}
|