@reqvire-org/ads 0.5.0 → 0.5.1
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 +275 -12
- package/dist/ads-views.mjs +4 -4
- package/dist/analysis/design-usage.mjs +20 -4
- package/dist/analysis/mock-check.mjs +5 -4
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +172 -39
- package/dist/analysis/owner-composition.mjs +37 -13
- package/dist/analysis/owner-controls.mjs +27 -0
- package/dist/analysis/owner-source.mjs +67 -18
- package/dist/analysis/prose-owners.mjs +57 -0
- package/dist/analysis/styling-ownership.mjs +22 -0
- package/dist/check.mjs +7 -1
- package/dist/cli-arguments.mjs +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/composed-contrast.mjs +28 -8
- package/dist/composed-keyline.mjs +107 -0
- package/dist/construction-output.mjs +146 -18
- package/dist/construction-spec.d.mts +212 -9
- package/dist/construction-spec.mjs +297 -56
- package/dist/corner-overpaint.mjs +53 -0
- package/dist/design-foundation.mjs +6 -1
- package/dist/design-usage.mjs +8 -2
- package/dist/emit/emission.mjs +11 -4
- package/dist/emit/font-emission.mjs +21 -1
- package/dist/emit/foundation-sheet.mjs +6 -5
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/finding-rules.mjs +7 -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/foundation-macro.d.mts +1 -1
- package/dist/frame-regions.mjs +66 -3
- package/dist/grid-facts.mjs +72 -16
- package/dist/grid-lowering.mjs +11 -5
- package/dist/init.mjs +14 -23
- package/dist/lowering-enter.mjs +31 -0
- package/dist/lowering-properties.mjs +22 -1
- package/dist/lowering-region-layout.mjs +42 -8
- package/dist/lowering-sequence.mjs +89 -0
- package/dist/lowering-session.mjs +7 -0
- package/dist/lowering-transitions.mjs +22 -8
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-widget.bundle.js +5 -5
- package/dist/motion-model.mjs +2 -0
- package/dist/owner-analysis-check.mjs +67 -7
- package/dist/owner-errors.mjs +16 -0
- package/dist/owner-lowering.mjs +36 -16
- package/dist/owner-scenarios.mjs +25 -3
- package/dist/ownership-model.mjs +23 -4
- package/dist/paint-contrast.mjs +5 -0
- package/dist/placeholder-contrast.mjs +1 -0
- package/dist/platform-features.mjs +26 -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 +105 -3
- package/dist/recipe-model.mjs +31 -7
- package/dist/region-lowering.mjs +241 -41
- package/dist/render-audit/corner-overpaint.page.mjs +54 -0
- package/dist/render-audit/worker.mjs +6 -1
- package/dist/render-audit.mjs +25 -0
- package/dist/role-vocabulary.d.mts +38 -2
- package/dist/role-vocabulary.mjs +39 -4
- package/dist/scenario-kit.d.mts +6 -0
- package/dist/scenario-registry.mjs +1 -1
- 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 +117 -86
- 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 +2 -2
- package/dist/skills/ads-designer/references/atomic-styles.md +8 -1
- package/dist/skills/ads-designer/references/branding.md +7 -2
- package/dist/skills/ads-designer/references/cli.md +4 -4
- package/dist/skills/ads-designer/references/contracts.md +9 -2
- 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 +42 -3
- package/dist/skills/ads-designer/references/motion.md +37 -1
- package/dist/skills/ads-designer/references/performance.md +7 -1
- package/dist/skills/ads-designer/references/recipes.md +67 -6
- 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 +9 -2
- 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 +42 -3
- package/dist/skills/ads-import/references/recipes.md +67 -6
- 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 +2 -1
- package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -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 +9 -2
- 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 +42 -3
- package/dist/skills/ads-port/references/recipes.md +67 -6
- 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 +68 -10
- package/dist/surface-effects.mjs +98 -0
- package/dist/target-size.mjs +1 -1
- package/dist/task-cache.mjs +1 -1
- 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.mjs +1 -1
- package/docs/ADS.md +36 -13
- package/docs/ARCHITECTURE.md +160 -16
- package/docs/ASSETS.md +81 -10
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +346 -21
- package/docs/DESIGN-REFERENCES.md +5 -5
- package/docs/GUIDE.md +241 -72
- package/docs/LANGUAGE.md +287 -21
- package/docs/LOWERING.md +13 -1
- package/docs/MOTION.md +233 -7
- package/docs/PROFILE-KINDS.md +167 -13
- package/docs/PROFILES.md +2 -2
- package/docs/RULES.md +49 -18
- package/docs/TOKEN-ROLES.md +9 -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/preview-bun.mjs
CHANGED
|
@@ -21,7 +21,8 @@ import * as timing from "./stage-timing.mjs";
|
|
|
21
21
|
import { bunBundler } from "./bun-bundler.mjs";
|
|
22
22
|
import { isRecord } from "./unknown.mjs";
|
|
23
23
|
import { adsViewDefinition } from "./ads-views.mjs";
|
|
24
|
-
import { PREVIEW_FACTS_FILE, PREVIEW_TOKENS_SHEET } from "./emit/preview-tree.mjs";
|
|
24
|
+
import { PREVIEW_CONTROLS_FILE, PREVIEW_FACTS_FILE, PREVIEW_TOKENS_SHEET } from "./emit/preview-tree.mjs";
|
|
25
|
+
import { parsePreviewControls } from "./preview-controls.mjs";
|
|
25
26
|
const distributedFrame = existsSync(new URL("./showcase/preview-frame.mjs", import.meta.url)), builtFrame = !distributedFrame && existsSync(new URL("../dist/showcase/ui/ui.js", import.meta.url)), compiledFrame = distributedFrame || builtFrame, previewFrameDirectory = distributedFrame ? "./showcase/" : builtFrame ? "../dist/showcase/" : "../showcase-client/", previewFrameFile = (file) => fileURLToPath(new URL(`${previewFrameDirectory}${file}`, import.meta.url)), previewFrameModule = (name) => previewFrameFile(`${name}${compiledFrame ? ".mjs" : ".mts"}`);
|
|
26
27
|
export const SCENARIO_KIT = "@reqvire-org/ads/showcase", previewFrameFiles = [
|
|
27
28
|
previewFrameModule("preview-frame"),
|
|
@@ -38,9 +39,16 @@ export const SCENARIO_KIT = "@reqvire-org/ads/showcase", previewFrameFiles = [
|
|
|
38
39
|
previewFrameModule("assets-view"),
|
|
39
40
|
...["inspected-svg", "result"].map((name) => fileURLToPath(new URL(builtFrame ? `../dist/${name}.mjs` : `./${name}${distributedFrame ? ".mjs" : ".mts"}`, import.meta.url)))
|
|
40
41
|
], adsViewsModule = previewFrameModule("ads-views");
|
|
41
|
-
export function previewEntryCode(entry, { root, tree,
|
|
42
|
-
if (entry.view === void 0)
|
|
43
|
-
|
|
42
|
+
export function previewEntryCode(entry, { root, tree, foundation }, projectMount, inputs) {
|
|
43
|
+
if (entry.view === void 0) {
|
|
44
|
+
const file = path.join(tree, PREVIEW_CONTROLS_FILE);
|
|
45
|
+
let controls = {};
|
|
46
|
+
try {
|
|
47
|
+
controls = parsePreviewControls(readFileSync(file, "utf8"));
|
|
48
|
+
inputs.add(file);
|
|
49
|
+
} catch {}
|
|
50
|
+
return `import {mountScenario} from ${JSON.stringify(projectMount())};import {scenario} from ${JSON.stringify(path.join(root, entry.file))};export const mount=container=>mountScenario(scenario,container,${JSON.stringify(controls)});`;
|
|
51
|
+
}
|
|
44
52
|
const definition = adsViewDefinition(entry.view), file = path.join(tree, PREVIEW_FACTS_FILE);
|
|
45
53
|
let facts = null;
|
|
46
54
|
try {
|
|
@@ -48,17 +56,10 @@ export function previewEntryCode(entry, { root, tree, publicAlias, foundation },
|
|
|
48
56
|
inputs.add(file);
|
|
49
57
|
facts = isRecord(read) ? { [definition.facts]: read[definition.facts] ?? null } : null;
|
|
50
58
|
} catch {}
|
|
51
|
-
const mount = `import {mountAdsView} from ${JSON.stringify(adsViewsModule)};`, options = `view:${JSON.stringify(entry.view)},facts:${JSON.stringify(facts)}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case "token-sheets": {
|
|
56
|
-
const sheet = path.join(tree, PREVIEW_TOKENS_SHEET), sheets = [...foundation === null ? [] : [foundation], ...existsSync(sheet) ? [sheet] : []];
|
|
57
|
-
if (sheets.includes(sheet))
|
|
58
|
-
inputs.add(sheet);
|
|
59
|
-
return `${sheets.map((file) => `import ${JSON.stringify(file)};`).join("")}${mount}export const mount=container=>mountAdsView(container,{${options}});`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
59
|
+
const mount = `import {mountAdsView} from ${JSON.stringify(adsViewsModule)};`, options = `view:${JSON.stringify(entry.view)},facts:${JSON.stringify(facts)}`, sheet = path.join(tree, PREVIEW_TOKENS_SHEET), sheets = [...foundation === null ? [] : [foundation], ...existsSync(sheet) ? [sheet] : []];
|
|
60
|
+
if (sheets.includes(sheet))
|
|
61
|
+
inputs.add(sheet);
|
|
62
|
+
return `${sheets.map((file) => `import ${JSON.stringify(file)};`).join("")}${mount}export const mount=container=>mountAdsView(container,{${options}});`;
|
|
62
63
|
}
|
|
63
64
|
const hash = (value) => createHash("sha256").update(value).digest("hex"), fileHash = (file) => {
|
|
64
65
|
try {
|
|
@@ -156,7 +157,7 @@ export function createBunPreviewBuilder() {
|
|
|
156
157
|
return kitFile = file;
|
|
157
158
|
}, emittedClasses = new Map, mounts = new Map(entries.map((entry, index) => {
|
|
158
159
|
const file = path.join(workDirectory, hash(entry.id) + ".tsx");
|
|
159
|
-
writeFileSync(file, previewEntryCode(entry, { root: options.root, tree: origin.tree,
|
|
160
|
+
writeFileSync(file, previewEntryCode(entry, { root: options.root, tree: origin.tree, foundation }, projectMount, inputs));
|
|
160
161
|
return [file, index];
|
|
161
162
|
})), previewUi = previewFrameFiles[0], alias = (specifier) => {
|
|
162
163
|
if (specifier === "@reqvire-org/ads/preview")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function previewControls(owners) {
|
|
2
|
+
const byComponent = new Map;
|
|
3
|
+
for (const owner of owners)
|
|
4
|
+
for (const { component, prop, values, optional } of owner.controls ?? []) {
|
|
5
|
+
const list = byComponent.get(component) ?? byComponent.set(component, []).get(component) ?? [];
|
|
6
|
+
if (!list.some((control) => control.prop === prop))
|
|
7
|
+
list.push({ prop, values, optional });
|
|
8
|
+
}
|
|
9
|
+
return Object.fromEntries([...byComponent].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
10
|
+
}
|
|
11
|
+
export const previewControlsText = (owners) => `${JSON.stringify(previewControls(owners), null, 2)}
|
|
12
|
+
`;
|
|
13
|
+
export function parsePreviewControls(text) {
|
|
14
|
+
try {
|
|
15
|
+
const read = JSON.parse(text);
|
|
16
|
+
if (typeof read !== "object" || read === null || Array.isArray(read))
|
|
17
|
+
return {};
|
|
18
|
+
const controls = {};
|
|
19
|
+
for (const [component, list] of Object.entries(read)) {
|
|
20
|
+
if (!Array.isArray(list))
|
|
21
|
+
continue;
|
|
22
|
+
controls[component] = list.flatMap((item) => {
|
|
23
|
+
if (typeof item !== "object" || item === null)
|
|
24
|
+
return [];
|
|
25
|
+
const prop = Reflect.get(item, "prop"), values = Reflect.get(item, "values");
|
|
26
|
+
if (typeof prop !== "string" || !Array.isArray(values))
|
|
27
|
+
return [];
|
|
28
|
+
return [{ prop, values: values.filter((value) => typeof value === "string" || typeof value === "boolean"), optional: Reflect.get(item, "optional") === !0 }];
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return controls;
|
|
32
|
+
} catch {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -333,7 +333,7 @@ async function createGraph(options, configuration) {
|
|
|
333
333
|
return name;
|
|
334
334
|
}
|
|
335
335
|
const roots = entries.map((entry, index) => {
|
|
336
|
-
const file = path.join(directory, hash(entry.id) + ".tsx"), mount = previewEntryCode(entry, { root: options.root, tree: emittedTree,
|
|
336
|
+
const file = path.join(directory, hash(entry.id) + ".tsx"), mount = previewEntryCode(entry, { root: options.root, tree: emittedTree, foundation: origin.foundation }, projectMount, inputs), sheet = origin.foundation, code = `${sheet === null ? "" : `import ${JSON.stringify(sheet)};
|
|
337
337
|
`}import ${JSON.stringify(bootstrapId)};
|
|
338
338
|
` + mount;
|
|
339
339
|
if (generated.get(file) !== code) {
|
package/dist/preview-source.mjs
CHANGED
|
@@ -97,8 +97,8 @@ export function sourcePathOf(source, dsRoot, file) {
|
|
|
97
97
|
}
|
|
98
98
|
export function generatedMount(framework, foundation) {
|
|
99
99
|
const sheet = foundation === null ? "" : `import ${JSON.stringify(foundation)};
|
|
100
|
-
`, page = `export function mountScenario(scenario, container) {
|
|
101
|
-
return mountScenarioPage(container, scenario, mountSpecimen);
|
|
100
|
+
`, page = `export function mountScenario(scenario, container, controls) {
|
|
101
|
+
return mountScenarioPage(container, scenario, mountSpecimen, controls);
|
|
102
102
|
}
|
|
103
103
|
`;
|
|
104
104
|
switch (framework) {
|
package/dist/profile-macro.d.mts
CHANGED
|
@@ -34,6 +34,21 @@ export interface ProfileSpec {
|
|
|
34
34
|
readonly below?: Token;
|
|
35
35
|
readonly above?: Token;
|
|
36
36
|
}>>;
|
|
37
|
+
/**
|
|
38
|
+
* A `sequence` profile's steps, each at a whole percentage of the run from 0 to 100. A step states
|
|
39
|
+
* what the part looks like there: `opacity`, travel (`translateInline`, `translateBlock`), one scale
|
|
40
|
+
* (`scale`, or `scaleInline` / `scaleBlock` for one axis) and `rotate`, each from a token of its role.
|
|
41
|
+
*/
|
|
42
|
+
readonly steps?: readonly {
|
|
43
|
+
readonly at: number;
|
|
44
|
+
readonly opacity?: Token;
|
|
45
|
+
readonly translateInline?: Token;
|
|
46
|
+
readonly translateBlock?: Token;
|
|
47
|
+
readonly scale?: Token;
|
|
48
|
+
readonly scaleInline?: Token;
|
|
49
|
+
readonly scaleBlock?: Token;
|
|
50
|
+
readonly rotate?: Token;
|
|
51
|
+
}[];
|
|
37
52
|
}
|
|
38
53
|
export interface Profile {
|
|
39
54
|
readonly spec: ProfileSpec;
|
package/dist/profile-model.mjs
CHANGED
|
@@ -63,10 +63,10 @@ function readDefinition(node, metadata) {
|
|
|
63
63
|
}
|
|
64
64
|
choices.set(child.params, { default: fields.default, options });
|
|
65
65
|
} else {
|
|
66
|
-
check(kind === "spatial" && ["ads-breakpoint", "ads-gutter", "ads-condition"].includes(child.name), `Unknown profile clause: ${child.name}`);
|
|
67
|
-
check(fieldsOnly(child), "
|
|
66
|
+
check(kind === "spatial" && ["ads-breakpoint", "ads-gutter", "ads-condition"].includes(child.name) || kind === "sequence" && child.name === "ads-step", `Unknown profile clause: ${child.name}`);
|
|
67
|
+
check(fieldsOnly(child), "Profile clauses contain fields only");
|
|
68
68
|
const key = `${child.name} ${child.params}`;
|
|
69
|
-
check(!clauses.has(key), `Duplicate
|
|
69
|
+
check(!clauses.has(key), `Duplicate profile clause: ${key}`);
|
|
70
70
|
clauses.set(key, declarations(child));
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { references } from "./design-foundation.mjs";
|
|
1
|
+
import { references, tokenValueContexts } from "./design-foundation.mjs";
|
|
2
2
|
import { roleShape } from "./role-vocabulary.mjs";
|
|
3
3
|
import { tokenSpecimen } from "./token-view-facts.mjs";
|
|
4
4
|
const byName = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
5
5
|
export const authoredField = (field) => field.replace(/-([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
6
|
-
const kindOrder = ["text", "frame", "surface", "visual", "spacing", "motion", "focus", "spatial", "layer", "composite"], byKind = (a, b) => {
|
|
6
|
+
const kindOrder = ["text", "frame", "surface", "visual", "spacing", "motion", "sequence", "focus", "spatial", "layer", "composite"], byKind = (a, b) => {
|
|
7
7
|
const at = (kind) => kindOrder.includes(kind) ? kindOrder.indexOf(kind) : kindOrder.length;
|
|
8
8
|
return at(a) - at(b) || byName(a, b);
|
|
9
9
|
};
|
|
@@ -11,6 +11,53 @@ export function profileGroup(file) {
|
|
|
11
11
|
const parts = file?.split("/") ?? [], at = parts.indexOf("profiles");
|
|
12
12
|
return at >= 0 && parts.length > at + 2 ? parts[at + 1] ?? null : null;
|
|
13
13
|
}
|
|
14
|
+
const APPLIED_PROPERTIES = {
|
|
15
|
+
text: { fontFamily: "font-family", fontSize: "font-size", lineHeight: "line-height", fontWeight: "font-weight", fontStretch: "font-stretch", letterSpacing: "letter-spacing", wordSpacing: "word-spacing", fontFeatureSettings: "font-feature-settings", fontVariationSettings: "font-variation-settings", textTransform: "text-transform" },
|
|
16
|
+
surface: { background: "background-color", color: "color", borderColor: "border-color", boxShadow: "box-shadow", backgroundImage: "background-image", opacity: "opacity" },
|
|
17
|
+
frame: { borderWidth: "border-width", borderStyle: "border-style", radius: "border-radius", padding: "padding", paddingInline: "padding-inline", paddingBlock: "padding-block", paddingInlineStart: "padding-inline-start", paddingInlineEnd: "padding-inline-end", paddingBlockStart: "padding-block-start", paddingBlockEnd: "padding-block-end", minBlockSize: "min-block-size", minInlineSize: "min-inline-size" },
|
|
18
|
+
spacing: { contentGap: "gap" },
|
|
19
|
+
focus: { color: "outline-color", width: "outline-width", offset: "outline-offset" }
|
|
20
|
+
}, SLOT_KINDS = { textProfile: "text", surfaceProfile: "surface", frameProfile: "frame", spacingProfile: "spacing", focusProfile: "focus", visualProfile: "visual" }, NOTED = {
|
|
21
|
+
frame: ["minBlockSize", "blockSize", "inlineSize", "minInlineSize", "maxInlineSize", "padding", "paddingInline", "paddingBlock", "paddingInlineStart", "paddingInlineEnd", "minimumBlockInset", "borderWidth", "radius"],
|
|
22
|
+
text: ["fontSize", "lineHeight", "fontWeight"],
|
|
23
|
+
visual: ["size"],
|
|
24
|
+
spacing: ["contentGap"],
|
|
25
|
+
surface: ["background", "color", "borderColor"],
|
|
26
|
+
focus: ["width", "offset", "color"]
|
|
27
|
+
};
|
|
28
|
+
export function profileApplied(profile, selected, tokenValue) {
|
|
29
|
+
const sources = profile.kind === "composite" ? profile.fields.flatMap((field) => Object.hasOwn(SLOT_KINDS, field.field) && field.profile !== null ? [selected(field.profile)].flatMap((item) => item === void 0 ? [] : [item]) : []) : [profile], of = (kind) => sources.find((source) => source.kind === kind), stated = (kind, field) => of(kind)?.fields.find((item) => item.field === field)?.value, declarations = (kind) => {
|
|
30
|
+
const properties = APPLIED_PROPERTIES[kind] ?? {};
|
|
31
|
+
return (of(kind)?.fields ?? []).flatMap((field) => Object.hasOwn(properties, field.field) ? [[properties[field.field] ?? "", field.value]] : []);
|
|
32
|
+
}, css = (value) => /^--[\w-]+$/.test(value) ? `var(${value})` : value, frame = declarations("frame"), surface = declarations("surface"), shadow = stated("surface", "shapeShadow") ?? stated("surface", "groupShadow"), filter = [...stated("surface", "blur") === void 0 ? [] : [`blur(${css(stated("surface", "blur") ?? "")})`], ...shadow === void 0 ? [] : [`drop-shadow(${css(shadow)})`]], backdrop = [...stated("surface", "backdropBlur") === void 0 ? [] : [`blur(${css(stated("surface", "backdropBlur") ?? "")})`], ...stated("surface", "backdropSaturate") === void 0 ? [] : [`saturate(${css(stated("surface", "backdropSaturate") ?? "")})`]];
|
|
33
|
+
if (filter.length > 0)
|
|
34
|
+
surface.push(["filter", filter.join(" ")]);
|
|
35
|
+
if (backdrop.length > 0)
|
|
36
|
+
surface.push(["backdrop-filter", backdrop.join(" ")]);
|
|
37
|
+
if (frame.some(([property]) => property === "border-width") && !frame.some(([property]) => property === "border-style"))
|
|
38
|
+
frame.push(["border-style", "solid"]);
|
|
39
|
+
const focus = profile.kind === "focus" ? [...declarations("focus"), ["outline-style", "solid"]] : [], text = declarations("text"), gap = declarations("spacing"), glyph = stated("visual", "size") ?? null, inline = stated("frame", "inlineSize") ?? null, block = stated("frame", "blockSize") ?? null, resolved = (value) => {
|
|
40
|
+
const token = /--[\w-]+/.exec(value)?.[0];
|
|
41
|
+
return token === void 0 ? value : tokenValue(token) ?? "";
|
|
42
|
+
}, relative = [inline, block].some((value) => value !== null && resolved(value).includes("%")), extent = inline === null && block === null ? null : { inline: inline === null ? null : css(inline), block: block === null ? null : css(block), relative }, controlFrame = of("frame") !== void 0 && (stated("frame", "minBlockSize") !== void 0 || stated("frame", "minimumBlockInset") !== void 0) && ["paddingInline", "paddingInlineStart", "padding"].some((field) => stated("frame", field) !== void 0), boxed = frame.length > 0 || surface.length > 0 || extent !== null, lockup = !boxed && glyph !== null && text.length > 0, gaps = (of("spacing")?.fields ?? []).filter((field) => field.profile === null).map((field) => ({ field: field.field, value: css(field.value) })), shape = profile.kind === "focus" ? "focus" : controlFrame && (of("text") !== void 0 || glyph !== null) ? "control" : boxed ? "box" : lockup ? "text" : gap.length > 0 ? "gap" : text.length > 0 ? "text" : glyph !== null ? "visual" : null;
|
|
43
|
+
if (shape === null)
|
|
44
|
+
return null;
|
|
45
|
+
const inset = frame.some(([property]) => property.startsWith("padding")), sized = extent !== null && !(extent.relative && inset), content = shape === "control" || lockup ? "label" : sized && gap.length === 0 && text.length === 0 ? "empty" : gap.length > 0 ? "blocks" : text.length > 0 ? "text" : frame.length > 0 || extent !== null ? "block" : "label", notes = sources.filter((source) => source.kind !== "focus").flatMap((source) => (NOTED[source.kind] ?? []).flatMap((field) => {
|
|
46
|
+
const value = source.fields.find((item) => item.field === field)?.value;
|
|
47
|
+
return value === void 0 ? [] : [{ kind: source.kind, field, value: value.replace(/^var\(\s*(--[\w-]+)\s*\)$/, "$1") }];
|
|
48
|
+
})), values = (list) => list.map(([property, value]) => [property, css(value)]);
|
|
49
|
+
return {
|
|
50
|
+
shape,
|
|
51
|
+
content,
|
|
52
|
+
outlined: shape !== "control" && (surface.length > 0 || focus.length > 0),
|
|
53
|
+
box: values([...frame, ...surface, ...shape === "control" || lockup || content === "blocks" ? gap : [], ...focus]),
|
|
54
|
+
text: values(text),
|
|
55
|
+
glyph: glyph === null ? null : css(glyph),
|
|
56
|
+
extent,
|
|
57
|
+
gaps,
|
|
58
|
+
notes: profile.kind === "composite" ? notes : []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
14
61
|
export function profileViewFacts(foundation) {
|
|
15
62
|
const fields = (entries) => Object.entries(entries).sort(([a], [b]) => byName(a, b)).map(([field, { value, origin }]) => {
|
|
16
63
|
const tokens = references(value).map((name) => ({ name, role: foundation.tokens.get(name)?.role ?? null })), [only] = tokens, role = tokens.length === 1 ? only?.role ?? null : null, stated = origin.includes(".") ? origin.slice(0, origin.lastIndexOf(".")) : origin;
|
|
@@ -26,7 +73,11 @@ export function profileViewFacts(foundation) {
|
|
|
26
73
|
name: choice,
|
|
27
74
|
default: chosen,
|
|
28
75
|
options: Object.entries(options).map(([option, entries]) => ({ name: option, fields: fields(entries) }))
|
|
29
|
-
}))
|
|
76
|
+
})),
|
|
77
|
+
steps: Object.entries(summary.clauses).flatMap(([key, values]) => {
|
|
78
|
+
const at = /^ads-step at-(\d+)$/.exec(key)?.[1];
|
|
79
|
+
return at === void 0 ? [] : [{ at: Number(at), fields: fields(Object.fromEntries(Object.entries(values).map(([field, value]) => [field, { value, origin: name }]))) }];
|
|
80
|
+
}).sort((a, b) => a.at - b.at)
|
|
30
81
|
})), users = new Map, use = (used, user) => void (users.get(used) ?? users.set(used, new Set).get(used))?.add(user);
|
|
31
82
|
for (const profile of profiles) {
|
|
32
83
|
for (const input of profile.inputs)
|
|
@@ -35,7 +86,7 @@ export function profileViewFacts(foundation) {
|
|
|
35
86
|
if (field.profile !== null)
|
|
36
87
|
use(field.profile, profile.name);
|
|
37
88
|
}
|
|
38
|
-
const sorted = profiles.map((profile) => ({ ...profile, usedBy: [...users.get(profile.name) ?? []].sort(byName) })).sort((a, b) => byKind(a.kind, b.kind) || byName(a.name, b.name)), counts = new Map;
|
|
89
|
+
const named = new Map(profiles.map((profile) => [profile.name, profile])), [base] = tokenValueContexts(foundation), tokenValue = (name) => base?.values.get(name), sorted = profiles.map((profile) => ({ ...profile, usedBy: [...users.get(profile.name) ?? []].sort(byName), applied: profileApplied(profile, (name) => named.get(name), tokenValue) })).sort((a, b) => byKind(a.kind, b.kind) || byName(a.name, b.name)), counts = new Map;
|
|
39
90
|
for (const profile of sorted)
|
|
40
91
|
counts.set(profile.kind, (counts.get(profile.kind) ?? 0) + 1);
|
|
41
92
|
return { kinds: [...counts].map(([kind, count]) => ({ kind, count })), profiles: sorted };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** A prose element's name in a recipe, with the tags it selects. */
|
|
2
|
+
export declare const PROSE_ELEMENTS: {
|
|
3
|
+
readonly paragraph: readonly ["p"];
|
|
4
|
+
readonly heading1: readonly ["h1"];
|
|
5
|
+
readonly heading2: readonly ["h2"];
|
|
6
|
+
readonly heading3: readonly ["h3"];
|
|
7
|
+
readonly heading4: readonly ["h4"];
|
|
8
|
+
readonly heading5: readonly ["h5"];
|
|
9
|
+
readonly heading6: readonly ["h6"];
|
|
10
|
+
readonly list: readonly ["ul", "ol"];
|
|
11
|
+
readonly item: readonly ["li"];
|
|
12
|
+
readonly quote: readonly ["blockquote"];
|
|
13
|
+
readonly rule: readonly ["hr"];
|
|
14
|
+
readonly pre: readonly ["pre"];
|
|
15
|
+
readonly table: readonly ["table"];
|
|
16
|
+
readonly headerCell: readonly ["th"];
|
|
17
|
+
readonly cell: readonly ["td"];
|
|
18
|
+
readonly figure: readonly ["figure"];
|
|
19
|
+
readonly caption: readonly ["figcaption"];
|
|
20
|
+
readonly media: readonly ["img", "video", "iframe"];
|
|
21
|
+
readonly descriptions: readonly ["dl"];
|
|
22
|
+
readonly term: readonly ["dt"];
|
|
23
|
+
readonly definition: readonly ["dd"];
|
|
24
|
+
readonly link: readonly ["a"];
|
|
25
|
+
readonly strong: readonly ["strong", "b"];
|
|
26
|
+
readonly emphasis: readonly ["em", "i"];
|
|
27
|
+
readonly deleted: readonly ["del", "s"];
|
|
28
|
+
readonly code: readonly ["code"];
|
|
29
|
+
readonly sub: readonly ["sub"];
|
|
30
|
+
readonly sup: readonly ["sup"];
|
|
31
|
+
readonly kbd: readonly ["kbd"];
|
|
32
|
+
readonly mark: readonly ["mark"];
|
|
33
|
+
};
|
|
34
|
+
export type ProseElementName = keyof typeof PROSE_ELEMENTS;
|
|
35
|
+
export declare const PROSE_ELEMENT_NAMES: readonly ProseElementName[];
|
|
36
|
+
/** Every tag prose styles, with the element it belongs to. */
|
|
37
|
+
export declare const PROSE_TAGS: ReadonlyMap<string, ProseElementName>;
|
|
38
|
+
/**
|
|
39
|
+
* Tags that carry no design of their own but are part of content: a table's row groups and rows belong
|
|
40
|
+
* to its `table` element, and a line break belongs to any prose. The markup checks accept them as
|
|
41
|
+
* content; no rule is written for them.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PROSE_STRUCTURE: ReadonlyMap<string, ProseElementName | null>;
|
|
44
|
+
/** Whether a tag can be content of a prose owner: a styled tag or a structural one. */
|
|
45
|
+
export declare const isProseTag: (tag: string) => boolean;
|
|
46
|
+
/** The content tags a recipe that declares `names` accepts: their own tags, and the structure that comes with them. */
|
|
47
|
+
export declare function proseContentTags(names: Iterable<ProseElementName>): ReadonlySet<string>;
|
|
48
|
+
/** Elements that stand as blocks in the flow: they take the rhythm before them. */
|
|
49
|
+
export declare const PROSE_BLOCKS: readonly ProseElementName[];
|
|
50
|
+
/** The elements whose text can sit directly inside `container`: what its background must carry. */
|
|
51
|
+
export declare function proseContents(container: ProseElementName): readonly ProseElementName[];
|
|
52
|
+
/** The selector of one tag inside the prose root: plain markup only. */
|
|
53
|
+
export declare const proseSelector: (tag: string) => string;
|
|
54
|
+
/** `&:hover` on an element's selector: the state is the element's own. */
|
|
55
|
+
export declare const proseState: (selector: string, condition: string) => string;
|
|
56
|
+
/** The first plain element of the root and of a plain container: its start margin is cancelled. */
|
|
57
|
+
export declare const PROSE_FIRST: readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* A component placed directly in the prose root (it has a class) is a block of the flow like any
|
|
60
|
+
* other: it takes the rhythm before it, unless it comes first. Space between siblings is the
|
|
61
|
+
* container's to give; the component's own design is untouched. A component inside a paragraph or
|
|
62
|
+
* another plain element is inline content and is left alone.
|
|
63
|
+
*/
|
|
64
|
+
export declare const PROSE_COMPONENT = "& > :not(:first-child)[class]";
|
|
65
|
+
type Values = Readonly<Record<string, string>>;
|
|
66
|
+
/**
|
|
67
|
+
* The browser defaults ADS replaces on an element, whatever the recipe declares for it: margins
|
|
68
|
+
* (the rhythm owns the space between blocks), a quote's and a figure's indent, a rule's inset border,
|
|
69
|
+
* media wider than its column, a table's doubled borders.
|
|
70
|
+
*/
|
|
71
|
+
export declare function proseDefaults(name: ProseElementName): Values;
|
|
72
|
+
/**
|
|
73
|
+
* The emitted record of a design system's prose owners, beside its public entry: exported name → the
|
|
74
|
+
* plain tags its recipe declares. The design-use check of application source reads it, because an
|
|
75
|
+
* emitted owner no longer carries its recipe.
|
|
76
|
+
*/
|
|
77
|
+
export declare const PROSE_MANIFEST = "ads-prose.json";
|
|
78
|
+
export declare const proseManifestText: (owners: ReadonlyMap<string, ReadonlySet<string>>) => string;
|
|
79
|
+
/** The owners a manifest text records; entries that are not a list of prose tags are dropped. */
|
|
80
|
+
export declare function parseProseManifest(text: string): ReadonlyMap<string, ReadonlySet<string>>;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const PROSE_ELEMENTS = {
|
|
2
|
+
paragraph: ["p"],
|
|
3
|
+
heading1: ["h1"],
|
|
4
|
+
heading2: ["h2"],
|
|
5
|
+
heading3: ["h3"],
|
|
6
|
+
heading4: ["h4"],
|
|
7
|
+
heading5: ["h5"],
|
|
8
|
+
heading6: ["h6"],
|
|
9
|
+
list: ["ul", "ol"],
|
|
10
|
+
item: ["li"],
|
|
11
|
+
quote: ["blockquote"],
|
|
12
|
+
rule: ["hr"],
|
|
13
|
+
pre: ["pre"],
|
|
14
|
+
table: ["table"],
|
|
15
|
+
headerCell: ["th"],
|
|
16
|
+
cell: ["td"],
|
|
17
|
+
figure: ["figure"],
|
|
18
|
+
caption: ["figcaption"],
|
|
19
|
+
media: ["img", "video", "iframe"],
|
|
20
|
+
descriptions: ["dl"],
|
|
21
|
+
term: ["dt"],
|
|
22
|
+
definition: ["dd"],
|
|
23
|
+
link: ["a"],
|
|
24
|
+
strong: ["strong", "b"],
|
|
25
|
+
emphasis: ["em", "i"],
|
|
26
|
+
deleted: ["del", "s"],
|
|
27
|
+
code: ["code"],
|
|
28
|
+
sub: ["sub"],
|
|
29
|
+
sup: ["sup"],
|
|
30
|
+
kbd: ["kbd"],
|
|
31
|
+
mark: ["mark"]
|
|
32
|
+
}, PROSE_ELEMENT_NAMES = Object.keys(PROSE_ELEMENTS), PROSE_TAGS = new Map(PROSE_ELEMENT_NAMES.flatMap((name) => PROSE_ELEMENTS[name].map((tag) => [tag, name]))), PROSE_STRUCTURE = new Map([
|
|
33
|
+
["thead", "table"],
|
|
34
|
+
["tbody", "table"],
|
|
35
|
+
["tfoot", "table"],
|
|
36
|
+
["tr", "table"],
|
|
37
|
+
["br", null]
|
|
38
|
+
]), isProseTag = (tag) => PROSE_TAGS.has(tag) || PROSE_STRUCTURE.has(tag);
|
|
39
|
+
export function proseContentTags(names) {
|
|
40
|
+
const declared = new Set(names), tags = new Set([...declared].flatMap((name) => PROSE_ELEMENTS[name]));
|
|
41
|
+
for (const [tag, owner] of PROSE_STRUCTURE)
|
|
42
|
+
if (owner === null || declared.has(owner))
|
|
43
|
+
tags.add(tag);
|
|
44
|
+
return tags;
|
|
45
|
+
}
|
|
46
|
+
export const PROSE_BLOCKS = ["paragraph", "heading1", "heading2", "heading3", "heading4", "heading5", "heading6", "list", "quote", "rule", "pre", "table", "figure", "descriptions"];
|
|
47
|
+
const INLINE = ["link", "strong", "emphasis", "deleted", "code", "sub", "sup", "kbd", "mark"], FLOW_CONTAINERS = ["item", "quote", "cell", "headerCell", "figure", "definition"];
|
|
48
|
+
export function proseContents(container) {
|
|
49
|
+
if (FLOW_CONTAINERS.includes(container))
|
|
50
|
+
return PROSE_ELEMENT_NAMES.filter((name) => name !== container || container === "item" || container === "quote");
|
|
51
|
+
if (container === "list")
|
|
52
|
+
return ["item"];
|
|
53
|
+
if (container === "table")
|
|
54
|
+
return ["headerCell", "cell", "caption"];
|
|
55
|
+
if (container === "descriptions")
|
|
56
|
+
return ["term", "definition"];
|
|
57
|
+
if (container === "rule" || container === "media")
|
|
58
|
+
return [];
|
|
59
|
+
if (container === "pre")
|
|
60
|
+
return ["code"];
|
|
61
|
+
if (container === "code")
|
|
62
|
+
return [];
|
|
63
|
+
return INLINE.filter((name) => name !== container);
|
|
64
|
+
}
|
|
65
|
+
export const proseSelector = (tag) => `& ${tag}:not([class])`, proseState = (selector, condition) => `${selector}${condition.slice(1)}`, PROSE_FIRST = ["& > :first-child:not([class])", "& :not([class]) > :first-child:not([class])"], PROSE_COMPONENT = "& > :not(:first-child)[class]";
|
|
66
|
+
export function proseDefaults(name) {
|
|
67
|
+
switch (name) {
|
|
68
|
+
case "quote":
|
|
69
|
+
case "figure":
|
|
70
|
+
return { "margin-inline-start": "0", "margin-inline-end": "0" };
|
|
71
|
+
case "definition":
|
|
72
|
+
return { "margin-inline-start": "0" };
|
|
73
|
+
case "rule":
|
|
74
|
+
return { "border-top-width": "0", "border-right-width": "0", "border-bottom-width": "0", "border-left-width": "0" };
|
|
75
|
+
case "media":
|
|
76
|
+
return { "max-inline-size": "100%", "block-size": "auto" };
|
|
77
|
+
case "table":
|
|
78
|
+
return { "border-collapse": "collapse" };
|
|
79
|
+
case "pre":
|
|
80
|
+
return { overflow: "auto hidden" };
|
|
81
|
+
default:
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const PROSE_MANIFEST = "ads-prose.json", proseManifestText = (owners) => `${JSON.stringify(Object.fromEntries([...owners].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, tags]) => [name, [...tags].sort()])), null, 2)}
|
|
86
|
+
`;
|
|
87
|
+
export function parseProseManifest(text) {
|
|
88
|
+
const owners = new Map;
|
|
89
|
+
let value;
|
|
90
|
+
try {
|
|
91
|
+
value = JSON.parse(text);
|
|
92
|
+
} catch {
|
|
93
|
+
return owners;
|
|
94
|
+
}
|
|
95
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
96
|
+
return owners;
|
|
97
|
+
for (const [name, tags] of Object.entries(value))
|
|
98
|
+
if (Array.isArray(tags))
|
|
99
|
+
owners.set(name, new Set(tags.filter((tag) => typeof tag === "string" && isProseTag(tag))));
|
|
100
|
+
return owners;
|
|
101
|
+
}
|
package/dist/recipe-macro.d.mts
CHANGED
|
@@ -18,7 +18,30 @@ export interface Placement {
|
|
|
18
18
|
readonly visible?: boolean;
|
|
19
19
|
readonly at?: Readonly<Record<string, Placement>>;
|
|
20
20
|
}
|
|
21
|
-
export type Layout = "inline" | "stack" | "fluid" | "hybrid" | "fixed" | "flow" | "inherited" | "layered";
|
|
21
|
+
export type Layout = "inline" | "stack" | "fluid" | "hybrid" | "fixed" | "flow" | "inherited" | "layered" | "prose";
|
|
22
|
+
/** A profile field of the nearest recipe's spacing slot. */
|
|
23
|
+
type SpacingField = {
|
|
24
|
+
readonly slot: "spacing";
|
|
25
|
+
readonly field: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* One element of a prose root (`layout: "prose"`): the profiles its plain markup takes, by name.
|
|
29
|
+
* `spaceBefore` (blocks) replaces the rhythm before it, `indent` (list) is its start inset, `marker`
|
|
30
|
+
* (item) a colour-only surface.
|
|
31
|
+
*/
|
|
32
|
+
export interface ProseElement {
|
|
33
|
+
readonly text?: string;
|
|
34
|
+
readonly surface?: string;
|
|
35
|
+
readonly frame?: string;
|
|
36
|
+
readonly when?: Readonly<Record<string, {
|
|
37
|
+
readonly surface: string;
|
|
38
|
+
}>>;
|
|
39
|
+
readonly spaceBefore?: SpacingField;
|
|
40
|
+
readonly indent?: SpacingField;
|
|
41
|
+
readonly marker?: string;
|
|
42
|
+
}
|
|
43
|
+
/** The elements a prose root styles. */
|
|
44
|
+
export type ProseElementName = "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "list" | "item" | "quote" | "rule" | "pre" | "table" | "headerCell" | "cell" | "figure" | "caption" | "media" | "descriptions" | "term" | "definition" | "link" | "strong" | "emphasis" | "deleted" | "code" | "sub" | "sup" | "kbd" | "mark";
|
|
22
45
|
/** A logical side of the box; it mirrors with the writing direction. */
|
|
23
46
|
export type Side = "block-start" | "block-end" | "inline-start" | "inline-end";
|
|
24
47
|
export type Frame = "control" | "container" | {
|
|
@@ -27,6 +50,12 @@ export type Frame = "control" | "container" | {
|
|
|
27
50
|
readonly ratio?: string;
|
|
28
51
|
/** One-sided rules on these sides only: the frame profile's border width, the surface's border colour. */
|
|
29
52
|
readonly rules?: readonly Side[];
|
|
53
|
+
/** A region root's frame: the corners it rounds by the frame profile's `radius` (block then inline edge); the others are square. Every corner without it. */
|
|
54
|
+
readonly corners?: readonly ("start-start" | "start-end" | "end-start" | "end-end")[];
|
|
55
|
+
}
|
|
56
|
+
/** On a part: its own box (padding, border, radius, sizes) from a named frame profile. */
|
|
57
|
+
| {
|
|
58
|
+
readonly profile: string;
|
|
30
59
|
};
|
|
31
60
|
/** The pointer cursors an element may show: a closed set, no image cursors. */
|
|
32
61
|
export type Cursor = "pointer" | "default" | "grab" | "grabbing" | "col-resize" | "row-resize" | "move" | "text" | "not-allowed";
|
|
@@ -48,6 +77,8 @@ interface NativeNormalization {
|
|
|
48
77
|
readonly userSelect?: "none";
|
|
49
78
|
}
|
|
50
79
|
export interface Normalization extends NativeNormalization {
|
|
80
|
+
/** A `<textarea>` part only: the user resizes it by its block edge, or not at all. */
|
|
81
|
+
readonly resize?: "vertical" | "none";
|
|
51
82
|
readonly when?: Readonly<Record<string, NativeNormalization>>;
|
|
52
83
|
}
|
|
53
84
|
/** Scroll snap on the element that scrolls: its axis (`x` inline, `y` block) and strictness, and where each child it places snaps. */
|
|
@@ -60,7 +91,7 @@ export type Overflow = "clip" | "scroll-block" | "scroll-inline" | "scroll-both"
|
|
|
60
91
|
/** A native element the region or part renders, for its closed normalization. */
|
|
61
92
|
export type NativeElement = "iframe" | "select" | "search-input" | "text-input" | "table" | "header-cell" | "cell" | "list" | "summary";
|
|
62
93
|
/** A paint a surface treatment can transition. */
|
|
63
|
-
export type PaintChannel = "background-color" | "border-color" | "color" | "box-shadow";
|
|
94
|
+
export type PaintChannel = "background-color" | "border-color" | "color" | "box-shadow" | "filter" | "backdrop-filter" | "opacity";
|
|
64
95
|
/** Paint channels of one element that change between its state surfaces, timed by a motion profile. */
|
|
65
96
|
export interface PaintTransition {
|
|
66
97
|
readonly channels: readonly PaintChannel[];
|
|
@@ -69,6 +100,33 @@ export interface PaintTransition {
|
|
|
69
100
|
readonly slot: "motion";
|
|
70
101
|
} | string;
|
|
71
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* An entrance: the element starts from `from` on its first render and settles into its own look over
|
|
105
|
+
* `motion`. `from.surface` is a surface profile that states only `opacity` and `blur`; at most one
|
|
106
|
+
* movement, read from the entrance's motion profile (`translate` its `distance` on the block axis,
|
|
107
|
+
* `scale` its `scale`, `rotate` its `angle`).
|
|
108
|
+
*/
|
|
109
|
+
export interface Enter {
|
|
110
|
+
readonly from: {
|
|
111
|
+
readonly surface?: string;
|
|
112
|
+
readonly translate?: {
|
|
113
|
+
readonly slot: "motion";
|
|
114
|
+
readonly field: "distance";
|
|
115
|
+
};
|
|
116
|
+
readonly scale?: {
|
|
117
|
+
readonly slot: "motion";
|
|
118
|
+
readonly field: "scale";
|
|
119
|
+
};
|
|
120
|
+
readonly rotate?: {
|
|
121
|
+
readonly slot: "motion";
|
|
122
|
+
readonly field: "angle";
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/** The nearest recipe's motion slot (`{ slot: "motion" }`) or a named motion profile: a duration, an easing and `reduced: "static"`. */
|
|
126
|
+
readonly motion: {
|
|
127
|
+
readonly slot: "motion";
|
|
128
|
+
} | string;
|
|
129
|
+
}
|
|
72
130
|
/** A colour-only surface on a part's pseudo-element, with owner-state treatments. */
|
|
73
131
|
export interface PseudoTreatment {
|
|
74
132
|
readonly surface: ProfileReference;
|
|
@@ -115,7 +173,8 @@ export type MeasuredLengthProperty = "inset-block-start" | "inset-block-end" | "
|
|
|
115
173
|
export type MeasuredDeclaration = {
|
|
116
174
|
readonly type: "length";
|
|
117
175
|
readonly property: MeasuredLengthProperty;
|
|
118
|
-
readonly fallback?: number;
|
|
176
|
+
readonly fallback?: number; /** The motion profile that animates a change of the value. */
|
|
177
|
+
readonly motion?: string;
|
|
119
178
|
} | {
|
|
120
179
|
readonly type: "transform";
|
|
121
180
|
readonly property: "translate";
|
|
@@ -123,6 +182,7 @@ export type MeasuredDeclaration = {
|
|
|
123
182
|
readonly x: number;
|
|
124
183
|
readonly y: number;
|
|
125
184
|
};
|
|
185
|
+
readonly motion?: string;
|
|
126
186
|
}
|
|
127
187
|
/** One track (1-based) of a grid's own track list. */
|
|
128
188
|
| {
|
|
@@ -130,6 +190,7 @@ export type MeasuredDeclaration = {
|
|
|
130
190
|
readonly property: "grid-template-columns" | "grid-template-rows";
|
|
131
191
|
readonly track: number;
|
|
132
192
|
readonly fallback?: number;
|
|
193
|
+
readonly motion?: string;
|
|
133
194
|
}
|
|
134
195
|
/** A cropped image's focal point (a visual part whose visual profile declares `fit: "cover"`): centred until given. */
|
|
135
196
|
| {
|
|
@@ -200,6 +261,8 @@ export interface RecipeSpec {
|
|
|
200
261
|
readonly gap?: SlotField;
|
|
201
262
|
readonly rowGap?: SlotField;
|
|
202
263
|
readonly columns?: number;
|
|
264
|
+
/** A fluid grid with local `columns`: the share of the width each column takes (`[0.85, 1.15]`); every column weighs 1 without it. */
|
|
265
|
+
readonly weights?: readonly number[];
|
|
203
266
|
readonly rows?: readonly ("auto" | "fill")[];
|
|
204
267
|
readonly gutter?: string;
|
|
205
268
|
readonly margin?: "none";
|
|
@@ -219,6 +282,11 @@ export interface RecipeSpec {
|
|
|
219
282
|
readonly textEdge?: readonly ("cap" | "alphabetic")[];
|
|
220
283
|
readonly transition?: readonly ("translate" | "scale" | "rotate")[];
|
|
221
284
|
readonly translateInline?: SlotField;
|
|
285
|
+
/** A scale on one axis only, the other at rest (a blink): the motion profile's `scale`. */
|
|
286
|
+
readonly scaleInline?: SlotField;
|
|
287
|
+
readonly scaleBlock?: SlotField;
|
|
288
|
+
/** A region part's travel on the block axis under an owner state (its picture lifting while the card is hovered). */
|
|
289
|
+
readonly translateBlock?: SlotField;
|
|
222
290
|
readonly scale?: SlotField;
|
|
223
291
|
readonly rotate?: SlotField;
|
|
224
292
|
readonly repeat?: "continuous";
|
|
@@ -245,6 +313,40 @@ export interface RecipeSpec {
|
|
|
245
313
|
readonly snap?: SnapDeclaration;
|
|
246
314
|
readonly theme?: string;
|
|
247
315
|
readonly paintTransition?: PaintTransition;
|
|
316
|
+
/**
|
|
317
|
+
* A visual part shown under one colour scheme only: the light or the dark file of a content image. Its
|
|
318
|
+
* sibling declares the other scheme; both `<img>` elements are in the markup and CSS displays the one
|
|
319
|
+
* for the theme in effect, however the page selected it.
|
|
320
|
+
*/
|
|
321
|
+
readonly scheme?: "light" | "dark";
|
|
322
|
+
/** A layered backdrop part: how far it is drawn past its parent's box on each axis, from the spacing slot. */
|
|
323
|
+
readonly outset?: {
|
|
324
|
+
readonly block?: SpacingField;
|
|
325
|
+
readonly inline?: SpacingField;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Plays a `sequence` profile's steps: whenever the element is rendered (on a recipe root, a region
|
|
329
|
+
* part, a control's visual part or a standalone artwork part), or under an owner state (in a `when`
|
|
330
|
+
* entry). `order` starts it that many of the profile's staggers late.
|
|
331
|
+
*/
|
|
332
|
+
readonly play?: {
|
|
333
|
+
readonly sequence: string;
|
|
334
|
+
readonly order?: number;
|
|
335
|
+
};
|
|
336
|
+
/** A prose root: the space between its blocks, from the spacing slot. */
|
|
337
|
+
readonly rhythm?: SpacingField;
|
|
338
|
+
/** A prose root: the plain elements it styles, wherever they nest in its content. */
|
|
339
|
+
readonly elements?: Readonly<Partial<Record<ProseElementName, ProseElement>>>;
|
|
340
|
+
/**
|
|
341
|
+
* The root or part stays at an edge of its scrolling container while the rest scrolls. `clear:
|
|
342
|
+
* "block-start"` holds it below a region at the top by the layer profile's `clearBlockStart`.
|
|
343
|
+
*/
|
|
344
|
+
readonly sticky?: {
|
|
345
|
+
readonly edge: "block-start" | "block-end";
|
|
346
|
+
readonly clear?: "none" | "block-start";
|
|
347
|
+
};
|
|
348
|
+
/** An entrance on first render: the root or part starts from `from` and settles into its own look. */
|
|
349
|
+
readonly enter?: Enter;
|
|
248
350
|
/** Pseudo-element treatments of an `<input>` or `<textarea>` part. */
|
|
249
351
|
readonly pseudo?: {
|
|
250
352
|
readonly placeholder?: PseudoTreatment;
|