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/virtual-rows.ts
CHANGED
|
@@ -20,13 +20,17 @@
|
|
|
20
20
|
// 窗口起点向下取偶数,保证斑马纹(nth-child 的 even)的奇偶不随窗口位置翻转。
|
|
21
21
|
// 卸载:摘事件、释放虚拟化器(观察者随之清掉)。
|
|
22
22
|
|
|
23
|
+
import { kitApplyLevelClass } from './level-class';
|
|
23
24
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
25
|
+
import { KIT_FOCUS_RING } from '../recipes/state';
|
|
24
26
|
import { createKeyboardWiring, type CollectionItem } from 'soma-core/keyboard';
|
|
25
27
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
26
|
-
import { TAG_CLASS } from '../base/tag';
|
|
27
|
-
import {
|
|
28
|
+
import { DOT_CORE, DOT_ROOT, DOT_TEXT, DOT_WRAP, TAG_CLASS } from '../base/tag';
|
|
29
|
+
import { KIT_CELL_VALUE_CLASS_CANDIDATES, kitCellValueNode, kitCellValuePlan, type KitCellValuePlan } from './cell-value';
|
|
30
|
+
import { kitRowKey } from '../shared/row-key';
|
|
31
|
+
import { permissionCheckerOf, registerLivePermissionGate } from '../base/permission-gate';
|
|
28
32
|
import { KIT_CHECK_CLASS_CANDIDATES, attachMarkEvents, createCheck, markChecked, paintCheck, setMarkLabel } from '../base/check-core';
|
|
29
|
-
import { CLASS_PROP, bool, createKitController,
|
|
33
|
+
import { CLASS_PROP, bool, createKitController, joinClass, str } from '../base/shared';
|
|
30
34
|
import { kitLocaleAt } from '../i18n/kit-text';
|
|
31
35
|
import {
|
|
32
36
|
KIT_VIRTUAL_CLASS_CANDIDATES, KIT_VIRTUAL_LABELS, KIT_VIRTUAL_ROW_CLASS, virtualRowPx,
|
|
@@ -37,12 +41,24 @@ import { KIT_ROW_TONE_CLASS, rowToneClass } from '../object-renderer/view-bindin
|
|
|
37
41
|
import { isKitActionBusy, onKitActionBusy } from '../base/action-busy';
|
|
38
42
|
import type { KitTableDensity } from '../object-renderer/defaults';
|
|
39
43
|
import { KIT_ACTION_SLOT_BASE, actionSlotEmits, emitActionSlot } from '../base/action-slots';
|
|
44
|
+
import { KIT_PART_TABLE_ROW } from '../recipes/table-row';
|
|
45
|
+
import { kitStripBoundaryClasses } from '../recipes/divider';
|
|
46
|
+
import {
|
|
47
|
+
KIT_ATTR_ACT, KIT_ATTR_COL, KIT_ATTR_DENSE, KIT_ATTR_EDIT_CONTROL, KIT_ATTR_EDITABLE, KIT_ATTR_ELLIPSIS, KIT_ATTR_INDEX,
|
|
48
|
+
KIT_ATTR_KEY, KIT_ATTR_MARK, KIT_ATTR_PART, KIT_ATTR_ROOMY, KIT_ATTR_ROW, KIT_ATTR_ROWS, KIT_ATTR_SEL, KIT_ATTR_SELECTED, KIT_ATTR_TABLE,
|
|
49
|
+
KIT_ATTR_VSCROLL, kitAttrSel,
|
|
50
|
+
} from '../shared/dom-attrs';
|
|
51
|
+
import {
|
|
52
|
+
kitActionPropsOf, kitFieldPropsOf, kitHasOwnOverflow, kitMarkDataFacts, kitMarkLevel, kitMarkPart, kitMarkPicked, kitMergeAlignOverflow,
|
|
53
|
+
} from './kit-contract';
|
|
54
|
+
import { createKitRowConfirm } from './row-confirm';
|
|
40
55
|
|
|
41
56
|
const ROOT_CLASS = 'flex flex-col focus-visible:outline-none';
|
|
42
57
|
const SPACER_CLASS = 'w-full';
|
|
43
58
|
const TEXT_CLASS = 'block min-w-0 truncate text-sm text-fg';
|
|
59
|
+
const TEXT_BASE_CLASS = 'block min-w-0 text-sm text-fg';
|
|
44
60
|
const ACTIONS_CELL_CLASS = 'flex flex-nowrap items-center justify-end gap-x-4 whitespace-nowrap';
|
|
45
|
-
const ROW_FOCUS_CLASS = 'scroll-mt-10
|
|
61
|
+
const ROW_FOCUS_CLASS = 'scroll-mt-10 ' + KIT_FOCUS_RING.item;
|
|
46
62
|
const ROW_PICK_CLASS = 'cursor-pointer';
|
|
47
63
|
|
|
48
64
|
export const KIT_VIRTUAL_ROWS_CLASS_CANDIDATES: readonly string[] = Object.freeze([...new Set([
|
|
@@ -50,7 +66,9 @@ export const KIT_VIRTUAL_ROWS_CLASS_CANDIDATES: readonly string[] = Object.freez
|
|
|
50
66
|
...KIT_VIRTUAL_CLASS_CANDIDATES,
|
|
51
67
|
...Object.values(ROW_ACTION_BUTTON_CLASS),
|
|
52
68
|
...Object.values(TAG_CLASS.md),
|
|
69
|
+
DOT_ROOT.md, DOT_WRAP.md, ...Object.values(DOT_TEXT), ...Object.values(DOT_CORE),
|
|
53
70
|
...Object.values(KIT_ROW_TONE_CLASS),
|
|
71
|
+
...KIT_CELL_VALUE_CLASS_CANDIDATES,
|
|
54
72
|
].flatMap((s) => s.split(/\s+/).filter((c) => c !== '')))].sort());
|
|
55
73
|
|
|
56
74
|
type Rec = Record<string, unknown>;
|
|
@@ -105,17 +123,9 @@ function actionsOf(raw: unknown): ActionItem[] {
|
|
|
105
123
|
return out;
|
|
106
124
|
}
|
|
107
125
|
|
|
126
|
+
/** bordered: false 剥边界类:只经分隔线出口的剥离函数(KT-B8 第 4 点,一个决定一个出口) */
|
|
108
127
|
function stripBorderClasses(cls: string): string {
|
|
109
|
-
return cls
|
|
110
|
-
.split(/\s+/)
|
|
111
|
-
.filter((t) => t !== "" && t !== "border" && t !== "border-b" && t !== "border-e" && t !== "not-last:border-e" && !t.startsWith("border-border") && !t.startsWith("not-last:border-border"))
|
|
112
|
-
.join(" ");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function rowKeyOf(row: unknown, keyField: string): string {
|
|
116
|
-
if (!isRec(row)) return '';
|
|
117
|
-
const v = row[keyField];
|
|
118
|
-
return keyField !== '' && v !== undefined && v !== null ? String(v) : JSON.stringify(row);
|
|
128
|
+
return kitStripBoundaryClasses(cls);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
/** 文本里的 {n} 占位 */
|
|
@@ -181,14 +191,23 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
181
191
|
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
|
|
182
192
|
controllerFactory: createKitController((api) => {
|
|
183
193
|
const P = (): Rec => api.props();
|
|
184
|
-
|
|
194
|
+
let renderedPerm = '';
|
|
195
|
+
const permStateOf = (p: Rec): string => {
|
|
196
|
+
const list = actionsOf(p.actions);
|
|
197
|
+
if (!list.some((a) => a.permission !== '')) return '';
|
|
198
|
+
const check = permissionCheckerOf(api as unknown as any);
|
|
199
|
+
return list.map((a) => (a.permission !== '' && check !== null ? (check(a.permission) ? '1' : '0') : '-')).join('');
|
|
200
|
+
};
|
|
185
201
|
let root: HTMLElement | null = null;
|
|
186
202
|
let top: HTMLElement | null = null;
|
|
187
203
|
let bottom: HTMLElement | null = null;
|
|
188
204
|
let win: VirtualWindow | null = null;
|
|
189
205
|
let rows: Rec[] = [];
|
|
190
206
|
let rowsRef: unknown = null;
|
|
191
|
-
let
|
|
207
|
+
let schemaSig = '';
|
|
208
|
+
let windowSig = '';
|
|
209
|
+
let selectedSet = new Set<string>();
|
|
210
|
+
let selectedKeyField = '';
|
|
192
211
|
let cursor = 0;
|
|
193
212
|
let pendingFocus: number | null = null;
|
|
194
213
|
let offs: Array<() => void> = [];
|
|
@@ -204,7 +223,7 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
204
223
|
};
|
|
205
224
|
/** 承载 aria-rowcount / colcount 的 grid:外壳内层,没有就是根自己 */
|
|
206
225
|
const gridEl = (): HTMLElement => (root?.parentElement?.closest<HTMLElement>('[role="grid"]') ?? root ?? api.host);
|
|
207
|
-
const scroller = (): HTMLElement | null => api.host.closest<HTMLElement>(
|
|
226
|
+
const scroller = (): HTMLElement | null => api.host.closest<HTMLElement>(kitAttrSel(KIT_ATTR_VSCROLL));
|
|
208
227
|
const cells = (): CellDef[] => cellsOf(P().cells);
|
|
209
228
|
const mode = (): string => str(P().select, 'none');
|
|
210
229
|
/**
|
|
@@ -213,17 +232,17 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
213
232
|
*/
|
|
214
233
|
const densityNow = (): KitTableDensity => {
|
|
215
234
|
const sc = scroller();
|
|
216
|
-
if (sc !== null && sc.hasAttribute(
|
|
217
|
-
return sc.hasAttribute(
|
|
235
|
+
if (sc !== null && sc.hasAttribute(KIT_ATTR_TABLE)) {
|
|
236
|
+
return sc.hasAttribute(KIT_ATTR_DENSE) ? 'compact' : sc.hasAttribute(KIT_ATTR_ROOMY) ? 'spacious' : 'standard';
|
|
218
237
|
}
|
|
219
|
-
return '
|
|
238
|
+
return 'standard';
|
|
220
239
|
};
|
|
221
240
|
/** 有效行高档:rowHeight 是标准密度的档位,紧凑下移一档、宽松上移一档(夹在 sm..lg 内) */
|
|
222
241
|
const tier = (): KitRowTier => {
|
|
223
242
|
const base = rowTierOf(P().rowHeight);
|
|
224
243
|
const at = KIT_ROW_TIERS.indexOf(base);
|
|
225
244
|
const d = densityNow();
|
|
226
|
-
const shifted = d === '
|
|
245
|
+
const shifted = d === 'compact' ? at - 1 : d === 'spacious' ? at + 1 : at;
|
|
227
246
|
return KIT_ROW_TIERS[Math.max(0, Math.min(KIT_ROW_TIERS.length - 1, shifted))]!;
|
|
228
247
|
};
|
|
229
248
|
let appliedTier: KitRowTier | null = null;
|
|
@@ -248,15 +267,21 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
248
267
|
observedScroller = sc;
|
|
249
268
|
if (sc !== null && typeof MutationObserver === 'function') {
|
|
250
269
|
densityObserver = new MutationObserver(() => syncTier());
|
|
251
|
-
densityObserver.observe(sc, { attributes: true, attributeFilter: [
|
|
270
|
+
densityObserver.observe(sc, { attributes: true, attributeFilter: [KIT_ATTR_DENSE, KIT_ATTR_ROOMY] });
|
|
252
271
|
}
|
|
253
272
|
};
|
|
254
273
|
|
|
255
|
-
const
|
|
274
|
+
const rebuildSelectedSet = (): void => {
|
|
256
275
|
const sel = P().selected;
|
|
257
276
|
const kf = str(P().keyField);
|
|
258
|
-
|
|
277
|
+
selectedKeyField = kf;
|
|
278
|
+
if (!Array.isArray(sel) || sel.length === 0) {
|
|
279
|
+
selectedSet = new Set();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
selectedSet = new Set(sel.map((r) => kitRowKey(r, kf)));
|
|
259
283
|
};
|
|
284
|
+
const isPicked = (row: Rec): boolean => selectedSet.has(kitRowKey(row, selectedKeyField));
|
|
260
285
|
/** 本行删除在途:协调组件经忙闲通道登记(作用域 + 对象 + 行主键三段),与 KitTableActions 同一条规则 */
|
|
261
286
|
const rowBusy = (row: Rec): boolean => {
|
|
262
287
|
const p = P();
|
|
@@ -284,11 +309,11 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
284
309
|
const busy = rowBusy(row);
|
|
285
310
|
if (fresh ? !busy : (el.getAttribute('aria-busy') === 'true') === busy) return;
|
|
286
311
|
if (busy) el.setAttribute('aria-busy', 'true'); else el.removeAttribute('aria-busy');
|
|
287
|
-
for (const btn of Array.from(el.querySelectorAll<HTMLButtonElement>(
|
|
312
|
+
for (const btn of Array.from(el.querySelectorAll<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACT)))) {
|
|
288
313
|
btn.disabled = busy;
|
|
289
314
|
if (busy) btn.setAttribute('aria-disabled', 'true'); else btn.removeAttribute('aria-disabled');
|
|
290
315
|
}
|
|
291
|
-
const box = el.querySelector<HTMLElement>(
|
|
316
|
+
const box = el.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SEL));
|
|
292
317
|
if (box) paintCheck(box, { checked: markChecked(box), disabled: busy });
|
|
293
318
|
};
|
|
294
319
|
const emitSelect = (row: Rec, checked: boolean): void => {
|
|
@@ -302,78 +327,143 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
302
327
|
api.emit('row_pick', { kit_action: 'select', id: 'select', name: '', builtin: 'select', target: '', row, ...objectPayload() });
|
|
303
328
|
};
|
|
304
329
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
330
|
+
interface PreparedCell {
|
|
331
|
+
readonly def: CellDef;
|
|
332
|
+
readonly cellClass: string;
|
|
333
|
+
/** 值呈现计划(与树表同一个函数 data/cell-value.ts:选项映射、格式、占位、分类色表、页面线判定) */
|
|
334
|
+
readonly value: KitCellValuePlan;
|
|
335
|
+
readonly textClass: string;
|
|
336
|
+
}
|
|
337
|
+
interface PreparedAction {
|
|
338
|
+
readonly id: string;
|
|
339
|
+
readonly name: string;
|
|
340
|
+
readonly btnClass: string;
|
|
341
|
+
}
|
|
342
|
+
interface RowRenderPlan {
|
|
343
|
+
readonly baseRowClass: string;
|
|
344
|
+
readonly toneField: string;
|
|
345
|
+
readonly mode: string;
|
|
346
|
+
readonly selectClass: string;
|
|
347
|
+
readonly cells: readonly PreparedCell[];
|
|
348
|
+
readonly hasActionsCol: boolean;
|
|
349
|
+
readonly actionsClass: string;
|
|
350
|
+
readonly actions: readonly PreparedAction[];
|
|
351
|
+
}
|
|
315
352
|
|
|
316
|
-
|
|
353
|
+
/** 单次 reconcile / 渲染批次的列与动作预计算计划:把 kitFieldPropsOf / kitActionPropsOf / optionsMapOf / kitLocaleAt / mergeClass 从 O(R·C) 行×列热循环提至 O(C) */
|
|
354
|
+
const createRowPlan = (): RowRenderPlan => {
|
|
317
355
|
const p = P();
|
|
318
|
-
const
|
|
319
|
-
const
|
|
356
|
+
const m = mode();
|
|
357
|
+
const borderless = p.bordered === false;
|
|
358
|
+
const baseRowClass = [
|
|
320
359
|
withoutPy(str(p.rowClass)), str(p.stripeClass), KIT_VIRTUAL_ROW_CLASS[tier()], 'items-center', ROW_FOCUS_CLASS,
|
|
321
360
|
bool(p.pickOnRow) ? ROW_PICK_CLASS : '',
|
|
322
|
-
// 行样式档位:行内容变了(含档位字段值变了)整行重建(见 syncRows 的签名),类串建行时现算,无旧档位残留
|
|
323
|
-
toneField === '' ? '' : rowToneClass(row[toneField]),
|
|
324
361
|
].filter((s) => s !== '').join(' ');
|
|
325
|
-
|
|
362
|
+
const rawSelect = m === 'single' || m === 'multi' ? withoutPy(str(p.selectClass)) : '';
|
|
363
|
+
const selectClass = borderless ? stripBorderClasses(rawSelect) : rawSelect;
|
|
364
|
+
const hostLocale = kitLocaleAt(api.host) || 'zh-CN';
|
|
365
|
+
const preparedCells: PreparedCell[] = [];
|
|
366
|
+
for (const col of cells()) {
|
|
367
|
+
const rawCell = withoutPy(col.cellClass);
|
|
368
|
+
const baseCellClass = borderless ? stripBorderClasses(rawCell) : rawCell;
|
|
369
|
+
const fk = kitFieldPropsOf(p, col.field);
|
|
370
|
+
const ownValOverflow = kitHasOwnOverflow(col.valueClass);
|
|
371
|
+
const ownCellOverflow = kitHasOwnOverflow(baseCellClass);
|
|
372
|
+
const cellClass = kitMergeAlignOverflow(baseCellClass, fk.align, ownValOverflow ? undefined : fk.overflow);
|
|
373
|
+
const textClass = ownValOverflow
|
|
374
|
+
? joinClass(TEXT_BASE_CLASS, col.valueClass)
|
|
375
|
+
: ownCellOverflow
|
|
376
|
+
? joinClass(/(?:^|\s)(?:[a-z0-9*@[\]=_/.-]+:)*truncate(?=\s|$)/.test(baseCellClass) ? TEXT_CLASS : TEXT_BASE_CLASS, col.valueClass)
|
|
377
|
+
: fk.overflow !== undefined && fk.overflow !== 'truncate' && fk.overflow !== 'middle'
|
|
378
|
+
? joinClass(kitMergeAlignOverflow(TEXT_BASE_CLASS, undefined, fk.overflow), col.valueClass)
|
|
379
|
+
: joinClass(TEXT_CLASS, col.valueClass);
|
|
380
|
+
preparedCells.push({
|
|
381
|
+
def: col,
|
|
382
|
+
cellClass,
|
|
383
|
+
value: kitCellValuePlan(col, fk, api.host, hostLocale),
|
|
384
|
+
textClass,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
const allActions = actionsOf(p.actions);
|
|
388
|
+
const hasActionsCol = allActions.length > 0;
|
|
389
|
+
const rawActionsClass = hasActionsCol ? withoutPy(str(p.actionsClass)) : '';
|
|
390
|
+
const actionsClass = borderless ? stripBorderClasses(rawActionsClass) : rawActionsClass;
|
|
391
|
+
const check = permissionCheckerOf(api as unknown as any);
|
|
392
|
+
const permitted = hasActionsCol
|
|
393
|
+
? allActions.filter((a) => (a.permission === '' || check === null || check(a.permission)))
|
|
394
|
+
: [];
|
|
395
|
+
const ranks = rowActionRanks(permitted);
|
|
396
|
+
const preparedActions: PreparedAction[] = permitted.map((a, at) => {
|
|
397
|
+
// 动作级判定的语义色调:只升不降——页面线判危险时升为危险档,否则保持动作自己的 tone 推的档(SCON-128 B4)
|
|
398
|
+
const rank = kitActionPropsOf(p, a.id).tone === 'danger' ? 'danger' : ranks[at]!;
|
|
399
|
+
return { id: a.id, name: a.name, btnClass: ROW_ACTION_BUTTON_CLASS[rank] };
|
|
400
|
+
});
|
|
401
|
+
return {
|
|
402
|
+
baseRowClass,
|
|
403
|
+
toneField: str(p.rowToneField),
|
|
404
|
+
mode: m,
|
|
405
|
+
selectClass,
|
|
406
|
+
cells: preparedCells,
|
|
407
|
+
hasActionsCol,
|
|
408
|
+
actionsClass,
|
|
409
|
+
actions: preparedActions,
|
|
410
|
+
};
|
|
326
411
|
};
|
|
327
412
|
|
|
328
|
-
|
|
329
|
-
|
|
413
|
+
/** 单元格内容:与树表同一个函数(data/cell-value.ts),走预计算的选项 O(1) 映射;表体没有复制钮的事件接线,copyable 按缺省正文画 */
|
|
414
|
+
const cellContent = (cell: PreparedCell, row: Rec): HTMLElement =>
|
|
415
|
+
kitCellValueNode({ doc: doc(), host: api.host, copy: false }, cell.value, row[cell.def.field], cell.textClass);
|
|
416
|
+
|
|
417
|
+
const buildRow = (index: number, plan: RowRenderPlan): HTMLElement => {
|
|
330
418
|
const row = rows[index] ?? {};
|
|
331
|
-
const
|
|
419
|
+
const toneCls = plan.toneField === '' ? '' : rowToneClass(row[plan.toneField]);
|
|
420
|
+
const rowCls = toneCls === '' ? plan.baseRowClass : (plan.baseRowClass === '' ? toneCls : `${plan.baseRowClass} ${toneCls}`);
|
|
421
|
+
const el = mk('div', rowCls);
|
|
332
422
|
el.setAttribute('role', 'row');
|
|
333
423
|
el.setAttribute('aria-rowindex', String(index + 2));
|
|
334
|
-
el.setAttribute(
|
|
335
|
-
|
|
336
|
-
el
|
|
424
|
+
el.setAttribute(KIT_ATTR_PART, KIT_PART_TABLE_ROW);
|
|
425
|
+
// 行 = 条目;部件位已被存量 table-row 占用(虚拟行定高的结构规则按它命中),kitMarkLevel 不覆盖
|
|
426
|
+
kitMarkLevel(el, 'item', 'line'); kitApplyLevelClass(el);
|
|
427
|
+
el.setAttribute(KIT_ATTR_ROW, '');
|
|
428
|
+
el.setAttribute(KIT_ATTR_INDEX, String(index));
|
|
429
|
+
el.setAttribute(KIT_ATTR_KEY, String(index));
|
|
337
430
|
el.tabIndex = index === cursor ? 0 : -1;
|
|
338
|
-
const m = mode
|
|
431
|
+
const m = plan.mode;
|
|
339
432
|
const picked = isPicked(row);
|
|
340
433
|
if (m !== 'none') el.setAttribute('aria-selected', picked ? 'true' : 'false');
|
|
341
|
-
if (picked) el.setAttribute(
|
|
434
|
+
if (picked) el.setAttribute(KIT_ATTR_SELECTED, '');
|
|
435
|
+
// 选中行交互状态自报;aria-selected 已按选择模式写在上一行
|
|
436
|
+
kitMarkPicked(el, 'selected', picked, null);
|
|
342
437
|
if (m === 'single' || m === 'multi') {
|
|
343
|
-
const
|
|
344
|
-
const selectClass = p.bordered === false ? stripBorderClasses(rawSelect) : rawSelect;
|
|
345
|
-
const cell = mk('div', selectClass);
|
|
438
|
+
const cell = mk('div', plan.selectClass);
|
|
346
439
|
cell.setAttribute('role', 'gridcell');
|
|
347
440
|
const box = createCheck(doc(), m === 'single' ? 'radio' : 'checkbox', { checked: picked });
|
|
348
|
-
box.setAttribute(
|
|
441
|
+
box.setAttribute(KIT_ATTR_SEL, '');
|
|
349
442
|
setMarkLabel(box, fill(KIT_VIRTUAL_LABELS.rowSelect ?? '', index + 1));
|
|
350
443
|
cell.appendChild(box);
|
|
351
444
|
el.appendChild(cell);
|
|
352
445
|
}
|
|
353
|
-
for (const col of cells
|
|
354
|
-
const
|
|
355
|
-
const cellClass = p.bordered === false ? stripBorderClasses(rawCell) : rawCell;
|
|
356
|
-
const cell = mk('div', cellClass);
|
|
446
|
+
for (const col of plan.cells) {
|
|
447
|
+
const cell = mk('div', col.cellClass);
|
|
357
448
|
cell.setAttribute('role', 'gridcell');
|
|
358
|
-
cell.setAttribute(
|
|
359
|
-
|
|
360
|
-
if (col.
|
|
449
|
+
cell.setAttribute(KIT_ATTR_COL, col.def.field);
|
|
450
|
+
kitMarkPart(cell, 'cell');
|
|
451
|
+
if (col.def.ellipsis) cell.setAttribute(KIT_ATTR_ELLIPSIS, '');
|
|
452
|
+
if (col.def.editable) cell.setAttribute(KIT_ATTR_EDITABLE, '');
|
|
361
453
|
cell.appendChild(cellContent(col, row));
|
|
362
454
|
el.appendChild(cell);
|
|
363
455
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const rawActions = withoutPy(str(p.actionsClass));
|
|
367
|
-
const actionsClass = p.bordered === false ? stripBorderClasses(rawActions) : rawActions;
|
|
368
|
-
const cell = mk('div', actionsClass);
|
|
456
|
+
if (plan.hasActionsCol) {
|
|
457
|
+
const cell = mk('div', plan.actionsClass);
|
|
369
458
|
cell.setAttribute('role', 'gridcell');
|
|
459
|
+
kitMarkPart(cell, 'cell');
|
|
370
460
|
const box = mk('div', ACTIONS_CELL_CLASS);
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
const btn = mk('button', ROW_ACTION_BUTTON_CLASS[ranks[at]!], a.name);
|
|
461
|
+
for (const a of plan.actions) {
|
|
462
|
+
const btn = mk('button', a.btnClass, a.name);
|
|
374
463
|
btn.setAttribute('type', 'button');
|
|
464
|
+
kitMarkPart(btn, 'action');
|
|
375
465
|
// 行动作:文字链接形态(无面,不标 raised)
|
|
376
|
-
btn.setAttribute(
|
|
466
|
+
btn.setAttribute(KIT_ATTR_ACT, a.id);
|
|
377
467
|
box.appendChild(btn);
|
|
378
468
|
}
|
|
379
469
|
cell.appendChild(box);
|
|
@@ -388,14 +478,20 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
388
478
|
rendered.clear();
|
|
389
479
|
};
|
|
390
480
|
|
|
391
|
-
/** 选中态刷新(不重建行):data-kit-selected / aria-selected /
|
|
481
|
+
/** 选中态刷新(不重建行):data-kit-selected / aria-selected / 勾选框,带脏检查避免无谓 DOM 写 */
|
|
392
482
|
const refreshSelection = (): void => {
|
|
483
|
+
const m = mode();
|
|
393
484
|
for (const [i, el] of rendered) {
|
|
394
485
|
const row = rows[i] ?? {};
|
|
395
486
|
const picked = isPicked(row);
|
|
396
|
-
if (picked) el.
|
|
397
|
-
if (
|
|
398
|
-
|
|
487
|
+
if (picked) { if (!el.hasAttribute(KIT_ATTR_SELECTED)) el.setAttribute(KIT_ATTR_SELECTED, ''); }
|
|
488
|
+
else if (el.hasAttribute(KIT_ATTR_SELECTED)) el.removeAttribute(KIT_ATTR_SELECTED);
|
|
489
|
+
if (m !== 'none') {
|
|
490
|
+
const nextAria = picked ? 'true' : 'false';
|
|
491
|
+
if (el.getAttribute('aria-selected') !== nextAria) el.setAttribute('aria-selected', nextAria);
|
|
492
|
+
}
|
|
493
|
+
kitMarkPicked(el, 'selected', picked, null);
|
|
494
|
+
const box = el.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SEL));
|
|
399
495
|
if (box && markChecked(box) !== picked) paintCheck(box, { checked: picked, disabled: rowBusy(row) });
|
|
400
496
|
applyBusy(el, row); // 在途状态变化(忙闲通道通知后重绘走这里)
|
|
401
497
|
}
|
|
@@ -424,13 +520,15 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
424
520
|
const active = root.ownerDocument.activeElement;
|
|
425
521
|
for (const [i, el] of rendered) {
|
|
426
522
|
if (i >= start && i < end) continue;
|
|
427
|
-
if (active instanceof HTMLElement && el.contains(active)) root.focus({ preventScroll: true });
|
|
523
|
+
if (typeof HTMLElement !== 'undefined' && active instanceof HTMLElement && el.contains(active)) root.focus({ preventScroll: true });
|
|
428
524
|
el.remove();
|
|
429
525
|
rendered.delete(i);
|
|
430
526
|
}
|
|
527
|
+
let plan: RowRenderPlan | null = null;
|
|
431
528
|
for (let i = end - 1; i >= start; i--) {
|
|
432
529
|
if (rendered.has(i)) continue;
|
|
433
|
-
|
|
530
|
+
if (plan === null) plan = createRowPlan();
|
|
531
|
+
const el = buildRow(i, plan);
|
|
434
532
|
let next: Element = bottom;
|
|
435
533
|
for (let j = i + 1; j < end; j++) {
|
|
436
534
|
const hit = rendered.get(j);
|
|
@@ -461,8 +559,13 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
461
559
|
syncTier(false);
|
|
462
560
|
const p = P();
|
|
463
561
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
464
|
-
//
|
|
562
|
+
// 数据状态自报:没有行记「内容全空」(加载 / 出错由同页集合三态面板承载)
|
|
563
|
+
kitMarkDataFacts(root, { empty: rows.length === 0 });
|
|
564
|
+
// 外壳(emit-static)的内层已是 grid(含表头行),本组件的根是其中的 rowgroup;单独使用时根自己当 grid,
|
|
565
|
+
// 同时自标 data-kit-vscroll 使结构规则 `[data-kit-part="table-row"]:not([data-kit-vscroll] *)` 识别虚拟行按档位类定高,不叠加常规表行 min-height
|
|
465
566
|
root.setAttribute('role', gridEl() === root ? 'grid' : 'rowgroup');
|
|
567
|
+
if (scroller() === null) root.setAttribute(KIT_ATTR_VSCROLL, '');
|
|
568
|
+
else root.removeAttribute(KIT_ATTR_VSCROLL);
|
|
466
569
|
const label = str(p.label);
|
|
467
570
|
if (label !== '' && gridEl() === root) root.setAttribute('aria-label', label); else root.removeAttribute('aria-label');
|
|
468
571
|
const nCols = Number(p.colCount) > 0 ? Number(p.colCount) : cells().length + (mode() !== 'none' ? 1 : 0) + (actionsOf(p.actions).length > 0 ? 1 : 0);
|
|
@@ -471,21 +574,55 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
471
574
|
reconcile();
|
|
472
575
|
}
|
|
473
576
|
|
|
474
|
-
/**
|
|
577
|
+
/** 计算当前可见窗口与首尾边界的轻量浅签名(避免对万行全量数组做 JSON.stringify) */
|
|
578
|
+
const computeWindowSig = (list: readonly Rec[]): string => {
|
|
579
|
+
const indices = new Set<number>([0, Math.max(0, list.length - 1)]);
|
|
580
|
+
for (const idx of rendered.keys()) {
|
|
581
|
+
if (idx >= 0 && idx < list.length) indices.add(idx);
|
|
582
|
+
}
|
|
583
|
+
if (rendered.size === 0 && list.length > 0) {
|
|
584
|
+
const cap = Math.min(list.length, 32);
|
|
585
|
+
for (let i = 0; i < cap; i += 1) indices.add(i);
|
|
586
|
+
}
|
|
587
|
+
const sorted = [...indices].sort((a, b) => a - b).slice(0, 80);
|
|
588
|
+
const sample = sorted.map((i) => [i, list[i]]);
|
|
589
|
+
try {
|
|
590
|
+
return `${list.length}:${JSON.stringify(sample)}`;
|
|
591
|
+
} catch {
|
|
592
|
+
return `${list.length}:ref`;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
/** 引用 + 长度 + 窗口浅签名对账:禁止全量万行 JSON.stringify */
|
|
475
597
|
const syncRows = (): boolean => {
|
|
476
|
-
const
|
|
477
|
-
|
|
598
|
+
const p = P();
|
|
599
|
+
const permState = permStateOf(p);
|
|
600
|
+
renderedPerm = permState;
|
|
601
|
+
let nextSchema: string;
|
|
602
|
+
try {
|
|
603
|
+
nextSchema = JSON.stringify([p.cells, p.rowClass, p.stripeClass, p.actions, p.select, p.selectClass, p.actionsClass, p.bordered, p.pickOnRow, p.rowToneField, permState]);
|
|
604
|
+
} catch {
|
|
605
|
+
nextSchema = '';
|
|
606
|
+
}
|
|
607
|
+
const schemaChanged = nextSchema !== schemaSig;
|
|
608
|
+
schemaSig = nextSchema;
|
|
609
|
+
const next = p.rows;
|
|
610
|
+
if (next === rowsRef && !schemaChanged) return false;
|
|
611
|
+
const prevRows = rows;
|
|
478
612
|
rowsRef = next;
|
|
479
613
|
const list = Array.isArray(next) ? next.filter(isRec) : [];
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
614
|
+
const lenChanged = list.length !== prevRows.length;
|
|
615
|
+
const nextWinSig = computeWindowSig(list);
|
|
616
|
+
const renderedRefChanged = rendered.size > 80 && Array.from(rendered.keys()).some((i) => prevRows[i] !== list[i]);
|
|
617
|
+
const winChanged = nextWinSig !== windowSig || renderedRefChanged;
|
|
618
|
+
windowSig = nextWinSig;
|
|
484
619
|
rows = list;
|
|
485
|
-
items
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
620
|
+
if (lenChanged || items.length !== rows.length) {
|
|
621
|
+
items = rows.map((_r, i) => ({ key: String(i), text: '' }));
|
|
622
|
+
if (cursor >= rows.length) cursor = Math.max(0, rows.length - 1);
|
|
623
|
+
win?.setCount(rows.length);
|
|
624
|
+
}
|
|
625
|
+
return schemaChanged || lenChanged || winChanged;
|
|
489
626
|
};
|
|
490
627
|
|
|
491
628
|
const pageStep = SOMA_SIZE_UNITS.collection.keyboard.pageStep;
|
|
@@ -521,8 +658,9 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
521
658
|
bottom = mk('div', SPACER_CLASS);
|
|
522
659
|
bottom.setAttribute('aria-hidden', 'true');
|
|
523
660
|
root.replaceChildren(top, bottom);
|
|
524
|
-
root.setAttribute(
|
|
661
|
+
root.setAttribute(KIT_ATTR_ROWS, '');
|
|
525
662
|
root.tabIndex = -1;
|
|
663
|
+
rebuildSelectedSet();
|
|
526
664
|
syncRows();
|
|
527
665
|
appliedTier = tier();
|
|
528
666
|
win = createVirtualWindow({
|
|
@@ -536,11 +674,12 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
536
674
|
ensureDensityObserver();
|
|
537
675
|
const r = root;
|
|
538
676
|
const rowAt = (t: EventTarget | null): { el: HTMLElement; index: number } | null => {
|
|
539
|
-
const el = (t as HTMLElement | null)?.closest<HTMLElement>(
|
|
677
|
+
const el = (t as HTMLElement | null)?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_INDEX)) ?? null;
|
|
540
678
|
if (!el || !r.contains(el)) return null;
|
|
541
|
-
const index = Number(el.getAttribute(
|
|
679
|
+
const index = Number(el.getAttribute(KIT_ATTR_INDEX));
|
|
542
680
|
return Number.isInteger(index) ? { el, index } : null;
|
|
543
681
|
};
|
|
682
|
+
const rowConfirm = createKitRowConfirm(() => api.isCurrent());
|
|
544
683
|
const onClick = (event: Event): void => {
|
|
545
684
|
const hit = rowAt(event.target);
|
|
546
685
|
if (!hit) return;
|
|
@@ -549,30 +688,33 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
549
688
|
const t = event.target as HTMLElement;
|
|
550
689
|
cursor = hit.index;
|
|
551
690
|
syncTabindex();
|
|
552
|
-
const act = t.closest<HTMLElement>(
|
|
691
|
+
const act = t.closest<HTMLElement>(kitAttrSel(KIT_ATTR_ACT));
|
|
553
692
|
if (act) {
|
|
554
693
|
const list = actionsOf(P().actions);
|
|
555
|
-
const idx = list.findIndex((x) => x.id === act.getAttribute(
|
|
694
|
+
const idx = list.findIndex((x) => x.id === act.getAttribute(KIT_ATTR_ACT));
|
|
556
695
|
const a = list[idx];
|
|
557
|
-
|
|
696
|
+
// 页面线对危险动作下发的二次确认(props.kit.actions[动作].confirm):确认通过才抛槽位事件,没有判定时同步抛。
|
|
697
|
+
// 确认锁按行键(D-10,与右键菜单 / 列表行同一行在途键 removeKeyOf):窗口滚动后同一下标换了行也不会误锁;取不到行键才退到下标
|
|
698
|
+
const rowKey = removeKeyOf(row, str(P().removeKeyField));
|
|
699
|
+
if (a && !rowBusy(row)) rowConfirm.guard(P(), a.id, act, a.name, () => emitActionSlot((n, p) => api.emit(n, p), KIT_ACTION_SLOT_BASE.row, idx, { kit_action: a.id, id: a.id, name: a.name, builtin: a.builtin, target: a.target, row, ...objectPayload(), ...rowBusyPayload(row) }), rowKey !== '' ? rowKey : String(hit.index));
|
|
558
700
|
return;
|
|
559
701
|
}
|
|
560
|
-
if (t.closest(
|
|
561
|
-
if (t.closest(
|
|
702
|
+
if (t.closest(kitAttrSel(KIT_ATTR_SEL))) return; // change 事件处理
|
|
703
|
+
if (t.closest(`button, a, input, select, textarea, label, ${kitAttrSel(KIT_ATTR_EDITABLE)}`)) return;
|
|
562
704
|
const sel = typeof window !== 'undefined' && typeof window.getSelection === 'function' ? window.getSelection() : null;
|
|
563
705
|
if (sel !== null && !sel.isCollapsed && sel.toString() !== '') return;
|
|
564
706
|
if (bool(P().pickOnRow)) emitPick(row);
|
|
565
707
|
};
|
|
566
708
|
// 选择框是自绘勾选标记(base/check-core.ts):点击 / 空格 -> 抛选择
|
|
567
709
|
const offMark = attachMarkEvents(r, (mark, next) => {
|
|
568
|
-
if (mark.getAttribute(
|
|
710
|
+
if (mark.getAttribute(KIT_ATTR_SEL) === null) return;
|
|
569
711
|
const hit = rowAt(mark);
|
|
570
712
|
const row = hit ? rows[hit.index] : undefined;
|
|
571
713
|
if (row) emitSelect(row, next);
|
|
572
714
|
});
|
|
573
715
|
const onKeydown = (event: KeyboardEvent): void => {
|
|
574
716
|
const t = event.target as HTMLElement | null;
|
|
575
|
-
if (!t || t.closest(
|
|
717
|
+
if (!t || t.closest(`input, select, textarea, ${kitAttrSel(KIT_ATTR_MARK)}, ${kitAttrSel(KIT_ATTR_ACT)}, ${kitAttrSel(KIT_ATTR_EDIT_CONTROL)}`)) return;
|
|
576
718
|
if (wiring.onKeydown(event)) event.preventDefault();
|
|
577
719
|
};
|
|
578
720
|
const onFocusIn = (event: Event): void => {
|
|
@@ -588,8 +730,14 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
588
730
|
if ((el.getAttribute('aria-busy') === 'true') !== rowBusy(rows[i] ?? {})) { api.refresh(); return; }
|
|
589
731
|
}
|
|
590
732
|
});
|
|
733
|
+
const offPerm = registerLivePermissionGate(() => {
|
|
734
|
+
if (permStateOf(P()) !== renderedPerm) api.refresh();
|
|
735
|
+
});
|
|
591
736
|
return () => {
|
|
737
|
+
rowConfirm.dispose();
|
|
592
738
|
offBusy();
|
|
739
|
+
offPerm();
|
|
740
|
+
renderedPerm = '';
|
|
593
741
|
r.removeEventListener('click', onClick);
|
|
594
742
|
offMark();
|
|
595
743
|
r.removeEventListener('keydown', onKeydown as EventListener);
|
|
@@ -607,6 +755,7 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
607
755
|
},
|
|
608
756
|
render(rootEl) {
|
|
609
757
|
root = rootEl;
|
|
758
|
+
rebuildSelectedSet();
|
|
610
759
|
// 行样式档位字段换了:行元素复用会留旧档位类,整窗重建
|
|
611
760
|
const tone = str(P().rowToneField);
|
|
612
761
|
const toneChanged = tone !== appliedTone;
|
|
@@ -615,6 +764,7 @@ export function createKitVirtualRows(): SomaComponentDefinition {
|
|
|
615
764
|
else refreshSelection();
|
|
616
765
|
syncTier();
|
|
617
766
|
paint();
|
|
767
|
+
windowSig = computeWindowSig(rows);
|
|
618
768
|
},
|
|
619
769
|
};
|
|
620
770
|
}),
|