@reqvire-org/ads 0.5.0 → 0.5.2
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 +9 -6
- package/dist/ads-errors.mjs +382 -34
- package/dist/ads-views.mjs +4 -4
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/design-usage.mjs +20 -4
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/mock-check.mjs +5 -4
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +195 -43
- package/dist/analysis/owner-composition.mjs +152 -43
- package/dist/analysis/owner-controls.mjs +27 -0
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +309 -83
- package/dist/analysis/prose-owners.mjs +57 -0
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/styling-ownership.mjs +22 -0
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +20 -7
- package/dist/cli-arguments.mjs +2 -2
- package/dist/cli.mjs +4 -4
- package/dist/composed-contrast.mjs +28 -8
- package/dist/composed-keyline.mjs +107 -0
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +149 -20
- package/dist/construction-spec.d.mts +320 -12
- package/dist/construction-spec.mjs +452 -69
- package/dist/corner-overpaint.mjs +65 -0
- package/dist/derived-states.mjs +182 -0
- package/dist/design-foundation.mjs +6 -1
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/design-usage.mjs +8 -2
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +14 -5
- package/dist/emit/font-emission.mjs +21 -1
- package/dist/emit/foundation-sheet.mjs +6 -5
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +10 -0
- package/dist/font-checks.mjs +42 -0
- package/dist/font-declaration.d.mts +10 -0
- package/dist/font-declaration.mjs +25 -3
- package/dist/font-fallback.d.mts +37 -0
- package/dist/font-fallback.mjs +25 -0
- package/dist/font-macro.d.mts +10 -0
- package/dist/font-metrics.d.mts +34 -0
- package/dist/font-metrics.mjs +314 -0
- package/dist/font-model.mjs +28 -2
- package/dist/form-states.mjs +8 -0
- package/dist/foundation-macro.d.mts +1 -1
- package/dist/frame-regions.mjs +92 -9
- package/dist/grid-facts.mjs +72 -16
- package/dist/grid-lowering.mjs +11 -5
- package/dist/hover-geometry.mjs +15 -0
- package/dist/init.mjs +14 -23
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-enter.mjs +31 -0
- package/dist/lowering-properties.mjs +27 -1
- package/dist/lowering-region-layout.mjs +49 -10
- package/dist/lowering-sequence.mjs +89 -0
- package/dist/lowering-session.mjs +7 -0
- package/dist/lowering-transitions.mjs +22 -8
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +5 -5
- package/dist/motion-model.mjs +3 -1
- package/dist/owner-analysis-check.mjs +86 -12
- package/dist/owner-errors.mjs +20 -2
- package/dist/owner-lowering.mjs +104 -25
- package/dist/owner-scenarios.mjs +29 -4
- package/dist/ownership-model.mjs +37 -4
- package/dist/paint-contrast.mjs +5 -0
- package/dist/placeholder-contrast.mjs +18 -1
- package/dist/platform-features.mjs +35 -2
- package/dist/preview-bun.mjs +17 -16
- package/dist/preview-controls.mjs +35 -0
- package/dist/preview-incremental.mjs +1 -1
- package/dist/preview-source.mjs +2 -2
- package/dist/profile-macro.d.mts +15 -0
- package/dist/profile-model.mjs +3 -3
- package/dist/profile-view-facts.mjs +55 -4
- package/dist/prose-model.d.mts +81 -0
- package/dist/prose-model.mjs +101 -0
- package/dist/recipe-macro.d.mts +176 -15
- package/dist/recipe-model.mjs +35 -7
- package/dist/region-lowering.mjs +463 -65
- package/dist/render-audit/corner-overpaint.page.mjs +54 -0
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +23 -3
- package/dist/render-audit.mjs +139 -1
- package/dist/role-vocabulary.d.mts +43 -2
- package/dist/role-vocabulary.mjs +50 -4
- package/dist/scenario-kit.d.mts +6 -0
- package/dist/scenario-registry.mjs +1 -1
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/scheme-switch.d.mts +8 -0
- package/dist/scheme-switch.mjs +1 -0
- package/dist/showcase/ads-views.mjs +116 -53
- package/dist/showcase/assets-view.mjs +136 -89
- package/dist/showcase/client.bundle.js +65 -65
- package/dist/showcase/http-client.bundle.js +17 -17
- package/dist/showcase/preview-frame.css +2 -0
- package/dist/showcase/profiles-view.mjs +163 -122
- package/dist/showcase/scenario-page.d.mts +11 -1
- package/dist/showcase/scenario-page.mjs +18 -3
- package/dist/showcase/token-sample.mjs +47 -4
- package/dist/showcase/tokens-view.mjs +82 -34
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/README.md +5 -5
- package/dist/skills/ads-designer/README.md +1 -1
- package/dist/skills/ads-designer/SKILL.md +13 -12
- package/dist/skills/ads-designer/references/accessibility.md +9 -2
- package/dist/skills/ads-designer/references/atomic-styles.md +8 -1
- package/dist/skills/ads-designer/references/branding.md +20 -5
- package/dist/skills/ads-designer/references/cli.md +4 -4
- package/dist/skills/ads-designer/references/contracts.md +14 -4
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-designer/references/design-data.md +3 -3
- package/dist/skills/ads-designer/references/forms.md +6 -6
- package/dist/skills/ads-designer/references/layout.md +46 -3
- package/dist/skills/ads-designer/references/motion.md +45 -1
- package/dist/skills/ads-designer/references/performance.md +7 -1
- package/dist/skills/ads-designer/references/recipes.md +92 -7
- package/dist/skills/ads-designer/references/runtimes.md +1 -1
- package/dist/skills/ads-designer/references/scenarios.md +1 -0
- package/dist/skills/ads-import/references/atomic-styles.md +8 -1
- package/dist/skills/ads-import/references/cli.md +4 -4
- package/dist/skills/ads-import/references/contracts.md +14 -4
- package/dist/skills/ads-import/references/design-data.md +3 -3
- package/dist/skills/ads-import/references/forms.md +6 -6
- package/dist/skills/ads-import/references/layout.md +46 -3
- package/dist/skills/ads-import/references/recipes.md +92 -7
- package/dist/skills/ads-import/references/runtimes.md +1 -1
- package/dist/skills/ads-import/references/scenarios.md +1 -0
- package/dist/skills/ads-migrate/SKILL.md +3 -1
- package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-port/references/atomic-styles.md +8 -1
- package/dist/skills/ads-port/references/cli.md +4 -4
- package/dist/skills/ads-port/references/contracts.md +14 -4
- package/dist/skills/ads-port/references/design-data.md +3 -3
- package/dist/skills/ads-port/references/forms.md +6 -6
- package/dist/skills/ads-port/references/layout.md +46 -3
- package/dist/skills/ads-port/references/recipes.md +92 -7
- package/dist/skills/ads-port/references/runtimes.md +1 -1
- package/dist/skills/ads-port/references/scenarios.md +1 -0
- package/dist/spatial-model.mjs +20 -4
- package/dist/state-conditions.d.mts +29 -0
- package/dist/state-conditions.mjs +42 -2
- package/dist/surface-contrast.mjs +69 -10
- package/dist/surface-effects.mjs +100 -0
- package/dist/target-size.mjs +1 -1
- package/dist/task-cache.mjs +9 -19
- package/dist/token-dtcg.mjs +1 -0
- package/dist/token-view-facts.mjs +54 -5
- package/dist/unreached-sources.mjs +5 -0
- package/dist/validation-checks.mjs +1 -1
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +36 -13
- package/docs/ARCHITECTURE.md +223 -23
- package/docs/ASSETS.md +81 -10
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +525 -23
- package/docs/DESIGN-REFERENCES.md +5 -5
- package/docs/GUIDE.md +286 -73
- package/docs/LANGUAGE.md +428 -24
- package/docs/LOWERING.md +13 -1
- package/docs/MOTION.md +241 -7
- package/docs/PROFILE-KINDS.md +176 -14
- package/docs/PROFILES.md +2 -2
- package/docs/RULES.md +63 -24
- package/docs/TOKEN-ROLES.md +15 -7
- package/package.json +1 -1
- package/dist/starter-files.mjs +0 -155
- package/dist/starter-overlay.mjs +0 -189
- package/dist/starters/preact/design-system/assets/avatars/avatar.ads.ts +0 -10
- package/dist/starters/preact/design-system/assets/avatars/member.svg +0 -1
- package/dist/starters/preact/design-system/assets/brand/emblem.ads.ts +0 -18
- package/dist/starters/preact/design-system/assets/brand/emblem.svg +0 -4
- package/dist/starters/preact/design-system/assets/brand/iris-emblem.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/brand/iris-emblem.svg +0 -4
- package/dist/starters/preact/design-system/assets/brand/mark.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/brand/mark.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/arrow.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/glyphs/arrow.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron-20.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron-24.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron.ads.ts +0 -20
- package/dist/starters/preact/design-system/assets/glyphs/close.ads.ts +0 -13
- package/dist/starters/preact/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/favorite.ads.ts +0 -23
- package/dist/starters/preact/design-system/assets/glyphs/favorite.normal.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/favorite.selected.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/search.ads.ts +0 -10
- package/dist/starters/preact/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/preact/design-system/assets/illustrations/journey.ads.ts +0 -32
- package/dist/starters/preact/design-system/assets/illustrations/journey.contrast.svg +0 -6
- package/dist/starters/preact/design-system/assets/illustrations/journey.dark.svg +0 -13
- package/dist/starters/preact/design-system/assets/illustrations/journey.light.svg +0 -13
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.ads.ts +0 -17
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.dark.svg +0 -10
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.light.svg +0 -10
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.ads.ts +0 -15
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.dark.svg +0 -9
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.light.svg +0 -9
- package/dist/starters/preact/design-system/assets/status/error.svg +0 -1
- package/dist/starters/preact/design-system/assets/status/outcomes.ads.ts +0 -31
- package/dist/starters/preact/design-system/assets/status/status.ads.ts +0 -16
- package/dist/starters/preact/design-system/assets/status/success.svg +0 -1
- package/dist/starters/preact/design-system/assets/status/sync-status.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/status/sync-status.svg +0 -7
- package/dist/starters/preact/design-system/assets/status/warning.svg +0 -1
- package/dist/starters/preact/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -12
- package/dist/starters/preact/design-system/components/Actions/Button/Button.tsx +0 -198
- package/dist/starters/preact/design-system/components/Actions/IconButton/IconButton.tsx +0 -95
- package/dist/starters/preact/design-system/components/Actions/ToggleTile/ToggleTile.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/components/Actions/ToggleTile/ToggleTile.tsx +0 -60
- package/dist/starters/preact/design-system/components/Containers/Disclosure/Disclosure.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/components/Containers/Disclosure/Disclosure.tsx +0 -50
- package/dist/starters/preact/design-system/components/Content/Artwork/Artwork.ads.scenario.tsx +0 -8
- package/dist/starters/preact/design-system/components/Content/Artwork/Artwork.tsx +0 -110
- package/dist/starters/preact/design-system/components/Content/BarChart/BarChart.ads.scenario.tsx +0 -25
- package/dist/starters/preact/design-system/components/Content/BarChart/BarChart.tsx +0 -72
- package/dist/starters/preact/design-system/components/Content/GuideGrid/GuideGrid.ads.scenario.tsx +0 -8
- package/dist/starters/preact/design-system/components/Content/GuideGrid/GuideGrid.tsx +0 -43
- package/dist/starters/preact/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/components/Content/Icon/Icon.tsx +0 -41
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/arrow.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/close.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/search.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Image/Image.ads.fixture.ts +0 -9
- package/dist/starters/preact/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -12
- package/dist/starters/preact/design-system/components/Content/Image/Image.tsx +0 -83
- package/dist/starters/preact/design-system/components/Content/InspectedGlyph/InspectedGlyph.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/components/Content/InspectedGlyph/InspectedGlyph.tsx +0 -46
- package/dist/starters/preact/design-system/components/Content/PartnerLogo/PartnerLogo.ads.scenario.tsx +0 -17
- package/dist/starters/preact/design-system/components/Content/PartnerLogo/PartnerLogo.tsx +0 -41
- package/dist/starters/preact/design-system/components/Content/StatusIcon/StatusIcon.ads.scenario.tsx +0 -20
- package/dist/starters/preact/design-system/components/Content/StatusIcon/StatusIcon.tsx +0 -37
- package/dist/starters/preact/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/components/Forms/TextField/TextField.tsx +0 -173
- package/dist/starters/preact/design-system/components/Identity/Identity.ads.scenario.tsx +0 -13
- package/dist/starters/preact/design-system/components/Identity/Identity.tsx +0 -146
- package/dist/starters/preact/design-system/components/Overlays/Menu/Menu.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/components/Overlays/Menu/Menu.tsx +0 -194
- package/dist/starters/preact/design-system/components/Overlays/Popover/Popover.ads.scenario.tsx +0 -19
- package/dist/starters/preact/design-system/components/Overlays/Popover/Popover.tsx +0 -37
- package/dist/starters/preact/design-system/controllers/FormField/FormField.ads.behavior.ts +0 -70
- package/dist/starters/preact/design-system/controllers/FormField/FormField.behavior.spec.ts +0 -237
- package/dist/starters/preact/design-system/controllers/FormField/FormField.ts +0 -343
- package/dist/starters/preact/design-system/controllers/FormField/useFormField.ts +0 -70
- package/dist/starters/preact/design-system/controllers/Palette/Palette.ts +0 -165
- package/dist/starters/preact/design-system/foundation.ads.ts +0 -22
- package/dist/starters/preact/design-system/index.ts +0 -51
- package/dist/starters/preact/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.fixture.ts +0 -5
- package/dist/starters/preact/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/mocks/Inspector/Inspector.ads.fixture.ts +0 -12
- package/dist/starters/preact/design-system/mocks/Inspector/Inspector.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/mocks/Workspace/Layouts.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/mocks/Workspace/Media.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/mocks/Workspace/Stress.ads.scenario.tsx +0 -36
- package/dist/starters/preact/design-system/mocks/Workspace/Workspace.ads.fixture.ts +0 -13
- package/dist/starters/preact/design-system/mocks/Workspace/Workspace.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/mocks/Workspace/media/ads.svg +0 -1
- package/dist/starters/preact/design-system/palette.generated.ts +0 -188
- package/dist/starters/preact/design-system/patterns/ArtworkCatalogue/ArtworkCatalogue/ArtworkCatalogue.tsx +0 -73
- package/dist/starters/preact/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.ads.scenario.tsx +0 -23
- package/dist/starters/preact/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.tsx +0 -94
- package/dist/starters/preact/design-system/patterns/Forms/InviteMember/InviteMember.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/patterns/Forms/InviteMember/InviteMember.tsx +0 -137
- package/dist/starters/preact/design-system/patterns/Inspector/Inspector/Inspector.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/patterns/Inspector/Inspector/Inspector.tsx +0 -248
- package/dist/starters/preact/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -26
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -268
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/Workspace.ads.scenario.tsx +0 -28
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/Workspace.tsx +0 -105
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/WorkspacePanels.tsx +0 -179
- package/dist/starters/preact/design-system/profiles/Containers/containers.ads.ts +0 -67
- package/dist/starters/preact/design-system/profiles/Containers/frames.ads.ts +0 -32
- package/dist/starters/preact/design-system/profiles/Containers/geometry.ads.ts +0 -30
- package/dist/starters/preact/design-system/profiles/Containers/spacing.ads.ts +0 -26
- package/dist/starters/preact/design-system/profiles/Controls/controls.ads.ts +0 -157
- package/dist/starters/preact/design-system/profiles/Controls/frames.ads.ts +0 -50
- package/dist/starters/preact/design-system/profiles/Controls/spacing.ads.ts +0 -29
- package/dist/starters/preact/design-system/profiles/Focus/keyboard.ads.ts +0 -13
- package/dist/starters/preact/design-system/profiles/Identity/identity.ads.ts +0 -25
- package/dist/starters/preact/design-system/profiles/Identity/spacing.ads.ts +0 -22
- package/dist/starters/preact/design-system/profiles/Layout/grid.ads.ts +0 -69
- package/dist/starters/preact/design-system/profiles/Layout/inspector.ads.ts +0 -146
- package/dist/starters/preact/design-system/profiles/Layout/overlays.ads.ts +0 -94
- package/dist/starters/preact/design-system/profiles/Layout/regions.ads.ts +0 -296
- package/dist/starters/preact/design-system/profiles/Motion/feedback.ads.ts +0 -92
- package/dist/starters/preact/design-system/profiles/Surfaces/controls.ads.ts +0 -142
- package/dist/starters/preact/design-system/profiles/Surfaces/document.ads.ts +0 -2
- package/dist/starters/preact/design-system/profiles/Surfaces/materials.ads.ts +0 -18
- package/dist/starters/preact/design-system/profiles/Surfaces/surfaces.ads.ts +0 -48
- package/dist/starters/preact/design-system/profiles/Typography/details.ads.ts +0 -19
- package/dist/starters/preact/design-system/profiles/Typography/document.ads.ts +0 -2
- package/dist/starters/preact/design-system/profiles/Typography/headings.ads.ts +0 -15
- package/dist/starters/preact/design-system/profiles/Typography/text.ads.ts +0 -73
- package/dist/starters/preact/design-system/profiles/Visuals/artwork.ads.ts +0 -46
- package/dist/starters/preact/design-system/profiles/Visuals/charts.ads.ts +0 -31
- package/dist/starters/preact/design-system/profiles/Visuals/content.ads.ts +0 -52
- package/dist/starters/preact/design-system/profiles/Visuals/glyphs.ads.ts +0 -35
- package/dist/starters/preact/design-system/profiles/Visuals/identity.ads.ts +0 -24
- package/dist/starters/preact/design-system/tokens/Artwork/paint.ads.css +0 -7
- package/dist/starters/preact/design-system/tokens/Artwork/visual-size.ads.css +0 -12
- package/dist/starters/preact/design-system/tokens/Brand/paint.ads.css +0 -7
- package/dist/starters/preact/design-system/tokens/Charts/paint.ads.css +0 -19
- package/dist/starters/preact/design-system/tokens/Containers/border-width.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Containers/content-gap.ads.css +0 -5
- package/dist/starters/preact/design-system/tokens/Containers/frame-inset.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Containers/frame-size.ads.css +0 -11
- package/dist/starters/preact/design-system/tokens/Containers/radius.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Controls/border-width.ads.css +0 -4
- package/dist/starters/preact/design-system/tokens/Controls/content-gap.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Controls/control-min-size.ads.css +0 -17
- package/dist/starters/preact/design-system/tokens/Controls/frame-inset.ads.css +0 -21
- package/dist/starters/preact/design-system/tokens/Controls/radius.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Controls/target-min-size.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Controls/visual-size.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Focus/border-width.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Focus/focus-offset.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Foundation/spacing.ads.css +0 -20
- package/dist/starters/preact/design-system/tokens/Grid/grid-gutter.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Grid/layer.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Grid/layout-size.ads.css +0 -15
- package/dist/starters/preact/design-system/tokens/Grid/spacing.ads.css +0 -12
- package/dist/starters/preact/design-system/tokens/Grid/track-count.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Identity/content-gap.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Identity/visual-size.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Motion/duration.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Motion/easing.ads.css +0 -5
- package/dist/starters/preact/design-system/tokens/Motion/motion-angle.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Motion/motion-distance.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Motion/motion-scale.ads.css +0 -9
- package/dist/starters/preact/design-system/tokens/Surfaces/blur.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/gradient.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/opacity.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/paint.ads.css +0 -58
- package/dist/starters/preact/design-system/tokens/Surfaces/shadow.ads.css +0 -20
- package/dist/starters/preact/design-system/tokens/Typography/font-family.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-features.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-size.ads.css +0 -9
- package/dist/starters/preact/design-system/tokens/Typography/font-stretch.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-variations.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-weight.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/letter-spacing.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/line-height.ads.css +0 -11
- package/dist/starters/preact/design-system/tokens/Typography/word-spacing.ads.css +0 -1
- package/dist/starters/preact/starter.json +0 -11
- package/dist/starters/react/design-system/assets/avatars/avatar.ads.ts +0 -10
- package/dist/starters/react/design-system/assets/avatars/member.svg +0 -1
- package/dist/starters/react/design-system/assets/brand/emblem.ads.ts +0 -18
- package/dist/starters/react/design-system/assets/brand/emblem.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/iris-emblem.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/brand/iris-emblem.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/mark.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/brand/mark.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/arrow.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/glyphs/arrow.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-20.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-24.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron.ads.ts +0 -20
- package/dist/starters/react/design-system/assets/glyphs/close.ads.ts +0 -13
- package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/favorite.ads.ts +0 -23
- package/dist/starters/react/design-system/assets/glyphs/favorite.normal.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/favorite.selected.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/search.ads.ts +0 -10
- package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/react/design-system/assets/illustrations/journey.ads.ts +0 -32
- package/dist/starters/react/design-system/assets/illustrations/journey.contrast.svg +0 -6
- package/dist/starters/react/design-system/assets/illustrations/journey.dark.svg +0 -13
- package/dist/starters/react/design-system/assets/illustrations/journey.light.svg +0 -13
- package/dist/starters/react/design-system/assets/logos/harbor-pay.ads.ts +0 -17
- package/dist/starters/react/design-system/assets/logos/harbor-pay.dark.svg +0 -10
- package/dist/starters/react/design-system/assets/logos/harbor-pay.light.svg +0 -10
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.ads.ts +0 -15
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.dark.svg +0 -9
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.light.svg +0 -9
- package/dist/starters/react/design-system/assets/status/error.svg +0 -1
- package/dist/starters/react/design-system/assets/status/outcomes.ads.ts +0 -31
- package/dist/starters/react/design-system/assets/status/status.ads.ts +0 -16
- package/dist/starters/react/design-system/assets/status/success.svg +0 -1
- package/dist/starters/react/design-system/assets/status/sync-status.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/status/sync-status.svg +0 -7
- package/dist/starters/react/design-system/assets/status/warning.svg +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -198
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -95
- package/dist/starters/react/design-system/components/Actions/ToggleTile/ToggleTile.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/components/Actions/ToggleTile/ToggleTile.tsx +0 -60
- package/dist/starters/react/design-system/components/Containers/Disclosure/Disclosure.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/components/Containers/Disclosure/Disclosure.tsx +0 -50
- package/dist/starters/react/design-system/components/Content/Artwork/Artwork.ads.scenario.tsx +0 -8
- package/dist/starters/react/design-system/components/Content/Artwork/Artwork.tsx +0 -110
- package/dist/starters/react/design-system/components/Content/BarChart/BarChart.ads.scenario.tsx +0 -25
- package/dist/starters/react/design-system/components/Content/BarChart/BarChart.tsx +0 -72
- package/dist/starters/react/design-system/components/Content/GuideGrid/GuideGrid.ads.scenario.tsx +0 -8
- package/dist/starters/react/design-system/components/Content/GuideGrid/GuideGrid.tsx +0 -43
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -41
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/arrow.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/close.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/search.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -9
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -83
- package/dist/starters/react/design-system/components/Content/InspectedGlyph/InspectedGlyph.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/components/Content/InspectedGlyph/InspectedGlyph.tsx +0 -46
- package/dist/starters/react/design-system/components/Content/PartnerLogo/PartnerLogo.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Content/PartnerLogo/PartnerLogo.tsx +0 -41
- package/dist/starters/react/design-system/components/Content/StatusIcon/StatusIcon.ads.scenario.tsx +0 -20
- package/dist/starters/react/design-system/components/Content/StatusIcon/StatusIcon.tsx +0 -37
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -173
- package/dist/starters/react/design-system/components/Identity/Identity.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Identity/Identity.tsx +0 -146
- package/dist/starters/react/design-system/components/Overlays/Menu/Menu.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/components/Overlays/Menu/Menu.tsx +0 -194
- package/dist/starters/react/design-system/components/Overlays/Popover/Popover.ads.scenario.tsx +0 -19
- package/dist/starters/react/design-system/components/Overlays/Popover/Popover.tsx +0 -37
- package/dist/starters/react/design-system/controllers/FormField/FormField.ads.behavior.ts +0 -70
- package/dist/starters/react/design-system/controllers/FormField/FormField.behavior.spec.ts +0 -237
- package/dist/starters/react/design-system/controllers/FormField/FormField.ts +0 -343
- package/dist/starters/react/design-system/controllers/FormField/useFormField.ts +0 -70
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -165
- package/dist/starters/react/design-system/foundation.ads.ts +0 -22
- package/dist/starters/react/design-system/index.ts +0 -51
- package/dist/starters/react/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/mocks/Inspector/Inspector.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/mocks/Inspector/Inspector.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/mocks/Workspace/Layouts.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/mocks/Workspace/Media.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/mocks/Workspace/Stress.ads.scenario.tsx +0 -36
- package/dist/starters/react/design-system/mocks/Workspace/Workspace.ads.fixture.ts +0 -13
- package/dist/starters/react/design-system/mocks/Workspace/Workspace.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/mocks/Workspace/media/ads.svg +0 -1
- package/dist/starters/react/design-system/palette.generated.ts +0 -188
- package/dist/starters/react/design-system/patterns/ArtworkCatalogue/ArtworkCatalogue/ArtworkCatalogue.tsx +0 -73
- package/dist/starters/react/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.ads.scenario.tsx +0 -23
- package/dist/starters/react/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.tsx +0 -94
- package/dist/starters/react/design-system/patterns/Forms/InviteMember/InviteMember.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Forms/InviteMember/InviteMember.tsx +0 -137
- package/dist/starters/react/design-system/patterns/Inspector/Inspector/Inspector.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/patterns/Inspector/Inspector/Inspector.tsx +0 -248
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -26
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -268
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/Workspace.ads.scenario.tsx +0 -28
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/Workspace.tsx +0 -105
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/WorkspacePanels.tsx +0 -179
- package/dist/starters/react/design-system/profiles/Containers/containers.ads.ts +0 -67
- package/dist/starters/react/design-system/profiles/Containers/frames.ads.ts +0 -32
- package/dist/starters/react/design-system/profiles/Containers/geometry.ads.ts +0 -30
- package/dist/starters/react/design-system/profiles/Containers/spacing.ads.ts +0 -26
- package/dist/starters/react/design-system/profiles/Controls/controls.ads.ts +0 -157
- package/dist/starters/react/design-system/profiles/Controls/frames.ads.ts +0 -50
- package/dist/starters/react/design-system/profiles/Controls/spacing.ads.ts +0 -29
- package/dist/starters/react/design-system/profiles/Focus/keyboard.ads.ts +0 -13
- package/dist/starters/react/design-system/profiles/Identity/identity.ads.ts +0 -25
- package/dist/starters/react/design-system/profiles/Identity/spacing.ads.ts +0 -22
- package/dist/starters/react/design-system/profiles/Layout/grid.ads.ts +0 -69
- package/dist/starters/react/design-system/profiles/Layout/inspector.ads.ts +0 -146
- package/dist/starters/react/design-system/profiles/Layout/overlays.ads.ts +0 -94
- package/dist/starters/react/design-system/profiles/Layout/regions.ads.ts +0 -296
- package/dist/starters/react/design-system/profiles/Motion/feedback.ads.ts +0 -92
- package/dist/starters/react/design-system/profiles/Surfaces/controls.ads.ts +0 -142
- package/dist/starters/react/design-system/profiles/Surfaces/document.ads.ts +0 -2
- package/dist/starters/react/design-system/profiles/Surfaces/materials.ads.ts +0 -18
- package/dist/starters/react/design-system/profiles/Surfaces/surfaces.ads.ts +0 -48
- package/dist/starters/react/design-system/profiles/Typography/details.ads.ts +0 -19
- package/dist/starters/react/design-system/profiles/Typography/document.ads.ts +0 -2
- package/dist/starters/react/design-system/profiles/Typography/headings.ads.ts +0 -15
- package/dist/starters/react/design-system/profiles/Typography/text.ads.ts +0 -73
- package/dist/starters/react/design-system/profiles/Visuals/artwork.ads.ts +0 -46
- package/dist/starters/react/design-system/profiles/Visuals/charts.ads.ts +0 -31
- package/dist/starters/react/design-system/profiles/Visuals/content.ads.ts +0 -52
- package/dist/starters/react/design-system/profiles/Visuals/glyphs.ads.ts +0 -35
- package/dist/starters/react/design-system/profiles/Visuals/identity.ads.ts +0 -24
- package/dist/starters/react/design-system/tokens/Artwork/paint.ads.css +0 -7
- package/dist/starters/react/design-system/tokens/Artwork/visual-size.ads.css +0 -12
- package/dist/starters/react/design-system/tokens/Brand/paint.ads.css +0 -7
- package/dist/starters/react/design-system/tokens/Charts/paint.ads.css +0 -19
- package/dist/starters/react/design-system/tokens/Containers/border-width.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Containers/content-gap.ads.css +0 -5
- package/dist/starters/react/design-system/tokens/Containers/frame-inset.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Containers/frame-size.ads.css +0 -11
- package/dist/starters/react/design-system/tokens/Containers/radius.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Controls/border-width.ads.css +0 -4
- package/dist/starters/react/design-system/tokens/Controls/content-gap.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Controls/control-min-size.ads.css +0 -17
- package/dist/starters/react/design-system/tokens/Controls/frame-inset.ads.css +0 -21
- package/dist/starters/react/design-system/tokens/Controls/radius.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Controls/target-min-size.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Controls/visual-size.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Focus/border-width.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Focus/focus-offset.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Foundation/spacing.ads.css +0 -20
- package/dist/starters/react/design-system/tokens/Grid/grid-gutter.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Grid/layer.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Grid/layout-size.ads.css +0 -15
- package/dist/starters/react/design-system/tokens/Grid/spacing.ads.css +0 -12
- package/dist/starters/react/design-system/tokens/Grid/track-count.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Identity/content-gap.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Identity/visual-size.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Motion/duration.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Motion/easing.ads.css +0 -5
- package/dist/starters/react/design-system/tokens/Motion/motion-angle.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Motion/motion-distance.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Motion/motion-scale.ads.css +0 -9
- package/dist/starters/react/design-system/tokens/Surfaces/blur.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/gradient.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/opacity.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/paint.ads.css +0 -58
- package/dist/starters/react/design-system/tokens/Surfaces/shadow.ads.css +0 -20
- package/dist/starters/react/design-system/tokens/Typography/font-family.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-features.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-size.ads.css +0 -9
- package/dist/starters/react/design-system/tokens/Typography/font-stretch.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-variations.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-weight.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/letter-spacing.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/line-height.ads.css +0 -11
- package/dist/starters/react/design-system/tokens/Typography/word-spacing.ads.css +0 -1
- package/dist/starters/react/starter.json +0 -11
- package/docs/STARTER.md +0 -167
package/dist/motion-model.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import { check, rejecting } from "./design-rejection.mjs";
|
|
|
2
2
|
const OPERATIONS = {
|
|
3
3
|
"translate-inline": { channel: "translate", field: "distance", neutral: 0 },
|
|
4
4
|
scale: { channel: "scale", field: "scale", neutral: 1 },
|
|
5
|
+
"scale-inline": { channel: "scale", field: "scale", neutral: 1 },
|
|
6
|
+
"scale-block": { channel: "scale", field: "scale", neutral: 1 },
|
|
5
7
|
rotate: { channel: "rotate", field: "angle", neutral: 0 }
|
|
6
|
-
}, isProperty = (value) => Object.hasOwn(OPERATIONS, value), CHANNELS = ["translate", "scale", "rotate"], CONDITIONS = new Set(["&:hover:not(:disabled)", "&:active:not(:disabled)", '&[aria-busy="true"]']), declarationsOf = (node) => (node.nodes ?? []).filter((child) => child.type === "decl");
|
|
8
|
+
}, isProperty = (value) => Object.hasOwn(OPERATIONS, value), CHANNELS = ["translate", "scale", "rotate"], CONDITIONS = new Set(["&:hover:not(:disabled)", "&:active:not(:disabled)", '&[aria-busy="true"]', '&[aria-expanded="true"]', '&[aria-pressed="true"]', '&[aria-checked="true"]', '&[aria-selected="true"]']), declarationsOf = (node) => (node.nodes ?? []).filter((child) => child.type === "decl");
|
|
7
9
|
export const inspectMotion = (part, motionProfiles, { complete = !0 } = {}) => rejecting(() => {
|
|
8
10
|
const children = part.nodes ?? [], transitions = children.filter((node) => node.type === "decl" && node.prop === "transition"), whens = children.filter((node) => node.type === "atrule" && node.name === "ads-when" && declarationsOf(node).some((field) => isProperty(field.prop) || field.prop === "repeat"));
|
|
9
11
|
if (transitions.length === 0 && whens.length === 0)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { currentAnalysis, memoFact, memoProgram } from "./analysis/context.mjs";
|
|
3
|
-
import { optionalSourceText } from "./analysis/helpers.mjs";
|
|
4
|
-
import { projectOwnerCache, projectScenarioCache } from "./analysis/owner-analysis-cache.mjs";
|
|
3
|
+
import { capturedTreeFiles, optionalSourceText } from "./analysis/helpers.mjs";
|
|
4
|
+
import { projectConstructionCache, projectOwnerCache, projectScenarioCache } from "./analysis/owner-analysis-cache.mjs";
|
|
5
|
+
import { wholeDesignDigests } from "./analysis/design-reads.mjs";
|
|
6
|
+
import { scenarioWork } from "./analysis/scenario-keys.mjs";
|
|
5
7
|
import { designDigests } from "./analysis/owner-analysis-key.mjs";
|
|
6
8
|
import { barrelDeclarations, checkDesignSystem } from "./analysis/owner-discovery.mjs";
|
|
7
9
|
import { ownerReuse } from "./analysis/owner-reuse.mjs";
|
|
@@ -23,7 +25,7 @@ import { tokenChecks } from "./token-checks.mjs";
|
|
|
23
25
|
import { describeTokenProvenance } from "./token-provenance.mjs";
|
|
24
26
|
import { describeTokenType } from "./token-type-check.mjs";
|
|
25
27
|
import { describeTokenSheet } from "./token-sheet-check.mjs";
|
|
26
|
-
import { describeSurfaceContrast, describeUnresolved } from "./surface-contrast.mjs";
|
|
28
|
+
import { describeSurfaceContrast, describeUnresolved, sufficientForUses } from "./surface-contrast.mjs";
|
|
27
29
|
import { describeFocus, focusChecks } from "./focus-checks.mjs";
|
|
28
30
|
import { NO_TARGETS, targetSizeFindings } from "./target-size.mjs";
|
|
29
31
|
import { describeTokenOverlap } from "./token-overlap.mjs";
|
|
@@ -32,6 +34,8 @@ import { describeFont, fontChecks } from "./font-checks.mjs";
|
|
|
32
34
|
import { appIconAssets, appIconPath, appIconPlan, appIconRule, describeAppIcon } from "./app-icon-checks.mjs";
|
|
33
35
|
import { maskableFindings } from "./emit/app-icon-render.mjs";
|
|
34
36
|
import { composedContrastFindings, composedRepair, describeComposedContrast } from "./composed-contrast.mjs";
|
|
37
|
+
import { composedKeylineFindings, keylineRepairs } from "./composed-keyline.mjs";
|
|
38
|
+
import { unreachedSources } from "./unreached-sources.mjs";
|
|
35
39
|
export const OWNER_ANALYSIS_RULE = "owner-analysis", OWNER_BLOCKED_RULE = "owner-analysis-blocked";
|
|
36
40
|
export { FOUNDATION_DECLARATION } from "./design-contexts.mjs";
|
|
37
41
|
export const OWNER_REVIEW_RULE = "owner-analysis-review";
|
|
@@ -45,6 +49,7 @@ const ACCESSIBILITY_RULES = new Map([
|
|
|
45
49
|
["construction/accessibility-declaration-unmet", "a11y-non-text-contrast"]
|
|
46
50
|
]), ACCESSIBILITY_REVIEWS = new Map([
|
|
47
51
|
["review/click-without-keyboard", "a11y-keyboard"],
|
|
52
|
+
["review/motion-endless", "a11y-motion-endless"],
|
|
48
53
|
["review/target-size-unresolved", "a11y-target-size-unresolved"],
|
|
49
54
|
["review/target-area-overlap-unresolved", "a11y-target-size-unresolved"]
|
|
50
55
|
]), ownerRule = (code) => ACCESSIBILITY_RULES.get(code) ?? OWNER_ANALYSIS_RULE, reviewRule = (code) => ACCESSIBILITY_REVIEWS.get(code) ?? OWNER_REVIEW_RULE, TOKEN_CHECK_GUIDES = {
|
|
@@ -59,6 +64,7 @@ const ACCESSIBILITY_RULES = new Map([
|
|
|
59
64
|
"a11y-focus-unresolved": "ads://guides/accessibility",
|
|
60
65
|
"surface-contrast": "ads://guides/accessibility",
|
|
61
66
|
"surface-contrast-unresolved": "ads://guides/accessibility",
|
|
67
|
+
"surface-contrast-placed": "ads://guides/accessibility",
|
|
62
68
|
"token-overlap-review": "ads://guides/tokens",
|
|
63
69
|
"spatial-profile-invalid": "ads://guides/layout",
|
|
64
70
|
"spatial-context-unsupported": "ads://guides/layout"
|
|
@@ -111,7 +117,14 @@ async function analyzeRevision(inputs, captured, settings) {
|
|
|
111
117
|
const reads = designInputs.stats.reads, design = timing.timeStage("design-inputs", () => designInputs.read(captured, settings), void 0, () => ({ reused: designInputs.stats.reads === reads }));
|
|
112
118
|
if (design.kind === "err")
|
|
113
119
|
return { report: { diagnostics: findingsOf(inputs, { kind: "design-inputs", failure: design.error }), advisories: [], contexts: [], palette: [], tokens: [], fonts: [], appIcon: [], assets: [], composed: [], packages: [] }, checked: null };
|
|
114
|
-
const { foundation, assets, contexts } = design.value, texts = designTexts(captured), contextFindings = design.value.undefinedContexts.map((item) => undefinedContextFinding(inputs, texts, item)), palette = paletteFindings(inputs, foundation, contexts, design.value.palette), tokens = timing.timeStage("token-checks", () => tokenFindings(inputs, texts, foundation, design.value.document)), missing = missingTokenFindings(inputs, texts, foundation), fonts = timing.timeStage("font-checks", () => fontFindings(inputs, texts, foundation, design.value.document, design.value.fonts)), icon = await timing.timeStage("app-icon-checks", () => appIconReading(design.value.appIcon, { assets, foundation, contexts })), appIcon = icon.findings.map((finding) => appIconFinding(inputs, texts, finding)),
|
|
120
|
+
const { foundation, assets, contexts } = design.value, texts = designTexts(captured), contextFindings = design.value.undefinedContexts.map((item) => undefinedContextFinding(inputs, texts, item)), palette = paletteFindings(inputs, foundation, contexts, design.value.palette), tokens = timing.timeStage("token-checks", () => tokenFindings(inputs, texts, foundation, design.value.document)), missing = missingTokenFindings(inputs, texts, foundation), fonts = timing.timeStage("font-checks", () => fontFindings(inputs, texts, foundation, design.value.document, design.value.fonts)), icon = await timing.timeStage("app-icon-checks", () => appIconReading(design.value.appIcon, { assets, foundation, contexts })), appIcon = icon.findings.map((finding) => appIconFinding(inputs, texts, finding)), digests = designDigests(texts, assets, inputs.dsRoot), constructions = {
|
|
121
|
+
cache: projectConstructionCache(inputs.cacheOwner),
|
|
122
|
+
root: inputs.dsRoot,
|
|
123
|
+
catalog: assets,
|
|
124
|
+
whole: wholeDesignDigests(foundation, digests.assets),
|
|
125
|
+
tokens: digests.tokens,
|
|
126
|
+
tally: { reused: 0, built: 0 }
|
|
127
|
+
}, reuse = ownerReuse({
|
|
115
128
|
cache: projectOwnerCache(inputs.cacheOwner),
|
|
116
129
|
scenarios: projectScenarioCache(inputs.cacheOwner),
|
|
117
130
|
root: inputs.dsRoot,
|
|
@@ -119,7 +132,8 @@ async function analyzeRevision(inputs, captured, settings) {
|
|
|
119
132
|
framework: inputs.framework ?? null,
|
|
120
133
|
contexts,
|
|
121
134
|
foundation,
|
|
122
|
-
|
|
135
|
+
assets,
|
|
136
|
+
design: digests,
|
|
123
137
|
environment: revisionEnvironment()
|
|
124
138
|
}), options = {
|
|
125
139
|
foundation,
|
|
@@ -131,8 +145,12 @@ async function analyzeRevision(inputs, captured, settings) {
|
|
|
131
145
|
publicAlias: inputs.publicAlias,
|
|
132
146
|
framework: inputs.framework ?? null,
|
|
133
147
|
stats: analysis,
|
|
134
|
-
cache: extractionCache(inputs.cacheOwner, inputs.cacheLimits)
|
|
135
|
-
|
|
148
|
+
cache: extractionCache(inputs.cacheOwner, inputs.cacheLimits),
|
|
149
|
+
constructions
|
|
150
|
+
}, styling = { ...scenarioWork.styling }, analyzed = await checkDesignSystem(inputs.dsRoot, options, reuse.owners);
|
|
151
|
+
timing.recordStage("construction-reuse", 0, { ...constructions.tally });
|
|
152
|
+
timing.recordStage("scenario-styling", 0, { computed: scenarioWork.styling.computed - styling.computed, reused: scenarioWork.styling.reused - styling.reused });
|
|
153
|
+
const tally = reuse.tally();
|
|
136
154
|
owners.last = tally;
|
|
137
155
|
if (tally !== null) {
|
|
138
156
|
owners.analyzed += tally.analyzed.length;
|
|
@@ -140,9 +158,12 @@ async function analyzeRevision(inputs, captured, settings) {
|
|
|
140
158
|
}
|
|
141
159
|
if (analyzed.kind === "err")
|
|
142
160
|
return { report: { diagnostics: distinct([...missing, ...findingsOf(inputs, { kind: "owner", failure: analyzed.error })]), advisories: [], contexts: contextFindings, palette, tokens, fonts, appIcon, assets: [], composed: [], packages: [] }, checked: null };
|
|
143
|
-
const iconAssets = design.value.appIcon === null ? [] : appIconAssets(design.value.appIcon, assets), composed =
|
|
161
|
+
const iconAssets = design.value.appIcon === null ? [] : appIconAssets(design.value.appIcon, assets), composed = [
|
|
162
|
+
...await timing.timeStage("composed-contrast", () => composedFindings(inputs, texts, analyzed.value, foundation, design.value.document)),
|
|
163
|
+
...timing.timeStage("composed-keyline", () => keylineFindings(inputs, analyzed.value, foundation))
|
|
164
|
+
], checkedFindings = checkFindings(inputs, analyzed.value), released = releasedSurfaces(foundation, analyzed.value, design.value.document), usedTokens = released.size === 0 ? tokens : tokenFindings(inputs, texts, foundation, design.value.document, released);
|
|
144
165
|
return {
|
|
145
|
-
report: { ...checkedFindings, diagnostics: distinct([...missing, ...checkedFindings.diagnostics]), contexts: contextFindings, palette, tokens, fonts, appIcon, assets: assetFindings(inputs, texts, assets, analyzed.value, iconAssets), composed, packages: packageFindings(inputs, analyzed.value) },
|
|
166
|
+
report: { ...checkedFindings, diagnostics: distinct([...missing, ...checkedFindings.diagnostics]), contexts: contextFindings, palette, tokens: usedTokens, fonts, appIcon, assets: [...assetFindings(inputs, texts, assets, analyzed.value, iconAssets), ...unreachedFindings(inputs, analyzed.value)], composed, packages: packageFindings(inputs, analyzed.value) },
|
|
146
167
|
checked: { check: analyzed.value, contexts, foundation, document: design.value.document, assets, fonts: design.value.fonts, appIcon: icon.plan, keys: new Map(reuse.keys()), options, tally }
|
|
147
168
|
};
|
|
148
169
|
}
|
|
@@ -193,6 +214,24 @@ function assetFindings(inputs, captured, catalog, check, iconAssets) {
|
|
|
193
214
|
const icon = { assets: iconAssets, sets: [], glyphs: [] };
|
|
194
215
|
return unusedArtwork(catalog, [...owners, ...[...check.plain.values()].map((module) => module.artwork), icon]).map((item) => unusedFinding(inputs, captured, item));
|
|
195
216
|
}
|
|
217
|
+
function unreachedFindings(inputs, check) {
|
|
218
|
+
const plainModules = [...check.graph.modules.values()].filter((module) => module.role !== "owner").length;
|
|
219
|
+
if ([...check.outcomes.values()].some((outcome) => outcome.kind !== "analyzed") || check.plain.size !== plainModules)
|
|
220
|
+
return [];
|
|
221
|
+
const captured = capturedTreeFiles(inputs.dsRoot);
|
|
222
|
+
if (captured === null)
|
|
223
|
+
return [];
|
|
224
|
+
const files = captured.map((file) => path.relative(inputs.dsRoot, file).replaceAll("\\", "/")).filter((file) => !file.startsWith(".."));
|
|
225
|
+
return unreachedSources(files, check.graph).map((file) => ({
|
|
226
|
+
rule: "source-unreached",
|
|
227
|
+
severity: findingSeverity("source-unreached"),
|
|
228
|
+
file: projectFile(inputs, path.join(inputs.dsRoot, file)),
|
|
229
|
+
line: 1,
|
|
230
|
+
column: 1,
|
|
231
|
+
message: `${file} is not reached from the design system's public entry: no exported owner imports it, so ADS checks nothing in it and emits nothing from it. Export it from the entry, import it from an owner that is exported, or delete it; leave it only if it is outside the entry on purpose.`,
|
|
232
|
+
guidanceUri: "ads://guides/layers"
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
196
235
|
function unusedFinding(inputs, captured, item) {
|
|
197
236
|
const at = sitePositionIn(inputs, (name) => captured.get(name) ?? null, { kind: "macro-field", file: item.site.file, macro: item.site.macro, declaration: item.site.declaration, path: ["name"] }), what = (() => {
|
|
198
237
|
switch (item.kind) {
|
|
@@ -236,13 +275,28 @@ function paletteFindings(inputs, foundation, contexts, declared) {
|
|
|
236
275
|
function missingTokenFindings(inputs, captured, foundation) {
|
|
237
276
|
return tokenChecks(foundation).missing.map((failure) => finding(ownerError({ kind: "token-css", owner: inputs.dsRoot, failure }), failure.reference === null ? foundationPosition(inputs) : { file: projectFile(inputs, path.join(inputs.dsRoot, failure.reference.file)), ...offsetPosition(captured.get(failure.reference.file) ?? null, failure.reference.offset) }));
|
|
238
277
|
}
|
|
239
|
-
|
|
278
|
+
const surfacePairKey = (finding) => JSON.stringify([finding.profile, finding.paints]);
|
|
279
|
+
function releasedSurfaces(foundation, check, document) {
|
|
280
|
+
const none = new Set, failing = tokenChecks(foundation).contrast.filter((finding) => finding.kind === "surface-contrast");
|
|
281
|
+
if (failing.length === 0 || [...check.outcomes.values()].some((outcome) => outcome.kind !== "analyzed"))
|
|
282
|
+
return none;
|
|
283
|
+
const uses = new Map, record = (use) => void uses.set(use.surface, [...uses.get(use.surface) ?? [], use]);
|
|
284
|
+
record({ surface: document.names.surface, content: "text", text: { fontSize: document.text.get("font-size") ?? null, fontWeight: document.text.get("font-weight") ?? null } });
|
|
285
|
+
for (const [, owner] of analyzedOwners(check.outcomes))
|
|
286
|
+
for (const style of owner.styles.values()) {
|
|
287
|
+
if (style.surfaceUses === void 0)
|
|
288
|
+
return none;
|
|
289
|
+
style.surfaceUses.forEach(record);
|
|
290
|
+
}
|
|
291
|
+
return new Set(failing.filter((finding) => sufficientForUses(foundation, finding.paints, [finding.profile, ...finding.shared].flatMap((name) => uses.get(name) ?? []))).map(surfacePairKey));
|
|
292
|
+
}
|
|
293
|
+
function tokenFindings(inputs, captured, foundation, document, released = new Set) {
|
|
240
294
|
const report = tokenChecks(foundation), text = (name) => captured.get(name) ?? null, atSheet = (site) => site === null ? foundationPosition(inputs) : { file: projectFile(inputs, path.join(inputs.dsRoot, site.file)), ...offsetPosition(text(site.file), site.offset) }, atProfile = (file, profile) => file === null ? foundationPosition(inputs) : { file: projectFile(inputs, path.join(inputs.dsRoot, file)), ...offsetPosition(text(file), profileOffset(text(file), profile)) }, located = (rule, position, message) => ({ rule, severity: findingSeverity(rule), ...position, message, guidanceUri: TOKEN_CHECK_GUIDES[rule] });
|
|
241
295
|
return [
|
|
242
296
|
...report.sheets.map((finding) => located(finding.kind, atSheet(finding.site), describeTokenSheet(finding))),
|
|
243
297
|
...report.types.filter((finding) => finding.kind !== "token-type-unresolved" || finding.missingTokens === void 0).map((finding) => located(tokenTypeRule(finding), atSheet(finding.site), describeTokenType(finding))),
|
|
244
298
|
...report.provenance.map((finding) => located(finding.kind, atSheet(finding.site), describeTokenProvenance(finding))),
|
|
245
|
-
...report.contrast.map((finding) => located(finding.kind, atProfile(finding.file, finding.profile), describeSurfaceContrast(finding))),
|
|
299
|
+
...report.contrast.filter((finding) => !released.has(surfacePairKey(finding))).map((finding) => located(finding.kind, atProfile(finding.file, finding.profile), describeSurfaceContrast(finding))),
|
|
246
300
|
...report.overlaps.map((finding) => located(finding.kind, atSheet(finding.site), describeTokenOverlap(finding))),
|
|
247
301
|
...focusChecks(foundation, document).map((finding) => located(focusRule(finding), atProfile(finding.file, finding.profile), describeFocus(finding, describeUnresolved))),
|
|
248
302
|
...gridChecks(foundation).map((finding) => located(finding.kind, atProfile(finding.file, finding.profile), describeGridCheck(finding)))
|
|
@@ -274,6 +328,24 @@ async function composedFindings(inputs, captured, check, foundation, document) {
|
|
|
274
328
|
return finding.kind === "component-contrast" ? { ...located, tokens: finding.tokens, contexts: finding.contexts, states: finding.states } : located;
|
|
275
329
|
});
|
|
276
330
|
}
|
|
331
|
+
function keylineFindings(inputs, check, foundation) {
|
|
332
|
+
const owners = new Map;
|
|
333
|
+
for (const [name, owner] of analyzedOwners(check.outcomes))
|
|
334
|
+
owners.set(name, owner.composition);
|
|
335
|
+
const at = (point) => ({ file: projectFile(inputs, path.join(inputs.dsRoot, point.file)), line: point.line, column: point.column }), px = (value) => `${Math.round(value * 100) / 100}px`;
|
|
336
|
+
return composedKeylineFindings({ foundation, owners }).map((finding) => {
|
|
337
|
+
const repair = keylineRepairs[finding.kind], message = finding.kind === "component-keyline" ? `<${finding.component}> is placed in a cell of a ${finding.gutter}-gutter grid, and its root frame ${finding.frame} starts its content ${px(finding.insetPx)} from the column line (the ${finding.gutter} gutter's start and its inline padding; borders are not counted), but the text keyline of this grid is ${px(finding.keylinePx)} (the wide gutter's start) under ${finding.context}: its text is ${px(Math.abs(finding.insetPx - finding.keylinePx))} ${finding.insetPx > finding.keylinePx ? "past" : "short of"} the keyline, more than the profile's fine unit (${px(finding.tolerancePx)}).` : `<${finding.component}> is placed in a cell of a ${finding.gutter}-gutter grid, but whether its content starts on the grid's text keyline cannot be proven: ${finding.reason}.`;
|
|
338
|
+
return {
|
|
339
|
+
rule: finding.kind,
|
|
340
|
+
severity: findingSeverity(finding.kind),
|
|
341
|
+
...at(finding.site),
|
|
342
|
+
message: `${message} ${repair}`,
|
|
343
|
+
repair,
|
|
344
|
+
guidanceUri: "ads://guides/layout",
|
|
345
|
+
related: finding.kind === "component-keyline" ? [{ ...at(finding.frameAt), message: `The root frame of <${finding.component}>: ${finding.frame}.` }] : []
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
}
|
|
277
349
|
function fontRule(finding) {
|
|
278
350
|
switch (finding.kind) {
|
|
279
351
|
case "font-weight-missing":
|
|
@@ -284,6 +356,8 @@ function fontRule(finding) {
|
|
|
284
356
|
case "font-family-unused":
|
|
285
357
|
case "font-face-unused":
|
|
286
358
|
return "font-unused";
|
|
359
|
+
case "font-fallback-unnamed":
|
|
360
|
+
return "font-fallback";
|
|
287
361
|
}
|
|
288
362
|
}
|
|
289
363
|
function fontFindingPath(finding) {
|
|
@@ -305,7 +379,7 @@ function fontFindings(inputs, captured, foundation, document, fonts) {
|
|
|
305
379
|
return composed.kind === "ok" ? composed.value.file ?? null : null;
|
|
306
380
|
};
|
|
307
381
|
return fontChecks({ foundation, document, fonts, budgetKb: inputs.fontBudgetKb, profileFile }).map((finding) => {
|
|
308
|
-
const rule = fontRule(finding), position = finding.kind === "font-weight-missing" ? finding.file === null ? foundationPosition(inputs) : { file: projectFile(inputs, path.join(inputs.dsRoot, finding.file)), ...offsetPosition(text(finding.file), profileOffset(text(finding.file), finding.profile)) } : sitePositionIn(inputs, text, { kind: "macro-field", file: finding.font.site.file, macro: "font", declaration: finding.font.site.declaration, path: fontFindingPath(finding) });
|
|
382
|
+
const rule = fontRule(finding), position = finding.kind === "font-weight-missing" ? finding.file === null ? foundationPosition(inputs) : { file: projectFile(inputs, path.join(inputs.dsRoot, finding.file)), ...offsetPosition(text(finding.file), profileOffset(text(finding.file), finding.profile)) } : finding.kind === "font-fallback-unnamed" ? { file: projectFile(inputs, path.join(inputs.dsRoot, finding.file)), ...offsetPosition(text(finding.file), Math.max(0, (text(finding.file) ?? "").search(new RegExp(`${finding.token}\\s*:`)))) } : sitePositionIn(inputs, text, { kind: "macro-field", file: finding.font.site.file, macro: "font", declaration: finding.font.site.declaration, path: fontFindingPath(finding) });
|
|
309
383
|
return { rule, severity: findingSeverity(rule), ...position, message: describeFont(finding), guidanceUri: "ads://guides/performance" };
|
|
310
384
|
});
|
|
311
385
|
}
|
package/dist/owner-errors.mjs
CHANGED
|
@@ -91,11 +91,12 @@ export function constructionError(failure) {
|
|
|
91
91
|
case "profile-kind":
|
|
92
92
|
case "profile-field-missing":
|
|
93
93
|
case "profile-field-unsupported":
|
|
94
|
+
case "surface-effect-misplaced":
|
|
95
|
+
case "surface-shadow-layer":
|
|
94
96
|
case "content-missing":
|
|
95
97
|
case "profile-provider-conflict":
|
|
96
|
-
case "parts-visual-repeated":
|
|
97
98
|
case "artwork-binding-missing":
|
|
98
|
-
case "paint-
|
|
99
|
+
case "artwork-paint-contrast-insufficient":
|
|
99
100
|
case "spatial-token-expected":
|
|
100
101
|
case "spatial-bound-unit":
|
|
101
102
|
case "spatial-clause-unsupported":
|
|
@@ -105,14 +106,31 @@ export function constructionError(failure) {
|
|
|
105
106
|
case "drawn-height-below-minimum":
|
|
106
107
|
case "paint-transition-redundant":
|
|
107
108
|
case "paint-transition-effect-unsupported":
|
|
109
|
+
case "prose-contrast-insufficient":
|
|
110
|
+
case "condition-visual-unsupported":
|
|
111
|
+
case "sequence-steps-invalid":
|
|
112
|
+
case "sequence-not-seamless":
|
|
113
|
+
case "sequence-step-field":
|
|
114
|
+
case "sequence-stagger-missing":
|
|
115
|
+
case "sequence-property-conflict":
|
|
116
|
+
case "state-text-field":
|
|
117
|
+
case "state-text-unbound":
|
|
118
|
+
case "outset-unsupported":
|
|
119
|
+
case "scheme-unsupported":
|
|
120
|
+
case "enter-surface-unsupported":
|
|
121
|
+
case "enter-property-conflict":
|
|
108
122
|
case "pseudo-surface-unsupported":
|
|
123
|
+
case "state-geometry-unsupported":
|
|
109
124
|
case "placeholder-contrast-insufficient":
|
|
110
125
|
case "placeholder-contrast-unresolved":
|
|
126
|
+
case "progress-contrast-insufficient":
|
|
127
|
+
case "progress-contrast-unresolved":
|
|
111
128
|
case "state-contrast-insufficient":
|
|
112
129
|
case "inactive-surface-active":
|
|
113
130
|
case "target-size-below-minimum":
|
|
114
131
|
case "target-area-overlap":
|
|
115
132
|
case "non-text-contrast-insufficient":
|
|
133
|
+
case "corner-overpaint":
|
|
116
134
|
case "accessibility-declaration-unmet":
|
|
117
135
|
case "layer-root-padding":
|
|
118
136
|
case "layer-frame-position":
|
package/dist/owner-lowering.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { BORDER_STYLE } from "./role-vocabulary.mjs";
|
|
1
2
|
import { reducedMotionPolicy } from "./lowering-motion.mjs";
|
|
2
3
|
import { attempt } from "./result.mjs";
|
|
3
4
|
import { tokenValueContexts } from "./design-foundation.mjs";
|
|
4
5
|
import { lengthPx } from "./css-length.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { inactiveCondition, NON_TEXT_MINIMUM, paintContrast } from "./paint-contrast.mjs";
|
|
7
|
+
import { normalizedDeclarations, scaleValue } from "./construction-spec.mjs";
|
|
8
|
+
import { frameValues } from "./region-lowering.mjs";
|
|
9
|
+
import { FRAME_INSET_FIELDS } from "./lowering-region-layout.mjs";
|
|
6
10
|
import {
|
|
7
11
|
HIT_AREA_FIELDS,
|
|
8
12
|
LIGHT,
|
|
@@ -21,8 +25,13 @@ import {
|
|
|
21
25
|
writeTransitions,
|
|
22
26
|
placed,
|
|
23
27
|
profiles,
|
|
24
|
-
visualPart
|
|
28
|
+
visualPart,
|
|
29
|
+
checkSurfaceEffects,
|
|
30
|
+
writeEnter,
|
|
31
|
+
writePlays,
|
|
32
|
+
writeStateText
|
|
25
33
|
} from "./construction-output.mjs";
|
|
34
|
+
import { settled } from "./lowering-enter.mjs";
|
|
26
35
|
function controlArrangement(spec) {
|
|
27
36
|
switch (spec.layout) {
|
|
28
37
|
case "inline":
|
|
@@ -44,45 +53,52 @@ export function controlEnvelope(spec, line, visual, gap) {
|
|
|
44
53
|
}
|
|
45
54
|
export function lowerControl(spec, foundation, input) {
|
|
46
55
|
return attempt((reject) => {
|
|
47
|
-
const profile = profiles(foundation, reject), selected = profile.select(spec.profile, spec.select), slots = Object.fromEntries(selected.fields), text = profile.of(slots["text-profile"], "text", spec.profile), frame = profile.of(slots["frame-profile"], "frame", spec.profile), spacing = profile.of(slots["spacing-profile"], "spacing", spec.profile), visual = profile.of(slots["visual-profile"], "visual", spec.profile), focus = profile.of(slots["focus-profile"], "focus", spec.profile), animated = spec.glyph !== null && (spec.glyph.transition.length > 0 || spec.glyph.when.length > 0), pressed = spec.press.when.length > 0, motion = animated || pressed || slots["motion-profile"] !== void 0 ? profile.of(slots["motion-profile"], "motion", spec.profile) : {};
|
|
56
|
+
const profile = profiles(foundation, reject), selected = profile.select(spec.profile, spec.select), slots = Object.fromEntries(selected.fields), text = profile.of(spec.text ?? slots["text-profile"], "text", spec.profile), frame = profile.of(slots["frame-profile"], "frame", spec.profile), spacing = profile.of(slots["spacing-profile"], "spacing", spec.profile), visual = profile.of(slots["visual-profile"], "visual", spec.profile), focus = profile.of(slots["focus-profile"], "focus", spec.profile), animated = spec.glyph !== null && (spec.glyph.transition.length > 0 || spec.glyph.when.length > 0) || spec.decor.some((box) => box.when.some(([, , effects]) => effects.length > 0)), pressed = spec.press.when.length > 0, motion = animated || pressed || slots["motion-profile"] !== void 0 ? profile.of(slots["motion-profile"], "motion", spec.profile) : {};
|
|
48
57
|
if (animated || pressed || slots["motion-profile"] !== void 0) {
|
|
49
58
|
const reduced = reducedMotionPolicy(motion.reduced);
|
|
50
59
|
if (reduced.kind === "unsupported")
|
|
51
60
|
return reject({ kind: "lowering", failure: { kind: "motion", error: { kind: "reduced-motion-unsupported", declared: reduced.declared } } });
|
|
52
61
|
checkMotion(spec.source, motion, reject);
|
|
53
62
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
writePaintTransition(out, profile, "&", spec.paintTransition, motionFields(spec.paintTransition.motion, slots, profile), surfaces, reject,
|
|
58
|
-
|
|
59
|
-
writeTransitions(out, "&",
|
|
60
|
-
|
|
63
|
+
checkSurfaceEffects(foundation, profile, [spec.surface, ...spec.when.map(([, name]) => name)], "container", reject);
|
|
64
|
+
const out = output(input.root, "lowerButton", reject, profile), press = writeRootPress(out, spec.press, motion, profile, reject), surfaces = { base: { name: spec.surface, fields: profile.of(spec.surface, "surface") }, states: spec.when.map(([, surface]) => ({ name: surface, fields: profile.of(surface, "surface") })) }, pressGroups = press === null ? [] : [press], entering = writeEnter(out, profile, "&", spec.enter, surfaces.base.fields, spec.when.map(([condition, surface]) => ({ selector: condition, fields: profile.of(surface, "surface") })), slots, [...spec.paintTransition?.channels ?? [], ...pressGroups.flatMap((group) => group.properties)], reject), groups = entering === null ? pressGroups : [...pressGroups, entering.group], blurred = entering?.blurred ?? !1;
|
|
65
|
+
if (spec.paintTransition !== null)
|
|
66
|
+
writePaintTransition(out, profile, "&", spec.paintTransition, motionFields(spec.paintTransition.motion, slots, profile), surfaces, reject, groups);
|
|
67
|
+
else
|
|
68
|
+
writeTransitions(out, "&", groups);
|
|
69
|
+
writePlays(out, profile, foundation, "&", spec.plays, "&", [...spec.paintTransition?.channels ?? [], ...groups.flatMap((group) => group.properties)], reject);
|
|
70
|
+
profile.only(frame, "frame", ["min-block-size", "min-inline-size", ...FRAME_INSET_FIELDS, "minimum-block-inset", "border-width", BORDER_STYLE, "radius", ...HIT_AREA_FIELDS]);
|
|
71
|
+
const line = frame[BORDER_STYLE];
|
|
72
|
+
if (line !== void 0 && spec.normalize.some(([property]) => property === "border-style"))
|
|
73
|
+
return reject({ kind: "extent-conflict", element: "&", property: "border-style", providers: ["frame profile", "normalize"] });
|
|
61
74
|
const minInline = frame["min-inline-size"], { asset, hasText } = input;
|
|
62
|
-
if (!hasText && asset === null)
|
|
75
|
+
if (!hasText && asset === null && spec.decor.length === 0)
|
|
63
76
|
return reject({ kind: "content-missing" });
|
|
64
|
-
if (asset !== null && asset.paint
|
|
65
|
-
|
|
66
|
-
const geometry = asset === null ? null : visualPart(asset, visual, input.state, LIGHT, reject), at = (fields, name, owner) => profile.field(fields, owner, name), lineHeight = at(text, "line-height", "text"), gap = at(spacing, "content-gap", "spacing"), box = controlBox(frame, controlEnvelope(spec, hasText ? LINE_BOX : null, geometry?.extent ?? null, gap), profile.field), keepsWidth = hasText && spec.label
|
|
77
|
+
if (asset !== null && asset.paint === "slots")
|
|
78
|
+
slotArtworkContrast(foundation, asset, spec, (name) => profile.of(name, "surface"), reject);
|
|
79
|
+
const geometry = asset === null ? null : visualPart(asset, visual, input.state, input.theme ?? LIGHT, reject), at = (fields, name, owner) => profile.field(fields, owner, name), lineHeight = at(text, "line-height", "text"), gap = at(spacing, "content-gap", "spacing"), box = controlBox(frame, controlEnvelope(spec, hasText ? LINE_BOX : null, geometry?.extent ?? null, gap), profile.field, reject), keepsWidth = hasText && spec.label?.wrap === "never";
|
|
67
80
|
out.rule("&", {
|
|
68
81
|
...controlArrangement(spec),
|
|
82
|
+
...spec.extent === "container" && spec.layout !== "native" ? { display: "flex", "inline-size": "100%" } : {},
|
|
69
83
|
"box-sizing": "border-box",
|
|
70
84
|
...minInline !== void 0 ? { "min-inline-size": minInline } : keepsWidth ? {} : { "min-inline-size": "0" },
|
|
71
85
|
...text,
|
|
72
86
|
...controlBoxValues(box),
|
|
87
|
+
...line === void 0 ? {} : { "border-style": line },
|
|
73
88
|
gap,
|
|
74
|
-
...
|
|
89
|
+
...settled(surfaces.base.fields, blurred)
|
|
75
90
|
});
|
|
76
91
|
out.rule("&", normalizedDeclarations(spec.normalize));
|
|
92
|
+
writeStateText(out, profile, "&", text, spec.textWhen, (condition) => condition, reject);
|
|
77
93
|
for (const [condition, values] of spec.normalizeWhen)
|
|
78
94
|
out.rule(condition, normalizedDeclarations(values));
|
|
79
95
|
for (const [condition, surface] of spec.when)
|
|
80
|
-
out.rule(condition, { ...profile.of(surface, "surface") });
|
|
96
|
+
out.rule(condition, { ...settled(profile.of(surface, "surface"), blurred) });
|
|
81
97
|
const hitArea = hitAreaOf(frame);
|
|
82
98
|
writeHitArea(out, "&", hitArea);
|
|
83
99
|
const target = {
|
|
84
100
|
element: "&",
|
|
85
|
-
frame: frameTarget(frame, profile.field),
|
|
101
|
+
frame: frameTarget(frame, box, profile.field),
|
|
86
102
|
hitArea,
|
|
87
103
|
content: {
|
|
88
104
|
kind: "control",
|
|
@@ -100,30 +116,40 @@ export function lowerControl(spec, foundation, input) {
|
|
|
100
116
|
"outline-style": "solid"
|
|
101
117
|
});
|
|
102
118
|
const { label, glyph } = spec;
|
|
103
|
-
|
|
119
|
+
for (const box of spec.decor)
|
|
120
|
+
lowerDecor(out, box, profile, motion, reject);
|
|
121
|
+
if (hasText && label !== null) {
|
|
104
122
|
const trim = label.textEdge.length === 0 ? {} : { "text-box-trim": "trim-both", "text-box-edge": label.textEdge.join(" ") }, wrap = label.wrap === "never" ? { "white-space": "nowrap" } : { "min-inline-size": "0", "overflow-wrap": label.wrap === "anywhere" ? "anywhere" : "break-word" };
|
|
105
|
-
out.rule(`& > ${label.selector}`, { ...wrap, ...trim });
|
|
123
|
+
out.rule(`& > ${label.selector}`, { ...wrap, ...trim, ...label.align === null ? {} : { "text-align": label.align } });
|
|
106
124
|
}
|
|
107
125
|
if (geometry !== null && glyph !== null) {
|
|
108
|
-
const part = `& > ${glyph.selector}
|
|
126
|
+
const part = `& > ${glyph.selector}`, turns = glyph.when.some(([, effects]) => effects.some((effect) => effect.effect === "rotate"));
|
|
109
127
|
out.rule(part, {
|
|
110
128
|
...geometry.part,
|
|
111
129
|
...animated ? {
|
|
112
130
|
translate: "0px",
|
|
113
131
|
scale: "1",
|
|
132
|
+
...turns ? { rotate: "0deg" } : {},
|
|
114
133
|
...glyph.transition.length > 0 ? {
|
|
115
134
|
"transition-property": glyph.transition.join(", "),
|
|
116
135
|
"transition-duration": at(motion, "duration", "motion"),
|
|
117
|
-
"transition-delay":
|
|
136
|
+
...motion.delay === void 0 ? {} : { "transition-delay": motion.delay },
|
|
118
137
|
"transition-timing-function": at(motion, "easing", "motion")
|
|
119
138
|
} : {}
|
|
120
139
|
} : {}
|
|
121
140
|
});
|
|
122
|
-
out.rule(`${part} >
|
|
141
|
+
out.rule(`${part} > ${geometry.element}`, geometry.media);
|
|
142
|
+
if (asset !== null && asset.paint === "slots")
|
|
143
|
+
out.paint(glyph.selector, [...asset.slots].map(([slot, value]) => ({ slot, paint: value === "currentColor" ? { kind: "current-color" } : { kind: "token", name: value } })));
|
|
123
144
|
for (const [condition, effects] of glyph.when) {
|
|
124
145
|
const values = {};
|
|
125
146
|
for (const effect of effects)
|
|
126
|
-
|
|
147
|
+
if (effect.effect === "translate-inline")
|
|
148
|
+
values.translate = at(motion, effect.field, "motion");
|
|
149
|
+
else if (effect.effect === "rotate")
|
|
150
|
+
values.rotate = at(motion, effect.field, "motion");
|
|
151
|
+
else
|
|
152
|
+
values.scale = scaleValue(effect.effect, at(motion, effect.field, "motion"));
|
|
127
153
|
out.rule(`${condition} > ${glyph.selector}`, values);
|
|
128
154
|
const inline = effects.find((effect) => effect.effect === "translate-inline"), reduced = ["media", "(prefers-reduced-motion: reduce)"];
|
|
129
155
|
if (inline !== void 0)
|
|
@@ -132,10 +158,61 @@ export function lowerControl(spec, foundation, input) {
|
|
|
132
158
|
if (inline !== void 0)
|
|
133
159
|
out.rule(`${condition}:dir(rtl) > ${glyph.selector}`, { translate: "0px" }, reduced);
|
|
134
160
|
}
|
|
161
|
+
const moved = [...new Set(glyph.when.flatMap(([, effects]) => effects.map((effect) => effect.effect === "translate-inline" ? "translate" : effect.effect === "rotate" ? "rotate" : "scale")))];
|
|
162
|
+
writePlays(out, profile, foundation, glyph.name, glyph.plays, part, moved, reject);
|
|
135
163
|
}
|
|
136
164
|
return out.finish({ kind: "control", artwork: geometry === null ? null : placed(geometry), targets: { elements: [target], neighbours: [] } }, input.hidden);
|
|
137
165
|
});
|
|
138
166
|
}
|
|
167
|
+
function lowerDecor(out, box, profile, motion, reject) {
|
|
168
|
+
const path = `& > ${box.selector}`, base = box.surface === null ? {} : profile.of(box.surface, "surface"), moved = new Set(box.when.flatMap(([, , effects]) => effects.map((effect) => effect.effect === "translate-inline" ? "translate" : "scale"))), timing = box.transition.length === 0 ? {} : {
|
|
169
|
+
"transition-property": box.transition.join(", "),
|
|
170
|
+
"transition-duration": profile.field(motion, "motion", "duration"),
|
|
171
|
+
...motion.delay === void 0 ? {} : { "transition-delay": motion.delay },
|
|
172
|
+
"transition-timing-function": profile.field(motion, "motion", "easing")
|
|
173
|
+
};
|
|
174
|
+
out.rule(path, {
|
|
175
|
+
"box-sizing": "border-box",
|
|
176
|
+
"flex-grow": "0",
|
|
177
|
+
"flex-shrink": "0",
|
|
178
|
+
"flex-basis": "auto",
|
|
179
|
+
...frameValues(profile.of(box.box, "frame"), profile, reject),
|
|
180
|
+
...settled(base, !1),
|
|
181
|
+
...moved.has("translate") ? { translate: "0px" } : {},
|
|
182
|
+
...moved.has("scale") ? { scale: "1" } : {},
|
|
183
|
+
...timing
|
|
184
|
+
});
|
|
185
|
+
for (const [condition, surface, effects] of box.when) {
|
|
186
|
+
const values = surface === null ? {} : { ...settled(profile.of(surface, "surface"), !1) };
|
|
187
|
+
for (const effect of effects) {
|
|
188
|
+
const value = profile.field(motion, "motion", effect.field);
|
|
189
|
+
if (effect.effect === "translate-inline")
|
|
190
|
+
values.translate = value;
|
|
191
|
+
else if (effect.effect !== "rotate")
|
|
192
|
+
values.scale = scaleValue(effect.effect, value);
|
|
193
|
+
}
|
|
194
|
+
out.rule(`${condition} > ${box.selector}`, values);
|
|
195
|
+
const inline = effects.find((effect) => effect.effect === "translate-inline");
|
|
196
|
+
if (inline !== void 0)
|
|
197
|
+
out.rule(`${condition}:dir(rtl) > ${box.selector}`, { translate: `calc(${profile.field(motion, "motion", inline.field)} * -1)` });
|
|
198
|
+
}
|
|
199
|
+
if (box.transition.length > 0)
|
|
200
|
+
out.rule(path, { "transition-duration": "0s", "transition-delay": "0s" }, ["media", "(prefers-reduced-motion: reduce)"]);
|
|
201
|
+
}
|
|
202
|
+
function slotArtworkContrast(foundation, asset, spec, surface, reject) {
|
|
203
|
+
const base = surface(spec.surface), states = [[null, base], ...spec.when.filter(([condition]) => !inactiveCondition(condition)).map(([condition, name]) => [condition, surface(name)])];
|
|
204
|
+
for (const context of tokenValueContexts(foundation))
|
|
205
|
+
for (const [condition, fields] of states) {
|
|
206
|
+
const background = fields.background ?? base.background;
|
|
207
|
+
if (background === void 0)
|
|
208
|
+
continue;
|
|
209
|
+
const paints = [...asset.slots.values()].map((value) => value === "currentColor" ? fields.color ?? base.color ?? null : `var(${value})`).filter((value) => value !== null), outcomes = paints.map((foreground) => paintContrast(context, { foreground, background }, NON_TEXT_MINIMUM));
|
|
210
|
+
if (outcomes.some((outcome) => outcome.kind !== "insufficient"))
|
|
211
|
+
continue;
|
|
212
|
+
const ratio = Math.max(...outcomes.map((outcome) => outcome.kind === "insufficient" ? outcome.ratio : 0));
|
|
213
|
+
return reject({ kind: "artwork-paint-contrast-insufficient", asset: asset.name, context: context.label, state: condition, background, paints, ratio, minimum: NON_TEXT_MINIMUM });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
139
216
|
function drawnHeight(foundation, asset, visual, reject) {
|
|
140
217
|
const minimum = asset.spec.minDrawnHeight;
|
|
141
218
|
if (minimum === void 0)
|
|
@@ -159,8 +236,9 @@ export function lowerArtwork(spec, foundation, input) {
|
|
|
159
236
|
const profile = profiles(foundation, reject), { asset, visualProfile, theme } = input;
|
|
160
237
|
if (asset === null || visualProfile === null)
|
|
161
238
|
return reject({ kind: "artwork-binding-missing" });
|
|
162
|
-
const visual = profile.of(visualProfile, "visual"), geometry = visualPart(asset, visual, input.state, theme, reject), out = output(input.root, "lowerArtwork", reject, profile), height = drawnHeight(foundation, asset, visual, reject), { part } = spec;
|
|
163
|
-
|
|
239
|
+
const visual = profile.of(visualProfile, "visual"), geometry = visualPart(asset, visual, input.state, theme, reject), out = output(input.root, "lowerArtwork", reject, profile), height = drawnHeight(foundation, asset, visual, reject), { part } = spec, tone = spec.surface === null ? {} : profile.of(spec.surface, "surface");
|
|
240
|
+
profile.only(tone, "surface", ["color"]);
|
|
241
|
+
out.rule("&", { display: "inline-flex", "align-items": spec.align, "justify-content": "center", "min-inline-size": "0", ...tone.color === void 0 ? {} : { color: tone.color } });
|
|
164
242
|
out.rule(`& > ${part.selector}`, geometry.part);
|
|
165
243
|
out.rule(`& > ${part.selector} > ${geometry.element}`, geometry.media);
|
|
166
244
|
if (asset.paint === "slots")
|
|
@@ -181,6 +259,7 @@ export function lowerArtwork(spec, foundation, input) {
|
|
|
181
259
|
}
|
|
182
260
|
});
|
|
183
261
|
}
|
|
262
|
+
writePlays(out, profile, foundation, part.name, part.plays, `& > ${part.selector}`, part.effects.length > 0 ? ["rotate"] : [], reject);
|
|
184
263
|
return out.finish({ kind: "artwork", artwork: placed(geometry), theme: theme.name, drawnHeight: height }, input.hidden);
|
|
185
264
|
});
|
|
186
265
|
}
|
package/dist/owner-scenarios.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { throwIfCancelled } from "./analysis/context.mjs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { isAuthoring, publicExports } from "./analysis/owner-discovery.mjs";
|
|
3
4
|
import { location, memoProgram, symbolAt, unalias, valueSymbolAt, walk } from "./analysis/helpers.mjs";
|
|
@@ -9,10 +10,12 @@ import { PUBLIC_BARREL, ownerCompilerOptions, ownerProgramRoots, programSource }
|
|
|
9
10
|
import ts from "./analysis/syntax.mjs";
|
|
10
11
|
import { isScenarioFile, scenarioIdentity, sourceFiles } from "./config.mjs";
|
|
11
12
|
import { isDevelopmentModule } from "./development-modules.mjs";
|
|
13
|
+
import { publicProse } from "./analysis/prose-owners.mjs";
|
|
14
|
+
import { isProseTag } from "./prose-model.mjs";
|
|
12
15
|
import { findingRules } from "./finding-rules.mjs";
|
|
13
16
|
import { err, ok } from "./result.mjs";
|
|
14
17
|
import { createScenarioGroups } from "./scenario-groups.mjs";
|
|
15
|
-
const KINDS = ["components", "patterns", "mocks"], isKind = (value) => KINDS.some((kind) => kind === value), FIELDS = ["id", "title", "description", "covers", "exercises", "frame", "states", "specimens", "captureTargets"], SUBJECT_FIELDS = new Set(["states", "specimens"]), FRAMES = ["inline", "screen", "phone"], ARRANGEMENTS = ["stack", "row", "tiles"], WIDTHS = ["content", "full", "small", "medium"], MAX_STATES = 12, SPECIMEN_FIELDS = ["title", "note", "arrangement", "width", "render"], quoted = (values) => values.map((value) => `"${value}"`).join(", "), isField = (name) => FIELDS.some((field) => field === name), SAFE_ID = /^[\w-]+(?:[/.][\w-]+)*$/, FIXTURE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs", ".json"], ENTRY_LISTS = new Set(["covers", "exercises"]), unwrap = (input) => {
|
|
18
|
+
const KINDS = ["components", "patterns", "mocks"], isKind = (value) => KINDS.some((kind) => kind === value), FIELDS = ["id", "title", "description", "covers", "exercises", "frame", "states", "controls", "specimens", "captureTargets"], SUBJECT_FIELDS = new Set(["states", "specimens"]), FRAMES = ["inline", "screen", "phone"], ARRANGEMENTS = ["stack", "row", "tiles"], WIDTHS = ["content", "full", "small", "medium"], MAX_STATES = 12, SPECIMEN_FIELDS = ["title", "note", "arrangement", "width", "render"], quoted = (values) => values.map((value) => `"${value}"`).join(", "), isField = (name) => FIELDS.some((field) => field === name), SAFE_ID = /^[\w-]+(?:[/.][\w-]+)*$/, FIXTURE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs", ".json"], ENTRY_LISTS = new Set(["covers", "exercises"]), unwrap = (input) => {
|
|
16
19
|
let node = input;
|
|
17
20
|
while (ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isParenthesizedExpression(node))
|
|
18
21
|
node = node.expression;
|
|
@@ -172,7 +175,7 @@ async function registrationOf(options, program, checker, file) {
|
|
|
172
175
|
for (const problem of subjects.problems)
|
|
173
176
|
report(problem.rule, problem.message, problem.node ?? record.nodes.get(problem.field) ?? metadata?.node, problem.entry);
|
|
174
177
|
if (kind !== "mocks")
|
|
175
|
-
for (const problem of markupProblems(dsRoot, source))
|
|
178
|
+
for (const problem of markupProblems(dsRoot, source, await publicProse(dsRoot)))
|
|
176
179
|
report("scenario-markup", problem.message, problem.node);
|
|
177
180
|
let valid = !entry && subjects.renders.length > 0;
|
|
178
181
|
for (const [name, node] of record.nodes)
|
|
@@ -184,6 +187,8 @@ async function registrationOf(options, program, checker, file) {
|
|
|
184
187
|
const declaredDescription = record.values.get("description");
|
|
185
188
|
if (record.nodes.has("description") && (typeof declaredDescription !== "string" || declaredDescription.trim() === ""))
|
|
186
189
|
report("scenario-field", "`description` is a nonempty static string: one sentence under the page's title.", record.nodes.get("description"), "description");
|
|
190
|
+
if (record.nodes.has("controls") && typeof record.values.get("controls") !== "boolean")
|
|
191
|
+
report("scenario-field", "`controls` is `true` or `false`: with `true` ADS draws a control for each closed prop of the first owner in `covers`, and every specimen receives the chosen values as props.", record.nodes.get("controls"), "controls");
|
|
187
192
|
const declaredFrame = record.values.get("frame");
|
|
188
193
|
if (record.nodes.has("frame") && !FRAMES.some((frame) => frame === declaredFrame))
|
|
189
194
|
report("scenario-field", `\`frame\` is one of ${quoted(FRAMES)}: a page of boxed specimens (the default), or one specimen as a whole screen.`, record.nodes.get("frame"), "frame");
|
|
@@ -590,7 +595,7 @@ const specimenRenders = (checker, source) => memoProgram(source, "owner-scenario
|
|
|
590
595
|
const { metadata } = scenarioExports(source), record = metadata?.initializer === void 0 ? void 0 : await recordOf(checker, metadata.initializer, new Set, SUBJECT_FIELDS);
|
|
591
596
|
return record === void 0 ? [] : (await specimensOf(checker, record)).renders;
|
|
592
597
|
});
|
|
593
|
-
function markupProblems(dsRoot, source) {
|
|
598
|
+
function markupProblems(dsRoot, source, prose) {
|
|
594
599
|
const problems = [], development = new Map;
|
|
595
600
|
for (const statement of source.statements) {
|
|
596
601
|
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier) || !statement.moduleSpecifier.text.startsWith("."))
|
|
@@ -619,6 +624,12 @@ function markupProblems(dsRoot, source) {
|
|
|
619
624
|
problems.push({ node: attribute, message: "A scenario does not style what it shows: remove `style`. A size or a position the subject needs comes from the scenario kit's Container, or from the owner's own props." });
|
|
620
625
|
const tag = node.tagName, name = tag.getText();
|
|
621
626
|
if (ts.isIdentifier(tag) && /^[a-z]/.test(name)) {
|
|
627
|
+
const owner = isProseTag(name) ? proseOwnerOf(node, prose) : void 0;
|
|
628
|
+
if (owner !== void 0) {
|
|
629
|
+
if (!owner.tags.has(name))
|
|
630
|
+
problems.push({ node: tag, message: `<${name}> is content of ${owner.name}, whose prose recipe declares no such element: it would be drawn without a design. Declare the element in the recipe's \`elements\`, or write the content with the elements it declares.` });
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
622
633
|
problems.push({ node: tag, message: `A scenario renders public owners and the scenario kit, not <${name}>. ADS draws the page: put text in \`title\`, \`description\` and each specimen's \`title\` and \`note\`, choose its \`arrangement\` and \`width\`, and use the kit (Container, Placeholder, Anchor, EventLog) around a subject that needs one.` });
|
|
623
634
|
return;
|
|
624
635
|
}
|
|
@@ -631,6 +642,18 @@ function markupProblems(dsRoot, source) {
|
|
|
631
642
|
});
|
|
632
643
|
return problems;
|
|
633
644
|
}
|
|
645
|
+
function proseOwnerOf(node, prose) {
|
|
646
|
+
for (let current = node.parent;current !== void 0; current = current.parent) {
|
|
647
|
+
if (!ts.isJsxElement(current) || current.openingElement === node)
|
|
648
|
+
continue;
|
|
649
|
+
const tag = current.openingElement.tagName;
|
|
650
|
+
if (ts.isIdentifier(tag) && isProseTag(tag.text))
|
|
651
|
+
continue;
|
|
652
|
+
const tags = ts.isIdentifier(tag) ? prose.get(tag.text) : void 0;
|
|
653
|
+
return tags === void 0 ? void 0 : { name: tag.getText(), tags };
|
|
654
|
+
}
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
634
657
|
const defaultExportNode = (source) => source.statements.find((statement) => ts.isExportAssignment(statement) || ts.isFunctionDeclaration(statement) && hasModifier(statement, ts.SyntaxKind.DefaultKeyword));
|
|
635
658
|
async function renderedNames(checker, dsRoot, entries, exported) {
|
|
636
659
|
const rendered = new Set, visited = new Set, pending = [...entries];
|
|
@@ -796,8 +819,10 @@ export async function scenarioFindings(options, reuse = null) {
|
|
|
796
819
|
const files = sourceFiles(options.dsRoot, options).filter(isScenarioFile).sort();
|
|
797
820
|
let program;
|
|
798
821
|
const compute = async (file) => factsOf(options, await (program ??= reuse === null ? scenarioProgram(options, files) : Promise.resolve(reuse.program)), file), keys = reuse === null ? null : await revisionScenarioKeys({ dsRoot: options.dsRoot, publicAlias: options.config.publicAlias, framework: options.config.framework ?? null, graph: reuse.graph, globals: reuse.globals }), cache = reuse === null || keys === null ? null : projectScenarioCache(reuse.cacheOwner), facts = [];
|
|
799
|
-
for (const file of files)
|
|
822
|
+
for (const file of files) {
|
|
823
|
+
throwIfCancelled();
|
|
800
824
|
facts.push(await obtainScenarioResult(cache, options.dsRoot, keys?.get(path.relative(options.dsRoot, file).split(path.sep).join("/")), "facts", () => compute(file)));
|
|
825
|
+
}
|
|
801
826
|
const { diagnostics, registered } = assemble(options, files, facts.map((fact) => fact.registration)), unreadable = diagnostics.some((diagnostic) => diagnostic.rule === "scenario-metadata"), scenarios = registered.filter(({ entry }) => entry.kind !== "mocks").map(({ file, entry }) => ({ file: projectPath(options, file), covers: [...entry.covers] })), coverage = scenarioCoverage(options, { scenarios }, exports.value).filter((finding) => !(unreadable && finding.rule === "scenario-coverage")), unrendered = new Map(files.map((file, index) => [file, facts[index]?.unrendered ?? null])), renders = registered.flatMap(({ file }) => (unrendered.get(file) ?? []).filter(({ name }) => exports.value.names.has(name)).map(({ name, line, column }) => ({
|
|
802
827
|
rule: "scenario-render",
|
|
803
828
|
file: projectPath(options, file),
|