soma-kit 0.1.15 → 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/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 -340
- package/spec/generated/kit-page.schema.json +1134 -139
- package/spec/kit-grammar.json +934 -92
- package/spec/kit-grammar.schema.json +167 -2
- package/src/app/app-config.ts +219 -186
- package/src/app/define-kit-actions.ts +126 -20
- package/src/app/define-kit-app.ts +49 -4
- package/src/app/index.ts +5 -0
- package/src/app/kit-view-context.ts +39 -1
- 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 +67 -23
- package/src/app/theme-runtime.ts +414 -85
- 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 +104 -59
- package/src/base/anchored-layer.ts +7 -6
- 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 +347 -50
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +143 -32
- package/src/base/check-core.ts +193 -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 +399 -27
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +148 -36
- package/src/base/context-menu.ts +23 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +114 -96
- package/src/base/date.ts +481 -74
- package/src/base/delta.ts +16 -9
- package/src/base/divider.ts +51 -33
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +57 -21
- package/src/base/gap-value.ts +34 -15
- package/src/base/hint-tips.ts +99 -29
- 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 +79 -22
- package/src/base/inline-error.ts +13 -7
- package/src/base/input.ts +135 -35
- package/src/base/kbd.ts +30 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +282 -101
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +55 -22
- package/src/base/menu-button.ts +73 -22
- package/src/base/menu-core.ts +201 -24
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +7 -5
- package/src/base/motion/hover-gallery.ts +16 -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 +139 -27
- package/src/base/overlay-runtime.ts +30 -23
- package/src/base/overlay-shell.ts +59 -14
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +624 -73
- package/src/base/popup.ts +187 -52
- 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 +141 -22
- 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 +58 -16
- package/src/base/relation-cells.ts +541 -0
- package/src/base/resize-handle.ts +5 -3
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +70 -26
- package/src/base/select.ts +8 -3
- package/src/base/shared.ts +482 -71
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- 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 +123 -54
- package/src/base/tag.ts +184 -66
- package/src/base/text.ts +461 -71
- package/src/base/textarea.ts +88 -39
- package/src/base/time-picker.ts +335 -55
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +342 -88
- package/src/base/upload.ts +604 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +70 -5
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +52 -12
- package/src/biz/auth-panel/compile.ts +13 -3
- package/src/biz/auth-panel/shell.ts +27 -7
- package/src/biz/category-crud/compile.ts +51 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +29 -9
- package/src/biz/checkout-page/compile.ts +37 -3
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +26 -9
- package/src/biz/compose.ts +6 -1
- package/src/biz/data-components.ts +2 -0
- package/src/biz/import-wizard/compile.ts +4 -1
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +32 -18
- package/src/biz/index.ts +1 -1
- package/src/biz/landing-page/compile.ts +3 -2
- package/src/biz/landing-page/shell.ts +22 -3
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +54 -15
- package/src/biz/master-sub/compile.ts +194 -57
- package/src/biz/master-sub/detail-head.ts +141 -18
- package/src/biz/master-sub/index.ts +3 -0
- package/src/biz/master-sub/shell.ts +186 -57
- package/src/biz/multi-board/compile.ts +87 -36
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +3 -2
- package/src/biz/multi-board/prose-fold.ts +15 -11
- package/src/biz/multi-board/shell.ts +148 -37
- package/src/biz/notification-center/compile.ts +20 -6
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +43 -10
- package/src/biz/page-templates/domain-templates.ts +145 -22
- package/src/biz/page-templates/result-page/compile.ts +4 -1
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +17 -4
- package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
- package/src/biz/record-detail/compile.ts +39 -11
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +41 -10
- package/src/biz/settings-center/compile.ts +4 -1
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +30 -9
- package/src/biz/shared/action-host.ts +137 -46
- package/src/biz/shared/compile-helpers.ts +130 -28
- package/src/biz/shared/coordinator.ts +628 -147
- 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 +58 -10
- package/src/biz/shared/overlay-shell.ts +40 -10
- 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 +4 -2
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +21 -11
- package/src/biz/standard-crud/compile.ts +206 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +82 -22
- package/src/biz/standard-crud/summary.ts +2 -37
- package/src/biz/step-form/compile.ts +12 -3
- package/src/biz/step-form/hub.ts +165 -50
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +31 -15
- package/src/biz/types.ts +40 -4
- package/src/cli/kit-cli.ts +145 -26
- package/src/cli/kit-init.ts +3 -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/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +446 -53
- package/src/compile/component-candidates.ts +56 -4
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +1 -1
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/rules-composition.ts +2 -1
- 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 +382 -46
- 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/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +645 -28
- package/src/compile/styles.ts +226 -26
- package/src/compile/types.ts +62 -5
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +49 -22
- package/src/data/anchor-nav.ts +73 -15
- package/src/data/approval-flow.ts +210 -124
- package/src/data/assignment-picker.ts +163 -85
- package/src/data/async-result-panel.ts +110 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +141 -19
- package/src/data/calendar.ts +434 -96
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +72 -38
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +904 -77
- package/src/data/checklist.ts +78 -35
- package/src/data/code-view.ts +106 -48
- package/src/data/comment-thread.ts +607 -87
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +198 -30
- 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 +107 -50
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +33 -17
- package/src/data/embed.ts +142 -7
- package/src/data/engine-ports.ts +13 -4
- package/src/data/field-mapper.ts +104 -48
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +603 -142
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +85 -27
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +637 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +38 -15
- package/src/data/image-viewer.ts +261 -62
- package/src/data/index.ts +63 -1
- package/src/data/item-list.ts +217 -57
- package/src/data/json-view.ts +165 -100
- package/src/data/kanban.ts +339 -87
- 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 +155 -45
- package/src/data/matrix.ts +217 -112
- package/src/data/media-grid.ts +162 -38
- package/src/data/mega-menu.ts +39 -23
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +50 -15
- package/src/data/menu.ts +131 -47
- package/src/data/mockup.ts +30 -22
- package/src/data/modal-dialog.ts +90 -13
- package/src/data/navbar.ts +143 -61
- package/src/data/notice-list.ts +100 -48
- package/src/data/notify-renderer.ts +61 -7
- package/src/data/object-form.ts +1389 -130
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +122 -42
- package/src/data/panel-head.ts +237 -75
- package/src/data/permission-matrix.ts +371 -119
- package/src/data/permission-tree.ts +135 -80
- package/src/data/pricing-table.ts +106 -42
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +63 -31
- package/src/data/record-card.ts +239 -70
- package/src/data/record-picker.ts +56 -27
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +131 -41
- package/src/data/resident.ts +11 -1
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +206 -35
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +376 -102
- package/src/data/rule-builder.ts +129 -80
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +86 -43
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +438 -86
- package/src/data/static-lazy.ts +18 -0
- package/src/data/static-registry.ts +38 -2
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +63 -34
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +128 -47
- package/src/data/system-switcher.ts +40 -20
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +99 -31
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +110 -47
- package/src/data/transfer.ts +195 -47
- package/src/data/tree-table.ts +194 -112
- package/src/data/tree.ts +191 -70
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +242 -102
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +26 -4
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +1 -2
- package/src/frames/inherited-shell.ts +54 -13
- package/src/frames/page-bar.ts +205 -27
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +0 -2
- package/src/frames/shared.ts +64 -21
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +11 -7
- package/src/frames/split-frame/wiring.ts +14 -10
- package/src/frames/tabs-frame/shell.ts +3 -2
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +2 -0
- package/src/frames/workspace-frame/extras.ts +5 -3
- 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 +22 -2
- package/src/frames/workspace-frame/state.ts +42 -14
- package/src/frames/workspace-frame/view.ts +697 -167
- package/src/generated/kit-grammar-runtime.ts +1015 -53
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +96 -3
- package/src/object-renderer/action-group.ts +175 -23
- package/src/object-renderer/action-more.ts +48 -17
- package/src/object-renderer/arrange.ts +241 -29
- 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 +432 -107
- package/src/object-renderer/collection-table.ts +347 -45
- package/src/object-renderer/collection.ts +291 -62
- package/src/object-renderer/compile-data.ts +12 -2
- package/src/object-renderer/defaults.ts +6 -5
- package/src/object-renderer/emit-events.ts +45 -19
- package/src/object-renderer/emit-object.ts +35 -9
- package/src/object-renderer/emit-static.ts +734 -159
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +105 -18
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +18 -2
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +44 -2
- 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 +71 -26
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +424 -103
- 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 +428 -128
- package/src/object-renderer/types.ts +91 -2
- 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/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +15 -14
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +3 -2
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +76 -19
- package/src/recipes/control.ts +64 -5
- package/src/recipes/desc-list.ts +101 -7
- package/src/recipes/divider.ts +30 -9
- package/src/recipes/emphasis.ts +90 -5
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +3 -2
- package/src/recipes/index.ts +28 -4
- package/src/recipes/inherited-shell.ts +21 -15
- package/src/recipes/json-view.ts +6 -5
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +16 -6
- package/src/recipes/overlay.ts +47 -19
- package/src/recipes/page-width.ts +31 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +37 -19
- 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 +5 -5
- package/src/recipes/state.ts +54 -3
- package/src/recipes/status.ts +14 -14
- package/src/recipes/strip.ts +47 -5
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +33 -4
- package/src/recipes/table-gap.ts +3 -2
- package/src/recipes/table-native-edit.ts +22 -9
- package/src/recipes/table-row.ts +45 -12
- package/src/recipes/tabs.ts +54 -22
- package/src/recipes/text-diff.ts +15 -8
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +68 -3
- 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/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +58 -12
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/icons.ts +28 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- 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/pipeline-mode.ts +64 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +165 -24
- 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 +527 -16
- package/src/theme/kit-theme.tpl +491 -16
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +522 -185
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +3 -2
- package/src/theme/theme-tokens.ts +1601 -93
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/frames/list-summary.ts +0 -123
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
// 组件自报声明:组件实例在组件树上的三个事实——组件部件、宿主、是否自管布局(业务功能描述 §3.5)。
|
|
2
|
+
// 展开事件按组件名查这里;组件自己不判断页面、不读空间地图,只经这张表「报出自己是什么」。
|
|
3
|
+
// 本文件只登记名字字符串,不 import data/ 或 base/:spatial/ 不认识任何具体组件目录(架构 §3.2 依赖规则),
|
|
4
|
+
// 名单齐不齐由 tests/spatial/self-report.test.ts 对着各注册表核对。
|
|
5
|
+
// 内置登记表是模块级只读数据;应用自定义组件与第三方组件包的补登按编译上下文传入(kitSelfReportTable 建表,展开的入参 selfReports 带进来),
|
|
6
|
+
// 不改进程级全局状态——同一进程里编两个应用,补登互不串。补登不能覆盖内置项;没登记的取缺省(部件自定义、宿主为块、自管布局)。
|
|
7
|
+
// 另登记两项取色事实(用到图表色阶、用到分类色):展开记在组件实例的元信息上、报告原样带出,下游不按组件名判断。
|
|
8
|
+
// 应用组件的补登来自组件契约顶层的静态自报声明 selfReport(KitComponentSelfDecl),由应用装配收集、经编译上下文传入。
|
|
9
|
+
// 应用组件还可自报内容宽(contentWidth,容器档名,SCON-174):组件内部自画的表格 / 版面完整显示要多宽,版心求解按表格固有宽度计入;
|
|
10
|
+
// 换算只在本文件一处(kitSelfContentRem),页面线(展开记在实例元信息上)与编排层的版心事实(compile/stages.ts)都调它,两种模式同源。
|
|
11
|
+
|
|
12
|
+
import { arrangeTiers } from 'soma-foundation/arrange';
|
|
13
|
+
import { KIT_COMPONENT_PARTS, KIT_HOSTS, type KitComponentPart, type KitHost } from '../shared/page-attrs';
|
|
14
|
+
|
|
15
|
+
export interface KitSelfReport {
|
|
16
|
+
readonly componentPart: KitComponentPart;
|
|
17
|
+
readonly host: KitHost;
|
|
18
|
+
readonly selfLayout: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 未知组件的缺省:不了解它的内部,就不替它排内部,也不假设它是行内小件 */
|
|
22
|
+
export const KIT_SELF_REPORT_DEFAULT: KitSelfReport = Object.freeze({ componentPart: 'custom', host: 'block', selfLayout: true });
|
|
23
|
+
|
|
24
|
+
export class KitSelfReportError extends Error {
|
|
25
|
+
constructor(message: string) {
|
|
26
|
+
super(`[soma-kit][组件自报] ${message}`);
|
|
27
|
+
this.name = 'KitSelfReportError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 登记行的简写:部件、宿主、自管布局;缺省最常见的「块、非自管」,让名单读起来只剩差异
|
|
32
|
+
type Row = readonly [KitComponentPart, KitHost?, boolean?];
|
|
33
|
+
const r = (part: KitComponentPart, host: KitHost = 'block', selfLayout = false): Row => [part, host, selfLayout];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 内置写死形状数据组件(data/static-registry.ts 的 KIT_STATIC_BUILTIN_SPECS)。
|
|
37
|
+
* 自管布局取真的只有自己排整块二维版面的:画布 / 图形 / 时间轴网格 / 泳道类,外部的栏数、贴边对它们没有意义。
|
|
38
|
+
*/
|
|
39
|
+
const STATIC_DATA: Readonly<Record<string, Row>> = {
|
|
40
|
+
Tree: r('tree'),
|
|
41
|
+
StatGroup: r('stats-group'),
|
|
42
|
+
Pager: r('pager'),
|
|
43
|
+
Timeline: r('timeline'),
|
|
44
|
+
AuditLog: r('timeline'),
|
|
45
|
+
LogStream: r('custom'),
|
|
46
|
+
StageFlow: r('stepper'),
|
|
47
|
+
HeatCalendar: r('calendar', 'block', true),
|
|
48
|
+
OrgChart: r('custom', 'block', true),
|
|
49
|
+
GraphView: r('custom', 'block', true),
|
|
50
|
+
ScheduleGrid: r('schedule-grid', 'block', true),
|
|
51
|
+
Steps: r('stepper'),
|
|
52
|
+
ApprovalFlow: r('stepper'),
|
|
53
|
+
Checklist: r('item-list'),
|
|
54
|
+
CommentThread: r('custom'),
|
|
55
|
+
RecordCard: r('record'),
|
|
56
|
+
CardGrid: r('custom'),
|
|
57
|
+
AmountBreakdown: r('kv'),
|
|
58
|
+
Transfer: r('editor'),
|
|
59
|
+
PermissionMatrix: r('editor'),
|
|
60
|
+
FieldMapper: r('editor'),
|
|
61
|
+
Gantt: r('gantt', 'block', true),
|
|
62
|
+
Matrix: r('table'),
|
|
63
|
+
FlowEditor: r('editor', 'block', true),
|
|
64
|
+
PermissionTree: r('editor'),
|
|
65
|
+
AssignmentPicker: r('editor'),
|
|
66
|
+
Menu: r('nav'),
|
|
67
|
+
Navbar: r('nav'),
|
|
68
|
+
MenuBar: r('nav'),
|
|
69
|
+
Breadcrumbs: r('nav'),
|
|
70
|
+
// 水印是叠在宿主上的定位图层:它自己有一个铺满宿主的定位盒(absolute inset-0),不是透传
|
|
71
|
+
Watermark: r('custom'),
|
|
72
|
+
AnchorNav: r('nav'),
|
|
73
|
+
Kanban: r('board', 'block', true),
|
|
74
|
+
Hero: r('custom'),
|
|
75
|
+
Carousel: r('custom'),
|
|
76
|
+
Dock: r('nav'),
|
|
77
|
+
Diff: r('custom'),
|
|
78
|
+
TextDiff: r('custom'),
|
|
79
|
+
Mockup: r('custom'),
|
|
80
|
+
Footer: r('custom'),
|
|
81
|
+
PricingTable: r('custom'),
|
|
82
|
+
CodeView: r('text'),
|
|
83
|
+
JsonView: r('tree'),
|
|
84
|
+
MarkdownView: r('text'),
|
|
85
|
+
ItemList: r('item-list'),
|
|
86
|
+
NoticeList: r('notice'),
|
|
87
|
+
SystemSwitcher: r('nav'),
|
|
88
|
+
RowEditor: r('editor'),
|
|
89
|
+
AsyncResultPanel: r('custom'),
|
|
90
|
+
ResultPanel: r('notice'),
|
|
91
|
+
RequestConsole: r('custom', 'block', true),
|
|
92
|
+
RuleBuilder: r('editor'),
|
|
93
|
+
Calendar: r('calendar', 'block', true),
|
|
94
|
+
ImageViewer: r('custom'),
|
|
95
|
+
Leaderboard: r('item-list'),
|
|
96
|
+
FileList: r('item-list'),
|
|
97
|
+
MediaGrid: r('custom'),
|
|
98
|
+
EmojiReactionBar: r('custom', 'inline'),
|
|
99
|
+
RichTextEditor: r('editor'),
|
|
100
|
+
Questionnaire: r('form'),
|
|
101
|
+
// 引导的遮罩与步骤卡挂在页面最外层,要按目标元素的测量盒定位:有自己的定位盒,不是透传
|
|
102
|
+
TourGuide: r('custom'),
|
|
103
|
+
TrendLine: r('chart', 'inline', true),
|
|
104
|
+
SegmentBar: r('chart', 'block', true),
|
|
105
|
+
TargetProgress: r('custom'),
|
|
106
|
+
CompareView: r('table'),
|
|
107
|
+
TileGrid: r('custom'),
|
|
108
|
+
StatusStrip: r('custom'),
|
|
109
|
+
Waterfall: r('chart', 'block', true),
|
|
110
|
+
SummaryStrip: r('kv'),
|
|
111
|
+
RecordPicker: r('custom', 'control'),
|
|
112
|
+
SegmentedSwitch: r('segmented', 'control'),
|
|
113
|
+
MetaAction: r('action', 'control'),
|
|
114
|
+
ScopeSwitch: r('segmented', 'control'),
|
|
115
|
+
Chart: r('chart', 'block', true),
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/** 常驻数据组件(data/resident.ts 的 createKitResidentDataComponents;RowEditor 与写死形状件同名同报,不重复登记) */
|
|
119
|
+
const RESIDENT_DATA: Readonly<Record<string, Row>> = {
|
|
120
|
+
KitObjectForm: r('form'),
|
|
121
|
+
KitTableActions: r('action', 'control'),
|
|
122
|
+
KitActionMore: r('action', 'control'),
|
|
123
|
+
KitTableHead: r('table'),
|
|
124
|
+
KitTableTools: r('action', 'control'),
|
|
125
|
+
KitTableSummary: r('table'),
|
|
126
|
+
// 以下是不画东西的接线件或包裹层:没有视觉盒,宿主透传(透传只给真正没有界面、只做协作与桥接的组件)
|
|
127
|
+
KitTableGap: r('custom', 'passthrough'),
|
|
128
|
+
KitCollectionState: r('notice'),
|
|
129
|
+
KitCollapseWiring: r('custom', 'passthrough'),
|
|
130
|
+
KitTreeTable: r('table'),
|
|
131
|
+
KitVirtualRows: r('table'),
|
|
132
|
+
// 右键菜单在指针处弹出浮起层,要有自己的定位盒:不是透传
|
|
133
|
+
KitContextMenu: r('action'),
|
|
134
|
+
KitRedirect: r('custom', 'passthrough'),
|
|
135
|
+
KitAccessGate: r('custom', 'passthrough'),
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** 业务组件依赖的协作数据组件(biz/data-components.ts 的 KIT_BIZ_DATA_COMPONENTS) */
|
|
139
|
+
const BIZ_DATA: Readonly<Record<string, Row>> = {
|
|
140
|
+
// 四个枢纽与桥接件只持有状态、转发事件,没有界面
|
|
141
|
+
KitCrudBridge: r('custom', 'passthrough'),
|
|
142
|
+
KitActionHost: r('custom', 'passthrough'),
|
|
143
|
+
KitLinkHub: r('custom', 'passthrough'),
|
|
144
|
+
KitStepHub: r('custom', 'passthrough'),
|
|
145
|
+
KitImportHub: r('custom', 'passthrough'),
|
|
146
|
+
KitBoardProse: r('text'),
|
|
147
|
+
KitDetailHead: r('record'),
|
|
148
|
+
KitPageFormActions: r('action', 'control'),
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/** 页面框层常驻组件(frames/resident-components.ts 的 createKitFrameResidentComponents) */
|
|
152
|
+
const FRAME_RESIDENT: Readonly<Record<string, Row>> = {
|
|
153
|
+
KitTabsWiring: r('custom', 'passthrough'),
|
|
154
|
+
KitSplitWiring: r('custom', 'passthrough'),
|
|
155
|
+
// 多页签工作台自己排外壳内容面板与工作页,整页应用型
|
|
156
|
+
KitWorkspace: r('custom', 'block', true),
|
|
157
|
+
KitPageBar: r('custom'),
|
|
158
|
+
KitPageStatus: r('notice'),
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* 内置基础组件(base/index.ts 的 KIT_BASE_COMPONENTS,含动效组件)。
|
|
163
|
+
* 输入类部件为「输入」、取控件宿主(按控件高度档排;开关是落在单元格里的行内小件);徽标、标签、头像、单元格值这类行内小件取行内宿主,
|
|
164
|
+
* 它们落在表格单元格里,按宿主的几何契约不得吞掉父容器的对齐、不得撑高行。
|
|
165
|
+
*/
|
|
166
|
+
const BASE: Readonly<Record<string, Row>> = {
|
|
167
|
+
Text: r('text'),
|
|
168
|
+
Tag: r('value', 'inline'),
|
|
169
|
+
Input: r('input', 'control'),
|
|
170
|
+
Textarea: r('input', 'control'),
|
|
171
|
+
Number: r('input', 'control'),
|
|
172
|
+
Select: r('input', 'control'),
|
|
173
|
+
Radio: r('input', 'control'),
|
|
174
|
+
Checkbox: r('input', 'control'),
|
|
175
|
+
Switch: r('input', 'inline'),
|
|
176
|
+
Date: r('input', 'control'),
|
|
177
|
+
DateRange: r('input', 'control'),
|
|
178
|
+
Button: r('action', 'control'),
|
|
179
|
+
Link: r('action', 'inline'),
|
|
180
|
+
TagInput: r('input', 'control'),
|
|
181
|
+
Upload: r('input', 'control'),
|
|
182
|
+
TimePicker: r('input', 'control'),
|
|
183
|
+
TimeRange: r('input', 'control'),
|
|
184
|
+
TreeSelect: r('input', 'control'),
|
|
185
|
+
Alert: r('notice'),
|
|
186
|
+
KitDivider: r('custom'),
|
|
187
|
+
TextRotate: r('text', 'inline'),
|
|
188
|
+
Hover3d: r('custom'),
|
|
189
|
+
HoverGallery: r('custom'),
|
|
190
|
+
Aura: r('custom'),
|
|
191
|
+
Marquee: r('custom'),
|
|
192
|
+
Range: r('input', 'control'),
|
|
193
|
+
Rating: r('input', 'control'),
|
|
194
|
+
Otp: r('input', 'control'),
|
|
195
|
+
Avatar: r('value', 'inline'),
|
|
196
|
+
AvatarGroup: r('value', 'inline'),
|
|
197
|
+
Kbd: r('value', 'inline'),
|
|
198
|
+
KitProgress: r('value', 'inline'),
|
|
199
|
+
KitDelta: r('stat-delta', 'inline'),
|
|
200
|
+
Countdown: r('value', 'inline'),
|
|
201
|
+
Swap: r('custom', 'inline'),
|
|
202
|
+
ButtonGroup: r('action', 'control'),
|
|
203
|
+
PeriodPicker: r('input', 'control'),
|
|
204
|
+
Fab: r('action', 'control'),
|
|
205
|
+
Image: r('value'),
|
|
206
|
+
MenuButton: r('action', 'control'),
|
|
207
|
+
Cascader: r('input', 'control'),
|
|
208
|
+
Combobox: r('input', 'control'),
|
|
209
|
+
ColorPicker: r('input', 'control'),
|
|
210
|
+
Mentions: r('input', 'control'),
|
|
211
|
+
Popover: r('custom', 'inline'),
|
|
212
|
+
PriceText: r('value', 'inline'),
|
|
213
|
+
QrCode: r('custom'),
|
|
214
|
+
// 命令面板是居中弹出的浮层,有自己的定位盒
|
|
215
|
+
CommandPalette: r('custom'),
|
|
216
|
+
GapValue: r('value', 'inline'),
|
|
217
|
+
PersonCell: r('value', 'inline'),
|
|
218
|
+
TagGroup: r('value', 'inline'),
|
|
219
|
+
Identifier: r('value', 'inline'),
|
|
220
|
+
RecordsCell: r('value', 'inline'),
|
|
221
|
+
FileCell: r('value', 'inline'),
|
|
222
|
+
LinkCell: r('value', 'inline'),
|
|
223
|
+
PathCell: r('value', 'inline'),
|
|
224
|
+
Badge: r('value', 'inline'),
|
|
225
|
+
// 通知在视口角落堆叠定位,有自己的定位盒
|
|
226
|
+
Notification: r('notice'),
|
|
227
|
+
Card: r('record'),
|
|
228
|
+
Collapse: r('custom'),
|
|
229
|
+
Tabs: r('segmented'),
|
|
230
|
+
// 吸附要测量自己的盒(滚动越过阈值时切换为固定定位并占位),不能是透传
|
|
231
|
+
Affix: r('custom'),
|
|
232
|
+
Spinner: r('value', 'inline'),
|
|
233
|
+
HoverCard: r('custom', 'inline'),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const toReport = ([componentPart, host = 'block', selfLayout = false]: Row): KitSelfReport => Object.freeze({ componentPart, host, selfLayout });
|
|
237
|
+
|
|
238
|
+
// 内置登记:模块加载时建好、之后只读(不导出可写的表,也没有往里写的入口)
|
|
239
|
+
const BUILTIN: ReadonlyMap<string, KitSelfReport> = (() => {
|
|
240
|
+
const m = new Map<string, KitSelfReport>();
|
|
241
|
+
for (const table of [STATIC_DATA, RESIDENT_DATA, BIZ_DATA, FRAME_RESIDENT, BASE]) {
|
|
242
|
+
for (const [name, row] of Object.entries(table)) {
|
|
243
|
+
// 同名出现在两张表里说明名单抄错了:在模块加载时就失败,而不是让后一张静默覆盖前一张
|
|
244
|
+
if (m.has(name)) throw new KitSelfReportError(`内置组件 ${name} 重复登记`);
|
|
245
|
+
m.set(name, toReport(row));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return m;
|
|
249
|
+
})();
|
|
250
|
+
|
|
251
|
+
/** 内置登记的全部组件名(供对账测试读;应用补登的不在内) */
|
|
252
|
+
export const KIT_BUILTIN_SELF_REPORTED: readonly string[] = Object.freeze([...BUILTIN.keys()]);
|
|
253
|
+
|
|
254
|
+
const PARTS: ReadonlySet<string> = new Set(KIT_COMPONENT_PARTS);
|
|
255
|
+
const HOSTS: ReadonlySet<string> = new Set(KIT_HOSTS);
|
|
256
|
+
|
|
257
|
+
/** 补登表的一项:三个自报事实,另可带取色事实(没带 = 四项都算用到,见 kitInstanceUses)与内容宽(容器档名,见 kitSelfContentRem) */
|
|
258
|
+
export interface KitSelfReportEntry extends KitSelfReport {
|
|
259
|
+
readonly uses?: KitInstanceUses;
|
|
260
|
+
readonly contentWidth?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 内容宽的闭集:容器宽度档名(真源 soma-design/spec/adaptive.json#containerTiers,经 soma-foundation/arrange#arrangeTiers,自窄到宽),
|
|
265
|
+
* 与组件里写的容器查询前缀(@md: / @3xl: / @max-2xl:hidden …)同一套档名。本文件不抄档名与 rem,现取现用
|
|
266
|
+
*/
|
|
267
|
+
const contentTierNames = (): readonly string[] => arrangeTiers().map((t) => t.name);
|
|
268
|
+
|
|
269
|
+
/** 内容宽档名 → rem(档的下界宽);不是档名为 undefined */
|
|
270
|
+
function contentRemOfTier(tier: unknown): number | undefined {
|
|
271
|
+
if (typeof tier !== 'string') return undefined;
|
|
272
|
+
return arrangeTiers().find((t) => t.name === tier)?.rem;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** 一个应用(一次编译)补登的自报表:组件名 → 自报。由 kitSelfReportTable 建,只读 */
|
|
276
|
+
export type KitSelfReportTable = ReadonlyMap<string, KitSelfReportEntry>;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* 应用组件的静态自报声明:写在组件契约顶层的 selfReport 段(core 对契约未知段不透明、原样透传,KI-18;与契约 look 段同一做法)。
|
|
280
|
+
* 编译期由应用装配从已登记的组件定义收集(app/server.ts),经编译上下文 selfReports 交给页面线;运行期控制器骨架的 self 选项(base/shared.ts)是另一回事。
|
|
281
|
+
* 形状与登记项同口径:只有组件部件必写;宿主缺省为块;自管布局缺省为是(与未登记组件的缺省同一结论:不了解就不替它排内部);
|
|
282
|
+
* 四项取色事实(usesChartScale / usesCategorical / usesTone / usesCode)各自缺省为用到(漏判时宁可多报,仅显式写 false 时关闭)。层级角色不在这里:组件实例的层级角色由页面线按呈现与条带给,组件自报的层级角色只在运行期(kitMarkSelf)
|
|
283
|
+
*/
|
|
284
|
+
export interface KitComponentSelfDecl {
|
|
285
|
+
readonly componentPart: KitComponentPart;
|
|
286
|
+
readonly host?: KitHost;
|
|
287
|
+
readonly selfLayout?: boolean;
|
|
288
|
+
readonly usesChartScale?: boolean;
|
|
289
|
+
readonly usesCategorical?: boolean;
|
|
290
|
+
readonly usesTone?: boolean;
|
|
291
|
+
readonly usesCode?: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* 内容宽(可选,SCON-174):组件内部自画的表格 / 版面完整显示(不收列、不横滚)所需的最窄容器档名,闭集 = 容器宽度档
|
|
294
|
+
* (真源 adaptive.json#containerTiers:xs / sm / md / lg / xl / 2xl / 3xl / 4xl,与组件里写的容器查询前缀同名)。
|
|
295
|
+
* 版心求解把它按表格固有宽度计入(取档的下界 rem,与页面上 kit 自己画的表同一条规则):阅读型页面(ReportBoard 等)按它升到 wide / xwide,
|
|
296
|
+
* 其余页面照表格宽度规则求。不写 = 不计(与改动前相同);不在闭集里、或写在内置组件上,按其余自报字段同口径报错(应用装配隔离该组件自报,KIT-COMP-006)。
|
|
297
|
+
* 只是元信息:不进属性总账,不到浏览器
|
|
298
|
+
*/
|
|
299
|
+
readonly contentWidth?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* 静态自报声明的字段闭集(只此一处):应用装配(app/server.ts#collectSelfReports)按它从契约 selfReport 段摘字段、写诊断提示,
|
|
304
|
+
* 新增字段只改 KitComponentSelfDecl 与这里,装配侧不另抄一份(漏抄会让字段在真实装配里被静默剥掉)
|
|
305
|
+
*/
|
|
306
|
+
export const KIT_SELF_DECL_KEYS: readonly (keyof KitComponentSelfDecl)[] = Object.freeze([
|
|
307
|
+
'componentPart',
|
|
308
|
+
'host',
|
|
309
|
+
'selfLayout',
|
|
310
|
+
'usesChartScale',
|
|
311
|
+
'usesCategorical',
|
|
312
|
+
'usesTone',
|
|
313
|
+
'usesCode',
|
|
314
|
+
'contentWidth',
|
|
315
|
+
] as const);
|
|
316
|
+
|
|
317
|
+
/** 静态自报声明 → 补登表的一项(只补缺省,不核闭集;核闭集与内置冲突在 kitSelfReportTable) */
|
|
318
|
+
export function kitSelfReportOfDecl(decl: KitComponentSelfDecl): KitSelfReportEntry {
|
|
319
|
+
return {
|
|
320
|
+
componentPart: decl.componentPart,
|
|
321
|
+
host: decl.host ?? 'block',
|
|
322
|
+
selfLayout: decl.selfLayout ?? KIT_SELF_REPORT_DEFAULT.selfLayout,
|
|
323
|
+
uses: {
|
|
324
|
+
usesChartScale: decl.usesChartScale ?? true,
|
|
325
|
+
usesCategorical: decl.usesCategorical ?? true,
|
|
326
|
+
usesTone: decl.usesTone ?? true,
|
|
327
|
+
usesCode: decl.usesCode ?? true,
|
|
328
|
+
},
|
|
329
|
+
...(decl.contentWidth !== undefined ? { contentWidth: decl.contentWidth } : {}),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const USES_KEYS: readonly ('usesChartScale' | 'usesCategorical' | 'usesTone' | 'usesCode')[] = [
|
|
334
|
+
'usesChartScale',
|
|
335
|
+
'usesCategorical',
|
|
336
|
+
'usesTone',
|
|
337
|
+
'usesCode',
|
|
338
|
+
];
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* 建应用补登的自报表(按编译上下文传给展开,不写进任何全局状态)。逐条核闭集——应用侧可能不经类型检查传进来(YAML 装配);
|
|
342
|
+
* 补登不能覆盖内置项:与内置登记同名时只允许完全相同(重复装配是幂等的),不同就报错——
|
|
343
|
+
* 自报是组件的事实,后登记的静默改掉内置的会让同名组件在不同应用里表现不一。取色事实对内置组件不生效(内置按名单登记)。
|
|
344
|
+
* 内容宽(contentWidth)只许是容器档名;内置组件不自报内容宽(内置组件画的东西由 kit 自己求宽),同名补登写了它按改登报错
|
|
345
|
+
*/
|
|
346
|
+
export function kitSelfReportTable(entries: Readonly<Record<string, KitSelfReportEntry>>): KitSelfReportTable {
|
|
347
|
+
const out = new Map<string, KitSelfReportEntry>();
|
|
348
|
+
for (const [component, report] of Object.entries(entries)) {
|
|
349
|
+
if (component === '') throw new KitSelfReportError('组件名不能为空');
|
|
350
|
+
if (!PARTS.has(report.componentPart)) throw new KitSelfReportError(`${component} 的组件部件 ${String(report.componentPart)} 不在闭集内`);
|
|
351
|
+
if (!HOSTS.has(report.host)) throw new KitSelfReportError(`${component} 的宿主 ${String(report.host)} 不在闭集内`);
|
|
352
|
+
if (typeof report.selfLayout !== 'boolean') throw new KitSelfReportError(`${component} 的自管布局必须是布尔`);
|
|
353
|
+
const uses = report.uses;
|
|
354
|
+
if (
|
|
355
|
+
uses !== undefined
|
|
356
|
+
&& USES_KEYS.some((k) => (k === 'usesCode' ? uses.usesCode !== undefined && typeof uses.usesCode !== 'boolean' : typeof uses[k] !== 'boolean'))
|
|
357
|
+
) {
|
|
358
|
+
throw new KitSelfReportError(`${component} 的取色事实(${USES_KEYS.join(' / ')})必须是布尔`);
|
|
359
|
+
}
|
|
360
|
+
const contentWidth = report.contentWidth;
|
|
361
|
+
if (contentWidth !== undefined && contentRemOfTier(contentWidth) === undefined) {
|
|
362
|
+
throw new KitSelfReportError(`${component} 的内容宽 contentWidth ${JSON.stringify(contentWidth)} 不在容器档闭集内(${contentTierNames().join(' / ')})`);
|
|
363
|
+
}
|
|
364
|
+
const base = toReport([report.componentPart, report.host, report.selfLayout]);
|
|
365
|
+
const prev = BUILTIN.get(component);
|
|
366
|
+
if (prev !== undefined && (prev.componentPart !== base.componentPart || prev.host !== base.host || prev.selfLayout !== base.selfLayout)) {
|
|
367
|
+
throw new KitSelfReportError(`组件 ${component} 是内置组件,已登记为 ${prev.componentPart} / ${prev.host} / ${String(prev.selfLayout)},应用补登不能改登`);
|
|
368
|
+
}
|
|
369
|
+
if (prev !== undefined && contentWidth !== undefined) {
|
|
370
|
+
throw new KitSelfReportError(`组件 ${component} 是内置组件,内置组件不自报内容宽(contentWidth 只给应用自有组件写),应用补登不能改登`);
|
|
371
|
+
}
|
|
372
|
+
const withUses: KitSelfReportEntry = uses === undefined
|
|
373
|
+
? base
|
|
374
|
+
: Object.freeze({
|
|
375
|
+
...base,
|
|
376
|
+
uses: Object.freeze({
|
|
377
|
+
usesChartScale: uses.usesChartScale,
|
|
378
|
+
usesCategorical: uses.usesCategorical,
|
|
379
|
+
usesTone: uses.usesTone,
|
|
380
|
+
usesCode: uses.usesCode ?? true,
|
|
381
|
+
}),
|
|
382
|
+
});
|
|
383
|
+
const next: KitSelfReportEntry = contentWidth === undefined ? withUses : Object.freeze({ ...withUses, contentWidth });
|
|
384
|
+
out.set(component, next);
|
|
385
|
+
}
|
|
386
|
+
return out;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* 自报与取色共用的查表次序(只此一处):内置登记表里确有这个名字 → 内置项;否则本应用补登表里有 → 补登项;都没有 → 无(调用方取各自的缺省)。
|
|
391
|
+
* 「内置表里登记了」按 Map#has 判,不按查出的值判:内置表对未登记名字没有值,不会以缺省挡住补登表;内置项不可被补登覆盖(建表时已拒绝改登)
|
|
392
|
+
*/
|
|
393
|
+
type Lookup =
|
|
394
|
+
| { readonly from: 'builtin'; readonly report: KitSelfReport }
|
|
395
|
+
| { readonly from: 'app'; readonly report: KitSelfReportEntry }
|
|
396
|
+
| { readonly from: 'none' };
|
|
397
|
+
|
|
398
|
+
function lookup(component: string, app: KitSelfReportTable | undefined): Lookup {
|
|
399
|
+
const builtin = BUILTIN.get(component);
|
|
400
|
+
if (BUILTIN.has(component) && builtin !== undefined) return { from: 'builtin', report: builtin };
|
|
401
|
+
const added = app?.get(component);
|
|
402
|
+
if (added !== undefined) return { from: 'app', report: added };
|
|
403
|
+
return { from: 'none' };
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** 内置登记 → 本应用补登 → 缺省(次序见 lookup) */
|
|
407
|
+
export function kitSelfReport(component: string, app?: KitSelfReportTable): KitSelfReport {
|
|
408
|
+
const hit = lookup(component, app);
|
|
409
|
+
return hit.from === 'none' ? KIT_SELF_REPORT_DEFAULT : hit.report;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// ── 组件自报的内容宽(SCON-174)──────────────────────────────────────────────────────────
|
|
413
|
+
// 应用组件自画的表格 / 版面(如原生 <table> 的站会表、报告区块的对比表)页面线看不进去:组件在静态自报声明里写 contentWidth(容器档名),
|
|
414
|
+
// 版心求解把它当作表格固有宽度(tableIdealRem 取最大)计入,与页面上 kit 自己画的表同一条求解规则(soma-design 的 solvePageEnvelope:
|
|
415
|
+
// 阅读模式内嵌宽表按表宽升档、超 xwide 上限放开)。换算只在这里:页面线的展开(实例元信息 contentRem,布局手搭树时的退路读它)
|
|
416
|
+
// 与编排层的版心事实(compile/stages.ts#derivePageEnvelopeFacts,两种模式共用的那一份)都调这两个函数。
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* 组件自报的内容宽(rem,容器档的下界宽):与 kitSelfReport 同一套查表次序——内置组件不自报内容宽(为 undefined);
|
|
420
|
+
* 本应用补登项写了 contentWidth 的取它的档宽;没登记、没写为 undefined
|
|
421
|
+
*/
|
|
422
|
+
export function kitSelfContentRem(component: string, app?: KitSelfReportTable): number | undefined {
|
|
423
|
+
const hit = lookup(component, app);
|
|
424
|
+
return hit.from === 'app' ? contentRemOfTier(hit.report.contentWidth) : undefined;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* 同 kitSelfContentRem,直接读应用装配收集的静态自报声明(编译上下文 app.selfReports)——编排层求版心事实时用(compile/ 不建补登表)。
|
|
429
|
+
* 声明按建表的同一套核对过一遍:不合法的(应用装配会隔离、报 KIT-COMP-006 的那种)不带内容宽,与「隔离后回落缺省自报」同一结论
|
|
430
|
+
*/
|
|
431
|
+
export function kitSelfContentRemOfDecls(component: string, decls: Readonly<Record<string, KitComponentSelfDecl>> | undefined): number | undefined {
|
|
432
|
+
if (decls === undefined || component === '' || !Object.hasOwn(decls, component)) return undefined;
|
|
433
|
+
const decl = decls[component];
|
|
434
|
+
if (decl === undefined || decl.contentWidth === undefined) return undefined;
|
|
435
|
+
try {
|
|
436
|
+
return kitSelfContentRem(component, kitSelfReportTable({ [component]: kitSelfReportOfDecl(decl) }));
|
|
437
|
+
} catch {
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// ── 组件用到的取色(组件实例的事实)────────────────────────────────────────────────────
|
|
443
|
+
// 展开把它记在组件实例的元信息上,生成事件原样带进页面属性报告的行(spatial/emit.ts#reportPageAttrs);
|
|
444
|
+
// 怎样据它决定下发哪些样式不归页面线(compile/page-pipeline.ts 只读报告汇总)。漏判时宁可多报:
|
|
445
|
+
// 内置组件按下面三张名单登记;应用补登时在静态自报声明里写了取色事实的按声明,没写的与未登记的组件不了解它画什么,四项都算用到。
|
|
446
|
+
|
|
447
|
+
/** 读图表色阶(--soma-chart-* / fill-chart-* 等系列色)的内置组件:图表类,以及按系列色画块的热力日历、矩阵、甘特与摘要指标件 */
|
|
448
|
+
const CHART_SCALE_USERS: ReadonlySet<string> = new Set([
|
|
449
|
+
'Chart', 'SegmentBar', 'Waterfall', 'TrendLine', 'HeatCalendar', 'Matrix', 'Gantt',
|
|
450
|
+
'CompareView', 'StatusStrip', 'TileGrid', 'TargetProgress',
|
|
451
|
+
]);
|
|
452
|
+
|
|
453
|
+
/** 按名字散列或按出现顺序取分类色(--kit-cat-auto 自动序列)的内置组件:不经字段的分类色序号也会用到分类色令牌 */
|
|
454
|
+
const CATEGORICAL_USERS: ReadonlySet<string> = new Set([
|
|
455
|
+
'Avatar', 'AvatarGroup', 'Kanban', 'Tag', 'TagGroup', 'Text', 'PersonCell', 'Identifier',
|
|
456
|
+
'Timeline', 'AuditLog', 'RecordCard', 'Gantt', 'Calendar', 'ScheduleGrid', 'FlowEditor', 'ApprovalFlow',
|
|
457
|
+
'Checklist', 'Leaderboard', 'OrgChart', 'StatGroup', 'SummaryStrip',
|
|
458
|
+
// 运行期按条目标题 / 作者名散列或按文件类别写分类色名(data-kit-tone=cN)的条目列表、评论串、文件列表与业务壳(侧栏账户头像):
|
|
459
|
+
// 不登记则只有这些组件的页面分类色令牌与载体都不下发,前缀块 / 头像 / 扩展名块落回中性灰(与 compile-page 的 DECOR_CARRIER_COMPONENTS 同口径)
|
|
460
|
+
'ItemList', 'CommentThread', 'FileList', 'KitWorkspace',
|
|
461
|
+
]);
|
|
462
|
+
|
|
463
|
+
/** 读代码高亮令牌(--soma-syntax-*,经 recipes/code-view.ts)的内置组件:代码视图、JSON 视图、Markdown 视图与请求控制台 */
|
|
464
|
+
const CODE_USERS: ReadonlySet<string> = new Set(['CodeView', 'JsonView', 'MarkdownView', 'RequestConsole']);
|
|
465
|
+
|
|
466
|
+
/** 组件实例用到的取色:图表色阶(CHART_SCALE_USERS)、分类色(CATEGORICAL_USERS)、语义色调、代码高亮(CODE_USERS;应用自报缺省保守按 true) */
|
|
467
|
+
export interface KitInstanceUses {
|
|
468
|
+
readonly usesChartScale: boolean;
|
|
469
|
+
readonly usesCategorical: boolean;
|
|
470
|
+
readonly usesTone: boolean;
|
|
471
|
+
readonly usesCode?: boolean;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const USES_ALL: KitInstanceUses = Object.freeze({ usesChartScale: true, usesCategorical: true, usesTone: true, usesCode: true });
|
|
475
|
+
|
|
476
|
+
/** 组件用到的取色:内置组件按登记;应用补登时声明了取色事实的按声明;其余(补登没声明的、未登记的)四项都算用到 */
|
|
477
|
+
export function kitInstanceUses(component: string, app?: KitSelfReportTable): KitInstanceUses {
|
|
478
|
+
// 与 kitSelfReport 同一套次序(lookup):内置按名单,补登按声明(没声明取色事实的四项都算用到),都没有四项都算用到
|
|
479
|
+
const hit = lookup(component, app);
|
|
480
|
+
if (hit.from === 'builtin') {
|
|
481
|
+
const usesCode = CODE_USERS.has(component);
|
|
482
|
+
return Object.freeze({
|
|
483
|
+
usesChartScale: CHART_SCALE_USERS.has(component),
|
|
484
|
+
usesCategorical: CATEGORICAL_USERS.has(component),
|
|
485
|
+
usesTone: false,
|
|
486
|
+
...(usesCode ? { usesCode: true } : {}),
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (hit.from === 'app') return hit.report.uses ?? USES_ALL;
|
|
490
|
+
return USES_ALL;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// ── 视图槽的承载组件 ─────────────────────────────────────────────────────────────────
|
|
494
|
+
// 对象的视图槽(列表、摘要、筛选、表单)没写组件名时由谁画:对象渲染器把表格 / 卡片 / 条目画成静态模板而不是单个组件,
|
|
495
|
+
// 这里取与该形态同部件的常驻组件,只用来查自报。放在登记表旁边,是为了让组件名只出现在这一个文件里(展开不认组件名)。
|
|
496
|
+
|
|
497
|
+
/** 集合的形态:取自列表视图的 collection(类型、是否树表、是否虚拟滚动) */
|
|
498
|
+
export interface KitCollectionShape {
|
|
499
|
+
readonly type: string;
|
|
500
|
+
readonly tree: boolean;
|
|
501
|
+
readonly virtual: boolean;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** 列表槽的承载组件:树表与虚拟滚动各有自己的表体组件,卡片、条目各有组件,普通表格取表头组件(部件同为表格) */
|
|
505
|
+
export function kitListSlotComponent(c: KitCollectionShape): string {
|
|
506
|
+
if (c.type === 'treeTable' || ((c.type === '' || c.type === 'table') && c.tree)) return 'KitTreeTable';
|
|
507
|
+
if ((c.type === '' || c.type === 'table') && c.virtual) return 'KitVirtualRows';
|
|
508
|
+
if (c.type === 'cards') return 'CardGrid';
|
|
509
|
+
if (c.type === 'stack' || c.type === 'compact-list') return 'ItemList';
|
|
510
|
+
return 'KitTableHead';
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** 摘要、筛选、表单槽的承载组件:摘要是键值条,筛选与表单都由对象表单组件承载 */
|
|
514
|
+
export const KIT_VIEW_SLOT_COMPONENT: Readonly<Record<'summary' | 'filter' | 'form', string>> = Object.freeze({
|
|
515
|
+
summary: 'SummaryStrip',
|
|
516
|
+
filter: 'KitObjectForm',
|
|
517
|
+
form: 'KitObjectForm',
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
/** 自画外壳的页面框(如多页签工作台)在运行期由宿主组件自绘,这里集中登记其承载组件名 */
|
|
521
|
+
const FRAME_HOST_COMPONENT: Readonly<Record<string, string>> = Object.freeze({
|
|
522
|
+
'workspace-frame': 'KitWorkspace',
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
/** 页面框自身承载组件的取色事实(非自画外壳框返回 undefined) */
|
|
526
|
+
export function kitFrameUses(frameKind: string, app?: KitSelfReportTable): KitInstanceUses | undefined {
|
|
527
|
+
const comp = Object.hasOwn(FRAME_HOST_COMPONENT, frameKind) ? FRAME_HOST_COMPONENT[frameKind] : undefined;
|
|
528
|
+
return comp === undefined ? undefined : kitInstanceUses(comp, app);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/** 只读关联形态对应的内置数据组件(与 kit-grammar.json#fieldRelation.pick.show 同口径) */
|
|
532
|
+
const RELATION_SHOW_COMPONENT: Readonly<Record<string, string>> = Object.freeze({
|
|
533
|
+
person: 'PersonCell',
|
|
534
|
+
people: 'PersonCell',
|
|
535
|
+
record: 'Identifier',
|
|
536
|
+
records: 'RecordsCell',
|
|
537
|
+
tags: 'TagGroup',
|
|
538
|
+
parent: 'PathCell',
|
|
539
|
+
file: 'FileCell',
|
|
540
|
+
files: 'FileCell',
|
|
541
|
+
link: 'LinkCell',
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
/** 药丸 / 徽标类组件(表格单元格里字段 type 为 text 时按状态类算、不作标识列,与 object-renderer/collection-table.ts#pillColumnType 同口径) */
|
|
545
|
+
const PILL_COMPONENTS: ReadonlySet<string> = new Set(['Tag', 'Badge']);
|
|
546
|
+
|
|
547
|
+
/** 组件名是否属于药丸 / 徽标类(组件名集中登记在 self-report.ts,展开事件不写组件名字面量) */
|
|
548
|
+
export function kitIsPillComponent(component: string): boolean {
|
|
549
|
+
return PILL_COMPONENTS.has(component);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* 字段单元格渲染组件(显式 component / schema.show / schema.edit 或只读关联形态 relation)的取色事实:
|
|
554
|
+
* 仅当存在任一取色为真时返回 KitInstanceUses,否则返回 undefined。
|
|
555
|
+
*/
|
|
556
|
+
export function kitFieldUses(
|
|
557
|
+
explicitComp: string | undefined,
|
|
558
|
+
relation: string | undefined,
|
|
559
|
+
readonlySlot: boolean,
|
|
560
|
+
app?: KitSelfReportTable,
|
|
561
|
+
): KitInstanceUses | undefined {
|
|
562
|
+
const comp = explicitComp !== undefined && explicitComp !== ''
|
|
563
|
+
? explicitComp
|
|
564
|
+
: readonlySlot && relation !== undefined && Object.hasOwn(RELATION_SHOW_COMPONENT, relation)
|
|
565
|
+
? RELATION_SHOW_COMPONENT[relation]
|
|
566
|
+
: undefined;
|
|
567
|
+
if (comp === undefined) return undefined;
|
|
568
|
+
const u = kitInstanceUses(comp, app);
|
|
569
|
+
if (!u.usesChartScale && !u.usesCategorical && !u.usesTone && u.usesCode !== true) return undefined;
|
|
570
|
+
return u;
|
|
571
|
+
}
|