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
|
@@ -22,16 +22,24 @@
|
|
|
22
22
|
// 每次勾选抛 `change { value, added, removed, reason }`;save_label 非空时底部出现保存钮,校验通过抛
|
|
23
23
|
// `saved { values, object, model, mode, value, added, removed, reason }`;cancel_label 非空时出现取消钮,抛 `cancel {}` 并还原草稿。
|
|
24
24
|
|
|
25
|
+
import { kitApplyLevelClass } from './level-class';
|
|
26
|
+
import { kitLevelClassFor, kitLevelParentClass } from '../recipes/pipeline-runtime';
|
|
25
27
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
28
|
+
import { KIT_FOCUS_RING } from '../recipes/state';
|
|
26
29
|
import { createKeyboardWiring, type CollectionItem } from 'soma-core/keyboard';
|
|
27
30
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
+
import { KIT_SIZE_SPEC } from 'soma-foundation/kit-limits';
|
|
32
|
+
import { bool, createKitController, joinClass, num, preserveKitScroll, str } from '../base/shared';
|
|
33
|
+
import { createCheckVisual, KIT_CHECK_CORE_CLASS_CANDIDATES, paintCheckVisual } from '../base/check-core';
|
|
31
34
|
import { kitText, type KitTextKey } from '../i18n/kit-text';
|
|
32
35
|
import { kitControlRecipe, setKitFace } from '../recipes';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
36
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
37
|
+
import { kitDivideRecipe, kitDividerRecipe } from '../recipes/divider';
|
|
38
|
+
import { kitMarkRecipe } from '../recipes/mark';
|
|
39
|
+
import { markKitRowLines } from '../recipes/strip';
|
|
40
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
41
|
+
import { kitActionRecipe, kitPlainActionRecipe } from '../recipes/emphasis';
|
|
42
|
+
import { mergeClass } from '../shared/merge-class';
|
|
35
43
|
import {
|
|
36
44
|
KIT_OVERLAY_FOOT_ATTR, KIT_OVERLAY_FORM_FOOTER_CLASS, KIT_OVERLAY_FORM_SCROLL_ATTR, KIT_OVERLAY_ROOT_FILL_CLASS, kitOverlayFormScrollClass,
|
|
37
45
|
} from '../recipes/overlay';
|
|
@@ -40,56 +48,72 @@ import { classTokens, keyMap, mk, recOf } from './shape-util';
|
|
|
40
48
|
import { envelopeOf } from './permission-tree';
|
|
41
49
|
import { attrEsc } from './d9-util';
|
|
42
50
|
import { markKitEdge } from '../recipes/surface-edge';
|
|
51
|
+
import { kitHasProps, kitMarkDataFacts, kitMarkLevel, kitMarkPart, kitMarkPicked } from './kit-contract';
|
|
43
52
|
import { kitTypographyRecipe } from '../recipes/typography';
|
|
53
|
+
import { KIT_ATTR_CHANGE, KIT_ATTR_GROUP, KIT_ATTR_GROUP_ON, KIT_ATTR_KEY, kitAttrSel } from '../shared/dom-attrs';
|
|
44
54
|
|
|
45
55
|
// ── 类串表:全部完整写死,不拼接片段 ──
|
|
46
56
|
|
|
47
|
-
const ROOT_CLASS = `@container flex h-full flex-col gap-
|
|
57
|
+
const ROOT_CLASS = `@container flex h-full flex-col gap-3 text-sm text-fg ${KIT_OVERLAY_ROOT_FILL_CLASS}`;
|
|
48
58
|
const HELP_CLASS = 'text-sm text-fg-muted';
|
|
49
59
|
const SUBJECT_CLASS = 'flex flex-wrap items-center gap-4';
|
|
50
60
|
const SUBJECT_ITEM_CLASS = 'flex items-center gap-2';
|
|
51
61
|
const CAPTION_CLASS = 'text-sm text-fg-muted';
|
|
52
62
|
const STRONG_CLASS = 'text-sm font-semibold text-fg';
|
|
53
|
-
const ALERT_CLASS = 'rounded-
|
|
54
|
-
const GRID_CLASS = 'grid grid-cols-12 gap-
|
|
63
|
+
const ALERT_CLASS = 'rounded-item bg-danger-soft px-3 py-2 text-sm text-danger-on-soft';
|
|
64
|
+
const GRID_CLASS = 'grid grid-cols-12 gap-3';
|
|
55
65
|
const MAIN_FULL_CLASS = 'col-span-12';
|
|
56
|
-
|
|
57
|
-
const
|
|
66
|
+
// 间距只取 4 的倍数阶梯(尺寸规格 §1;接入核对 C2:10 / 6px 收回 8 / 12)
|
|
67
|
+
const MAIN_INNER_CLASS = 'flex flex-col gap-2';
|
|
68
|
+
const SIDE_TOP_LINE = kitDividerRecipe('top');
|
|
69
|
+
const ROWS_DIVIDE = kitDivideRecipe('y');
|
|
70
|
+
const BOX_EDGE = kitControlEdgeRecipe({ wrapper: true });
|
|
71
|
+
const SIDE_INNER_CLASS = `flex flex-col gap-2 ${SIDE_TOP_LINE} pt-3`;
|
|
58
72
|
const HEAD_CLASS = 'flex items-center justify-between gap-3';
|
|
59
73
|
const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
|
|
60
74
|
const SUMMARY_CLASS = 'text-sm text-fg-muted';
|
|
61
75
|
const CHANGES_CLASS = 'text-sm text-fg-muted';
|
|
62
76
|
const TOOLS_CLASS = 'flex flex-wrap items-center gap-2';
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
77
|
+
// 搜索框 = 标准输入(控件配方,KT-B1 / §4 C6),工具钮与它同高(控件档)
|
|
78
|
+
const SEARCH_CLASS = mergeClass(kitControlRecipe(), 'min-w-40 flex-1');
|
|
79
|
+
// 全选 / 清空 = 小的淡底钮(与权限树 PermissionTree 同一出口 button.text sm,KT-P-assign 授权选择器共用头部):
|
|
80
|
+
// 筛选条里已有搜索框这一个描边元素,次级动作不描边(KT-B9 / B07 条带描边预算)——淡底是面不是线;2026-11-25 裁决:正常情况不用文字当按钮
|
|
81
|
+
const TOOL_BTN_CLASS = kitPlainActionRecipe('toggle', { shape: 'button', size: 'sm' });
|
|
82
|
+
// 列表框外缘 = 壳配方(容器边,KT-B2);条目之间的线由父出(kitDivideRecipe,KT-B5);
|
|
83
|
+
// 分组:灰底组头与条目之间、组与组之间已有面差,不再画线(D-30)
|
|
84
|
+
// 可视高 = (整数行 + 半行) × 行高令牌(KT-D9-6,kit-limits#sizeSpec.scrollRows.dialogList;compile/styles 注入 max-h-rows-<n>):
|
|
85
|
+
// 原 max-h-36(144px)是按旧行高 48 定的 3 行,行高改 40 后露 3.5 行、最后一行被拦腰截断
|
|
86
|
+
const LIST_CLASS = mergeClass(`flex max-h-rows-${KIT_SIZE_SPEC.scrollRows.dialogList} flex-col overflow-y-auto ${KIT_FOCUS_RING.item}`, `${kitShellRecipe({ tone: 'base', shadow: false })} ${kitDivideRecipe('y')}`);
|
|
87
|
+
const GROUP_CLASS = `flex flex-col border-b-0 ${ROWS_DIVIDE}`;
|
|
88
|
+
// 分组头 = 带(KT-B9 带行、KT-R3 F0:带色 bg-surface-band、直角;原圆角凹槽色,窗口里暗色成深条,K-4)
|
|
89
|
+
const GROUP_HEAD_CLASS = 'flex items-center justify-between gap-2 bg-surface-band px-3 py-1.5 text-xs font-medium text-fg-muted border-b-0';
|
|
90
|
+
const GROUP_BTN_CLASS = kitPlainActionRecipe('expand', { shape: 'button', size: 'sm' });
|
|
91
|
+
// 条目 = 行:行高下限读行高令牌(min-h-table-row,KT-D4);带说明行的条目打两行标记换两行档(markKitRowLines),内容更高时随内容长高
|
|
92
|
+
const ITEM_CLASS = 'group flex min-h-table-row shrink-0 cursor-pointer items-center gap-3 bg-surface px-3 py-2 text-fg transition-colors state-layer';
|
|
93
|
+
const ITEM_OFF_CLASS = 'flex min-h-table-row shrink-0 cursor-not-allowed items-center gap-3 bg-surface px-3 py-2 text-fg-subtle';
|
|
94
|
+
const ITEM_ADDED_CLASS = 'group flex min-h-table-row shrink-0 cursor-pointer items-center gap-3 bg-success-soft px-3 py-2 text-success-on-soft transition-colors';
|
|
95
|
+
const ITEM_REMOVED_CLASS = 'group flex min-h-table-row shrink-0 cursor-pointer items-center gap-3 bg-danger-soft px-3 py-2 text-danger-on-soft transition-colors';
|
|
73
96
|
const CURSOR_CLASS = 'ring-2 ring-inset ring-ring';
|
|
74
|
-
const BOX_OFF_CLASS =
|
|
75
|
-
const BOX_ON_CLASS = 'inline-flex
|
|
97
|
+
const BOX_OFF_CLASS = `inline-flex h-check-md w-check-md shrink-0 items-center justify-center rounded-item ${BOX_EDGE} bg-surface text-xs`;
|
|
98
|
+
const BOX_ON_CLASS = 'inline-flex h-check-md w-check-md shrink-0 items-center justify-center rounded-item border border-primary bg-primary text-xs text-primary-fg';
|
|
76
99
|
const TEXT_CLASS = 'flex min-w-0 flex-1 flex-col';
|
|
77
100
|
const LABEL_CLASS = 'truncate text-sm';
|
|
78
101
|
const SUB_CLASS = 'truncate text-xs text-fg-muted';
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
102
|
+
// 变更标记 = 语气标记出口(kitMarkRecipe('tone'):F1 小档淡底,不成胶囊,KT-R3 / KT-B9 标记行)
|
|
103
|
+
const CHIP_BASE = 'shrink-0';
|
|
104
|
+
const CHIP_KEPT_CLASS = kitMarkRecipe('tone', 'neutral');
|
|
105
|
+
const CHIP_ADDED_CLASS = kitMarkRecipe('tone', 'success');
|
|
106
|
+
const CHIP_REMOVED_CLASS = kitMarkRecipe('tone', 'danger');
|
|
83
107
|
const EMPTY_CLASS = 'px-2 py-3 text-sm text-fg-muted';
|
|
84
108
|
const FIELD_LABEL_CLASS = 'flex items-center gap-1 text-sm text-fg';
|
|
85
109
|
const STAR_CLASS = 'text-danger-on-soft';
|
|
86
|
-
const AREA_CLASS =
|
|
110
|
+
const AREA_CLASS = mergeClass(kitControlRecipe({ multiline: true }), 'resize-none');
|
|
87
111
|
const FIELD_ERROR_CLASS = 'text-xs text-danger-on-soft';
|
|
88
112
|
// mt-auto:根随容器拉高时按钮区贴在面板底部,不悬在中间
|
|
89
113
|
const FOOT_CLASS = 'mt-auto flex items-center justify-end gap-2 pt-1';
|
|
90
114
|
// 保存 / 取消(返回):标准高度(32)的实心 / 描边按钮,与对话框底栏、授权树同一配方(原手写 h-9 = 36)
|
|
91
|
-
const SAVE_CLASS =
|
|
92
|
-
const CANCEL_CLASS =
|
|
115
|
+
const SAVE_CLASS = kitActionRecipe('save', { region: 'form', rankInRegion: 0 });
|
|
116
|
+
const CANCEL_CLASS = kitActionRecipe('cancel', { region: 'form' });
|
|
93
117
|
|
|
94
118
|
export const KIT_ASSIGNMENT_PICKER_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
95
119
|
ROOT_CLASS, HELP_CLASS, SUBJECT_CLASS, SUBJECT_ITEM_CLASS, CAPTION_CLASS, STRONG_CLASS, ALERT_CLASS, GRID_CLASS, MAIN_FULL_CLASS,
|
|
@@ -98,6 +122,7 @@ export const KIT_ASSIGNMENT_PICKER_CLASS_CANDIDATES: readonly string[] = classTo
|
|
|
98
122
|
ITEM_REMOVED_CLASS, CURSOR_CLASS, BOX_OFF_CLASS, BOX_ON_CLASS, TEXT_CLASS, LABEL_CLASS, SUB_CLASS, CHIP_BASE, CHIP_KEPT_CLASS,
|
|
99
123
|
CHIP_ADDED_CLASS, CHIP_REMOVED_CLASS, EMPTY_CLASS, FIELD_LABEL_CLASS, STAR_CLASS, AREA_CLASS, FIELD_ERROR_CLASS, FOOT_CLASS,
|
|
100
124
|
SAVE_CLASS, CANCEL_CLASS, KIT_OVERLAY_FORM_FOOTER_CLASS, kitOverlayFormScrollClass('gap-4'), 'hidden', 'flex', 'flex-1', 'rounded-full',
|
|
125
|
+
KIT_CHECK_CORE_CLASS_CANDIDATES,
|
|
101
126
|
);
|
|
102
127
|
|
|
103
128
|
// ── 数据规整纯函数:解析、对比、过滤、分组、文案 ──
|
|
@@ -323,7 +348,25 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
323
348
|
onToggle: (key) => toggle(key),
|
|
324
349
|
});
|
|
325
350
|
|
|
326
|
-
|
|
351
|
+
let lastEmittedReason = '';
|
|
352
|
+
const sigFor = (p: Record<string, unknown>, map: KitAssignmentPickerMap, val: unknown, missingText: string, reasonOverride?: string): string => {
|
|
353
|
+
const d = envelopeOf(p.data, map.items);
|
|
354
|
+
const dataForSig = reasonOverride === undefined ? p.data : { ...recOf(p.data), ...(d === recOf(p.data) ? { [map.reason]: reasonOverride } : { data: { ...d, [map.reason]: reasonOverride } }) };
|
|
355
|
+
return JSON.stringify([dataForSig, map, val ?? null, missingText]);
|
|
356
|
+
};
|
|
357
|
+
const emitChange = (): void => {
|
|
358
|
+
const out = payload();
|
|
359
|
+
const p = P();
|
|
360
|
+
const map = mapOf();
|
|
361
|
+
const missingText = T().missing;
|
|
362
|
+
lastEmittedReason = out.reason;
|
|
363
|
+
if (Array.isArray(p.value)) {
|
|
364
|
+
sig = sigFor(p, map, out.value, missingText);
|
|
365
|
+
} else {
|
|
366
|
+
sig = sigFor(p, map, p.value ?? null, missingText);
|
|
367
|
+
}
|
|
368
|
+
api.emit('change', out);
|
|
369
|
+
};
|
|
327
370
|
|
|
328
371
|
const multiple = (): boolean => P().multiple !== false && P().multiple !== 'false';
|
|
329
372
|
|
|
@@ -363,14 +406,27 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
363
406
|
emitChange();
|
|
364
407
|
};
|
|
365
408
|
|
|
409
|
+
let syncWithoutReasonSig = '';
|
|
366
410
|
const sync = (): void => {
|
|
367
411
|
const p = P();
|
|
368
412
|
const map = mapOf();
|
|
369
413
|
const t = T();
|
|
370
|
-
const next =
|
|
414
|
+
const next = sigFor(p, map, p.value ?? null, t.missing);
|
|
371
415
|
if (next === sig) return;
|
|
372
|
-
sig = next;
|
|
373
416
|
const d = envelopeOf(p.data, map.items);
|
|
417
|
+
const nextNoReason = JSON.stringify([
|
|
418
|
+
{ ...d, [map.reason]: null },
|
|
419
|
+
map,
|
|
420
|
+
p.value ?? null,
|
|
421
|
+
t.missing,
|
|
422
|
+
]);
|
|
423
|
+
// 仅 data.reason 回声变化(宿主在 change 后把 reason 回写进 data)时不重置勾选草稿与正在输入的文本框
|
|
424
|
+
if (syncWithoutReasonSig !== '' && nextNoReason === syncWithoutReasonSig && str(d[map.reason]).trim() === lastEmittedReason) {
|
|
425
|
+
sig = next;
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
sig = next;
|
|
429
|
+
syncWithoutReasonSig = nextNoReason;
|
|
374
430
|
const given = Array.isArray(p.value) ? { ...d, [map.value]: p.value } : d;
|
|
375
431
|
const parsed = parseAssignmentData(given, map, t.missing);
|
|
376
432
|
items = parsed.items;
|
|
@@ -378,6 +434,7 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
378
434
|
base = new Set(parsed.value);
|
|
379
435
|
now = new Set(parsed.value);
|
|
380
436
|
reason = str(d[map.reason]);
|
|
437
|
+
lastEmittedReason = reason.trim();
|
|
381
438
|
reasonError = '';
|
|
382
439
|
notice = '';
|
|
383
440
|
error = str(d[map.error]);
|
|
@@ -392,21 +449,24 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
392
449
|
const row = mk('div', '');
|
|
393
450
|
row.id = optionId(item.id);
|
|
394
451
|
row.setAttribute('role', 'option');
|
|
395
|
-
row.setAttribute(
|
|
452
|
+
row.setAttribute(KIT_ATTR_KEY, item.id);
|
|
396
453
|
row.setAttribute('aria-selected', on ? 'true' : 'false');
|
|
454
|
+
// 组件契约自报:候选项 = 条目(元素部件「行」),选中同写交互状态(aria-selected 上一行已写)
|
|
455
|
+
kitMarkLevel(row, 'item', 'line');
|
|
456
|
+
kitMarkPicked(row, 'selected', on, null);
|
|
397
457
|
if (!ok) row.setAttribute('aria-disabled', 'true');
|
|
398
458
|
const state = on && !was ? 'added' : !on && was ? 'removed' : on ? 'kept' : '';
|
|
399
|
-
if (state !== '') row.setAttribute(
|
|
459
|
+
if (state !== '') row.setAttribute(KIT_ATTR_CHANGE, state);
|
|
400
460
|
const tone = !ok ? ITEM_OFF_CLASS : state === 'added' ? ITEM_ADDED_CLASS : state === 'removed' ? ITEM_REMOVED_CLASS : ITEM_CLASS;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
box.setAttribute('aria-hidden', 'true');
|
|
461
|
+
// 基础外观经层级角色出口(新模式剥取值表负责的类);键盘游标环是状态,照旧追加
|
|
462
|
+
row.className = cursor === item.id ? `${kitLevelClassFor(row, tone)} ${CURSOR_CLASS}` : kitLevelClassFor(row, tone);
|
|
463
|
+
const kind = multiple() ? 'checkbox' : 'radio';
|
|
464
|
+
const box = createCheckVisual(root!.ownerDocument, kind, 'md');
|
|
465
|
+
paintCheckVisual(box, kind, on, { disabled: !ok, size: 'md' });
|
|
407
466
|
const text = mk('span', TEXT_CLASS);
|
|
408
467
|
text.appendChild(mk('span', LABEL_CLASS, item.label));
|
|
409
468
|
if (item.sub !== '') text.appendChild(mk('span', SUB_CLASS, item.sub));
|
|
469
|
+
markKitRowLines(row, item.sub);
|
|
410
470
|
row.append(box, text);
|
|
411
471
|
if (state === 'added') row.appendChild(mk('span', `${CHIP_BASE} ${CHIP_ADDED_CLASS}`, t.added));
|
|
412
472
|
else if (state === 'removed') row.appendChild(mk('span', `${CHIP_BASE} ${CHIP_REMOVED_CLASS}`, t.removed));
|
|
@@ -415,52 +475,60 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
415
475
|
};
|
|
416
476
|
|
|
417
477
|
function paintList(): void {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
478
|
+
preserveKitScroll(listEl, () => {
|
|
479
|
+
const t = T();
|
|
480
|
+
const vis = visibleItems();
|
|
481
|
+
listEl.textContent = '';
|
|
482
|
+
groupBarEl.textContent = '';
|
|
483
|
+
groupBarEl.className = 'hidden';
|
|
484
|
+
listEl.setAttribute('aria-multiselectable', multiple() ? 'true' : 'false');
|
|
485
|
+
if (vis.length === 0) {
|
|
486
|
+
const empty = mk('div', EMPTY_CLASS, str(P().empty_text) || t.empty);
|
|
487
|
+
empty.setAttribute('role', 'status');
|
|
488
|
+
kitMarkLevel(empty, 'sub'); kitApplyLevelClass(empty);
|
|
489
|
+
listEl.appendChild(empty);
|
|
490
|
+
listEl.removeAttribute('aria-activedescendant');
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const groups = groupAssignItems(vis);
|
|
494
|
+
const grouped = groups.some((g) => g.name !== '');
|
|
495
|
+
// 不分组时列表的直接子项就是候选条目:新模式线改由取值表按条目画,父上的 divide-* 剥掉;分组时直接子项是组(不自报层级角色),组间线仍由父画
|
|
496
|
+
listEl.className = grouped ? LIST_CLASS : kitLevelParentClass('item', LIST_CLASS);
|
|
497
|
+
const frag = document.createDocumentFragment();
|
|
498
|
+
for (const g of groups) {
|
|
499
|
+
if (!grouped) { for (const item of g.items) frag.appendChild(buildItem(item, t)); continue; }
|
|
500
|
+
const wrap = mk('div', kitLevelParentClass('item', GROUP_CLASS));
|
|
501
|
+
wrap.setAttribute('role', 'group');
|
|
502
|
+
const chosen = g.items.filter((i) => now.has(i.id)).length;
|
|
503
|
+
wrap.setAttribute('aria-label', g.name !== '' ? `${g.name} ${chosen}/${g.items.length}` : t.selected.replace('{n}', String(chosen)));
|
|
504
|
+
if (g.name !== '') {
|
|
505
|
+
const head = mk('div', GROUP_HEAD_CLASS);
|
|
506
|
+
head.setAttribute('aria-hidden', 'true');
|
|
507
|
+
// 分组行 = 淡底带
|
|
508
|
+
kitMarkLevel(head, 'band'); kitApplyLevelClass(head);
|
|
509
|
+
head.appendChild(mk('span', '', `${g.name} ${chosen}/${g.items.length}`));
|
|
510
|
+
wrap.appendChild(head);
|
|
511
|
+
const pickable = g.items.filter((i) => canToggle(i) || (!i.disabled && !i.missing));
|
|
512
|
+
const allOn = pickable.length > 0 && pickable.every((i) => now.has(i.id));
|
|
513
|
+
const btn = mk('button', GROUP_BTN_CLASS, `${g.name}:${allOn ? t.group_none : t.group_all}`);
|
|
514
|
+
btn.type = 'button';
|
|
515
|
+
setKitFace(btn, 'raised');
|
|
516
|
+
btn.disabled = locked() || pickable.length === 0;
|
|
517
|
+
btn.setAttribute(KIT_ATTR_GROUP, g.name);
|
|
518
|
+
btn.setAttribute(KIT_ATTR_GROUP_ON, allOn ? 'off' : 'on');
|
|
519
|
+
kitMarkPart(btn, 'action');
|
|
520
|
+
if (multiple()) {
|
|
521
|
+
groupBarEl.appendChild(btn);
|
|
522
|
+
groupBarEl.className = TOOLS_CLASS;
|
|
523
|
+
}
|
|
456
524
|
}
|
|
525
|
+
for (const item of g.items) wrap.appendChild(buildItem(item, t));
|
|
526
|
+
frag.appendChild(wrap);
|
|
457
527
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
if (cursor !== null && vis.some((i) => i.id === cursor)) listEl.setAttribute('aria-activedescendant', optionId(cursor));
|
|
463
|
-
else listEl.removeAttribute('aria-activedescendant');
|
|
528
|
+
listEl.appendChild(frag);
|
|
529
|
+
if (cursor !== null && vis.some((i) => i.id === cursor)) listEl.setAttribute('aria-activedescendant', optionId(cursor));
|
|
530
|
+
else listEl.removeAttribute('aria-activedescendant');
|
|
531
|
+
});
|
|
464
532
|
}
|
|
465
533
|
|
|
466
534
|
function paint(): void {
|
|
@@ -468,6 +536,7 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
468
536
|
const p = P();
|
|
469
537
|
const t = T();
|
|
470
538
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
539
|
+
kitMarkDataFacts(root, { error: error !== '', empty: items.length === 0, readonly: locked() });
|
|
471
540
|
const help = str(p.help);
|
|
472
541
|
helpEl.hidden = help === '';
|
|
473
542
|
helpEl.textContent = help;
|
|
@@ -571,9 +640,12 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
571
640
|
subjectEl = mk('div', SUBJECT_CLASS);
|
|
572
641
|
alertEl = mk('p', ALERT_CLASS);
|
|
573
642
|
alertEl.setAttribute('role', 'alert');
|
|
643
|
+
kitMarkLevel(alertEl, 'sub'); kitApplyLevelClass(alertEl);
|
|
574
644
|
titleEl = mk('h3', TITLE_CLASS);
|
|
645
|
+
kitMarkPart(titleEl, 'block-title');
|
|
575
646
|
summaryEl = mk('span', SUMMARY_CLASS);
|
|
576
647
|
const head = mk('div', HEAD_CLASS);
|
|
648
|
+
kitMarkLevel(head, 'head'); kitApplyLevelClass(head);
|
|
577
649
|
head.append(titleEl, summaryEl);
|
|
578
650
|
changesEl = mk('p', CHANGES_CLASS);
|
|
579
651
|
search = mk('input', SEARCH_CLASS);
|
|
@@ -584,13 +656,17 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
584
656
|
searchBox.className = 'flex flex-1';
|
|
585
657
|
allBtn = mk('button', TOOL_BTN_CLASS); allBtn.type = 'button';
|
|
586
658
|
clearBtn = mk('button', TOOL_BTN_CLASS); clearBtn.type = 'button';
|
|
587
|
-
|
|
588
|
-
setKitFace(clearBtn, 'raised');
|
|
659
|
+
// 文字链接无面:不标 raised(不叠质感阴影)
|
|
589
660
|
const tools = mk('div', TOOLS_CLASS);
|
|
661
|
+
// 搜索 + 全选 / 清空一条 = 筛选带(淡底带)
|
|
662
|
+
kitMarkLevel(tools, 'band'); kitApplyLevelClass(tools);
|
|
663
|
+
kitMarkPart(allBtn, 'action');
|
|
664
|
+
kitMarkPart(clearBtn, 'action');
|
|
590
665
|
tools.append(searchBox, allBtn, clearBtn);
|
|
591
666
|
groupBarEl = mk('div', 'hidden');
|
|
592
667
|
listEl = mk('div', LIST_CLASS);
|
|
593
|
-
|
|
668
|
+
// 外框去留原先看祖先(surface-edge);页面线写了入参时由取值表按层级邻接给,不再自报 edge
|
|
669
|
+
if (!kitHasProps(P())) markKitEdge(listEl);
|
|
594
670
|
listEl.setAttribute('role', 'listbox');
|
|
595
671
|
listEl.tabIndex = 0;
|
|
596
672
|
const mainInner = mk('div', MAIN_INNER_CLASS);
|
|
@@ -600,7 +676,7 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
600
676
|
fieldLabel = mk('label', FIELD_LABEL_CLASS);
|
|
601
677
|
area = mk('textarea', AREA_CLASS);
|
|
602
678
|
setKitFace(area, 'field');
|
|
603
|
-
area.rows =
|
|
679
|
+
area.rows = 2;
|
|
604
680
|
const areaId = `${uid}-reason`;
|
|
605
681
|
area.id = areaId;
|
|
606
682
|
fieldLabel.htmlFor = areaId;
|
|
@@ -622,6 +698,9 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
622
698
|
cancelBox = boxOf(cancelBtn);
|
|
623
699
|
saveBox = boxOf(saveBtn);
|
|
624
700
|
const foot = mk('div', FOOT_CLASS);
|
|
701
|
+
kitMarkLevel(foot, 'foot'); kitApplyLevelClass(foot);
|
|
702
|
+
kitMarkPart(cancelBtn, 'action');
|
|
703
|
+
kitMarkPart(saveBtn, 'action');
|
|
625
704
|
foot.append(cancelBox, saveBox);
|
|
626
705
|
footBox = boxOf(foot);
|
|
627
706
|
// 浮层滚动体里底栏吸底并贴着浮层底边(外包层是 sticky 元素;变体只在 group-data-kit-overlay-scroll 祖先下生效)
|
|
@@ -639,15 +718,15 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
639
718
|
removers.push(() => target.removeEventListener(type, fn));
|
|
640
719
|
};
|
|
641
720
|
on(groupBarEl, 'click', (event) => {
|
|
642
|
-
const gbtn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(
|
|
721
|
+
const gbtn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(kitAttrSel(KIT_ATTR_GROUP));
|
|
643
722
|
if (!gbtn) return;
|
|
644
|
-
const name = gbtn.getAttribute(
|
|
723
|
+
const name = gbtn.getAttribute(KIT_ATTR_GROUP) ?? '';
|
|
645
724
|
const members = visibleItems().filter((i) => i.group === name);
|
|
646
|
-
setMany(members.filter((i) => canToggle(i) || (!i.disabled && !i.missing)), gbtn.getAttribute(
|
|
647
|
-
groupBarEl.querySelector<HTMLElement>(`[
|
|
725
|
+
setMany(members.filter((i) => canToggle(i) || (!i.disabled && !i.missing)), gbtn.getAttribute(KIT_ATTR_GROUP_ON) === 'on');
|
|
726
|
+
groupBarEl.querySelector<HTMLElement>(`[${KIT_ATTR_GROUP}="${attrEsc(name)}"]`)?.focus();
|
|
648
727
|
});
|
|
649
728
|
on(listEl, 'click', (event) => {
|
|
650
|
-
const key = (event.target as HTMLElement | null)?.closest<HTMLElement>(
|
|
729
|
+
const key = (event.target as HTMLElement | null)?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))?.getAttribute(KIT_ATTR_KEY);
|
|
651
730
|
if (key) toggle(key);
|
|
652
731
|
});
|
|
653
732
|
on(listEl, 'keydown', (event) => {
|
|
@@ -660,7 +739,16 @@ export function createAssignmentPicker(): SomaComponentDefinition {
|
|
|
660
739
|
on(search, 'input', () => { cursor = null; paintList(); });
|
|
661
740
|
on(allBtn, 'click', () => setMany(visibleItems().filter((i) => !i.missing), true));
|
|
662
741
|
on(clearBtn, 'click', () => setMany(visibleItems(), false));
|
|
663
|
-
on(area, 'input', () => {
|
|
742
|
+
on(area, 'input', () => {
|
|
743
|
+
reason = area.value;
|
|
744
|
+
if (reasonError !== '') {
|
|
745
|
+
reasonError = '';
|
|
746
|
+
area.removeAttribute('aria-invalid');
|
|
747
|
+
fieldError.textContent = '';
|
|
748
|
+
errorBox.hidden = true;
|
|
749
|
+
}
|
|
750
|
+
emitChange();
|
|
751
|
+
});
|
|
664
752
|
on(saveBtn, 'click', save);
|
|
665
753
|
on(cancelBtn, 'click', () => {
|
|
666
754
|
now = new Set(base);
|