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/base/tag-input.ts
CHANGED
|
@@ -9,51 +9,67 @@
|
|
|
9
9
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
10
10
|
import type { CollectionItem } from 'soma-core/keyboard';
|
|
11
11
|
import { kitKey, kitText } from '../i18n/kit-text';
|
|
12
|
-
import { kitIcon } from '
|
|
12
|
+
import { kitIcon } from '../shared/icons';
|
|
13
|
+
import { mergeClass } from '../shared/merge-class';
|
|
14
|
+
import { KIT_ATTR_KEY, KIT_ATTR_REMOVE, KIT_ATTR_TOKEN } from '../shared/dom-attrs';
|
|
13
15
|
import { setKitFace } from '../recipes';
|
|
16
|
+
import { KIT_FOCUS_DELEGATED_INPUT, KIT_FOCUS_RING } from '../recipes/state';
|
|
17
|
+
import { kitClosedValueRecipe } from '../recipes/field-text';
|
|
18
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
19
|
+
import { KIT_DIVIDER_COLOR_CLASS } from '../recipes/divider';
|
|
14
20
|
import {
|
|
15
21
|
CLASS_PROP, FIELD_INVALID_CLASS, ID_PROPS, INVALID_PROPS, OPTIONS_PROP, SIZE_PROP,
|
|
16
|
-
applyCommon, applyDisabled, bool, createKitController, joinClass, nextUid, num, optionsOf, sameValue, setAttr, setBoolAttr,
|
|
22
|
+
applyCommon, applyDisabled, bool, classCandidates, createKitController, joinClass, nextUid, num, optionsOf, sameValue, setAttr, setBoolAttr, str, withInvalid,
|
|
23
|
+
kitControlSizeOf, kitMarkDataState, kitMarkInteract, kitReadProps, kitReportSelf,
|
|
17
24
|
type KitApi, type KitOption, type KitProps, type KitSize,
|
|
18
25
|
} from './shared';
|
|
19
26
|
import {
|
|
20
27
|
EMPTY_ROW_CLASS, KIT_POPUP_CLASS_CANDIDATES, KIT_DROPDOWN_CLASS_CANDIDATES,
|
|
21
|
-
PANEL_HIDDEN_CLASS, syncDropdown, releaseDropdown,
|
|
28
|
+
PANEL_HIDDEN_CLASS, isImeComposing, syncDropdown, releaseDropdown,
|
|
22
29
|
cssEscape, createListNav, optionClass, scrollIntoViewIfAny, type ListNav,
|
|
23
30
|
} from './popup';
|
|
24
31
|
|
|
25
32
|
// ---- Tailwind 类常量与候选类清单 ----
|
|
26
33
|
|
|
34
|
+
// 外壳的边只取控件轮廓出口(KT-B1 / §4 C6)
|
|
35
|
+
const EDGE = kitControlEdgeRecipe({ wrapper: true });
|
|
36
|
+
const EDGE_STILL = kitControlEdgeRecipe({ wrapper: true, hover: false });
|
|
37
|
+
const EDGE_DISABLED = mergeClass(EDGE_STILL, KIT_DIVIDER_COLOR_CLASS);
|
|
27
38
|
const ROOT_CLASS: Record<KitSize, string> = {
|
|
28
|
-
sm:
|
|
29
|
-
md:
|
|
30
|
-
lg:
|
|
39
|
+
sm: `relative flex min-h-control-sm w-full flex-wrap items-center gap-1 rounded-control ${EDGE} bg-surface px-2 py-0.5 text-xs text-fg transition-colors focus-visible:outline-none`,
|
|
40
|
+
md: `relative flex min-h-8 w-full flex-wrap items-center gap-1 rounded-control ${EDGE} bg-surface px-2 py-0.5 text-sm text-fg transition-colors focus-visible:outline-none`,
|
|
41
|
+
lg: `relative flex min-h-10 w-full flex-wrap items-center gap-2 rounded-control ${EDGE} bg-surface px-3 py-1 text-base text-fg transition-colors focus-visible:outline-none`,
|
|
31
42
|
};
|
|
32
43
|
const ROOT_DISABLED_CLASS: Record<KitSize, string> = {
|
|
33
|
-
sm:
|
|
34
|
-
md:
|
|
35
|
-
lg:
|
|
44
|
+
sm: `relative flex min-h-control-sm w-full cursor-not-allowed flex-wrap items-center gap-1 rounded-control ${EDGE_DISABLED} bg-control-disabled px-2 py-0.5 text-xs text-fg-disabled`,
|
|
45
|
+
md: `relative flex min-h-8 w-full cursor-not-allowed flex-wrap items-center gap-1 rounded-control ${EDGE_DISABLED} bg-control-disabled px-2 py-0.5 text-sm text-fg-disabled`,
|
|
46
|
+
lg: `relative flex min-h-10 w-full cursor-not-allowed flex-wrap items-center gap-2 rounded-control ${EDGE_DISABLED} bg-control-disabled px-3 py-1 text-base text-fg-disabled`, // KT-K0-4
|
|
36
47
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
48
|
+
// 纯 CSS 兄弟聚焦环(PW-1 R1-P1-05):仅当内部 <input class="peer"> 获得 :focus-visible 时亮外框单环;
|
|
49
|
+
// 聚焦芯片删除钮 [data-kit-remove] 时仅亮按钮自身单环,彻底杜绝外框 + 芯片 + 删除钮三层套娃蓝环
|
|
50
|
+
const PEER_INPUT_FOCUS = KIT_FOCUS_RING.control.replace(/(^|\s)focus-visible:/g, '$1peer-focus-visible:');
|
|
51
|
+
const FOCUS_RING_OVERLAY_CLASS = `pointer-events-none absolute -inset-px rounded-control border border-transparent ${PEER_INPUT_FOCUS} peer-aria-invalid:peer-focus-visible:border-danger peer-aria-invalid:peer-focus-visible:ring-danger`;
|
|
52
|
+
// 标签芯片:浅底、无描边(控件里不套第二圈线,与多选框芯片同一形体)
|
|
53
|
+
// 标签 token = 闭集值标签(F7:有底,走 kitClosedValueRecipe 的中性语气)
|
|
54
|
+
const TOKEN_CLASS = mergeClass(kitClosedValueRecipe('neutral'), 'max-w-full gap-1');
|
|
55
|
+
const TOKEN_TEXT_CLASS = 'min-w-0 truncate';
|
|
56
|
+
const REMOVE_CLASS = 'inline-flex min-h-5 min-w-5 shrink-0 cursor-pointer items-center justify-center rounded-item px-0.5 text-fg-subtle transition-colors hover:text-fg ' + KIT_FOCUS_RING.item;
|
|
57
|
+
const INPUT_CLASS = `peer min-w-8 flex-1 appearance-none autofill-clear border-0 bg-transparent px-1 py-0 text-fg placeholder:text-fg-subtle ${KIT_FOCUS_DELEGATED_INPUT} disabled:cursor-not-allowed disabled:text-fg-disabled`;
|
|
58
|
+
const INPUT_LOCKED_CLASS = `peer w-0 min-w-0 flex-none appearance-none autofill-clear border-0 bg-transparent p-0 text-fg placeholder:text-fg-subtle ${KIT_FOCUS_DELEGATED_INPUT} disabled:cursor-not-allowed disabled:text-fg-disabled`;
|
|
40
59
|
|
|
41
60
|
/** 本组件自带的类(并入基础组件候选类清单) */
|
|
42
|
-
export const KIT_TAG_INPUT_CLASS_CANDIDATES: readonly string[] =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]);
|
|
61
|
+
export const KIT_TAG_INPUT_CLASS_CANDIDATES: readonly string[] = classCandidates(
|
|
62
|
+
Object.values(ROOT_CLASS),
|
|
63
|
+
Object.values(ROOT_DISABLED_CLASS),
|
|
64
|
+
FOCUS_RING_OVERLAY_CLASS,
|
|
65
|
+
TOKEN_CLASS, TOKEN_TEXT_CLASS, REMOVE_CLASS, INPUT_CLASS, INPUT_LOCKED_CLASS, EMPTY_ROW_CLASS, FIELD_INVALID_CLASS,
|
|
66
|
+
KIT_POPUP_CLASS_CANDIDATES,
|
|
67
|
+
KIT_DROPDOWN_CLASS_CANDIDATES,
|
|
68
|
+
);
|
|
51
69
|
|
|
52
70
|
// ---- 数据规整:标签值、分隔符、上限、切词、标签文字(纯函数) ----
|
|
53
71
|
|
|
54
72
|
const DEFAULT_SEPARATORS = ',,;;\n';
|
|
55
|
-
const TOKEN_ATTR = 'data-kit-token';
|
|
56
|
-
const REMOVE_ATTR = 'data-kit-remove';
|
|
57
73
|
|
|
58
74
|
function valuesOf(raw: unknown): string[] {
|
|
59
75
|
if (!Array.isArray(raw)) return [];
|
|
@@ -103,6 +119,8 @@ function firstEnabledKey(list: readonly KitOption[]): string | null {
|
|
|
103
119
|
|
|
104
120
|
interface Ui {
|
|
105
121
|
input: HTMLInputElement;
|
|
122
|
+
focusRing: HTMLSpanElement;
|
|
123
|
+
hidden: HTMLInputElement | null;
|
|
106
124
|
panel: HTMLElement;
|
|
107
125
|
listId: string;
|
|
108
126
|
open: boolean;
|
|
@@ -124,13 +142,13 @@ function suggestionsOf(p: KitProps, ui: Ui): KitOption[] {
|
|
|
124
142
|
);
|
|
125
143
|
}
|
|
126
144
|
|
|
127
|
-
function paintPanel(ui: Ui, p: KitProps): void {
|
|
145
|
+
function paintPanel(ui: Ui, p: KitProps, immediate = false): void {
|
|
128
146
|
const list = ui.open && canEdit(p) ? suggestionsOf(p, ui) : [];
|
|
129
147
|
const visible = ui.open && list.length > 0;
|
|
130
148
|
ui.input.setAttribute('aria-expanded', visible ? 'true' : 'false');
|
|
131
149
|
ui.panel.textContent = '';
|
|
132
150
|
if (!visible) {
|
|
133
|
-
syncDropdown(ui.panel, false);
|
|
151
|
+
syncDropdown(ui.panel, false, undefined, undefined, 'start', immediate ? { immediate: true } : undefined);
|
|
134
152
|
ui.input.removeAttribute('aria-activedescendant');
|
|
135
153
|
return;
|
|
136
154
|
}
|
|
@@ -142,20 +160,29 @@ function paintPanel(ui: Ui, p: KitProps): void {
|
|
|
142
160
|
const active = ui.cursor === key;
|
|
143
161
|
el.id = id;
|
|
144
162
|
el.setAttribute('role', 'option');
|
|
145
|
-
el.setAttribute(
|
|
163
|
+
el.setAttribute(KIT_ATTR_KEY, key);
|
|
146
164
|
el.setAttribute('aria-selected', active ? 'true' : 'false');
|
|
147
165
|
if (o.disabled) el.setAttribute('aria-disabled', 'true');
|
|
148
166
|
el.className = optionClass(false, active, o.disabled === true);
|
|
167
|
+
// 键盘活动项 = 激活(当前项)自报;悬停 / 禁用走伪类与 aria-disabled
|
|
168
|
+
if (active) kitMarkInteract(el, 'current', true);
|
|
149
169
|
el.textContent = o.label;
|
|
150
170
|
if (active) activeId = id;
|
|
151
171
|
ui.panel.appendChild(el);
|
|
152
172
|
});
|
|
153
173
|
setAttr(ui.input, 'aria-activedescendant', activeId);
|
|
154
|
-
syncDropdown(ui.panel, true
|
|
174
|
+
syncDropdown(ui.panel, true, undefined, ui.input.parentElement ?? undefined, 'start', {
|
|
175
|
+
onEscape: () => {
|
|
176
|
+
if (ui.composing) return;
|
|
177
|
+
ui.open = false;
|
|
178
|
+
ui.cursor = null;
|
|
179
|
+
paintPanel(ui, ui.api.props(), true);
|
|
180
|
+
},
|
|
181
|
+
});
|
|
155
182
|
if (activeId !== '') scrollIntoViewIfAny(ui.panel.querySelector(`#${cssEscape(activeId)}`));
|
|
156
183
|
}
|
|
157
184
|
|
|
158
|
-
/**
|
|
185
|
+
/** 加入一批候选文本;返回是否有变化。仅当确实新增了标签或命中已有标签去重成功时才清空输入框,被 allow_create / max 拒绝时保留草稿 */
|
|
159
186
|
function addTexts(ui: Ui, candidates: readonly string[], fromSuggestion: boolean): boolean {
|
|
160
187
|
const p = ui.api.props();
|
|
161
188
|
if (!canEdit(p)) return false;
|
|
@@ -164,22 +191,31 @@ function addTexts(ui: Ui, candidates: readonly string[], fromSuggestion: boolean
|
|
|
164
191
|
const options = optionsOf(p.options);
|
|
165
192
|
const max = limitOf(p);
|
|
166
193
|
const created: string[] = [];
|
|
194
|
+
let hitExisting = false;
|
|
167
195
|
for (const raw of candidates) {
|
|
168
196
|
const text = raw.trim();
|
|
169
|
-
if (text === ''
|
|
197
|
+
if (text === '') continue;
|
|
198
|
+
if (next.includes(text)) {
|
|
199
|
+
hitExisting = true;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
170
202
|
if (max > 0 && next.length >= max) break;
|
|
171
203
|
const known = options.some((o) => sameValue(o.value, text));
|
|
172
204
|
if (!fromSuggestion && p.allow_create === false && !known) continue;
|
|
173
205
|
next.push(text);
|
|
174
206
|
if (!known) created.push(text);
|
|
175
207
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
208
|
+
const added = next.length > current.length;
|
|
209
|
+
if (added || hitExisting) {
|
|
210
|
+
ui.input.value = '';
|
|
211
|
+
ui.cursor = null;
|
|
212
|
+
ui.open = false;
|
|
213
|
+
}
|
|
214
|
+
if (!added) {
|
|
180
215
|
paintPanel(ui, p);
|
|
181
216
|
return false;
|
|
182
217
|
}
|
|
218
|
+
if (ui.hidden !== null) ui.hidden.value = next.join(',');
|
|
183
219
|
ui.api.emit('change', { value: next });
|
|
184
220
|
for (const text of created) ui.api.emit('create', { text });
|
|
185
221
|
paintPanel(ui, p);
|
|
@@ -196,34 +232,43 @@ function removeAt(ui: Ui, index: number): void {
|
|
|
196
232
|
}
|
|
197
233
|
|
|
198
234
|
function removeButtons(root: HTMLElement): HTMLElement[] {
|
|
199
|
-
return Array.from(root.querySelectorAll<HTMLElement>(`[${
|
|
235
|
+
return Array.from(root.querySelectorAll<HTMLElement>(`[${KIT_ATTR_REMOVE}]`));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function rootClassFor(p: KitProps): string {
|
|
239
|
+
const size = kitControlSizeOf(p, kitReadProps(p));
|
|
240
|
+
const disabled = bool(p.disabled);
|
|
241
|
+
const base = disabled ? ROOT_DISABLED_CLASS[size] : ROOT_CLASS[size];
|
|
242
|
+
return joinClass(withInvalid(base, bool(p.invalid) && !disabled), p.class);
|
|
200
243
|
}
|
|
201
244
|
|
|
202
245
|
function paint(root: HTMLElement, p: KitProps, ui: Ui): void {
|
|
203
246
|
const options = optionsOf(p.options);
|
|
204
247
|
const values = valuesOf(p.value);
|
|
205
248
|
const editable = canEdit(p);
|
|
206
|
-
|
|
207
|
-
root.className =
|
|
208
|
-
// 质感标记:根是带边框的输入外壳(field),里面的 input
|
|
249
|
+
kitMarkDataState(root, bool(p.readonly) ? 'readonly' : 'normal');
|
|
250
|
+
root.className = rootClassFor(p);
|
|
251
|
+
// 质感标记:根是带边框的输入外壳(field),里面的 input 与芯片不标,避免焦点探测误把芯片当外框
|
|
209
252
|
setKitFace(root, 'field');
|
|
210
253
|
root.setAttribute('role', 'group');
|
|
211
254
|
setAttr(root, 'aria-label', str(p.aria_label));
|
|
212
255
|
// 标签:每次重建(数量小),输入框与面板元素保持不变以保住焦点与输入法状态
|
|
213
|
-
for (const old of Array.from(root.querySelectorAll(`[${
|
|
256
|
+
for (const old of Array.from(root.querySelectorAll(`[${KIT_ATTR_TOKEN}]`))) old.remove();
|
|
214
257
|
values.forEach((v, index) => {
|
|
215
258
|
const token = document.createElement('span');
|
|
216
|
-
token.setAttribute(
|
|
259
|
+
token.setAttribute(KIT_ATTR_TOKEN, String(index));
|
|
217
260
|
token.className = TOKEN_CLASS;
|
|
218
|
-
|
|
261
|
+
// 已录入的每一枚标签是这个控件的值
|
|
262
|
+
kitReportSelf(token, { part: 'value' });
|
|
219
263
|
const text = document.createElement('span');
|
|
264
|
+
text.className = TOKEN_TEXT_CLASS;
|
|
220
265
|
text.textContent = labelOf(options, v);
|
|
221
266
|
token.appendChild(text);
|
|
222
267
|
if (editable) {
|
|
223
268
|
const rm = document.createElement('button');
|
|
224
269
|
rm.type = 'button';
|
|
225
270
|
rm.tabIndex = -1;
|
|
226
|
-
rm.setAttribute(
|
|
271
|
+
rm.setAttribute(KIT_ATTR_REMOVE, String(index));
|
|
227
272
|
rm.setAttribute('aria-label', kitText('soma.kit.remove_named', { name: v }, root));
|
|
228
273
|
rm.className = REMOVE_CLASS;
|
|
229
274
|
rm.appendChild(kitIcon('close', 'xs'));
|
|
@@ -231,12 +276,28 @@ function paint(root: HTMLElement, p: KitProps, ui: Ui): void {
|
|
|
231
276
|
}
|
|
232
277
|
root.insertBefore(token, ui.input);
|
|
233
278
|
});
|
|
279
|
+
const disabled = bool(p.disabled);
|
|
280
|
+
ui.input.className = !editable && values.length > 0 ? INPUT_LOCKED_CLASS : INPUT_CLASS;
|
|
234
281
|
ui.input.placeholder = values.length === 0 ? str(p.placeholder) : '';
|
|
235
|
-
applyDisabled(ui.input,
|
|
282
|
+
applyDisabled(ui.input, disabled);
|
|
236
283
|
setBoolAttr(ui.input, 'readonly', bool(p.readonly));
|
|
237
284
|
if (bool(p.readonly)) ui.input.setAttribute('aria-readonly', 'true'); else ui.input.removeAttribute('aria-readonly');
|
|
238
285
|
const ariaLabel = str(p.aria_label) === '' ? str(p.placeholder, kitText('soma.kit.ti_placeholder', undefined, root)) : str(p.aria_label);
|
|
239
|
-
|
|
286
|
+
const name = str(p.name);
|
|
287
|
+
applyCommon(ui.input, { ...p, name: '', aria_label: ariaLabel });
|
|
288
|
+
if (name !== '') {
|
|
289
|
+
if (ui.hidden === null) {
|
|
290
|
+
ui.hidden = document.createElement('input');
|
|
291
|
+
ui.hidden.type = 'hidden';
|
|
292
|
+
root.appendChild(ui.hidden);
|
|
293
|
+
}
|
|
294
|
+
setAttr(ui.hidden, 'name', name);
|
|
295
|
+
ui.hidden.value = values.join(',');
|
|
296
|
+
ui.hidden.disabled = disabled;
|
|
297
|
+
} else if (ui.hidden !== null) {
|
|
298
|
+
ui.hidden.remove();
|
|
299
|
+
ui.hidden = null;
|
|
300
|
+
}
|
|
240
301
|
if (!editable) ui.open = false;
|
|
241
302
|
paintPanel(ui, p);
|
|
242
303
|
if (ui.pendingFocus !== null) {
|
|
@@ -258,14 +319,18 @@ function buildUi(root: HTMLElement, api: KitApi): Ui {
|
|
|
258
319
|
input.setAttribute('autocomplete', 'off');
|
|
259
320
|
const listId = nextUid('kit-taginput-list');
|
|
260
321
|
input.setAttribute('aria-controls', listId);
|
|
322
|
+
const focusRing = document.createElement('span');
|
|
323
|
+
focusRing.setAttribute('aria-hidden', 'true');
|
|
324
|
+
focusRing.className = FOCUS_RING_OVERLAY_CLASS;
|
|
261
325
|
const panel = document.createElement('div');
|
|
262
326
|
panel.id = listId;
|
|
263
327
|
panel.setAttribute('role', 'listbox');
|
|
264
328
|
panel.className = PANEL_HIDDEN_CLASS;
|
|
265
329
|
root.appendChild(input);
|
|
330
|
+
root.appendChild(focusRing);
|
|
266
331
|
root.appendChild(panel);
|
|
267
332
|
const ui: Ui = {
|
|
268
|
-
input, panel, listId, open: false, cursor: null, composing: false, pendingFocus: null, api,
|
|
333
|
+
input, focusRing, hidden: null, panel, listId, open: false, cursor: null, composing: false, pendingFocus: null, api,
|
|
269
334
|
nav: createListNav({
|
|
270
335
|
host: () => panel,
|
|
271
336
|
textFocus: true,
|
|
@@ -311,9 +376,9 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
311
376
|
attach(root, api) {
|
|
312
377
|
const ui = buildUi(root, api);
|
|
313
378
|
uis.set(root, ui);
|
|
314
|
-
const { input, panel } = ui;
|
|
379
|
+
const { input, focusRing, panel } = ui;
|
|
315
380
|
|
|
316
|
-
const refreshPanel = (): void => paintPanel(ui, api.props());
|
|
381
|
+
const refreshPanel = (immediate = false): void => paintPanel(ui, api.props(), immediate);
|
|
317
382
|
const onInput = (event: Event): void => {
|
|
318
383
|
const p = api.props();
|
|
319
384
|
if (!canEdit(p) || ui.composing || (event as InputEvent).isComposing) return;
|
|
@@ -336,18 +401,24 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
336
401
|
const seps = separatorsOf(p);
|
|
337
402
|
if (!Array.from(pasted).some((ch) => seps.includes(ch))) return;
|
|
338
403
|
event.preventDefault();
|
|
339
|
-
|
|
404
|
+
const selStart = input.selectionStart ?? input.value.length;
|
|
405
|
+
const selEnd = input.selectionEnd ?? input.value.length;
|
|
406
|
+
const merged = `${input.value.slice(0, selStart)}${pasted}${input.value.slice(selEnd)}`;
|
|
407
|
+
input.value = merged;
|
|
408
|
+
const nextPos = selStart + pasted.length;
|
|
409
|
+
try { input.setSelectionRange(nextPos, nextPos); } catch { /* ignore */ }
|
|
410
|
+
addTexts(ui, splitText(merged, seps), false);
|
|
340
411
|
};
|
|
341
412
|
const onInputKeydown = (event: KeyboardEvent): void => {
|
|
342
413
|
const p = api.props();
|
|
343
|
-
if (!canEdit(p) || event
|
|
414
|
+
if (!canEdit(p) || isImeComposing(event) || ui.composing) return;
|
|
344
415
|
if (event.key === 'Escape') {
|
|
345
416
|
if (ui.open) {
|
|
346
417
|
event.preventDefault();
|
|
347
418
|
event.stopPropagation();
|
|
348
419
|
ui.open = false;
|
|
349
420
|
ui.cursor = null;
|
|
350
|
-
refreshPanel();
|
|
421
|
+
refreshPanel(true);
|
|
351
422
|
}
|
|
352
423
|
return;
|
|
353
424
|
}
|
|
@@ -389,7 +460,7 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
389
460
|
};
|
|
390
461
|
// 标签上的键盘:←→ 在标签间走,Backspace / Delete 删除,越过末尾回输入框
|
|
391
462
|
const onRootKeydown = (event: KeyboardEvent): void => {
|
|
392
|
-
const hit = (event.target as HTMLElement | null)?.closest<HTMLElement>(`[${
|
|
463
|
+
const hit = (event.target as HTMLElement | null)?.closest<HTMLElement>(`[${KIT_ATTR_REMOVE}]`);
|
|
393
464
|
if (!hit) return;
|
|
394
465
|
const buttons = removeButtons(root);
|
|
395
466
|
const index = buttons.indexOf(hit);
|
|
@@ -408,9 +479,9 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
408
479
|
};
|
|
409
480
|
const onRootClick = (event: Event): void => {
|
|
410
481
|
const target = event.target as HTMLElement | null;
|
|
411
|
-
const rm = target?.closest<HTMLElement>(`[${
|
|
482
|
+
const rm = target?.closest<HTMLElement>(`[${KIT_ATTR_REMOVE}]`);
|
|
412
483
|
if (rm) {
|
|
413
|
-
removeAt(ui, Number(rm.getAttribute(
|
|
484
|
+
removeAt(ui, Number(rm.getAttribute(KIT_ATTR_REMOVE)));
|
|
414
485
|
return;
|
|
415
486
|
}
|
|
416
487
|
// 点空白处把焦点交给输入框
|
|
@@ -418,8 +489,8 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
418
489
|
};
|
|
419
490
|
// 建议行的点选听在面板自己上:面板挂到浮层端口后不再是 root 的后代,root 的委托收不到
|
|
420
491
|
const onPanelClick = (event: Event): void => {
|
|
421
|
-
const row = (event.target as HTMLElement | null)?.closest<HTMLElement>(
|
|
422
|
-
const key = row?.getAttribute(
|
|
492
|
+
const row = (event.target as HTMLElement | null)?.closest<HTMLElement>(`[${KIT_ATTR_KEY}]`);
|
|
493
|
+
const key = row?.getAttribute(KIT_ATTR_KEY);
|
|
423
494
|
if (key === null || key === undefined) return;
|
|
424
495
|
const hit = optionsOf(api.props().options).find((o) => String(o.value) === key);
|
|
425
496
|
if (hit && !hit.disabled) addTexts(ui, [key], true);
|
|
@@ -455,6 +526,9 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
455
526
|
panel.removeEventListener('click', onPanelClick);
|
|
456
527
|
uis.delete(root);
|
|
457
528
|
input.remove();
|
|
529
|
+
focusRing.remove();
|
|
530
|
+
ui.hidden?.remove();
|
|
531
|
+
ui.hidden = null;
|
|
458
532
|
releaseDropdown(panel, false);
|
|
459
533
|
panel.remove();
|
|
460
534
|
};
|
|
@@ -463,6 +537,6 @@ export function createTagInput(): SomaComponentDefinition {
|
|
|
463
537
|
const ui = uis.get(root);
|
|
464
538
|
if (ui) paint(root, p, ui);
|
|
465
539
|
},
|
|
466
|
-
})),
|
|
540
|
+
}), { self: { level: 'control' } }),
|
|
467
541
|
};
|
|
468
542
|
}
|