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
package/src/frames/page-bar.ts
CHANGED
|
@@ -6,15 +6,26 @@
|
|
|
6
6
|
// · actions(动作):宽于 @lg 的页头容器内联成按钮(链接项是 <a>),窄于 @lg 收进「更多」下拉(role=menu,↑↓/Home/End/Esc,回焦触发钮)。
|
|
7
7
|
// 具名动作项点击抛槽位事件 action_<序号> { id },页面事件 `<锚点>.action_<序号>` 给每个动作各绑一条 ACTION | 名字;链接项直接导航,不抛事件。
|
|
8
8
|
// 容器查询以页头 <header> 的 @container 为准,所以动作区的折叠随页面框宽度走,而不是视口。
|
|
9
|
+
// 主题流水线新模式下,入参 props.kit.actions[动作 id] 带页面线对每个动作的判定(按钮形态、实心主色名额、色调、确认方式、可收纳),
|
|
10
|
+
// 有判定的动作按判定画(确认方式走二次确认端口,可收纳为否的恒内联);入参里没有时保持原行为。
|
|
9
11
|
|
|
10
12
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
11
13
|
import { CLASS_PROP, createKitController, str } from '../base/shared';
|
|
12
14
|
import { safeHref } from '../base/link';
|
|
13
|
-
import { kitControlRecipe } from '../recipes/control';
|
|
15
|
+
import { kitControlRecipe, kitLegacyRecipes } from '../recipes/control';
|
|
14
16
|
import { kitIcon } from '../shared/icons';
|
|
15
17
|
import { kitDirAt, kitText } from '../i18n/kit-text';
|
|
16
18
|
import { queryWithDropdowns, releaseDropdownsIn } from '../base/popup';
|
|
19
|
+
import { mergeClass } from '../shared/merge-class';
|
|
20
|
+
import { arrangeTiers } from 'soma-foundation/arrange';
|
|
17
21
|
import { KIT_ACTION_SLOT_BASE, actionSlotEmits, emitActionSlot } from '../base/action-slots';
|
|
22
|
+
import { kitApplyStowable, kitAskConfirm, type KitRuntimeProps } from '../base/kit-contract';
|
|
23
|
+
import { kitMergeButtonVariant } from '../base/button';
|
|
24
|
+
import { kitActionPropsOf, kitHasActionProps } from '../data/kit-contract';
|
|
25
|
+
import { getKitHubByHost, getKitHubByHostWithStatus, kitHubUsableFrom } from '../biz/shared/runtime-hub';
|
|
26
|
+
import {
|
|
27
|
+
KIT_ATTR_PAGE_ACTION, KIT_ATTR_PAGE_BACK, KIT_ATTR_PAGE_MORE, KIT_ATTR_PAGE_MORE_TRIGGER, KIT_ATTR_STRIP_ITEM, KIT_ATTR_TAB_PANEL, kitAttrSel,
|
|
28
|
+
} from '../shared/dom-attrs';
|
|
18
29
|
import {
|
|
19
30
|
buildDropdownPanel, classSet, DROPDOWN_CLASSES, fitDropdownPanel, FOCUS, focusFirstItem, h, isRec, onOutsidePointer, recList, textOf,
|
|
20
31
|
type KitDropdownItem, type Rec,
|
|
@@ -22,27 +33,145 @@ import {
|
|
|
22
33
|
|
|
23
34
|
const ROOT_CLASS = 'flex min-w-0 items-center gap-2';
|
|
24
35
|
|
|
25
|
-
const BACK_CLASS = `inline-flex h-8 cursor-pointer items-center gap-1 rounded-
|
|
36
|
+
const BACK_CLASS = `inline-flex h-8 cursor-pointer items-center gap-1 rounded-control px-2 text-sm text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg ${FOCUS}`;
|
|
26
37
|
const INLINE_CLASS = 'hidden @lg:flex items-center gap-2';
|
|
27
38
|
const MORE_WRAP_CLASS = 'relative @lg:hidden';
|
|
39
|
+
/** 条带形态(KT-D9-1):内联行恒在,逐项按投影类隐藏;收纳入口类由投影给(data-kit-strip 宿主是查询容器) */
|
|
40
|
+
const STRIP_INLINE_CLASS = 'flex min-w-0 items-center justify-end gap-2';
|
|
41
|
+
/** 条带投影在运行期 DOM 上可能写出的按档类(每个容器档一条),并入候选 */
|
|
42
|
+
const STRIP_TIER_CLASSES: readonly string[] = arrangeTiers().flatMap((t) => [`@max-${t.name}:hidden`, `@max-${t.name}:inline-flex`]);
|
|
28
43
|
|
|
29
44
|
// 页头按钮 / 链接项:按钮四元组与面 / 状态层 / 焦点环 / 禁用态全部取自控件引擎(kitControlRecipe),页头只加手形指针;
|
|
30
45
|
// 链接项(<a>)没有 enabled 伪类,link 宿主选项换成裸伪类并加 no-underline
|
|
31
46
|
const PAGE_BAR_VARIANTS = ['primary', 'neutral', 'danger', 'ghost'] as const;
|
|
32
|
-
|
|
33
|
-
const
|
|
47
|
+
type PageBarVariant = (typeof PAGE_BAR_VARIANTS)[number];
|
|
48
|
+
const PAGE_BAR_VARIANT_SET: ReadonlySet<string> = new Set(PAGE_BAR_VARIANTS);
|
|
49
|
+
// 用到时求值:配方可能随新旧模式出不同的类(kitControlRecipe 的文字钮分支),模块顶层求值会把加载那一刻的模式钉死
|
|
50
|
+
const btnClass = (v: PageBarVariant): string => kitControlRecipe({ variant: v, pointer: true });
|
|
51
|
+
const linkClass = (v: PageBarVariant): string => kitControlRecipe({ variant: v, pointer: true, link: true });
|
|
52
|
+
|
|
53
|
+
/** 本部件自带的全部类(供页头并入候选类):按旧版求(新模式换上的类登记在 data/kit-contract.ts#KIT_CONTRACT_CLASS_CANDIDATES) */
|
|
54
|
+
export const KIT_PAGE_BAR_CLASS_CANDIDATES: readonly string[] = kitLegacyRecipes(() => classSet(
|
|
55
|
+
ROOT_CLASS, BACK_CLASS, INLINE_CLASS, MORE_WRAP_CLASS, PAGE_BAR_VARIANTS.map(btnClass), PAGE_BAR_VARIANTS.map(linkClass), DROPDOWN_CLASSES, STRIP_INLINE_CLASS, STRIP_TIER_CLASSES, 'shrink-0', 'relative',
|
|
56
|
+
));
|
|
57
|
+
|
|
58
|
+
/** 页面上已挂载的组件宿主(core 给每个组件宿主元素标 data-soma-component) */
|
|
59
|
+
const COMPONENT_HOST_SELECTOR = '[data-soma-component]';
|
|
34
60
|
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
61
|
+
/** 协调组件的对外标识:实例 id 优先(唯一),没有取作用域 id;动作执行器按载荷 scope 查它 */
|
|
62
|
+
const hubKeyOf = (hub: { readonly scope: string; readonly instanceId?: string }): string => (hub.instanceId !== undefined && hub.instanceId !== '' ? hub.instanceId : hub.scope);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 页头动作读筛选 / 勾选 / 重取时落到哪个协调组件:取页头所在区域对应的那个,同页多个时按页头的位置就近取,不取「最后挂载」(L7b-7)。
|
|
66
|
+
* 顺序:页头自己就在某个协调组件的宿主(或其父节点)下且唯一 -> 它;否则自页头向上逐层找第一个包含协调组件宿主的祖先,
|
|
67
|
+
* 在其中按文档序取页头之后的第一个(页头在内容之上),没有再取页头之前的最后一个;对页头不可用的(隐藏页签里没激活的、嵌套的另一个页面宿主里的)先排除。
|
|
68
|
+
* 可用判据与动作执行器的兜底同一口径(runtime-hub#kitHubUsableFrom)。找不到返回 undefined(载荷不带 scope,执行器兜底同样不借隐藏 / 跨宿主的协调组件)。
|
|
69
|
+
*/
|
|
70
|
+
function nearestHubKey(bar: HTMLElement): string | undefined {
|
|
71
|
+
const near = getKitHubByHostWithStatus(bar);
|
|
72
|
+
if (near.entry !== undefined && kitHubUsableFrom(near.entry, bar)) {
|
|
73
|
+
return hubKeyOf(near.entry);
|
|
74
|
+
}
|
|
75
|
+
for (let a = bar.parentElement; a !== null; a = a.parentElement) {
|
|
76
|
+
// 宿主与页签面板是隔离边界:处理完该边界容器本身后即停止向上爬,避免跨宿主 / 跨页签借用无关协调组件
|
|
77
|
+
const isBoundary = a.hasAttribute('data-soma-host') || a.hasAttribute(KIT_ATTR_TAB_PANEL);
|
|
78
|
+
const found: Array<{ el: HTMLElement; key: string; usable: boolean }> = [];
|
|
79
|
+
for (const el of Array.from(a.querySelectorAll<HTMLElement>(COMPONENT_HOST_SELECTOR))) {
|
|
80
|
+
const hub = getKitHubByHost(el);
|
|
81
|
+
if (hub !== undefined && hub.host === el) found.push({ el, key: hubKeyOf(hub), usable: kitHubUsableFrom(hub, bar) });
|
|
82
|
+
}
|
|
83
|
+
const shown = found.filter((f) => f.usable);
|
|
84
|
+
if (shown.length > 0) {
|
|
85
|
+
const after = shown.find((f) => (bar.compareDocumentPosition(f.el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);
|
|
86
|
+
return (after ?? shown[shown.length - 1]!).key;
|
|
87
|
+
}
|
|
88
|
+
if (isBoundary) break;
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** 页头动作槽位事件的载荷:动作 id + 就近协调组件的 scope(有才带) */
|
|
94
|
+
function headerPayload(bar: HTMLElement, id: string): { id: string; scope?: string } {
|
|
95
|
+
const scope = nearestHubKey(bar);
|
|
96
|
+
return scope === undefined ? { id } : { id, scope };
|
|
97
|
+
}
|
|
39
98
|
|
|
40
99
|
interface BackResult { url: string; viaFallback: boolean; steps: number }
|
|
41
100
|
interface NavHistoryLike {
|
|
42
101
|
back?: (fallback: string, options?: { exclude?: string[]; previousCount?: number }) => Promise<BackResult> | BackResult;
|
|
43
102
|
}
|
|
44
103
|
|
|
45
|
-
const variantOf = (raw: unknown):
|
|
104
|
+
const variantOf = (raw: unknown): PageBarVariant => (typeof raw === 'string' && PAGE_BAR_VARIANT_SET.has(raw) ? (raw as PageBarVariant) : 'neutral');
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 页面级动作的判定读取(主题流水线新模式,业务功能描述 §3.7、§6.1):生成事件把页头条带下各动作途径为入参的判定汇总进
|
|
108
|
+
* 本实例(锚点 frame__header__actions)的 props.kit.actions[动作 id],读取走数据组件层同一个出口(data/kit-contract#kitActionPropsOf,
|
|
109
|
+
* 底下是 kitReadProps 的闭集校验)。没有汇总、或汇总里没有这个动作(或这个动作一个合法判定都没有)时返回 null:调用方按原行为画。
|
|
110
|
+
*/
|
|
111
|
+
function pageBarJudgements(p: Rec): (id: string) => KitRuntimeProps | null {
|
|
112
|
+
if (!kitHasActionProps(p)) return () => null;
|
|
113
|
+
return (id) => {
|
|
114
|
+
const k = kitActionPropsOf(p, id);
|
|
115
|
+
return Object.keys(k).length === 0 ? null : k;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 判定 → 页头按钮变体。合成规则与基础按钮、表单同一出口(base/button#kitMergeButtonVariant:动作声明的 variant 是自己的角色,
|
|
121
|
+
* 页面线只叠加本屏实心名额与危险色调),再落到页头自带的四种变体上:primary → primary,危险(danger / dangerSolid)→ danger,
|
|
122
|
+
* 轻按钮(quiet / ghost)→ ghost(页头动作恒带可见文字),其余(描边中性,以及页头没有的 tonal / discovery 等浅底变体,按次级动作归并)→ neutral。
|
|
123
|
+
* 判定里没有按钮形态时只看色调:危险取 danger,否则保持声明的 variant。
|
|
124
|
+
*/
|
|
125
|
+
function pageBarVariantOfJudged(a: Rec, k: KitRuntimeProps): PageBarVariant {
|
|
126
|
+
if (k.variant === undefined) return k.tone === 'danger' ? 'danger' : variantOf(a.variant);
|
|
127
|
+
const v = kitMergeButtonVariant(typeof a.variant === 'string' ? a.variant : undefined, k);
|
|
128
|
+
if (v === 'primary') return 'primary';
|
|
129
|
+
if (v === 'danger' || v === 'dangerSolid') return 'danger';
|
|
130
|
+
if (v === 'quiet' || v === 'ghost') return 'ghost';
|
|
131
|
+
return 'neutral';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** 判定为要二次确认(行内气泡确认 / 弹窗确认)的动作 */
|
|
135
|
+
function needsConfirm(k: KitRuntimeProps | null): boolean {
|
|
136
|
+
return k !== null && k.confirm !== undefined && k.confirm !== 'none';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 确认后执行:不要确认时立即执行(与改前同步行为一致);要确认时走基础组件的二次确认端口(base/kit-contract#kitAskConfirm,
|
|
141
|
+
* 实现由数据组件层注册;没有注册实现时端口返回 false,动作不执行),确认通过且实例仍存活未中止才执行
|
|
142
|
+
*/
|
|
143
|
+
function confirmThen(
|
|
144
|
+
k: KitRuntimeProps | null,
|
|
145
|
+
at: HTMLElement,
|
|
146
|
+
label: string,
|
|
147
|
+
go: () => void,
|
|
148
|
+
signal: AbortSignal,
|
|
149
|
+
isAlive: () => boolean,
|
|
150
|
+
onDone?: () => void,
|
|
151
|
+
): void {
|
|
152
|
+
if (k === null || k.confirm === undefined || k.confirm === 'none') { go(); return; }
|
|
153
|
+
let pending: Promise<boolean>;
|
|
154
|
+
try {
|
|
155
|
+
pending = Promise.resolve(kitAskConfirm({
|
|
156
|
+
kind: k.confirm,
|
|
157
|
+
at,
|
|
158
|
+
label,
|
|
159
|
+
...(k.tone === 'danger' ? { tone: 'danger' as const } : {}),
|
|
160
|
+
signal,
|
|
161
|
+
}));
|
|
162
|
+
} catch {
|
|
163
|
+
pending = Promise.resolve(false);
|
|
164
|
+
}
|
|
165
|
+
void pending
|
|
166
|
+
.catch(() => false)
|
|
167
|
+
.then((ok) => {
|
|
168
|
+
if (!ok || signal.aborted || !isAlive()) return;
|
|
169
|
+
go();
|
|
170
|
+
})
|
|
171
|
+
.finally(() => {
|
|
172
|
+
onDone?.();
|
|
173
|
+
});
|
|
174
|
+
}
|
|
46
175
|
|
|
47
176
|
export function createKitPageBar(): SomaComponentDefinition {
|
|
48
177
|
return {
|
|
@@ -57,27 +186,39 @@ export function createKitPageBar(): SomaComponentDefinition {
|
|
|
57
186
|
},
|
|
58
187
|
emits: {
|
|
59
188
|
back: { payload: { url: { type: 'string' }, viaFallback: { type: 'boolean' }, steps: { type: 'number' } }, desc: '点了返回;url 是实际去处(站内路径)' },
|
|
60
|
-
...actionSlotEmits(KIT_ACTION_SLOT_BASE.header, { id: { type: 'string' } }, '点了具名动作项(链接项直接导航,不抛);序号 = 动作在 actions 数组里的位置'),
|
|
189
|
+
...actionSlotEmits(KIT_ACTION_SLOT_BASE.header, { id: { type: 'string' }, scope: { type: 'string', desc: '页头所在区域对应的协调组件的实例 id / 作用域(同页多个业务组件时按页头的位置就近取;找不到不带,由动作执行器按原兜底)' } }, '点了具名动作项(链接项直接导航,不抛);序号 = 动作在 actions 数组里的位置'),
|
|
61
190
|
},
|
|
62
191
|
},
|
|
63
192
|
services: ['navHistory'],
|
|
64
193
|
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
|
|
65
194
|
controllerFactory: createKitController((api) => {
|
|
66
|
-
//
|
|
195
|
+
// 每个实例一份:下拉开合、点外面关、存活态与在途确认中止器
|
|
67
196
|
let open = false;
|
|
197
|
+
let alive = false;
|
|
198
|
+
let confirmAbort: AbortController | null = null;
|
|
68
199
|
let offOutside: (() => void) | null = null;
|
|
69
200
|
let paint: () => void = () => undefined;
|
|
70
201
|
|
|
71
202
|
return {
|
|
72
203
|
attach(root) {
|
|
204
|
+
alive = true;
|
|
73
205
|
const doc = root.ownerDocument;
|
|
74
206
|
const win = doc.defaultView;
|
|
207
|
+
const runConfirm = (k: KitRuntimeProps | null, at: HTMLElement, label: string, go: () => void): void => {
|
|
208
|
+
if (k === null || k.confirm === undefined || k.confirm === 'none') { go(); return; }
|
|
209
|
+
confirmAbort?.abort();
|
|
210
|
+
const ac = new AbortController();
|
|
211
|
+
confirmAbort = ac;
|
|
212
|
+
confirmThen(k, at, label, go, ac.signal, () => alive && api.isCurrent(), () => {
|
|
213
|
+
if (confirmAbort === ac) confirmAbort = null;
|
|
214
|
+
});
|
|
215
|
+
};
|
|
75
216
|
const closeMenu = (restore: boolean): void => {
|
|
76
217
|
open = false;
|
|
77
218
|
offOutside?.();
|
|
78
219
|
offOutside = null;
|
|
79
220
|
paint();
|
|
80
|
-
if (restore) root.querySelector<HTMLElement>(
|
|
221
|
+
if (restore) root.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_PAGE_MORE_TRIGGER))?.focus();
|
|
81
222
|
};
|
|
82
223
|
|
|
83
224
|
paint = (): void => {
|
|
@@ -88,7 +229,7 @@ export function createKitPageBar(): SomaComponentDefinition {
|
|
|
88
229
|
const back: Rec = isRec(p.back) ? p.back : {};
|
|
89
230
|
const fallback = textOf(back.fallback);
|
|
90
231
|
if (fallback !== '') {
|
|
91
|
-
const btn = h('button', BACK_CLASS, { type: 'button',
|
|
232
|
+
const btn = h('button', BACK_CLASS, { type: 'button', [KIT_ATTR_PAGE_BACK]: '' }, h('span', 'inline-flex', { 'aria-hidden': 'true' }, kitIcon(kitDirAt(root) === 'rtl' ? 'arrow-right' : 'arrow-left', 'sm')), textOf(back.label, kitText('soma.kit.back', undefined, root)));
|
|
92
233
|
btn.addEventListener('click', () => {
|
|
93
234
|
const opts: { exclude?: string[]; previousCount?: number } = {};
|
|
94
235
|
if (Array.isArray(back.exclude)) opts.exclude = back.exclude.filter((e): e is string => typeof e === 'string');
|
|
@@ -107,35 +248,58 @@ export function createKitPageBar(): SomaComponentDefinition {
|
|
|
107
248
|
|
|
108
249
|
// ── 动作 ──
|
|
109
250
|
const actions = recList(p.actions);
|
|
251
|
+
// 条带投影(编译期 frames/shared 的 projectStrip('page-head')):每项的按档隐藏类与「更多」入口类;旧产物没有它时退回整组 @lg 切换
|
|
252
|
+
const strip: Rec | null = isRec(p.strip) && isRec(p.strip.item) ? p.strip : null;
|
|
253
|
+
const itemCls = (id: string): string => (strip !== null && typeof (strip.item as Rec)[id] === 'string' ? String((strip.item as Rec)[id]) : '');
|
|
110
254
|
if (actions.length > 0) {
|
|
111
255
|
const moreLabel = str(p.more_label) || kitText('soma.kit.more_actions', undefined, root);
|
|
112
|
-
const inline = h('div', INLINE_CLASS);
|
|
256
|
+
const inline = h('div', strip !== null ? STRIP_INLINE_CLASS : INLINE_CLASS);
|
|
257
|
+
// 新模式:页面线把每个页面级动作的判定(按钮形态、实心主色名额、色调、确认方式、可收纳)汇总在 props.kit.actions[动作 id];
|
|
258
|
+
// 入参里没有汇总、或汇总里没有这个动作时为 null,该动作按原来的 variant / 不确认 / 按条带投影收纳画(与改前逐字节相同)
|
|
259
|
+
const judgedOf = pageBarJudgements(p);
|
|
260
|
+
const variantFor = (a: Rec): PageBarVariant => {
|
|
261
|
+
const k = judgedOf(textOf(a.id));
|
|
262
|
+
return k === null ? variantOf(a.variant) : pageBarVariantOfJudged(a, k);
|
|
263
|
+
};
|
|
264
|
+
// 可收纳为否的动作恒在内联行(不挂条带投影的按档隐藏类),因此也不会进「更多」
|
|
265
|
+
const itemClsFor = (id: string): string => (judgedOf(id)?.stowable === false ? '' : itemCls(id));
|
|
113
266
|
// 按钮组位置全应用一条(KT-K0-5):主按钮排在最右(DOM 顺序 = 视觉顺序),其余保持声明序;派发仍按声明序号
|
|
114
|
-
const ordered = [...actions].sort((x, y) => Number(
|
|
267
|
+
const ordered = [...actions].sort((x, y) => Number(variantFor(x) === 'primary') - Number(variantFor(y) === 'primary'));
|
|
115
268
|
for (const a of ordered) {
|
|
116
269
|
const id = textOf(a.id);
|
|
117
|
-
const
|
|
270
|
+
const judged = judgedOf(id);
|
|
271
|
+
const variant = variantFor(a);
|
|
118
272
|
const icon = textOf(a.icon);
|
|
119
273
|
const content = [icon !== '' ? h('span', '', { 'aria-hidden': 'true' }, icon) : null, textOf(a.label)];
|
|
120
274
|
const href = textOf(a.href) !== '' ? safeHref(textOf(a.href)) : '';
|
|
121
275
|
const disabled = a.disabled === true;
|
|
122
276
|
if (href !== '' && !disabled) {
|
|
123
|
-
|
|
277
|
+
const link = h('a', mergeClass(linkClass(variant), itemClsFor(id)), { href, [KIT_ATTR_PAGE_ACTION]: id, [KIT_ATTR_STRIP_ITEM]: 'action' }, ...content);
|
|
278
|
+
// 要确认的链接项:先拦下原生跳转,确认通过再导航;不要确认的不挂监听(原生链接行为不变)
|
|
279
|
+
if (needsConfirm(judged)) {
|
|
280
|
+
link.addEventListener('click', (e) => {
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
runConfirm(judged, link, textOf(a.label), () => win?.location.assign(href));
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (judged !== null) kitApplyStowable(link, judged);
|
|
286
|
+
inline.append(link);
|
|
124
287
|
} else {
|
|
125
|
-
const b = h('button',
|
|
126
|
-
if (!disabled) b.addEventListener('click', () => emitActionSlot(api.emit, KIT_ACTION_SLOT_BASE.header, actions.findIndex((x) => textOf(x.id) === id),
|
|
288
|
+
const b = h('button', mergeClass(btnClass(variant), itemClsFor(id)), { type: 'button', disabled, [KIT_ATTR_PAGE_ACTION]: id, [KIT_ATTR_STRIP_ITEM]: 'action' }, ...content);
|
|
289
|
+
if (!disabled) b.addEventListener('click', () => runConfirm(judged, b, textOf(a.label), () => emitActionSlot(api.emit, KIT_ACTION_SLOT_BASE.header, actions.findIndex((x) => textOf(x.id) === id), headerPayload(root, id))));
|
|
290
|
+
if (judged !== null) kitApplyStowable(b, judged);
|
|
127
291
|
inline.append(b);
|
|
128
292
|
}
|
|
129
293
|
}
|
|
130
|
-
const trigger = h('button',
|
|
131
|
-
type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': String(open), 'aria-label': moreLabel,
|
|
294
|
+
const trigger = h('button', btnClass('neutral'), {
|
|
295
|
+
type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': String(open), 'aria-label': moreLabel, [KIT_ATTR_PAGE_MORE_TRIGGER]: '',
|
|
132
296
|
}, h('span', 'inline-flex', { 'aria-hidden': 'true' }, kitIcon('more', 'md')));
|
|
133
|
-
const more = h('div', MORE_WRAP_CLASS, {
|
|
297
|
+
const more = h('div', strip !== null ? mergeClass('relative', str(strip.more)) : MORE_WRAP_CLASS, { [KIT_ATTR_PAGE_MORE]: '' }, trigger);
|
|
134
298
|
trigger.addEventListener('click', () => {
|
|
135
299
|
open = !open;
|
|
136
300
|
offOutside?.();
|
|
137
301
|
offOutside = null;
|
|
138
|
-
if (open) offOutside = onOutsidePointer(doc, (t) => t.closest(
|
|
302
|
+
if (open) offOutside = onOutsidePointer(doc, (t) => t.closest(kitAttrSel(KIT_ATTR_PAGE_MORE)) !== null, () => closeMenu(false));
|
|
139
303
|
paint();
|
|
140
304
|
if (open) {
|
|
141
305
|
// 下拉面板打开时挂在浮层端口里,不在 root 的后代中
|
|
@@ -144,15 +308,26 @@ export function createKitPageBar(): SomaComponentDefinition {
|
|
|
144
308
|
}
|
|
145
309
|
});
|
|
146
310
|
if (open) {
|
|
147
|
-
|
|
148
|
-
|
|
311
|
+
// 条带收纳:菜单只列当前被收起的项(按投影类的显隐现算,同 KitActionMore;不量宽);整组切换的旧形态列全部
|
|
312
|
+
const hiddenNow = (a: Rec): boolean => {
|
|
313
|
+
if (strip === null) return true;
|
|
314
|
+
const el = root.querySelector<HTMLElement>(`[${KIT_ATTR_PAGE_ACTION}="${CSS.escape(textOf(a.id))}"]`);
|
|
315
|
+
return el === null || win?.getComputedStyle(el).display === 'none';
|
|
316
|
+
};
|
|
317
|
+
// 危险标记:有判定时按判定后的形态(危险色调),没有判定时与原来一样看声明的 variant
|
|
318
|
+
const items: KitDropdownItem[] = actions.filter(hiddenNow).map((a) => ({
|
|
319
|
+
key: textOf(a.id), label: textOf(a.label), disabled: a.disabled === true, danger: judgedOf(textOf(a.id)) === null ? a.variant === 'danger' : variantFor(a) === 'danger',
|
|
149
320
|
}));
|
|
150
321
|
more.append(buildDropdownPanel(items, (key) => {
|
|
151
322
|
const a = actions.find((x) => textOf(x.id) === key);
|
|
152
323
|
closeMenu(true);
|
|
153
324
|
const href = a !== undefined && textOf(a.href) !== '' ? safeHref(textOf(a.href)) : '';
|
|
154
|
-
|
|
155
|
-
|
|
325
|
+
// 菜单项点下后菜单已收起并重画:确认锚在重画后的「更多」触发钮上(closeMenu(true) 刚把焦点还给它)
|
|
326
|
+
const at = root.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_PAGE_MORE_TRIGGER)) ?? root;
|
|
327
|
+
runConfirm(judgedOf(key), at, a !== undefined ? textOf(a.label) : key, () => {
|
|
328
|
+
if (href !== '') win?.location.assign(href);
|
|
329
|
+
else emitActionSlot(api.emit, KIT_ACTION_SLOT_BASE.header, actions.findIndex((x) => textOf(x.id) === key), headerPayload(root, key));
|
|
330
|
+
});
|
|
156
331
|
}, (restore) => closeMenu(restore), moreLabel));
|
|
157
332
|
}
|
|
158
333
|
kids.push(inline, more);
|
|
@@ -165,6 +340,9 @@ export function createKitPageBar(): SomaComponentDefinition {
|
|
|
165
340
|
};
|
|
166
341
|
|
|
167
342
|
return () => {
|
|
343
|
+
alive = false;
|
|
344
|
+
confirmAbort?.abort();
|
|
345
|
+
confirmAbort = null;
|
|
168
346
|
releaseDropdownsIn(root);
|
|
169
347
|
offOutside?.();
|
|
170
348
|
offOutside = null;
|
|
@@ -10,6 +10,7 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
10
10
|
import { CLASS_PROP, createKitController } from '../base/shared';
|
|
11
11
|
import { onKitActionStatus, type KitActionStatusPhase } from '../base/action-status';
|
|
12
12
|
import { classSet } from '../data/menu-dom';
|
|
13
|
+
import { KIT_ATTR_STATUS } from '../shared/dom-attrs';
|
|
13
14
|
|
|
14
15
|
// 与标题的间距(mt-1)跟着文案走:没有文案时整行不占位(hidden),页头节奏与不写 status 的页一致
|
|
15
16
|
const ROOT_CLASS = 'mt-1 min-h-5 text-sm text-fg-muted';
|
|
@@ -36,8 +37,8 @@ export function createKitPageStatus(): SomaComponentDefinition {
|
|
|
36
37
|
const paint = (phase: KitActionStatusPhase | null, text: string): void => {
|
|
37
38
|
root.textContent = text;
|
|
38
39
|
root.className = text === '' ? EMPTY_CLASS : phase === 'failed' ? FAILED_CLASS : ROOT_CLASS;
|
|
39
|
-
if (phase === null) root.removeAttribute(
|
|
40
|
-
else root.setAttribute(
|
|
40
|
+
if (phase === null) root.removeAttribute(KIT_ATTR_STATUS);
|
|
41
|
+
else root.setAttribute(KIT_ATTR_STATUS, phase);
|
|
41
42
|
if (phase === 'busy') root.setAttribute('aria-busy', 'true');
|
|
42
43
|
else root.removeAttribute('aria-busy');
|
|
43
44
|
};
|
|
@@ -6,7 +6,6 @@ import { createKitSplitWiring } from './split-frame/wiring';
|
|
|
6
6
|
import { createKitWorkspace } from './workspace-frame/view';
|
|
7
7
|
import { createKitPageBar } from './page-bar';
|
|
8
8
|
import { createKitPageStatus } from './page-status';
|
|
9
|
-
import { createKitListSummary } from './list-summary';
|
|
10
9
|
|
|
11
10
|
export function createKitFrameResidentComponents(): Record<string, SomaComponentDefinition> {
|
|
12
11
|
return {
|
|
@@ -15,6 +14,5 @@ export function createKitFrameResidentComponents(): Record<string, SomaComponent
|
|
|
15
14
|
KitWorkspace: createKitWorkspace(),
|
|
16
15
|
KitPageBar: createKitPageBar(),
|
|
17
16
|
KitPageStatus: createKitPageStatus(),
|
|
18
|
-
KitListSummary: createKitListSummary(),
|
|
19
17
|
};
|
|
20
18
|
}
|
package/src/frames/shared.ts
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
// 页面框共用件:转义、页头、槽位片段合并、类检查。纯函数。
|
|
2
2
|
|
|
3
|
+
import { kitNeutralClass } from '../biz/shared/pipeline';
|
|
3
4
|
import { emptyFragment, mergeFragments, type KitFragment } from '../object-renderer/fragment';
|
|
4
5
|
import { classesInHtml } from '../object-renderer/candidates';
|
|
5
6
|
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow } from '../base/action-slots';
|
|
6
7
|
import { checkClasses, mergeClass } from '../shared/merge-class';
|
|
7
8
|
import { kitFrameBleedCanvasRecipe, kitFrameBleedHeaderRecipe, kitFrameBleedTabBarRecipe } from '../recipes/frame-bleed';
|
|
8
9
|
import type { KitDiagnostic } from '../object-renderer/types';
|
|
10
|
+
import { kitClosedValueRecipe } from '../recipes/field-text';
|
|
11
|
+
import { KIT_CANVAS_CLASS } from '../recipes/chrome-surface';
|
|
9
12
|
import { breadcrumbsHtml } from '../data/breadcrumbs';
|
|
10
|
-
import { KIT_PAGE_HEADER_ACTIONS_CLASS, KIT_PAGE_HEADER_GAP_CLASS, KIT_PAGE_HEADER_GAP_STICKY_CLASS, KIT_PAGE_HEADER_ROW_CLASS, KIT_PAGE_HEAD_ROW_ATTR,
|
|
13
|
+
import { KIT_PAGE_HEADER_ACTIONS_CLASS, KIT_PAGE_HEADER_GAP_CLASS, KIT_PAGE_HEADER_GAP_STICKY_CLASS, KIT_PAGE_HEADER_ROW_CLASS, KIT_PAGE_HEAD_ROW_ATTR, KIT_PAGE_DESC_CLASS, KIT_PAGE_TITLE_ROW_ATTR, KIT_PAGE_TITLE_ROW_CLASS, KIT_PAGE_HEADER_EMBED_CLASS, KIT_PAGE_HEADER_EMBED_GAPLESS_CLASS, KIT_PAGE_TITLE_EMBED_CLASS } from '../recipes/strip';
|
|
11
14
|
import { KIT_PART_TITLE_PAGE, kitTypographyRecipe } from '../recipes/typography';
|
|
12
15
|
import type { KitFrameInput } from './types';
|
|
13
16
|
import { PAGE_HEADER } from './page-header';
|
|
14
17
|
import { KIT_PAGE_BAR_CLASS_CANDIDATES } from './page-bar';
|
|
18
|
+
import { projectStrip } from '../object-renderer/action-group';
|
|
15
19
|
import { KIT_PAGE_STATUS_CLASS_CANDIDATES } from './page-status';
|
|
16
20
|
|
|
17
21
|
import { esc } from '../shared/escape';
|
|
22
|
+
import { KIT_ATTR_FRAME_BLEED, KIT_ATTR_LAYER, KIT_ATTR_PART, KIT_ATTR_STICKY_EDGE, kitAttrHtml } from '../shared/dom-attrs';
|
|
18
23
|
export { esc };
|
|
19
24
|
|
|
20
25
|
/** 第 1 层:页面框画布;页边距读真源 density.pageMarginPx(--soma-page-margin,标准 24 / 紧凑 16 / 宽松 32,随 theme.density),不再按档位换类 */
|
|
21
|
-
|
|
26
|
+
// 嵌入工作台且主体不装卡时画布取面板面:画布是层 0 容器,底色归结构 CSS 的层级规则(theme/nine-dim-structure.ts,KT-B10「套面板与装卡二选一」)
|
|
27
|
+
// 画布底只引层级角色出口 recipes/chrome-surface(§3.9 KT-HB-F);吸顶页头的不透明底与画布同一出口
|
|
28
|
+
export const CANVAS_CLASS = `${KIT_CANVAS_CLASS} p-page min-h-screen text-sm text-fg`;
|
|
22
29
|
/** 通栏画布(frame.bleed):与 CANVAS_CLASS 只差页边距——内容区不留页边距,页头自己带水平内边距(见 HEADER_BLEED_*) */
|
|
23
30
|
export const CANVAS_BLEED_CLASS = kitFrameBleedCanvasRecipe();
|
|
24
31
|
/** 通栏标记:打在内容容器(槽位容器 / 页签面板体)上;结构 CSS(nine-dim-structure 的 frame-bleed 块)据此让直接子面板与内容区共边 */
|
|
25
|
-
export const KIT_FRAME_BLEED_ATTR =
|
|
32
|
+
export const KIT_FRAME_BLEED_ATTR = KIT_ATTR_FRAME_BLEED;
|
|
26
33
|
export function bleedMark(input: KitFrameInput): string {
|
|
27
34
|
return input.bleed === true ? ` ${KIT_FRAME_BLEED_ATTR}=""` : '';
|
|
28
35
|
}
|
|
29
36
|
const TITLE_CLASS = kitTypographyRecipe('pageTitle');
|
|
30
37
|
const EYEBROW_CLASS = 'mb-1 text-xs font-medium text-primary-on-soft';
|
|
31
|
-
|
|
38
|
+
// 页面说明任何模式都不上页面(§11.17 C2):只留给读屏,出口在 recipes/strip#KIT_PAGE_DESC_CLASS
|
|
39
|
+
const SUBTITLE_CLASS = KIT_PAGE_DESC_CLASS;
|
|
32
40
|
|
|
33
41
|
export function classAttr(value: string): string {
|
|
34
42
|
return value === '' ? '' : ` class="${esc(value)}"`;
|
|
@@ -39,11 +47,14 @@ export function classAttr(value: string): string {
|
|
|
39
47
|
// 间距读真源 structure.titleToBlockGapUnits(--soma-title-block-gap,标准 4 × 4 = 16,随密度同比):mb-title-block / pb-title-block
|
|
40
48
|
const HEADER_BAR_CLASS = `${KIT_PAGE_HEADER_GAP_CLASS} @container`;
|
|
41
49
|
const HEADER_BAR_STANDARD_CLASS = `${KIT_PAGE_HEADER_GAP_CLASS} @container`;
|
|
42
|
-
const HEADER_STICKY_CLASS = `sticky top-0 z-10
|
|
43
|
-
const HEADER_STICKY_STANDARD_CLASS = `sticky top-0 z-10
|
|
50
|
+
const HEADER_STICKY_CLASS = `sticky top-0 z-10 ${KIT_CANVAS_CLASS} ${KIT_PAGE_HEADER_GAP_STICKY_CLASS} @container`;
|
|
51
|
+
const HEADER_STICKY_STANDARD_CLASS = `sticky top-0 z-10 ${KIT_CANVAS_CLASS} ${KIT_PAGE_HEADER_GAP_STICKY_CLASS} @container`;
|
|
52
|
+
// V4-L0-4:next 管线吸顶页头不再携带无层 bg-surface-sunken,由 @layer soma-kit-values 的 canvas > head 规则自然与画布融底
|
|
53
|
+
const HEADER_STICKY_NEXT_CLASS = `sticky top-0 z-10 ${KIT_PAGE_HEADER_GAP_STICKY_CLASS} @container`;
|
|
44
54
|
// 通栏页头(frame.bleed):画布无页边距,页头自带水平 / 顶部页边距(px-page / pt-page,读同一个 --soma-page-margin)与下分隔(pb-title-block + 发丝线),不贴边
|
|
45
55
|
const HEADER_BLEED_CLASS = kitFrameBleedHeaderRecipe(false);
|
|
46
56
|
const HEADER_BLEED_STICKY_CLASS = kitFrameBleedHeaderRecipe(true);
|
|
57
|
+
const HEADER_BLEED_STICKY_NEXT_CLASS = mergeClass('sticky top-0 z-10', HEADER_BLEED_CLASS);
|
|
47
58
|
export const KIT_TAB_BAR_BLEED_CLASS = kitFrameBleedTabBarRecipe();
|
|
48
59
|
// 页头 = 标题行(strip.pageTitleRowPx,所有页面类型同高)+ 可选第二行(副标题,strip.pageSecondRowPx);没有第二行时不留空槽位(排布只在 recipes/strip 一处)
|
|
49
60
|
const TITLE_ROW_CLASS = KIT_PAGE_TITLE_ROW_CLASS;
|
|
@@ -52,7 +63,7 @@ const ACTIONS_SLOT_CLASS = `shrink-0 ${KIT_PAGE_HEADER_ACTIONS_CLASS}`;
|
|
|
52
63
|
const BACK_WRAP_CLASS = 'mb-2';
|
|
53
64
|
const STATUS_CLASS: Record<string, string> = {
|
|
54
65
|
// 中性徽标 = 浅底芯片(无描边,芯片一种形体)
|
|
55
|
-
neutral: '
|
|
66
|
+
neutral: kitClosedValueRecipe('neutral'),
|
|
56
67
|
info: 'inline-flex items-center rounded-full bg-info-soft px-2 py-0.5 text-xs font-medium text-info-on-soft',
|
|
57
68
|
success: 'inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-xs font-medium text-success-on-soft',
|
|
58
69
|
warning: 'inline-flex items-center rounded-full bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning-on-soft',
|
|
@@ -62,7 +73,7 @@ const WIDTH_WRAP_CLASS = 'mx-auto w-full';
|
|
|
62
73
|
|
|
63
74
|
/** 页头用到的全部固定类(含页头部件 KitPageBar 自带类),并入候选 */
|
|
64
75
|
const HEADER_EXTRA_CANDIDATES: readonly string[] = [
|
|
65
|
-
...new Set([HEADER_BAR_CLASS, HEADER_BAR_STANDARD_CLASS, HEADER_STICKY_CLASS, HEADER_STICKY_STANDARD_CLASS, HEADER_BLEED_CLASS, HEADER_BLEED_STICKY_CLASS, KIT_TAB_BAR_BLEED_CLASS, TITLE_CLASS, TITLE_ROW_CLASS, TOP_ROW_CLASS, ACTIONS_SLOT_CLASS, SUBTITLE_CLASS, BACK_WRAP_CLASS, ...Object.values(STATUS_CLASS), ...KIT_PAGE_BAR_CLASS_CANDIDATES, ...KIT_PAGE_STATUS_CLASS_CANDIDATES]
|
|
76
|
+
...new Set([HEADER_BAR_CLASS, HEADER_BAR_STANDARD_CLASS, HEADER_STICKY_CLASS, HEADER_STICKY_STANDARD_CLASS, HEADER_STICKY_NEXT_CLASS, HEADER_BLEED_CLASS, HEADER_BLEED_STICKY_CLASS, HEADER_BLEED_STICKY_NEXT_CLASS, KIT_TAB_BAR_BLEED_CLASS, TITLE_CLASS, TITLE_ROW_CLASS, TOP_ROW_CLASS, ACTIONS_SLOT_CLASS, SUBTITLE_CLASS, BACK_WRAP_CLASS, KIT_PAGE_HEADER_EMBED_CLASS, KIT_PAGE_HEADER_EMBED_GAPLESS_CLASS, KIT_PAGE_TITLE_EMBED_CLASS, ...Object.values(STATUS_CLASS), ...KIT_PAGE_BAR_CLASS_CANDIDATES, ...KIT_PAGE_STATUS_CLASS_CANDIDATES]
|
|
66
77
|
.flatMap((s) => s.split(/\s+/)).filter((c) => c !== '')),
|
|
67
78
|
];
|
|
68
79
|
|
|
@@ -73,12 +84,19 @@ export function maxWidthClass(input: KitFrameInput): string {
|
|
|
73
84
|
return cls === '' ? '' : `${WIDTH_WRAP_CLASS} ${cls}`;
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* 用 max_width 包住页头 + 主体;没写档位原样返回。候选类并入 widthCandidates()。
|
|
89
|
+
* 新模式:恒输出内容包装 frame__width、不带限宽类——它是页面线版心(data-kit-envelope)的落点(biz/layout-contracts.ts#KIT_FRAME_CONTENT_ANCHORS),
|
|
90
|
+
* 限宽居中由取值表按版心属性给;再输出 max-w-* 就成了双重限宽。页面声明的 max_width 与应用缺省的版心档不在这里出类:它们是页面线版心求解的显式输入
|
|
91
|
+
* (spatial/layout.ts → 求解出口 arrangePageEnvelope 的 declaredTier / appTier),结果落到 data-kit-envelope。旧版输出不变
|
|
92
|
+
*/
|
|
77
93
|
export function widthWrap(input: KitFrameInput, inner: string): string {
|
|
94
|
+
if (input.pipeline === 'next') return `<div data-soma-id="frame__width">${inner}</div>`;
|
|
78
95
|
const cls = maxWidthClass(input);
|
|
79
96
|
return cls === '' ? inner : `<div data-soma-id="frame__width"${classAttr(cls)}>${inner}</div>`;
|
|
80
97
|
}
|
|
81
98
|
export function widthCandidates(input: KitFrameInput): string[] {
|
|
99
|
+
if (input.pipeline === 'next') return [];
|
|
82
100
|
const cls = maxWidthClass(input);
|
|
83
101
|
return cls === '' ? [] : cls.split(' ');
|
|
84
102
|
}
|
|
@@ -115,10 +133,10 @@ export function headerFragment(input: KitFrameInput, prefix = ''): KitFragment {
|
|
|
115
133
|
const { page } = input;
|
|
116
134
|
const { title, subtitle, eyebrow, breadcrumbs } = page;
|
|
117
135
|
const crumbs = breadcrumbs !== undefined && breadcrumbs.length > 0
|
|
118
|
-
? `<div data-soma-id="${esc(`${hid}__crumbs`)}" class="${isStandard ? 'mb-4' : 'mb-2'}">${breadcrumbsHtml(breadcrumbs, { anchorId: `${hid}__crumbs_nav`, locale: input.locale ?? '' })}</div>`
|
|
136
|
+
? `<div data-soma-id="${esc(`${hid}__crumbs`)}" class="${isStandard ? 'mb-4' : 'mb-2'} ${KIT_PAGE_TITLE_EMBED_CLASS}">${breadcrumbsHtml(breadcrumbs, { anchorId: `${hid}__crumbs_nav`, locale: input.locale ?? '' })}</div>`
|
|
119
137
|
: '';
|
|
120
138
|
const eye = eyebrow !== undefined && eyebrow !== ''
|
|
121
|
-
? `<p data-soma-id="${esc(`${hid}__eyebrow`)}"${classAttr(EYEBROW_CLASS)}>${esc(eyebrow)}</p>`
|
|
139
|
+
? `<p data-soma-id="${esc(`${hid}__eyebrow`)}"${classAttr(`${EYEBROW_CLASS} ${KIT_PAGE_TITLE_EMBED_CLASS}`)}>${esc(eyebrow)}</p>`
|
|
122
140
|
: '';
|
|
123
141
|
const sub = subtitle !== undefined && subtitle !== ''
|
|
124
142
|
? `<p data-soma-id="${esc(`${hid}__subtitle`)}"${classAttr(SUBTITLE_CLASS)}>${esc(subtitle)}</p>`
|
|
@@ -146,9 +164,19 @@ export function headerFragment(input: KitFrameInput, prefix = ''): KitFragment {
|
|
|
146
164
|
liveHtml = `<div data-soma-component="KitPageStatus" data-soma-id="${esc(id)}"></div>`;
|
|
147
165
|
}
|
|
148
166
|
let actionsHtml = '';
|
|
167
|
+
let actionsSlotClass = ACTIONS_SLOT_CLASS;
|
|
168
|
+
let actionsStripMark = '';
|
|
149
169
|
if (page.actions !== undefined && page.actions.length > 0) {
|
|
150
170
|
const id = `${hid}__actions`;
|
|
151
|
-
|
|
171
|
+
// 页头动作条 = 条带求解(solveStrip,载体 page-head,KT-D9-1):放不下时次级动作按保留序逐个收进「更多」,主操作恒可见;
|
|
172
|
+
// 不再是「窄于 @lg 整组收进更多」的固定档。宿主由载体推出(占标题之后的剩余宽的查询容器),标题过长时整组换到下一行(换布局级)
|
|
173
|
+
const strip = projectStrip('page-head', page.actions.map((a) => ({
|
|
174
|
+
id: a.id, kind: 'action' as const, label: a.label,
|
|
175
|
+
importance: a.variant === 'primary' ? 'primary' as const : a.variant === 'danger' ? 'danger' as const : 'secondary' as const,
|
|
176
|
+
})));
|
|
177
|
+
actionsSlotClass = mergeClass(mergeClass(strip.hostClass, KIT_PAGE_HEADER_ACTIONS_CLASS), 'justify-end');
|
|
178
|
+
actionsStripMark = ` ${strip.mark}`;
|
|
179
|
+
show[id] = { props: { actions: page.actions.map((a) => ({ ...a })), strip: { item: strip.itemClass, more: strip.moreClass } } };
|
|
152
180
|
// 每个页头动作各抛 action_<序号>(序号 = 它在 actions 数组里的位置),各绑一条 ACTION | 名字
|
|
153
181
|
const overflow = actionSlotOverflow(page.actions.length, 'page.actions');
|
|
154
182
|
if (overflow !== null) out.diagnostics.push({ code: 'KIT-EVT-001', path: 'page.actions', message: overflow });
|
|
@@ -160,18 +188,31 @@ export function headerFragment(input: KitFrameInput, prefix = ''): KitFragment {
|
|
|
160
188
|
}
|
|
161
189
|
out.events[`${id}.${actionSlotEvent(KIT_ACTION_SLOT_BASE.header, i)}`] = `ACTION | ${a.action}`;
|
|
162
190
|
});
|
|
163
|
-
actionsHtml = `<div data-soma-component="KitPageBar" data-soma-id="${esc(id)}"${classAttr(
|
|
191
|
+
actionsHtml = `<div data-soma-component="KitPageBar" data-soma-id="${esc(id)}"${actionsStripMark}${classAttr(actionsSlotClass)}></div>`;
|
|
164
192
|
}
|
|
165
193
|
const titleCls = TITLE_CLASS;
|
|
194
|
+
const isNext = input.pipeline === 'next';
|
|
166
195
|
const barCls = input.bleed === true
|
|
167
|
-
? (page.sticky === true ? HEADER_BLEED_STICKY_CLASS : HEADER_BLEED_CLASS)
|
|
168
|
-
: page.sticky === true
|
|
169
|
-
|
|
196
|
+
? (page.sticky === true ? (isNext ? HEADER_BLEED_STICKY_NEXT_CLASS : HEADER_BLEED_STICKY_CLASS) : HEADER_BLEED_CLASS)
|
|
197
|
+
: page.sticky === true
|
|
198
|
+
? (isNext ? HEADER_STICKY_NEXT_CLASS : (isStandard ? HEADER_STICKY_STANDARD_CLASS : HEADER_STICKY_CLASS))
|
|
199
|
+
: (isStandard ? HEADER_BAR_STANDARD_CLASS : HEADER_BAR_CLASS);
|
|
200
|
+
// 页名不重复:嵌在工作页签里时标题块只留给读屏;页头没有别的内容时整个页头不占位(recipes/strip 的两个出口)。
|
|
201
|
+
// 带状态标签 / 状态行的页头不收(那是页面自己的信息,不是页名的重复)
|
|
202
|
+
// 标题行带静态状态标签时整行不收(标签是页面自己的信息),嵌入态只把 h1 收给读屏、标签留下(非内容项 N02);状态行(最近一次操作的结果)是瞬时反馈,标题收起后它仍在原位
|
|
203
|
+
const quietTitle = page.status === undefined;
|
|
204
|
+
// 面包屑与眼眉在嵌入态同样只留给读屏(非内容项 N01:层级位置已由导航选中项与页签给出),不再让页头因它们不被收起
|
|
205
|
+
const noChrome = quietTitle && backHtml === '' && actionsHtml === '';
|
|
206
|
+
const bareHeader = noChrome && liveHtml === '';
|
|
207
|
+
const headerEmbedCls = bareHeader ? ` ${KIT_PAGE_HEADER_EMBED_CLASS}` : noChrome ? ` ${KIT_PAGE_HEADER_EMBED_GAPLESS_CLASS}` : '';
|
|
208
|
+
const titleRowCls = quietTitle ? `${TITLE_ROW_CLASS} ${KIT_PAGE_TITLE_EMBED_CLASS}` : TITLE_ROW_CLASS;
|
|
209
|
+
const titleBlock = `<div class="min-w-0"><div ${KIT_PAGE_TITLE_ROW_ATTR}=""${classAttr(titleRowCls)}><h1 data-soma-id="${esc(`${hid}__title`)}" ${KIT_ATTR_PART}="${KIT_PART_TITLE_PAGE}"${classAttr(quietTitle ? titleCls : `${titleCls} ${KIT_PAGE_TITLE_EMBED_CLASS}`)}>${esc(title)}</h1>${status}</div>${sub}${liveHtml}</div>`;
|
|
170
210
|
// 吸顶页头与画布同层(层 0):它只是盖住滚动内容的画布色条,不是新的一层表面;不写则编译期标注把它标成层 1(白底),在蓝灰画布上长出一条白带
|
|
171
|
-
|
|
211
|
+
// 新模式:表面层级是布局的结论(页头条带锚点 frame__header 上的 data-kit-level),模板不再写 data-kit-layer
|
|
212
|
+
const stickyLayer = page.sticky === true && input.pipeline !== 'next' ? kitAttrHtml(KIT_ATTR_LAYER, '0') : '';
|
|
172
213
|
// 吸顶页头吸住后才出现下缘分隔:标记 data-kit-sticky-edge(滚动驱动 CSS 路径,零脚本;样式与数字在结构 CSS / 真源 structure.stickyEdge)
|
|
173
|
-
const stickyEdge = page.sticky === true ?
|
|
174
|
-
out.html = `<header data-soma-id="${esc(hid)}"${stickyLayer}${stickyEdge}${classAttr(barCls)}>${crumbs}${backHtml}${eye}<div ${KIT_PAGE_HEAD_ROW_ATTR}=""${classAttr(TOP_ROW_CLASS)}>${titleBlock}${actionsHtml}</div></header>`;
|
|
214
|
+
const stickyEdge = page.sticky === true ? kitAttrHtml(KIT_ATTR_STICKY_EDGE) : '';
|
|
215
|
+
out.html = `<header data-soma-id="${esc(hid)}"${stickyLayer}${stickyEdge}${classAttr(`${barCls}${headerEmbedCls}`)}>${crumbs}${backHtml}${eye}<div ${KIT_PAGE_HEAD_ROW_ATTR}=""${classAttr(TOP_ROW_CLASS)}>${titleBlock}${actionsHtml}</div></header>`;
|
|
175
216
|
if (Object.keys(show).length > 0) out.ui.show = show;
|
|
176
217
|
const used: string[] = [];
|
|
177
218
|
if (backHtml !== '' || actionsHtml !== '') used.push('KitPageBar');
|
|
@@ -238,13 +279,15 @@ export function finishFrame(slotParts: KitFragment[], html: string, extraCandida
|
|
|
238
279
|
};
|
|
239
280
|
}
|
|
240
281
|
|
|
241
|
-
/** 宽松画布:仅当应用密度显式指定为
|
|
282
|
+
/** 宽松画布:仅当应用密度显式指定为 spacious 时启用 p-6 宽松画布;未设与默认 standard、compact、touch 统一为 p-4 标准画布 */
|
|
242
283
|
function roomyCanvas(input: KitFrameInput): boolean {
|
|
243
|
-
return input.density === '
|
|
284
|
+
return input.density === 'spacious';
|
|
244
285
|
}
|
|
245
286
|
|
|
246
287
|
export function rootClass(input: KitFrameInput, base?: string): string {
|
|
247
288
|
const dflt = base ?? (input.bleed === true ? CANVAS_BLEED_CLASS : CANVAS_CLASS);
|
|
289
|
+
// 新模式:页面框根是画布区域的容器(锚点 frame__root),画布底色由取值表按层级角色「画布」给,模板只留结构类
|
|
290
|
+
if (input.pipeline === 'next') return mergeClass(kitNeutralClass(dflt), input.class);
|
|
248
291
|
return mergeClass(dflt, input.class);
|
|
249
292
|
}
|
|
250
293
|
|
|
@@ -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
|
};
|