soma-kit 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +8 -5
- package/packs/ai/model-card.ts +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/packs/ops/error-budget-card.ts +3 -3
- package/packs/ops/release-readiness-card.ts +3 -3
- package/packs/security/control-evidence-card.ts +3 -3
- package/packs/security/finding-card.ts +3 -2
- package/packs/shared/card-util.ts +17 -0
- package/spec/generated/kit-app.schema.json +2148 -338
- package/spec/generated/kit-page.schema.json +1152 -87
- package/spec/kit-grammar.json +1084 -136
- package/spec/kit-grammar.schema.json +167 -26
- package/src/app/app-config.ts +220 -187
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +200 -22
- package/src/app/define-kit-app.ts +54 -8
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +12 -7
- package/src/app/kit-view-context.ts +50 -3
- package/src/app/list-page-defaults.ts +14 -0
- package/src/app/server-pages.ts +239 -7
- package/src/app/server.ts +466 -25
- package/src/app/theme-endpoint.ts +68 -24
- package/src/app/theme-runtime.ts +421 -87
- package/src/app/theme-shards.ts +69 -0
- package/src/app/tier-compat.ts +107 -0
- package/src/base/action-busy.ts +215 -38
- package/src/base/affix.ts +137 -0
- package/src/base/alert.ts +107 -59
- package/src/base/anchored-layer.ts +8 -7
- package/src/base/avatar.ts +147 -61
- package/src/base/badge.ts +186 -0
- package/src/base/button-group.ts +227 -0
- package/src/base/button.ts +365 -53
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +147 -32
- package/src/base/check-core.ts +196 -33
- package/src/base/checkbox.ts +67 -2
- package/src/base/choice.ts +132 -31
- package/src/base/collapse.ts +249 -0
- package/src/base/color-picker.ts +404 -28
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +155 -37
- package/src/base/context-menu.ts +26 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +115 -94
- package/src/base/date.ts +487 -76
- package/src/base/delta.ts +20 -11
- package/src/base/divider.ts +64 -97
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +64 -23
- package/src/base/gap-value.ts +35 -16
- package/src/base/hint-tips.ts +100 -30
- package/src/base/identity-cells.ts +839 -0
- package/src/base/illustrations.ts +6 -4
- package/src/base/image.ts +40 -19
- package/src/base/index.ts +92 -24
- package/src/base/inline-error.ts +90 -0
- package/src/base/input.ts +174 -38
- package/src/base/kbd.ts +31 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +324 -95
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +58 -22
- package/src/base/menu-button.ts +129 -42
- package/src/base/menu-core.ts +210 -26
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +10 -5
- package/src/base/motion/hover-gallery.ts +19 -12
- package/src/base/motion/limits.ts +10 -0
- package/src/base/motion/marquee.ts +18 -11
- package/src/base/motion/text-rotate.ts +34 -16
- package/src/base/notification.ts +292 -0
- package/src/base/number.ts +93 -12
- package/src/base/otp.ts +143 -27
- package/src/base/overlay-runtime.ts +32 -24
- package/src/base/overlay-shell.ts +186 -0
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +625 -74
- package/src/base/popup.ts +219 -78
- package/src/base/portal-core.ts +99 -2
- package/src/base/price-text.ts +51 -17
- package/src/base/progress.ts +100 -18
- package/src/base/qr-code.ts +64 -17
- package/src/base/qty-stepper.ts +145 -21
- package/src/base/radio.ts +43 -2
- package/src/base/range.ts +194 -39
- package/src/base/rating.ts +117 -31
- package/src/base/reason-tip.ts +60 -18
- package/src/base/relation-cells.ts +541 -0
- package/src/{frames → base}/resize-handle.ts +6 -4
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +99 -56
- package/src/base/select.ts +8 -2
- package/src/base/shared.ts +520 -73
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/status-tone.ts +1 -1
- package/src/base/sticky-edge.ts +96 -29
- package/src/base/swap.ts +39 -21
- package/src/base/switch.ts +158 -38
- package/src/base/tabs.ts +292 -0
- package/src/base/tag-input.ts +129 -55
- package/src/base/tag.ts +203 -91
- package/src/base/text.ts +491 -77
- package/src/base/textarea.ts +89 -40
- package/src/base/time-picker.ts +341 -57
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +346 -89
- package/src/base/upload.ts +612 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +98 -6
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +53 -13
- package/src/biz/auth-panel/compile.ts +14 -4
- package/src/biz/auth-panel/shell.ts +28 -8
- package/src/biz/category-crud/compile.ts +64 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +30 -8
- package/src/biz/checkout-page/compile.ts +38 -4
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +28 -10
- package/src/biz/compose.ts +9 -4
- package/src/biz/data-components.ts +2 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +5 -2
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +36 -20
- package/src/biz/index.ts +5 -4
- package/src/biz/landing-page/compile.ts +4 -3
- package/src/biz/landing-page/shell.ts +25 -5
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +62 -16
- package/src/biz/master-sub/compile.ts +318 -38
- package/src/biz/master-sub/detail-head.ts +145 -21
- package/src/biz/master-sub/index.ts +6 -3
- package/src/biz/master-sub/shell.ts +232 -66
- package/src/biz/multi-board/compile.ts +89 -38
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +25 -9
- package/src/biz/multi-board/prose-fold.ts +17 -13
- package/src/biz/multi-board/shell.ts +153 -38
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +28 -7
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +51 -11
- package/src/biz/page-templates/domain-templates.ts +147 -20
- package/src/biz/page-templates/result-page/compile.ts +5 -2
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +20 -6
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +20 -9
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +30 -14
- package/src/biz/record-detail/compile.ts +43 -12
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +42 -11
- package/src/biz/settings-center/compile.ts +5 -2
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +33 -9
- package/src/biz/shared/action-host.ts +146 -48
- package/src/biz/shared/compile-helpers.ts +134 -32
- package/src/biz/shared/coordinator.ts +727 -163
- package/src/biz/shared/focus-return.ts +180 -0
- package/src/biz/shared/object-aliases.ts +7 -1
- package/src/biz/shared/overlay-compile.ts +102 -24
- package/src/biz/shared/overlay-shell.ts +97 -116
- package/src/biz/shared/page-form-actions.ts +151 -0
- package/src/biz/shared/page-form.ts +255 -0
- package/src/biz/shared/pipeline.ts +74 -0
- package/src/biz/shared/runtime-hub.ts +101 -8
- package/src/biz/shared/verbs.ts +129 -0
- package/src/biz/single-form/compile.ts +6 -4
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +22 -8
- package/src/biz/standard-crud/compile.ts +213 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +90 -13
- package/src/biz/standard-crud/summary.ts +2 -35
- package/src/biz/step-form/compile.ts +13 -4
- package/src/biz/step-form/hub.ts +168 -49
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +35 -17
- package/src/biz/types.ts +49 -6
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +179 -33
- package/src/cli/kit-init.ts +152 -3
- package/src/cli/migrate/theme-map.ts +35 -28
- package/src/cli/migrate/ts-rules.ts +2 -2
- package/src/cli/migrate/types.ts +3 -3
- package/src/cli/migrate/yaml-rules.ts +11 -9
- package/src/cli/view-writes.ts +13 -0
- package/src/compile/access-gate-attach.ts +1 -1
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +461 -273
- package/src/compile/component-candidates.ts +58 -5
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +6 -59
- package/src/compile/index.ts +2 -2
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +44 -13
- package/src/compile/layout-lint/rules-table.ts +4 -19
- package/src/compile/look-page.ts +551 -0
- package/src/compile/look.ts +376 -0
- package/src/compile/page-composition.ts +405 -67
- package/src/compile/page-hierarchy.ts +131 -0
- package/src/compile/page-pipeline-look.ts +156 -0
- package/src/compile/page-pipeline.ts +200 -0
- package/src/compile/parse.ts +12 -11
- package/src/compile/redirect.ts +1 -1
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +786 -0
- package/src/compile/styles.ts +286 -48
- package/src/compile/types.ts +63 -6
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +52 -23
- package/src/data/anchor-nav.ts +77 -16
- package/src/data/approval-flow.ts +217 -126
- package/src/data/assignment-picker.ts +182 -94
- package/src/data/async-result-panel.ts +114 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +150 -24
- package/src/data/calendar.ts +436 -97
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +81 -41
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +1053 -96
- package/src/data/checklist.ts +82 -38
- package/src/data/code-view.ts +296 -44
- package/src/data/comment-thread.ts +611 -86
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +250 -39
- package/src/data/context-menu.ts +95 -21
- package/src/data/d9-limits.ts +2 -0
- package/src/data/d9-util.ts +13 -5
- package/src/data/diff.ts +109 -49
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +38 -18
- package/src/data/embed.ts +143 -8
- package/src/data/engine-ports.ts +135 -0
- package/src/data/field-mapper.ts +116 -54
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +695 -158
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +88 -26
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +640 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +40 -13
- package/src/data/image-viewer.ts +265 -62
- package/src/data/index.ts +75 -6
- package/src/data/item-list.ts +219 -58
- package/src/data/json-view.ts +909 -0
- package/src/data/kanban.ts +346 -91
- package/src/data/kit-contract.ts +230 -0
- package/src/data/leaderboard.ts +343 -0
- package/src/data/level-class.ts +21 -0
- package/src/data/log-stream.ts +347 -0
- package/src/data/markdown-view.ts +597 -0
- package/src/data/matrix.ts +234 -120
- package/src/data/media-grid.ts +165 -38
- package/src/data/mega-menu.ts +43 -26
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +55 -19
- package/src/data/menu.ts +138 -48
- package/src/data/mockup.ts +37 -25
- package/src/data/modal-dialog.ts +126 -98
- package/src/data/navbar.ts +152 -66
- package/src/data/notice-list.ts +101 -49
- package/src/data/notify-renderer.ts +80 -15
- package/src/data/object-form.ts +1504 -164
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +129 -45
- package/src/data/panel-head.ts +238 -76
- package/src/data/permission-matrix.ts +379 -120
- package/src/data/permission-tree.ts +146 -78
- package/src/data/pricing-table.ts +112 -43
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +67 -32
- package/src/data/record-card.ts +245 -72
- package/src/data/record-picker.ts +61 -28
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +141 -38
- package/src/data/resident.ts +11 -13
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +260 -127
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +384 -105
- package/src/data/rule-builder.ts +136 -81
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +90 -36
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +493 -100
- package/src/data/static-lazy.ts +21 -0
- package/src/data/static-registry.ts +46 -4
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +69 -36
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +134 -47
- package/src/data/system-switcher.ts +53 -24
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +731 -0
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +113 -47
- package/src/data/transfer.ts +204 -47
- package/src/data/tree-table.ts +228 -81
- package/src/data/tree.ts +193 -69
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +248 -98
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +28 -6
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +4 -4
- package/src/frames/inherited-shell.ts +219 -0
- package/src/frames/page-bar.ts +208 -28
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +18 -0
- package/src/frames/shared.ts +73 -26
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +27 -17
- package/src/frames/split-frame/wiring.ts +16 -12
- package/src/frames/tabs-frame/shell.ts +14 -7
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +5 -2
- package/src/frames/workspace-frame/extras.ts +23 -7
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/pipeline-key.ts +6 -0
- package/src/frames/workspace-frame/shell.ts +24 -3
- package/src/frames/workspace-frame/state.ts +42 -8
- package/src/frames/workspace-frame/view.ts +773 -194
- package/src/generated/kit-grammar-runtime.ts +1061 -77
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +210 -5
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +204 -22
- package/src/object-renderer/action-more.ts +66 -19
- package/src/object-renderer/arrange.ts +270 -28
- package/src/object-renderer/category-tone.ts +96 -0
- package/src/object-renderer/collapse-wiring.ts +19 -9
- package/src/object-renderer/collection-expand.ts +3 -3
- package/src/object-renderer/collection-parts.ts +459 -103
- package/src/object-renderer/collection-table.ts +406 -59
- package/src/object-renderer/collection.ts +333 -71
- package/src/object-renderer/compile-data.ts +13 -3
- package/src/object-renderer/defaults.ts +14 -5
- package/src/object-renderer/emit-events.ts +46 -20
- package/src/object-renderer/emit-object.ts +35 -6
- package/src/object-renderer/emit-static.ts +831 -153
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +190 -0
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/{compile → object-renderer}/fragment.ts +2 -2
- package/src/object-renderer/index.ts +1 -1
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +55 -7
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +124 -0
- package/src/object-renderer/pick-component.ts +8 -2
- package/src/object-renderer/pipeline-mode.ts +6 -0
- package/src/object-renderer/relation-field.ts +79 -0
- package/src/object-renderer/render-object.ts +72 -27
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +479 -111
- package/src/object-renderer/table-gap.ts +2 -1
- package/src/object-renderer/table-reorder.ts +237 -0
- package/src/object-renderer/table-summary.ts +26 -12
- package/src/object-renderer/table-tools.ts +437 -130
- package/src/object-renderer/types.ts +100 -17
- package/src/object-renderer/value-present.ts +49 -0
- package/src/page-target/ai-surface.ts +15 -22
- package/src/page-target/compile.ts +5 -6
- package/src/page-target/drift.ts +0 -7
- package/src/page-target/intent-schema.ts +46 -43
- package/src/page-target/target.ts +4 -5
- package/src/page-target/writer-policy.ts +4 -5
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +57 -0
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +32 -0
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +93 -26
- package/src/recipes/control.ts +85 -8
- package/src/recipes/desc-list.ts +108 -0
- package/src/recipes/divider.ts +74 -0
- package/src/recipes/emphasis.ts +102 -13
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +6 -5
- package/src/recipes/index.ts +39 -5
- package/src/recipes/inherited-shell.ts +43 -0
- package/src/recipes/json-view.ts +50 -0
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +96 -0
- package/src/recipes/overlay.ts +151 -37
- package/src/recipes/page-width.ts +51 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +38 -20
- package/src/recipes/rail-grid.ts +6 -3
- package/src/recipes/self-owned.ts +59 -0
- package/src/recipes/slot-align.ts +5 -3
- package/src/recipes/stat-state.ts +6 -6
- package/src/recipes/state.ts +64 -11
- package/src/recipes/status.ts +21 -20
- package/src/recipes/strip.ts +114 -0
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +40 -7
- package/src/recipes/table-gap.ts +4 -3
- package/src/recipes/table-native-edit.ts +25 -12
- package/src/recipes/table-row.ts +56 -20
- package/src/recipes/tabs.ts +140 -31
- package/src/recipes/text-diff.ts +97 -0
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +72 -5
- package/src/recipes/typography.ts +2 -2
- package/src/shared/action-func.ts +106 -0
- package/src/shared/color-scheme.ts +127 -0
- package/src/shared/confirm-decl.ts +5 -2
- package/src/shared/danger-facts.ts +55 -0
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +292 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +40 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/order-value.ts +15 -0
- package/src/shared/page-attrs-runtime.ts +327 -0
- package/src/shared/page-attrs.ts +262 -0
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +181 -21
- package/src/shared/theme-usage.ts +16 -0
- package/src/shared/value-table-contract.ts +68 -0
- package/src/spatial/action-func.ts +4 -0
- package/src/spatial/declared-actions.ts +116 -0
- package/src/spatial/emit.ts +660 -0
- package/src/spatial/expand.ts +1482 -0
- package/src/spatial/field-types.ts +48 -0
- package/src/spatial/index.ts +82 -0
- package/src/spatial/layout.ts +697 -0
- package/src/spatial/look-apply.ts +206 -0
- package/src/spatial/page-decl.ts +44 -0
- package/src/spatial/page-object.ts +349 -0
- package/src/spatial/recognize.ts +491 -0
- package/src/spatial/self-report.ts +571 -0
- package/src/spatial/shape.ts +205 -0
- package/src/spatial/spatial-map.ts +136 -0
- package/src/spatial/tone.ts +145 -0
- package/src/theme/index.ts +11 -2
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +563 -28
- package/src/theme/kit-theme.tpl +527 -28
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +538 -176
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +12 -3
- package/src/theme/theme-tokens.ts +1602 -90
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- package/src/frames/list-summary.ts +0 -100
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
- /package/src/{base → shared}/class-candidates.ts +0 -0
package/src/data/kanban.ts
CHANGED
|
@@ -24,46 +24,115 @@
|
|
|
24
24
|
// 与 `change { value }`(value 为移动后的全部行,供 view.value 写回)。
|
|
25
25
|
// 点卡片抛 `select { id, item }`。data 内容变化(内容签名变)才重置本地顺序。
|
|
26
26
|
|
|
27
|
+
import { kitApplyLevelClass } from './level-class';
|
|
28
|
+
import { kitLevelClass } from '../recipes/pipeline-runtime';
|
|
27
29
|
import type { SomaComponentDefinition, SomaDataPort } from 'soma-core';
|
|
28
30
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
31
|
+
import { KIT_TIP_ATTR, KIT_TIPS_SCOPE_ATTR } from '../base/hint-tips';
|
|
32
|
+
import { releaseReasonTipsIn } from '../base/reason-tip';
|
|
29
33
|
import { kitKey, kitText } from '../i18n/kit-text';
|
|
30
34
|
import { createKeyboardWiring } from 'soma-core/keyboard';
|
|
31
35
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
32
36
|
import { setKitFace } from '../recipes';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
37
|
+
import { KIT_DIMMED_CLASS, KIT_FOCUS_RING, kitSelectedRecipe } from '../recipes/state';
|
|
38
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
39
|
+
import { kitDashedEdgeRecipe } from '../recipes/divider';
|
|
40
|
+
import { kitSurfaceRecipe } from '../recipes/surface';
|
|
41
|
+
import { kitTypographyRecipe } from '../recipes/typography';
|
|
42
|
+
import { kitActionRecipe, kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
43
|
+
import { kitClosedValueRecipe, kitDecorFillRecipe, kitDecorToneOf } from '../recipes/field-text';
|
|
44
|
+
import { KIT_COLOR_ROLE_CLASS_CANDIDATES, kitReadHostAutoSequence, kitResolveStatusOrCategoryTone, kitToneDotClass, kitToneSoftBadgeClass } from '../recipes/color-role';
|
|
45
|
+
import { KIT_LOOK_TONE_ATTR } from '../recipes/look';
|
|
46
|
+
import { KIT_SKELETON_BAR_TITLE_MAIN, KIT_SKELETON_BAR_TITLE_SUB } from '../recipes/placeholder';
|
|
47
|
+
import { initialsOf, ROOT_CLASS as AVATAR_ROOT_CLASS } from '../base/avatar';
|
|
48
|
+
import { kitIcon } from '../shared/icons';
|
|
49
|
+
import { mergeClass } from '../shared/merge-class';
|
|
50
|
+
import { orderValueAt } from '../shared/order-value';
|
|
35
51
|
import { provideCtxRows } from './context-menu';
|
|
52
|
+
import { kitMarkDataFacts, kitMarkDragging, kitMarkLevel, kitMarkPart, kitMarkPicked } from './kit-contract';
|
|
53
|
+
import {
|
|
54
|
+
KIT_ATTR_ADD,
|
|
55
|
+
KIT_ATTR_CONTAINER,
|
|
56
|
+
KIT_ATTR_DROP_LINE,
|
|
57
|
+
KIT_ATTR_FOLD,
|
|
58
|
+
KIT_ATTR_KEY,
|
|
59
|
+
KIT_ATTR_LANE,
|
|
60
|
+
KIT_ATTR_LANE_BODY,
|
|
61
|
+
KIT_ATTR_LANE_BOX,
|
|
62
|
+
KIT_ATTR_LANE_DOT,
|
|
63
|
+
KIT_ATTR_META,
|
|
64
|
+
KIT_ATTR_MOVE,
|
|
65
|
+
KIT_ATTR_TEXT,
|
|
66
|
+
KIT_ATTR_TO,
|
|
67
|
+
KIT_ATTR_WIP_NOTICE,
|
|
68
|
+
kitAttrSel,
|
|
69
|
+
} from '../shared/dom-attrs';
|
|
36
70
|
|
|
37
71
|
// ───────── 样式常量:Tailwind 类串与候选类清单 ─────────
|
|
38
72
|
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
73
|
+
// 根用 grid-cols-1(minmax(0, 1fr))使固有最小宽为 0、最大宽随内容:窄舞台(Mode B / 窄列)零向右越界且由 BOARD_CLASS 优雅横向滚动
|
|
74
|
+
const ROOT_CLASS = 'grid w-full min-w-0 max-w-full grid-cols-1 gap-2 overflow-hidden';
|
|
75
|
+
const BOARD_CLASS = 'flex w-full min-w-0 max-w-full items-start gap-3 overflow-x-auto pb-2';
|
|
76
|
+
// 泳道 = 凹槽面的壳配方,卡片 = 壳配方(容器边 + 容器阴影令牌,KT-B2);移动菜单 = 浮起表面(KT-B4);提示条浅底无描边
|
|
77
|
+
// 长列自己滚:列设高度上限(头 / 尾 shrink-0,卡区 flex-1 overflow-y-auto);折叠态收成窄条
|
|
78
|
+
const LANE_SHELL = kitShellRecipe({ tone: 'sunken', shadow: false });
|
|
79
|
+
const LANE_CLASS = mergeClass('flex max-h-128 min-w-72 flex-1 flex-col gap-2 p-2', LANE_SHELL);
|
|
80
|
+
const LANE_FOLDED_CLASS = mergeClass('flex w-12 shrink-0 flex-col items-center gap-2 p-2', LANE_SHELL);
|
|
81
|
+
// 列头:行高 32(min-h-8,与项高同阶)、左右 8 与卡片外缘对齐(泳道 p-2 + 头 px-2 → 文字与卡片内容左缘同线于 16)
|
|
82
|
+
const PILL_ROUND = 'rounded-full';
|
|
83
|
+
const LANE_HEAD_CLASS = 'flex min-h-8 shrink-0 items-center justify-between gap-2 px-2 text-sm';
|
|
84
|
+
const LANE_HEAD_FOLDED_CLASS = 'flex shrink-0 flex-col items-center gap-2 text-sm';
|
|
85
|
+
const LANE_TITLE_CLASS = mergeClass('min-w-0 flex-1 truncate', kitTypographyRecipe('menuItem'));
|
|
86
|
+
const LANE_DOT_BASE = `size-status-dot shrink-0 ${PILL_ROUND}`;
|
|
87
|
+
const COUNT_CLASS = mergeClass(kitClosedValueRecipe('neutral'), 'shrink-0 tabular-nums');
|
|
88
|
+
const COUNT_OVER_CLASS = mergeClass(kitClosedValueRecipe('danger'), 'shrink-0 font-medium tabular-nums');
|
|
89
|
+
const KANBAN_TONE_CANDIDATES: string = (
|
|
90
|
+
['neutral', 'primary', 'info', 'success', 'warning', 'danger', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8'] as const
|
|
91
|
+
).flatMap((t) => [kitToneSoftBadgeClass(t), kitToneDotClass(t)]).join(' ');
|
|
92
|
+
// 列头动作:折叠(始终可见,aria-expanded);行内一律 row 区的轻量按钮
|
|
93
|
+
const LANE_ACTION_CLASS = kitActionRecipe('more', { tight: true, size: 'sm', region: 'row' });
|
|
94
|
+
const LANE_BODY_CLASS = 'flex min-h-16 min-w-0 flex-1 flex-col gap-2 overflow-y-auto rounded-item';
|
|
95
|
+
// 列尾添加位:整宽的轻量按钮
|
|
96
|
+
const LANE_ADD_CLASS = mergeClass(kitActionRecipe('create', { tight: true, size: 'sm', region: 'row' }), 'w-full shrink-0 justify-start gap-1');
|
|
97
|
+
// 落点线:卡间 2px 主色圆端线;原位卡半透明
|
|
98
|
+
const DROP_LINE_CLASS = `h-0.5 shrink-0 ${PILL_ROUND} bg-primary`;
|
|
99
|
+
const CARD_GHOST_CLASS = KIT_DIMMED_CLASS;
|
|
100
|
+
const SKELETON_CARD_CLASS = mergeClass('flex flex-col gap-2 p-3', kitShellRecipe({ tone: 'base', shadow: false }));
|
|
101
|
+
const AVATAR_FACE_CLASS = mergeClass(`inline-flex size-full items-center justify-center overflow-hidden ${PILL_ROUND} text-xs font-medium`, kitDecorFillRecipe());
|
|
102
|
+
const AVATAR_CLASS = `${AVATAR_ROOT_CLASS.sm} ms-auto`;
|
|
103
|
+
const META_CLASS = mergeClass(mergeClass('flex flex-wrap items-center gap-x-2 gap-y-1', kitTypographyRecipe('captionPlain')), 'text-fg-muted');
|
|
104
|
+
// 拖放占位:落点列体浅主色底 + 内收虚线框(占位语义,不叠焦点环)
|
|
105
|
+
const DROP_CLASS = 'bg-state-layer-hover outline-2 outline-dashed -outline-offset-2 outline-primary';
|
|
106
|
+
const CARD_EDGE = kitShellRecipe({ tone: 'base' });
|
|
107
|
+
const CARD_CLASS = mergeClass(mergeClass(mergeClass('flex flex-col gap-1', CARD_EDGE), mergeClass('p-3 transition-colors state-layer', kitTypographyRecipe('text'))), KIT_FOCUS_RING.item);
|
|
49
108
|
const CARD_DRAG_CLASS = 'cursor-grab active:cursor-grabbing';
|
|
50
|
-
|
|
51
|
-
const
|
|
109
|
+
// 标题两行截断防超高;禁用卡取禁用字色
|
|
110
|
+
const CARD_TITLE_CLASS = mergeClass('line-clamp-2 break-words', kitTypographyRecipe('menuItem'));
|
|
111
|
+
const CARD_TITLE_OFF_CLASS = mergeClass(mergeClass('line-clamp-2 break-words', kitTypographyRecipe('menuItem')), 'text-fg-disabled');
|
|
112
|
+
const CARD_OFF_CLASS = 'cursor-not-allowed text-fg-disabled';
|
|
113
|
+
const FACT_CLASS = 'inline-flex min-w-0 items-baseline gap-1';
|
|
52
114
|
const FACT_VALUE_CLASS = 'truncate text-fg';
|
|
53
|
-
const EMPTY_CLASS = 'px-2 py-3 text-center
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
115
|
+
const EMPTY_CLASS = mergeClass('px-2 py-3 text-center', kitTypographyRecipe('textMuted'));
|
|
116
|
+
// 空列:虚线占位块(拖到这里 / 添加)
|
|
117
|
+
const EMPTY_LANE_CLASS = mergeClass(mergeClass('rounded-item px-2 py-3 text-center', kitDashedEdgeRecipe()), kitTypographyRecipe('textMuted'));
|
|
118
|
+
const CARD_FOOT_CLASS = 'mt-1 flex min-w-0 items-center justify-between gap-2';
|
|
119
|
+
const MOVE_BTN_CLASS = mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'sm', tight: true }), 'shrink-0 whitespace-nowrap gap-1');
|
|
120
|
+
const MENU_CLASS = mergeClass('flex flex-col gap-1 p-1', kitSurfaceRecipe('raised'));
|
|
121
|
+
const MENU_ITEM_CLASS = mergeClass(mergeClass(mergeClass('flex h-7 items-center rounded-item px-2 text-start hover:bg-state-layer-hover active:bg-state-layer-press disabled:cursor-not-allowed disabled:text-fg-subtle', kitTypographyRecipe('captionPlain')), 'text-fg'), KIT_FOCUS_RING.button);
|
|
122
|
+
const NOTICE_CLASS = mergeClass(mergeClass('rounded-item bg-warning-soft px-3 py-1.5', kitTypographyRecipe('captionPlain')), 'text-warning-on-soft');
|
|
58
123
|
const HIDDEN_CLASS = 'hidden';
|
|
59
124
|
const LIVE_CLASS = 'sr-only';
|
|
60
125
|
|
|
61
126
|
/** 本组件自带的全部类(供编译器并入候选类) */
|
|
62
127
|
export const KIT_KANBAN_CLASS_CANDIDATES: readonly string[] = Object.freeze(
|
|
63
128
|
[...new Set([
|
|
64
|
-
ROOT_CLASS, BOARD_CLASS, LANE_CLASS, LANE_HEAD_CLASS, LANE_TITLE_CLASS, COUNT_CLASS, COUNT_OVER_CLASS, LANE_BODY_CLASS,
|
|
129
|
+
ROOT_CLASS, BOARD_CLASS, LANE_CLASS, LANE_HEAD_CLASS, LANE_TITLE_CLASS, LANE_DOT_BASE, COUNT_CLASS, COUNT_OVER_CLASS, KANBAN_TONE_CANDIDATES, LANE_BODY_CLASS,
|
|
65
130
|
DROP_CLASS, CARD_CLASS, CARD_DRAG_CLASS, CARD_TITLE_CLASS, FACT_CLASS, FACT_VALUE_CLASS, EMPTY_CLASS,
|
|
66
|
-
|
|
131
|
+
LANE_FOLDED_CLASS, LANE_HEAD_FOLDED_CLASS, LANE_ACTION_CLASS, LANE_ADD_CLASS, DROP_LINE_CLASS, CARD_GHOST_CLASS, SKELETON_CARD_CLASS,
|
|
132
|
+
AVATAR_FACE_CLASS, AVATAR_CLASS, META_CLASS, CARD_TITLE_OFF_CLASS, CARD_OFF_CLASS, EMPTY_LANE_CLASS, KIT_SKELETON_BAR_TITLE_MAIN, KIT_SKELETON_BAR_TITLE_SUB,
|
|
133
|
+
kitSelectedRecipe(),
|
|
134
|
+
CARD_FOOT_CLASS, MOVE_BTN_CLASS, MENU_CLASS, MENU_ITEM_CLASS, NOTICE_CLASS, HIDDEN_CLASS, LIVE_CLASS,
|
|
135
|
+
...KIT_COLOR_ROLE_CLASS_CANDIDATES,
|
|
67
136
|
].flatMap((s) => s.split(/\s+/)).filter((c) => c !== ''))].sort(),
|
|
68
137
|
);
|
|
69
138
|
|
|
@@ -72,6 +141,7 @@ export const KIT_KANBAN_CLASS_CANDIDATES: readonly string[] = Object.freeze(
|
|
|
72
141
|
export interface KitKanbanLane {
|
|
73
142
|
value: string;
|
|
74
143
|
label: string;
|
|
144
|
+
tone?: string;
|
|
75
145
|
}
|
|
76
146
|
|
|
77
147
|
export interface KitKanbanField {
|
|
@@ -84,6 +154,8 @@ export interface KitKanbanConfig {
|
|
|
84
154
|
lanes: KitKanbanLane[];
|
|
85
155
|
title: string;
|
|
86
156
|
fields: KitKanbanField[];
|
|
157
|
+
/** 卡行尾头像取的字段(负责人名);空 = 不画头像 */
|
|
158
|
+
avatar: string;
|
|
87
159
|
wip: Record<string, number>;
|
|
88
160
|
}
|
|
89
161
|
|
|
@@ -102,7 +174,8 @@ export function kanbanConfigOf(groupRaw: unknown, lanesRaw: unknown, cardRaw: un
|
|
|
102
174
|
const value = str(r.value).trim();
|
|
103
175
|
if (value === '' || seen.has(value)) continue;
|
|
104
176
|
seen.add(value);
|
|
105
|
-
|
|
177
|
+
const tone = str(r.tone).trim();
|
|
178
|
+
lanes.push({ value, label: str(r.label).trim() || value, ...(tone !== '' ? { tone } : {}) });
|
|
106
179
|
}
|
|
107
180
|
const card = recOf(cardRaw);
|
|
108
181
|
const fields: KitKanbanField[] = [];
|
|
@@ -115,7 +188,7 @@ export function kanbanConfigOf(groupRaw: unknown, lanesRaw: unknown, cardRaw: un
|
|
|
115
188
|
for (const [k, v] of Object.entries(recOf(wipRaw))) {
|
|
116
189
|
if (typeof v === 'number' && Number.isInteger(v) && v > 0) wip[k] = v;
|
|
117
190
|
}
|
|
118
|
-
return { group: str(groupRaw).trim(), lanes, title: str(card.title).trim(), fields, wip };
|
|
191
|
+
return { group: str(groupRaw).trim(), lanes, title: str(card.title).trim(), fields, avatar: str(card.avatar).trim(), wip };
|
|
119
192
|
}
|
|
120
193
|
|
|
121
194
|
/** 把卡 id 从 rows 取出,放进 to 泳道的第 index 位(0 起,超出放末尾),并改写 group 字段。纯函数,返回新数组;找不到卡返回 null */
|
|
@@ -139,18 +212,12 @@ export function moveKanbanCard(rows: readonly Row[], idField: string, group: str
|
|
|
139
212
|
* 空泳道 -> 0;落在首位 -> 首卡序值 - 1;落在末位 -> 末卡序值 + 1;落在两卡中间 -> 两卡序值的中点。
|
|
140
213
|
* 序值不是有限数时按下标计,保证总有一个数。
|
|
141
214
|
*/
|
|
142
|
-
export
|
|
143
|
-
if (peers.length === 0) return 0;
|
|
144
|
-
const at = (i: number): number => (Number.isFinite(peers[i]) ? peers[i]! : i);
|
|
145
|
-
if (pos <= 0) return at(0) - 1;
|
|
146
|
-
if (pos >= peers.length) return at(peers.length - 1) + 1;
|
|
147
|
-
return (at(pos - 1) + at(pos)) / 2;
|
|
148
|
-
}
|
|
215
|
+
export const kanbanOrderValue = orderValueAt;
|
|
149
216
|
|
|
150
217
|
// ───────── 组件 ─────────
|
|
151
218
|
|
|
152
219
|
interface DragPortLike {
|
|
153
|
-
draggable(el: HTMLElement, source: { id: string; data: () => Record<string, unknown>; canDrag?: () => boolean }): () => void;
|
|
220
|
+
draggable(el: HTMLElement, source: { id: string; data: () => Record<string, unknown>; canDrag?: () => boolean; onDragStart?(): void; onDragEnd?(): void }): () => void;
|
|
154
221
|
dropTarget(el: HTMLElement, target: {
|
|
155
222
|
id: string; edges?: readonly ('top' | 'bottom' | 'left' | 'right')[]; onOver?(edge: unknown): void; onLeave?(): void;
|
|
156
223
|
}): () => void;
|
|
@@ -169,7 +236,10 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
169
236
|
value: { type: 'array', default: null, desc: '行数组(view.value 绑定);给了就覆盖 data' },
|
|
170
237
|
group: { type: 'string', default: '', desc: '决定泳道的字段名' },
|
|
171
238
|
lanes: { type: 'array', default: [], desc: '泳道 [{ value, label }],顺序即显示顺序' },
|
|
172
|
-
card: { type: 'object', default: {}, desc: '卡片 { title: 字段, fields?: [字段 | { field, label }] }' },
|
|
239
|
+
card: { type: 'object', default: {}, desc: '卡片 { title: 字段, fields?: [字段 | { field, label }], avatar?: 行尾头像取的字段(负责人名) };行里 disabled 为 true 的卡取禁用字色且不可拖' },
|
|
240
|
+
loading: { type: 'boolean', default: false, desc: '读取中:没有卡时每列画 3 张卡高的骨架(aria-busy),已有卡则保留' },
|
|
241
|
+
add_label: { type: 'string', default: '', desc: '非空时每列列尾出现添加位(按钮文案),点击抛 add { lane }' },
|
|
242
|
+
fold: { type: 'boolean', default: true, desc: '列头带折叠钮(折叠成窄条,aria-expanded)' },
|
|
173
243
|
wip: { type: 'object', default: {}, desc: '在制品上限 { 泳道 value: 正整数 }:缺省泳道满了不接收新卡,超限计数标红' },
|
|
174
244
|
wip_mode: { type: 'enum', values: ['hard', 'soft'], default: 'hard', desc: 'hard 硬上限(满了拒收,抛 wip_blocked);soft 软上限(只提示并抛 wip_exceeded,照常移入)' },
|
|
175
245
|
id_field: { type: 'string', default: 'id', desc: '卡主键字段名' },
|
|
@@ -190,6 +260,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
190
260
|
},
|
|
191
261
|
change: { payload: { value: { type: 'array' } }, desc: '移动后抛出,value 为移动后的全部行(view.value 写回)' },
|
|
192
262
|
select: { payload: { id: { type: 'string' }, item: { type: 'object' } }, desc: '点卡片或 Enter / Space' },
|
|
263
|
+
add: { payload: { lane: { type: 'string' } }, desc: '点列尾添加位(add_label 非空时),lane 为泳道 value' },
|
|
193
264
|
wip_blocked: { payload: { id: { type: 'string' }, to: { type: 'string' }, limit: { type: 'number' } }, desc: '目标泳道已满,移入被拒(硬上限)' },
|
|
194
265
|
wip_exceeded: { payload: { id: { type: 'string' }, to: { type: 'string' }, limit: { type: 'number' } }, desc: '目标泳道已满仍照常移入(wip_mode: soft)' },
|
|
195
266
|
},
|
|
@@ -208,6 +279,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
208
279
|
let sig = '';
|
|
209
280
|
let tabKey: string | null = null;
|
|
210
281
|
let menuFor: string | null = null;
|
|
282
|
+
let selectedId: string | null = null;
|
|
283
|
+
const folded = new Set<string>();
|
|
211
284
|
let pendingFocus: string | null = null;
|
|
212
285
|
let cleanups: Array<() => void> = [];
|
|
213
286
|
let offMove: (() => void) | null = null;
|
|
@@ -225,8 +298,6 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
225
298
|
const port = (api.services as { data?: SomaDataPort } | undefined)?.data;
|
|
226
299
|
return port && typeof port === 'object' ? port : undefined;
|
|
227
300
|
};
|
|
228
|
-
const notifyPort = (): { toast?: (o: { level: string; message: string }) => void } | undefined =>
|
|
229
|
-
(api.services as { notify?: { toast?: (o: { level: string; message: string }) => void } } | undefined)?.notify;
|
|
230
301
|
|
|
231
302
|
const config = (): KitKanbanConfig => {
|
|
232
303
|
const p = P();
|
|
@@ -241,6 +312,26 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
241
312
|
return engines?.dnd ?? null;
|
|
242
313
|
};
|
|
243
314
|
|
|
315
|
+
const laneRowsMap = (cfg: KitKanbanConfig): Map<string, Row[]> => {
|
|
316
|
+
const buckets = new Map<string, Row[]>();
|
|
317
|
+
for (const l of cfg.lanes) buckets.set(l.value, []);
|
|
318
|
+
for (const r of rows) {
|
|
319
|
+
if (idOf(r) === '') continue;
|
|
320
|
+
const g = str(r[cfg.group]);
|
|
321
|
+
const list = buckets.get(g);
|
|
322
|
+
if (list !== undefined) list.push(r);
|
|
323
|
+
}
|
|
324
|
+
const f = str(P().order);
|
|
325
|
+
if (f !== '') {
|
|
326
|
+
const key = (r: Row): number => { const n = Number(r[f]); return Number.isFinite(n) ? n : Number.MAX_SAFE_INTEGER; };
|
|
327
|
+
for (const [k, list] of buckets) {
|
|
328
|
+
if (list.length > 1) {
|
|
329
|
+
buckets.set(k, list.map((r, i) => ({ r, i })).sort((a, b) => key(a.r) - key(b.r) || a.i - b.i).map((x) => x.r));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return buckets;
|
|
334
|
+
};
|
|
244
335
|
const laneRows = (cfg: KitKanbanConfig, lane: string): Row[] => {
|
|
245
336
|
const list = rows.filter((r) => idOf(r) !== '' && str(r[cfg.group]) === lane);
|
|
246
337
|
const f = str(P().order);
|
|
@@ -277,7 +368,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
277
368
|
}
|
|
278
369
|
showNotice(text);
|
|
279
370
|
announce(text);
|
|
280
|
-
|
|
371
|
+
// 错误不用轻提示(KT-K-feedback-3,§6.1 G-17):保存失败已由看板自己的 notice + announce 就地呈现,不再重复发轻提示
|
|
281
372
|
paint();
|
|
282
373
|
// 连着移了好几次、中间结果不可知:以服务端为准重取
|
|
283
374
|
if (several) {
|
|
@@ -394,36 +485,75 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
394
485
|
return node;
|
|
395
486
|
};
|
|
396
487
|
|
|
397
|
-
|
|
488
|
+
/** 行带禁用标记:取禁用字色、不注册拖拽、不出移动钮 */
|
|
489
|
+
const rowOff = (r: Row): boolean => r.disabled === true;
|
|
398
490
|
|
|
399
|
-
const
|
|
491
|
+
const cardKeys = (cfg: KitKanbanConfig, byLane?: ReadonlyMap<string, Row[]>): string[][] => {
|
|
492
|
+
const map = byLane ?? laneRowsMap(cfg);
|
|
493
|
+
return cfg.lanes.map((l) => (map.get(l.value) ?? []).map(idOf));
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
const buildCard = (cfg: KitKanbanConfig, row: Row, lane: string, hasDnd: boolean, byLane: ReadonlyMap<string, Row[]>): HTMLElement => {
|
|
400
497
|
const id = idOf(row);
|
|
401
|
-
const
|
|
498
|
+
const off = rowOff(row);
|
|
499
|
+
// 卡自报对象面(下方 kitMarkLevel):基础外观经层级角色出口(新模式剥掉取值表负责的类);禁用 / 选中状态配方照旧追加
|
|
500
|
+
const cardBase = kitLevelClass('face', CARD_CLASS);
|
|
501
|
+
const base = off ? mergeClass(cardBase, CARD_OFF_CLASS) : selectedId === id ? mergeClass(cardBase, kitSelectedRecipe()) : cardBase;
|
|
502
|
+
const card = el('div', hasDnd && !locked() && !off ? `${base} ${CARD_DRAG_CLASS}` : base);
|
|
402
503
|
card.id = `${uid}-card-${encodeURIComponent(id).replace(/%/g, '_')}`;
|
|
403
504
|
card.setAttribute('role', 'group');
|
|
404
|
-
card.setAttribute(
|
|
405
|
-
card.setAttribute(
|
|
505
|
+
card.setAttribute(KIT_ATTR_KEY, id);
|
|
506
|
+
card.setAttribute(KIT_ATTR_LANE, lane);
|
|
507
|
+
if (off) card.setAttribute('aria-disabled', 'true');
|
|
508
|
+
if (selectedId === id) card.setAttribute('aria-current', 'true');
|
|
509
|
+
// 看板的每张卡 = 对象面;当前卡自报交互状态(aria-current 上一行已写)
|
|
510
|
+
kitMarkLevel(card, 'face');
|
|
511
|
+
kitMarkPicked(card, 'current', selectedId === id, null);
|
|
406
512
|
card.tabIndex = tabKey === id ? 0 : -1;
|
|
407
513
|
const title = cfg.title !== '' ? str(row[cfg.title]) || id : id;
|
|
408
514
|
card.setAttribute('aria-label', title);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
515
|
+
const titleEl = el('div', off ? CARD_TITLE_OFF_CLASS : CARD_TITLE_CLASS, title);
|
|
516
|
+
titleEl.setAttribute(KIT_ATTR_TEXT, 'clamp-2');
|
|
517
|
+
kitMarkPart(titleEl, 'block-title');
|
|
518
|
+
card.appendChild(titleEl);
|
|
519
|
+
// 第 2 行:元信息(字段 label + 值,可折行)、头像在行尾
|
|
520
|
+
const owner = cfg.avatar !== '' ? str(row[cfg.avatar]).trim() : '';
|
|
521
|
+
const metas = cfg.fields.filter((f) => { const v = row[f.field]; return v !== undefined && v !== null && v !== ''; });
|
|
522
|
+
if (metas.length > 0 || owner !== '') {
|
|
523
|
+
const meta = el('div', META_CLASS);
|
|
524
|
+
meta.setAttribute(KIT_ATTR_META, '');
|
|
525
|
+
for (const f of metas) {
|
|
526
|
+
const line = el('span', FACT_CLASS);
|
|
527
|
+
line.appendChild(el('span', '', f.label));
|
|
528
|
+
line.appendChild(el('span', off ? '' : FACT_VALUE_CLASS, str(row[f.field])));
|
|
529
|
+
meta.appendChild(line);
|
|
530
|
+
}
|
|
531
|
+
if (owner !== '') {
|
|
532
|
+
const av = el('span', AVATAR_CLASS);
|
|
533
|
+
av.setAttribute('role', 'img');
|
|
534
|
+
av.setAttribute('aria-label', owner);
|
|
535
|
+
const face = el('span', AVATAR_FACE_CLASS, initialsOf(owner));
|
|
536
|
+
face.setAttribute(KIT_LOOK_TONE_ATTR, kitDecorToneOf(owner));
|
|
537
|
+
av.appendChild(face);
|
|
538
|
+
meta.appendChild(av);
|
|
539
|
+
}
|
|
540
|
+
card.appendChild(meta);
|
|
417
541
|
}
|
|
418
|
-
// 移动菜单始终提供(WCAG 2.5.7
|
|
419
|
-
if (!locked()) {
|
|
420
|
-
const
|
|
542
|
+
// 移动菜单始终提供(WCAG 2.5.7:拖放之外必须有单指针替代;有拖放端口时也不隐藏);独立底部操作行 + 紧凑不折行钮 + 下拉箭头,避免视觉呈现为截断「移到...」
|
|
543
|
+
if (!locked() && !off) {
|
|
544
|
+
const customMove = str(P().move_label);
|
|
545
|
+
const moveLabel = customMove !== '' ? customMove : kitText('soma.kit.move_to', undefined, api.host).replace(/[….]+$/u, '');
|
|
546
|
+
const btn = el('button', MOVE_BTN_CLASS);
|
|
547
|
+
btn.append(el('span', '', moveLabel), kitIcon('chevron-down', 'xs'));
|
|
421
548
|
btn.type = 'button';
|
|
422
549
|
setKitFace(btn, 'raised');
|
|
423
|
-
btn.setAttribute(
|
|
550
|
+
btn.setAttribute(KIT_ATTR_MOVE, id);
|
|
551
|
+
kitMarkPart(btn, 'action');
|
|
424
552
|
btn.setAttribute('aria-haspopup', 'menu');
|
|
425
553
|
btn.setAttribute('aria-expanded', menuFor === id ? 'true' : 'false');
|
|
426
|
-
|
|
554
|
+
const foot = el('div', CARD_FOOT_CLASS);
|
|
555
|
+
foot.appendChild(btn);
|
|
556
|
+
card.appendChild(foot);
|
|
427
557
|
if (menuFor === id) {
|
|
428
558
|
const menu = el('div', MENU_CLASS);
|
|
429
559
|
menu.setAttribute('role', 'menu');
|
|
@@ -431,8 +561,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
431
561
|
const item = el('button', MENU_ITEM_CLASS, l.label);
|
|
432
562
|
item.type = 'button';
|
|
433
563
|
item.setAttribute('role', 'menuitem');
|
|
434
|
-
item.setAttribute(
|
|
435
|
-
const full = !softWip() && l.value !== lane && cfg.wip[l.value] !== undefined &&
|
|
564
|
+
item.setAttribute(KIT_ATTR_TO, l.value);
|
|
565
|
+
const full = !softWip() && l.value !== lane && cfg.wip[l.value] !== undefined && (byLane.get(l.value)?.length ?? 0) >= cfg.wip[l.value]!;
|
|
436
566
|
if (l.value === lane || full) item.disabled = true;
|
|
437
567
|
menu.appendChild(item);
|
|
438
568
|
}
|
|
@@ -448,60 +578,166 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
448
578
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
449
579
|
for (const fn of cleanups) fn();
|
|
450
580
|
cleanups = [];
|
|
581
|
+
const prevBoardLeft = board.scrollLeft;
|
|
582
|
+
const prevLaneTop = new Map<string, number>();
|
|
583
|
+
for (const bodyEl of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_LANE_BODY))) {
|
|
584
|
+
const lk = bodyEl.getAttribute(KIT_ATTR_LANE_BODY);
|
|
585
|
+
if (lk !== null) prevLaneTop.set(lk, bodyEl.scrollTop);
|
|
586
|
+
}
|
|
451
587
|
// 重绘会重建全部节点:焦点原本在卡片内(含其按钮)时记下卡主键,重绘后还回去(props 更新 / 点移动钮不丢焦点)
|
|
452
588
|
if (pendingFocus === null) {
|
|
453
589
|
const active = document.activeElement;
|
|
454
590
|
if (active instanceof HTMLElement && board.contains(active)) {
|
|
455
|
-
pendingFocus = active.closest<HTMLElement>(
|
|
591
|
+
pendingFocus = active.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))?.getAttribute(KIT_ATTR_KEY) ?? null;
|
|
456
592
|
}
|
|
457
593
|
}
|
|
458
594
|
const cfg = config();
|
|
459
595
|
const port = dndPort();
|
|
460
596
|
const hasDnd = port !== null;
|
|
461
597
|
const emptyText = str(p.empty_text, kitText('soma.kit.empty_card', undefined, api.host));
|
|
462
|
-
const
|
|
463
|
-
const
|
|
598
|
+
const byLane = laneRowsMap(cfg);
|
|
599
|
+
const byId = new Map<string, Row>();
|
|
600
|
+
for (const r of rows) {
|
|
601
|
+
const k = idOf(r);
|
|
602
|
+
if (k !== '' && !byId.has(k)) byId.set(k, r);
|
|
603
|
+
}
|
|
604
|
+
const keys = cardKeys(cfg, byLane);
|
|
605
|
+
const all = keys.filter((_, i) => !folded.has(cfg.lanes[i]!.value)).flat();
|
|
464
606
|
if (tabKey === null || !all.includes(tabKey)) tabKey = all[0] ?? null;
|
|
607
|
+
const loading = bool(p.loading);
|
|
608
|
+
if (loading) board.setAttribute('aria-busy', 'true'); else board.removeAttribute('aria-busy');
|
|
609
|
+
kitMarkDataFacts(root, { loading, empty: rows.length === 0, readonly: locked() });
|
|
610
|
+
const clearDropLine = (): void => { for (const n of board?.querySelectorAll(kitAttrSel(KIT_ATTR_DROP_LINE)) ?? []) n.remove(); };
|
|
465
611
|
|
|
612
|
+
releaseReasonTipsIn(board);
|
|
466
613
|
board.textContent = '';
|
|
467
|
-
|
|
468
|
-
|
|
614
|
+
const autoSeq = kitReadHostAutoSequence(root);
|
|
615
|
+
for (const [laneIdx, lane] of cfg.lanes.entries()) {
|
|
616
|
+
const list = byLane.get(lane.value) ?? [];
|
|
469
617
|
const limit = cfg.wip[lane.value];
|
|
470
618
|
const over = limit !== undefined && list.length > limit;
|
|
471
|
-
const
|
|
619
|
+
const isFolded = p.fold !== false && folded.has(lane.value);
|
|
620
|
+
const laneTone = kitResolveStatusOrCategoryTone(
|
|
621
|
+
lane.label || lane.value,
|
|
622
|
+
laneIdx,
|
|
623
|
+
{
|
|
624
|
+
...(lane.tone !== undefined ? { explicitTone: lane.tone } : {}),
|
|
625
|
+
...(autoSeq !== undefined ? { autoSequence: autoSeq } : { host: root }),
|
|
626
|
+
},
|
|
627
|
+
);
|
|
628
|
+
const col = el('section', isFolded ? LANE_FOLDED_CLASS : LANE_CLASS);
|
|
629
|
+
col.setAttribute(KIT_ATTR_CONTAINER, 'card');
|
|
472
630
|
col.setAttribute('aria-label', lane.label);
|
|
473
|
-
col.setAttribute(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
631
|
+
col.setAttribute(KIT_ATTR_LANE_BOX, lane.value);
|
|
632
|
+
// 泳道 = 看板这张面里左右分开的窗格(窗格 › 面头;窗格 › 对象面按合法表的邻接例外放行)
|
|
633
|
+
kitMarkLevel(col, 'pane'); kitApplyLevelClass(col);
|
|
634
|
+
if (isFolded) col.setAttribute(KIT_TIP_ATTR, lane.label);
|
|
635
|
+
const head = el('div', isFolded ? LANE_HEAD_FOLDED_CLASS : LANE_HEAD_CLASS);
|
|
636
|
+
kitMarkLevel(head, 'head'); kitApplyLevelClass(head);
|
|
637
|
+
const countCls = over ? COUNT_OVER_CLASS : mergeClass(COUNT_CLASS, kitToneSoftBadgeClass(laneTone));
|
|
638
|
+
const countEl = el('span', countCls, limit !== undefined ? `${list.length}/${limit}` : String(list.length));
|
|
639
|
+
if (isFolded) countEl.setAttribute(KIT_TIP_ATTR, lane.label);
|
|
640
|
+
const laneDot = (): HTMLElement => {
|
|
641
|
+
const dot = el('span', mergeClass(LANE_DOT_BASE, kitToneDotClass(laneTone)));
|
|
642
|
+
dot.setAttribute('aria-hidden', 'true');
|
|
643
|
+
dot.setAttribute(KIT_ATTR_LANE_DOT, '');
|
|
644
|
+
return dot;
|
|
645
|
+
};
|
|
646
|
+
const laneTitle = (): HTMLElement => {
|
|
647
|
+
const node = el('span', LANE_TITLE_CLASS, lane.label);
|
|
648
|
+
kitMarkPart(node, 'block-title');
|
|
649
|
+
node.setAttribute(KIT_TIPS_SCOPE_ATTR, '');
|
|
650
|
+
return node;
|
|
651
|
+
};
|
|
652
|
+
if (p.fold !== false) {
|
|
653
|
+
const fold = el('button', LANE_ACTION_CLASS);
|
|
654
|
+
fold.type = 'button';
|
|
655
|
+
setKitFace(fold, 'raised');
|
|
656
|
+
fold.setAttribute(KIT_ATTR_FOLD, lane.value);
|
|
657
|
+
fold.setAttribute('aria-expanded', isFolded ? 'false' : 'true');
|
|
658
|
+
fold.setAttribute('aria-label', `${kitText(isFolded ? 'soma.kit.expand' : 'soma.kit.collapse', undefined, api.host)}:${lane.label}`);
|
|
659
|
+
fold.appendChild(kitIcon(isFolded ? 'chevron-right' : 'chevron-down', 'sm', 'rtl:-scale-x-100'));
|
|
660
|
+
if (isFolded) { head.appendChild(fold); head.appendChild(laneDot()); head.appendChild(countEl); } else { head.appendChild(laneDot()); head.appendChild(laneTitle()); head.appendChild(countEl); head.appendChild(fold); }
|
|
661
|
+
} else {
|
|
662
|
+
head.appendChild(laneDot());
|
|
663
|
+
head.appendChild(laneTitle());
|
|
664
|
+
head.appendChild(countEl);
|
|
665
|
+
}
|
|
477
666
|
col.appendChild(head);
|
|
667
|
+
board.appendChild(col);
|
|
668
|
+
if (isFolded) continue;
|
|
478
669
|
const body = el('div', LANE_BODY_CLASS);
|
|
479
|
-
body.setAttribute(
|
|
480
|
-
if (list.length === 0) {
|
|
481
|
-
|
|
670
|
+
body.setAttribute(KIT_ATTR_LANE_BODY, lane.value);
|
|
671
|
+
if (list.length === 0 && loading) {
|
|
672
|
+
// 加载骨架:3 张卡高的条
|
|
673
|
+
body.setAttribute('aria-hidden', 'true');
|
|
674
|
+
for (let i = 0; i < 3; i++) {
|
|
675
|
+
const sk = el('div', SKELETON_CARD_CLASS);
|
|
676
|
+
sk.appendChild(el('span', KIT_SKELETON_BAR_TITLE_MAIN));
|
|
677
|
+
sk.appendChild(el('span', KIT_SKELETON_BAR_TITLE_SUB));
|
|
678
|
+
body.appendChild(sk);
|
|
679
|
+
}
|
|
680
|
+
} else if (list.length === 0) {
|
|
681
|
+
const empty = el('div', EMPTY_LANE_CLASS, emptyText);
|
|
482
682
|
empty.setAttribute('role', 'status');
|
|
683
|
+
// 空泳道的空状态块 = 子块
|
|
684
|
+
kitMarkLevel(empty, 'sub'); kitApplyLevelClass(empty);
|
|
483
685
|
body.appendChild(empty);
|
|
484
686
|
}
|
|
485
|
-
for (const row of list) body.appendChild(buildCard(cfg, row, lane.value, hasDnd));
|
|
687
|
+
for (const row of list) body.appendChild(buildCard(cfg, row, lane.value, hasDnd, byLane));
|
|
486
688
|
col.appendChild(body);
|
|
487
|
-
|
|
689
|
+
if (str(p.add_label) !== '' && !locked()) {
|
|
690
|
+
const add = el('button', LANE_ADD_CLASS);
|
|
691
|
+
add.type = 'button';
|
|
692
|
+
setKitFace(add, 'raised');
|
|
693
|
+
add.setAttribute(KIT_ATTR_ADD, lane.value);
|
|
694
|
+
kitMarkPart(add, 'action');
|
|
695
|
+
add.appendChild(kitIcon('plus', 'sm'));
|
|
696
|
+
add.appendChild(el('span', '', str(p.add_label)));
|
|
697
|
+
col.appendChild(add);
|
|
698
|
+
}
|
|
488
699
|
|
|
489
700
|
if (port && !locked()) {
|
|
490
701
|
const over2 = (on: boolean) => (): void => { for (const c of DROP_CLASS.split(' ')) body.classList.toggle(c, on); };
|
|
491
702
|
cleanups.push(port.dropTarget(body, { id: `${uid}:lane:${lane.value}`, onOver: over2(true), onLeave: over2(false) }));
|
|
492
|
-
for (const node of body.querySelectorAll<HTMLElement>(
|
|
493
|
-
const key = node.getAttribute(
|
|
494
|
-
|
|
495
|
-
|
|
703
|
+
for (const node of body.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))) {
|
|
704
|
+
const key = node.getAttribute(KIT_ATTR_KEY)!;
|
|
705
|
+
const dragRow = byId.get(key);
|
|
706
|
+
const noDrag = dragRow !== undefined && rowOff(dragRow);
|
|
707
|
+
if (!noDrag) {
|
|
708
|
+
cleanups.push(port.draggable(node, {
|
|
709
|
+
id: `${uid}:card:${key}`, data: () => ({ id: key, lane: lane.value }),
|
|
710
|
+
// 拖拽中自报交互状态:与幽灵态类同起同落
|
|
711
|
+
onDragStart: () => { for (const c of CARD_GHOST_CLASS.split(' ')) node.classList.add(c); kitMarkDragging(node, true); },
|
|
712
|
+
onDragEnd: () => { for (const c of CARD_GHOST_CLASS.split(' ')) node.classList.remove(c); kitMarkDragging(node, false); clearDropLine(); },
|
|
713
|
+
}));
|
|
714
|
+
}
|
|
715
|
+
cleanups.push(port.dropTarget(node, {
|
|
716
|
+
id: `${uid}:card:${key}`, edges: ['top', 'bottom'],
|
|
717
|
+
onOver: (edge) => {
|
|
718
|
+
clearDropLine();
|
|
719
|
+
const line = el('div', DROP_LINE_CLASS);
|
|
720
|
+
line.setAttribute(KIT_ATTR_DROP_LINE, '');
|
|
721
|
+
line.setAttribute('aria-hidden', 'true');
|
|
722
|
+
node.parentElement?.insertBefore(line, edge === 'bottom' ? node.nextSibling : node);
|
|
723
|
+
},
|
|
724
|
+
onLeave: clearDropLine,
|
|
725
|
+
}));
|
|
496
726
|
}
|
|
497
727
|
}
|
|
498
728
|
}
|
|
499
|
-
if (cfg.lanes.length === 0)
|
|
729
|
+
if (cfg.lanes.length === 0) { const empty = el('div', EMPTY_CLASS, emptyText); kitMarkLevel(empty, 'sub'); kitApplyLevelClass(empty); board.appendChild(empty); }
|
|
500
730
|
|
|
501
731
|
if (pendingFocus !== null) {
|
|
502
|
-
const target = [...board.querySelectorAll<HTMLElement>(
|
|
732
|
+
const target = [...board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === pendingFocus);
|
|
503
733
|
pendingFocus = null;
|
|
504
|
-
target?.focus();
|
|
734
|
+
target?.focus({ preventScroll: true });
|
|
735
|
+
}
|
|
736
|
+
board.scrollLeft = prevBoardLeft;
|
|
737
|
+
for (const bodyEl of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_LANE_BODY))) {
|
|
738
|
+
const lk = bodyEl.getAttribute(KIT_ATTR_LANE_BODY);
|
|
739
|
+
const savedTop = lk !== null ? prevLaneTop.get(lk) : undefined;
|
|
740
|
+
if (savedTop !== undefined) bodyEl.scrollTop = savedTop;
|
|
505
741
|
}
|
|
506
742
|
}
|
|
507
743
|
|
|
@@ -528,8 +764,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
528
764
|
const focusCard = (id: string | undefined): void => {
|
|
529
765
|
if (id === undefined || !board) return;
|
|
530
766
|
tabKey = id;
|
|
531
|
-
for (const n of board.querySelectorAll<HTMLElement>(
|
|
532
|
-
[...board.querySelectorAll<HTMLElement>(
|
|
767
|
+
for (const n of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))) n.tabIndex = n.getAttribute(KIT_ATTR_KEY) === id ? 0 : -1;
|
|
768
|
+
[...board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)?.focus();
|
|
533
769
|
};
|
|
534
770
|
|
|
535
771
|
// 泳道内的纵向导航走 core 的共享键盘接线:集合 = 当前泳道的卡(按键前由 onKeydown 填),游标 = 焦点卡
|
|
@@ -554,9 +790,9 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
554
790
|
const target = e.target as HTMLElement | null;
|
|
555
791
|
// 菜单内:↑↓ 走项、Esc 关闭,其余交给按钮本身
|
|
556
792
|
const menuItem = target?.closest<HTMLElement>('[role="menuitem"]');
|
|
557
|
-
const cardEl = target?.closest<HTMLElement>(
|
|
793
|
+
const cardEl = target?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY));
|
|
558
794
|
if (!cardEl) return;
|
|
559
|
-
const id = cardEl.getAttribute(
|
|
795
|
+
const id = cardEl.getAttribute(KIT_ATTR_KEY)!;
|
|
560
796
|
if (menuItem) {
|
|
561
797
|
const items = [...cardEl.querySelectorAll<HTMLButtonElement>('[role="menuitem"]')].filter((b) => !b.disabled);
|
|
562
798
|
const at = items.indexOf(menuItem as HTMLButtonElement);
|
|
@@ -577,7 +813,10 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
577
813
|
const key = kitKey(e.key, root);
|
|
578
814
|
if (key === 'Enter' || key === ' ') {
|
|
579
815
|
e.preventDefault();
|
|
816
|
+
selectedId = id;
|
|
817
|
+
pendingFocus = id;
|
|
580
818
|
api.emit('select', { id, item: rows.find((r) => idOf(r) === id) ?? {} });
|
|
819
|
+
paint();
|
|
581
820
|
return;
|
|
582
821
|
}
|
|
583
822
|
if ((key === 'm' || key === 'M') && !e.altKey && !e.ctrlKey && !e.metaKey && !locked()) {
|
|
@@ -586,7 +825,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
586
825
|
pendingFocus = menuFor === null ? id : null;
|
|
587
826
|
paint();
|
|
588
827
|
if (menuFor !== null) {
|
|
589
|
-
[...board!.querySelectorAll<HTMLElement>(
|
|
828
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)
|
|
590
829
|
?.querySelector<HTMLElement>('[role="menuitem"]:not(:disabled)')?.focus();
|
|
591
830
|
}
|
|
592
831
|
return;
|
|
@@ -615,7 +854,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
615
854
|
}
|
|
616
855
|
e.preventDefault();
|
|
617
856
|
let nl = li + horizontal;
|
|
618
|
-
while (nl >= 0 && nl < keys.length && keys[nl]!.length === 0) nl += horizontal;
|
|
857
|
+
while (nl >= 0 && nl < keys.length && (keys[nl]!.length === 0 || folded.has(cfg.lanes[nl]!.value))) nl += horizontal;
|
|
619
858
|
const col = keys[nl];
|
|
620
859
|
if (col) focusCard(col[Math.min(ci, col.length - 1)]);
|
|
621
860
|
};
|
|
@@ -623,27 +862,43 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
623
862
|
const onClick = (event: Event): void => {
|
|
624
863
|
const target = event.target as HTMLElement | null;
|
|
625
864
|
if (!target) return;
|
|
626
|
-
const
|
|
627
|
-
|
|
865
|
+
const foldBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_FOLD));
|
|
866
|
+
if (foldBtn) {
|
|
867
|
+
const lane = foldBtn.getAttribute(KIT_ATTR_FOLD)!;
|
|
868
|
+
if (folded.has(lane)) folded.delete(lane); else folded.add(lane);
|
|
869
|
+
paint();
|
|
870
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_FOLD))].find((n) => n.getAttribute(KIT_ATTR_FOLD) === lane)?.focus();
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
const addBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_ADD));
|
|
874
|
+
if (addBtn) {
|
|
875
|
+
api.emit('add', { lane: addBtn.getAttribute(KIT_ATTR_ADD)! });
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const toBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_TO));
|
|
879
|
+
const cardEl = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY));
|
|
628
880
|
if (toBtn && cardEl) {
|
|
629
|
-
move(cardEl.getAttribute(
|
|
881
|
+
move(cardEl.getAttribute(KIT_ATTR_KEY)!, toBtn.getAttribute(KIT_ATTR_TO)!, laneRows(config(), toBtn.getAttribute(KIT_ATTR_TO)!).length);
|
|
630
882
|
return;
|
|
631
883
|
}
|
|
632
|
-
const moveBtn = target.closest<HTMLElement>(
|
|
884
|
+
const moveBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_MOVE));
|
|
633
885
|
if (moveBtn) {
|
|
634
|
-
const id = moveBtn.getAttribute(
|
|
886
|
+
const id = moveBtn.getAttribute(KIT_ATTR_MOVE)!;
|
|
635
887
|
menuFor = menuFor === id ? null : id;
|
|
636
888
|
paint();
|
|
637
889
|
if (menuFor !== null) {
|
|
638
|
-
[...board!.querySelectorAll<HTMLElement>(
|
|
890
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)
|
|
639
891
|
?.querySelector<HTMLElement>('[role="menuitem"]:not(:disabled)')?.focus();
|
|
640
892
|
}
|
|
641
893
|
return;
|
|
642
894
|
}
|
|
643
895
|
if (cardEl) {
|
|
644
|
-
const id = cardEl.getAttribute(
|
|
896
|
+
const id = cardEl.getAttribute(KIT_ATTR_KEY)!;
|
|
645
897
|
tabKey = id;
|
|
898
|
+
selectedId = id;
|
|
899
|
+
pendingFocus = id;
|
|
646
900
|
api.emit('select', { id, item: rows.find((r) => idOf(r) === id) ?? {} });
|
|
901
|
+
paint();
|
|
647
902
|
}
|
|
648
903
|
};
|
|
649
904
|
|
|
@@ -653,7 +908,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
653
908
|
root.textContent = '';
|
|
654
909
|
noticeEl = el('div', HIDDEN_CLASS);
|
|
655
910
|
noticeEl.setAttribute('role', 'alert');
|
|
656
|
-
noticeEl.setAttribute(
|
|
911
|
+
noticeEl.setAttribute(KIT_ATTR_WIP_NOTICE, '');
|
|
657
912
|
board = el('div', BOARD_CLASS);
|
|
658
913
|
live = el('div', LIVE_CLASS);
|
|
659
914
|
live.setAttribute('role', 'status');
|