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/delta.ts
CHANGED
|
@@ -4,26 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
6
6
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
7
|
-
import { kitIcon } from '
|
|
7
|
+
import { kitIcon } from '../shared/icons';
|
|
8
|
+
import { KIT_ATTR_TREND } from '../shared/dom-attrs';
|
|
8
9
|
import {
|
|
9
|
-
CLASS_PROP, ID_PROPS, SIZE_PROP,
|
|
10
|
-
classCandidates, createKitController, formatValue, joinClass, num, setAttr, sizeOf, str,
|
|
10
|
+
CLASS_PROP, ID_PROPS, KIT_TOOLTIP_CLASS_CANDIDATES, SIZE_PROP, TOOLTIP_PROP,
|
|
11
|
+
classCandidates, createKitController, formatValue, joinClass, num, setAttr, sizeOf, str, withTooltip,
|
|
12
|
+
kitMarkDataState, kitOuterRoot,
|
|
11
13
|
type KitSize,
|
|
12
14
|
} from './shared';
|
|
13
15
|
import { trendTone, type TrendTone } from './trend-tone';
|
|
14
16
|
import { KIT_DELTA_TEXT } from '../recipes/typography';
|
|
15
17
|
|
|
16
18
|
const ROOT: Readonly<Record<KitSize, string>> = KIT_DELTA_TEXT;
|
|
17
|
-
|
|
19
|
+
/** 涨跌语气 → 文字色(彩色文字只用 -on-soft):KitDelta 与 StatGroup 的趋势共用这一份(趋势 = 文字 + 箭头,无底,不借标签形;KT-K-stat-4) */
|
|
20
|
+
export const KIT_DELTA_TONE_CLASS: Readonly<Record<TrendTone, string>> = {
|
|
18
21
|
good: 'text-success-on-soft',
|
|
19
22
|
bad: 'text-danger-on-soft',
|
|
20
23
|
flat: 'text-fg-muted',
|
|
21
24
|
};
|
|
25
|
+
const TONE_CLASS = KIT_DELTA_TONE_CLASS;
|
|
22
26
|
const SR_ONLY = 'sr-only';
|
|
23
27
|
const EMPTY_TEXT = '—';
|
|
24
28
|
|
|
25
29
|
export const KIT_DELTA_CLASS_CANDIDATES: readonly string[] = classCandidates(
|
|
26
|
-
Object.values(ROOT), Object.values(TONE_CLASS), SR_ONLY,
|
|
30
|
+
Object.values(ROOT), Object.values(TONE_CLASS), SR_ONLY, KIT_TOOLTIP_CLASS_CANDIDATES,
|
|
27
31
|
);
|
|
28
32
|
|
|
29
33
|
export function createKitDelta(): SomaComponentDefinition {
|
|
@@ -34,7 +38,9 @@ export function createKitDelta(): SomaComponentDefinition {
|
|
|
34
38
|
props: {
|
|
35
39
|
value: { type: 'string', default: '', desc: '涨跌数值(数字或数字串);percent 下是比率(0.12 = 12%);非数字显示 —' },
|
|
36
40
|
format: { type: 'enum', values: ['percent', 'number'], default: 'percent', desc: '显示格式:percent = 比率按百分比,number = 按数字' },
|
|
41
|
+
up_is: { type: 'enum', values: ['', 'good', 'bad'], default: '', desc: '涨是好事还是坏事(与 upIs 双向兼容,显式传入时优先):good 涨绿跌红,bad 涨红跌绿' },
|
|
37
42
|
upIs: { type: 'enum', values: ['good', 'bad'], default: 'good', desc: '涨是好事还是坏事:good 涨绿跌红,bad 涨红跌绿' },
|
|
43
|
+
tooltip: TOOLTIP_PROP,
|
|
38
44
|
id: ID_PROPS.id,
|
|
39
45
|
size: SIZE_PROP,
|
|
40
46
|
class: CLASS_PROP,
|
|
@@ -42,19 +48,21 @@ export function createKitDelta(): SomaComponentDefinition {
|
|
|
42
48
|
emits: {},
|
|
43
49
|
},
|
|
44
50
|
templateHtml: `<span data-soma-id="root" class="${ROOT.md} ${TONE_CLASS.flat}"></span>`,
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
// 涨跌幅是指标:根只报元素部件
|
|
52
|
+
controllerFactory: createKitController(() => withTooltip({
|
|
53
|
+
render(root, p, api) {
|
|
47
54
|
const size = sizeOf(p.size);
|
|
48
55
|
const change = num(p.value);
|
|
49
|
-
const
|
|
56
|
+
const rawUp = p.up_is !== undefined && p.up_is !== '' ? p.up_is : p.upIs;
|
|
57
|
+
const upIs = rawUp === 'bad' ? 'bad' : 'good';
|
|
50
58
|
const format = p.format === 'number' ? 'number' : 'percent';
|
|
51
59
|
const tone: TrendTone = change === null ? 'flat' : trendTone(change, upIs);
|
|
52
60
|
root.textContent = '';
|
|
53
61
|
if (change === null) {
|
|
54
|
-
root.setAttribute(
|
|
62
|
+
root.setAttribute(KIT_ATTR_TREND, 'none');
|
|
55
63
|
root.appendChild(document.createTextNode(EMPTY_TEXT));
|
|
56
64
|
} else {
|
|
57
|
-
root.setAttribute(
|
|
65
|
+
root.setAttribute(KIT_ATTR_TREND, change > 0 ? 'up' : change < 0 ? 'down' : 'flat');
|
|
58
66
|
if (change !== 0) root.appendChild(kitIcon(change > 0 ? 'arrow-up' : 'arrow-down', 'xs'));
|
|
59
67
|
root.appendChild(document.createTextNode(formatValue(Math.abs(change), format, kitLocaleAt(root))));
|
|
60
68
|
if (change !== 0) {
|
|
@@ -66,7 +74,8 @@ export function createKitDelta(): SomaComponentDefinition {
|
|
|
66
74
|
}
|
|
67
75
|
setAttr(root, 'id', str(p.id));
|
|
68
76
|
root.className = joinClass(`${ROOT[size]} ${TONE_CLASS[tone]}`, p.class);
|
|
77
|
+
kitMarkDataState(kitOuterRoot(api.host, root), change === null ? 'empty' : 'normal');
|
|
69
78
|
},
|
|
70
|
-
})),
|
|
79
|
+
}), { self: { part: 'metric' } }),
|
|
71
80
|
};
|
|
72
81
|
}
|
package/src/base/divider.ts
CHANGED
|
@@ -6,87 +6,39 @@
|
|
|
6
6
|
// 无障碍:根是 role="separator",带文字时用 aria-label 给出名字,内部线与文字对读屏隐藏。
|
|
7
7
|
|
|
8
8
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
9
|
-
import { CLASS_PROP, bool, createKitController, joinClass, str, type KitTone } from './shared';
|
|
9
|
+
import { CLASS_PROP, bool, classCandidates, createKitController, joinClass, str, type KitTone } from './shared';
|
|
10
|
+
import { kitDividerRecipe } from '../recipes/divider';
|
|
11
|
+
import { KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES, kitTypographyRecipe } from '../recipes/typography';
|
|
12
|
+
import { mergeClass } from '../shared/merge-class';
|
|
10
13
|
|
|
11
14
|
export type KitDividerTone = 'neutral' | 'primary' | KitTone;
|
|
12
15
|
const TONES: readonly KitDividerTone[] = ['neutral', 'primary', 'info', 'success', 'warning', 'danger'];
|
|
13
16
|
|
|
14
|
-
//
|
|
15
|
-
const
|
|
16
|
-
neutral: '
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
danger: 'flex-1 border-t border-danger',
|
|
22
|
-
};
|
|
23
|
-
const LINE_DASHED: Record<KitDividerTone, string> = {
|
|
24
|
-
neutral: 'flex-1 border-t border-dashed border-border-subtle',
|
|
25
|
-
primary: 'flex-1 border-t border-dashed border-primary',
|
|
26
|
-
info: 'flex-1 border-t border-dashed border-info',
|
|
27
|
-
success: 'flex-1 border-t border-dashed border-success',
|
|
28
|
-
warning: 'flex-1 border-t border-dashed border-warning',
|
|
29
|
-
danger: 'flex-1 border-t border-dashed border-danger',
|
|
30
|
-
};
|
|
17
|
+
// 线体:中性线只经分隔线出口(发丝宽、分隔灰,KT-B1 / KT-B5);语气线同宽(发丝档)、取语气色
|
|
18
|
+
const lineOf = (side: 'top' | 'start', tone: KitDividerTone): string =>
|
|
19
|
+
tone === 'neutral' ? kitDividerRecipe(side) : `border-${side === 'top' ? 't' : 's'}-hairline border-${tone}`;
|
|
20
|
+
const table = (layout: string, side: 'top' | 'start', dashed: boolean): Record<KitDividerTone, string> =>
|
|
21
|
+
Object.fromEntries(TONES.map((t) => [t, `${layout} ${lineOf(side, t)}${dashed ? ' border-dashed' : ''}`])) as Record<KitDividerTone, string>;
|
|
22
|
+
const LINE_SOLID = table('flex-1', 'top', false);
|
|
23
|
+
const LINE_DASHED = table('flex-1', 'top', true);
|
|
31
24
|
// 靠前 / 靠后时短的那一侧(定宽)
|
|
32
|
-
const LINE_SHORT_SOLID
|
|
33
|
-
|
|
34
|
-
primary: 'w-6 shrink-0 border-t border-primary',
|
|
35
|
-
info: 'w-6 shrink-0 border-t border-info',
|
|
36
|
-
success: 'w-6 shrink-0 border-t border-success',
|
|
37
|
-
warning: 'w-6 shrink-0 border-t border-warning',
|
|
38
|
-
danger: 'w-6 shrink-0 border-t border-danger',
|
|
39
|
-
};
|
|
40
|
-
const LINE_SHORT_DASHED: Record<KitDividerTone, string> = {
|
|
41
|
-
neutral: 'w-6 shrink-0 border-t border-dashed border-border-subtle',
|
|
42
|
-
primary: 'w-6 shrink-0 border-t border-dashed border-primary',
|
|
43
|
-
info: 'w-6 shrink-0 border-t border-dashed border-info',
|
|
44
|
-
success: 'w-6 shrink-0 border-t border-dashed border-success',
|
|
45
|
-
warning: 'w-6 shrink-0 border-t border-dashed border-warning',
|
|
46
|
-
danger: 'w-6 shrink-0 border-t border-dashed border-danger',
|
|
47
|
-
};
|
|
25
|
+
const LINE_SHORT_SOLID = table('w-6 shrink-0', 'top', false);
|
|
26
|
+
const LINE_SHORT_DASHED = table('w-6 shrink-0', 'top', true);
|
|
48
27
|
// 无文字的整条水平线(根自己就是线)
|
|
49
|
-
const BARE_SOLID
|
|
50
|
-
|
|
51
|
-
primary: 'block w-full border-t border-primary',
|
|
52
|
-
info: 'block w-full border-t border-info',
|
|
53
|
-
success: 'block w-full border-t border-success',
|
|
54
|
-
warning: 'block w-full border-t border-warning',
|
|
55
|
-
danger: 'block w-full border-t border-danger',
|
|
56
|
-
};
|
|
57
|
-
const BARE_DASHED: Record<KitDividerTone, string> = {
|
|
58
|
-
neutral: 'block w-full border-t border-dashed border-border-subtle',
|
|
59
|
-
primary: 'block w-full border-t border-dashed border-primary',
|
|
60
|
-
info: 'block w-full border-t border-dashed border-info',
|
|
61
|
-
success: 'block w-full border-t border-dashed border-success',
|
|
62
|
-
warning: 'block w-full border-t border-dashed border-warning',
|
|
63
|
-
danger: 'block w-full border-t border-dashed border-danger',
|
|
64
|
-
};
|
|
28
|
+
const BARE_SOLID = table('block w-full', 'top', false);
|
|
29
|
+
const BARE_DASHED = table('block w-full', 'top', true);
|
|
65
30
|
// 竖线(行内,如操作项之间)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
warning: 'inline-block h-4 border-l border-warning',
|
|
72
|
-
danger: 'inline-block h-4 border-l border-danger',
|
|
73
|
-
};
|
|
74
|
-
const VERTICAL_DASHED: Record<KitDividerTone, string> = {
|
|
75
|
-
neutral: 'inline-block h-4 border-l border-dashed border-border-subtle',
|
|
76
|
-
primary: 'inline-block h-4 border-l border-dashed border-primary',
|
|
77
|
-
info: 'inline-block h-4 border-l border-dashed border-info',
|
|
78
|
-
success: 'inline-block h-4 border-l border-dashed border-success',
|
|
79
|
-
warning: 'inline-block h-4 border-l border-dashed border-warning',
|
|
80
|
-
danger: 'inline-block h-4 border-l border-dashed border-danger',
|
|
81
|
-
};
|
|
82
|
-
const LABELED_ROOT = 'flex w-full items-center gap-3';
|
|
83
|
-
const LABEL_CLASS = 'shrink-0 text-xs text-fg-muted';
|
|
31
|
+
// 取值表 02 §20(Ant / Arco / TDesign,待组件卡):竖线外边距 12(随 density A)、高 ≈ 0.9em;带文字线与文字的间距 ≈ 1em;文字 14 / 500 / 次级色
|
|
32
|
+
const VERTICAL_SOLID = table('mx-3 inline-block h-4', 'start', false);
|
|
33
|
+
const VERTICAL_DASHED = table('mx-3 inline-block h-4', 'start', true);
|
|
34
|
+
const LABELED_ROOT = 'flex w-full items-center gap-4';
|
|
35
|
+
const LABEL_CLASS = mergeClass(kitTypographyRecipe('text'), 'shrink-0 font-medium text-fg-muted');
|
|
84
36
|
|
|
85
|
-
export const KIT_DIVIDER_CLASS_CANDIDATES: readonly string[] =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
LABELED_ROOT, LABEL_CLASS,
|
|
89
|
-
|
|
37
|
+
export const KIT_DIVIDER_CLASS_CANDIDATES: readonly string[] = classCandidates(
|
|
38
|
+
Object.values(LINE_SOLID), Object.values(LINE_DASHED), Object.values(LINE_SHORT_SOLID), Object.values(LINE_SHORT_DASHED),
|
|
39
|
+
Object.values(BARE_SOLID), Object.values(BARE_DASHED), Object.values(VERTICAL_SOLID), Object.values(VERTICAL_DASHED),
|
|
40
|
+
LABELED_ROOT, LABEL_CLASS, KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES,
|
|
41
|
+
);
|
|
90
42
|
|
|
91
43
|
function toneOf(raw: unknown): KitDividerTone {
|
|
92
44
|
const t = str(raw) as KitDividerTone;
|
|
@@ -125,32 +77,47 @@ export function createKitDivider(): SomaComponentDefinition {
|
|
|
125
77
|
align: { type: 'enum', values: ['start', 'center', 'end'], default: 'center', desc: '文字位置' },
|
|
126
78
|
dashed: { type: 'boolean', default: false, desc: '虚线' },
|
|
127
79
|
tone: { type: 'enum', values: ['neutral', 'primary', 'info', 'success', 'warning', 'danger'], default: 'neutral', desc: '线体语气色' },
|
|
80
|
+
decorative: { type: 'boolean', default: false, desc: '纯装饰分隔:根改 role=none、不写 aria-orientation;有意义的区块分隔保持 separator' },
|
|
128
81
|
class: CLASS_PROP,
|
|
129
82
|
},
|
|
130
83
|
},
|
|
131
|
-
templateHtml:
|
|
132
|
-
controllerFactory: createKitController(() =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
84
|
+
templateHtml: `<div data-soma-id="root" role="separator" class="${BARE_SOLID.neutral}"></div>`,
|
|
85
|
+
controllerFactory: createKitController(() => {
|
|
86
|
+
let lastPlanSig = '\u0001';
|
|
87
|
+
return {
|
|
88
|
+
render(root, p) {
|
|
89
|
+
const plan = dividerPlan(p);
|
|
90
|
+
const doc = root.ownerDocument;
|
|
91
|
+
if (bool(p.decorative)) {
|
|
92
|
+
// 纯装饰:不进无障碍树,无方向、无名字
|
|
93
|
+
root.setAttribute('role', 'none');
|
|
94
|
+
root.removeAttribute('aria-orientation');
|
|
95
|
+
root.removeAttribute('aria-label');
|
|
96
|
+
} else {
|
|
97
|
+
root.setAttribute('role', 'separator');
|
|
98
|
+
root.setAttribute('aria-orientation', plan.vertical ? 'vertical' : 'horizontal');
|
|
99
|
+
if (plan.label !== '') root.setAttribute('aria-label', plan.label);
|
|
100
|
+
else root.removeAttribute('aria-label');
|
|
101
|
+
}
|
|
102
|
+
root.className = joinClass(plan.root, p.class);
|
|
103
|
+
const sig = `${plan.vertical ? '1' : '0'}\u0000${plan.align}\u0000${plan.before}\u0000${plan.after}\u0000${plan.label}`;
|
|
104
|
+
if (sig === lastPlanSig) return;
|
|
105
|
+
lastPlanSig = sig;
|
|
106
|
+
root.replaceChildren();
|
|
107
|
+
if (plan.label === '') return;
|
|
108
|
+
const a = doc.createElement('span');
|
|
109
|
+
a.className = plan.before;
|
|
110
|
+
a.setAttribute('aria-hidden', 'true');
|
|
111
|
+
const text = doc.createElement('span');
|
|
112
|
+
text.className = LABEL_CLASS;
|
|
113
|
+
text.setAttribute('aria-hidden', 'true');
|
|
114
|
+
text.textContent = plan.label;
|
|
115
|
+
const b = doc.createElement('span');
|
|
116
|
+
b.className = plan.after;
|
|
117
|
+
b.setAttribute('aria-hidden', 'true');
|
|
118
|
+
root.append(a, text, b);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}),
|
|
155
122
|
};
|
|
156
123
|
}
|
package/src/base/end-edge.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// 表壳右侧遮挡标记(量滚动余量,不是版式切换:版式切换走容器查询,不在脚本里量宽度)。
|
|
2
2
|
// 表壳右侧还有被遮住的内容时标 `data-kit-edge-r`,贴右固定的操作格据此出分隔线与阴影;滚动 / 尺寸变化时重算。
|
|
3
3
|
|
|
4
|
+
import { KIT_ATTR_EDGE_L, KIT_ATTR_EDGE_R, KIT_ATTR_PART } from '../shared/dom-attrs';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* 表壳两侧是否还有被遮住的内容(唯一口径):右侧容差 4px——列轨最小宽之和与容器只差几个像素(取整 / 边框)时不算「还有内容」,
|
|
6
8
|
* 不出分隔线与阴影。table-tools 的 applyEdges 与 watchEndEdge 共用本函数,不各写一份判据。
|
|
@@ -23,8 +25,11 @@ export function watchEndEdge(el: HTMLElement | null): () => void {
|
|
|
23
25
|
return () => release(el);
|
|
24
26
|
}
|
|
25
27
|
const apply = (): void => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const edges = measureEdges(el);
|
|
29
|
+
if (el.scrollLeft > 1) el.setAttribute(KIT_ATTR_EDGE_L, '');
|
|
30
|
+
else el.removeAttribute(KIT_ATTR_EDGE_L);
|
|
31
|
+
if (edges.right) el.setAttribute(KIT_ATTR_EDGE_R, '');
|
|
32
|
+
else el.removeAttribute(KIT_ATTR_EDGE_R);
|
|
28
33
|
};
|
|
29
34
|
apply();
|
|
30
35
|
// 订阅时可能还没布局(量到的宽全是 0):下一帧再算一次
|
|
@@ -35,7 +40,7 @@ export function watchEndEdge(el: HTMLElement | null): () => void {
|
|
|
35
40
|
ro.observe(el);
|
|
36
41
|
if (el.firstElementChild !== null) ro.observe(el.firstElementChild);
|
|
37
42
|
// 表头 / 首行的尺寸变化(字体就绪、列轨重算)不改变壳与首子元素的尺寸,但会改 scrollWidth:一并观察,避免没有溢出时残留分隔线
|
|
38
|
-
for (const part of Array.from(el.querySelectorAll(
|
|
43
|
+
for (const part of Array.from(el.querySelectorAll(`[${KIT_ATTR_PART}="table-head"], [${KIT_ATTR_PART}="table-row"]`)).slice(0, 2)) ro.observe(part);
|
|
39
44
|
}
|
|
40
45
|
// 字体就绪后列宽才定:再量一次(旧值可能是回退字体下的宽度)
|
|
41
46
|
const fonts = (el.ownerDocument as Document & { fonts?: { ready?: Promise<unknown> } }).fonts;
|
|
@@ -45,7 +50,8 @@ export function watchEndEdge(el: HTMLElement | null): () => void {
|
|
|
45
50
|
stop: () => {
|
|
46
51
|
el.removeEventListener('scroll', apply);
|
|
47
52
|
ro?.disconnect();
|
|
48
|
-
el.removeAttribute(
|
|
53
|
+
el.removeAttribute(KIT_ATTR_EDGE_L);
|
|
54
|
+
el.removeAttribute(KIT_ATTR_EDGE_R);
|
|
49
55
|
},
|
|
50
56
|
});
|
|
51
57
|
return () => release(el);
|
package/src/base/fab.ts
CHANGED
|
@@ -6,26 +6,36 @@
|
|
|
6
6
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
7
7
|
import {
|
|
8
8
|
CLASS_PROP, ID_PROPS, SIZE_PROP, TOOLTIP_PROP,
|
|
9
|
-
applyCommon, bool, classCandidates, createKitController, joinClass, num, setBoolAttr,
|
|
9
|
+
applyCommon, bool, classCandidates, createKitController, joinClass, num, setBoolAttr, str, withTooltip,
|
|
10
|
+
kitControlSizeOf, kitReadProps,
|
|
10
11
|
type KitSize, type KitView,
|
|
11
12
|
} from './shared';
|
|
13
|
+
import { kitReportSelf } from './kit-contract';
|
|
12
14
|
import { kitText } from '../i18n/kit-text';
|
|
13
|
-
import { kitIcon } from '
|
|
15
|
+
import { KIT_ICON_CLASS_CANDIDATES, kitIcon, resolveKitIconName } from '../shared/icons';
|
|
14
16
|
import { setKitFixed } from '../recipes';
|
|
15
|
-
import {
|
|
17
|
+
import { kitSurfaceRecipe } from '../recipes/surface';
|
|
18
|
+
import { KIT_FOCUS_RING } from '../recipes/state';
|
|
19
|
+
import { mergeClass } from '../shared/merge-class';
|
|
20
|
+
import { KIT_ATTR_FACE } from '../shared/dom-attrs';
|
|
21
|
+
import { KIT_MENU_CORE_CLASS_CANDIDATES, menuItemsOf, wireMenu, type MenuClasses, type MenuHandle } from './menu-core';
|
|
16
22
|
import { KIT_DROPDOWN_PORTAL_CLASS_CANDIDATES, KIT_POPUP_PLACE_CLASS_CANDIDATES, popPlaceClass, type PopPlace } from './popup';
|
|
23
|
+
import { scrollParentOf } from './sticky-edge';
|
|
24
|
+
|
|
25
|
+
// 悬浮动作钮是浮起的面(KT-B4):发丝描边 + 浮起面 + 双层浮起阴影只取浮起表面配方;胶囊圆角是构件形体
|
|
26
|
+
const FLOAT_EDGE = mergeClass(kitSurfaceRecipe('raised'), 'rounded-full');
|
|
17
27
|
|
|
18
28
|
export type FabPlacement = 'inline' | 'bottom-right' | 'bottom-left';
|
|
19
29
|
|
|
20
30
|
const ROOT_CLASS: Record<FabPlacement, string> = {
|
|
21
31
|
inline: 'relative inline-block',
|
|
22
|
-
'bottom-right': 'fixed bottom-6
|
|
23
|
-
'bottom-left': 'fixed bottom-6
|
|
32
|
+
'bottom-right': 'fixed bottom-6 end-6 z-30 inline-block',
|
|
33
|
+
'bottom-left': 'fixed bottom-6 start-6 z-30 inline-block',
|
|
24
34
|
};
|
|
25
35
|
const TRIGGER_CLASS: Record<KitSize, string> = {
|
|
26
|
-
sm: 'inline-flex h-10 w-10 items-center justify-center rounded-full bg-primary text-lg font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active
|
|
27
|
-
md: 'inline-flex h-12 w-12 items-center justify-center rounded-full bg-primary text-xl font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active
|
|
28
|
-
lg: 'inline-flex h-14 w-14 items-center justify-center rounded-full bg-primary text-2xl font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active
|
|
36
|
+
sm: 'inline-flex h-10 w-10 p-0 items-center justify-center rounded-full bg-primary text-lg font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active ' + KIT_FOCUS_RING.button + ' disabled:cursor-not-allowed disabled:bg-control-disabled disabled:text-fg-disabled',
|
|
37
|
+
md: 'inline-flex h-12 w-12 p-0 items-center justify-center rounded-full bg-primary text-xl font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active ' + KIT_FOCUS_RING.button + ' disabled:cursor-not-allowed disabled:bg-control-disabled disabled:text-fg-disabled',
|
|
38
|
+
lg: 'inline-flex h-14 w-14 p-0 items-center justify-center rounded-full bg-primary text-2xl font-medium text-primary-fg shadow-md transition-colors enabled:hover:bg-primary-hover enabled:active:bg-primary-active ' + KIT_FOCUS_RING.button + ' disabled:cursor-not-allowed disabled:bg-control-disabled disabled:text-fg-disabled',
|
|
29
39
|
};
|
|
30
40
|
const MENU_HIDDEN = 'hidden';
|
|
31
41
|
export type FabDirection = 'up' | 'down' | 'left' | 'right';
|
|
@@ -36,26 +46,29 @@ function menuPref(placement: FabPlacement, direction: FabDirection): PopPlace {
|
|
|
36
46
|
if (direction === 'right') return { side: 'end', align: 'start' };
|
|
37
47
|
return { side: 'top', align: placement === 'bottom-left' ? 'start' : 'end' };
|
|
38
48
|
}
|
|
39
|
-
const MENU_BASE = 'absolute z-
|
|
49
|
+
const MENU_BASE = 'absolute z-30 flex flex-col gap-2';
|
|
40
50
|
// 水平展开(左 / 右):动作排成一行,与主按钮垂直居中对齐
|
|
41
|
-
const MENU_BASE_ROW = 'absolute z-
|
|
51
|
+
const MENU_BASE_ROW = 'absolute z-30 flex flex-row items-center gap-2';
|
|
42
52
|
const menuClass = (place: PopPlace): string =>
|
|
43
53
|
place.side === 'start' || place.side === 'end'
|
|
44
|
-
? `${MENU_BASE_ROW} ${popPlaceClass(place
|
|
45
|
-
: `${MENU_BASE} ${popPlaceClass(place
|
|
54
|
+
? `${MENU_BASE_ROW} ${popPlaceClass(place)}`
|
|
55
|
+
: `${MENU_BASE} ${popPlaceClass(place)} ${place.align === 'end' ? 'items-end' : 'items-start'}`;
|
|
46
56
|
const BACK_TOP_HIDDEN = 'hidden';
|
|
47
57
|
const BACK_TOP_OFFSET = 200;
|
|
48
58
|
const MENU_CLASSES: MenuClasses = {
|
|
49
|
-
idle: 'flex cursor-pointer items-center gap-2 whitespace-nowrap rounded-full
|
|
50
|
-
danger: 'flex cursor-pointer items-center gap-2 whitespace-nowrap rounded-full
|
|
51
|
-
disabled: 'flex cursor-not-allowed items-center gap-2 whitespace-nowrap rounded-full
|
|
59
|
+
idle: 'flex cursor-pointer items-center gap-2 whitespace-nowrap rounded-full ' + FLOAT_EDGE + ' px-4 py-2 text-sm font-medium text-fg transition-colors state-layer ' + KIT_FOCUS_RING.item,
|
|
60
|
+
danger: 'flex cursor-pointer items-center gap-2 whitespace-nowrap rounded-full ' + FLOAT_EDGE + ' px-4 py-2 text-sm font-medium text-danger-on-soft transition-colors hover:bg-danger-soft focus-visible:bg-danger-soft ' + KIT_FOCUS_RING.item,
|
|
61
|
+
disabled: 'flex cursor-not-allowed items-center gap-2 whitespace-nowrap rounded-full ' + FLOAT_EDGE + ' px-4 py-2 text-sm font-medium text-fg-disabled', // KT-K0-4:禁用字用专用令牌,不降透明度
|
|
52
62
|
divider: 'hidden',
|
|
53
63
|
icon: 'inline-block shrink-0',
|
|
64
|
+
// 子菜单面板:与主面板同形(无底的药丸纵列),位置由内核按 end 侧落位
|
|
65
|
+
subPanel: MENU_BASE,
|
|
54
66
|
};
|
|
55
67
|
|
|
56
68
|
export const KIT_FAB_CLASS_CANDIDATES: readonly string[] = classCandidates(
|
|
57
69
|
Object.values(ROOT_CLASS), Object.values(TRIGGER_CLASS), MENU_HIDDEN, MENU_BASE, MENU_BASE_ROW, BACK_TOP_HIDDEN,
|
|
58
|
-
'items-end', 'items-start', KIT_POPUP_PLACE_CLASS_CANDIDATES, KIT_DROPDOWN_PORTAL_CLASS_CANDIDATES, Object.values(MENU_CLASSES),
|
|
70
|
+
'items-end', 'items-start', KIT_POPUP_PLACE_CLASS_CANDIDATES, KIT_DROPDOWN_PORTAL_CLASS_CANDIDATES, Object.values(MENU_CLASSES), KIT_MENU_CORE_CLASS_CANDIDATES,
|
|
71
|
+
KIT_ICON_CLASS_CANDIDATES,
|
|
59
72
|
);
|
|
60
73
|
|
|
61
74
|
function placementOf(raw: unknown): FabPlacement {
|
|
@@ -81,24 +94,40 @@ function makeView(): KitView {
|
|
|
81
94
|
attach(root, api) {
|
|
82
95
|
const trigger = root.firstElementChild as HTMLElement;
|
|
83
96
|
const menu = root.children[1] as HTMLElement;
|
|
97
|
+
// 自报(主按钮 = 控件、其图标 = 图标、展开的动作菜单 = 浮起):挂载时按组件自己持有的节点引用写,不按子路径选择器找
|
|
98
|
+
// (菜单打开后挂到浮层端口、不在根下);图标槽 span 在重绘时只换内容、节点不换;旧版只写区域作用域(kitReportSelf)
|
|
99
|
+
kitReportSelf(trigger, { level: 'control' });
|
|
100
|
+
kitReportSelf(trigger.firstElementChild, { part: 'icon' });
|
|
101
|
+
kitReportSelf(menu, { level: 'float' });
|
|
84
102
|
const hasItems = (): boolean => !bool(api.props().back_top) && menuItemsOf(api.props().items).some((i) => !i.divider);
|
|
85
103
|
const pref = (): PopPlace => menuPref(placementOf(api.props().placement), directionOf(api.props().direction));
|
|
86
|
-
const
|
|
104
|
+
const scrollOffsetNow = (): number => {
|
|
105
|
+
const sp = scrollParentOf(root);
|
|
106
|
+
if (sp !== null) return sp.scrollTop;
|
|
107
|
+
return typeof window === 'undefined' ? 0 : window.scrollY;
|
|
108
|
+
};
|
|
109
|
+
const scrolled = (): boolean => scrollOffsetNow() >= backTopOffsetOf(api.props().back_top_offset);
|
|
87
110
|
paintRoot = (): void => {
|
|
88
111
|
const p = api.props();
|
|
89
112
|
const hiddenNow = bool(p.back_top) && !backTopShown;
|
|
90
113
|
root.className = hiddenNow ? BACK_TOP_HIDDEN : joinClass(ROOT_CLASS[placementOf(p.placement)], p.class);
|
|
91
114
|
setKitFixed(root, !hiddenNow && placementOf(p.placement) !== 'inline');
|
|
92
115
|
};
|
|
93
|
-
const onScroll = (): void => {
|
|
116
|
+
const onScroll = (ev?: Event): void => {
|
|
94
117
|
if (!bool(api.props().back_top)) return;
|
|
118
|
+
if (ev?.target instanceof Element) {
|
|
119
|
+
const doc = root.ownerDocument;
|
|
120
|
+
if (ev.target !== doc.documentElement && ev.target !== doc.body && !ev.target.contains(root)) return;
|
|
121
|
+
}
|
|
95
122
|
const next = scrolled();
|
|
96
123
|
if (next === backTopShown) return;
|
|
97
124
|
backTopShown = next;
|
|
98
125
|
paintRoot?.();
|
|
99
126
|
};
|
|
100
127
|
backTopShown = scrolled();
|
|
128
|
+
const doc = root.ownerDocument;
|
|
101
129
|
if (typeof window !== 'undefined') window.addEventListener('scroll', onScroll, { passive: true });
|
|
130
|
+
doc.addEventListener('scroll', onScroll, { capture: true, passive: true });
|
|
102
131
|
handle = wireMenu({
|
|
103
132
|
scope: root,
|
|
104
133
|
trigger,
|
|
@@ -120,9 +149,16 @@ function makeView(): KitView {
|
|
|
120
149
|
const onClick = (): void => {
|
|
121
150
|
const p = api.props();
|
|
122
151
|
if (bool(p.disabled) || hasItems()) return;
|
|
123
|
-
if (bool(p.back_top)
|
|
124
|
-
const calm = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
125
|
-
|
|
152
|
+
if (bool(p.back_top)) {
|
|
153
|
+
const calm = typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
154
|
+
const behavior: ScrollBehavior = calm ? 'auto' : 'smooth';
|
|
155
|
+
const sp = scrollParentOf(root);
|
|
156
|
+
if (sp !== null) {
|
|
157
|
+
if (typeof sp.scrollTo === 'function') sp.scrollTo({ top: 0, behavior });
|
|
158
|
+
else sp.scrollTop = 0;
|
|
159
|
+
} else if (typeof window !== 'undefined' && typeof window.scrollTo === 'function') {
|
|
160
|
+
window.scrollTo({ top: 0, behavior });
|
|
161
|
+
}
|
|
126
162
|
}
|
|
127
163
|
api.emit('click', {});
|
|
128
164
|
};
|
|
@@ -130,6 +166,7 @@ function makeView(): KitView {
|
|
|
130
166
|
return () => {
|
|
131
167
|
trigger.removeEventListener('click', onClick);
|
|
132
168
|
if (typeof window !== 'undefined') window.removeEventListener('scroll', onScroll);
|
|
169
|
+
doc.removeEventListener('scroll', onScroll, { capture: true });
|
|
133
170
|
handle?.destroy();
|
|
134
171
|
handle = null;
|
|
135
172
|
paintRoot = null;
|
|
@@ -143,7 +180,7 @@ function makeView(): KitView {
|
|
|
143
180
|
if (off) trigger.setAttribute('aria-disabled', 'true');
|
|
144
181
|
else trigger.removeAttribute('aria-disabled');
|
|
145
182
|
applyCommon(trigger, { id: p.id, aria_label: str(p.aria_label) !== '' ? p.aria_label : str(p.label, kitText('soma.kit.head_ops', undefined, root)) });
|
|
146
|
-
trigger.className = TRIGGER_CLASS[
|
|
183
|
+
trigger.className = TRIGGER_CLASS[kitControlSizeOf(p, kitReadProps(p))];
|
|
147
184
|
paintTrigger(trigger, p, handle?.isOpen() === true);
|
|
148
185
|
}
|
|
149
186
|
if (bool(p.disabled) && handle?.isOpen()) handle.close(false);
|
|
@@ -161,10 +198,12 @@ function paintTrigger(trigger: HTMLElement, p: Record<string, unknown>, open: bo
|
|
|
161
198
|
const glyph = trigger.firstElementChild as HTMLElement | null;
|
|
162
199
|
// back_top 且没自定义符号:用向上箭头
|
|
163
200
|
const icon = str(p.icon, '+');
|
|
201
|
+
const resolved = resolveKitIconName(icon);
|
|
164
202
|
if (!glyph) return;
|
|
165
203
|
if (open) glyph.replaceChildren(kitIcon('close', 'md'));
|
|
166
204
|
else if (bool(p.back_top) && (icon === '+' || icon === '')) glyph.replaceChildren(kitIcon('arrow-up', 'md'));
|
|
167
205
|
else if (icon === '+') glyph.replaceChildren(kitIcon('plus', 'md'));
|
|
206
|
+
else if (resolved !== null) glyph.replaceChildren(kitIcon(resolved, 'md'));
|
|
168
207
|
else glyph.textContent = icon;
|
|
169
208
|
}
|
|
170
209
|
|
|
@@ -193,7 +232,9 @@ export function createFab(): SomaComponentDefinition {
|
|
|
193
232
|
click: { payload: {}, desc: '没有动作项时点主按钮' },
|
|
194
233
|
},
|
|
195
234
|
},
|
|
196
|
-
|
|
235
|
+
// 根是纯定位包装不设层级角色:主按钮是控件,动作列是浮起(菜单),符号是图标
|
|
236
|
+
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS.inline}"><button type="button" ${KIT_ATTR_FACE}="raised" class="${TRIGGER_CLASS.md}"><span aria-hidden="true">+</span></button><div class="${MENU_HIDDEN}"></div></div>`,
|
|
237
|
+
// 自报不拼进静态模板:在 makeView 的 attach 里按节点引用写(见那里)
|
|
197
238
|
controllerFactory: createKitController(() => withTooltip(makeView(), (root) => root.firstElementChild as HTMLElement)),
|
|
198
239
|
};
|
|
199
240
|
}
|
package/src/base/gap-value.ts
CHANGED
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
|
|
16
16
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
17
17
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
18
|
-
import { kitIcon } from '
|
|
18
|
+
import { kitIcon } from '../shared/icons';
|
|
19
|
+
import { KIT_ATTR_GAP } from '../shared/dom-attrs';
|
|
19
20
|
import { resolveTextDisplay } from './text';
|
|
20
21
|
import { KIT_TABLE_GAP, KIT_TABLE_GAP_MARK, KIT_TABLE_GAP_CLASS_CANDIDATES } from '../recipes/table-gap';
|
|
21
22
|
import { KIT_GAP_PILL, KIT_GAP_PILL_FOCUS, KIT_GAP_TEXT_TRUNCATE, KIT_GAP_VALUE_RECIPE_CLASS_CANDIDATES, KIT_GAP_VALUE_TEXT, type KitGapKind } from '../recipes/status';
|
|
22
23
|
import {
|
|
23
24
|
CLASS_PROP, SIZE_PROP, TOOLTIP_PROP,
|
|
24
25
|
bool, createKitController, formatValue, joinClass, sizeOf, str, withTooltip,
|
|
26
|
+
kitMarkDataState, kitOuterRoot,
|
|
25
27
|
type KitProps, type KitSize, type KitView,
|
|
26
28
|
} from './shared';
|
|
27
29
|
|
|
@@ -47,16 +49,31 @@ export type GapResolved =
|
|
|
47
49
|
| { kind: 'value'; text: string }
|
|
48
50
|
| { kind: KitGapKind; reason: string };
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
export interface GapInput {
|
|
53
|
+
value: unknown;
|
|
54
|
+
state: GapState;
|
|
55
|
+
reason: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const COMPOSITE_GAP_KEYS: readonly string[] = ['value', 'text', 'label', 'state', 'reason'];
|
|
59
|
+
|
|
60
|
+
/** 统一解包复合值 { value | text | label, state?, reason? }(复合值里显式给出的字段优先于同名顶层 prop;非标量裸对象缺有效标量键时按缺失解包,杜绝 "[object Object]") */
|
|
61
|
+
export function unwrapCompositeGap(p: KitProps): GapInput {
|
|
62
|
+
const rawObj = p.value !== null && typeof p.value === 'object' && !Array.isArray(p.value) && !(p.value instanceof Date)
|
|
63
|
+
? (p.value as Record<string, unknown>)
|
|
56
64
|
: null;
|
|
57
|
-
const
|
|
65
|
+
const composite = rawObj !== null && COMPOSITE_GAP_KEYS.some((k) => k in rawObj) ? rawObj : null;
|
|
66
|
+
const value = composite !== null
|
|
67
|
+
? ('value' in composite ? composite.value : ('text' in composite ? composite.text : ('label' in composite ? composite.label : undefined)))
|
|
68
|
+
: (rawObj !== null ? undefined : p.value);
|
|
58
69
|
const state = composite !== null && composite.state !== undefined ? gapStateOf(composite.state) : gapStateOf(p.state);
|
|
59
70
|
const reason = (composite !== null && typeof composite.reason === 'string' && composite.reason.trim() !== '' ? composite.reason : str(p.reason)).trim();
|
|
71
|
+
return { value, state, reason };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 把 props 归一成展示意图(纯函数,便于单测) */
|
|
75
|
+
export function resolveGap(p: KitProps, locale: string): GapResolved {
|
|
76
|
+
const { value, state, reason } = unwrapCompositeGap(p);
|
|
60
77
|
if (state === 'gap' || state === 'unknown') return { kind: state, reason };
|
|
61
78
|
// auto / value:值在场才画值;缺失一律按缺口画(绝不画成 0 或空白)
|
|
62
79
|
if (!gapPresent(value)) return { kind: 'gap', reason };
|
|
@@ -66,12 +83,11 @@ export function resolveGap(p: KitProps, locale: string): GapResolved {
|
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
/** 表格单元格形态(plain)的展示意图:值在场 = 与 Text 同一套格式化;缺失 = 缺口(原因走悬停提示) */
|
|
69
|
-
function resolvePlainGap(p: KitProps, root: HTMLElement): GapResolved {
|
|
70
|
-
const reason =
|
|
71
|
-
const state = gapStateOf(p.state);
|
|
86
|
+
export function resolvePlainGap(p: KitProps, root: HTMLElement): GapResolved {
|
|
87
|
+
const { value, state, reason } = unwrapCompositeGap(p);
|
|
72
88
|
if (state === 'gap' || state === 'unknown') return { kind: state, reason };
|
|
73
|
-
if (!gapPresent(
|
|
74
|
-
return { kind: 'value', text: resolveTextDisplay(p, root).text };
|
|
89
|
+
if (!gapPresent(value)) return { kind: 'gap', reason };
|
|
90
|
+
return { kind: 'value', text: resolveTextDisplay({ ...p, value }, root).text };
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
/** 胶囊里的文字:单行,放不下时截断(胶囊本身 max-w-full + 不换行,图标不缩) */
|
|
@@ -89,7 +105,7 @@ function gapTextNode(text: string): HTMLElement {
|
|
|
89
105
|
export function gapMarkerNode(kind: KitGapKind, reason: string, at: Element | null = null, size: KitSize = 'md'): HTMLElement {
|
|
90
106
|
const el = document.createElement('span');
|
|
91
107
|
el.className = KIT_GAP_PILL[kind][size];
|
|
92
|
-
el.setAttribute(
|
|
108
|
+
el.setAttribute(KIT_ATTR_GAP, kind);
|
|
93
109
|
const marker = kitText(kind === 'gap' ? 'soma.kit.gap_marker' : 'soma.kit.gap_unknown_marker', undefined, at);
|
|
94
110
|
const text = reason.trim() !== ''
|
|
95
111
|
? kitText(kind === 'gap' ? 'soma.kit.gap_with_reason' : 'soma.kit.gap_unknown_with_reason', { reason: reason.trim() }, at)
|
|
@@ -125,7 +141,7 @@ export function createGapValue(): SomaComponentDefinition {
|
|
|
125
141
|
render(root, p) {
|
|
126
142
|
const size = sizeOf(p.size);
|
|
127
143
|
const r = current;
|
|
128
|
-
root.setAttribute(
|
|
144
|
+
root.setAttribute(KIT_ATTR_GAP, r.kind);
|
|
129
145
|
if (r.kind === 'value') {
|
|
130
146
|
root.className = joinClass(KIT_GAP_VALUE_TEXT[size], p.class);
|
|
131
147
|
root.removeAttribute('tabindex');
|
|
@@ -160,9 +176,12 @@ export function createGapValue(): SomaComponentDefinition {
|
|
|
160
176
|
current = plain ? resolvePlainGap(p, root) : resolveGap(p, str(p.locale, kitLocaleAt(root) || 'zh-CN'));
|
|
161
177
|
// tooltip:缺口 / 未知 compact(或 plain)时取原因;其余沿用页面给的 tooltip
|
|
162
178
|
const tooltip = current.kind !== 'value' && (plain || bool(p.compact)) && current.reason !== '' ? current.reason : str(p.tooltip);
|
|
179
|
+
// 缺口 / 未知 = 这一格没有可显示的值:组件根报「内容全空」
|
|
180
|
+
kitMarkDataState(kitOuterRoot(a.host, root), current.kind === 'value' ? 'normal' : 'empty');
|
|
163
181
|
return view.render(root, { ...p, tooltip }, a);
|
|
164
182
|
},
|
|
165
183
|
};
|
|
166
|
-
|
|
184
|
+
// 缺口值是值:根只报元素部件
|
|
185
|
+
}, { self: { part: 'value' } }),
|
|
167
186
|
};
|
|
168
187
|
}
|