@pixel-point/toolcraft 0.0.14 → 0.0.15
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 +13 -2
- package/package.json +1 -1
- package/scripts/prepare-pack.mjs +2 -28
- package/src/cli-io.mjs +174 -0
- package/src/cli-package-manager-flow.test.mjs +206 -0
- package/src/cli.mjs +7 -495
- package/src/cli.test.mjs +34 -177
- package/src/create-command.mjs +152 -0
- package/src/create-options.mjs +194 -0
- package/src/generate-test-assertions.mjs +27 -0
- package/src/generate-test-doc-assertions.mjs +162 -0
- package/src/generate-test-file-assertions.mjs +251 -0
- package/src/generate-test-fs-utils.mjs +59 -0
- package/src/generate-test-integrity-assertions.mjs +30 -0
- package/src/generate-test-integrity-framework-assertions.mjs +222 -0
- package/src/generate-test-integrity-manifest-assertions.mjs +150 -0
- package/src/generate-test-integrity-ownership-assertions.mjs +127 -0
- package/src/generate-test-integrity-test-utils.mjs +102 -0
- package/src/generate-test-package-assertions.mjs +75 -0
- package/src/generate-test-product-fixture.mjs +84 -0
- package/src/generate-test-product-fixture.test.mjs +73 -0
- package/src/generate-test-standalone-assertions.mjs +209 -0
- package/src/generate-transactional.test.mjs +151 -0
- package/src/generate.mjs +182 -102
- package/src/generate.test.mjs +242 -338
- package/src/generated-integrity-manifest.mjs +127 -0
- package/src/generated-integrity-manifest.test.mjs +151 -0
- package/src/generated-source-policy.mjs +22 -0
- package/src/generated-source-policy.test.mjs +35 -0
- package/src/generated-target-policy.mjs +55 -0
- package/src/generation-transaction.mjs +135 -0
- package/src/generation-transaction.test.mjs +74 -0
- package/src/package-json.mjs +18 -1
- package/src/package-json.test.mjs +38 -5
- package/src/package-manager.mjs +2 -0
- package/src/package-manager.test.mjs +5 -1
- package/src/packaged-template-fallback.test.mjs +126 -0
- package/src/prepare-pack-templates.mjs +34 -0
- package/templates/runtime/contracts/component-contract-builders.ts +95 -0
- package/templates/runtime/contracts/component-contracts.choices.test.ts +293 -0
- package/templates/runtime/contracts/component-contracts.choices.ts +322 -0
- package/templates/runtime/contracts/component-contracts.inputs.test.ts +210 -0
- package/templates/runtime/contracts/component-contracts.inputs.ts +252 -0
- package/templates/runtime/contracts/component-contracts.media-custom.test.ts +116 -0
- package/templates/runtime/contracts/component-contracts.media-custom.ts +144 -0
- package/templates/runtime/contracts/component-contracts.runtime-acceptance.test.ts +229 -0
- package/templates/runtime/contracts/component-contracts.runtime-labels.test.ts +76 -0
- package/templates/runtime/contracts/component-contracts.runtime-panels.test.ts +135 -0
- package/templates/runtime/contracts/component-contracts.runtime-shell.test.ts +148 -0
- package/templates/runtime/contracts/component-contracts.runtime.ts +361 -0
- package/templates/runtime/contracts/component-contracts.test.ts +39 -1458
- package/templates/runtime/contracts/component-contracts.ts +44 -1505
- package/templates/runtime/contracts/component-contracts.visual.test.ts +316 -0
- package/templates/runtime/contracts/component-contracts.visual.ts +385 -0
- package/templates/runtime/contracts/contract-manifest.test.ts +64 -0
- package/templates/runtime/contracts/decision-contracts.test.ts +29 -4
- package/templates/runtime/contracts/decision-contracts.ts +38 -1
- package/templates/runtime/index.ts +1 -0
- package/templates/runtime/react/{runtime-public-api.test.tsx → app-shell/runtime-public-api.test.tsx} +29 -7
- package/templates/runtime/react/{settings-transfer.test.ts → app-shell/settings-transfer.test.ts} +4 -4
- package/templates/runtime/react/{settings-transfer.ts → app-shell/settings-transfer.ts} +3 -3
- package/templates/runtime/react/{toolbar-panel.test.tsx → app-shell/toolbar-panel.test.tsx} +2 -2
- package/templates/runtime/react/{toolbar-panel.tsx → app-shell/toolbar-panel.tsx} +3 -3
- package/templates/runtime/react/{toolcraft-app.integration.test.tsx → app-shell/toolcraft-app.integration.test.tsx} +6 -6
- package/templates/runtime/react/{toolcraft-app.test.tsx → app-shell/toolcraft-app.test.tsx} +3 -3
- package/templates/runtime/react/{toolcraft-app.tsx → app-shell/toolcraft-app.tsx} +11 -8
- package/templates/runtime/react/{toolcraft-root.test.tsx → app-shell/toolcraft-root.test.tsx} +1 -1
- package/templates/runtime/react/{toolcraft-root.tsx → app-shell/toolcraft-root.tsx} +5 -5
- package/templates/runtime/react/{use-toolcraft.ts → app-shell/use-toolcraft.ts} +1 -1
- package/templates/runtime/react/canvas/canvas-default-media-layer.tsx +81 -0
- package/templates/runtime/react/canvas/canvas-media-transform.ts +33 -0
- package/templates/runtime/react/canvas/canvas-shell-interactions.test.tsx +156 -0
- package/templates/runtime/react/canvas/canvas-shell-media-rendering.test.tsx +87 -0
- package/templates/runtime/react/canvas/canvas-shell-rendering.test.tsx +102 -0
- package/templates/runtime/react/canvas/canvas-shell-test-utils.tsx +108 -0
- package/templates/runtime/react/canvas/canvas-shell-upload.test.tsx +106 -0
- package/templates/runtime/react/canvas/canvas-shell.tsx +146 -0
- package/templates/runtime/react/canvas/canvas-upload-routing.ts +84 -0
- package/templates/runtime/react/{media-file.ts → canvas/media-file.ts} +1 -1
- package/templates/runtime/react/canvas/use-canvas-drop-import.ts +145 -0
- package/templates/runtime/react/canvas/use-canvas-viewport-interactions.ts +227 -0
- package/templates/runtime/react/controls-panel/__tests__/control-conditions.test.ts +89 -0
- package/templates/runtime/react/{controls-panel-filedrop-reorder.test.tsx → controls-panel/__tests__/controls-panel-filedrop-reorder.test.tsx} +4 -4
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.actions-layout.test.tsx +91 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.collection-actions.test.tsx +213 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-layout.test.tsx +366 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-picker-models.test.tsx +169 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.compound-layout.test.tsx +160 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.control-visibility.test.tsx +352 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.curves.test.tsx +226 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.floating-shell.test.tsx +13 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.font-picker.test.tsx +302 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.footer-actions.test.tsx +401 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.gradient-control.test.tsx +139 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.help-policy.test.tsx +103 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.image-picker.test.tsx +16 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.inline-layout.test.tsx +290 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.keyframes.test.tsx +175 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.media-upload-files.test.tsx +121 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.media-upload-image.test.tsx +363 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.media-upload-multi-image.test.tsx +105 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.range-slider-editing.test.tsx +149 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.section-shell.test.tsx +138 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.select-layout.test.tsx +148 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.setup-controls.test.tsx +189 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.slider-rendering.test.tsx +317 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.state-reset.test.tsx +137 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.structure.test.tsx +66 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.text-input.test.tsx +205 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.vector-interaction.test.tsx +388 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.vector-layout.test.tsx +155 -0
- package/templates/runtime/react/controls-panel/actions/controls-panel-actions.ts +172 -0
- package/templates/runtime/react/{control-conditions.ts → controls-panel/conditions/control-conditions.ts} +26 -3
- package/templates/runtime/react/{control-renderers.ts → controls-panel/control-renderers.ts} +2 -2
- package/templates/runtime/react/controls-panel/controls-panel.tsx +250 -0
- package/templates/runtime/react/controls-panel/keyframes/controls-panel-keyframes.tsx +265 -0
- package/templates/runtime/react/controls-panel/layout/controls-panel-collapse-storage.ts +131 -0
- package/templates/runtime/react/controls-panel/layout/controls-panel-help.tsx +132 -0
- package/templates/runtime/react/controls-panel/layout/controls-panel-inline-layout.tsx +311 -0
- package/templates/runtime/react/controls-panel/layout/controls-panel-layout.tsx +216 -0
- package/templates/runtime/react/controls-panel/layout/controls-panel-section.tsx +401 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-action-renderer.tsx +137 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-basic-renderers.tsx +421 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-collection-renderer.tsx +286 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-compound-renderers.tsx +366 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-media-renderer.tsx +173 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-renderer-registry.test.ts +23 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-renderer-registry.ts +55 -0
- package/templates/runtime/react/controls-panel/renderers/controls-panel-settings-transfer-renderer.tsx +45 -0
- package/templates/runtime/react/controls-panel/testing/controls-panel-test-utils.tsx +300 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-aspect-ratio-values.ts +94 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-collection-values.ts +87 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-color-values.ts +82 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-font-values.ts +69 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-spatial-values.ts +64 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-value-labels.ts +93 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-value-primitives.ts +30 -0
- package/templates/runtime/react/controls-panel/values/controls-panel-values.ts +7 -0
- package/templates/runtime/react/index.ts +13 -13
- package/templates/runtime/react/{layer-tree.ts → layers/layer-tree.ts} +1 -1
- package/templates/runtime/react/layers/layers-panel-drag-drop.test.tsx +190 -0
- package/templates/runtime/react/layers/layers-panel-editing.test.tsx +41 -0
- package/templates/runtime/react/layers/layers-panel-insert-targets.test.ts +87 -0
- package/templates/runtime/react/layers/layers-panel-insert-targets.ts +254 -0
- package/templates/runtime/react/layers/layers-panel-model.ts +15 -0
- package/templates/runtime/react/layers/layers-panel-rendering.test.tsx +43 -0
- package/templates/runtime/react/layers/layers-panel-reorder.ts +148 -0
- package/templates/runtime/react/layers/layers-panel-row.tsx +475 -0
- package/templates/runtime/react/layers/layers-panel-test-utils.tsx +135 -0
- package/templates/runtime/react/layers/layers-panel-visibility.test.tsx +126 -0
- package/templates/runtime/react/layers/layers-panel.tsx +349 -0
- package/templates/runtime/react/layers/use-layers-panel-drag-controller.ts +327 -0
- package/templates/runtime/react/{panel-host-types.ts → panel-host/panel-host-types.ts} +2 -2
- package/templates/runtime/react/{panel-host.test.tsx → panel-host/panel-host.test.tsx} +3 -3
- package/templates/runtime/react/{panel-host.tsx → panel-host/panel-host.tsx} +1 -1
- package/templates/runtime/react/timeline/timeline-easing-editor.tsx +409 -0
- package/templates/runtime/react/timeline/timeline-easing-geometry.ts +42 -0
- package/templates/runtime/react/timeline/timeline-easing-icons.tsx +135 -0
- package/templates/runtime/react/timeline/timeline-easing-model.test.ts +87 -0
- package/templates/runtime/react/timeline/timeline-easing-model.ts +271 -0
- package/templates/runtime/react/timeline/timeline-easing-popover-content.tsx +227 -0
- package/templates/runtime/react/timeline/timeline-easing-popover-layout.ts +69 -0
- package/templates/runtime/react/timeline/timeline-easing-popover.tsx +60 -0
- package/templates/runtime/react/timeline/timeline-event-targets.ts +19 -0
- package/templates/runtime/react/timeline/timeline-expanded-content.tsx +299 -0
- package/templates/runtime/react/timeline/timeline-icon-button.tsx +51 -0
- package/templates/runtime/react/timeline/timeline-keyframe-row.tsx +360 -0
- package/templates/runtime/react/timeline/timeline-keyframes.ts +23 -0
- package/templates/runtime/react/timeline/timeline-panel-floating-layout.test.tsx +328 -0
- package/templates/runtime/react/timeline/timeline-panel-header.tsx +404 -0
- package/templates/runtime/react/timeline/timeline-panel-keyframes.test.tsx +90 -0
- package/templates/runtime/react/timeline/timeline-panel-layout.ts +30 -0
- package/templates/runtime/react/timeline/timeline-panel-responsive-layout.ts +182 -0
- package/templates/runtime/react/timeline/timeline-panel-test-utils.tsx +88 -0
- package/templates/runtime/react/timeline/timeline-panel-transport.test.tsx +202 -0
- package/templates/runtime/react/timeline/timeline-panel-upload.test.tsx +53 -0
- package/templates/runtime/react/timeline/timeline-panel.tsx +449 -0
- package/templates/runtime/react/timeline/timeline-playback-hooks.ts +254 -0
- package/templates/runtime/schema/assembly-contract.ts +271 -0
- package/templates/runtime/schema/control-schema-normalization.ts +55 -0
- package/templates/runtime/schema/controls-panel-actions.ts +141 -0
- package/templates/runtime/schema/controls-panel-layout-groups.ts +144 -0
- package/templates/runtime/schema/controls-panel-normalization.ts +19 -0
- package/templates/runtime/schema/controls-panel-section-layout.ts +140 -0
- package/templates/runtime/schema/controls-panel-section-titles.ts +161 -0
- package/templates/runtime/schema/define-toolcraft-test-utils.ts +18 -0
- package/templates/runtime/schema/define-toolcraft.actions.test.ts +182 -0
- package/templates/runtime/schema/define-toolcraft.assembly.test.ts +246 -0
- package/templates/runtime/schema/define-toolcraft.canvas.test.ts +150 -0
- package/templates/runtime/schema/define-toolcraft.control-layout.test.ts +345 -0
- package/templates/runtime/schema/define-toolcraft.control-sections.test.ts +304 -0
- package/templates/runtime/schema/define-toolcraft.setup-canvas.test.ts +69 -0
- package/templates/runtime/schema/define-toolcraft.setup-persistence.test.ts +66 -0
- package/templates/runtime/schema/define-toolcraft.setup-render-scale-timeline.test.ts +116 -0
- package/templates/runtime/schema/define-toolcraft.setup-settings-transfer.test.ts +291 -0
- package/templates/runtime/schema/define-toolcraft.ts +24 -1449
- package/templates/runtime/schema/panels-schema-normalization.ts +49 -0
- package/templates/runtime/schema/runtime-section-titles.ts +1 -0
- package/templates/runtime/schema/runtime-setup-section.ts +282 -0
- package/templates/runtime/schema/schema-resolvers.ts +168 -0
- package/templates/runtime/schema/types.ts +17 -0
- package/templates/runtime/state/canvas-reducer.ts +106 -0
- package/templates/runtime/state/canvas-state.ts +209 -0
- package/templates/runtime/state/controls-reducer.ts +277 -0
- package/templates/runtime/state/history-patches.ts +174 -0
- package/templates/runtime/state/layer-state.ts +12 -0
- package/templates/runtime/state/layers-reducer.ts +318 -0
- package/templates/runtime/state/media-reducer.ts +283 -0
- package/templates/runtime/state/media-state.ts +105 -0
- package/templates/runtime/state/panels-reducer.ts +58 -0
- package/templates/runtime/state/persistence-merge.ts +53 -0
- package/templates/runtime/state/persistence-reader-canvas.ts +27 -0
- package/templates/runtime/state/persistence-reader-layers.ts +73 -0
- package/templates/runtime/state/persistence-reader-media.ts +82 -0
- package/templates/runtime/state/persistence-reader-panels.ts +56 -0
- package/templates/runtime/state/persistence-reader-primitives.ts +27 -0
- package/templates/runtime/state/persistence-reader-timeline.ts +145 -0
- package/templates/runtime/state/persistence-reader-values.ts +40 -0
- package/templates/runtime/state/persistence-readers.ts +72 -0
- package/templates/runtime/state/persistence-shared.ts +23 -0
- package/templates/runtime/state/persistence-snapshot.ts +57 -0
- package/templates/runtime/state/persistence.ts +16 -581
- package/templates/runtime/state/reducer-canvas-panels.test.ts +324 -0
- package/templates/runtime/state/reducer-controls.test.ts +158 -0
- package/templates/runtime/state/reducer-layers.test.ts +306 -0
- package/templates/runtime/state/reducer-media-import-sizing.test.ts +197 -0
- package/templates/runtime/state/reducer-media-reorder-history.test.ts +116 -0
- package/templates/runtime/state/reducer-media-reset.test.ts +249 -0
- package/templates/runtime/state/reducer-media-test-utils.ts +40 -0
- package/templates/runtime/state/reducer-media-transform.test.ts +52 -0
- package/templates/runtime/state/reducer-test-utils.ts +30 -0
- package/templates/runtime/state/reducer-timeline.test.ts +242 -0
- package/templates/runtime/state/reducer.ts +57 -1785
- package/templates/runtime/state/timeline-reducer.ts +412 -0
- package/templates/runtime/state/timeline-values.test.ts +45 -0
- package/templates/runtime/state/timeline-values.ts +45 -0
- package/templates/runtime/testing/performance-browser-policy.test.ts +81 -0
- package/templates/runtime/testing/performance-browser-policy.ts +102 -0
- package/templates/runtime/testing/performance-budget-validation.ts +84 -0
- package/templates/runtime/testing/performance-control-classification.test.ts +106 -0
- package/templates/runtime/testing/performance-control-classification.ts +101 -0
- package/templates/runtime/testing/performance-coverage-context.ts +44 -0
- package/templates/runtime/testing/performance-coverage-renderer-policy.ts +221 -0
- package/templates/runtime/testing/performance-coverage-scenario-policy.ts +147 -0
- package/templates/runtime/testing/performance-coverage-target-policy.ts +121 -0
- package/templates/runtime/testing/performance-coverage-validator.ts +34 -0
- package/templates/runtime/testing/performance-export-coverage.test.ts +234 -0
- package/templates/runtime/testing/performance-fixture-load-profile.test.ts +360 -0
- package/templates/runtime/testing/performance-fixture-media.test.ts +80 -0
- package/templates/runtime/testing/performance-fixture-stress.test.ts +314 -0
- package/templates/runtime/testing/performance-fixture-validation.ts +255 -0
- package/templates/runtime/testing/performance-fixture-values.ts +275 -0
- package/templates/runtime/testing/performance-fixture-workload.test.ts +140 -0
- package/templates/runtime/testing/performance-load-profile-validation.ts +467 -0
- package/templates/runtime/testing/performance-renderer-coverage.test.ts +325 -0
- package/templates/runtime/testing/performance-renderer-pipeline-coverage.test.ts +115 -0
- package/templates/runtime/testing/performance-renderer-pipeline-interactions.test.ts +201 -0
- package/templates/runtime/testing/performance-renderer-pipeline-passes.test.ts +247 -0
- package/templates/runtime/testing/performance-renderer-pipeline-validation.ts +360 -0
- package/templates/runtime/testing/performance-renderer-technique-validation.ts +329 -0
- package/templates/runtime/testing/performance-renderer-technique.test.ts +275 -0
- package/templates/runtime/testing/performance-renderer-validation.ts +2 -0
- package/templates/runtime/testing/performance-scenario-coverage.test.ts +303 -0
- package/templates/runtime/testing/performance-scenario-validation.ts +49 -0
- package/templates/runtime/testing/performance-schema-derived-workloads.test.ts +231 -0
- package/templates/runtime/testing/performance-schema-queries.ts +181 -0
- package/templates/runtime/testing/performance-test-fixtures/index.ts +4 -0
- package/templates/runtime/testing/performance-test-fixtures/renderer-pipelines.ts +322 -0
- package/templates/runtime/testing/performance-test-fixtures/scenarios.ts +172 -0
- package/templates/runtime/testing/performance-test-fixtures/schemas.ts +151 -0
- package/templates/runtime/testing/performance-test-fixtures/stress-fixtures.ts +133 -0
- package/templates/runtime/testing/performance-test-fixtures.ts +1 -0
- package/templates/runtime/testing/performance-types.ts +338 -0
- package/templates/runtime/testing/performance.ts +15 -2485
- package/templates/starter/AGENTS.md +41 -26
- package/templates/starter/LICENSE.md +18 -95
- package/templates/starter/NOTICE.md +3 -3
- package/templates/starter/docs/toolcraft/README.md +5 -5
- package/templates/starter/docs/toolcraft/acceptance-testing.md +36 -8
- package/templates/starter/docs/toolcraft/assembly-workflow.md +12 -15
- package/templates/starter/docs/toolcraft/component-rules.md +6 -2
- package/templates/starter/docs/toolcraft/core/layout.md +1 -0
- package/templates/starter/docs/toolcraft/core/performance.md +7 -4
- package/templates/starter/docs/toolcraft/core/runtime-boundary.md +11 -4
- package/templates/starter/docs/toolcraft/core/timeline-animation.md +1 -0
- package/templates/starter/docs/toolcraft/custom-controls.md +8 -1
- package/templates/starter/docs/toolcraft/decision-contract.md +26 -22
- package/templates/starter/docs/toolcraft/performance.md +42 -16
- package/templates/starter/docs/toolcraft/schema-reference.md +34 -23
- package/templates/starter/docs/toolcraft/workflow.md +25 -17
- package/templates/starter/e2e/app-browser-acceptance-evidence.spec.ts +111 -0
- package/templates/starter/e2e/app-browser-control-coverage.spec.ts +118 -0
- package/templates/starter/e2e/app-browser-performance-evidence.spec.ts +217 -0
- package/templates/starter/e2e/app-browser-performance-probe.spec.ts +322 -0
- package/templates/starter/e2e/app-browser-proof-session.spec.ts +196 -0
- package/templates/starter/e2e/app-browser-runtime-evidence.spec.ts +9 -0
- package/templates/starter/e2e/app-browser-runtime-provenance.spec.ts +240 -0
- package/templates/starter/e2e/app-browser-runtime-reporter.spec.ts +180 -0
- package/templates/starter/e2e/app-browser-runtime-requirements.spec.ts +310 -0
- package/templates/starter/e2e/app-browser-semantic-evidence.spec.ts +432 -0
- package/templates/starter/e2e/app-browser-shell.spec.ts +171 -0
- package/templates/starter/e2e/app-browser-timeline-layers-reference.spec.ts +70 -0
- package/templates/starter/e2e/app-performance.spec.ts +0 -491
- package/templates/starter/e2e/browser-acceptance-outcome-helpers.ts +97 -0
- package/templates/starter/e2e/browser-acceptance-transition-helpers.ts +74 -0
- package/templates/starter/e2e/browser-conditional-output-evidence-helpers.ts +230 -0
- package/templates/starter/e2e/browser-control-target-helpers.ts +109 -0
- package/templates/starter/e2e/browser-layer-evidence-helpers.ts +229 -0
- package/templates/starter/e2e/browser-proof-session.ts +392 -0
- package/templates/starter/e2e/browser-runtime-evidence-reporter.ts +136 -0
- package/templates/starter/e2e/browser-runtime-evidence-requirements.ts +290 -0
- package/templates/starter/e2e/browser-runtime-evidence.ts +27 -0
- package/templates/starter/e2e/browser-state-evidence-helpers.ts +205 -0
- package/templates/starter/e2e/browser-timeline-evidence-helpers.ts +319 -0
- package/templates/starter/e2e/canvas-handle-helpers.ts +86 -4
- package/templates/starter/e2e/export-artifact-helpers.ts +132 -0
- package/templates/starter/e2e/performance-budget-helpers.ts +159 -0
- package/templates/starter/e2e/performance-canvas-helpers.ts +123 -0
- package/templates/starter/e2e/performance-control-helpers.ts +3 -0
- package/templates/starter/e2e/performance-control-layout-helpers.ts +161 -0
- package/templates/starter/e2e/performance-fixture-helpers.ts +217 -0
- package/templates/starter/e2e/performance-frame-probe.ts +247 -0
- package/templates/starter/e2e/performance-helpers.ts +6 -854
- package/templates/starter/e2e/performance-interaction-measurement.ts +251 -0
- package/templates/starter/e2e/performance-measurement-evidence.ts +72 -0
- package/templates/starter/e2e/performance-output-action-helpers.spec.ts +43 -0
- package/templates/starter/e2e/performance-output-action-helpers.ts +109 -0
- package/templates/starter/e2e/performance-probe-helpers.ts +12 -0
- package/templates/starter/e2e/performance-render-scale-helpers.ts +55 -0
- package/templates/starter/e2e/performance-slider-helpers.ts +271 -0
- package/templates/starter/e2e/product-observable-helpers.ts +72 -17
- package/templates/starter/e2e/stable-outcome-helpers.ts +208 -0
- package/templates/starter/package.json +10 -5
- package/templates/starter/playwright.config.ts +5 -2
- package/templates/starter/scripts/check-ai-skills.mjs +14 -8
- package/templates/starter/scripts/check-ai-skills.test.mjs +64 -0
- package/templates/starter/scripts/check-toolcraft-code-health.mjs +108 -0
- package/templates/starter/scripts/check-toolcraft-code-health.test.mjs +213 -0
- package/templates/starter/scripts/check-toolcraft-docs.mjs +47 -34
- package/templates/starter/scripts/check-toolcraft-integrity.mjs +141 -144
- package/templates/starter/scripts/run-browser-performance.mjs +118 -0
- package/templates/starter/scripts/run-browser-performance.test.mjs +53 -0
- package/templates/starter/scripts/toolcraft-code-health-core.mjs +297 -0
- package/templates/starter/scripts/toolcraft-contract-doc-integrity.mjs +77 -0
- package/templates/starter/scripts/toolcraft-contract-doc-integrity.test.mjs +81 -0
- package/templates/starter/scripts/toolcraft-contract-manifest.json +113 -0
- package/templates/starter/scripts/toolcraft-contract-manifest.mjs +128 -0
- package/templates/starter/scripts/toolcraft-contract-manifest.test.mjs +72 -0
- package/templates/starter/scripts/toolcraft-integrity-manifest.mjs +172 -0
- package/templates/starter/scripts/toolcraft-integrity-policy.mjs +60 -0
- package/templates/starter/scripts/toolcraft-product-boundary-ast-utils.mjs +23 -0
- package/templates/starter/scripts/toolcraft-product-boundary-ast.mjs +264 -0
- package/templates/starter/scripts/toolcraft-product-boundary-test-fixtures.mjs +16 -0
- package/templates/starter/scripts/toolcraft-product-boundary.mjs +243 -0
- package/templates/starter/scripts/toolcraft-product-boundary.test.mjs +289 -0
- package/templates/starter/scripts/toolcraft-product-dependency-graph.mjs +176 -0
- package/templates/starter/scripts/toolcraft-product-dependency-graph.test.mjs +196 -0
- package/templates/starter/scripts/toolcraft-product-dependency-resolution.mjs +279 -0
- package/templates/starter/scripts/toolcraft-product-evidence-boundary-ast.mjs +91 -0
- package/templates/starter/scripts/toolcraft-product-evidence-boundary.test.mjs +138 -0
- package/templates/starter/scripts/toolcraft-product-style-boundary.mjs +219 -0
- package/templates/starter/scripts/toolcraft-source-inventory.d.mts +46 -0
- package/templates/starter/scripts/toolcraft-source-inventory.mjs +187 -0
- package/templates/starter/scripts/toolcraft-source-inventory.test.mjs +132 -0
- package/templates/starter/scripts/toolcraft-source-ownership.mjs +167 -0
- package/templates/starter/scripts/toolcraft-source-ownership.test.mjs +113 -0
- package/templates/starter/scripts/toolcraft-static-string.mjs +104 -0
- package/templates/starter/scripts/toolcraft-verification-inventory.mjs +123 -0
- package/templates/starter/scripts/toolcraft-verification-receipt.d.mts +19 -0
- package/templates/starter/scripts/toolcraft-verification-receipt.mjs +284 -0
- package/templates/starter/scripts/toolcraft-verification-receipt.test.mjs +282 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.d.mts +32 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.mjs +88 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.test.mjs +87 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.mjs +109 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.test.mjs +111 -0
- package/templates/starter/scripts/toolcraft-workflow-routes.mjs +314 -0
- package/templates/starter/scripts/toolcraft-workflow-routes.test.mjs +204 -0
- package/templates/starter/src/app/acceptance/actions.ts +30 -0
- package/templates/starter/src/app/acceptance/animation-intent.ts +184 -0
- package/templates/starter/src/app/acceptance/canvas-handle-acceptance.ts +70 -0
- package/templates/starter/src/app/acceptance/color-bank-labels.ts +164 -0
- package/templates/starter/src/app/acceptance/conditions.ts +80 -0
- package/templates/starter/src/app/acceptance/control-acceptance-context.ts +70 -0
- package/templates/starter/src/app/acceptance/control-acceptance-coverage.ts +271 -0
- package/templates/starter/src/app/acceptance/control-acceptance-kind-rules.ts +149 -0
- package/templates/starter/src/app/acceptance/control-acceptance-policy.ts +189 -0
- package/templates/starter/src/app/acceptance/control-acceptance.ts +70 -0
- package/templates/starter/src/app/acceptance/control-component-rules.ts +277 -0
- package/templates/starter/src/app/acceptance/control-labels.ts +223 -0
- package/templates/starter/src/app/acceptance/control-layout-dependency-rules.ts +107 -0
- package/templates/starter/src/app/acceptance/control-layout-entity-rules.ts +104 -0
- package/templates/starter/src/app/acceptance/control-layout-model.ts +159 -0
- package/templates/starter/src/app/acceptance/control-layout-section-rules.ts +164 -0
- package/templates/starter/src/app/acceptance/control-layout.ts +45 -0
- package/templates/starter/src/app/acceptance/control-order.ts +123 -0
- package/templates/starter/src/app/acceptance/control-parts.ts +47 -0
- package/templates/starter/src/app/acceptance/control-section-inventory.ts +183 -0
- package/templates/starter/src/app/acceptance/controls.ts +27 -0
- package/templates/starter/src/app/acceptance/coverage.ts +81 -0
- package/templates/starter/src/app/acceptance/custom-controls.ts +140 -0
- package/templates/starter/src/app/acceptance/inline-layout.ts +192 -0
- package/templates/starter/src/app/acceptance/media-upload.ts +55 -0
- package/templates/starter/src/app/acceptance/output-background-rules.ts +135 -0
- package/templates/starter/src/app/acceptance/output-export-actions.test.ts +76 -0
- package/templates/starter/src/app/acceptance/output-export-actions.ts +34 -0
- package/templates/starter/src/app/acceptance/output-export-layout-rules.ts +46 -0
- package/templates/starter/src/app/acceptance/output-export-model.ts +146 -0
- package/templates/starter/src/app/acceptance/output-export.ts +45 -0
- package/templates/starter/src/app/acceptance/output-image-export-rules.ts +87 -0
- package/templates/starter/src/app/acceptance/reference-runtime-coverage.ts +96 -0
- package/templates/starter/src/app/acceptance/reference-runtime-feature-inventory.ts +171 -0
- package/templates/starter/src/app/acceptance/reference-runtime-study.ts +73 -0
- package/templates/starter/src/app/acceptance/reference-runtime-timeline.ts +291 -0
- package/templates/starter/src/app/acceptance/reference-runtime.ts +99 -0
- package/templates/starter/src/app/acceptance/runtime-coverage.ts +290 -0
- package/templates/starter/src/app/acceptance/runtime-setup.ts +117 -0
- package/templates/starter/src/app/acceptance/section-title-rules.ts +8 -0
- package/templates/starter/src/app/acceptance/sections.ts +6 -0
- package/templates/starter/src/app/acceptance/semantic.ts +63 -0
- package/templates/starter/src/app/acceptance/timeline-loop.ts +21 -0
- package/templates/starter/src/app/acceptance/types.ts +363 -0
- package/templates/starter/src/app/acceptance/validate-coverage.ts +217 -0
- package/templates/starter/src/app/acceptance/validation-pipeline.test.ts +56 -0
- package/templates/starter/src/app/acceptance/validation-pipeline.ts +60 -0
- package/templates/starter/src/app/acceptance/video-reference-study.ts +217 -0
- package/templates/starter/src/app/starter-acceptance-data.ts +21 -0
- package/templates/starter/src/app/starter-acceptance.animation-intent.test.ts +383 -0
- package/templates/starter/src/app/starter-acceptance.background-export.test.ts +349 -0
- package/templates/starter/src/app/starter-acceptance.base-coverage.test.ts +47 -0
- package/templates/starter/src/app/starter-acceptance.canvas-handles.test.ts +71 -0
- package/templates/starter/src/app/starter-acceptance.canvas-sizing.test.ts +199 -0
- package/templates/starter/src/app/starter-acceptance.compound-part-coverage.test.ts +244 -0
- package/templates/starter/src/app/starter-acceptance.contract-fixtures.ts +63 -0
- package/templates/starter/src/app/starter-acceptance.control-label-context.test.ts +172 -0
- package/templates/starter/src/app/starter-acceptance.control-labels.test.ts +387 -0
- package/templates/starter/src/app/starter-acceptance.control-naming-rules.test.ts +215 -0
- package/templates/starter/src/app/starter-acceptance.control-order.test.ts +274 -0
- package/templates/starter/src/app/starter-acceptance.control-state.test.ts +275 -0
- package/templates/starter/src/app/starter-acceptance.curves-rules.test.ts +184 -0
- package/templates/starter/src/app/starter-acceptance.custom-control-collections.test.ts +200 -0
- package/templates/starter/src/app/starter-acceptance.custom-control-coverage.test.ts +111 -0
- package/templates/starter/src/app/starter-acceptance.custom-control-fit-check.test.ts +135 -0
- package/templates/starter/src/app/starter-acceptance.custom-control-valid.test.ts +74 -0
- package/templates/starter/src/app/starter-acceptance.export-test-utils.ts +107 -0
- package/templates/starter/src/app/starter-acceptance.framework-boundary.test.ts +327 -0
- package/templates/starter/src/app/starter-acceptance.image-video-export-settings.test.ts +328 -0
- package/templates/starter/src/app/starter-acceptance.keyframes.test.ts +242 -0
- package/templates/starter/src/app/starter-acceptance.layers.test.ts +203 -0
- package/templates/starter/src/app/starter-acceptance.media-upload.fixtures.ts +110 -0
- package/templates/starter/src/app/starter-acceptance.media-upload.test.ts +153 -0
- package/templates/starter/src/app/starter-acceptance.output-export-rules.test.ts +97 -0
- package/templates/starter/src/app/starter-acceptance.persistence-coverage.test.ts +134 -0
- package/templates/starter/src/app/starter-acceptance.product-output-export.test.ts +202 -0
- package/templates/starter/src/app/starter-acceptance.product-readiness-rules.test.ts +14 -0
- package/templates/starter/src/app/starter-acceptance.product-readiness-test-utils.ts +25 -0
- package/templates/starter/src/app/starter-acceptance.product-readiness.test.ts +50 -0
- package/templates/starter/src/app/starter-acceptance.product-worklog.test.ts +27 -0
- package/templates/starter/src/app/starter-acceptance.range-slider-rules.test.ts +147 -0
- package/templates/starter/src/app/starter-acceptance.reference-custom-timeline.test.ts +197 -0
- package/templates/starter/src/app/starter-acceptance.reference-foundation.test.ts +304 -0
- package/templates/starter/src/app/starter-acceptance.reference-test-utils.ts +102 -0
- package/templates/starter/src/app/starter-acceptance.reference-timeline.test.ts +267 -0
- package/templates/starter/src/app/starter-acceptance.schema-test-utils.ts +116 -0
- package/templates/starter/src/app/starter-acceptance.section-cohesion.test.ts +373 -0
- package/templates/starter/src/app/starter-acceptance.section-dependencies.test.ts +260 -0
- package/templates/starter/src/app/starter-acceptance.section-titles.test.ts +180 -0
- package/templates/starter/src/app/starter-acceptance.setup-readiness.test.ts +205 -0
- package/templates/starter/src/app/starter-acceptance.slider-rules.test.ts +470 -0
- package/templates/starter/src/app/starter-acceptance.slider-unit-rules.test.ts +61 -0
- package/templates/starter/src/app/starter-acceptance.source-test-utils.ts +43 -0
- package/templates/starter/src/app/starter-acceptance.test-utils.ts +21 -0
- package/templates/starter/src/app/starter-acceptance.text-control-kind.test.ts +89 -0
- package/templates/starter/src/app/starter-acceptance.timeline-playback.test.ts +264 -0
- package/templates/starter/src/app/starter-acceptance.timeline-test-utils.ts +56 -0
- package/templates/starter/src/app/starter-acceptance.toggle-pair-layout.test.ts +200 -0
- package/templates/starter/src/app/starter-acceptance.toggle-parameter-layout.test.ts +277 -0
- package/templates/starter/src/app/starter-acceptance.ts +151 -4576
- package/templates/starter/src/app/starter-acceptance.video-export-test-utils.ts +37 -0
- package/templates/starter/src/app/starter-acceptance.video-reference-study.test.ts +262 -0
- package/templates/starter/src/app/starter-acceptance.worklog-test-utils.ts +428 -0
- package/templates/starter/src/app/starter-acceptance.worklog.test.ts +283 -0
- package/templates/starter/src/app/starter-automated-runtime-evidence.test.ts +34 -0
- package/templates/starter/src/app/starter-composition.tsx +7 -0
- package/templates/starter/src/app/starter-performance-test-utils.ts +275 -0
- package/templates/starter/src/app/starter-performance.budgets.test.ts +374 -0
- package/templates/starter/src/app/starter-performance.gates.test.ts +128 -0
- package/templates/starter/src/app/starter-performance.renderer-source.test.ts +136 -0
- package/templates/starter/src/app/starter-performance.renderer-technique.test.ts +291 -0
- package/templates/starter/src/app/starter-performance.scenarios.test.ts +355 -0
- package/templates/starter/src/app/test-evidence/browser-runtime-contract.test.ts +253 -0
- package/templates/starter/src/app/test-evidence/browser-runtime-contract.ts +243 -0
- package/templates/starter/src/routes/index.tsx +11 -2
- package/templates/starter/vite.config.ts +8 -0
- package/templates/ui/components/controls/color/color-control-types.ts +38 -0
- package/templates/ui/components/controls/color/color-control.tsx +19 -437
- package/templates/ui/components/controls/color/color-footer.tsx +272 -0
- package/templates/ui/components/controls/color/color-model-slider.tsx +271 -0
- package/templates/ui/components/controls/color/color-opacity-input.tsx +94 -0
- package/templates/ui/components/controls/color/color-surface.tsx +194 -0
- package/templates/ui/components/controls/color/color-value-control.tsx +159 -0
- package/templates/ui/components/controls/color/color-value-utils.ts +170 -0
- package/templates/ui/components/controls/color/index.ts +10 -3
- package/templates/ui/components/controls/color/palette-control-controller.ts +407 -0
- package/templates/ui/components/controls/color/palette-control-layout.ts +14 -0
- package/templates/ui/components/controls/color/palette-control-types.ts +50 -0
- package/templates/ui/components/controls/color/palette-control-view.tsx +174 -0
- package/templates/ui/components/controls/color/palette-control.tsx +6 -544
- package/templates/ui/components/controls/color/style-guide-color-picker-color-utils.ts +39 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-controller.ts +370 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-hue-handlers.ts +66 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-interaction-state.ts +49 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-interactions.ts +2 -2
- package/templates/ui/components/controls/color/style-guide-color-picker-model.ts +125 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-parts.tsx +10 -707
- package/templates/ui/components/controls/color/style-guide-color-picker-surface-drag.ts +93 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-surface-geometry.ts +114 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-surface-preview.ts +45 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-types.ts +84 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-view.tsx +69 -0
- package/templates/ui/components/controls/color/style-guide-color-picker.tsx +6 -495
- package/templates/ui/components/controls/curves/curves-control.tsx +4 -3
- package/templates/ui/components/controls/file-drop/file-drop-control.tsx +39 -515
- package/templates/ui/components/controls/file-drop/file-drop-empty-state.tsx +35 -0
- package/templates/ui/components/controls/file-drop/file-drop-file-list.tsx +160 -0
- package/templates/ui/components/controls/file-drop/file-drop-image-grid.tsx +175 -0
- package/templates/ui/components/controls/file-drop/file-drop-model.tsx +170 -0
- package/templates/ui/components/controls/file-drop/file-drop-single-preview.tsx +63 -0
- package/templates/ui/components/controls/file-drop/file-drop-types.ts +48 -0
- package/templates/ui/components/controls/file-drop/index.ts +2 -2
- package/templates/ui/components/controls/font-picker/font-picker-control.tsx +133 -906
- package/templates/ui/components/controls/font-picker/font-picker-footer.tsx +116 -0
- package/templates/ui/components/controls/font-picker/font-picker-list.tsx +194 -0
- package/templates/ui/components/controls/font-picker/font-picker-popover-content.tsx +191 -0
- package/templates/ui/components/controls/font-picker/font-picker-value.ts +222 -0
- package/templates/ui/components/controls/font-picker/index.ts +4 -1
- package/templates/ui/components/controls/font-picker/use-font-picker-preview-pipeline.ts +163 -0
- package/templates/ui/components/controls/font-picker/use-font-picker-virtual-list.ts +293 -0
- package/templates/ui/components/controls/gradient/gradient-control-utils.ts +2 -25
- package/templates/ui/components/controls/gradient/gradient-control.tsx +4 -464
- package/templates/ui/components/controls/gradient/gradient-stops-controller.ts +332 -0
- package/templates/ui/components/controls/gradient/gradient-stops-track.tsx +159 -0
- package/templates/ui/components/controls/vector/vector-control-types.ts +26 -0
- package/templates/ui/components/controls/vector/vector-control.tsx +10 -486
- package/templates/ui/components/controls/vector/vector-pad-field.tsx +211 -0
- package/templates/ui/components/controls/vector/vector-pad-geometry.ts +61 -0
- package/templates/ui/components/controls/vector/vector-pad-parts.tsx +72 -0
- package/templates/ui/components/controls/vector/vector-pad-variants.ts +20 -0
- package/templates/ui/components/controls/vector/vector-size-field.tsx +104 -0
- package/templates/ui/components/controls/vector/vector-value.ts +46 -0
- package/templates/ui/components/primitives/slider/slider-discrete-state.ts +181 -0
- package/templates/ui/components/primitives/slider/slider-marker-policy.ts +52 -0
- package/templates/ui/components/primitives/slider/slider-pointer-dragging.ts +87 -0
- package/templates/ui/components/primitives/slider/slider-runtime.ts +109 -0
- package/templates/ui/components/primitives/slider/slider-types.ts +21 -0
- package/templates/ui/components/primitives/slider/slider.tsx +2 -403
- package/templates/runtime/react/canvas-shell.test.tsx +0 -554
- package/templates/runtime/react/canvas-shell.tsx +0 -585
- package/templates/runtime/react/controls-panel.test.tsx +0 -5446
- package/templates/runtime/react/controls-panel.tsx +0 -3220
- package/templates/runtime/react/layers-panel.test.tsx +0 -487
- package/templates/runtime/react/layers-panel.tsx +0 -1348
- package/templates/runtime/react/timeline-panel.test.tsx +0 -751
- package/templates/runtime/react/timeline-panel.tsx +0 -3078
- package/templates/runtime/schema/define-toolcraft.test.ts +0 -1742
- package/templates/runtime/state/reducer.test.ts +0 -1703
- package/templates/runtime/testing/performance.test.ts +0 -3081
- package/templates/starter/e2e/app-browser-acceptance.spec.ts +0 -785
- package/templates/starter/src/app/starter-acceptance.test.ts +0 -10068
- package/templates/starter/src/app/starter-performance.test.ts +0 -1583
- package/templates/ui/components/controls/color/style-guide-color-picker-logic.ts +0 -490
- /package/templates/runtime/react/{storage-key-migration.ts → app-shell/storage-key-migration.ts} +0 -0
- /package/templates/runtime/react/{theme-runtime.tsx → app-shell/theme-runtime.tsx} +0 -0
- /package/templates/runtime/react/{curve-geometry.test.ts → controls-panel/__tests__/curve-geometry.test.ts} +0 -0
- /package/templates/runtime/react/{panel-host-config.ts → panel-host/panel-host-config.ts} +0 -0
- /package/templates/runtime/react/{panel-host-geometry.test.ts → panel-host/panel-host-geometry.test.ts} +0 -0
- /package/templates/runtime/react/{panel-host-geometry.ts → panel-host/panel-host-geometry.ts} +0 -0
|
@@ -5,11 +5,48 @@ import { cwd } from "node:process";
|
|
|
5
5
|
import { describe, expect, expectTypeOf, it } from "vitest";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
TOOLCRAFT_COMPONENT_CONTRACTS,
|
|
9
8
|
getToolcraftComponentContract,
|
|
9
|
+
isToolcraftBuiltInControlType,
|
|
10
|
+
TOOLCRAFT_BUILT_IN_CONTROL_TYPES,
|
|
10
11
|
} from "./component-contracts";
|
|
11
12
|
|
|
12
|
-
describe("Toolcraft template component contracts", () => {
|
|
13
|
+
describe("Toolcraft template component contracts: core", () => {
|
|
14
|
+
it("derives one canonical built-in control registry from component contracts", () => {
|
|
15
|
+
expect(TOOLCRAFT_BUILT_IN_CONTROL_TYPES).toEqual([
|
|
16
|
+
"aspectRatio",
|
|
17
|
+
"slider",
|
|
18
|
+
"rangeSlider",
|
|
19
|
+
"text",
|
|
20
|
+
"rangeInput",
|
|
21
|
+
"code",
|
|
22
|
+
"select",
|
|
23
|
+
"segmented",
|
|
24
|
+
"switch",
|
|
25
|
+
"checkbox",
|
|
26
|
+
"actions",
|
|
27
|
+
"collectionActions",
|
|
28
|
+
"panelActions",
|
|
29
|
+
"colorOpacity",
|
|
30
|
+
"palette",
|
|
31
|
+
"vector",
|
|
32
|
+
"color",
|
|
33
|
+
"gradient",
|
|
34
|
+
"fontPicker",
|
|
35
|
+
"curves",
|
|
36
|
+
"anchorGrid",
|
|
37
|
+
"channelMixer",
|
|
38
|
+
"fileDrop",
|
|
39
|
+
"imagePicker",
|
|
40
|
+
"settingsTransfer",
|
|
41
|
+
]);
|
|
42
|
+
expect(new Set(TOOLCRAFT_BUILT_IN_CONTROL_TYPES).size).toBe(
|
|
43
|
+
TOOLCRAFT_BUILT_IN_CONTROL_TYPES.length,
|
|
44
|
+
);
|
|
45
|
+
expect(isToolcraftBuiltInControlType("gradient")).toBe(true);
|
|
46
|
+
expect(isToolcraftBuiltInControlType("customControl")).toBe(false);
|
|
47
|
+
expect(isToolcraftBuiltInControlType("productMaskEditor")).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
13
50
|
it("exposes decision catalog metadata for controls that agents choose between", () => {
|
|
14
51
|
for (const id of [
|
|
15
52
|
"slider",
|
|
@@ -76,36 +113,6 @@ describe("Toolcraft template component contracts", () => {
|
|
|
76
113
|
);
|
|
77
114
|
});
|
|
78
115
|
|
|
79
|
-
it("documents select as the fallback for segmented controls that exceed compact limits", () => {
|
|
80
|
-
const segmented = getToolcraftComponentContract("segmented").decisionCatalog;
|
|
81
|
-
const select = getToolcraftComponentContract("select").decisionCatalog;
|
|
82
|
-
|
|
83
|
-
expect(segmented?.strictness).toBe("best-fit");
|
|
84
|
-
expect(segmented?.acceptableAlternatives?.join(" ")).toMatch(/Select/i);
|
|
85
|
-
expect(segmented?.layoutConstraints).toContain(
|
|
86
|
-
"Segmented controls are full-width controls and must not be placed in two-column inline or half-width layout groups.",
|
|
87
|
-
);
|
|
88
|
-
expect(getToolcraftComponentContract("segmented").aiUsageRules).toContain(
|
|
89
|
-
"Do not place Segmented beside Switch, Color, Select, or another control in an inline row; use Select when a finite choice must occupy a half-width column.",
|
|
90
|
-
);
|
|
91
|
-
expect(select?.useWhen.join(" ")).toMatch(/long labels|many options/i);
|
|
92
|
-
expect(select?.useWhen).toContain(
|
|
93
|
-
"Use Select when a dropdown choice is more readable than a row of segmented cells.",
|
|
94
|
-
);
|
|
95
|
-
expect(select?.layoutConstraints).toContain(
|
|
96
|
-
"Standalone Select controls render stacked full-width with the label above the dropdown; do not use the compact side-label row with label left and dropdown right.",
|
|
97
|
-
);
|
|
98
|
-
expect(select?.layoutConstraints).toContain(
|
|
99
|
-
"Prefer compact two-column inline layout only for related short Select pairs that tune one workflow or entity.",
|
|
100
|
-
);
|
|
101
|
-
expect(select?.layoutConstraints).toContain(
|
|
102
|
-
"Use vertical one-select-per-row layout for single Select controls and as the fallback when a Select pair label, selected value, or option text would clip, truncate, or lose internal padding in the compact row.",
|
|
103
|
-
);
|
|
104
|
-
expect(select?.layoutConstraints).toContain(
|
|
105
|
-
"If a compact Select pair falls back to vertical layout, record the fit reason in the spec or worklog.",
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
116
|
it("keeps UI data variants in the exported stylesheet for standalone apps", () => {
|
|
110
117
|
const uiStyles = readFileSync(
|
|
111
118
|
resolve(cwd(), "../ui/src/styles.css"),
|
|
@@ -123,87 +130,6 @@ describe("Toolcraft template component contracts", () => {
|
|
|
123
130
|
}
|
|
124
131
|
});
|
|
125
132
|
|
|
126
|
-
it("marks standalone controls as component-labeled standalone controls", () => {
|
|
127
|
-
for (const id of [
|
|
128
|
-
"palette",
|
|
129
|
-
"vector",
|
|
130
|
-
"color",
|
|
131
|
-
"colorOpacity",
|
|
132
|
-
"gradient",
|
|
133
|
-
"fontPicker",
|
|
134
|
-
"curves",
|
|
135
|
-
"anchorGrid",
|
|
136
|
-
"channelMixer",
|
|
137
|
-
"imagePicker",
|
|
138
|
-
] as const) {
|
|
139
|
-
const contract = getToolcraftComponentContract(id);
|
|
140
|
-
|
|
141
|
-
expect(contract.kind).toBe("control");
|
|
142
|
-
expect(contract.defaultSectionLayout).toBe("standalone");
|
|
143
|
-
expect(contract.labelPolicy).toBe("component-owned");
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it("documents vector density and section grouping rules", () => {
|
|
148
|
-
const contract = getToolcraftComponentContract("vector");
|
|
149
|
-
|
|
150
|
-
expect(contract.aiUsageRules).toContain(
|
|
151
|
-
"If the controls panel contains exactly one vector control, the runtime renders the vector pad as a square.",
|
|
152
|
-
);
|
|
153
|
-
expect(contract.aiUsageRules).toContain(
|
|
154
|
-
"Multiple vector controls should live in separate semantic sections unless they intentionally belong to the same entity with other related controls.",
|
|
155
|
-
);
|
|
156
|
-
expect(contract.decisionCatalog?.ownsValueModel).toEqual(
|
|
157
|
-
expect.arrayContaining([
|
|
158
|
-
"user-authored stable position",
|
|
159
|
-
"user-authored stable offset",
|
|
160
|
-
"user-authored stable direction",
|
|
161
|
-
]),
|
|
162
|
-
);
|
|
163
|
-
expect(contract.decisionCatalog?.useWhen).toContain(
|
|
164
|
-
"Use Vector for paired X/Y values only when the user is meant to manually author a stable two-axis product parameter such as position, offset, direction, focus, anchor, light direction, or color-balance movement.",
|
|
165
|
-
);
|
|
166
|
-
expect(contract.decisionCatalog?.doNotReplaceWith).toContain(
|
|
167
|
-
"Do not replace animation, keyboard input, pointer input, physics, timeline phase, velocity, or simulated pose state with Vector just because the internal value has x/y coordinates.",
|
|
168
|
-
);
|
|
169
|
-
expect(contract.decisionCatalog?.acceptableAlternatives).toContain(
|
|
170
|
-
"Use timeline, keyboard/pointer handlers, motion sliders, path/step controls, or renderer simulation state when movement is generated by animation or user input rather than authored as a stable panel value.",
|
|
171
|
-
);
|
|
172
|
-
expect(contract.aiUsageRules).toContain(
|
|
173
|
-
"Use Vector only for user-authored stable two-axis product parameters. Do not expose Vector for current animation state, keyboard movement, pointer movement, physics state, timeline phase, velocity, target pose, current pose, or simulated position/direction.",
|
|
174
|
-
);
|
|
175
|
-
expect(contract.aiUsageRules).toContain(
|
|
176
|
-
"Before adding a Vector control to an animated or interactive product, classify movement ownership as direct-authored, timeline-driven, keyboard/pointer-driven, or simulation-owned. Only direct-authored movement may become a visible Vector control; the other ownership modes stay in renderer/runtime interaction state and use controls such as Speed, Step, Spread, Path, Duration, or Timeline when the user needs tuning.",
|
|
177
|
-
);
|
|
178
|
-
expect(contract.aiUsageRules).toContain(
|
|
179
|
-
'Use variant: "whiteBalance" for temperature/tint pads: X maps cool blue to warm amber, Y maps green to magenta.',
|
|
180
|
-
);
|
|
181
|
-
expect(contract.aiUsageRules).toContain(
|
|
182
|
-
'Use variant: "colorBalance" for paired color-balance axes such as cyan/red and blue/yellow correction.',
|
|
183
|
-
);
|
|
184
|
-
expect(contract.aiUsageRules).toContain(
|
|
185
|
-
'Use the default vector variant for spatial values such as position, offset, direction, focus, anchor, and light direction.',
|
|
186
|
-
);
|
|
187
|
-
expect(contract.aiUsageRules).toContain(
|
|
188
|
-
'Default spatial vector pads use coordinateMode: "screen": dragging left/up makes vector.x and vector.y smaller so canvas objects move left/up without renderer-side Y inversion.',
|
|
189
|
-
);
|
|
190
|
-
expect(contract.aiUsageRules).toContain(
|
|
191
|
-
"Vector pad value labels render compact rounded coordinates. Do not expose raw floating-point strings such as -0.07070312499999998 in the controls panel.",
|
|
192
|
-
);
|
|
193
|
-
expect(contract.aiUsageRules).toContain(
|
|
194
|
-
"Double-clicking a vector pad resets both axes to the control default through the normal runtime value update, matching section header reset semantics; if no default is defined, the fallback is 0,0. Do not add a separate custom reset UI for this basic pad reset behavior.",
|
|
195
|
-
);
|
|
196
|
-
expect(contract.aiUsageRules).toContain(
|
|
197
|
-
"Holding Shift while dragging a vector pad locks movement to the dominant axis and must not select text or page content; do not build a custom pad just to support axis-constrained movement.",
|
|
198
|
-
);
|
|
199
|
-
expect(contract.aiUsageRules).toContain(
|
|
200
|
-
'Use coordinateMode: "cartesian" only when the product intentionally exposes mathematical Y-up coordinates instead of canvas/screen movement.',
|
|
201
|
-
);
|
|
202
|
-
expect(contract.aiUsageRules).toContain(
|
|
203
|
-
"Vector is a compound control; acceptance must prove vector.x and vector.y both affect the product output and that the vector represents a user-authored stable two-axis parameter rather than current animation, input, or simulation state.",
|
|
204
|
-
);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
133
|
it("marks grouped controls as label-required grouped controls", () => {
|
|
208
134
|
for (const id of [
|
|
209
135
|
"slider",
|
|
@@ -224,1351 +150,6 @@ describe("Toolcraft template component contracts", () => {
|
|
|
224
150
|
}
|
|
225
151
|
});
|
|
226
152
|
|
|
227
|
-
it("documents context-only labels for binary controls", () => {
|
|
228
|
-
const switchContract = getToolcraftComponentContract("switch");
|
|
229
|
-
const checkboxContract = getToolcraftComponentContract("checkbox");
|
|
230
|
-
|
|
231
|
-
expect(switchContract.aiUsageRules).toContain(
|
|
232
|
-
'Switch labels name the setting context only; do not prefix labels with "Enable" or "Disable" because the switch already communicates on/off behavior.',
|
|
233
|
-
);
|
|
234
|
-
expect(switchContract.aiUsageRules).toContain(
|
|
235
|
-
'Use labels such as "CRT", "Background", "Glow", or "Loop" instead of "Enable CRT" or "Disable background".',
|
|
236
|
-
);
|
|
237
|
-
expect(switchContract.aiUsageRules).toContain(
|
|
238
|
-
"Two adjacent Switch controls for the same product entity must share one inline row when every visible label fits without truncation. Keep paired labels to short one- or two-word names; the runtime auto-pairs safe adjacent switches by target entity, and generated schemas should stack switches only when any label would truncate.",
|
|
239
|
-
);
|
|
240
|
-
expect(switchContract.aiUsageRules).toContain(
|
|
241
|
-
"When the nearest section title already names the switch context, do not duplicate that title as the visible switch label. Use label false for a visual-only toggle and keep the meaning in target/description.",
|
|
242
|
-
);
|
|
243
|
-
expect(switchContract.aiUsageRules).toContain(
|
|
244
|
-
'A Switch may share an inline row with one related parameter control when the visible switch label is short enough to fit. That row uses equal-width columns and the same horizontal column gap as paired Select controls; never shrink the switch column to intrinsic width. The non-switch parameter uses label false in that row; if its label is needed, stack the controls instead. In section-owned rows, use a short visible switch label such as "Include" instead of repeating the section title, such as "Include background" inside Background.',
|
|
245
|
-
);
|
|
246
|
-
expect(checkboxContract.aiUsageRules).toContain(
|
|
247
|
-
'Checkbox labels name the setting context only; do not prefix labels with "Enable" or "Disable" because the checkbox already communicates enabled/selected state.',
|
|
248
|
-
);
|
|
249
|
-
expect(checkboxContract.aiUsageRules).toContain(
|
|
250
|
-
'Use labels such as "Transparent background", "Guides", or "Loop" instead of "Enable transparent background".',
|
|
251
|
-
);
|
|
252
|
-
expect(checkboxContract.aiUsageRules).toContain(
|
|
253
|
-
"When the nearest section title already names the checkbox context, do not duplicate that title as the visible checkbox label. Use label false for a visual-only checkbox and keep the meaning in target/description.",
|
|
254
|
-
);
|
|
255
|
-
expect(checkboxContract.aiUsageRules).toContain(
|
|
256
|
-
"Two adjacent Checkbox controls for the same product entity must share one inline row when every visible label fits without truncation. Keep paired labels to short one- or two-word names; the runtime auto-pairs safe adjacent checkboxes by target entity, and generated schemas should stack checkboxes only when any label would truncate.",
|
|
257
|
-
);
|
|
258
|
-
expect(checkboxContract.aiUsageRules).toContain(
|
|
259
|
-
"A Checkbox may share an inline row with one related parameter control when the visible checkbox label is short enough to fit. That row uses equal-width columns and the same horizontal column gap as paired Select controls; never shrink the checkbox column to intrinsic width. The non-checkbox parameter uses label false in that row; if its label is needed, stack the controls instead. Hide the checkbox label when the section title provides the visible context.",
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it("documents minimal UI rules for custom controls", () => {
|
|
264
|
-
const contract = getToolcraftComponentContract("customControl");
|
|
265
|
-
|
|
266
|
-
expect(contract.visualComponent).toBe("CustomControlRenderer");
|
|
267
|
-
expect(contract.aiUsageRules).toContain(
|
|
268
|
-
"Custom controls must render the minimum UI needed to understand the value, context, and available actions; avoid decorative metadata and text that repeats what the section, label, or visible item already explains.",
|
|
269
|
-
);
|
|
270
|
-
expect(contract.aiUsageRules).toContain(
|
|
271
|
-
"Every visible custom-control element must justify its space by enabling selection, ordering, preview, removal, upload, editing, or status that affects the product.",
|
|
272
|
-
);
|
|
273
|
-
expect(contract.aiUsageRules).toContain(
|
|
274
|
-
"Do not use a custom control to recreate a built-in Slider, RangeSlider, Select, Segmented, Switch, Checkbox, Color, ColorOpacity, Gradient, FontPicker, ImagePicker, FileDrop, TextInput, CodeTextarea, RangeInput, Palette, Actions, CollectionActions, Curves, AnchorGrid, ChannelMixer, Vector, or PanelActions control.",
|
|
275
|
-
);
|
|
276
|
-
expect(contract.aiUsageRules).toContain(
|
|
277
|
-
"When a custom control owns a growable, removable, selectable, or reorderable runtime item set, its builtInFitCheck must explicitly check collectionActions and actions before choosing custom; this is based on the value model and user workflow, not on entity names such as masks or glyphs.",
|
|
278
|
-
);
|
|
279
|
-
expect(contract.aiUsageRules).toContain(
|
|
280
|
-
"Do not justify custom controls with icons, layout, styling, compactness, or custom buttons alone. The fit check must name the product interaction or value model that built-ins cannot express.",
|
|
281
|
-
);
|
|
282
|
-
expect(contract.aiUsageRules).toContain(
|
|
283
|
-
"Custom controls may use Toolcraft primitives for small app-specific chrome, but must not import or render low-level runtime surfaces or duplicate toolbar, timeline, layers, canvas, panel, or built-in control mechanics.",
|
|
284
|
-
);
|
|
285
|
-
expect(contract.aiUsageRules).toContain(
|
|
286
|
-
"Custom-control action buttons must be sized for the interaction. Do not shrink destructive, reorder, upload, or primary actions below comfortable kit button/icon-button sizes just to fit more text.",
|
|
287
|
-
);
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
it("documents Actions as local section command groups", () => {
|
|
291
|
-
const contract = getToolcraftComponentContract("actions");
|
|
292
|
-
|
|
293
|
-
expect(contract.stateMode).toBe("command-only");
|
|
294
|
-
expect(contract.decisionCatalog?.ownsValueModel).toContain(
|
|
295
|
-
"entity-scoped command group",
|
|
296
|
-
);
|
|
297
|
-
expect(contract.decisionCatalog?.useWhen).toContain(
|
|
298
|
-
"Use Actions for section-scoped commands such as Randomize palette, Normalize weights, Sort glyphs, Clear selection, Duplicate item, or Reset current entity.",
|
|
299
|
-
);
|
|
300
|
-
expect(contract.aiUsageRules).toContain(
|
|
301
|
-
"Use Actions for local commands inside the current section when the command affects only the nearby entity or workflow step.",
|
|
302
|
-
);
|
|
303
|
-
expect(contract.aiUsageRules).toContain(
|
|
304
|
-
"Good Actions examples: Randomize palette, Normalize weights, Sort glyphs, Clear selection, Duplicate item, Reset current layer, Reset current stop, or Shuffle shades.",
|
|
305
|
-
);
|
|
306
|
-
expect(contract.aiUsageRules).toContain(
|
|
307
|
-
"Do not use Actions for final product delivery actions; use sticky panelActions for Export, Copy, Download, Generate, or Apply.",
|
|
308
|
-
);
|
|
309
|
-
expect(contract.aiUsageRules).toContain(
|
|
310
|
-
"Do not use Actions for animation transport; Play, Pause, Resume, Restart, and Scrub belong to the top timeline when timeline behavior exists.",
|
|
311
|
-
);
|
|
312
|
-
expect(contract.decisionCatalog?.layoutConstraints).toContain(
|
|
313
|
-
"Do not set an Actions control label to the exact same visible text as its only button; use a short one- or two-word context label such as Ink wash, Palette action, or Current layer while the button keeps the command verb.",
|
|
314
|
-
);
|
|
315
|
-
expect(contract.decisionCatalog?.layoutConstraints).toContain(
|
|
316
|
-
"Actions never use a side-label layout. If a visible label exists, it sits above the buttons.",
|
|
317
|
-
);
|
|
318
|
-
expect(contract.decisionCatalog?.layoutConstraints).toContain(
|
|
319
|
-
"Actions buttons render as a two-column grid. One visible button occupies the left half of the section; two buttons occupy one half each; more than two buttons wrap into additional 50% cells.",
|
|
320
|
-
);
|
|
321
|
-
expect(contract.decisionCatalog?.layoutConstraints).toContain(
|
|
322
|
-
"Do not center or right-align a partial final Actions row; an odd trailing button stays in the left 50% cell.",
|
|
323
|
-
);
|
|
324
|
-
expect(contract.aiUsageRules).toContain(
|
|
325
|
-
"For a single visible Actions button, the control label and button label must not be identical; make the control label a concise context and the button label the command.",
|
|
326
|
-
);
|
|
327
|
-
expect(contract.aiUsageRules).toContain(
|
|
328
|
-
"Render the Actions label above the buttons; do not put the label on the left with buttons on the right.",
|
|
329
|
-
);
|
|
330
|
-
expect(contract.aiUsageRules).toContain(
|
|
331
|
-
"Render Actions buttons in 50% cells: one button uses the left half, two buttons fill one row, and larger groups continue in two columns.",
|
|
332
|
-
);
|
|
333
|
-
expect(contract.aiUsageRules).toContain(
|
|
334
|
-
"Do not stretch an odd trailing Actions button full-width.",
|
|
335
|
-
);
|
|
336
|
-
expect(contract.aiUsageRules).toContain(
|
|
337
|
-
'For local reset-like actions, use product-specific values such as "reset-current-layer" or "reset-palette" and handle them through ToolcraftApp onPanelAction; do not use a bare "reset" value unless the action intentionally runs controls.reset.',
|
|
338
|
-
);
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
it("documents CollectionActions as canvas-backed add/remove controls", () => {
|
|
342
|
-
const contract = getToolcraftComponentContract("collectionActions");
|
|
343
|
-
|
|
344
|
-
expect(contract.stateMode).toBe("controlled");
|
|
345
|
-
expect(contract.decisionCatalog?.strictness).toBe("exact-owner");
|
|
346
|
-
expect(contract.decisionCatalog?.ownsValueModel).toContain(
|
|
347
|
-
"repeatable product entity collection",
|
|
348
|
-
);
|
|
349
|
-
expect(contract.decisionCatalog?.useWhen).toContain(
|
|
350
|
-
"Use CollectionActions instead of a count Slider when the user edits the actual set of items rather than only a numeric amount.",
|
|
351
|
-
);
|
|
352
|
-
expect(contract.decisionCatalog?.doNotReplaceWith).toContain(
|
|
353
|
-
"Do not use Slider to add or remove real collection items.",
|
|
354
|
-
);
|
|
355
|
-
expect(contract.decisionCatalog?.layoutConstraints).toContain(
|
|
356
|
-
"recommendedMaxItems is an agent/layout/performance hint, not a hard add limit; hardMaxItems is allowed only for real algorithm, format, API, export, or proven performance limits.",
|
|
357
|
-
);
|
|
358
|
-
expect(contract.decisionCatalog?.requiredAcceptance.join(" ")).toMatch(
|
|
359
|
-
/canvas preview and export/i,
|
|
360
|
-
);
|
|
361
|
-
expect(contract.aiUsageRules).toContain(
|
|
362
|
-
"Adding or removing collection items must update the runtime target array consumed by the renderer and export; do not add panel-only items.",
|
|
363
|
-
);
|
|
364
|
-
expect(contract.aiUsageRules).toContain(
|
|
365
|
-
"recommendedMaxItems is advisory only and must not disable the plus button. Use hardMaxItems only when a real product, algorithm, API, export, or measured performance limit requires it.",
|
|
366
|
-
);
|
|
367
|
-
expect(contract.aiUsageRules.join(" ")).toMatch(/TextInput/);
|
|
368
|
-
expect(contract.aiUsageRules.join(" ")).toMatch(/FontPicker/);
|
|
369
|
-
expect(contract.aiUsageRules).toContain(
|
|
370
|
-
"Use FontPicker as the collection item control when each repeated item is a typography/text-style entity; do not split its font, color, opacity, size, case, letter-spacing, or line-height into sibling collection fields.",
|
|
371
|
-
);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it("documents Palette as a constrained design-token color control", () => {
|
|
375
|
-
const contract = getToolcraftComponentContract("palette");
|
|
376
|
-
|
|
377
|
-
expect(contract.decisionCatalog?.ownsValueModel).toContain(
|
|
378
|
-
"style-guide color token",
|
|
379
|
-
);
|
|
380
|
-
expect(contract.decisionCatalog?.useWhen).toContain(
|
|
381
|
-
"Use Palette for token-based color choices such as brand palettes, Tailwind-like shade scales, semantic palette families, or style-guide colors.",
|
|
382
|
-
);
|
|
383
|
-
expect(contract.decisionCatalog?.doNotReplaceWith).toContain(
|
|
384
|
-
"Do not use Palette for gradients, free hex colors, text color inside FontPicker, or a color value that owns opacity.",
|
|
385
|
-
);
|
|
386
|
-
expect(contract.aiUsageRules).toContain(
|
|
387
|
-
"Use Palette only when the product value is a constrained design-token palette choice with both family and shade.",
|
|
388
|
-
);
|
|
389
|
-
expect(contract.aiUsageRules).toContain(
|
|
390
|
-
"Good Palette examples: brand palette family and shade, Tailwind-like token color, style-guide color scale, semantic palette family, or theme accent token.",
|
|
391
|
-
);
|
|
392
|
-
expect(contract.aiUsageRules).toContain(
|
|
393
|
-
"Do not use Palette for arbitrary free color picking; use Color instead.",
|
|
394
|
-
);
|
|
395
|
-
expect(contract.aiUsageRules).toContain(
|
|
396
|
-
"Do not use Palette when opacity belongs to the same color entity; use ColorOpacity instead.",
|
|
397
|
-
);
|
|
398
|
-
expect(contract.decisionCatalog?.requiredAcceptance).toContain(
|
|
399
|
-
"Prove Palette family and shade selections update runtime state immediately, before delayed persistence/commit settles.",
|
|
400
|
-
);
|
|
401
|
-
expect(contract.aiUsageRules).toContain(
|
|
402
|
-
"Palette is a live control like Color and Slider: family and shade changes must update runtime state immediately so the next canvas interaction uses the selected token without waiting for delayed commit or persistence timers.",
|
|
403
|
-
);
|
|
404
|
-
expect(contract.aiUsageRules).toContain(
|
|
405
|
-
"Do not use Palette for gradients or color transitions; use Gradient instead.",
|
|
406
|
-
);
|
|
407
|
-
expect(contract.aiUsageRules).toContain(
|
|
408
|
-
"Do not split typography color out to Palette when the text styling belongs to FontPicker.",
|
|
409
|
-
);
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
it("keeps toolbar and controls panels behind PanelHost with their snap defaults", () => {
|
|
413
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.requiredWrapper).toBe("PanelHost");
|
|
414
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.defaultPlacement).toBe("bottom");
|
|
415
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.snapEdges).toEqual(["top", "bottom"]);
|
|
416
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.capabilities).toContain(
|
|
417
|
-
"keyboardShortcuts",
|
|
418
|
-
);
|
|
419
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.aiUsageRules).toContain(
|
|
420
|
-
"Toolbar history owns Undo and Redo buttons plus runtime keyboard shortcuts.",
|
|
421
|
-
);
|
|
422
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.aiUsageRules).toContain(
|
|
423
|
-
"Do not add app-level Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z, or Ctrl+Y listeners; use toolbar history and runtime commands.",
|
|
424
|
-
);
|
|
425
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.toolbar.aiUsageRules).toContain(
|
|
426
|
-
"Undo/redo keyboard shortcuts must not fire while the user is typing into inputs, textareas, selects, or contentEditable value labels.",
|
|
427
|
-
);
|
|
428
|
-
|
|
429
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.controlsPanel.requiredWrapper).toBe("PanelHost");
|
|
430
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.controlsPanel.defaultPlacement).toBe("right");
|
|
431
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.controlsPanel.snapEdges).toEqual(["left", "right"]);
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
it("preserves canvas runtime commands and patch history", () => {
|
|
435
|
-
const contract = getToolcraftComponentContract("canvas");
|
|
436
|
-
|
|
437
|
-
expect(contract.kind).toBe("canvas");
|
|
438
|
-
expect(contract.stateMode).toBe("runtime-owned");
|
|
439
|
-
expect(contract.historyPolicy).toBe("patch");
|
|
440
|
-
expect(contract.visualComponent).toBe("CanvasShell");
|
|
441
|
-
expect(contract.commands).toContain("canvas.setSize");
|
|
442
|
-
expect(contract.commands).toContain("canvas.panBy");
|
|
443
|
-
expect(contract.commands).toContain("canvas.setOffset");
|
|
444
|
-
expect(contract.commands).toContain("media.import");
|
|
445
|
-
expect(contract.commands).toContain("media.transform");
|
|
446
|
-
expect(contract.capabilities).toContain("editable-size");
|
|
447
|
-
expect(contract.aiUsageRules).toContain(
|
|
448
|
-
"Do not let canvas.upload choose intrinsic-media by default. Upload without explicit sizing resolves to editable-output so source/background images do not own product output size.",
|
|
449
|
-
);
|
|
450
|
-
expect(contract.aiUsageRules).toContain(
|
|
451
|
-
"Use intrinsic-media only for true media-viewer or source-native apps where the natural uploaded/generated media size is the product output; record the reason and prove it with intrinsic-media-size acceptance.",
|
|
452
|
-
);
|
|
453
|
-
expect(contract.aiUsageRules).toContain(
|
|
454
|
-
"Use editable-output for generated, exportable, shader, poster, badge, wall, banner, thumbnail, procedural, reference-clone, and product-output apps so users always see Aspect ratio, Canvas width, and Canvas height.",
|
|
455
|
-
);
|
|
456
|
-
expect(contract.aiUsageRules).toContain(
|
|
457
|
-
"When an uploaded image is a background/source inside the product canvas, keep the current canvas.size, keep Setup/canvas controls visible, and render the image as cover/crop inside the current canvas bounds without letterbox or aspect distortion.",
|
|
458
|
-
);
|
|
459
|
-
expect(contract.aiUsageRules).toContain(
|
|
460
|
-
"A user-provided, reference, fixed-format, or base/default size is not a reason to remove size controls; model it as canvas.size plus editable-output so the size is an initial value, not a hidden lock.",
|
|
461
|
-
);
|
|
462
|
-
expect(contract.aiUsageRules).toContain(
|
|
463
|
-
"Do not use fixed-output for generated product/output apps with export actions. Reserve fixed-output for non-product internal fixtures where width and height truly must never be user-editable, and prove that lock with canvasSizingCoverage fixed-output-size acceptance.",
|
|
464
|
-
);
|
|
465
|
-
expect(contract.aiUsageRules).toContain(
|
|
466
|
-
"A reference or previous app lacking a size editor, or defining a fixed-size baseline, is not a fixed-output reason for a generated product app; product-output clones still use editable-output.",
|
|
467
|
-
);
|
|
468
|
-
expect(contract.aiUsageRules).toContain(
|
|
469
|
-
"Resolved canvas.size exists for every canvas app, but visible Canvas width and Canvas height controls are mandatory only for editable-output sizing and live in the mandatory runtime Setup section.",
|
|
470
|
-
);
|
|
471
|
-
expect(contract.aiUsageRules).toContain(
|
|
472
|
-
"If canvas.size is provided without an explicit sizing mode, defineToolcraft treats it as editable-output and adds Canvas width and Canvas height controls.",
|
|
473
|
-
);
|
|
474
|
-
expect(contract.aiUsageRules).toContain(
|
|
475
|
-
"The runtime Canvas width and Canvas height block uses the mandatory headerless Setup controls block; do not add a separate Canvas section label above these fields.",
|
|
476
|
-
);
|
|
477
|
-
expect(contract.aiUsageRules).toContain(
|
|
478
|
-
"When the user manually edits Canvas width or Canvas height, the runtime keeps the typed dimension, keeps the other dimension unchanged, switches Aspect ratio to Custom, and shows the reduced current ratio in the custom ratio inputs.",
|
|
479
|
-
);
|
|
480
|
-
expect(contract.aiUsageRules).toContain(
|
|
481
|
-
"Aspect ratio presets are the only interaction that may resize both canvas dimensions from a preset; manual size inputs are exact output dimensions.",
|
|
482
|
-
);
|
|
483
|
-
expect(contract.aiUsageRules).toContain(
|
|
484
|
-
"For non-vector raster, Canvas 2D, WebGL, and WebGPU previews, set canvas.renderScale: true so the runtime adds Resolution scale after canvas sizing. The scale changes backing pixels from 1 to 2 without changing visible canvas size, and adding/enabling it requires targeted browser evidence that the canvas stays responsive at the selected scale.",
|
|
485
|
-
);
|
|
486
|
-
expect(contract.aiUsageRules).toContain(
|
|
487
|
-
"After enabling canvas.renderScale, verify that canvas preview stays responsive while dragging sliders and other high-frequency controls at the selected scale.",
|
|
488
|
-
);
|
|
489
|
-
expect(contract.aiUsageRules).toContain(
|
|
490
|
-
"Performance fixes for canvas.renderScale must preserve the selected visual quality; do not silently downsample, stretch a lower-resolution backing canvas, blur output, or clamp canvas.renderScale below the user's chosen value to pass budgets.",
|
|
491
|
-
);
|
|
492
|
-
expect(contract.aiUsageRules).toContain(
|
|
493
|
-
"Do not enable canvas.renderScale for DOM/SVG/vector-native previews; preserve vector fidelity through native vector rendering instead of raster supersampling.",
|
|
494
|
-
);
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
it("documents persistence as a runtime-owned policy instead of ad hoc localStorage", () => {
|
|
498
|
-
const contract = getToolcraftComponentContract("persistence");
|
|
499
|
-
|
|
500
|
-
expect(contract.kind).toBe("persistence");
|
|
501
|
-
expect(contract.stateMode).toBe("runtime-owned");
|
|
502
|
-
expect(contract.historyPolicy).toBe("never");
|
|
503
|
-
expect(contract.aiUsageRules).toContain("Do not write app state to localStorage directly.");
|
|
504
|
-
expect(contract.aiUsageRules).toContain(
|
|
505
|
-
"Use schema persistence policy for app state that should survive reload.",
|
|
506
|
-
);
|
|
507
|
-
expect(contract.aiUsageRules).toContain(
|
|
508
|
-
"Persistence may include values, canvas, panels, timeline, layers, and media; history is not persisted.",
|
|
509
|
-
);
|
|
510
|
-
expect(contract.aiUsageRules).toContain(
|
|
511
|
-
"Use persistence include: [\"media\"] only when runtime media state must survive reload, such as predefined attached files that users can delete, reorder, or transform. Do not use ad hoc storage for media state.",
|
|
512
|
-
);
|
|
513
|
-
expect(contract.aiUsageRules).toContain(
|
|
514
|
-
'Apps with visible runtime panels and localStorage persistence must include "panels" so dragged panel positions survive reload.',
|
|
515
|
-
);
|
|
516
|
-
expect(contract.aiUsageRules).toContain(
|
|
517
|
-
'Apps with localStorage persistence must include acceptance coverage for changing a user setting, reloading the browser page, and seeing the restored value or product output.',
|
|
518
|
-
);
|
|
519
|
-
expect(contract.aiUsageRules).toContain(
|
|
520
|
-
"Settings import/export is a mandatory runtime preset transfer feature; it must not be used to hide or replace broken persistence reload behavior.",
|
|
521
|
-
);
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
it("documents settings transfer as a mandatory runtime-owned feature", () => {
|
|
525
|
-
const contract = getToolcraftComponentContract("settingsTransfer");
|
|
526
|
-
|
|
527
|
-
expect(contract.kind).toBe("settings");
|
|
528
|
-
expect(contract.stateMode).toBe("runtime-owned");
|
|
529
|
-
expect(contract.aiUsageRules).toContain(
|
|
530
|
-
"Generated apps keep a controls panel so runtime Setup is visible from the first run; product controls are added after that mandatory runtime section.",
|
|
531
|
-
);
|
|
532
|
-
expect(contract.aiUsageRules).toContain(
|
|
533
|
-
"Do not gate Export Settings / Import Settings behind complexity thresholds, app size, or prompt wording.",
|
|
534
|
-
);
|
|
535
|
-
expect(contract.aiUsageRules).toContain(
|
|
536
|
-
"Do not hand-roll settings import/export through app routes, hidden file inputs, or panelActions.",
|
|
537
|
-
);
|
|
538
|
-
expect(contract.aiUsageRules).toContain(
|
|
539
|
-
"Settings transfer appears in the first visible headerless Setup controls-panel block; it imports and exports control values, canvas size, and timeline state.",
|
|
540
|
-
);
|
|
541
|
-
expect(contract.aiUsageRules).toContain(
|
|
542
|
-
"App-authored sections must not declare runtime Setup targets such as runtime.settingsTransfer, canvas.aspectRatio, canvas.size.width, canvas.size.height, canvas.renderScale, or panels.timeline.extended; those controls never suppress the mandatory runtime Setup controls.",
|
|
543
|
-
);
|
|
544
|
-
expect(contract.aiUsageRules).toContain(
|
|
545
|
-
"When editable-output canvas sizing is enabled, the first visible Setup runtime section contains Export Settings, Import Settings, Aspect ratio, Canvas width, Canvas height, and optional Resolution scale in that order.",
|
|
546
|
-
);
|
|
547
|
-
expect(contract.aiUsageRules).toContain(
|
|
548
|
-
"When panels.timeline is enabled, Setup appends the Timeline switch as the last control; when panels.timeline is omitted, the Timeline switch must not appear.",
|
|
549
|
-
);
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
it("documents slider visual variants as explicit schema choices", () => {
|
|
553
|
-
const slider = getToolcraftComponentContract("slider");
|
|
554
|
-
const rangeSlider = getToolcraftComponentContract("rangeSlider");
|
|
555
|
-
|
|
556
|
-
expect(slider.decisionCatalog.requiredAcceptance).toContain(
|
|
557
|
-
"Prove dragging the slider changes product output or the intended runtime side effect while the drag is in progress, not only after pointer release, blur, Apply, or a final commit.",
|
|
558
|
-
);
|
|
559
|
-
expect(slider.aiUsageRules).toContain(
|
|
560
|
-
"Sliders are live canvas controls: dragging must update runtime state and product output in real time by default.",
|
|
561
|
-
);
|
|
562
|
-
expect(slider.aiUsageRules).toContain(
|
|
563
|
-
"Do not implement slider values as deferred local drafts, Apply-only updates, pointer-up-only commits, or renderer changes that appear only after the user asks again.",
|
|
564
|
-
);
|
|
565
|
-
expect(slider.aiUsageRules).toContain(
|
|
566
|
-
"Slider performance coverage must use a real control-drag scenario; control-change coverage is not enough to prove live canvas feedback or drag smoothness.",
|
|
567
|
-
);
|
|
568
|
-
expect(slider.aiUsageRules).toContain(
|
|
569
|
-
"If a live slider causes jank, optimize the renderer path first: update uniforms or stable buffers, cache expensive inputs, coalesce preview work to requestAnimationFrame, cancel stale async renders, move heavy work off React, or switch renderer strategy.",
|
|
570
|
-
);
|
|
571
|
-
expect(slider.aiUsageRules).toContain(
|
|
572
|
-
"Only in an extreme documented performance ceiling may a slider use a degraded live preview or delayed heavy refinement; the user must still see immediate canvas feedback while dragging and the worklog must record the measured reason.",
|
|
573
|
-
);
|
|
574
|
-
expect(slider.aiUsageRules).toContain(
|
|
575
|
-
"Slider step means numeric snapping only; it does not make the slider visually discrete by itself.",
|
|
576
|
-
);
|
|
577
|
-
expect(slider.aiUsageRules).toContain(
|
|
578
|
-
"Classify every stepped slider as stepped continuous or visual discrete before writing the schema.",
|
|
579
|
-
);
|
|
580
|
-
expect(slider.aiUsageRules).toContain(
|
|
581
|
-
'Small semantic integer domains such as rows, cols, gaps, jitter, counts, levels, bands, passes, points, tiles, and segments must use variant: "discrete".',
|
|
582
|
-
);
|
|
583
|
-
expect(slider.aiUsageRules).toContain(
|
|
584
|
-
'Finite animation step domains such as flip depth, character count, glyph steps, and frame steps must use variant: "discrete" when the marker count stays within the Toolcraft visual budget.',
|
|
585
|
-
);
|
|
586
|
-
expect(slider.aiUsageRules).toContain(
|
|
587
|
-
"Large or precision stepped ranges such as speed, FPS, rate, duration, density, size, and intensity stay visually continuous even when they declare step.",
|
|
588
|
-
);
|
|
589
|
-
expect(slider.aiUsageRules).toContain(
|
|
590
|
-
"Use slider unit only for real measurement suffixes such as %, px, °, s, ms, fps, rows/cols, or similar domain units.",
|
|
591
|
-
);
|
|
592
|
-
expect(slider.aiUsageRules).toContain(
|
|
593
|
-
"Do not use unit for repeated entity nouns already named by the section or label, such as Letters + letters, Shape Density / Count + shapes, Words + words, Symbols + symbols, Items + items, Particles + particles, or Layers + layers.",
|
|
594
|
-
);
|
|
595
|
-
expect(slider.aiUsageRules).toContain(
|
|
596
|
-
'Do not use unit: "x"; scale, multiplier, intensity, opacity, strength, depth, and shader amount sliders display plain numbers unless a real measurement unit applies.',
|
|
597
|
-
);
|
|
598
|
-
expect(slider.aiUsageRules).toContain(
|
|
599
|
-
"When the value needs an entity noun to make sense, improve the label or section title instead of appending that noun as the value unit.",
|
|
600
|
-
);
|
|
601
|
-
expect(slider.aiUsageRules).toContain(
|
|
602
|
-
"Compact symbol/CSS units render tight, such as 70%, 24px, and 8s; word units render with a space, such as 5 cols, when they are truly needed.",
|
|
603
|
-
);
|
|
604
|
-
expect(slider.aiUsageRules).toContain(
|
|
605
|
-
"Slider valueLabel is editable only when it contains a numeric value; textual state labels such as Normal are display-only and must not expose hover or click editing affordances.",
|
|
606
|
-
);
|
|
607
|
-
expect(slider.aiUsageRules).toContain(
|
|
608
|
-
"Schema sliders render stacked at full width; do not put sliders in two-column inline layout groups.",
|
|
609
|
-
);
|
|
610
|
-
expect(slider.aiUsageRules).toContain(
|
|
611
|
-
"The fontPicker component is the only built-in exception with two internal footer sliders for letter spacing and line height.",
|
|
612
|
-
);
|
|
613
|
-
expect(slider.aiUsageRules).toContain(
|
|
614
|
-
'Browser verification can inspect [data-slot="slider"][data-variant="discrete"] plus slider markers to prove the Toolcraft component variant rendered.',
|
|
615
|
-
);
|
|
616
|
-
expect(slider.aiUsageRules).toContain(
|
|
617
|
-
"Visual discrete sliders must still drag smoothly; browser performance tests should use expectToolcraftDiscreteSliderDragSmoothness for real pointer drag.",
|
|
618
|
-
);
|
|
619
|
-
expect(slider.aiUsageRules).toContain(
|
|
620
|
-
"Use visibleWhen for sliders that are meaningful only in some mode/type/source/include/count states; inactive branches should disappear so the panel shows only controls usable in the current state.",
|
|
621
|
-
);
|
|
622
|
-
expect(slider.aiUsageRules).toContain(
|
|
623
|
-
"Do not use schema disabled: true or disabledWhen for product sliders; product panels should show only controls usable in the current state. Use visibleWhen for unavailable product states instead of rendering disabled controls.",
|
|
624
|
-
);
|
|
625
|
-
expect(slider.aiUsageRules).toContain(
|
|
626
|
-
"Do not leave an inactive conditional slider visible while making the renderer ignore it; hide it with visibleWhen.",
|
|
627
|
-
);
|
|
628
|
-
expect(rangeSlider.decisionCatalog.requiredAcceptance).toContain(
|
|
629
|
-
"Prove dragging rangeSlider.lower and rangeSlider.upper both affect product output while the drag is in progress, not only after pointer release, blur, Apply, or a final commit.",
|
|
630
|
-
);
|
|
631
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
632
|
-
"Range sliders are live canvas controls: dragging either thumb must update runtime state and product output in real time by default.",
|
|
633
|
-
);
|
|
634
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
635
|
-
"Do not implement range slider values as deferred local drafts, Apply-only updates, pointer-up-only commits, or renderer changes that appear only after the user asks again.",
|
|
636
|
-
);
|
|
637
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
638
|
-
"Range slider performance coverage must use a real control-drag scenario; control-change coverage is not enough to prove live canvas feedback or drag smoothness.",
|
|
639
|
-
);
|
|
640
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
641
|
-
"If a live range slider causes jank, optimize the renderer path first: update uniforms or stable buffers, cache expensive inputs, coalesce preview work to requestAnimationFrame, cancel stale async renders, move heavy work off React, or switch renderer strategy.",
|
|
642
|
-
);
|
|
643
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
644
|
-
"Only in an extreme documented performance ceiling may a range slider use a degraded live preview or delayed heavy refinement; the user must still see immediate canvas feedback while dragging and the worklog must record the measured reason.",
|
|
645
|
-
);
|
|
646
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
647
|
-
"Range slider step means numeric snapping only; it does not make the range slider visually discrete by itself.",
|
|
648
|
-
);
|
|
649
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
650
|
-
"Classify every stepped range slider as stepped continuous or visual discrete before writing the schema.",
|
|
651
|
-
);
|
|
652
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
653
|
-
'Small semantic integer domains such as rows, cols, gaps, jitter, counts, levels, bands, passes, points, tiles, and segments must use variant: "discrete".',
|
|
654
|
-
);
|
|
655
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
656
|
-
'Finite animation step domains such as flip depth, character count, glyph steps, and frame steps must use variant: "discrete" when the marker count stays within the Toolcraft visual budget.',
|
|
657
|
-
);
|
|
658
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
659
|
-
"Large or precision stepped ranges such as speed, FPS, rate, duration, density, size, and intensity stay visually continuous even when they declare step.",
|
|
660
|
-
);
|
|
661
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
662
|
-
"Use rangeSlider unit only for real measurement suffixes; do not use it for repeated entity nouns already named by the section or label, and do not use x as a unit.",
|
|
663
|
-
);
|
|
664
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
665
|
-
"When a range label needs an entity noun to make sense, improve the label or section title instead of appending that noun as the value unit.",
|
|
666
|
-
);
|
|
667
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
668
|
-
"Compact symbol/CSS units render tight, such as 20% – 80% or 12px – 48px; word units render with a space when truly needed.",
|
|
669
|
-
);
|
|
670
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
671
|
-
"RangeSlider is always a full-width two-thumb control; never place it in an inline two-column layout group with another slider or range slider.",
|
|
672
|
-
);
|
|
673
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
674
|
-
"RangeSlider defaultValue must start with different lower and upper values so the two-thumb control does not collapse into a single-value slider.",
|
|
675
|
-
);
|
|
676
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
677
|
-
"Manual range value editing accepts common separators such as slash, hyphen, spaces, and dashes, including when values include unit suffixes such as 30%-150% or 30% - 90%; do not create custom parsers for RangeSlider labels.",
|
|
678
|
-
);
|
|
679
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
680
|
-
"Visual discrete sliders must still drag smoothly; browser performance tests should use expectToolcraftDiscreteSliderDragSmoothness for real pointer drag.",
|
|
681
|
-
);
|
|
682
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
683
|
-
"Use visibleWhen for range sliders that are meaningful only in some mode/type/source/include/count states; inactive branches should disappear so the panel shows only controls usable in the current state.",
|
|
684
|
-
);
|
|
685
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
686
|
-
"Do not use schema disabled: true or disabledWhen for product range sliders; product panels should show only controls usable in the current state. Use visibleWhen for unavailable product states instead of rendering disabled controls.",
|
|
687
|
-
);
|
|
688
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
689
|
-
"Do not leave an inactive conditional range slider visible while making the renderer ignore it; hide it with visibleWhen.",
|
|
690
|
-
);
|
|
691
|
-
expect(rangeSlider.aiUsageRules).toContain(
|
|
692
|
-
"Acceptance must prove both rangeSlider.lower and rangeSlider.upper change the product output; testing one handle is not enough.",
|
|
693
|
-
);
|
|
694
|
-
});
|
|
695
|
-
|
|
696
|
-
it("documents compound control part coverage requirements", () => {
|
|
697
|
-
const color = getToolcraftComponentContract("color");
|
|
698
|
-
const colorOpacity = getToolcraftComponentContract("colorOpacity");
|
|
699
|
-
const gradient = getToolcraftComponentContract("gradient");
|
|
700
|
-
const fontPicker = getToolcraftComponentContract("fontPicker");
|
|
701
|
-
const rangeInput = getToolcraftComponentContract("rangeInput");
|
|
702
|
-
const palette = getToolcraftComponentContract("palette");
|
|
703
|
-
const curves = getToolcraftComponentContract("curves");
|
|
704
|
-
const anchorGrid = getToolcraftComponentContract("anchorGrid");
|
|
705
|
-
const channelMixer = getToolcraftComponentContract("channelMixer");
|
|
706
|
-
const appEntityAcceptance = getToolcraftComponentContract("appEntityAcceptance");
|
|
707
|
-
|
|
708
|
-
expect(color.aiUsageRules).toContain(
|
|
709
|
-
"Product-output apps always expose renderer-owned output background color as a schema color target such as appearance.background or scene.background.",
|
|
710
|
-
);
|
|
711
|
-
expect(color.aiUsageRules).toContain(
|
|
712
|
-
'Pair renderer-owned output background color with export.includeBackground in one Background section directly before export settings. Use an equal-width inline row with the export.includeBackground Switch labeled "Include" on the left and the background Color parameter with label false on the right; each control occupies one half of the row.',
|
|
713
|
-
);
|
|
714
|
-
expect(color.aiUsageRules).toContain(
|
|
715
|
-
"Preview, PNG export, and video export must read the runtime background color value instead of hardcoding that background in CSS, Canvas fillStyle, or WebGL clearColor. export.includeBackground controls live preview product background and PNG alpha; it must not make the Toolcraft canvas shell/backing or video output transparent.",
|
|
716
|
-
);
|
|
717
|
-
expect(color.aiUsageRules).toContain(
|
|
718
|
-
"When one short numeric/text field and one Color field configure the same entity, keep them in one two-column inline layout group.",
|
|
719
|
-
);
|
|
720
|
-
expect(color.aiUsageRules).toContain(
|
|
721
|
-
'Mixed inline rows usually require visible labels on both controls. Toggle-plus-parameter rows are the section-owned exception: keep the Switch/Checkbox label visible and set the non-toggle parameter label to false; if the parameter label is needed, stack the controls instead. All 50/50 inline rows use the same horizontal column gap as paired Select controls. The required Background row uses the Switch label "Include" and sets the background Color control label to false. Palette variation color banks are the other exception when the group/section label already names the color bank.',
|
|
722
|
-
);
|
|
723
|
-
expect(color.aiUsageRules).toContain(
|
|
724
|
-
"Plain Color popovers must not show opacity controls. If opacity is editable, use ColorOpacity instead.",
|
|
725
|
-
);
|
|
726
|
-
expect(color.aiUsageRules).toContain(
|
|
727
|
-
"Decide color label visibility from the user's point of view. Omit labels for color banks that only add palette variety, such as Accent Shades, Bead Colors, or palette.accent1..5.",
|
|
728
|
-
);
|
|
729
|
-
expect(color.aiUsageRules).toContain(
|
|
730
|
-
"Make color label visibility a group-level decision: do not mix labeled and unlabeled items inside one semantic color bank.",
|
|
731
|
-
);
|
|
732
|
-
expect(color.aiUsageRules).toContain(
|
|
733
|
-
"Keep visible labels when colors edit distinct user-facing entities or roles, such as Fill, Stroke, Background, Connector, Object, or Highlight.",
|
|
734
|
-
);
|
|
735
|
-
expect(color.aiUsageRules).toContain(
|
|
736
|
-
"A color bank can share a section with distribution controls such as Spread, Mix, or Randomness and still keep each color item unlabeled when the section title names the palette context.",
|
|
737
|
-
);
|
|
738
|
-
expect(color.aiUsageRules).toContain(
|
|
739
|
-
"If a multi-color bank has an odd trailing plain Color, keep that last Color at half width; only ColorOpacity or intentionally full-width compound controls occupy a full row.",
|
|
740
|
-
);
|
|
741
|
-
expect(gradient.aiUsageRules).toContain(
|
|
742
|
-
"Gradient is a compound control; acceptance must prove gradient.gradientType, gradient.angle, gradient.stops.position, gradient.stops.color, and gradient.stops.opacity all affect the product output when visible.",
|
|
743
|
-
);
|
|
744
|
-
expect(gradient.aiUsageRules).toContain(
|
|
745
|
-
"Keep Gradient type/angle, draggable stop track, and Stops list inside the built-in Gradient control. The full Gradient control is visually separated with content-width dividers only when it shares a section with sibling controls; do not put dividers only around the Stops list and do not rebuild it as separate schema controls.",
|
|
746
|
-
);
|
|
747
|
-
expect(gradient.aiUsageRules).toContain(
|
|
748
|
-
"If the renderer intentionally supports only a subset of gradient behavior, do not use the full Gradient control; use simpler controls that match the renderer behavior.",
|
|
749
|
-
);
|
|
750
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
751
|
-
"FontPicker owns the font preview select, virtualized font popup, category filters, search, preview loading, font-weight select, font-size input, text-case select, text color/opacity control, letter-spacing slider, and line-height slider.",
|
|
752
|
-
);
|
|
753
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
754
|
-
'Do not recreate FontPicker with a plain Select plus separate sliders; use type: "fontPicker" so the popup mechanics and footer controls stay intact.',
|
|
755
|
-
);
|
|
756
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
757
|
-
"FontPicker standard/default text color is #FFFFFF with opacity 100; omit color/opacity or use those values unless the prompt or reference explicitly requires a different initial text color.",
|
|
758
|
-
);
|
|
759
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
760
|
-
"Any product text controlled by FontPicker must render fontId, fontWeight, fontSize, letterSpacing, lineHeight, textCase, color, and opacity in preview and export; do not leave typography values as panel-only runtime state.",
|
|
761
|
-
);
|
|
762
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
763
|
-
"FontPicker is an atomic compound typography control. Do not split any owned typography part into a neighboring schema control for the same product text entity.",
|
|
764
|
-
);
|
|
765
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
766
|
-
"FontPicker is a compound control; acceptance must prove fontPicker.fontId, fontPicker.fontWeight, fontPicker.fontSize, fontPicker.letterSpacing, fontPicker.lineHeight, fontPicker.textCase, fontPicker.color, and fontPicker.opacity all affect the product output.",
|
|
767
|
-
);
|
|
768
|
-
expect(fontPicker.aiUsageRules).toContain(
|
|
769
|
-
"FontPicker acceptance must inspect the actual product text output after changing font, weight, size, letter spacing, line height, text case, color, and opacity; runtime state, select labels, or popup preview text alone are not enough.",
|
|
770
|
-
);
|
|
771
|
-
expect(colorOpacity.aiUsageRules).toContain(
|
|
772
|
-
'Do not split ColorOpacity into a separate Color plus Slider/Input for opacity; use type: "colorOpacity" so the color popover and percent input stay visually connected.',
|
|
773
|
-
);
|
|
774
|
-
expect(colorOpacity.aiUsageRules).toContain(
|
|
775
|
-
"ColorOpacity is the only color control variant that may expose opacity in the color picker popover; plain Color popovers hide opacity controls.",
|
|
776
|
-
);
|
|
777
|
-
expect(colorOpacity.aiUsageRules).toContain(
|
|
778
|
-
"Do not place ColorOpacity in inline two-column layout groups. If either color control has opacity, keep the controls stacked.",
|
|
779
|
-
);
|
|
780
|
-
expect(colorOpacity.aiUsageRules).toContain(
|
|
781
|
-
"Only plain Color controls without opacity may render in two-column color rows.",
|
|
782
|
-
);
|
|
783
|
-
expect(colorOpacity.aiUsageRules).toContain(
|
|
784
|
-
"Acceptance must prove colorOpacity.hex and colorOpacity.opacity both affect the product output; testing only the swatch or only runtime state is not enough.",
|
|
785
|
-
);
|
|
786
|
-
expect(rangeInput.aiUsageRules).toContain(
|
|
787
|
-
"RangeInput is a compound control; acceptance must prove rangeInput.start and rangeInput.end both affect the product output.",
|
|
788
|
-
);
|
|
789
|
-
expect(palette.aiUsageRules).toContain(
|
|
790
|
-
"Palette is a compound control; acceptance must prove palette.family and palette.shade both affect the product output.",
|
|
791
|
-
);
|
|
792
|
-
expect(curves.aiUsageRules).toContain(
|
|
793
|
-
'Use Curves for editable remapping curves. RGB/R/G/B tabs are only for color-correction or channel-specific curves; use variant: "single" for one standalone curve without channel tabs.',
|
|
794
|
-
);
|
|
795
|
-
expect(curves.aiUsageRules).toContain(
|
|
796
|
-
'Use variant: "single" for a single acceleration, bend, easing, opacity, response, depth, mask, threshold, tone-response, or mapping curve. Do not create a custom curve UI just to remove RGB tabs.',
|
|
797
|
-
);
|
|
798
|
-
expect(curves.aiUsageRules).toContain(
|
|
799
|
-
"RGB Curves is a color-correction-specific case; do not force RGB/R/G/B tabs onto products that need only one response, bend, depth, or easing curve.",
|
|
800
|
-
);
|
|
801
|
-
expect(curves.aiUsageRules).toContain(
|
|
802
|
-
'Use interpolation: "smooth" for photo/editor-like visual tone, color, and RGB curves where the curve should feel like a creative editor spline.',
|
|
803
|
-
);
|
|
804
|
-
expect(curves.aiUsageRules).toContain(
|
|
805
|
-
'Use interpolation: "monotone" for depth, response, mask, opacity, threshold, and data-mapping curves where order must be preserved and overshoot is unsafe. Single curves default to monotone unless smooth is explicitly requested.',
|
|
806
|
-
);
|
|
807
|
-
expect(curves.aiUsageRules).toContain(
|
|
808
|
-
"Single Curves is one labeled control without internal dividers; RGB Curves is the compound variant with channel tabs and section dividers when mixed with sibling controls.",
|
|
809
|
-
);
|
|
810
|
-
expect(curves.aiUsageRules).toContain(
|
|
811
|
-
"RGB curves acceptance must prove curves.activeChannel and curves.points both affect the product output. Single curves acceptance proves curves.points.",
|
|
812
|
-
);
|
|
813
|
-
expect(curves.aiUsageRules).toContain(
|
|
814
|
-
"Curves acceptance should include an off-center control point near an edge so smooth-vs-monotone interpolation mistakes are visible in product output.",
|
|
815
|
-
);
|
|
816
|
-
expect(anchorGrid.aiUsageRules).toContain(
|
|
817
|
-
"AnchorGrid is a position selector; acceptance must prove anchorGrid.position changes product placement, not only selected button state.",
|
|
818
|
-
);
|
|
819
|
-
expect(anchorGrid.decisionCatalog?.acceptableAlternatives).toContain(
|
|
820
|
-
"Use Vector only for stable direct-authored continuous position or direction parameters.",
|
|
821
|
-
);
|
|
822
|
-
expect(channelMixer.aiUsageRules).toContain(
|
|
823
|
-
"ChannelMixer is RGB-specific: it renders R/G/B tabs and Red, Green, Blue sliders for an RGB channel matrix.",
|
|
824
|
-
);
|
|
825
|
-
expect(channelMixer.aiUsageRules).toContain(
|
|
826
|
-
"Use ChannelMixer only for RGB channel mixing, channel swapping, or color-correction matrix behavior; do not use it for arbitrary channel lists.",
|
|
827
|
-
);
|
|
828
|
-
expect(channelMixer.decisionCatalog?.useWhen.join(" ")).toMatch(
|
|
829
|
-
/RGB channel mixing/i,
|
|
830
|
-
);
|
|
831
|
-
expect(channelMixer.decisionCatalog?.doNotReplaceWith?.join(" ")).toMatch(
|
|
832
|
-
/arbitrary non-RGB channels/i,
|
|
833
|
-
);
|
|
834
|
-
expect(channelMixer.aiUsageRules).toContain(
|
|
835
|
-
"ChannelMixer is a compound control; acceptance must prove channelMixer.activeChannel and channelMixer.values both affect the product output.",
|
|
836
|
-
);
|
|
837
|
-
expect(appEntityAcceptance.aiUsageRules).toContain(
|
|
838
|
-
"Compound controls must declare controlPartCoverage for every semantic value part required by their control type.",
|
|
839
|
-
);
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
it("documents segmented controls as compact selector-only choices", () => {
|
|
843
|
-
const segmented = getToolcraftComponentContract("segmented");
|
|
844
|
-
|
|
845
|
-
expect(segmented.aiUsageRules).toContain(
|
|
846
|
-
"Use Segmented only for compact mode choices where every cell keeps its internal padding.",
|
|
847
|
-
);
|
|
848
|
-
expect(segmented.aiUsageRules).toContain(
|
|
849
|
-
"If a segmented control is too wide, first shorten option labels; if the compact labels still exceed the width budget, use Select because it has the same selection mechanics without broken cells.",
|
|
850
|
-
);
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
it("documents app entity acceptance as product-output verification", () => {
|
|
854
|
-
const contract = getToolcraftComponentContract("appEntityAcceptance");
|
|
855
|
-
|
|
856
|
-
expect(contract.kind).toBe("composition");
|
|
857
|
-
expect(contract.stateMode).toBe("runtime-owned");
|
|
858
|
-
expect(contract.capabilities).toContain("product-output-verification");
|
|
859
|
-
expect(contract.aiUsageRules).toContain(
|
|
860
|
-
"Every app entity introduced by the AI must have an acceptance test that proves its product responsibility.",
|
|
861
|
-
);
|
|
862
|
-
expect(contract.aiUsageRules).toContain(
|
|
863
|
-
"Any supplied video, GIF, screen-recording, contact-sheet, or extracted-frame reference requires a Video Reference Study before implementation: storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping. Do not implement video references from a single screenshot or high-level summary.",
|
|
864
|
-
);
|
|
865
|
-
expect(contract.aiUsageRules).toContain(
|
|
866
|
-
"Compound control browser tests must explicitly exercise each required value part, not only one visible sub-control.",
|
|
867
|
-
);
|
|
868
|
-
expect(contract.aiUsageRules).toContain(
|
|
869
|
-
"Acceptance tests must fail when an entity is disconnected from runtime state, renderer output, export output, or command side effects.",
|
|
870
|
-
);
|
|
871
|
-
expect(contract.aiUsageRules).toContain(
|
|
872
|
-
"Do not accept typecheck, component existence, registered commands, runtime state mutation, renderer input objects, shader uniform presence, or signature strings as final proof.",
|
|
873
|
-
);
|
|
874
|
-
expect(contract.aiUsageRules).toContain(
|
|
875
|
-
"A generic canvas hash difference is not enough for workload or semantic controls; assert the intended direction of the effect.",
|
|
876
|
-
);
|
|
877
|
-
expect(contract.aiUsageRules).toContain(
|
|
878
|
-
"Component variants are accepted entities too; tests should fail if a non-default Toolcraft control variant falls back to the default variant or custom markup.",
|
|
879
|
-
);
|
|
880
|
-
expect(contract.aiUsageRules).toContain(
|
|
881
|
-
"Conditional entities require fixtures that make the condition observable.",
|
|
882
|
-
);
|
|
883
|
-
expect(contract.aiUsageRules).toContain(
|
|
884
|
-
"Use visibleWhen for mode-, type-, source-, include-, variant-, or count-exclusive sections or controls that do not belong to the current selected state.",
|
|
885
|
-
);
|
|
886
|
-
expect(contract.aiUsageRules).toContain(
|
|
887
|
-
"When a count/quantity control determines how many sibling controls are available, hide unavailable siblings with visibleWhen; do not render all possible controls while the renderer reads only the first N.",
|
|
888
|
-
);
|
|
889
|
-
expect(contract.aiUsageRules).toContain(
|
|
890
|
-
"If a switch/select/segmented/imagePicker/checkbox chooses a branch for the same product entity, controls outside the current branch use visibleWhen, not disabledWhen.",
|
|
891
|
-
);
|
|
892
|
-
expect(contract.aiUsageRules).toContain(
|
|
893
|
-
"Do not use schema disabled: true or disabledWhen for generated product controls; the panel should show only controls usable in the current state. Runtime primitives may still have disabled styling internally, but app schemas should model product availability with visibleWhen.",
|
|
894
|
-
);
|
|
895
|
-
expect(contract.aiUsageRules).toContain(
|
|
896
|
-
"Do not leave inactive conditional controls visible while making the renderer ignore them.",
|
|
897
|
-
);
|
|
898
|
-
});
|
|
899
|
-
|
|
900
|
-
it("documents performance acceptance for custom renderer workload controls", () => {
|
|
901
|
-
const contract = getToolcraftComponentContract("performanceAcceptance");
|
|
902
|
-
|
|
903
|
-
expect(contract.kind).toBe("composition");
|
|
904
|
-
expect(contract.stateMode).toBe("runtime-owned");
|
|
905
|
-
expect(contract.capabilities).toContain("performance-budgets");
|
|
906
|
-
expect(contract.capabilities).toContain("workload-control-tests");
|
|
907
|
-
expect(contract.aiUsageRules).toContain(
|
|
908
|
-
"Custom renderers must define performance budgets for media import, preview updates, control drags, and export/copy before implementation.",
|
|
909
|
-
);
|
|
910
|
-
expect(contract.aiUsageRules).toContain(
|
|
911
|
-
"Controls that change renderer workload by changing output dimensions, element count, density, sample count, iteration count, blur/filter radius, shader branch cost, media processing, text layout, or export quality must be tested at min, default, and max values.",
|
|
912
|
-
);
|
|
913
|
-
expect(contract.aiUsageRules).toContain(
|
|
914
|
-
"For workload control scenarios, stressFixture is the tested control value. If the app has an independent heavy baseline such as large media, long text, many items, high render scale, or dense source state, declare workloadFixture and apply it before the measured control interaction.",
|
|
915
|
-
);
|
|
916
|
-
expect(contract.aiUsageRules).toContain(
|
|
917
|
-
"Hash differs is not enough for workload controls; tests must assert semantic direction, such as density increasing item count or size changes reducing/increasing rendered cells.",
|
|
918
|
-
);
|
|
919
|
-
expect(contract.aiUsageRules).toContain(
|
|
920
|
-
"Performance tests must use representative fixtures and the same renderer/export path as the running app, not only tiny 32px fixtures or isolated helper state.",
|
|
921
|
-
);
|
|
922
|
-
expect(contract.aiUsageRules).toContain(
|
|
923
|
-
'Media-import workload fixtures and media workload baselines must use fixture kind "media" with numeric width and height at least 1920x1080-equivalent; 640x480 preview fixtures cannot satisfy upload, effect-control, or image-processing performance coverage.',
|
|
924
|
-
);
|
|
925
|
-
expect(contract.aiUsageRules).toContain(
|
|
926
|
-
"Slider drags and high-frequency controls must debounce or coalesce preview work, cancel stale async renders, and avoid re-decoding media on every control change.",
|
|
927
|
-
);
|
|
928
|
-
expect(contract.aiUsageRules).toContain(
|
|
929
|
-
"Performance matrices must declare rendererWorkload as none, simple-composition, text-output, vector-output, or pixel-output.",
|
|
930
|
-
);
|
|
931
|
-
expect(contract.aiUsageRules).toContain(
|
|
932
|
-
"A full performance checkpoint must run only when the first working app version exists or the user requests performance, lag, jank, animation speed, drag/zoom stabilization work, or otherwise complains about performance; use the agent-controlled browser first and this app's verify:perf script only as the Playwright fallback.",
|
|
933
|
-
);
|
|
934
|
-
expect(contract.aiUsageRules).toContain(
|
|
935
|
-
"Renderer, canvas, animation, export, timeline, layers, canvas.renderScale, bug fixes, and performance-sensitive control changes use targeted functional/browser checks first and targeted performance scenarios only for touched workload, viewport, or export paths.",
|
|
936
|
-
);
|
|
937
|
-
expect(contract.aiUsageRules).toContain(
|
|
938
|
-
"Performance fixes must preserve selected output and preview quality; do not reduce image quality, selected renderScale, export resolution, source media fidelity, or canvas backing pixels as the hidden way to pass budgets.",
|
|
939
|
-
);
|
|
940
|
-
expect(contract.aiUsageRules).toContain(
|
|
941
|
-
"When canvas or slider interactions lag, diagnose where the slowdown comes from before changing output quality: renderer technique, React update frequency, decoded media, shader/program setup, buffer uploads, layout work, async render cancellation, or animation scheduling.",
|
|
942
|
-
);
|
|
943
|
-
expect(contract.aiUsageRules).toContain(
|
|
944
|
-
"Renderer specs must include a Renderer Technique Decision Matrix with sourceRepresentation, productRepresentation, previewRenderer, exportRenderer, rendererWorkload, rendererStrategy, whyNotAlternativeStrategies, fidelityRisks, and performanceRisks.",
|
|
945
|
-
);
|
|
946
|
-
expect(contract.aiUsageRules).toContain(
|
|
947
|
-
"Custom renderer apps must mirror the Renderer Technique Decision Matrix in typed rendererTechnique config so validation can reject contradictory renderer choices.",
|
|
948
|
-
);
|
|
949
|
-
expect(contract.aiUsageRules).toContain(
|
|
950
|
-
"Custom renderer specs must include a Renderer Layer Inventory and mirror it in typed rendererTechnique.layers so dense raster backgrounds cannot silently rasterize semantic foreground output.",
|
|
951
|
-
);
|
|
952
|
-
expect(contract.aiUsageRules).toContain(
|
|
953
|
-
"Semantic foreground output such as product lines, shapes, icons, text, object bounds, and meaningful markers should use DOM or SVG by default; dense raster backgrounds do not justify rasterizing low-count foreground geometry or text.",
|
|
954
|
-
);
|
|
955
|
-
expect(contract.aiUsageRules).toContain(
|
|
956
|
-
"Editing handles must be DOM/SVG overlays, excluded from export, and written through runtime state instead of being drawn into the product raster layer.",
|
|
957
|
-
);
|
|
958
|
-
expect(contract.aiUsageRules).toContain(
|
|
959
|
-
"Product foreground and editing handle renderer layers must declare uiSelector so browser tests can verify the visible layer exists.",
|
|
960
|
-
);
|
|
961
|
-
expect(contract.aiUsageRules).toContain(
|
|
962
|
-
'productRepresentation "mixed" is valid only when rendererTechnique.layers proves at least two different content families.',
|
|
963
|
-
);
|
|
964
|
-
expect(contract.aiUsageRules).toContain(
|
|
965
|
-
"Custom renderer apps must declare rendererPipeline with render passes, cache keys, execution location, preview/export quality, and interaction invalidation before implementation.",
|
|
966
|
-
);
|
|
967
|
-
expect(contract.aiUsageRules).toContain(
|
|
968
|
-
"Render Pipeline Inventory must explain which runtime targets invalidate each expensive pass; high-frequency interactions such as animation frames, drag, zoom, pan, timeline playback, and mask movement must not invalidate upstream decode/preprocess/pixel-transform work unless that target truly changes the upstream result.",
|
|
969
|
-
);
|
|
970
|
-
expect(contract.aiUsageRules).toContain(
|
|
971
|
-
"Cache-sensitive render passes such as decode, preprocess, pixel-transform, text-layout, rasterize, and composite must declare cache keys so tests can reject full recomputation on every control change.",
|
|
972
|
-
);
|
|
973
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/rendererTechnique/);
|
|
974
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/rendererTechnique\.layers/);
|
|
975
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/rendererPipeline/);
|
|
976
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/Render Pipeline Inventory/);
|
|
977
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/sourceRepresentation/);
|
|
978
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/productRepresentation/);
|
|
979
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/previewRenderer/);
|
|
980
|
-
expect(contract.aiUsageRules.join("\n")).toMatch(/exportRenderer/);
|
|
981
|
-
expect(contract.aiUsageRules).toContain(
|
|
982
|
-
"Choose renderer technique from product context, not convenience or novelty. Preserve reference renderer technology in reference-runtime-clone mode unless a concrete blocker and replacement acceptance tests are named.",
|
|
983
|
-
);
|
|
984
|
-
expect(contract.aiUsageRules).toContain(
|
|
985
|
-
"Do not switch renderer technology just because it seems more modern or faster. Preview and export may use different renderers only when the decision matrix explains why and export/copy remains product-quality.",
|
|
986
|
-
);
|
|
987
|
-
expect(contract.aiUsageRules).toContain(
|
|
988
|
-
"Choose renderer workload by product fidelity before choosing rendering technology: ASCII, glyph grids, code art, subtitles, typography, or monospace text products are text-output unless the product intentionally rasterizes them into per-pixel effects.",
|
|
989
|
-
);
|
|
990
|
-
expect(contract.aiUsageRules).toContain(
|
|
991
|
-
"Text-output and vector-output visible previews must preserve native output fidelity. Do not render a low-resolution offscreen canvas or texture and upscale it to the product size.",
|
|
992
|
-
);
|
|
993
|
-
expect(contract.aiUsageRules).toContain(
|
|
994
|
-
"Pixel-output renderers must treat WebGL/WebGPU as the default candidate even when the scene is static; Canvas 2D is allowed only when measured worst-case evidence shows the CPU path preserves quality and remains responsive.",
|
|
995
|
-
);
|
|
996
|
-
expect(contract.aiUsageRules).toContain(
|
|
997
|
-
"Procedural pixel renderers, shader-like effects, animated mesh gradients, and large exportable previews should use WebGL or WebGPU for pixel work instead of main-thread ImageData loops.",
|
|
998
|
-
);
|
|
999
|
-
expect(contract.aiUsageRules).toContain(
|
|
1000
|
-
"Detail-heavy Canvas 2D pixel/media renderers may stay on CPU only when rendererTechnique records measured stress evidence for rejecting WebGL/WebGPU; if the heavy media stress fails, move pixel work to GPU instead of lowering quality.",
|
|
1001
|
-
);
|
|
1002
|
-
expect(contract.aiUsageRules).toContain(
|
|
1003
|
-
"WebGL and WebGPU renderers must initialize contexts, programs, shaders, pipelines, textures, and large buffers once, then update uniforms or stable buffers when controls change.",
|
|
1004
|
-
);
|
|
1005
|
-
expect(contract.aiUsageRules).toContain(
|
|
1006
|
-
"For keyframe or playback renderers, texture upload and media decode must be keyed to source media/resource changes, not to timeline time or evaluated settings. Timeline-only updates must reuse decoded media and existing GPU resources.",
|
|
1007
|
-
);
|
|
1008
|
-
expect(contract.aiUsageRules).toContain(
|
|
1009
|
-
"Do not create WebGL/WebGPU contexts, shader programs, textures, or requestAnimationFrame loops directly in the React render path.",
|
|
1010
|
-
);
|
|
1011
|
-
expect(contract.aiUsageRules).toContain(
|
|
1012
|
-
"Animation loops must cancel scheduled frames during cleanup.",
|
|
1013
|
-
);
|
|
1014
|
-
expect(contract.aiUsageRules).toContain(
|
|
1015
|
-
"Animated preview renderers must suspend or coalesce non-essential animation work while the user drags, pans, pinches, zooms, or centers the canvas viewport, then resume from the correct timeline or autonomous time without changing the user's play/pause state.",
|
|
1016
|
-
);
|
|
1017
|
-
expect(contract.aiUsageRules).toContain(
|
|
1018
|
-
"If a generated app uses ImageData, getImageData, or putImageData for procedural output, performance validation must fail unless rendererTechnique records measured WebGL/WebGPU comparison evidence that the CPU path preserves quality and responsiveness, or the renderer is moved to GPU.",
|
|
1019
|
-
);
|
|
1020
|
-
expect(contract.aiUsageRules).toContain(
|
|
1021
|
-
"Performance matrices must declare rendererStrategy so tests can distinguish none, dom, svg, canvas-2d, webgl, and webgpu renderer paths.",
|
|
1022
|
-
);
|
|
1023
|
-
expect(contract.aiUsageRules).toContain(
|
|
1024
|
-
"If a renderer cannot meet the budget, first optimize renderer technique, caching, invalidation, scheduling, and critical-path work. Only change exposed product ranges, work units, or controls after recording measured evidence that the requested quality ceiling is impossible; do not silently reduce product quality to pass budgets.",
|
|
1025
|
-
);
|
|
1026
|
-
});
|
|
1027
|
-
|
|
1028
|
-
it("documents reference runtime clone mode as a tested composition contract", () => {
|
|
1029
|
-
const contract = getToolcraftComponentContract("referenceRuntimeClone");
|
|
1030
|
-
|
|
1031
|
-
expect(contract.kind).toBe("composition");
|
|
1032
|
-
expect(contract.schemaType).toBe("transferMode");
|
|
1033
|
-
expect(contract.visualComponent).toBe("canvasContent");
|
|
1034
|
-
expect(contract.capabilities).toContain("reference-runtime-clone");
|
|
1035
|
-
expect(contract.capabilities).toContain("reference-timeline-inventory");
|
|
1036
|
-
expect(contract.aiUsageRules).toContain(
|
|
1037
|
-
'Use transferMode: "reference-runtime-clone" when the user asks to port, clone, copy, or reproduce an existing app exactly.',
|
|
1038
|
-
);
|
|
1039
|
-
expect(contract.aiUsageRules).toContain(
|
|
1040
|
-
"Preserve the reference runtime as the source of truth instead of replacing it with a new renderer or timeline model.",
|
|
1041
|
-
);
|
|
1042
|
-
expect(contract.aiUsageRules).toContain(
|
|
1043
|
-
"Port requestAnimationFrame loops, refs, mutable particle/object state, connection state, spawn/update cadence, lifetime rules, pause/resume, export/copy, canvas sizing, and media lifecycle when the reference depends on them.",
|
|
1044
|
-
);
|
|
1045
|
-
expect(contract.aiUsageRules).toContain(
|
|
1046
|
-
"Reference clone timeline choice is based on timeline behavior, not only on whether the reference draws a timeline-shaped UI.",
|
|
1047
|
-
);
|
|
1048
|
-
expect(contract.aiUsageRules).toContain(
|
|
1049
|
-
"If the reference has Play/Pause, Restart from beginning, current time/progress, duration, loop, scrub, selected range, trim handles, or video export timing, write a Reference Timeline Inventory before choosing a timeline mode.",
|
|
1050
|
-
);
|
|
1051
|
-
expect(contract.aiUsageRules).toContain(
|
|
1052
|
-
'Use referenceTimeline.mode "toolcraft-playback" for plain transport behavior such as play/pause, restart, duration/progress, loop, scrub, or export at time.',
|
|
1053
|
-
);
|
|
1054
|
-
expect(contract.aiUsageRules).toContain(
|
|
1055
|
-
"Reference clone specs must list every detected transport behavior explicitly, including pause-resume, restart, time-progress, export-at-time, playback, scrub, duration, loop, and keyframes when present.",
|
|
1056
|
-
);
|
|
1057
|
-
expect(contract.aiUsageRules).toContain(
|
|
1058
|
-
'Toolcraft reference timelines must declare referenceTimeline.loopDuration with source "reference", "user-request", or "product-derived", plus seconds and evidence; runtime/template fallback 8s is not a valid source.',
|
|
1059
|
-
);
|
|
1060
|
-
expect(contract.aiUsageRules).toContain(
|
|
1061
|
-
"panels.timeline.defaultDurationSeconds must match referenceTimeline.loopDuration.seconds for referenceTimeline.mode toolcraft-playback/toolcraft-keyframes.",
|
|
1062
|
-
);
|
|
1063
|
-
expect(contract.aiUsageRules).toContain(
|
|
1064
|
-
'Do not downgrade custom reference timelines to panels.timeline mode "playback". State buttons, trim handles, selected-range playback, or range export require referenceTimeline.mode "custom-reference-timeline" and dedicated acceptance.',
|
|
1065
|
-
);
|
|
1066
|
-
expect(contract.aiUsageRules).toContain(
|
|
1067
|
-
"Reference clone acceptance must include referenceCoverage rows for canvas sizing, control mapping, renderer state, and any renderer loop, spawn/update cadence, pause/resume, export/copy, or media lifecycle behavior in the reference.",
|
|
1068
|
-
);
|
|
1069
|
-
expect(contract.aiUsageRules).toContain(
|
|
1070
|
-
"Video reference assets used in a reference clone also require starterTransferMode.videoReferenceStudy with storyboard frames, frame-to-frame transition analysis, behavior decomposition, and acceptance mapping.",
|
|
1071
|
-
);
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
it("documents concise control label rules", () => {
|
|
1075
|
-
const contract = getToolcraftComponentContract("controlLabels");
|
|
1076
|
-
|
|
1077
|
-
expect(contract.kind).toBe("composition");
|
|
1078
|
-
expect(contract.visualComponent).toBe("ControlFieldLabel");
|
|
1079
|
-
expect(contract.aiUsageRules).toContain(
|
|
1080
|
-
"Control labels must be short UI names, usually one to three words.",
|
|
1081
|
-
);
|
|
1082
|
-
expect(contract.aiUsageRules).toContain(
|
|
1083
|
-
"Do not put explanations, formulas, units, parenthetical hints, or usage instructions in control labels.",
|
|
1084
|
-
);
|
|
1085
|
-
expect(contract.aiUsageRules).toContain(
|
|
1086
|
-
"A concise property label such as Speed, Color, Size, or Opacity is allowed when the nearest visible section or group clearly names the affected product entity.",
|
|
1087
|
-
);
|
|
1088
|
-
expect(contract.aiUsageRules).toContain(
|
|
1089
|
-
"When the section is generic, mixed, missing, or otherwise weak context, include the affected entity or role in the label: Pattern color, Background opacity, Wave speed, Stroke width.",
|
|
1090
|
-
);
|
|
1091
|
-
expect(contract.aiUsageRules).toContain(
|
|
1092
|
-
"Acceptance validators suggest semantic replacement labels for weak generic labels; fix the schema label instead of relying on runtime fallback rewriting.",
|
|
1093
|
-
);
|
|
1094
|
-
expect(contract.aiUsageRules).toContain(
|
|
1095
|
-
"Controls-panel sections should stay discrete: two to seven product controls is the normal size, and larger sections must split by product sub-entity or workflow stage.",
|
|
1096
|
-
);
|
|
1097
|
-
expect(contract.aiUsageRules).toContain(
|
|
1098
|
-
"Every app-authored controls-panel body section must have a short meaningful visible title. Runtime-created Setup renders as the first visible headerless controls block with no title, reset action, collapse button, or collapsed state; sticky footer action sections use the technical title Export but render without a visible heading.",
|
|
1099
|
-
);
|
|
1100
|
-
expect(contract.aiUsageRules).toContain(
|
|
1101
|
-
"Every visible app-authored controls-panel section title renders through the standard 36px collapsible header row with vertically centered text and the runtime collapse icon; generated apps must not hand-build section headers.",
|
|
1102
|
-
);
|
|
1103
|
-
expect(contract.aiUsageRules).toContain(
|
|
1104
|
-
"Controls-panel section expand and collapse uses the standard runtime height/opacity animation; generated apps must not replace it with instant custom section visibility.",
|
|
1105
|
-
);
|
|
1106
|
-
expect(contract.aiUsageRules).toContain(
|
|
1107
|
-
"Controls-panel section collapsed/expanded state persists as a runtime UI preference per app. It is not undo/redo state, not settings import/export state, and Reset controls must not clear it. Runtime Setup is not collapsible; sticky footer Export sections are not collapsible.",
|
|
1108
|
-
);
|
|
1109
|
-
expect(contract.aiUsageRules).toContain(
|
|
1110
|
-
"Ordinary controls-panel section headers expose the runtime section reset action before the collapse button; it dispatches controls.resetTargets and restores only that section's control targets to their schema defaultValue.",
|
|
1111
|
-
);
|
|
1112
|
-
expect(contract.aiUsageRules).toContain(
|
|
1113
|
-
"Runtime Setup and ordinary controls-panel body sections use 8px top spacing and 24px bottom spacing for their control content. Sticky footer action sections keep their dedicated spacing.",
|
|
1114
|
-
);
|
|
1115
|
-
expect(contract.aiUsageRules).toContain(
|
|
1116
|
-
"Broad section titles such as Flow, Icon, Shapes, Scene, Text, Typography, or Motion are only valid for small cohesive groups; use specific titles such as Flow Motion, Flow Geometry, Letter Burst, Shape Colors, Logo Glow, Logo Plate, or Text Block for larger groups.",
|
|
1117
|
-
);
|
|
1118
|
-
expect(contract.aiUsageRules).toContain(
|
|
1119
|
-
"Section titles in one controls panel must be unique.",
|
|
1120
|
-
);
|
|
1121
|
-
expect(contract.aiUsageRules).toContain(
|
|
1122
|
-
"Bad: Grid Density (every Nth). Good: Grid Density, with Every 6th as the select option label.",
|
|
1123
|
-
);
|
|
1124
|
-
expect(contract.aiUsageRules).toContain(
|
|
1125
|
-
"Use control.description for the short help tooltip shown beside visible labels. It must describe the product behavior or output affected by the control, not restate the label.",
|
|
1126
|
-
);
|
|
1127
|
-
expect(contract.aiUsageRules).toContain(
|
|
1128
|
-
"Do not write label-recap descriptions such as Adjusts Opacity, Controls Speed, or Sets Background.",
|
|
1129
|
-
);
|
|
1130
|
-
expect(contract.aiUsageRules).toContain(
|
|
1131
|
-
"If there is no useful product-specific explanation, omit control.description; the runtime should not show a help tooltip for that label.",
|
|
1132
|
-
);
|
|
1133
|
-
expect(contract.aiUsageRules).toContain(
|
|
1134
|
-
"Do not add control.description to sequential colors such as Color 1, Color 2, or simple palette controls such as Spread when the section title already names the color or palette context.",
|
|
1135
|
-
);
|
|
1136
|
-
expect(contract.aiUsageRules).toContain(
|
|
1137
|
-
"For compound controls such as FontPicker, do not use control.description to enumerate the control's owned fields. FontPicker descriptions must not recap font family, weight, size, case, color, opacity, letter spacing, or line height; use description only for non-obvious product scope or omit it.",
|
|
1138
|
-
);
|
|
1139
|
-
expect(contract.aiUsageRules).toContain(
|
|
1140
|
-
"The runtime renders a filled Phosphor question icon beside each visible ControlFieldLabel; generated apps must not hand-build their own help icon beside built-in labels.",
|
|
1141
|
-
);
|
|
1142
|
-
expect(contract.capabilities).toContain("control-description-tooltip");
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
it("documents FontPicker help as product-specific scope only", () => {
|
|
1146
|
-
const contract = getToolcraftComponentContract("fontPicker");
|
|
1147
|
-
|
|
1148
|
-
expect(contract.aiUsageRules).toContain(
|
|
1149
|
-
"Do not put a help tooltip on FontPicker just to list its owned fields. If the section title and FontPicker labels already make the text target clear, omit description.",
|
|
1150
|
-
);
|
|
1151
|
-
});
|
|
1152
|
-
|
|
1153
|
-
it("documents image picker option acceptance as product behavior", () => {
|
|
1154
|
-
const contract = getToolcraftComponentContract("imagePicker");
|
|
1155
|
-
|
|
1156
|
-
expect(contract.kind).toBe("control");
|
|
1157
|
-
expect(contract.defaultSectionLayout).toBe("standalone");
|
|
1158
|
-
expect(contract.aiUsageRules).toContain(
|
|
1159
|
-
"Every visible ImagePicker item must be actionable in the current product context.",
|
|
1160
|
-
);
|
|
1161
|
-
expect(contract.aiUsageRules).toContain(
|
|
1162
|
-
"Do not show selectable image choices that the renderer later sanitizes to a fallback or no-op.",
|
|
1163
|
-
);
|
|
1164
|
-
expect(contract.aiUsageRules).toContain(
|
|
1165
|
-
"Tests must choose each visible ImagePicker item and assert the selected image, texture, gradient, or exported pixels change in the product output.",
|
|
1166
|
-
);
|
|
1167
|
-
expect(contract.aiUsageRules).toContain(
|
|
1168
|
-
"Do not accept renderer data attributes, runtime target changes, or option existence as final proof that an image choice works.",
|
|
1169
|
-
);
|
|
1170
|
-
});
|
|
1171
|
-
|
|
1172
|
-
it("preserves runtime panel commands for optional layers and timeline panels", () => {
|
|
1173
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.commands).toContain("layers.reorder");
|
|
1174
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.capabilities).toContain("selection");
|
|
1175
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1176
|
-
"Do not enable the layers panel for single-layer apps.",
|
|
1177
|
-
);
|
|
1178
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1179
|
-
"When layers are enabled, layer-specific controls should target selectedLayer.* and apply to the currently selected runtime layer.",
|
|
1180
|
-
);
|
|
1181
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1182
|
-
"Do not use selectedLayer.* targets when panels.layers is disabled; single-layer apps use app-specific targets.",
|
|
1183
|
-
);
|
|
1184
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1185
|
-
"Layer-enabled apps need layerCoverage acceptance for selection, visibility, reorder, and grouping.",
|
|
1186
|
-
);
|
|
1187
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1188
|
-
"Every selectedLayer.* control needs selected-layer-controls acceptance proving it edits the currently selected layer output.",
|
|
1189
|
-
);
|
|
1190
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1191
|
-
"Layer browser coverage must use real LayersPanel rows and buttons, not direct layers.* command dispatch.",
|
|
1192
|
-
);
|
|
1193
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.layersPanel.aiUsageRules).toContain(
|
|
1194
|
-
"Layer-enabled custom renderers need layers.interactions viewport-stability coverage around real selection, visibility, reorder or grouping, and selected-layer output checks.",
|
|
1195
|
-
);
|
|
1196
|
-
|
|
1197
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.commands).toContain(
|
|
1198
|
-
"timeline.setCurrentTime",
|
|
1199
|
-
);
|
|
1200
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.commands).toContain(
|
|
1201
|
-
"timeline.togglePlayback",
|
|
1202
|
-
);
|
|
1203
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.commands).toContain(
|
|
1204
|
-
"panels.setHidden",
|
|
1205
|
-
);
|
|
1206
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.capabilities).toContain("keyframes");
|
|
1207
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1208
|
-
"Any product output animation must enable the top Toolcraft timeline; do not ship animated product output with only local requestAnimationFrame playback.",
|
|
1209
|
-
);
|
|
1210
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1211
|
-
"Before choosing no timeline for any animated product, write an Animation Intent Inventory: product transport, editable keyframes, or autonomous decorative output, plus the user-facing time behaviors present or intentionally absent.",
|
|
1212
|
-
);
|
|
1213
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1214
|
-
'User-requested product animation defaults to panels.timeline mode "playback" unless the spec explicitly declares autonomous decorative/self-running output with no play, pause, scrub, duration, loop, export-at-time behavior, or video export.',
|
|
1215
|
-
);
|
|
1216
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1217
|
-
'Any product app with Export Video must enable the top Toolcraft timeline: use panels.timeline mode "playback" for product animation transport, or mode "keyframes" when exported animation is driven by keyframes.',
|
|
1218
|
-
);
|
|
1219
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1220
|
-
"Video export renderers must render deterministic frames from runtime timeline timestamps and duration; do not treat autonomous wall-clock time or captureStream recording time as the source of product duration.",
|
|
1221
|
-
);
|
|
1222
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1223
|
-
"Playback renderers must consume runtime timeline state; pause freezes output, scrubbing renders a deterministic frame, and the full animation cycle maps to state.timeline.durationSeconds instead of a local fixed duration.",
|
|
1224
|
-
);
|
|
1225
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1226
|
-
'When panels.timeline is enabled for a new Toolcraft app, appTransferMode.animationIntent must match it: mode "timeline-playback" for playback, or mode "timeline-keyframes" for keyframes.',
|
|
1227
|
-
);
|
|
1228
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1229
|
-
"When the product has a known loop duration, declare it as panels.timeline.defaultDurationSeconds; the runtime timeline duration starts from that loop duration instead of an unrelated 8s default.",
|
|
1230
|
-
);
|
|
1231
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1232
|
-
'Timeline animation intent must declare loopDuration with source "reference", "user-request", or "product-derived", plus seconds and evidence; runtime/template fallback 8s is not a valid source.',
|
|
1233
|
-
);
|
|
1234
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1235
|
-
"panels.timeline.defaultDurationSeconds must match animationIntent.loopDuration.seconds for playback/keyframe animation, so the initial timeline UI shows the declared product loop instead of a generic default.",
|
|
1236
|
-
);
|
|
1237
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1238
|
-
"Playback renderers may compute an initial loop duration default during app initialization or reset, but must not watch state.timeline.durationSeconds and dispatch timeline.setDuration back to a computed local duration. User-edited timeline duration becomes the loop duration source of truth after initialization or reset.",
|
|
1239
|
-
);
|
|
1240
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1241
|
-
"Playback renderers should use getToolcraftTimelineLoopTime or getToolcraftTimelineLoopProgress to derive product loop phase from state.timeline.currentTimeSeconds and state.timeline.durationSeconds; do not hand-roll wall-clock, fixed-duration, mirror, yoyo, ping-pong, or reverse phase math.",
|
|
1242
|
-
);
|
|
1243
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1244
|
-
"Product animation loop means a seamless forward-only cycle by default: motion advances in one direction, first and last frames stitch without a visible jump, and mirror/yoyo/ping-pong/reverse loops require explicit user request.",
|
|
1245
|
-
);
|
|
1246
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1247
|
-
"Changing timeline duration must preserve seamless forward-loop semantics: one full product animation cycle maps from 0 to state.timeline.durationSeconds, first and last frames still stitch, direction does not reverse, and changing duration must not switch the renderer to wall-clock or fixed local speed.",
|
|
1248
|
-
);
|
|
1249
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1250
|
-
"When non-looping playback reaches the end, pressing Play again restarts playback from time 0.",
|
|
1251
|
-
);
|
|
1252
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1253
|
-
"Intrinsic-media upload timelines must stay paused at time 0 until source media exists; clearing the last media asset must pause and reset playback.",
|
|
1254
|
-
);
|
|
1255
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1256
|
-
"Do not put Pause or Resume in panelActions; playback belongs to TimelinePanel transport controls.",
|
|
1257
|
-
);
|
|
1258
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1259
|
-
"In keyframes mode, Toolcraft infers keyframe diamonds from control type; AI must not manually pick a smaller subset of slider/vector/color-style controls.",
|
|
1260
|
-
);
|
|
1261
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1262
|
-
"Keyframe state stores typed control values; valueLabel is display-only and must never be parsed by renderers or tests as the source of truth.",
|
|
1263
|
-
);
|
|
1264
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1265
|
-
"Custom renderers with keyframes must consume evaluateToolcraftTimelineValues or useToolcraftEvaluatedValues for keyframed settings instead of raw state.values for those targets.",
|
|
1266
|
-
);
|
|
1267
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1268
|
-
"Every inferred keyframe-capable control must be evaluated from runtime timeline keyframes and needs acceptance proving diamond creation, row creation, keyframe updates, scrub/playback evaluation, and product output change.",
|
|
1269
|
-
);
|
|
1270
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1271
|
-
"Keyframe custom renderers must prove zoom, radar, and canvas viewport stability while expanding the timeline, creating keyframes, and scrubbing or playing the timeline.",
|
|
1272
|
-
);
|
|
1273
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1274
|
-
"Keyframe renderers must not re-decode media or re-upload source textures on timeline ticks, scrubs, playback, or evaluated setting changes.",
|
|
1275
|
-
);
|
|
1276
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1277
|
-
"Timeline-driven preview renderers must suspend or coalesce non-essential animation work during canvas drag, pan, pinch, zoom, and radar/center interactions without mutating the user's timeline play/pause state.",
|
|
1278
|
-
);
|
|
1279
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1280
|
-
"Use keyframeable: false only on controls that are structurally unsupported by the shared keyframe capability helper; capable controls cannot opt out to hide broken animation wiring.",
|
|
1281
|
-
);
|
|
1282
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1283
|
-
"Right-panel animation controls may tune renderer parameters such as mode, intensity, speed, or stagger only after animation intent is declared; they must not replace top timeline transport.",
|
|
1284
|
-
);
|
|
1285
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1286
|
-
"Do not replace TimelinePanel with an app-level playback, transport, or timeline panel to avoid runtime performance issues; fix the Toolcraft runtime clock/state path instead.",
|
|
1287
|
-
);
|
|
1288
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1289
|
-
'Custom timeline UI is allowed only for explicit referenceTimeline.mode "custom-reference-timeline" transfers with browser-backed referenceTimelineCoverage.',
|
|
1290
|
-
);
|
|
1291
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1292
|
-
'When panels.timeline is enabled, runtime inserts a Setup switch labeled "Timeline" as the last runtime setup control after Resolution scale.',
|
|
1293
|
-
);
|
|
1294
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1295
|
-
"The Timeline Setup switch controls only compact versus extended runtime presentation: off shows the compact Play-only transport, on shows the extended timeline with scrubber, duration, loop, and keyframe UI. It must not stop playback, change keyframes, affect export, enter product values, or be reset by Reset controls/settings transfer.",
|
|
1296
|
-
);
|
|
1297
|
-
expect(TOOLCRAFT_COMPONENT_CONTRACTS.timelinePanel.aiUsageRules).toContain(
|
|
1298
|
-
"If timeline verification fails, wire the renderer to runtime timeline state or remove panels.timeline.",
|
|
1299
|
-
);
|
|
1300
|
-
});
|
|
1301
|
-
|
|
1302
|
-
it("keeps panel actions documented as sticky footer command controls", () => {
|
|
1303
|
-
const contract = getToolcraftComponentContract("panelActions");
|
|
1304
|
-
|
|
1305
|
-
expect(contract.stateMode).toBe("command-only");
|
|
1306
|
-
expect(contract.commands).toEqual(["controls.apply"]);
|
|
1307
|
-
expect(contract.aiUsageRules).toContain(
|
|
1308
|
-
"Do not use panelActions for resetting controls; the controls panel header owns Reset controls.",
|
|
1309
|
-
);
|
|
1310
|
-
expect(contract.aiUsageRules).toContain(
|
|
1311
|
-
"Handle product-specific panelActions through ToolcraftApp onPanelAction.",
|
|
1312
|
-
);
|
|
1313
|
-
expect(contract.aiUsageRules).toContain(
|
|
1314
|
-
"Async product actions such as Export, Download, Copy, Generate, or Apply must return the real Promise from onPanelAction and report progress through the onPanelAction reportProgress callback.",
|
|
1315
|
-
);
|
|
1316
|
-
expect(contract.aiUsageRules).toContain(
|
|
1317
|
-
"The sticky footer top accent indicator is determinate when reportProgress receives 0..1 values and falls back to pending state only when progress is unavailable.",
|
|
1318
|
-
);
|
|
1319
|
-
expect(contract.aiUsageRules).toContain(
|
|
1320
|
-
"defineToolcraft hoists panelActions into the controls panel sticky footer automatically.",
|
|
1321
|
-
);
|
|
1322
|
-
expect(contract.aiUsageRules).toContain(
|
|
1323
|
-
"Product-output apps must always include export in panelActions.",
|
|
1324
|
-
);
|
|
1325
|
-
expect(contract.aiUsageRules).toContain(
|
|
1326
|
-
'Export-labeled panelActions use icon "upload-simple", matching the Setup "Export Settings" action; do not use "download", "download-simple", or "export" icons for Export PNG or Export Video.',
|
|
1327
|
-
);
|
|
1328
|
-
expect(contract.aiUsageRules).toContain(
|
|
1329
|
-
"Static or still-output apps include Export PNG as the primary footer action.",
|
|
1330
|
-
);
|
|
1331
|
-
expect(contract.aiUsageRules).toContain(
|
|
1332
|
-
'Every app with Export PNG must expose a separate "Image Export" controls section.',
|
|
1333
|
-
);
|
|
1334
|
-
expect(contract.aiUsageRules).toContain(
|
|
1335
|
-
'The Image Export section must include "export.image.format" as a Select control with PNG and JPG choices, defaulting to "png".',
|
|
1336
|
-
);
|
|
1337
|
-
expect(contract.aiUsageRules).toContain(
|
|
1338
|
-
'The Image Export section must include "export.image.resolution" as a Select control with 2K, 4K, and 8K choices, defaulting to "4k".',
|
|
1339
|
-
);
|
|
1340
|
-
expect(contract.aiUsageRules).toContain(
|
|
1341
|
-
"Image Export format and resolution render as one compact two-column inline Select pair, matching the Video Export settings structure.",
|
|
1342
|
-
);
|
|
1343
|
-
expect(contract.aiUsageRules).toContain(
|
|
1344
|
-
"Image Export resolution controls the actual exported image long edge: 2K = 2048px, 4K = 4096px, 8K = 8192px. Pass the selected runtime value to createToolcraftPngExportCanvas resolution and prove decoded image width/height in browser acceptance.",
|
|
1345
|
-
);
|
|
1346
|
-
expect(contract.aiUsageRules).toContain(
|
|
1347
|
-
"Animated apps include Export Video as the primary footer action and Export PNG as a secondary footer action.",
|
|
1348
|
-
);
|
|
1349
|
-
expect(contract.aiUsageRules).toContain(
|
|
1350
|
-
"Any app with Export Video must enable the top Toolcraft timeline; video duration, loop, and rendered timestamps come from runtime timeline state.",
|
|
1351
|
-
);
|
|
1352
|
-
expect(contract.aiUsageRules).toContain(
|
|
1353
|
-
'Animated apps with Export Video must expose a separate "Video Export" controls section.',
|
|
1354
|
-
);
|
|
1355
|
-
expect(contract.aiUsageRules).toContain(
|
|
1356
|
-
'Animated apps with both Export PNG and Export Video must expose both "Image Export" and "Video Export"; Image Export sits immediately before Video Export.',
|
|
1357
|
-
);
|
|
1358
|
-
expect(contract.aiUsageRules).toContain(
|
|
1359
|
-
'The Video Export section must include format and resolution controls such as targets "export.video.format" and "export.video.resolution".',
|
|
1360
|
-
);
|
|
1361
|
-
expect(contract.aiUsageRules).toContain(
|
|
1362
|
-
"Use Select controls for Video Export format and resolution; do not use Segmented unless the product has a deliberately tiny fixed output menu and browser tests prove every cell keeps padding.",
|
|
1363
|
-
);
|
|
1364
|
-
expect(contract.aiUsageRules).toContain(
|
|
1365
|
-
"Place the Video Export section as the final controls section directly above sticky footer panelActions.",
|
|
1366
|
-
);
|
|
1367
|
-
expect(contract.aiUsageRules).toContain(
|
|
1368
|
-
'Video Export format defaults to "mp4"; keep "webm" available as the baseline alternate unless the prompt/reference requires another default.',
|
|
1369
|
-
);
|
|
1370
|
-
expect(contract.aiUsageRules).toContain(
|
|
1371
|
-
'Video Export resolution defaults to "current"; keep "4k" available as the high-resolution alternate.',
|
|
1372
|
-
);
|
|
1373
|
-
expect(contract.aiUsageRules).toContain(
|
|
1374
|
-
"Video Export format and resolution are a compact semantic pair and should use a two-column inline layout by default; use stacked rows only when labels or selected values do not fit without clipping.",
|
|
1375
|
-
);
|
|
1376
|
-
expect(contract.aiUsageRules).toContain(
|
|
1377
|
-
'Baseline browser video formats are "mp4" and "webm"; MOV or ProRes require an explicit custom encoder/transcoder and dedicated acceptance plus performance coverage.',
|
|
1378
|
-
);
|
|
1379
|
-
expect(contract.aiUsageRules).toContain(
|
|
1380
|
-
"Video export code must choose the actual MIME/container through MediaRecorder.isTypeSupported or an equivalent encoder capability check, then fall back safely.",
|
|
1381
|
-
);
|
|
1382
|
-
expect(contract.aiUsageRules).toContain(
|
|
1383
|
-
"Video export must use getToolcraftVideoExportSize for current and 4K dimensions. Current video export uses the current canvas/output size with even encoder-safe rounding; 4K video fits inside an encoder-safe 3840x2160 box, preserves canvas aspect ratio, and uses even pixel dimensions. Do not hand-roll 4096px long-edge video sizing.",
|
|
1384
|
-
);
|
|
1385
|
-
expect(contract.aiUsageRules).toContain(
|
|
1386
|
-
"Video export must set recording canvas dimensions before captureStream, MediaRecorder, VideoEncoder, or equivalent encoder setup, and must reject recorder/encoder errors instead of returning corrupt blobs.",
|
|
1387
|
-
);
|
|
1388
|
-
expect(contract.aiUsageRules).toContain(
|
|
1389
|
-
"Offline video export duration must be encoded from runtime timeline timestamps. Do not rely on canvas.captureStream plus MediaRecorder wall-clock recording time as the only duration mechanism for rendered-frame export.",
|
|
1390
|
-
);
|
|
1391
|
-
expect(contract.aiUsageRules).toContain(
|
|
1392
|
-
'Video resolution must control exported dimensions. Use "current" output size by default; "4K" is an export resolution target, not a hardcoded 3840x2160 canvas lock.',
|
|
1393
|
-
);
|
|
1394
|
-
expect(contract.aiUsageRules).toContain(
|
|
1395
|
-
"Video export browser coverage must load the exported blob metadata and prove video.duration matches the edited runtime timeline duration; blobSize/blobType checks alone are not enough.",
|
|
1396
|
-
);
|
|
1397
|
-
expect(contract.aiUsageRules).toContain(
|
|
1398
|
-
"Video export must report frame-based progress through reportProgress during render/encode steps. PNG export should report phase progress for render, blob, and handoff when those phases are asynchronous.",
|
|
1399
|
-
);
|
|
1400
|
-
expect(contract.aiUsageRules).toContain(
|
|
1401
|
-
'Product-output apps must expose a dedicated "Background" section directly before the first export settings section. With PNG export that first section is Image Export; with video-only export it is Video Export.',
|
|
1402
|
-
);
|
|
1403
|
-
expect(contract.aiUsageRules).toContain(
|
|
1404
|
-
"Product-output apps must pass the includeBackground runtime value to createToolcraftPngExportCanvas for PNG alpha and call shouldIncludeToolcraftPreviewBackground(state) for live preview product background.",
|
|
1405
|
-
);
|
|
1406
|
-
expect(contract.aiUsageRules).toContain(
|
|
1407
|
-
"PNG export must use createToolcraftPngExportCanvas so background transparency and selected image dimensions or retina fallback are applied consistently; turning Include off makes preview product background and PNG alpha transparent without hiding the Toolcraft canvas backing or video background.",
|
|
1408
|
-
);
|
|
1409
|
-
expect(contract.aiUsageRules).toContain(
|
|
1410
|
-
"Video export must keep product background and use getToolcraftVideoExportSize for current/4K output dimensions.",
|
|
1411
|
-
);
|
|
1412
|
-
expect(contract.aiUsageRules).toContain(
|
|
1413
|
-
"Copy PNG can be a secondary action when clipboard output is useful, but copy does not replace export.",
|
|
1414
|
-
);
|
|
1415
|
-
expect(contract.aiUsageRules).toContain(
|
|
1416
|
-
"Add Copy PNG as a secondary action only when the prompt/reference includes clipboard output or the product clearly benefits from paste/share workflows.",
|
|
1417
|
-
);
|
|
1418
|
-
expect(contract.aiUsageRules).toContain(
|
|
1419
|
-
"Footer actions must be one compact horizontal group; do not split them into stacked full-width sections.",
|
|
1420
|
-
);
|
|
1421
|
-
expect(contract.aiUsageRules).toContain(
|
|
1422
|
-
"If two footer actions are needed, render secondary/outline on the left and primary on the right.",
|
|
1423
|
-
);
|
|
1424
|
-
expect(contract.aiUsageRules).toContain(
|
|
1425
|
-
"When an odd number of footer actions renders in two columns, the final unpaired action spans the full row width.",
|
|
1426
|
-
);
|
|
1427
|
-
});
|
|
1428
|
-
|
|
1429
|
-
it("documents file upload ownership across single-layer and multi-layer apps", () => {
|
|
1430
|
-
const contract = getToolcraftComponentContract("fileDrop");
|
|
1431
|
-
|
|
1432
|
-
expect(contract.commands).toEqual([
|
|
1433
|
-
"media.delete",
|
|
1434
|
-
"media.import",
|
|
1435
|
-
"media.reorder",
|
|
1436
|
-
"media.transform",
|
|
1437
|
-
]);
|
|
1438
|
-
expect(contract.aiUsageRules).toContain(
|
|
1439
|
-
'Use fileDrop with assetKind: "image" for image-only source media and assetKind: "file" for arbitrary uploaded files.',
|
|
1440
|
-
);
|
|
1441
|
-
expect(contract.aiUsageRules).toContain(
|
|
1442
|
-
"If an app ships with predefined source files or background images, declare them as schema media.defaultAssets with sourceTarget matching the fileDrop control. They must render as ordinary attached files in fileDrop, not as hidden renderer constants or canvas placeholder artwork.",
|
|
1443
|
-
);
|
|
1444
|
-
expect(contract.aiUsageRules).toContain(
|
|
1445
|
-
"Predefined media files are default runtime state: users can remove them to get an empty source/canvas state, persistence may keep that removal with include: [\"media\"], and global or section Reset restores the default attached files.",
|
|
1446
|
-
);
|
|
1447
|
-
expect(contract.aiUsageRules).toContain(
|
|
1448
|
-
"When uploaded/imported content is part of the source-material flow, the canvas must not show agent-invented artwork, CTA text, fake sample output, decorative placeholders, or preset source designs before real content exists; keep the canvas neutral/runtime-backed and put upload affordance in fileDrop.",
|
|
1449
|
-
);
|
|
1450
|
-
expect(contract.aiUsageRules).toContain(
|
|
1451
|
-
"Do not add procedural Source Preset modes only to avoid an empty canvas. A default procedural or reference source is allowed only when the prompt/reference explicitly defines it and the worklog records that evidence.",
|
|
1452
|
-
);
|
|
1453
|
-
expect(contract.aiUsageRules).toContain(
|
|
1454
|
-
"In single-layer apps, the runtime shows the uploaded image as the fileDrop preview and provides the clear action.",
|
|
1455
|
-
);
|
|
1456
|
-
expect(contract.aiUsageRules).toContain(
|
|
1457
|
-
"In image mode, the runtime owns image transform actions: 90° Right, Flip horizontal, and Flip vertical. These actions render through the built-in actions-control in one three-column row with compact visible labels: 90°, Flip H, Flip V; keep a 6px vertical gap between the uploader and action row. Do not create a custom image action button grid. They update runtime mediaAssets transform metadata, and product preview/export must consume that metadata instead of keeping a separate transform state.",
|
|
1458
|
-
);
|
|
1459
|
-
expect(contract.aiUsageRules).toContain(
|
|
1460
|
-
"When exactly one uploaded image is present, image transform actions are visible immediately. When multiple images are present, users select a thumbnail first; no transform actions render until a thumbnail is selected, and the action applies only to that selected image.",
|
|
1461
|
-
);
|
|
1462
|
-
expect(contract.aiUsageRules).toContain(
|
|
1463
|
-
"In file mode, the runtime shows uploaded files as a sortable list with paperclip icons, file names, remove buttons, and --border/5 separators.",
|
|
1464
|
-
);
|
|
1465
|
-
expect(contract.aiUsageRules).toContain(
|
|
1466
|
-
"In single-layer apps, global Reset controls and section reset must restore fileDrop source media to schema media.defaultAssets for that target; when no default asset exists, Reset removes uploaded media and returns the fileDrop target to defaultValue.",
|
|
1467
|
-
);
|
|
1468
|
-
expect(contract.aiUsageRules).toContain(
|
|
1469
|
-
"Use fileDrop with multiple: true when the app needs several uploaded images as one source set; do not build a custom thumbnail uploader for this.",
|
|
1470
|
-
);
|
|
1471
|
-
expect(contract.aiUsageRules).toContain(
|
|
1472
|
-
"When multiple uploaded images are present, the runtime appends media, shows a sortable four-column preview grid, puts the add-more tile last, and exposes per-image removal.",
|
|
1473
|
-
);
|
|
1474
|
-
expect(contract.aiUsageRules).toContain(
|
|
1475
|
-
"Canvas drops route to the first visible matching fileDrop target by asset kind: image files prefer image uploaders, non-image files prefer file uploaders, and file uploaders accept images only when no image uploader matches.",
|
|
1476
|
-
);
|
|
1477
|
-
expect(contract.aiUsageRules).toContain(
|
|
1478
|
-
"Dragging thumbnails reorders runtime mediaAssets; preview, export, and renderer mapping must consume that media order instead of maintaining a separate product-only order.",
|
|
1479
|
-
);
|
|
1480
|
-
expect(contract.aiUsageRules).toContain(
|
|
1481
|
-
"When uploaded images are used as canvas/background source material, draw them with cover/crop behavior: scale proportionally until the current canvas bounds are fully covered, keep the canvas size/settings unchanged, and crop overflow at the canvas bounds.",
|
|
1482
|
-
);
|
|
1483
|
-
expect(contract.aiUsageRules).toContain(
|
|
1484
|
-
"Do not create custom upload buttons, file lists, or file sorting for generic source uploads when fileDrop can represent the source set.",
|
|
1485
|
-
);
|
|
1486
|
-
expect(contract.aiUsageRules).toContain(
|
|
1487
|
-
"In multi-layer apps, deletion and visibility belong to the Layers panel; fileDrop remains an upload target.",
|
|
1488
|
-
);
|
|
1489
|
-
});
|
|
1490
|
-
|
|
1491
|
-
it("documents semantic color section titles", () => {
|
|
1492
|
-
const contract = getToolcraftComponentContract("color");
|
|
1493
|
-
|
|
1494
|
-
expect(contract.aiUsageRules).toContain(
|
|
1495
|
-
"Color controls can be standalone color sections or grouped fields inside a semantic control section.",
|
|
1496
|
-
);
|
|
1497
|
-
expect(contract.aiUsageRules).toContain(
|
|
1498
|
-
"First identify the semantic entity the color belongs to, such as Square 1, Square 2, Background, Object, Connector, Glow, Tone Mapping, Brand, or Export.",
|
|
1499
|
-
);
|
|
1500
|
-
expect(contract.aiUsageRules).toContain(
|
|
1501
|
-
"Keep a color inside a section when it configures the same entity as nearby controls. Example: Square 1 (Right) contains Connections, Hover radius, and Color in one section.",
|
|
1502
|
-
);
|
|
1503
|
-
expect(contract.aiUsageRules).toContain(
|
|
1504
|
-
"When color belongs to the same object or effect as nearby controls, keep it inside that section and use a concise field label that is unambiguous in context, such as Color in a Square section or Symbol color in a mixed Style section.",
|
|
1505
|
-
);
|
|
1506
|
-
expect(contract.aiUsageRules).toContain(
|
|
1507
|
-
"The standalone default applies only to color-only sections; mixed semantic sections keep color grouped with nearby controls.",
|
|
1508
|
-
);
|
|
1509
|
-
expect(contract.aiUsageRules).toContain(
|
|
1510
|
-
"Never use generic Color or Colors as a generated section title. If no meaningful color role exists and the colors are just basic colors, use a neutral section title such as Appearance instead of omitting the title.",
|
|
1511
|
-
);
|
|
1512
|
-
expect(contract.aiUsageRules).toContain(
|
|
1513
|
-
"Do not split a grouped object section into a separate generated Color section; if the color role is unclear, ask the user before implementation.",
|
|
1514
|
-
);
|
|
1515
|
-
expect(contract.aiUsageRules).toContain(
|
|
1516
|
-
"Render multiple related color fields in one section with at most two colors per row.",
|
|
1517
|
-
);
|
|
1518
|
-
expect(contract.aiUsageRules).toContain(
|
|
1519
|
-
"If a multi-color bank has an odd trailing plain Color, keep that last Color at half width; only ColorOpacity or intentionally full-width compound controls occupy a full row.",
|
|
1520
|
-
);
|
|
1521
|
-
});
|
|
1522
|
-
|
|
1523
|
-
it("documents CodeTextarea as generic multiline text input", () => {
|
|
1524
|
-
const contract = getToolcraftComponentContract("code");
|
|
1525
|
-
|
|
1526
|
-
expect(contract.visualComponent).toBe("CodeTextarea");
|
|
1527
|
-
expect(contract.defaultSectionLayout).toBe("standalone");
|
|
1528
|
-
expect(contract.labelPolicy).toBe("required");
|
|
1529
|
-
expect(contract.aiUsageRules).toContain(
|
|
1530
|
-
"CodeTextarea is the multiline text input for any potentially long value, not only source code.",
|
|
1531
|
-
);
|
|
1532
|
-
expect(contract.aiUsageRules).toContain(
|
|
1533
|
-
"Do not use CodeTextarea for short single-line canvas text, button labels, names, titles, captions, badges, or short tokens; use TextInput.",
|
|
1534
|
-
);
|
|
1535
|
-
expect(contract.aiUsageRules).toContain(
|
|
1536
|
-
"Use text for short single-line strings such as names, button labels, small numeric values, compact prompts, titles, captions, and short tokens.",
|
|
1537
|
-
);
|
|
1538
|
-
expect(contract.aiUsageRules).toContain(
|
|
1539
|
-
"Use code only when the user may enter long prompts, multiline text, instructions, JSON, CSS, shader code, scripts, templates, or other long structured data.",
|
|
1540
|
-
);
|
|
1541
|
-
expect(contract.aiUsageRules).toContain(
|
|
1542
|
-
"If CodeTextarea has a short single-line default value, the schema description must make the long, multiline, or structured-content reason explicit.",
|
|
1543
|
-
);
|
|
1544
|
-
expect(contract.aiUsageRules).toContain(
|
|
1545
|
-
"CodeTextarea is a content editor and applies values while typing; do not wait for blur, Enter, or Cmd/Ctrl+Enter to update runtime state.",
|
|
1546
|
-
);
|
|
1547
|
-
expect(contract.aiUsageRules).toContain(
|
|
1548
|
-
"CodeTextarea height is capped at 12 visible text lines; long content scrolls inside the textarea instead of making the controls panel taller.",
|
|
1549
|
-
);
|
|
1550
|
-
});
|
|
1551
|
-
|
|
1552
|
-
it("documents TextInput content and setting commit modes", () => {
|
|
1553
|
-
const contract = getToolcraftComponentContract("text");
|
|
1554
|
-
|
|
1555
|
-
expect(contract.visualComponent).toBe("TextInput");
|
|
1556
|
-
expect(contract.defaultSectionLayout).toBe("grouped");
|
|
1557
|
-
expect(contract.labelPolicy).toBe("required");
|
|
1558
|
-
expect(contract.aiUsageRules).toContain(
|
|
1559
|
-
"TextInput owns short single-line product text: button labels, labels on the canvas, names, titles, captions, badges, short tokens, and compact prompts.",
|
|
1560
|
-
);
|
|
1561
|
-
expect(contract.aiUsageRules).toContain(
|
|
1562
|
-
'TextInput commitMode defaults to "content": text content, prompts, names, tokens, titles, and instructions apply while typing.',
|
|
1563
|
-
);
|
|
1564
|
-
expect(contract.aiUsageRules).toContain(
|
|
1565
|
-
'Use commitMode: "setting" for text inputs that edit settings such as font size, numeric-like style values, dimensions, ids, or configuration fields; setting text commits on blur or Enter.',
|
|
1566
|
-
);
|
|
1567
|
-
expect(contract.aiUsageRules).toContain(
|
|
1568
|
-
"Canvas width and Canvas height are runtime editable-size fields and always commit on blur or Enter like editor size fields.",
|
|
1569
|
-
);
|
|
1570
|
-
});
|
|
1571
|
-
|
|
1572
153
|
it("preserves literal contract types from the getter", () => {
|
|
1573
154
|
const contract = getToolcraftComponentContract("slider");
|
|
1574
155
|
|