soma-kit 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +8 -5
- package/packs/ai/model-card.ts +3 -3
- package/packs/ops/error-budget-card.ts +3 -3
- package/packs/ops/release-readiness-card.ts +3 -3
- package/packs/security/control-evidence-card.ts +3 -3
- package/packs/security/finding-card.ts +3 -2
- package/packs/shared/card-util.ts +17 -0
- package/spec/generated/kit-app.schema.json +2148 -340
- package/spec/generated/kit-page.schema.json +1134 -139
- package/spec/kit-grammar.json +934 -92
- package/spec/kit-grammar.schema.json +167 -2
- package/src/app/app-config.ts +219 -186
- package/src/app/define-kit-actions.ts +126 -20
- package/src/app/define-kit-app.ts +49 -4
- package/src/app/index.ts +5 -0
- package/src/app/kit-view-context.ts +39 -1
- package/src/app/list-page-defaults.ts +14 -0
- package/src/app/server-pages.ts +239 -7
- package/src/app/server.ts +466 -25
- package/src/app/theme-endpoint.ts +67 -23
- package/src/app/theme-runtime.ts +414 -85
- package/src/app/theme-shards.ts +69 -0
- package/src/app/tier-compat.ts +107 -0
- package/src/base/action-busy.ts +215 -38
- package/src/base/affix.ts +137 -0
- package/src/base/alert.ts +104 -59
- package/src/base/anchored-layer.ts +7 -6
- package/src/base/avatar.ts +147 -61
- package/src/base/badge.ts +186 -0
- package/src/base/button-group.ts +227 -0
- package/src/base/button.ts +347 -50
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +143 -32
- package/src/base/check-core.ts +193 -33
- package/src/base/checkbox.ts +67 -2
- package/src/base/choice.ts +132 -31
- package/src/base/collapse.ts +249 -0
- package/src/base/color-picker.ts +399 -27
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +148 -36
- package/src/base/context-menu.ts +23 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +114 -96
- package/src/base/date.ts +481 -74
- package/src/base/delta.ts +16 -9
- package/src/base/divider.ts +51 -33
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +57 -21
- package/src/base/gap-value.ts +34 -15
- package/src/base/hint-tips.ts +99 -29
- package/src/base/identity-cells.ts +839 -0
- package/src/base/illustrations.ts +6 -4
- package/src/base/image.ts +40 -19
- package/src/base/index.ts +79 -22
- package/src/base/inline-error.ts +13 -7
- package/src/base/input.ts +135 -35
- package/src/base/kbd.ts +30 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +282 -101
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +55 -22
- package/src/base/menu-button.ts +73 -22
- package/src/base/menu-core.ts +201 -24
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +7 -5
- package/src/base/motion/hover-gallery.ts +16 -12
- package/src/base/motion/limits.ts +10 -0
- package/src/base/motion/marquee.ts +18 -11
- package/src/base/motion/text-rotate.ts +34 -16
- package/src/base/notification.ts +292 -0
- package/src/base/number.ts +93 -12
- package/src/base/otp.ts +139 -27
- package/src/base/overlay-runtime.ts +30 -23
- package/src/base/overlay-shell.ts +59 -14
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +624 -73
- package/src/base/popup.ts +187 -52
- package/src/base/portal-core.ts +99 -2
- package/src/base/price-text.ts +51 -17
- package/src/base/progress.ts +100 -18
- package/src/base/qr-code.ts +64 -17
- package/src/base/qty-stepper.ts +141 -22
- package/src/base/radio.ts +43 -2
- package/src/base/range.ts +194 -39
- package/src/base/rating.ts +117 -31
- package/src/base/reason-tip.ts +58 -16
- package/src/base/relation-cells.ts +541 -0
- package/src/base/resize-handle.ts +5 -3
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +70 -26
- package/src/base/select.ts +8 -3
- package/src/base/shared.ts +482 -71
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/sticky-edge.ts +96 -29
- package/src/base/swap.ts +39 -21
- package/src/base/switch.ts +158 -38
- package/src/base/tabs.ts +292 -0
- package/src/base/tag-input.ts +123 -54
- package/src/base/tag.ts +184 -66
- package/src/base/text.ts +461 -71
- package/src/base/textarea.ts +88 -39
- package/src/base/time-picker.ts +335 -55
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +342 -88
- package/src/base/upload.ts +604 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +70 -5
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +52 -12
- package/src/biz/auth-panel/compile.ts +13 -3
- package/src/biz/auth-panel/shell.ts +27 -7
- package/src/biz/category-crud/compile.ts +51 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +29 -9
- package/src/biz/checkout-page/compile.ts +37 -3
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +26 -9
- package/src/biz/compose.ts +6 -1
- package/src/biz/data-components.ts +2 -0
- package/src/biz/import-wizard/compile.ts +4 -1
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +32 -18
- package/src/biz/index.ts +1 -1
- package/src/biz/landing-page/compile.ts +3 -2
- package/src/biz/landing-page/shell.ts +22 -3
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +54 -15
- package/src/biz/master-sub/compile.ts +194 -57
- package/src/biz/master-sub/detail-head.ts +141 -18
- package/src/biz/master-sub/index.ts +3 -0
- package/src/biz/master-sub/shell.ts +186 -57
- package/src/biz/multi-board/compile.ts +87 -36
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +3 -2
- package/src/biz/multi-board/prose-fold.ts +15 -11
- package/src/biz/multi-board/shell.ts +148 -37
- package/src/biz/notification-center/compile.ts +20 -6
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +43 -10
- package/src/biz/page-templates/domain-templates.ts +145 -22
- package/src/biz/page-templates/result-page/compile.ts +4 -1
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +17 -4
- package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
- package/src/biz/record-detail/compile.ts +39 -11
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +41 -10
- package/src/biz/settings-center/compile.ts +4 -1
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +30 -9
- package/src/biz/shared/action-host.ts +137 -46
- package/src/biz/shared/compile-helpers.ts +130 -28
- package/src/biz/shared/coordinator.ts +628 -147
- package/src/biz/shared/focus-return.ts +180 -0
- package/src/biz/shared/object-aliases.ts +7 -1
- package/src/biz/shared/overlay-compile.ts +58 -10
- package/src/biz/shared/overlay-shell.ts +40 -10
- package/src/biz/shared/page-form-actions.ts +151 -0
- package/src/biz/shared/page-form.ts +255 -0
- package/src/biz/shared/pipeline.ts +74 -0
- package/src/biz/shared/runtime-hub.ts +101 -8
- package/src/biz/shared/verbs.ts +129 -0
- package/src/biz/single-form/compile.ts +4 -2
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +21 -11
- package/src/biz/standard-crud/compile.ts +206 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +82 -22
- package/src/biz/standard-crud/summary.ts +2 -37
- package/src/biz/step-form/compile.ts +12 -3
- package/src/biz/step-form/hub.ts +165 -50
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +31 -15
- package/src/biz/types.ts +40 -4
- package/src/cli/kit-cli.ts +145 -26
- package/src/cli/kit-init.ts +3 -3
- package/src/cli/migrate/theme-map.ts +35 -28
- package/src/cli/migrate/ts-rules.ts +2 -2
- package/src/cli/migrate/types.ts +3 -3
- package/src/cli/migrate/yaml-rules.ts +11 -9
- package/src/cli/view-writes.ts +13 -0
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +446 -53
- package/src/compile/component-candidates.ts +56 -4
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +1 -1
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/rules-composition.ts +2 -1
- package/src/compile/layout-lint/rules-table.ts +4 -19
- package/src/compile/look-page.ts +551 -0
- package/src/compile/look.ts +376 -0
- package/src/compile/page-composition.ts +382 -46
- package/src/compile/page-hierarchy.ts +131 -0
- package/src/compile/page-pipeline-look.ts +156 -0
- package/src/compile/page-pipeline.ts +200 -0
- package/src/compile/parse.ts +12 -11
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +645 -28
- package/src/compile/styles.ts +226 -26
- package/src/compile/types.ts +62 -5
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +49 -22
- package/src/data/anchor-nav.ts +73 -15
- package/src/data/approval-flow.ts +210 -124
- package/src/data/assignment-picker.ts +163 -85
- package/src/data/async-result-panel.ts +110 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +141 -19
- package/src/data/calendar.ts +434 -96
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +72 -38
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +904 -77
- package/src/data/checklist.ts +78 -35
- package/src/data/code-view.ts +106 -48
- package/src/data/comment-thread.ts +607 -87
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +198 -30
- package/src/data/context-menu.ts +95 -21
- package/src/data/d9-limits.ts +2 -0
- package/src/data/d9-util.ts +13 -5
- package/src/data/diff.ts +107 -50
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +33 -17
- package/src/data/embed.ts +142 -7
- package/src/data/engine-ports.ts +13 -4
- package/src/data/field-mapper.ts +104 -48
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +603 -142
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +85 -27
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +637 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +38 -15
- package/src/data/image-viewer.ts +261 -62
- package/src/data/index.ts +63 -1
- package/src/data/item-list.ts +217 -57
- package/src/data/json-view.ts +165 -100
- package/src/data/kanban.ts +339 -87
- package/src/data/kit-contract.ts +230 -0
- package/src/data/leaderboard.ts +343 -0
- package/src/data/level-class.ts +21 -0
- package/src/data/log-stream.ts +347 -0
- package/src/data/markdown-view.ts +155 -45
- package/src/data/matrix.ts +217 -112
- package/src/data/media-grid.ts +162 -38
- package/src/data/mega-menu.ts +39 -23
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +50 -15
- package/src/data/menu.ts +131 -47
- package/src/data/mockup.ts +30 -22
- package/src/data/modal-dialog.ts +90 -13
- package/src/data/navbar.ts +143 -61
- package/src/data/notice-list.ts +100 -48
- package/src/data/notify-renderer.ts +61 -7
- package/src/data/object-form.ts +1389 -130
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +122 -42
- package/src/data/panel-head.ts +237 -75
- package/src/data/permission-matrix.ts +371 -119
- package/src/data/permission-tree.ts +135 -80
- package/src/data/pricing-table.ts +106 -42
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +63 -31
- package/src/data/record-card.ts +239 -70
- package/src/data/record-picker.ts +56 -27
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +131 -41
- package/src/data/resident.ts +11 -1
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +206 -35
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +376 -102
- package/src/data/rule-builder.ts +129 -80
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +86 -43
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +438 -86
- package/src/data/static-lazy.ts +18 -0
- package/src/data/static-registry.ts +38 -2
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +63 -34
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +128 -47
- package/src/data/system-switcher.ts +40 -20
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +99 -31
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +110 -47
- package/src/data/transfer.ts +195 -47
- package/src/data/tree-table.ts +194 -112
- package/src/data/tree.ts +191 -70
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +242 -102
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +26 -4
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +1 -2
- package/src/frames/inherited-shell.ts +54 -13
- package/src/frames/page-bar.ts +205 -27
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +0 -2
- package/src/frames/shared.ts +64 -21
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +11 -7
- package/src/frames/split-frame/wiring.ts +14 -10
- package/src/frames/tabs-frame/shell.ts +3 -2
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +2 -0
- package/src/frames/workspace-frame/extras.ts +5 -3
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/pipeline-key.ts +6 -0
- package/src/frames/workspace-frame/shell.ts +22 -2
- package/src/frames/workspace-frame/state.ts +42 -14
- package/src/frames/workspace-frame/view.ts +697 -167
- package/src/generated/kit-grammar-runtime.ts +1015 -53
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +96 -3
- package/src/object-renderer/action-group.ts +175 -23
- package/src/object-renderer/action-more.ts +48 -17
- package/src/object-renderer/arrange.ts +241 -29
- package/src/object-renderer/category-tone.ts +96 -0
- package/src/object-renderer/collapse-wiring.ts +19 -9
- package/src/object-renderer/collection-expand.ts +3 -3
- package/src/object-renderer/collection-parts.ts +432 -107
- package/src/object-renderer/collection-table.ts +347 -45
- package/src/object-renderer/collection.ts +291 -62
- package/src/object-renderer/compile-data.ts +12 -2
- package/src/object-renderer/defaults.ts +6 -5
- package/src/object-renderer/emit-events.ts +45 -19
- package/src/object-renderer/emit-object.ts +35 -9
- package/src/object-renderer/emit-static.ts +734 -159
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +105 -18
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +18 -2
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +44 -2
- package/src/object-renderer/pick-component.ts +8 -2
- package/src/object-renderer/pipeline-mode.ts +6 -0
- package/src/object-renderer/relation-field.ts +79 -0
- package/src/object-renderer/render-object.ts +71 -26
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +424 -103
- package/src/object-renderer/table-gap.ts +2 -1
- package/src/object-renderer/table-reorder.ts +237 -0
- package/src/object-renderer/table-summary.ts +26 -12
- package/src/object-renderer/table-tools.ts +428 -128
- package/src/object-renderer/types.ts +91 -2
- package/src/object-renderer/value-present.ts +49 -0
- package/src/page-target/ai-surface.ts +15 -22
- package/src/page-target/compile.ts +5 -6
- package/src/page-target/drift.ts +0 -7
- package/src/page-target/intent-schema.ts +46 -43
- package/src/page-target/target.ts +4 -5
- package/src/page-target/writer-policy.ts +4 -5
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +15 -14
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +3 -2
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +76 -19
- package/src/recipes/control.ts +64 -5
- package/src/recipes/desc-list.ts +101 -7
- package/src/recipes/divider.ts +30 -9
- package/src/recipes/emphasis.ts +90 -5
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +3 -2
- package/src/recipes/index.ts +28 -4
- package/src/recipes/inherited-shell.ts +21 -15
- package/src/recipes/json-view.ts +6 -5
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +16 -6
- package/src/recipes/overlay.ts +47 -19
- package/src/recipes/page-width.ts +31 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +37 -19
- package/src/recipes/rail-grid.ts +6 -3
- package/src/recipes/self-owned.ts +59 -0
- package/src/recipes/slot-align.ts +5 -3
- package/src/recipes/stat-state.ts +5 -5
- package/src/recipes/state.ts +54 -3
- package/src/recipes/status.ts +14 -14
- package/src/recipes/strip.ts +47 -5
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +33 -4
- package/src/recipes/table-gap.ts +3 -2
- package/src/recipes/table-native-edit.ts +22 -9
- package/src/recipes/table-row.ts +45 -12
- package/src/recipes/tabs.ts +54 -22
- package/src/recipes/text-diff.ts +15 -8
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +68 -3
- package/src/shared/action-func.ts +106 -0
- package/src/shared/color-scheme.ts +127 -0
- package/src/shared/confirm-decl.ts +5 -2
- package/src/shared/danger-facts.ts +55 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +58 -12
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/icons.ts +28 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/shared/order-value.ts +15 -0
- package/src/shared/page-attrs-runtime.ts +327 -0
- package/src/shared/page-attrs.ts +262 -0
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +165 -24
- package/src/shared/theme-usage.ts +16 -0
- package/src/shared/value-table-contract.ts +68 -0
- package/src/spatial/action-func.ts +4 -0
- package/src/spatial/declared-actions.ts +116 -0
- package/src/spatial/emit.ts +660 -0
- package/src/spatial/expand.ts +1482 -0
- package/src/spatial/field-types.ts +48 -0
- package/src/spatial/index.ts +82 -0
- package/src/spatial/layout.ts +697 -0
- package/src/spatial/look-apply.ts +206 -0
- package/src/spatial/page-decl.ts +44 -0
- package/src/spatial/page-object.ts +349 -0
- package/src/spatial/recognize.ts +491 -0
- package/src/spatial/self-report.ts +571 -0
- package/src/spatial/shape.ts +205 -0
- package/src/spatial/spatial-map.ts +136 -0
- package/src/spatial/tone.ts +145 -0
- package/src/theme/index.ts +11 -2
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +527 -16
- package/src/theme/kit-theme.tpl +491 -16
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +522 -185
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +3 -2
- package/src/theme/theme-tokens.ts +1601 -93
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/frames/list-summary.ts +0 -123
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
|
@@ -9,11 +9,15 @@
|
|
|
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
16
|
import { kitIconHtml, type KitIconName } from '../../shared/icons';
|
|
16
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';
|
|
17
21
|
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
18
22
|
import { SPLIT_G, splitSpanClass, splitSpanClasses, type SplitDirection, type SplitSide } from './span';
|
|
19
23
|
|
|
@@ -31,7 +35,7 @@ const CELL_CLASS = 'col-span-12 @md:col-span-6';
|
|
|
31
35
|
// 外层只放定位(无显示类,接线件在折叠时给它 hidden),内层是真正的 separator
|
|
32
36
|
const H_HANDLE_WRAP = 'absolute inset-y-0 -end-4 z-10 w-2';
|
|
33
37
|
const V_HANDLE_WRAP = 'absolute inset-x-0 -bottom-4 z-10 h-2';
|
|
34
|
-
const HANDLE_COMMON = 'group h-full w-full rounded-
|
|
38
|
+
const HANDLE_COMMON = 'group h-full w-full rounded-item touch-none ' + KIT_FOCUS_RING.button;
|
|
35
39
|
const H_HANDLE = `hidden @md:block cursor-col-resize ${HANDLE_COMMON}`;
|
|
36
40
|
const V_HANDLE = `block cursor-row-resize ${HANDLE_COMMON}`;
|
|
37
41
|
const BAR_COMMON = 'bg-border-subtle transition-colors group-hover:bg-primary group-focus-visible:bg-primary group-data-kit-dragging:bg-primary';
|
|
@@ -39,7 +43,7 @@ const H_BAR = `mx-auto block h-full w-1 rounded-full ${BAR_COMMON}`;
|
|
|
39
43
|
const V_BAR = `block h-1 w-full mt-0.5 rounded-full ${BAR_COMMON}`;
|
|
40
44
|
// 折叠钮浮在分隔条上 = 浮起表面(发丝描边 + 浮起阴影,KT-B4),胶囊圆角是构件形体
|
|
41
45
|
const TOGGLE_FACE = mergeClass(kitSurfaceRecipe('raised'), 'rounded-full');
|
|
42
|
-
const TOGGLE_COMMON = 'z-20 items-center justify-center ' + TOGGLE_FACE + ' text-xs text-fg-muted transition-colors state-layer hover:text-fg
|
|
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;
|
|
43
47
|
const H_TOGGLE_RIGHT = `absolute top-2 -end-6 hidden h-6 w-6 @md:flex ${TOGGLE_COMMON}`;
|
|
44
48
|
const H_TOGGLE_LEFT = `absolute top-2 -start-6 hidden h-6 w-6 @md:flex ${TOGGLE_COMMON}`;
|
|
45
49
|
const V_TOGGLE_BOTTOM = `absolute start-2 -bottom-6 flex h-6 w-6 ${TOGGLE_COMMON}`;
|
|
@@ -172,9 +176,9 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
172
176
|
: `${V_CELL_RESIZABLE} ${splitSpanClass(dir, 'right', cfg.ratio, collapsedSide === 'left')}`;
|
|
173
177
|
|
|
174
178
|
const body = (frag: { html: string }): string => horizontal ? frag.html : `<div class="${V_BODY}">${frag.html}</div>`;
|
|
175
|
-
const sepAttrs =
|
|
179
|
+
const sepAttrs = `${KIT_ATTR_SPLIT_HANDLE}="" `;
|
|
176
180
|
const handle = cfg.resizable
|
|
177
|
-
? `<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>`
|
|
178
182
|
: '';
|
|
179
183
|
// 折叠按钮挂在「另一栏」边缘:可折叠 left → 按钮在 right 栏;可折叠 right → 在 left 栏
|
|
180
184
|
const glyph = (side: SplitSide, collapsed: boolean): KitIconName => {
|
|
@@ -187,7 +191,7 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
187
191
|
const cls = horizontal ? (side === 'right' ? H_TOGGLE_RIGHT : H_TOGGLE_LEFT) : (side === 'right' ? V_TOGGLE_BOTTOM : V_TOGGLE_TOP);
|
|
188
192
|
const isCollapsed = collapsedSide === side;
|
|
189
193
|
const label = isCollapsed ? cfg.expandLabel : cfg.collapseLabel;
|
|
190
|
-
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>`;
|
|
191
195
|
};
|
|
192
196
|
// 按钮放在另一栏:left 可折叠 → right 栏里;right 可折叠 → left 栏里
|
|
193
197
|
const leftInner = `${body(left)}${handle}${toggleFor('right')}`;
|
|
@@ -196,10 +200,10 @@ export const splitFrame: KitFrameDefinition = {
|
|
|
196
200
|
const cell = (slot: SplitSide, base: string, inner: string): string => {
|
|
197
201
|
const tag = slotWrapper(slot, base, input, inner);
|
|
198
202
|
const hide = collapsedSide === slot ? ' hidden' : '';
|
|
199
|
-
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="`);
|
|
200
204
|
};
|
|
201
205
|
const gridClass = horizontal ? (cfg.resizable ? RESIZABLE_GRID_CLASS : GRID_CLASS) : `${V_GRID} ${SPLIT_G.heightTiers[cfg.height] ?? ''}`;
|
|
202
|
-
const grid = `<div data-soma-id="frame__split"
|
|
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>`;
|
|
203
207
|
const wiring = cfg.resizable ? '<div data-soma-component="KitSplitWiring" data-soma-id="frame__split_wiring" hidden></div>' : '';
|
|
204
208
|
const head = headerFragment(input);
|
|
205
209
|
const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input))}>${head.html}${grid}${wiring}</div>`;
|
|
@@ -12,6 +12,9 @@ import { createKitController, num, str, type KitProps } from '../../base/shared'
|
|
|
12
12
|
import { attachResizeHandle, type ResizeHandle } from '../../base/resize-handle';
|
|
13
13
|
import { kitDirAt } from '../../i18n/kit-text';
|
|
14
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);
|
|
@@ -10,6 +10,7 @@ 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
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';
|
|
14
15
|
import { projectTabOverflow } from '../../object-renderer/action-group';
|
|
15
16
|
|
|
@@ -81,7 +82,7 @@ export const tabsFrame: KitFrameDefinition = {
|
|
|
81
82
|
const cls = mergeClass('', input.slotClass?.[t.id]);
|
|
82
83
|
// 外层只放 hidden(无 preflight:与 grid / flex 同元素会让隐藏失效),slotClass 在内层
|
|
83
84
|
// data-kit-vt:页面过渡的内容区命名点(样式 view-transition-name: kit-content;同一时刻只有显示的那块参与,不会重名)
|
|
84
|
-
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>`);
|
|
85
86
|
});
|
|
86
87
|
|
|
87
88
|
const barId = `${fp}tabs__bar`;
|
|
@@ -94,7 +95,7 @@ export const tabsFrame: KitFrameDefinition = {
|
|
|
94
95
|
const wiring = `<div data-soma-component="KitTabsWiring" data-soma-id="${esc(wiringId)}" hidden></div>`;
|
|
95
96
|
// data-kit-tabs-frame:接线件从自身往上找到它,只在本框内查锚点
|
|
96
97
|
const head = headerFragment(input, fp);
|
|
97
|
-
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>`;
|
|
98
99
|
const out = finishFrame([head, ...parts], html, [], [...diagnostics, ...checkNoMaxWidth('tabs-frame', input)]);
|
|
99
100
|
const show = (out.ui.show ??= {});
|
|
100
101
|
if (wiringId in show) {
|
|
@@ -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
|
@@ -67,6 +67,8 @@ export interface KitFrameInput {
|
|
|
67
67
|
locale?: string;
|
|
68
68
|
/** 应用级九维密度(kit.app.yaml#app.theme.density,由编译器从应用继承,页面框自己不单设):缺省与默认 STANDARD_BALANCED 及 COMPACT_DENSE 同为 p-4 标准画布,显式给 SPACIOUS_AIRY 用 p-6 宽松画布 */
|
|
69
69
|
density?: KitThemeDensity;
|
|
70
|
+
/** 主题流水线模式(同 KitBizContext.pipeline):只有 next 时才给;next 下页面框不写判定类属性,并给区域容器补锚点 */
|
|
71
|
+
pipeline?: 'legacy' | 'next';
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export interface KitFrameDefinition {
|
|
@@ -8,6 +8,7 @@
|
|
|
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
14
|
import { kitIcon } from '../../shared/icons';
|
|
@@ -18,6 +19,7 @@ import { mountKitComponent, type KitMount } from '../../data/embed';
|
|
|
18
19
|
import { h, isRec, onOutsidePointer, recList, textOf, type Rec } from '../../data/menu-dom';
|
|
19
20
|
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
20
21
|
import { mergeClass } from '../../shared/merge-class';
|
|
22
|
+
import { KIT_ATTR_SYSTEMS, KIT_ATTR_SYSTEMS_SCRIM } from '../../shared/dom-attrs';
|
|
21
23
|
|
|
22
24
|
const SHARE_PARAM = (grammarJson as unknown as { workspaceFrame: { shareHash: { param: string } } }).workspaceFrame.shareHash.param;
|
|
23
25
|
|
|
@@ -28,7 +30,7 @@ export const WORKSPACE_EXTRAS_CLASSES = {
|
|
|
28
30
|
alertAction: 'shrink-0 self-center',
|
|
29
31
|
systemsScrim: 'fixed inset-0 z-0 bg-scrim',
|
|
30
32
|
systemsWrap: mergeClass(kitSurfaceRecipe('raised'), 'relative z-10 max-h-96 overflow-y-auto'),
|
|
31
|
-
systemsClose: 'absolute end-3 top-3 inline-flex size-8 cursor-pointer items-center justify-center rounded-
|
|
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,
|
|
32
34
|
} as const;
|
|
33
35
|
const HIDDEN = 'hidden';
|
|
34
36
|
|
|
@@ -131,9 +133,9 @@ export function mountWorkspaceExtras(host: WorkspaceExtrasHost): WorkspaceExtras
|
|
|
131
133
|
const openPanel = (): void => {
|
|
132
134
|
if (panelOpen || !isRec(cfg.systems)) return;
|
|
133
135
|
panelOpen = true;
|
|
134
|
-
const scrim = h('div', WORKSPACE_EXTRAS_CLASSES.systemsScrim, {
|
|
136
|
+
const scrim = h('div', WORKSPACE_EXTRAS_CLASSES.systemsScrim, { [KIT_ATTR_SYSTEMS_SCRIM]: '', 'aria-hidden': 'true' });
|
|
135
137
|
scrim.addEventListener('click', closePanel);
|
|
136
|
-
const wrap = h('div', WORKSPACE_EXTRAS_CLASSES.systemsWrap, {
|
|
138
|
+
const wrap = h('div', WORKSPACE_EXTRAS_CLASSES.systemsWrap, { [KIT_ATTR_SYSTEMS]: '' });
|
|
137
139
|
const close = h('button', WORKSPACE_EXTRAS_CLASSES.systemsClose, { type: 'button', 'aria-label': kitText('soma.kit.sw_close', undefined, host.root) }, kitIcon('close', 'md'));
|
|
138
140
|
close.addEventListener('click', closePanel);
|
|
139
141
|
const body = h('div', '');
|
|
@@ -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,10 +291,13 @@ 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
|
-
|
|
297
|
+
// 新模式:把模式带给运行期外壳(它在浏览器里画,编译期写不到它的节点);旧版原样
|
|
298
|
+
show[id] = input.pipeline === 'next'
|
|
299
|
+
? { props: { config: { ...(input.config ?? {}), [KIT_WORKSPACE_PIPELINE_KEY]: 'next' } } }
|
|
300
|
+
: { props: { config: input.config ?? {} } };
|
|
281
301
|
const hasAlerts = Array.isArray(input.config?.alerts) && input.config.alerts.length > 0;
|
|
282
302
|
out.components = [...new Set([...out.components, 'KitWorkspace', ...(hasAlerts ? ['Alert'] : [])])];
|
|
283
303
|
return out;
|
|
@@ -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,22 +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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return [{ id: 'current', label: tab.title }];
|
|
160
|
-
}
|
|
161
|
-
if (homeLabel !== '') out.push({ id: 'home', label: homeLabel });
|
|
162
|
-
parents.forEach((label, i) => out.push({ id: `p${i}`, label }));
|
|
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 }));
|
|
163
176
|
out.push({ id: 'current', label: tab.title });
|
|
164
|
-
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;
|
|
165
193
|
}
|