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/app/server-pages.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// (`page.roles` 由授权的 access 盖章,AI 源里的不收;授权 frame 对 kit 无意义,拒收);
|
|
9
9
|
// ④ 编译:`compileKitPage`,`page.url` 覆盖为提交地址(方言所有,留在本文件);
|
|
10
10
|
// ⑤ 按 URL 注册:`buildRegisterRequest` 组装(owner `soma-kit`、version = 载荷摘要)-> `registerPageOrReject` 判重并注册,
|
|
11
|
-
// 同一 URL
|
|
11
|
+
// 同一 URL 覆盖(不并存);乐观并发 `expectGeneration` 由 `checkExpectedGeneration` 在注册前紧贴着查(两者之间没有 await,别的提交插不进来);
|
|
12
|
+
// 版本号末尾带本页页面线事实的戳(kitRuntimePageFactsStamp),重启或重装配后装配从绑定的版本号读回。
|
|
12
13
|
// core 步骤抛 `SomaSubmitStepError`,本文件在 `guard` 里转成 `KitSubmitError`,文案原样取 core 的(同一种错误只有一份提示,测试只断言错误码)。
|
|
13
14
|
// 溯源:`options.provenance` 必填(core 唯一判据 `provenanceProblem`),由 core 账本按地址记在入口一侧(随进程内存,持久版本记录归 soma-ai-page 版本库),
|
|
14
15
|
// 视图里只在代次与当前绑定一致时出现;`provenance.outputDigest` = 方言源摘要,供 `PageTarget.binding()` 读回。
|
|
@@ -17,10 +18,15 @@
|
|
|
17
18
|
import type { PageProvenance } from 'soma-core/page-target';
|
|
18
19
|
import { SOMA_PIPELINE_LIMITS } from 'soma-core/pipeline/limits';
|
|
19
20
|
import { canonicalJson, fnv1a64Hex } from 'soma-foundation/fingerprint';
|
|
21
|
+
import grammarJson from '../../spec/kit-grammar.json';
|
|
20
22
|
import { compileKitPage } from '../compile/compile-page';
|
|
21
23
|
import { KIT_VERSION_PREFIX } from '../compile/producer-fingerprint';
|
|
22
24
|
import { createYamlLocator } from '../compile/locate';
|
|
23
25
|
import type { KitAppContext, KitPageArtifact } from '../compile/types';
|
|
26
|
+
import type { KitThemeUsage } from '../shared/theme-usage';
|
|
27
|
+
import type { KitFrameFacts } from '../spatial';
|
|
28
|
+
import { KIT_THEME_GATE, type KitThemeGateFinding } from '../theme/value-table';
|
|
29
|
+
import { KIT_TIER_COMPAT_GATE, type KitTierCompatFrameFacts } from './tier-compat';
|
|
24
30
|
import { KIT_LAYOUT_LATEST_PIN } from '../object-renderer/layout-plan';
|
|
25
31
|
import {
|
|
26
32
|
KIT_PLACEHOLDER_URL,
|
|
@@ -51,6 +57,31 @@ export interface KitServerPagesDeps {
|
|
|
51
57
|
/** 当前已装配的表内页地址(动态提交不得同址 / 覆盖) */
|
|
52
58
|
readonly tableAddresses?: () => readonly string[];
|
|
53
59
|
readonly now?: () => number;
|
|
60
|
+
/**
|
|
61
|
+
* 运行期提交的页并入整站状态的「试算」(主题流水线 next 才给;legacy 下装配不给这个回调):
|
|
62
|
+
* 入参是编译出的页面线事实(主题用到情况、版面事实;编译结果没有页面属性报告时对应项为 null:主题按「四片都用到」算,宁可多发;
|
|
63
|
+
* 版面事实缺了不参加组合核对,记 -012 告警),返回待应用的计划。试算无副作用:
|
|
64
|
+
* - `findings` 含 `severity === 'error'` 即拒收本页,既不写入运行期绑定,也不改整站状态。error 有两类:
|
|
65
|
+
* 合并主题分片后整站样式超出体积预算(`KIT-THEME-GATE-002`);本页页面模式与应用当前层级策略档组合冲突(`KIT-THEME-GATE-010`,
|
|
66
|
+
* 含「本页把应用当前档排除在外」与「与现在允许的档求交为空」两种);
|
|
67
|
+
* - warn(组合核对告警 -011、版式契约缺页面模式 -013、缺版面事实 -012)不挡提交,随提交结果的 diagnostics 回报(severity 为 warning);
|
|
68
|
+
* - 没有 error 时提交方先注册页面,注册成功后再调 `apply()` 把计划落到整站状态(主题按需分片只增不减,允许的层级策略档只减不增)。
|
|
69
|
+
* 代次检查、试算、注册、应用之间不许有 `await`:同一进程里不会有别的提交插进来,检查与试算看到的就是注册、应用时的状态。
|
|
70
|
+
*/
|
|
71
|
+
readonly planRuntimePage?: (page: KitRuntimePageFacts) => KitRuntimePagePlan;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 运行期提交的页上报给装配的页面线事实(都取自页面属性报告,缺了为 null) */
|
|
75
|
+
export interface KitRuntimePageFacts {
|
|
76
|
+
readonly url: string;
|
|
77
|
+
readonly themeUsage: KitThemeUsage | null;
|
|
78
|
+
readonly frameFacts: KitFrameFacts | null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** 试算得到的待应用结果:error 供拒收判断,warn 随提交结果回报;`apply` 只在注册成功后调用一次 */
|
|
82
|
+
export interface KitRuntimePagePlan {
|
|
83
|
+
readonly findings: readonly KitThemeGateFinding[];
|
|
84
|
+
readonly apply: () => void;
|
|
54
85
|
}
|
|
55
86
|
|
|
56
87
|
/**
|
|
@@ -64,6 +95,141 @@ export function kitSourceDigest(source: string): string {
|
|
|
64
95
|
return fnv1a64Hex(canonicalJson({ source }));
|
|
65
96
|
}
|
|
66
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 缺版面事实、没参加层级策略档组合核对(warn,不挡装配也不挡提交):运行期提交与应用装配两侧同一个码
|
|
100
|
+
* (组合核对本身的三个结论码在 tier-compat.ts#KIT_TIER_COMPAT_GATE)
|
|
101
|
+
*/
|
|
102
|
+
export const KIT_TIER_FACTS_MISSING = 'KIT-THEME-GATE-012';
|
|
103
|
+
|
|
104
|
+
// ── 运行期提交页的事实戳 ─────────────────────────────────────────────────────────────────
|
|
105
|
+
// 运行期提交的页重启后由 core 从磁盘装回、dev 重装配后也还在绑定表里,照常提供;它的页面线事实(主题用到情况、版面事实)却只在提交那次的编译结果里。
|
|
106
|
+
// core 随绑定一起落盘、并原样读回给方言的只有不透明版本号(1..128 位,core 只存只读、不解释),所以把这两项事实按闭集压成位图写在版本号末尾,
|
|
107
|
+
// 装配时从绑定的版本号读回,与表内页一起参加按需分片与组合核对(server.ts#assembleKitServer)。
|
|
108
|
+
// 位序取语法真源的闭集(色名表、业务组件意图词):语法真源进产出方指纹(producer-fingerprint.ts),真源一改指纹就变,旧戳的页整批被版本守卫丢弃,不会按新位序误读。
|
|
109
|
+
// 闭集以外的名字不进戳:色调载体只发色名表里的色,设计真源的页面模式名单(flatPageModes)只用意图词,丢掉它们不改样式、不改核对结论。
|
|
110
|
+
|
|
111
|
+
/** core 收的版本号长度上限(soma-core 注入口:1..128 位);加上戳会超出时不加戳,这一页在装配时按「缺事实」处理 */
|
|
112
|
+
const KIT_VERSION_MAX_LENGTH = 128;
|
|
113
|
+
/** 戳头:载荷摘要是 64 位十六进制(不含点),产出方前缀之后第一次出现它就是戳 */
|
|
114
|
+
const FACTS_STAMP_HEAD = '.f.';
|
|
115
|
+
/** 戳里「没有这一项」的记号(不是 36 进制数字) */
|
|
116
|
+
const FACTS_STAMP_NONE = '-';
|
|
117
|
+
/** toneNames 的位序:色名表的语义色 + 分类色(与色调载体同一张表) */
|
|
118
|
+
const STAMP_TONES: readonly string[] = [...grammarJson.toneNames.semantic, ...grammarJson.toneNames.categorical];
|
|
119
|
+
/** pageModes 的位序:业务组件意图词 + 自由编排页 free(biz/layout-contracts.ts#KitPageMode 的取值) */
|
|
120
|
+
const STAMP_MODES: readonly string[] = [...Object.keys(grammarJson.aiIntentMap.biz), 'free'];
|
|
121
|
+
const STAMP_RAILS: readonly KitTierCompatFrameFacts['navRail'][] = ['none', 'narrow', 'wide'];
|
|
122
|
+
// JS 位运算按 32 位有符号整数截断:位序表长度不得超 30,否则 1 << i 溢出符号位并破坏位图边界校验
|
|
123
|
+
if (STAMP_TONES.length > 30 || STAMP_MODES.length > 30) {
|
|
124
|
+
throw new Error(`运行期页面事实戳位图上限为 30 位:STAMP_TONES=${STAMP_TONES.length}、STAMP_MODES=${STAMP_MODES.length}`);
|
|
125
|
+
}
|
|
126
|
+
const STAMP_USAGE_MAX = 15;
|
|
127
|
+
const STAMP_TONE_MASK_MAX = (1 << STAMP_TONES.length) - 1;
|
|
128
|
+
const STAMP_MODE_MASK_MAX = (1 << STAMP_MODES.length) - 1;
|
|
129
|
+
const STAMP_RAIL_BITS_MAX = STAMP_RAILS.length * 16 - 1;
|
|
130
|
+
|
|
131
|
+
/** 从事实戳读回的运行期提交页页面线事实(组合核对只读版面事实里的页面模式,其余版面事实随戳原样带回) */
|
|
132
|
+
export interface KitRuntimePageStampedFacts {
|
|
133
|
+
readonly themeUsage: KitThemeUsage | null;
|
|
134
|
+
readonly frameFacts: KitTierCompatFrameFacts | null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function stampMaskOf(names: Iterable<string>, order: readonly string[]): number {
|
|
138
|
+
let mask = 0;
|
|
139
|
+
for (const name of names) {
|
|
140
|
+
const i = order.indexOf(name);
|
|
141
|
+
if (i >= 0) mask |= 1 << i;
|
|
142
|
+
}
|
|
143
|
+
return mask;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const stampNamesOf = (mask: number, order: readonly string[]): string[] => order.filter((_, i) => (mask & (1 << i)) !== 0);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 事实戳:`.f.<用到情况>.<色名子集>.<页面模式>_<侧导航与四个开关>_<窗格数>`,各段 36 进制,`-` 表示没有这一项。
|
|
150
|
+
* 用到情况四位:分类色 1、图表色阶 2、色调载体 4、代码高亮 8;色名子集只在色调载体为真且给了 toneNames 时写(没写 = 发全表)。
|
|
151
|
+
* 两项事实都没有时为空串(不加戳)
|
|
152
|
+
*/
|
|
153
|
+
export function kitRuntimePageFactsStamp(themeUsage: KitThemeUsage | null, frameFacts: KitTierCompatFrameFacts | null): string {
|
|
154
|
+
if (themeUsage === null && frameFacts === null) return '';
|
|
155
|
+
const usage = themeUsage === null
|
|
156
|
+
? FACTS_STAMP_NONE
|
|
157
|
+
: ((themeUsage.categorical ? 1 : 0) | (themeUsage.chart ? 2 : 0) | (themeUsage.tones ? 4 : 0) | (themeUsage.code !== false ? 8 : 0)).toString(36);
|
|
158
|
+
const tones = themeUsage === null || !themeUsage.tones || themeUsage.toneNames === undefined
|
|
159
|
+
? FACTS_STAMP_NONE
|
|
160
|
+
: stampMaskOf(themeUsage.toneNames, STAMP_TONES).toString(36);
|
|
161
|
+
const frame = frameFacts === null
|
|
162
|
+
? FACTS_STAMP_NONE
|
|
163
|
+
: [
|
|
164
|
+
stampMaskOf(frameFacts.pageModes ?? [], STAMP_MODES),
|
|
165
|
+
Math.max(0, STAMP_RAILS.indexOf(frameFacts.navRail)) * 16 + (frameFacts.stepper ? 1 : 0) + (frameFacts.reading ? 2 : 0) + (frameFacts.showcase ? 4 : 0) + (frameFacts.detail ? 8 : 0),
|
|
166
|
+
Number.isInteger(frameFacts.panes) && frameFacts.panes >= 0 ? frameFacts.panes : 0,
|
|
167
|
+
].map((n) => n.toString(36)).join('_');
|
|
168
|
+
return `${FACTS_STAMP_HEAD}${usage}.${tones}.${frame}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const FACTS_STAMP_BODY = /^(?:([0-9a-z]+)|-)\.(?:([0-9a-z]+)|-)\.(?:([0-9a-z]+)_([0-9a-z]+)_([0-9a-z]+)|-)$/;
|
|
172
|
+
|
|
173
|
+
/** 从运行期提交页绑定的版本号读回事实戳;不是本版产出方的版本号、没有戳或戳不认识时为 null(装配按「缺事实」处理) */
|
|
174
|
+
export function kitRuntimePageFactsOfVersion(version: string | undefined): KitRuntimePageStampedFacts | null {
|
|
175
|
+
if (typeof version !== 'string' || !version.startsWith(KIT_VERSION_PREFIX)) return null;
|
|
176
|
+
const at = version.indexOf(FACTS_STAMP_HEAD, KIT_VERSION_PREFIX.length);
|
|
177
|
+
if (at < 0) return null;
|
|
178
|
+
const m = FACTS_STAMP_BODY.exec(version.slice(at + FACTS_STAMP_HEAD.length));
|
|
179
|
+
if (m === null) return null;
|
|
180
|
+
const num = (text: string | undefined): number | undefined => (text === undefined ? undefined : Number.parseInt(text, 36));
|
|
181
|
+
const usage = num(m[1]);
|
|
182
|
+
const toneMask = num(m[2]);
|
|
183
|
+
const modeMask = num(m[3]);
|
|
184
|
+
const railBits = num(m[4]);
|
|
185
|
+
const panes = num(m[5]);
|
|
186
|
+
if (usage !== undefined && (!Number.isSafeInteger(usage) || usage < 0 || usage > STAMP_USAGE_MAX)) return null;
|
|
187
|
+
const tones = usage !== undefined && (usage & 4) !== 0;
|
|
188
|
+
if (toneMask !== undefined && (!tones || !Number.isSafeInteger(toneMask) || toneMask < 0 || toneMask > STAMP_TONE_MASK_MAX)) return null;
|
|
189
|
+
const hasFrame = modeMask !== undefined || railBits !== undefined || panes !== undefined;
|
|
190
|
+
if (hasFrame) {
|
|
191
|
+
if (
|
|
192
|
+
modeMask === undefined || !Number.isSafeInteger(modeMask) || modeMask < 0 || modeMask > STAMP_MODE_MASK_MAX
|
|
193
|
+
|| railBits === undefined || !Number.isSafeInteger(railBits) || railBits < 0 || railBits > STAMP_RAIL_BITS_MAX || (railBits >> 4) >= STAMP_RAILS.length
|
|
194
|
+
|| panes === undefined || !Number.isSafeInteger(panes) || panes < 0
|
|
195
|
+
) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const themeUsage: KitThemeUsage | null = usage === undefined
|
|
200
|
+
? null
|
|
201
|
+
: Object.freeze({
|
|
202
|
+
categorical: (usage & 1) !== 0,
|
|
203
|
+
chart: (usage & 2) !== 0,
|
|
204
|
+
tones,
|
|
205
|
+
code: (usage & 8) !== 0,
|
|
206
|
+
...(tones && toneMask !== undefined ? { toneNames: Object.freeze(stampNamesOf(toneMask, STAMP_TONES).sort()) } : {}),
|
|
207
|
+
});
|
|
208
|
+
const frameFacts: KitTierCompatFrameFacts | null = !hasFrame
|
|
209
|
+
? null
|
|
210
|
+
: Object.freeze({
|
|
211
|
+
panes: panes!,
|
|
212
|
+
navRail: STAMP_RAILS[railBits! >> 4]!,
|
|
213
|
+
stepper: (railBits! & 1) !== 0,
|
|
214
|
+
reading: (railBits! & 2) !== 0,
|
|
215
|
+
showcase: (railBits! & 4) !== 0,
|
|
216
|
+
detail: (railBits! & 8) !== 0,
|
|
217
|
+
pageModes: Object.freeze(stampNamesOf(modeMask!, STAMP_MODES)),
|
|
218
|
+
});
|
|
219
|
+
if (themeUsage === null && frameFacts === null) return null;
|
|
220
|
+
return Object.freeze({ themeUsage, frameFacts });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** 组合核对一族的结论码(核对本身三个 + 缺版面事实):提交诊断按「层级策略档组合核对」说明 */
|
|
224
|
+
const TIER_GATE_CODES: ReadonlySet<string> = new Set([KIT_TIER_COMPAT_GATE.error, KIT_TIER_COMPAT_GATE.warn, KIT_TIER_COMPAT_GATE.missingMode, KIT_TIER_FACTS_MISSING]);
|
|
225
|
+
|
|
226
|
+
/** 接收了但带告警时的建议(按码);告警不挡提交 */
|
|
227
|
+
const TIER_WARN_FIXES: Readonly<Record<string, string>> = Object.freeze({
|
|
228
|
+
[KIT_TIER_COMPAT_GATE.warn]: '页面已接收;本页页面模式与应用当前层级策略档被规范判为告警组合,如需消除,调整页面模式或应用主题的层级策略档',
|
|
229
|
+
[KIT_TIER_COMPAT_GATE.missingMode]: '页面已接收;业务组件的版式契约没有声明页面模式,本页没按页面模式核对层级策略档(不代表组合合规)',
|
|
230
|
+
[KIT_TIER_FACTS_MISSING]: '页面已接收;页面流水线没出属性报告(看编译告警),本页没参加层级策略档组合核对,修正页面后重新提交即可参加',
|
|
231
|
+
});
|
|
232
|
+
|
|
67
233
|
const isRecord = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
68
234
|
|
|
69
235
|
function isRuntimeError(error: unknown): error is Error & { runtimeCode: string; diagnostic: { problem: string; remedy: string } } {
|
|
@@ -123,6 +289,8 @@ export function createKitServerPages(deps: KitServerPagesDeps): KitServerPages {
|
|
|
123
289
|
readonly sourceDigest: string;
|
|
124
290
|
readonly provenance: PageProvenance;
|
|
125
291
|
readonly diagnostics: readonly PageDiagnostic[];
|
|
292
|
+
readonly themeUsage: KitThemeUsage | null;
|
|
293
|
+
readonly frameFacts: KitFrameFacts | null;
|
|
126
294
|
}
|
|
127
295
|
|
|
128
296
|
const prepare = async (url: string | undefined, source: KitPageSource, options: KitSubmitOptions): Promise<Prepared> => {
|
|
@@ -216,6 +384,8 @@ export function createKitServerPages(deps: KitServerPagesDeps): KitServerPages {
|
|
|
216
384
|
throw new KitSubmitError(issues[0]!.code, `提交 ${address} 没有通过 kit 编译闸门(${issues.length} 处)`, issues);
|
|
217
385
|
}
|
|
218
386
|
const artifact = compiled.artifact;
|
|
387
|
+
const themeUsage = compiled.pageAttrs?.themeUsage ?? null;
|
|
388
|
+
const frameFacts = compiled.pageAttrs?.frameFacts ?? null;
|
|
219
389
|
|
|
220
390
|
// ③ 信封:取编译写进 ui 的信封;受限写面只校验作者写的部分(nav.back 是编译器由 page.back 推出的形状,access 由授权盖章)
|
|
221
391
|
const uiDoc = runtime.parseSomaDsl(artifact.uiYaml, 'ui');
|
|
@@ -263,9 +433,12 @@ export function createKitServerPages(deps: KitServerPagesDeps): KitServerPages {
|
|
|
263
433
|
now,
|
|
264
434
|
});
|
|
265
435
|
// 版本带产出方指纹(kit 包版本 + 默认值指纹):落盘的持久页升级后由 kit 的版本守卫判过期并丢弃(与装配期注册的表内页同一套),
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
436
|
+
// 载荷摘要仍是判重依据(同载荷同指纹才判未变);末尾再带本页页面线事实的戳,重启或重装配后装配从绑定的版本号读回
|
|
437
|
+
// (事实与载荷出自同一次编译:同载荷同事实,判重口径不变)。加上戳超出 core 的版本号上限时不加,这一页在装配时按「缺事实」处理
|
|
438
|
+
const version = `${KIT_VERSION_PREFIX}${built.version}`;
|
|
439
|
+
const factsStamp = kitRuntimePageFactsStamp(themeUsage, frameFacts);
|
|
440
|
+
const stampedVersion = factsStamp !== '' && version.length + factsStamp.length <= KIT_VERSION_MAX_LENGTH ? `${version}${factsStamp}` : version;
|
|
441
|
+
const request = { ...built, version: stampedVersion, options: { ...built.options, version: stampedVersion } } as typeof built;
|
|
269
442
|
return {
|
|
270
443
|
address,
|
|
271
444
|
kind,
|
|
@@ -275,28 +448,87 @@ export function createKitServerPages(deps: KitServerPagesDeps): KitServerPages {
|
|
|
275
448
|
sourceDigest,
|
|
276
449
|
provenance: options.provenance,
|
|
277
450
|
diagnostics: coreIssues.filter((d) => d.severity !== 'error'),
|
|
451
|
+
themeUsage,
|
|
452
|
+
frameFacts,
|
|
278
453
|
};
|
|
279
454
|
};
|
|
280
455
|
|
|
281
|
-
|
|
456
|
+
/** 提交结果:信封校验的非 error 诊断,加上接收时的主题侧 / 组合核对告警(试算的 warn,页面已注册) */
|
|
457
|
+
const resultOf = (prepared: Prepared, binding: { readonly generation: number } | undefined, gateWarnings: readonly PageDiagnostic[] = []): KitSubmitResult => ({
|
|
282
458
|
address: prepared.address,
|
|
283
459
|
kind: prepared.kind,
|
|
284
460
|
digest: prepared.sourceDigest,
|
|
285
461
|
generation: binding?.generation ?? 0,
|
|
286
|
-
diagnostics: prepared.diagnostics,
|
|
462
|
+
diagnostics: gateWarnings.length === 0 ? prepared.diagnostics : [...prepared.diagnostics, ...gateWarnings],
|
|
287
463
|
});
|
|
288
464
|
|
|
289
465
|
/** 判重(同 owner、版本与选项都没变、无到期)-> 注册 -> 落空拒收,全由 core 步骤做 */
|
|
290
466
|
const registerOne = (prepared: Prepared) => guard(() => runtime.registerPageOrReject(runtime, prepared.request));
|
|
291
467
|
|
|
468
|
+
/** 试算的一条结论 -> 提交诊断:error 是拒收原因(severity error),warn 随接收结果回报(severity warning,页面已注册) */
|
|
469
|
+
const gateIssueOf = (address: string, f: KitThemeGateFinding): PageDiagnostic => {
|
|
470
|
+
const rejected = f.severity === 'error';
|
|
471
|
+
const severity = rejected ? 'error' : 'warning';
|
|
472
|
+
if (TIER_GATE_CODES.has(f.code)) {
|
|
473
|
+
return {
|
|
474
|
+
code: f.code,
|
|
475
|
+
severity,
|
|
476
|
+
situation: `提交 ${address} 的层级策略档组合核对`,
|
|
477
|
+
problem: `组合核对 ${f.node}:${f.message}`,
|
|
478
|
+
fix: rejected ? '调整该页面的页面模式或将应用主题的层级策略档调整为允许的档位后重新提交' : (TIER_WARN_FIXES[f.code] ?? '页面已接收;按告警说明调整页面模式或应用主题的层级策略档'),
|
|
479
|
+
at: `${address}#theme.layering`,
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
if (f.code === KIT_THEME_GATE.budget) {
|
|
483
|
+
return {
|
|
484
|
+
code: f.code,
|
|
485
|
+
severity,
|
|
486
|
+
situation: `提交 ${address} 的整站主题体积检查`,
|
|
487
|
+
problem: `主题侧门禁 ${f.node}:${f.message}`,
|
|
488
|
+
fix: '精简页面触发的新增主题分片(如代码高亮、图表色阶或色调载体)或调整主题配置,使整站主题样式不超过预算上限后重新提交',
|
|
489
|
+
at: `${address}#theme`,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
code: f.code,
|
|
494
|
+
severity,
|
|
495
|
+
situation: `提交 ${address} 的主题侧门禁检查`,
|
|
496
|
+
problem: `主题侧门禁 ${f.node}:${f.message}`,
|
|
497
|
+
fix: rejected ? '按诊断说明修正页面或主题配置后重新提交' : '页面已接收;按告警说明调整页面或主题配置',
|
|
498
|
+
at: `${address}#theme`,
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const rejectRuntimePageGate = (address: string, findings: readonly KitThemeGateFinding[]): KitSubmitError => {
|
|
503
|
+
const issues: PageDiagnostic[] = findings.filter((f) => f.severity === 'error').map((f) => gateIssueOf(address, f));
|
|
504
|
+
const firstCode = issues[0]!.code;
|
|
505
|
+
const summary = firstCode === KIT_TIER_COMPAT_GATE.error
|
|
506
|
+
? `提交 ${address} 与当前应用层级策略档组合冲突(${issues.length} 处)`
|
|
507
|
+
: firstCode === KIT_THEME_GATE.budget
|
|
508
|
+
? `提交 ${address} 合并主题分片后超出整站体积预算(${issues.length} 处)`
|
|
509
|
+
: `提交 ${address} 未通过主题侧门禁检查(${issues.length} 处)`;
|
|
510
|
+
return new KitSubmitError(firstCode, summary, issues);
|
|
511
|
+
};
|
|
512
|
+
|
|
292
513
|
const submit: KitServerPages['submit'] = async (url, source, options) => {
|
|
293
514
|
const prepared = await prepare(url, source, options);
|
|
294
515
|
if (options.dryRun === true) {
|
|
295
516
|
return { ...resultOf(prepared, undefined), generation: bindingOf(prepared.address)?.generation ?? 0 };
|
|
296
517
|
}
|
|
518
|
+
// 从这里到注册、应用、记账都是同步的,中间没有 await:
|
|
519
|
+
// - 乐观并发的代次检查紧贴注册(编译在 prepare 里,已经 await 完):检查完不让出,同一地址的另一笔提交插不进来,检查看到的代次就是注册时的代次;
|
|
520
|
+
// - 一次试算得到待应用结果(无副作用):有 error(整站主题超预算或层级策略档组合冲突)即拒收,既不写入运行期绑定,也不改整站状态;
|
|
521
|
+
// 否则注册,注册成功后才应用,dryRun 与被拒的页面不会污染整站状态。试算看到的整站状态就是应用时的状态,没有「注册了又要撤回」的半提交路径;
|
|
522
|
+
// - 试算的 warn(组合核对告警、缺页面模式、缺版面事实)不挡提交,随结果的 diagnostics 回报。
|
|
523
|
+
guard(() => runtime.checkExpectedGeneration(runtime, prepared.address, options.expectGeneration));
|
|
524
|
+
const plan = deps.planRuntimePage?.({ url: prepared.address, themeUsage: prepared.themeUsage, frameFacts: prepared.frameFacts });
|
|
525
|
+
if (plan !== undefined && plan.findings.some((f) => f.severity === 'error')) {
|
|
526
|
+
throw rejectRuntimePageGate(prepared.address, plan.findings);
|
|
527
|
+
}
|
|
297
528
|
const binding = registerOne(prepared);
|
|
529
|
+
plan?.apply();
|
|
298
530
|
ledger.remember(binding, prepared.provenance);
|
|
299
|
-
return resultOf(prepared, binding);
|
|
531
|
+
return resultOf(prepared, binding, plan === undefined ? [] : plan.findings.map((f) => gateIssueOf(prepared.address, f)));
|
|
300
532
|
};
|
|
301
533
|
|
|
302
534
|
const unbind: KitServerPages['unbind'] = async (url, options = {}) =>
|