@master/internal-site 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/astro.d.mts +3 -0
- package/dist/astro.mjs +510 -0
- package/dist/config.d.mts +69 -0
- package/dist/config.mjs +10 -0
- package/package.json +384 -4
- package/src/astro/Page.astro +12 -0
- package/src/astro/content-pages.ts +75 -0
- package/src/astro/index.ts +124 -0
- package/src/astro/module-id.ts +4 -0
- package/src/astro/propagated-assets.ts +29 -0
- package/src/astro/route-paths.ts +78 -0
- package/src/astro/routes.template.ts +110 -0
- package/src/astro/server-styles.ts +26 -0
- package/src/astro/site-context.ts +27 -0
- package/src/astro/source-url.ts +22 -0
- package/src/astro/svelte-renderer.ts +45 -0
- package/src/astro/svg-markup.ts +23 -0
- package/src/benchmarks/BenchmarkBarRows.astro +34 -0
- package/src/benchmarks/BenchmarkBars.astro +14 -0
- package/src/benchmarks/BenchmarkChart.astro +53 -0
- package/src/benchmarks/BenchmarkChartGroup.astro +24 -0
- package/src/benchmarks/BenchmarkDataTable.astro +24 -0
- package/src/benchmarks/BenchmarkDelta.astro +23 -0
- package/src/benchmarks/BenchmarkFigure.astro +30 -0
- package/src/benchmarks/BenchmarkMetricTable.astro +38 -0
- package/src/benchmarks/BenchmarkMetrics.astro +23 -0
- package/src/benchmarks/BenchmarkSampleSummary.astro +30 -0
- package/src/benchmarks/BenchmarkScrollRegion.svelte +27 -0
- package/src/benchmarks/BenchmarkSource.astro +20 -0
- package/src/benchmarks/BenchmarkStackedBars.astro +54 -0
- package/src/benchmarks/BenchmarkStatus.astro +16 -0
- package/src/benchmarks/types.ts +98 -0
- package/src/benchmarks/utils.ts +42 -0
- package/src/blog/BlogAuthors.astro +25 -0
- package/src/blog/article/BlogArticleContents.svelte +24 -0
- package/src/blog/article/BlogArticleEnd.astro +55 -0
- package/src/blog/article/BlogArticleMasthead.astro +61 -0
- package/src/blog/article/language.ts +29 -0
- package/src/blog/article/neighbors.ts +27 -0
- package/src/blog/article/title-lines.astro +14 -0
- package/src/blog/article/title-parts.ts +9 -0
- package/src/components.d.ts +5 -0
- package/src/config.ts +68 -0
- package/src/css/ButtonPreview.astro +22 -0
- package/src/css/ConfiguredExample.astro +15 -0
- package/src/css/NamespaceUtilityTable.astro +50 -0
- package/src/css/StylesheetExample.astro +15 -0
- package/src/css/ThemeNumberVariableTable.astro +57 -0
- package/src/css/configured-example.ts +53 -0
- package/src/css/foundation-data/elevation/shadow-data.ts +52 -0
- package/src/css/foundation-data/sizing/scale-data.ts +37 -0
- package/src/css/foundation-data/specimen-content.ts +10 -0
- package/src/css/foundation-data/specimens.ts +96 -0
- package/src/css/foundation-data/tokens.ts +32 -0
- package/src/css/generate-preset-css.ts +12 -0
- package/src/css/highlight.ts +34 -0
- package/src/css/manifest-utilities.ts +29 -0
- package/src/css/markdown.ts +279 -0
- package/src/css/preset-css.ts +15 -0
- package/src/css/preset-manifest.ts +3 -0
- package/src/css/stylesheet-example.ts +26 -0
- package/src/css/theme-variables.ts +74 -0
- package/src/css/variable-namespace-sources.ts +20 -0
- package/src/demo/Demo.svelte +55 -0
- package/src/demo/DemoAsset.astro +38 -0
- package/src/demo/DemoAxes.svelte +22 -0
- package/src/demo/DemoBadge.svelte +18 -0
- package/src/demo/DemoCatalog.astro +36 -0
- package/src/demo/DemoComparison.svelte +36 -0
- package/src/demo/DemoConfiguredExample.astro +48 -0
- package/src/demo/DemoContainer.svelte +48 -0
- package/src/demo/DemoControls.svelte +16 -0
- package/src/demo/DemoCopyButton.svelte +50 -0
- package/src/demo/DemoCopyGroup.svelte +15 -0
- package/src/demo/DemoExample.astro +27 -0
- package/src/demo/DemoFeatureSupport.svelte +18 -0
- package/src/demo/DemoGeneratedCSS.svelte +8 -0
- package/src/demo/DemoIndex.astro +23 -0
- package/src/demo/DemoInstallation.astro +17 -0
- package/src/demo/DemoItem.svelte +17 -0
- package/src/demo/DemoLabel.svelte +15 -0
- package/src/demo/DemoLegend.svelte +15 -0
- package/src/demo/DemoMeasure.svelte +28 -0
- package/src/demo/DemoMedia.svelte +43 -0
- package/src/demo/DemoMotion.svelte +41 -0
- package/src/demo/DemoPageViewport.astro +17 -0
- package/src/demo/DemoPalette.astro +29 -0
- package/src/demo/DemoPaletteGroups.svelte +15 -0
- package/src/demo/DemoScrollArea.svelte +15 -0
- package/src/demo/DemoStyleComparison.astro +25 -0
- package/src/demo/DemoSurface.svelte +15 -0
- package/src/demo/DemoSwatch.svelte +19 -0
- package/src/demo/DemoThemeComparison.astro +30 -0
- package/src/demo/DemoTokenTable.astro +34 -0
- package/src/demo/DemoViewTransition.astro +18 -0
- package/src/demo/DemoViewport.svelte +324 -0
- package/src/demo/DemoWaterfall.astro +30 -0
- package/src/demo/FoundationBreakpoint.astro +12 -0
- package/src/demo/ProjectStyleExample.astro +13 -0
- package/src/demo/copy-feedback.ts +10 -0
- package/src/demo/demo-waterfall.ts +17 -0
- package/src/demo/drag-readings.ts +20 -0
- package/src/demo/foundations/FoundationAxes.astro +12 -0
- package/src/demo/foundations/FoundationColorRoles.astro +5 -0
- package/src/demo/foundations/FoundationContainerGrid.astro +24 -0
- package/src/demo/foundations/FoundationDialog.astro +14 -0
- package/src/demo/foundations/FoundationElevation.astro +5 -0
- package/src/demo/foundations/FoundationElevationState.astro +5 -0
- package/src/demo/foundations/FoundationHue.astro +5 -0
- package/src/demo/foundations/FoundationLines.astro +5 -0
- package/src/demo/foundations/FoundationMedia.astro +28 -0
- package/src/demo/foundations/FoundationMotion.astro +5 -0
- package/src/demo/foundations/FoundationPalette.astro +8 -0
- package/src/demo/foundations/FoundationRadius.astro +13 -0
- package/src/demo/foundations/FoundationShapes.astro +12 -0
- package/src/demo/foundations/FoundationShrink.astro +14 -0
- package/src/demo/foundations/FoundationSizing.astro +19 -0
- package/src/demo/foundations/FoundationSpecimen.astro +20 -0
- package/src/demo/foundations/FoundationSurfaces.astro +5 -0
- package/src/demo/foundations/FoundationTextHue.astro +5 -0
- package/src/demo/foundations/FoundationTextRoles.astro +5 -0
- package/src/demo/foundations/FoundationTokens.astro +22 -0
- package/src/demo/foundations/FoundationTokensView.astro +65 -0
- package/src/demo/foundations/FoundationTransition.astro +5 -0
- package/src/demo/foundations/FoundationTypeComparison.astro +12 -0
- package/src/demo/foundations/FoundationTypography.astro +5 -0
- package/src/demo/foundations/Palette.svelte +37 -0
- package/src/demo/foundations/ShadowScaleDemo.astro +22 -0
- package/src/demo/illustration-materials.ts +180 -0
- package/src/demo/maintenance-example.ts +62 -0
- package/src/demo/playback.ts +75 -0
- package/src/demo/project-style-examples.ts +128 -0
- package/src/demo/reference/alignment.ts +42 -0
- package/src/demo/reference/animations.ts +30 -0
- package/src/demo/reference/backgrounds.ts +39 -0
- package/src/demo/reference/border-paint.ts +31 -0
- package/src/demo/reference/clipping.ts +26 -0
- package/src/demo/reference/document.ts +55 -0
- package/src/demo/reference/edges.ts +40 -0
- package/src/demo/reference/effects.ts +27 -0
- package/src/demo/reference/flexbox.ts +33 -0
- package/src/demo/reference/frame.css +118 -0
- package/src/demo/reference/grid.ts +42 -0
- package/src/demo/reference/html.ts +40 -0
- package/src/demo/reference/interaction.ts +42 -0
- package/src/demo/reference/layout-html.ts +10 -0
- package/src/demo/reference/layout.ts +102 -0
- package/src/demo/reference/media.ts +29 -0
- package/src/demo/reference/positioning.ts +90 -0
- package/src/demo/reference/scenes.ts +197 -0
- package/src/demo/reference/scrolling.ts +66 -0
- package/src/demo/reference/shapes.ts +22 -0
- package/src/demo/reference/sizing.ts +43 -0
- package/src/demo/reference/source.ts +8 -0
- package/src/demo/reference/text-effects.ts +37 -0
- package/src/demo/reference/text-flow.ts +41 -0
- package/src/demo/reference/transforms.ts +26 -0
- package/src/demo/reference/transitions.ts +24 -0
- package/src/demo/reference/type-specimens.ts +56 -0
- package/src/demo/reference/types.ts +30 -0
- package/src/demo/reference/typography.ts +32 -0
- package/src/demo/specimens/accent-color.json +50 -0
- package/src/demo/specimens/align-items.json +56 -0
- package/src/demo/specimens/animation-delay.json +55 -0
- package/src/demo/specimens/animation-direction.json +49 -0
- package/src/demo/specimens/animation-fill-mode.json +55 -0
- package/src/demo/specimens/animation-iteration-count.json +55 -0
- package/src/demo/specimens/animation-play-state.json +83 -0
- package/src/demo/specimens/animation-timing-function.json +48 -0
- package/src/demo/specimens/appearance.json +44 -0
- package/src/demo/specimens/aspect-ratio.json +28 -0
- package/src/demo/specimens/backdrop-filter.json +44 -0
- package/src/demo/specimens/background-attachment.json +49 -0
- package/src/demo/specimens/background-image.json +25 -0
- package/src/demo/specimens/background-origin.json +36 -0
- package/src/demo/specimens/background-size.json +29 -0
- package/src/demo/specimens/border-collapse.json +45 -0
- package/src/demo/specimens/border-color.json +35 -0
- package/src/demo/specimens/border-image-repeat.json +50 -0
- package/src/demo/specimens/border-image-slice.json +45 -0
- package/src/demo/specimens/border-radius.json +30 -0
- package/src/demo/specimens/box-decoration-break.json +35 -0
- package/src/demo/specimens/box-shadow.json +33 -0
- package/src/demo/specimens/clear.json +77 -0
- package/src/demo/specimens/clip-path.json +38 -0
- package/src/demo/specimens/content.json +27 -0
- package/src/demo/specimens/counter-set.json +31 -0
- package/src/demo/specimens/fill.json +23 -0
- package/src/demo/specimens/filter.json +23 -0
- package/src/demo/specimens/flex-direction.json +27 -0
- package/src/demo/specimens/flex-grow.json +27 -0
- package/src/demo/specimens/font-style.json +23 -0
- package/src/demo/specimens/font-variant-numeric.json +28 -0
- package/src/demo/specimens/grid-auto-columns.json +29 -0
- package/src/demo/specimens/grid-auto-flow.json +37 -0
- package/src/demo/specimens/grid-template-areas.json +34 -0
- package/src/demo/specimens/grid-template-columns.json +36 -0
- package/src/demo/specimens/isolation.json +25 -0
- package/src/demo/specimens/justify-content.json +36 -0
- package/src/demo/specimens/line-height.json +28 -0
- package/src/demo/specimens/list-style-position.json +36 -0
- package/src/demo/specimens/mask-image.json +54 -0
- package/src/demo/specimens/min-width.json +39 -0
- package/src/demo/specimens/mix-blend-mode.json +43 -0
- package/src/demo/specimens/object-fit.json +27 -0
- package/src/demo/specimens/object-position.json +27 -0
- package/src/demo/specimens/opacity.json +37 -0
- package/src/demo/specimens/order.json +28 -0
- package/src/demo/specimens/overflow-wrap.json +26 -0
- package/src/demo/specimens/overflow.json +53 -0
- package/src/demo/specimens/overscroll-behavior.json +29 -0
- package/src/demo/specimens/padding.json +84 -0
- package/src/demo/specimens/place-content.json +31 -0
- package/src/demo/specimens/pointer-events.json +46 -0
- package/src/demo/specimens/position.json +29 -0
- package/src/demo/specimens/resize.json +32 -0
- package/src/demo/specimens/screen-readers.json +37 -0
- package/src/demo/specimens/scroll-padding.json +29 -0
- package/src/demo/specimens/scroll-snap-stop.json +33 -0
- package/src/demo/specimens/shape-image-threshold.json +37 -0
- package/src/demo/specimens/shape-margin.json +40 -0
- package/src/demo/specimens/shape-outside.json +37 -0
- package/src/demo/specimens/stroke-width.json +27 -0
- package/src/demo/specimens/text-fill-color.json +23 -0
- package/src/demo/specimens/text-stroke-width.json +32 -0
- package/src/demo/specimens/touch-action.json +45 -0
- package/src/demo/specimens/transform-box.json +37 -0
- package/src/demo/specimens/transform-origin.json +56 -0
- package/src/demo/specimens/transform-style.json +55 -0
- package/src/demo/specimens/transform.json +47 -0
- package/src/demo/specimens/transition-delay.json +57 -0
- package/src/demo/specimens/transition-duration.json +60 -0
- package/src/demo/specimens/transition-property.json +60 -0
- package/src/demo/specimens/transition-timing-function.json +65 -0
- package/src/demo/specimens/user-drag.json +28 -0
- package/src/demo/specimens/user-select.json +25 -0
- package/src/demo/specimens/vertical-align.json +28 -0
- package/src/demo/specimens/width.json +56 -0
- package/src/demo/specimens/will-change.json +50 -0
- package/src/demo/specimens/writing-mode.json +26 -0
- package/src/demo/specimens/z-index.json +35 -0
- package/src/demo/style.ts +15 -0
- package/src/demo/tone.ts +4 -0
- package/src/demo/useDemoViewTransition.svelte.ts +71 -0
- package/src/docs-shell/common/i18n.config.d.ts +2 -0
- package/src/docs-shell/common/i18n.config.js +13 -0
- package/src/docs-shell/common/svgo.config.d.ts +2 -0
- package/src/docs-shell/common/svgo.config.js +11 -0
- package/src/docs-shell/components/ArticleHeader.astro +65 -0
- package/src/docs-shell/components/ArticleTOC.astro +18 -0
- package/src/docs-shell/components/Callout.astro +26 -0
- package/src/docs-shell/components/Code.astro +25 -0
- package/src/docs-shell/components/CodeCopyButton.astro +25 -0
- package/src/docs-shell/components/CodeTabBar.astro +40 -0
- package/src/docs-shell/components/CodeTabs.astro +53 -0
- package/src/docs-shell/components/CodeView.astro +23 -0
- package/src/docs-shell/components/Do.astro +5 -0
- package/src/docs-shell/components/DoNot.astro +5 -0
- package/src/docs-shell/components/DocArticle.astro +14 -0
- package/src/docs-shell/components/DocHeader.svelte +93 -0
- package/src/docs-shell/components/DocHeading.astro +28 -0
- package/src/docs-shell/components/DocMain.astro +19 -0
- package/src/docs-shell/components/DocMenuButton.svelte +96 -0
- package/src/docs-shell/components/DocSidebar.svelte +62 -0
- package/src/docs-shell/components/DocVersionSelect.svelte +22 -0
- package/src/docs-shell/components/DocWrapper.astro +11 -0
- package/src/docs-shell/components/DocumentAPIIndex.astro +24 -0
- package/src/docs-shell/components/DocumentChoices.astro +24 -0
- package/src/docs-shell/components/DocumentCodeExample.astro +20 -0
- package/src/docs-shell/components/DocumentCodeExampleView.astro +35 -0
- package/src/docs-shell/components/DocumentCodeTable.astro +19 -0
- package/src/docs-shell/components/DocumentComparison.astro +7 -0
- package/src/docs-shell/components/DocumentCopyButton.svelte +41 -0
- package/src/docs-shell/components/DocumentDeclaration.astro +17 -0
- package/src/docs-shell/components/DocumentDeclarationView.astro +12 -0
- package/src/docs-shell/components/DocumentDisclosure.astro +14 -0
- package/src/docs-shell/components/DocumentFileTree.astro +34 -0
- package/src/docs-shell/components/DocumentFlow.astro +27 -0
- package/src/docs-shell/components/DocumentIdentifier.astro +14 -0
- package/src/docs-shell/components/DocumentIllustration.astro +46 -0
- package/src/docs-shell/components/DocumentKeyList.astro +22 -0
- package/src/docs-shell/components/DocumentNamespaceTable.astro +20 -0
- package/src/docs-shell/components/DocumentOptionEntry.astro +15 -0
- package/src/docs-shell/components/DocumentOptionList.astro +11 -0
- package/src/docs-shell/components/DocumentOptions.astro +23 -0
- package/src/docs-shell/components/DocumentParameters.astro +30 -0
- package/src/docs-shell/components/DocumentPrompt.astro +16 -0
- package/src/docs-shell/components/DocumentValueList.astro +25 -0
- package/src/docs-shell/components/DocumentationIndex.svelte +144 -0
- package/src/docs-shell/components/Dropped.astro +21 -0
- package/src/docs-shell/components/ExpandContent.svelte +21 -0
- package/src/docs-shell/components/ExplorerView.astro +37 -0
- package/src/docs-shell/components/FileIcon.astro +123 -0
- package/src/docs-shell/components/Footer.svelte +80 -0
- package/src/docs-shell/components/GeneratedCSS.astro +8 -0
- package/src/docs-shell/components/Header.svelte +121 -0
- package/src/docs-shell/components/HeaderIcon.astro +14 -0
- package/src/docs-shell/components/HeaderNav.svelte +20 -0
- package/src/docs-shell/components/Image.svelte +56 -0
- package/src/docs-shell/components/Info.astro +5 -0
- package/src/docs-shell/components/InlineCode.astro +30 -0
- package/src/docs-shell/components/InteractingIndicator.astro +19 -0
- package/src/docs-shell/components/LanguageButton.svelte +18 -0
- package/src/docs-shell/components/LanguageSelect.svelte +44 -0
- package/src/docs-shell/components/Link.svelte +127 -0
- package/src/docs-shell/components/ModeImg.astro +11 -0
- package/src/docs-shell/components/NotFound.astro +21 -0
- package/src/docs-shell/components/OverviewButtons.astro +36 -0
- package/src/docs-shell/components/PMAction.astro +25 -0
- package/src/docs-shell/components/PackageBadges.astro +39 -0
- package/src/docs-shell/components/PageContent.svelte +38 -0
- package/src/docs-shell/components/PageContentBootstrap.astro +13 -0
- package/src/docs-shell/components/PageContentDisclosure.astro +25 -0
- package/src/docs-shell/components/PageContentList.svelte +70 -0
- package/src/docs-shell/components/PageContentProvider.svelte +15 -0
- package/src/docs-shell/components/PageContentTitle.svelte +16 -0
- package/src/docs-shell/components/PageNavs.astro +40 -0
- package/src/docs-shell/components/PreparedCodeView.astro +12 -0
- package/src/docs-shell/components/RenderNode.astro +16 -0
- package/src/docs-shell/components/RouteLayers.astro +17 -0
- package/src/docs-shell/components/SearchButton.svelte +31 -0
- package/src/docs-shell/components/SearchDialog.svelte +174 -0
- package/src/docs-shell/components/Segments.svelte +62 -0
- package/src/docs-shell/components/Step.astro +13 -0
- package/src/docs-shell/components/StepL.astro +10 -0
- package/src/docs-shell/components/StepR.astro +10 -0
- package/src/docs-shell/components/StepSection.astro +12 -0
- package/src/docs-shell/components/Tab.astro +8 -0
- package/src/docs-shell/components/Tabs.astro +10 -0
- package/src/docs-shell/components/ThemeIcon.astro +19 -0
- package/src/docs-shell/components/ThemeSelect.svelte +20 -0
- package/src/docs-shell/components/TimeAgo.svelte +32 -0
- package/src/docs-shell/components/Translate.astro +14 -0
- package/src/docs-shell/components/Warn.astro +5 -0
- package/src/docs-shell/components/code-props.ts +28 -0
- package/src/docs-shell/components/document-types.ts +119 -0
- package/src/docs-shell/components/markdown/Anchor.astro +5 -0
- package/src/docs-shell/components/markdown/Heading2.astro +5 -0
- package/src/docs-shell/components/markdown/Heading3.astro +5 -0
- package/src/docs-shell/components/markdown/Table.astro +6 -0
- package/src/docs-shell/components/markdown-components.ts +36 -0
- package/src/docs-shell/components/page-content-bootstrap.ts +115 -0
- package/src/docs-shell/components/page-content.svelte.ts +125 -0
- package/src/docs-shell/contexts/search.ts +18 -0
- package/src/docs-shell/contexts/theme-mode.svelte.ts +61 -0
- package/src/docs-shell/data/authors.ts +17 -0
- package/src/docs-shell/data/base-colors.ts +29 -0
- package/src/docs-shell/data/brands.ts +79 -0
- package/src/docs-shell/data/color-names.ts +1 -0
- package/src/docs-shell/data/color-palette.ts +50 -0
- package/src/docs-shell/data/colors.ts +1 -0
- package/src/docs-shell/factories/Page.astro +35 -0
- package/src/docs-shell/factories/create-page.ts +31 -0
- package/src/docs-shell/layouts/BlogArticle.astro +53 -0
- package/src/docs-shell/layouts/Doc.astro +41 -0
- package/src/docs-shell/remark/markdown-components.d.ts +2 -0
- package/src/docs-shell/remark/markdown-components.js +101 -0
- package/src/docs-shell/remark/slug-and-toc.d.ts +2 -0
- package/src/docs-shell/remark/slug-and-toc.js +53 -0
- package/src/docs-shell/scripts/code-tabs-bootstrap.ts +34 -0
- package/src/docs-shell/scripts/code.ts +124 -0
- package/src/docs-shell/scripts/document-anchor.ts +57 -0
- package/src/docs-shell/scripts/document.ts +47 -0
- package/src/docs-shell/site.ts +67 -0
- package/src/docs-shell/types/IllustrationImages.ts +2 -0
- package/src/docs-shell/types/Metadata.ts +17 -0
- package/src/docs-shell/types/Props.ts +9 -0
- package/src/docs-shell/types/StaticImage.ts +6 -0
- package/src/docs-shell/uses/use-selected-preview-syntax.svelte.ts +16 -0
- package/src/docs-shell/utils/anchor.ts +24 -0
- package/src/docs-shell/utils/beautify-css.ts +14 -0
- package/src/docs-shell/utils/beautify-html.ts +12 -0
- package/src/docs-shell/utils/beautify-js.ts +9 -0
- package/src/docs-shell/utils/create-highlighter.ts +50 -0
- package/src/docs-shell/utils/css-modern-grammar.ts +339 -0
- package/src/docs-shell/utils/documentation-search.ts +68 -0
- package/src/docs-shell/utils/generate-metadata.ts +60 -0
- package/src/docs-shell/utils/group-page-content.ts +10 -0
- package/src/docs-shell/utils/head.ts +72 -0
- package/src/docs-shell/utils/highlight-code-core.ts +146 -0
- package/src/docs-shell/utils/highlight-code.ts +1 -0
- package/src/docs-shell/utils/highlighted-code-text.ts +27 -0
- package/src/docs-shell/utils/i18n-pathname.ts +98 -0
- package/src/docs-shell/utils/i18n.ts +12 -0
- package/src/docs-shell/utils/is-date-within-seven-days.ts +16 -0
- package/src/docs-shell/utils/isBrowser.ts +1 -0
- package/src/docs-shell/utils/isInteractOutside.ts +16 -0
- package/src/docs-shell/utils/markdown-tree.ts +22 -0
- package/src/docs-shell/utils/metadata.ts +25 -0
- package/src/docs-shell/utils/prepared-code.ts +21 -0
- package/src/docs-shell/utils/resolve-heading.d.ts +1 -0
- package/src/docs-shell/utils/resolve-heading.js +19 -0
- package/src/docs-shell/utils/search-pages.ts +271 -0
- package/src/docs-shell/utils/slot-text.ts +15 -0
- package/src/docs-shell/utils/snackbar.ts +39 -0
- package/src/docs-shell/utils/syntax-theme.ts +53 -0
- package/src/docs-shell/utils/transformer-notation-word-mark.ts +146 -0
- package/src/docs-shell/utils/unique-id.ts +11 -0
- package/src/examples/article-transitions/page.astro +7 -0
- package/src/examples/article-transitions/transitions.css +10 -0
- package/src/examples/components/ArticleTransitionScene.svelte +83 -0
- package/src/examples/components/ViewTransitionScene.svelte +31 -0
- package/src/examples/images/article-aurora.jpg +0 -0
- package/src/examples/images/article-coast.jpg +0 -0
- package/src/examples/images/article-grid.jpg +0 -0
- package/src/examples/images/article-studio.jpg +0 -0
- package/src/examples/layout-system/page.astro +59 -0
- package/src/examples/scene.css +3 -0
- package/src/examples/view-transitions/page.astro +7 -0
- package/src/examples/view-transitions/transitions.css +9 -0
- package/src/home/HeroCanvas.svelte +617 -0
- package/src/home/HomeAction.astro +17 -0
- package/src/home/HomeBentoFrame.astro +9 -0
- package/src/home/HomeBentoGrid.astro +9 -0
- package/src/home/HomeCompactIcon.astro +15 -0
- package/src/home/HomeFooter.svelte +63 -0
- package/src/home/HomeIllustration.astro +17 -0
- package/src/home/HomeIllustrationArt.svelte +15 -0
- package/src/home/HomeLamp.svelte +18 -0
- package/src/home/design.css +532 -0
- package/src/home/footer.css +225 -0
- package/src/home/hero-shaders.ts +460 -0
- package/src/home/hero-title-mask.ts +175 -0
- package/src/home/hero.css +547 -0
- package/src/home/home-illustration.ts +5 -0
- package/src/home/home-lamp.ts +225 -0
- package/src/home/home.css +1081 -0
- package/src/home/icons/agent-check-preview-apply.svg +24 -0
- package/src/home/icons/agent-clients.svg +26 -0
- package/src/home/icons/agent-project-tools.svg +23 -0
- package/src/home/icons/artwork/agent-check-preview-apply-dark.webp +0 -0
- package/src/home/icons/artwork/agent-check-preview-apply-light.webp +0 -0
- package/src/home/icons/artwork/agent-clients-dark.webp +0 -0
- package/src/home/icons/artwork/agent-clients-light.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-dark.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-light.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-dark.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-light.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-dark.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-light.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-dark.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-light.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-dark.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-dark.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-light.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-dark.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-light.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-dark.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-light.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-dark.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-light.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-dark.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-light.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-dark.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-light.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-dark.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-light.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-light.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-light.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-light.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-light.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-light.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-light.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-light.webp +0 -0
- package/src/home/icons/artwork/render-progressive-dark.webp +0 -0
- package/src/home/icons/artwork/render-progressive-light.webp +0 -0
- package/src/home/icons/artwork/render-runtime-dark.webp +0 -0
- package/src/home/icons/artwork/render-runtime-light.webp +0 -0
- package/src/home/icons/artwork/render-static-dark.webp +0 -0
- package/src/home/icons/artwork/render-static-light.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-dark.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-light.webp +0 -0
- package/src/home/icons/artwork/section-css-size-dark.webp +0 -0
- package/src/home/icons/artwork/section-css-size-light.webp +0 -0
- package/src/home/icons/artwork/section-design-system-dark.webp +0 -0
- package/src/home/icons/artwork/section-design-system-light.webp +0 -0
- package/src/home/icons/artwork/section-editor-dark.webp +0 -0
- package/src/home/icons/artwork/section-editor-light.webp +0 -0
- package/src/home/icons/artwork/section-lint-dark.webp +0 -0
- package/src/home/icons/artwork/section-lint-light.webp +0 -0
- package/src/home/icons/artwork/section-rendering-dark.webp +0 -0
- package/src/home/icons/artwork/section-rendering-light.webp +0 -0
- package/src/home/icons/artwork/section-workflow-dark.webp +0 -0
- package/src/home/icons/artwork/section-workflow-light.webp +0 -0
- package/src/home/icons/artwork/source.json +303 -0
- package/src/home/icons/artwork/workflow-integrations-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-integrations-light.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-light.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-light.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-light.webp +0 -0
- package/src/home/icons/artwork.css +4 -0
- package/src/home/icons/artwork.ts +131 -0
- package/src/home/icons/catalog.ts +381 -0
- package/src/home/icons/design-cascade-layers.svg +32 -0
- package/src/home/icons/design-layout-motion.svg +16 -0
- package/src/home/icons/design-p3-gamut.svg +12 -0
- package/src/home/icons/design-theme-modes.svg +12 -0
- package/src/home/icons/design-theme-tokens.svg +20 -0
- package/src/home/icons/editor-color-tools.svg +18 -0
- package/src/home/icons/editor-focused-highlighting.svg +15 -0
- package/src/home/icons/editor-hover-inspection.svg +19 -0
- package/src/home/icons/editor-manifest-completions.svg +24 -0
- package/src/home/icons/lint-class-order-compact.svg +15 -0
- package/src/home/icons/lint-class-order.svg +28 -0
- package/src/home/icons/lint-conflicting-classes-compact.svg +11 -0
- package/src/home/icons/lint-conflicting-classes.svg +24 -0
- package/src/home/icons/lint-fix-previews-compact.svg +9 -0
- package/src/home/icons/lint-fix-previews.svg +19 -0
- package/src/home/icons/lint-invalid-classes-compact.svg +7 -0
- package/src/home/icons/lint-invalid-classes.svg +17 -0
- package/src/home/icons/lint-strict-vocabulary-compact.svg +8 -0
- package/src/home/icons/lint-strict-vocabulary.svg +16 -0
- package/src/home/icons/lint-theme-tokens-compact.svg +7 -0
- package/src/home/icons/lint-theme-tokens.svg +14 -0
- package/src/home/icons/mcp-apply-preview-compact.svg +9 -0
- package/src/home/icons/mcp-apply-preview.svg +18 -0
- package/src/home/icons/mcp-css-compare-compact.svg +9 -0
- package/src/home/icons/mcp-css-compare.svg +20 -0
- package/src/home/icons/mcp-inspect-class-compact.svg +9 -0
- package/src/home/icons/mcp-inspect-class.svg +18 -0
- package/src/home/icons/mcp-lint-project-compact.svg +14 -0
- package/src/home/icons/mcp-lint-project.svg +30 -0
- package/src/home/icons/mcp-manifest-query-compact.svg +14 -0
- package/src/home/icons/mcp-manifest-query.svg +27 -0
- package/src/home/icons/mcp-preview-fixes-compact.svg +9 -0
- package/src/home/icons/mcp-preview-fixes.svg +15 -0
- package/src/home/icons/mcp-render-css-compact.svg +13 -0
- package/src/home/icons/mcp-render-css.svg +30 -0
- package/src/home/icons/mcp-scan-project-compact.svg +7 -0
- package/src/home/icons/mcp-scan-project.svg +13 -0
- package/src/home/icons/mcp-trace-class-compact.svg +11 -0
- package/src/home/icons/mcp-trace-class.svg +24 -0
- package/src/home/icons/render-progressive.svg +17 -0
- package/src/home/icons/render-runtime.svg +23 -0
- package/src/home/icons/render-static.svg +29 -0
- package/src/home/icons/section-ai-agents.svg +24 -0
- package/src/home/icons/section-css-size.svg +13 -0
- package/src/home/icons/section-design-system.svg +24 -0
- package/src/home/icons/section-editor.svg +14 -0
- package/src/home/icons/section-lint.svg +14 -0
- package/src/home/icons/section-rendering.svg +30 -0
- package/src/home/icons/section-workflow.svg +22 -0
- package/src/home/icons/workflow-integrations.svg +15 -0
- package/src/home/icons/workflow-monorepo.svg +27 -0
- package/src/home/icons/workflow-route-styles.svg +24 -0
- package/src/home/icons/workflow-trace-change.svg +21 -0
- package/src/layouts/Document.astro +71 -0
- package/src/public/brand/v2/logo/mark/master-mark-small-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-light.svg +1 -0
- package/src/public/demo/border-grid.svg +7 -0
- package/src/public/demo/landscape.svg +1 -0
- package/src/public/demo/marker.svg +1 -0
- package/src/public/demo/mask.svg +1 -0
- package/src/public/fonts/Geist-Medium.ttf +0 -0
- package/src/public/fonts/Geist-Regular.ttf +0 -0
- package/src/public/fonts/GeistVariable.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Bold.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Medium.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Regular.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-SemiBold.woff2 +0 -0
- package/src/public/fonts/index.css +40 -0
- package/src/public/icons/csharp.svg +1 -0
- package/src/public/icons/css.svg +1 -0
- package/src/public/icons/eslint.svg +1 -0
- package/src/public/icons/folder.svg +12 -0
- package/src/public/icons/html.svg +1 -0
- package/src/public/icons/php.svg +1 -0
- package/src/public/icons/sass.svg +1 -0
- package/src/public/icons/storybook.svg +1 -0
- package/src/public/icons/visualstudiocode.svg +41 -0
- package/src/public/images/authors/aron.jpg +0 -0
- package/src/public/images/authors/benseage.jpg +0 -0
- package/src/public/images/authors/joy.jpg +0 -0
- package/src/public/images/authors/lola.jpg +0 -0
- package/src/public/images/authors/miles.jpg +0 -0
- package/src/public/images/bootstrap.svg +23 -0
- package/src/public/images/build-tools/rsbuild.svg +1 -0
- package/src/public/images/build-tools/rspack.svg +1 -0
- package/src/public/images/build-tools/vite.svg +15 -0
- package/src/public/images/build-tools/webpack.svg +10 -0
- package/src/public/images/cdns/esm-sh.svg +1 -0
- package/src/public/images/chevron-left.svg +4 -0
- package/src/public/images/cover-bg.jpg +0 -0
- package/src/public/images/emotion.svg +1 -0
- package/src/public/images/frameworks/angular.svg +29 -0
- package/src/public/images/frameworks/astro.svg +4 -0
- package/src/public/images/frameworks/blazor.svg +22 -0
- package/src/public/images/frameworks/express.svg +1 -0
- package/src/public/images/frameworks/laravel.svg +8 -0
- package/src/public/images/frameworks/line-liff.svg +1 -0
- package/src/public/images/frameworks/lit.svg +1 -0
- package/src/public/images/frameworks/nextjs.svg +16 -0
- package/src/public/images/frameworks/nuxtjs.svg +3 -0
- package/src/public/images/frameworks/rails.svg +1 -0
- package/src/public/images/frameworks/react.svg +8 -0
- package/src/public/images/frameworks/remix.svg +5 -0
- package/src/public/images/frameworks/shopify.svg +1 -0
- package/src/public/images/frameworks/svelte.svg +6 -0
- package/src/public/images/frameworks/tanstack.svg +1 -0
- package/src/public/images/frameworks/vuejs.svg +11 -0
- package/src/public/images/frameworks/wordpress.svg +1 -0
- package/src/public/images/mui.svg +1 -0
- package/src/public/images/styled-components.svg +4 -0
- package/src/public/images/tailwindcss.svg +1 -0
- package/src/scripts/bundler-imports.ts +25 -0
- package/src/scripts/static-social.ts +333 -0
- package/src/scripts/write-if-changed.ts +26 -0
- package/src/sections/blog.astro +11 -0
- package/src/sections/design-system.astro +14 -0
- package/src/sections/document.astro +8 -0
- package/src/sections/examples.astro +6 -0
- package/src/sections/guide.astro +26 -0
- package/src/sections/home.astro +7 -0
- package/src/sections/page.astro +12 -0
- package/src/styles/base.css +57 -0
- package/src/styles/benchmarks.css +20 -0
- package/src/styles/blog-article.css +670 -0
- package/src/styles/blog-materials.css +399 -0
- package/src/styles/blog.css +568 -0
- package/src/styles/demo.css +30 -0
- package/src/styles/design-system.css +15 -0
- package/src/styles/docs-shell/code.css +61 -0
- package/src/styles/docs-shell/docs.css +79 -0
- package/src/styles/docs-shell/documentation-search.css +42 -0
- package/src/styles/docs-shell/footer.css +38 -0
- package/src/styles/docs-shell/header.css +73 -0
- package/src/styles/docs-shell/materials.css +25 -0
- package/src/styles/docs-shell/menu.css +19 -0
- package/src/styles/docs-shell/not-found.css +10 -0
- package/src/styles/docs-shell/page-content.css +37 -0
- package/src/styles/docs-shell/prose.css +89 -0
- package/src/styles/docs-shell/segments.css +13 -0
- package/src/styles/docs-shell/steps.css +39 -0
- package/src/styles/docs-shell/syntax-theme.css +18 -0
- package/src/styles/docs-shell/theme.css +68 -0
- package/src/styles/docs-shell/wrapper.css +10 -0
- package/src/styles/document-comparison.css +7 -0
- package/src/styles/documentation-illustration.css +34 -0
- package/src/styles/documentation-index.css +100 -0
- package/src/styles/documents.css +4 -0
- package/src/styles/documents.ts +2 -0
- package/src/styles/foundation.css +4 -0
- package/src/styles/globals.css +2 -0
- package/src/styles/interface.css +3 -0
- package/src/styles/interface.ts +2 -0
- package/src/styles/site.ts +2 -0
- package/src/styles/system/DESIGN.md +108 -0
- package/src/styles/system/buttons.css +51 -0
- package/src/styles/system/code.css +85 -0
- package/src/styles/system/controls.css +110 -0
- package/src/styles/system/data.css +134 -0
- package/src/styles/system/mixins.css +7 -0
- package/src/styles/system/prose.css +75 -0
- package/src/styles/system/shell.css +102 -0
- package/src/styles/system/specimens.css +98 -0
- package/src/styles/system/surfaces.css +104 -0
- package/src/styles/system/tokens.css +136 -0
- package/src/utils/cloudflare-image-loader.js +85 -0
- package/src/virtual.d.ts +36 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type PlaybackAction = 'play' | 'pause' | 'restart'
|
|
2
|
+
|
|
3
|
+
/** Keep the browser's CSS Animation objects, including finished animations without fill. */
|
|
4
|
+
export function demoPlayback(doc: Document, managed: boolean, changed: (playing: boolean) => void, update: () => void) {
|
|
5
|
+
const animations = new Set<Animation>()
|
|
6
|
+
let frame = 0, lastReading = -Infinity, disposed = false
|
|
7
|
+
const collect = () => {
|
|
8
|
+
const current: Animation[] = doc.getAnimations().filter(animation => 'animationName' in animation)
|
|
9
|
+
current.forEach(animation => animations.add(animation))
|
|
10
|
+
animations.forEach(animation => {
|
|
11
|
+
const target = (animation.effect as KeyframeEffect | null)?.target
|
|
12
|
+
if (!target?.isConnected || animation.playState === 'idle' && !current.includes(animation)) animations.delete(animation)
|
|
13
|
+
})
|
|
14
|
+
return [...animations]
|
|
15
|
+
}
|
|
16
|
+
const read = (all: Animation[]) => {
|
|
17
|
+
doc.querySelectorAll<HTMLOutputElement>('[data-animation-readout]').forEach(output => {
|
|
18
|
+
// Keep frequently changing timeline values readable without live announcements.
|
|
19
|
+
if (output.getAttribute('aria-live') !== 'off') output.setAttribute('aria-live', 'off')
|
|
20
|
+
const target = doc.getElementById(output.dataset.animationReadout!)
|
|
21
|
+
const animation = all.find(item => (item.effect as KeyframeEffect | null)?.target === target)
|
|
22
|
+
const timing = animation?.effect?.getComputedTiming()
|
|
23
|
+
const value = animation ? `${animation.playState} · ${Math.round(Number(animation.currentTime ?? 0))}ms${timing?.progress == null ? '' : ` · ${Math.round(timing.progress * 100)}%`}` : 'No animation'
|
|
24
|
+
if (output.textContent !== value) output.textContent = value
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
const refresh = () => {
|
|
28
|
+
if (disposed) return
|
|
29
|
+
const all = collect()
|
|
30
|
+
read(all)
|
|
31
|
+
update()
|
|
32
|
+
const running = all.some(animation => animation.playState === 'running')
|
|
33
|
+
if (managed) changed(running)
|
|
34
|
+
if (running && !frame) frame = requestAnimationFrame(tick)
|
|
35
|
+
}
|
|
36
|
+
const tick = (time: number) => {
|
|
37
|
+
frame = 0
|
|
38
|
+
if (disposed) return
|
|
39
|
+
const running = collect().some(animation => animation.playState === 'running')
|
|
40
|
+
if (!running || time - lastReading >= 100) { lastReading = time; refresh() }
|
|
41
|
+
else frame = requestAnimationFrame(tick)
|
|
42
|
+
}
|
|
43
|
+
const pause = () => {
|
|
44
|
+
if (!managed) return
|
|
45
|
+
doc.documentElement.dataset.demoPaused = ''
|
|
46
|
+
collect().forEach(animation => animation.pause())
|
|
47
|
+
refresh()
|
|
48
|
+
}
|
|
49
|
+
const act = (action: PlaybackAction) => {
|
|
50
|
+
if (!managed) return
|
|
51
|
+
if (action === 'pause') { pause(); return }
|
|
52
|
+
doc.documentElement.dataset.motionAllowed = ''
|
|
53
|
+
delete doc.documentElement.dataset.demoPaused
|
|
54
|
+
collect().forEach(animation => {
|
|
55
|
+
if (action === 'restart') animation.currentTime = 0
|
|
56
|
+
animation.play()
|
|
57
|
+
})
|
|
58
|
+
refresh()
|
|
59
|
+
}
|
|
60
|
+
const events = ['animationstart', 'animationiteration', 'animationend', 'animationcancel', 'input', 'change', 'pointerover', 'pointerout', 'focusin', 'focusout']
|
|
61
|
+
events.forEach(event => doc.addEventListener(event, refresh))
|
|
62
|
+
doc.defaultView?.addEventListener('resize', refresh)
|
|
63
|
+
if (managed) pause()
|
|
64
|
+
else refresh()
|
|
65
|
+
return {
|
|
66
|
+
act, pause, refresh,
|
|
67
|
+
dispose() {
|
|
68
|
+
disposed = true
|
|
69
|
+
cancelAnimationFrame(frame)
|
|
70
|
+
events.forEach(event => doc.removeEventListener(event, refresh))
|
|
71
|
+
doc.defaultView?.removeEventListener('resize', refresh)
|
|
72
|
+
animations.clear()
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import maintenanceExample from '@master/internal-site/demo/maintenance-example.ts'
|
|
2
|
+
|
|
3
|
+
export interface ProjectStyleExample {
|
|
4
|
+
title: string
|
|
5
|
+
source: string
|
|
6
|
+
html: string
|
|
7
|
+
caption: string
|
|
8
|
+
guide: string
|
|
9
|
+
theme?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Authored configuration facts shared by the lesson and the design-system workbench. */
|
|
13
|
+
export const projectTokenDefinitions = [
|
|
14
|
+
{ name: '--color-brand', value: 'var(--color-text-link)' },
|
|
15
|
+
{ name: '--spacing-card', value: '1.5rem' },
|
|
16
|
+
{ name: '--radius-card', value: '.75rem' },
|
|
17
|
+
] as const
|
|
18
|
+
|
|
19
|
+
export const projectStyleExamples = {
|
|
20
|
+
tokens: {
|
|
21
|
+
title: 'A small project vocabulary',
|
|
22
|
+
source: `@theme {\n${projectTokenDefinitions.map(token => ` ${token.name}: ${token.value};`).join('\n')}\n}\n`,
|
|
23
|
+
html: "<article class=\"p-card r-card b(1) b-solid b-line-divider bg-surface-raised fg-text-body\">\n <p class=\"m(0) font-mono text-xs fg-brand\">FIELD NOTES / 024</p>\n <h2 class=\"mt-sm mb-xs text-xl font-medium fg-text-strong\">Room for the details</h2>\n <p class=\"m(0) text-sm\">Color, spacing and radius come from three shared project tokens.</p>\n</article>",
|
|
24
|
+
caption: 'p-card reads spacing, r-card reads radius, and fg-brand reads color. Each class retains a reference to its theme variable.',
|
|
25
|
+
guide: '/guide/theme',
|
|
26
|
+
},
|
|
27
|
+
spacing: {
|
|
28
|
+
title: 'One spacing token, two consumers',
|
|
29
|
+
source: `@theme {
|
|
30
|
+
--spacing-card: 1.5rem;
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
33
|
+
html: "<div class=\"grid gap-md\">\n <article class=\"p-card r-sm b(1) b-solid b-line-divider bg-surface-raised\">\n <h2 class=\"m(0) text-lg font-medium\">Collection</h2>\n <p class=\"mt-xs mb(0) text-sm fg-text-muted\">The article uses p-card.</p>\n </article>\n <aside class=\"p-card r-sm b(1) b-solid b-line-divider bg-surface-raised text-sm\">\n The note uses the same p-card class.\n </aside>\n</div>",
|
|
34
|
+
caption: 'Both elements have 1.5rem of padding. A change to --spacing-card applies to both consumers.',
|
|
35
|
+
guide: '/guide/theme',
|
|
36
|
+
},
|
|
37
|
+
modes: {
|
|
38
|
+
title: 'The same card in two modes',
|
|
39
|
+
source: `
|
|
40
|
+
|
|
41
|
+
@theme {
|
|
42
|
+
--color-surface-card: var(--color-white);
|
|
43
|
+
--color-text-card: var(--color-zinc-70);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.light {
|
|
47
|
+
--color-surface-card: var(--color-white);
|
|
48
|
+
--color-text-card: var(--color-zinc-70);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dark {
|
|
52
|
+
--color-surface-card: var(--color-zinc-90);
|
|
53
|
+
--color-text-card: var(--color-zinc-20);
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
html: "<article class=\"p-lg r-lg b(1) b-solid b-line-divider bg-surface-card fg-text-card\">\n <h2 class=\"m(0) text-lg font-medium\">Collection details</h2>\n <p class=\"mt-sm mb(0) text-sm\">The class list stays the same when the active mode changes.</p>\n</article>",
|
|
57
|
+
caption: 'Theme switches the preview document’s light/dark class. The browser resolves the actual generated custom properties.',
|
|
58
|
+
guide: '/guide/colors#native-color-scheme-and-manual-themes',
|
|
59
|
+
theme: true,
|
|
60
|
+
},
|
|
61
|
+
components: {
|
|
62
|
+
title: 'A component with native interaction states',
|
|
63
|
+
source: `@layer components {
|
|
64
|
+
.btn {
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
border-radius: var(--radius-md);
|
|
69
|
+
padding-block: var(--spacing-xs);
|
|
70
|
+
padding-inline: var(--spacing-md);
|
|
71
|
+
border-width: 0;
|
|
72
|
+
background-color: var(--color-blue-60);
|
|
73
|
+
color: oklch(100% 0 none);
|
|
74
|
+
font-size: var(--font-size-sm);
|
|
75
|
+
font-weight: var(--font-weight-medium);
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
background-color: var(--color-blue-70);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:focus-visible {
|
|
82
|
+
outline: 2px solid var(--color-text-link);
|
|
83
|
+
outline-offset: var(--spacing-4xs);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}`,
|
|
87
|
+
html: `<button type="button" class="btn">Preview button</button>`,
|
|
88
|
+
caption: 'Hover or focus the button to inspect its shared states.',
|
|
89
|
+
guide: '/guide/global-styles#component-classes',
|
|
90
|
+
},
|
|
91
|
+
maintenance: maintenanceExample,
|
|
92
|
+
layers: {
|
|
93
|
+
title: 'A local utility overrides the component',
|
|
94
|
+
source: `@layer components {
|
|
95
|
+
.card {
|
|
96
|
+
border-radius: var(--radius-lg);
|
|
97
|
+
padding: var(--spacing-lg);
|
|
98
|
+
border: 1px solid var(--color-line-divider);
|
|
99
|
+
background-color: var(--color-surface-raised);
|
|
100
|
+
color: var(--color-text-body);
|
|
101
|
+
}
|
|
102
|
+
}`,
|
|
103
|
+
html: "<div class=\"grid gap-md\">\n <article class=\"card\">\n <h2 class=\"m(0) text-lg font-medium\">Standard card</h2>\n <p class=\"mt-xs mb(0) text-sm\">card sets 1.5rem of padding.</p>\n </article>\n <article class=\"card p-sm\">\n <h2 class=\"m(0) text-lg font-medium\">Compact card</h2>\n <p class=\"mt-xs mb(0) text-sm\">p-sm changes this instance to .75rem.</p>\n </article>\n</div>",
|
|
104
|
+
caption: 'The same component is used twice. With the base layer order loaded, the normal padding utility wins in the second card.',
|
|
105
|
+
guide: '/guide/cascade-layers',
|
|
106
|
+
},
|
|
107
|
+
nativeField: {
|
|
108
|
+
title: 'A field that follows its content',
|
|
109
|
+
source: '',
|
|
110
|
+
html: "<label for=\"project-note\" class=\"block mb-xs text-sm font-medium\">Project note</label>\n<textarea id=\"project-note\" rows=\"3\"\n class=\"block (field-sizing:content) min-w(0) max-w-full w-full\n (min-height:6rem) (max-height:12rem) p-sm b(1) b-solid b-line-divider r-sm\n bg-surface-raised fg-text-body (font:inherit) (resize:vertical)\n outline(2):focus-visible outline-solid:focus-visible outline-blue:focus-visible outline-offset(2):focus-visible\"\n aria-describedby=\"note-help\">Keep the interaction close to its context.</textarea>\n<p id=\"note-help\" class=\"mt-xs mb(0) text-xs fg-text-muted\">Add a few lines to try content-based sizing.</p>",
|
|
111
|
+
caption: 'The textarea uses native field-sizing. Minimum and maximum heights bound the enhancement; unsupported browsers retain a usable field.',
|
|
112
|
+
guide: '/guide/compatibility#native-declarations',
|
|
113
|
+
},
|
|
114
|
+
checkedSelector: {
|
|
115
|
+
title: 'Selection with a native selector',
|
|
116
|
+
source: '',
|
|
117
|
+
html: "<div class=\"p-md b(1) b-solid b-line-divider r-sm bg-surface-raised\n b-blue:has(:checked)\">\n <label class=\"flex items-start gap-sm text-sm\">\n <input type=\"checkbox\" class=\"mt-3xs accent-blue\n outline(2):focus-visible outline-solid:focus-visible outline-blue:focus-visible outline-offset(2):focus-visible\" />\n <span>Include project notes\n <span class=\"block mt-2xs text-xs fg-text-muted\">The card border follows the checkbox.</span>\n </span>\n </label>\n</div>",
|
|
118
|
+
caption: 'Check the option with a pointer or the Space key. :has(:checked) adds a border cue; the native checkbox carries the state.',
|
|
119
|
+
guide: '/guide/compatibility#new-selectors',
|
|
120
|
+
},
|
|
121
|
+
} satisfies Record<string, ProjectStyleExample>
|
|
122
|
+
|
|
123
|
+
export type ProjectStyleName = keyof typeof projectStyleExamples
|
|
124
|
+
|
|
125
|
+
export function projectStyleExample(name: string): ProjectStyleExample {
|
|
126
|
+
if (!Object.hasOwn(projectStyleExamples, name)) throw new Error(`Unknown project style example: ${name}`)
|
|
127
|
+
return projectStyleExamples[name as ProjectStyleName]
|
|
128
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { label } from '@master/internal-site/demo/reference/html.ts'
|
|
3
|
+
import { paintLayout } from '@master/internal-site/demo/reference/layout-html.ts'
|
|
4
|
+
|
|
5
|
+
const comparisons: Record<string, string[]> = {
|
|
6
|
+
'center-wrapped-lines': ['Wrapped flex lines', 'Fixed grid tracks'],
|
|
7
|
+
'align-to-the-start-or-end': ['Start edges', 'End edges'],
|
|
8
|
+
'stretch-children': ['Explicit container height', 'Height from a sibling'],
|
|
9
|
+
'align-items-on-the-main-axis': ['Flex items', 'Fixed grid columns'],
|
|
10
|
+
'start-center-or-end-a-group': ['Start', 'Center', 'End', 'Center in a column'],
|
|
11
|
+
'distribute-extra-space': ['Space between', 'Space around', 'Space evenly'],
|
|
12
|
+
'use-explicit-css-values': ['Safe · overflowing', 'Unsafe · overflowing', 'Safe · content fits'],
|
|
13
|
+
'align-one-item-on-both-axes': ['End on both axes', 'Block end · inline start'],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The portable HTML owns every alignment prerequisite and minimum-size constraint. */
|
|
17
|
+
export function alignment(section: ReferenceDemoSection): DemoScene {
|
|
18
|
+
const { page, id } = section
|
|
19
|
+
const self = page.endsWith('-self')
|
|
20
|
+
const html = section.html.map((source, index) => {
|
|
21
|
+
const prefix = section.html.length > 1 ? `example-${index}-` : ''
|
|
22
|
+
const target = `${prefix}${self ? 'target' : 'layout'}`
|
|
23
|
+
const grid = /class="grid(?: |")/.test(source)
|
|
24
|
+
const axis = page.startsWith('place') ? 'both' : page.startsWith('align') ? 'cross' : 'main'
|
|
25
|
+
const subject = page.endsWith('-content') ? grid ? 'Grid tracks' : page.startsWith('align') ? 'Flex lines' : 'Flex items' : grid ? 'Grid items' : 'Flex items'
|
|
26
|
+
const painted = paintLayout(source, prefix, index === 0 ? self ? 'target' : 'layout' : '')
|
|
27
|
+
const tracks = grid ? `<span>Columns <output data-style-readout="${prefix}layout" data-style-property="grid-template-columns">—</output></span>` : ''
|
|
28
|
+
return `<section data-ui="layout-example">${comparisons[id] ? label(comparisons[id][index]) : ''}<div data-ui="label">${subject} · <output data-alignment-axis="${prefix}layout" data-axis-kind="${axis}">—</output></div>${painted}<div data-ui="layout-readings"><span>Container <output data-size-readout="${prefix}layout">—</output></span><span>Blue item <output data-size-readout="${prefix}target">—</output></span><span>Blue offset <output data-position-readout="${prefix}target" data-position-origin="${prefix}layout">—</output></span>${tracks}<span>${page} <output data-style-readout="${target}" data-style-property="${page}">—</output></span></div></section>`
|
|
29
|
+
}).join('')
|
|
30
|
+
const captions: Record<string, string> = {
|
|
31
|
+
'align-content': 'The container has room beyond the authored lines or tracks. Alignment distributes that remaining space; it does not change the fixed item heights.',
|
|
32
|
+
'align-items': id === 'align-text-baselines' ? 'Different text sizes share a first baseline. Compare the text positions, rather than the outer box edges.' : 'Compare the blue item with the violet sibling. Automatic sizes can stretch; explicit sizes keep their dimensions.',
|
|
33
|
+
'align-self': 'The blue item overrides the parent’s default. Its sibling follows the parent alignment in the same flex line.',
|
|
34
|
+
'justify-content': id === 'use-explicit-css-values' ? 'The overflow is real and scrollable. Safe centering preserves access to the start; unsafe centering loses the portion before the scrollport.' : 'The authored items or tracks leave actual free space. Compare their starting offsets and the spaces between them.',
|
|
35
|
+
'justify-items': 'Two equal grid columns keep their track sizes. Alignment changes each item’s inline position or automatic width inside its own area.',
|
|
36
|
+
'justify-self': 'The blue item moves inside the first column. The violet item keeps the parent’s default in the second column.',
|
|
37
|
+
'place-content': 'The fixed track group moves within the larger grid container. Its column widths, row heights and minimum gaps stay unchanged.',
|
|
38
|
+
'place-items': 'Each item aligns within its own grid area. Stretch applies only to dimensions that remain automatic.',
|
|
39
|
+
'place-self': 'The blue item has a local alignment override. The violet sibling follows the parent’s two-axis default in its own grid area.',
|
|
40
|
+
}
|
|
41
|
+
return { html, caption: captions[page], sizing: 'content' }
|
|
42
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { typeSpecimens } from '@master/internal-site/demo/reference/type-specimens.ts'
|
|
3
|
+
|
|
4
|
+
const properties: Record<string, string[]> = {
|
|
5
|
+
'animate': ['animation-name', 'animation-duration', 'animation-iteration-count'],
|
|
6
|
+
'animation-delay': ['animation-delay', 'animation-duration'],
|
|
7
|
+
'animation-direction': ['animation-direction', 'animation-duration'],
|
|
8
|
+
'animation-duration': ['animation-duration', 'animation-fill-mode'],
|
|
9
|
+
'animation-fill-mode': ['animation-fill-mode', 'animation-delay'],
|
|
10
|
+
'animation-iteration-count': ['animation-iteration-count', 'animation-direction'],
|
|
11
|
+
'animation-name': ['animation-name', 'animation-duration'],
|
|
12
|
+
'animation-play-state': ['animation-play-state', 'animation-name'],
|
|
13
|
+
'animation-timing-function': ['animation-timing-function', 'animation-duration'],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Full authored keyframes and SVGs remain the source of every native timeline. */
|
|
17
|
+
export function animations(section: ReferenceDemoSection): DemoScene {
|
|
18
|
+
const managed = section.page !== 'animation-play-state'
|
|
19
|
+
const scene = typeSpecimens(section, {
|
|
20
|
+
appearance: 'plain', properties: properties[section.page],
|
|
21
|
+
caption: managed
|
|
22
|
+
? 'Play opts into the actual CSS animation. Pause retains its time; Replay restarts even a finished one-shot. Readouts show native timeline time and progress, including delay and fill.'
|
|
23
|
+
: 'The native checkbox and authored selectors control the child’s CSS play state. Pausing preserves its time. Reduced motion keeps it paused; print removes the animation.',
|
|
24
|
+
})
|
|
25
|
+
scene.html = scene.html.replace(/(<div data-ui="type-readings">)([\s\S]*?)(<\/div>)/g, (_, open: string, readings: string, close: string) => {
|
|
26
|
+
const target = readings.match(/data-style-readout="([^"]+)"/)?.[1]
|
|
27
|
+
return `${open}${readings}<span>Timeline <output data-animation-readout="${target}">—</output></span>${close}`
|
|
28
|
+
})
|
|
29
|
+
return { ...scene, motion: managed }
|
|
30
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { typeSpecimens } from '@master/internal-site/demo/reference/type-specimens.ts'
|
|
3
|
+
|
|
4
|
+
const properties: Record<string, string[]> = {
|
|
5
|
+
color: ['color', 'opacity'],
|
|
6
|
+
background: ['background-color', 'background-image', 'background-position', 'background-size', 'background-repeat'],
|
|
7
|
+
'background-color': ['background-color', 'opacity'],
|
|
8
|
+
'background-image': ['background-image'],
|
|
9
|
+
'background-attachment': ['background-attachment'],
|
|
10
|
+
'background-blend-mode': ['background-blend-mode'],
|
|
11
|
+
'background-clip': ['background-clip'],
|
|
12
|
+
'background-origin': ['background-origin', 'background-size'],
|
|
13
|
+
'background-position': ['background-position', 'background-size'],
|
|
14
|
+
'background-repeat': ['background-repeat', 'background-size'],
|
|
15
|
+
'background-size': ['background-size'],
|
|
16
|
+
}
|
|
17
|
+
const captions: Record<string, string> = {
|
|
18
|
+
color: 'The foreground and element opacity are independent readings. The specimen keeps the actual authored theme and interaction rules.',
|
|
19
|
+
background: 'Each specimen supplies its own image and geometry. Read the background properties independently.',
|
|
20
|
+
'background-color': 'The backing surface belongs to the authored example. Background alpha changes the paint without reducing the element’s opacity.',
|
|
21
|
+
'background-image': 'The image list is the browser’s computed value. The first listed layer paints above the others; dimensions and repeat behavior come from the example.',
|
|
22
|
+
'background-attachment': 'Scroll both the inner panel and this preview page. Fixed attachment refers to the iframe viewport; local refers to the scrollable content. Actual paint support can vary by platform.',
|
|
23
|
+
'background-blend-mode': 'Only the authored background layers blend. The surrounding surface and labels stay outside the subject’s background group.',
|
|
24
|
+
'background-clip': 'The plain specimen adds no paint or clipping to the subject. Compare the painted boundary with the unchanged layout dimensions.',
|
|
25
|
+
'background-origin': 'Origin determines the image’s positioning area. Clipping stays separately authored, so positioning and painting boundaries remain distinct.',
|
|
26
|
+
'background-position': 'Percentages distribute the difference between area and image size. The computed position can remain a percentage; it is not a measured pixel offset.',
|
|
27
|
+
'background-repeat': 'The source image and tile dimensions remain fixed. Count the painted rows and columns to compare native repetition.',
|
|
28
|
+
'background-size': 'The readout reports the computed size, including keywords. The artwork’s visible edges expose the actual fit, crop or distortion.',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Preserve complete paint prerequisites, contexts and native scroll geometry. */
|
|
32
|
+
export function backgrounds(section: ReferenceDemoSection): DemoScene {
|
|
33
|
+
const glyphs = section.page === 'background-clip' && section.id === 'clip-a-background-to-text'
|
|
34
|
+
const scene = typeSpecimens(section, {
|
|
35
|
+
appearance: 'plain', measure: true, caption: captions[section.page],
|
|
36
|
+
properties: glyphs ? ['background-clip', '-webkit-text-fill-color'] : properties[section.page],
|
|
37
|
+
})
|
|
38
|
+
return section.page === 'background-attachment' ? { ...scene, sizing: 'viewport', height: 360, inspect: ['background-attachment'] } : scene
|
|
39
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { typeSpecimens } from '@master/internal-site/demo/reference/type-specimens.ts'
|
|
3
|
+
|
|
4
|
+
const properties: Record<string, string[]> = {
|
|
5
|
+
'border-collapse': ['border-collapse', 'border-spacing'],
|
|
6
|
+
'border-image': ['border-image-source', 'border-image-width', 'border-image-repeat'],
|
|
7
|
+
'border-image-source': ['border-image-source', 'border-width'],
|
|
8
|
+
'border-image-slice': ['border-image-slice', 'border-image-width'],
|
|
9
|
+
'border-image-width': ['border-image-width', 'border-width'],
|
|
10
|
+
'border-image-outset': ['border-image-outset', 'border-width'],
|
|
11
|
+
'border-image-repeat': ['border-image-repeat'],
|
|
12
|
+
'box-decoration-break': ['box-decoration-break', '-webkit-box-decoration-break'],
|
|
13
|
+
}
|
|
14
|
+
const captions: Record<string, string> = {
|
|
15
|
+
'border-collapse': 'Cell borders and spacing are explicitly authored. Compare the actual shared seams as well as the computed table properties.',
|
|
16
|
+
'border-image': 'The border image paints within the authored geometry. Its image properties are independent of the regular border width.',
|
|
17
|
+
'border-image-source': 'The source changes while the slice, painted width and measured layout box remain the same.',
|
|
18
|
+
'border-image-slice': 'The 96 × 96 source uses 24-unit corners. Slice boundaries belong to the source; painted widths belong to the destination border.',
|
|
19
|
+
'border-image-width': 'A bare number multiplies regular border width. The box reading measures layout, so paint can grow without changing it.',
|
|
20
|
+
'border-image-outset': 'Outset extends paint beyond the measured border box. The explicit margin reserves room around that paint.',
|
|
21
|
+
'border-image-repeat': 'The first repeat value controls top and bottom edges; the second controls left and right. The source pattern makes individual tiles visible.',
|
|
22
|
+
'box-decoration-break': 'One inline element creates real line fragments. The readings expose standard and WebKit property support; the container controls wrapping.',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Keep authored table cells, source geometry and inline fragments intact. */
|
|
26
|
+
export function borderPaint(section: ReferenceDemoSection): DemoScene {
|
|
27
|
+
return typeSpecimens(section, {
|
|
28
|
+
appearance: 'plain', properties: properties[section.page],
|
|
29
|
+
measure: section.page !== 'box-decoration-break', caption: captions[section.page],
|
|
30
|
+
})
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { classValue, comparison, label } from '@master/internal-site/demo/reference/html.ts'
|
|
3
|
+
|
|
4
|
+
/** The frame and content dimensions are taken from the displayed HTML. */
|
|
5
|
+
export function overflow(section: ReferenceDemoSection): DemoScene {
|
|
6
|
+
const { id, classLists: lists } = section
|
|
7
|
+
if (id === 'truncate-a-single-line') return {
|
|
8
|
+
html: `${label('224px available width')}<div data-ui="truncate" data-target class="${classValue(lists[0])}">A very long file name that should not widen the toolbar</div>`,
|
|
9
|
+
caption: 'The browser paints an ellipsis inside the constrained block. The complete label remains in the document.',
|
|
10
|
+
inspect: ['overflow', 'white-space', 'text-overflow'], sizing: 'content',
|
|
11
|
+
}
|
|
12
|
+
const content = (classes: string) => `<div data-ui="overflow-content" class="${classValue(classes)}"><span>01 · Start</span><span>02 · End</span></div>`
|
|
13
|
+
if (id === 'create-a-scroll-container') return {
|
|
14
|
+
html: comparison([
|
|
15
|
+
{ name: 'Vertical collection', content: `<div data-ui="overflow-frame" data-target class="${classValue(lists[0])}" tabindex="0" aria-label="Vertical collection">${content(lists[1])}</div>` },
|
|
16
|
+
{ name: 'Horizontal collection', content: `<div data-ui="overflow-frame" class="${classValue(lists[2])}" tabindex="0" aria-label="Horizontal collection">${content(lists[3])}</div>` },
|
|
17
|
+
]).replace('data-ui="comparison"', 'data-ui="comparison" data-scenario="scroll-containers"'),
|
|
18
|
+
caption: 'Focus either real scroll container and use the arrow keys. Each child overflows only along the direction being demonstrated.', sizing: 'content',
|
|
19
|
+
}
|
|
20
|
+
const conditional = id === 'apply-conditionally'
|
|
21
|
+
return {
|
|
22
|
+
html: `${conditional ? label('Resize for scrolling · print for visible overflow') : '<div data-ui="scroll-actions" role="group" aria-label="Programmatic scroll"><button type="button" data-scroll-container="overflow-sample" data-scroll-edge="end">Scroll to end</button><button type="button" data-scroll-container="overflow-sample" data-scroll-edge="start">Reset</button></div>'}<div id="overflow-sample" data-ui="overflow-frame" data-target class="${classValue(lists[0])}">${content(lists[1])}</div>`,
|
|
23
|
+
caption: conditional ? 'The authored screen condition enables native scrolling. Print preview preserves the full overflowing content.' : id === 'clip-without-scrolling' ? 'The buttons call the same native scroll API as the hidden example. Clip remains at its original scroll position.' : 'Scroll to end reveals the hidden lower-right corner. Reset returns to the initial view.',
|
|
24
|
+
inspect: ['overflow-x', 'overflow-y'], height: conditional ? 316 : 268,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { compileManifestSync } from '@master/css-compiler/node'
|
|
4
|
+
import { createRenderSessionSync } from '@master/css/node'
|
|
5
|
+
import { escape } from '@master/internal-site/demo/reference/html.ts'
|
|
6
|
+
import preset from '@master/internal-site/css/preset-manifest.ts'
|
|
7
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
8
|
+
|
|
9
|
+
const frameFile = fileURLToPath(import.meta.resolve('@master/internal-site/demo/reference/frame.css'))
|
|
10
|
+
const materialFile = fileURLToPath(import.meta.resolve('@master/internal-site/styles/docs-shell/materials.css'))
|
|
11
|
+
const systemTokenFile = fileURLToPath(import.meta.resolve('@master/internal-site/styles/system/tokens.css'))
|
|
12
|
+
const readSystemButtons = () => ['mixins.css', 'buttons.css'].map(file => readFileSync(fileURLToPath(import.meta.resolve(`@master/internal-site/styles/system/${file}`)), 'utf8')).join('\n')
|
|
13
|
+
const systemButtons = readSystemButtons()
|
|
14
|
+
let materials = readFileSync(materialFile, 'utf8')
|
|
15
|
+
const readSystemTokens = () => readFileSync(systemTokenFile, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '')
|
|
16
|
+
let systemTokens = readSystemTokens()
|
|
17
|
+
const frameCSS = readFileSync(frameFile, 'utf8')
|
|
18
|
+
const sharedManifest = () => compileManifestSync(`@mixin --light { &:where(.light, .light *) { @contents; } }\n@mixin --dark { &:where(.dark, .dark *) { @contents; } }\n${materials}`, { baseManifest: preset }).manifest
|
|
19
|
+
let shared = sharedManifest()
|
|
20
|
+
|
|
21
|
+
export function demoDocument(section: ReferenceDemoSection, scene: DemoScene, initialTheme?: 'light' | 'dark') {
|
|
22
|
+
// A srcdoc inherits the host URL as its base. Keep native fragment navigation
|
|
23
|
+
// inside this preview without changing the base for images, fonts or links.
|
|
24
|
+
const html = scene.html.replace(/(<a\b[^>]*?\bhref=)(["'])#([^"']*)\2/g, '$1$2about:srcdoc#$3$2')
|
|
25
|
+
// These files are read assets, so development HMR does not invalidate them.
|
|
26
|
+
const developing = process.env.NODE_ENV === 'development'
|
|
27
|
+
if (developing) {
|
|
28
|
+
const nextMaterials = readFileSync(materialFile, 'utf8')
|
|
29
|
+
systemTokens = readSystemTokens()
|
|
30
|
+
if (nextMaterials !== materials) {
|
|
31
|
+
materials = nextMaterials
|
|
32
|
+
shared = sharedManifest()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Opt in only for the interface operating a lesson. Use the canonical CSS so
|
|
36
|
+
// its material, geometry and interaction states cannot drift into a second recipe.
|
|
37
|
+
const configuration = [scene.systemButtons ? (developing ? readSystemButtons() : systemButtons) : '', section.css, scene.css].filter(Boolean).join('\n')
|
|
38
|
+
const compiled = configuration ? compileManifestSync(configuration, { baseManifest: shared }) : undefined
|
|
39
|
+
const errors = compiled?.diagnostics.filter(item => item.severity === 'error') ?? []
|
|
40
|
+
if (errors.length) throw new Error(`${section.page}#${section.id}: ${JSON.stringify(errors)}`)
|
|
41
|
+
const engine = createRenderSessionSync({ manifest: compiled?.manifest ?? shared })
|
|
42
|
+
try {
|
|
43
|
+
const classNames = [...new Set([...`${scene.html}<body class="${scene.bodyClass ?? ''}">`.matchAll(/\bclass="([\s\S]*?)"/g)].flatMap(match => match[1].replaceAll('"', '"').replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').split(/\s+/)).filter(Boolean))]
|
|
44
|
+
const frame = developing ? readFileSync(frameFile, 'utf8') : frameCSS
|
|
45
|
+
// The frame and the system roles reference preset variables (the neutral tone's zinc steps, the type families) without utility classes.
|
|
46
|
+
engine.ensureStylesheetResources(`${systemTokens}\n${frame}`)
|
|
47
|
+
if (compiled?.css) engine.ensureStylesheetResources(compiled.css)
|
|
48
|
+
const rendered = engine.ensureClassRules([...classNames, 'font-sans', 'font-mono'])
|
|
49
|
+
const invalid = rendered.invalidClassNames.filter(value => classNames.includes(value) && !compiled?.nativeClassNames.includes(value))
|
|
50
|
+
if (invalid.length) throw new Error(`${section.page}#${section.id}: invalid demo classes ${invalid.join(', ')}`)
|
|
51
|
+
// The site utility tokens resolve to the system roles, so the frame needs them too.
|
|
52
|
+
const css = `${systemTokens}\n${frame}\n${compiled?.css ?? ''}\n${rendered.cssText}`
|
|
53
|
+
return `<!doctype html><html lang="en"${initialTheme ? ` class="${initialTheme}"` : ''}${scene.motion ? ' data-demo-paused' : ''}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${scene.head ?? ''}<style>@layer theme,base,defaults,components,utilities;${css.replaceAll('</style', '<\\/style')}</style></head><body${scene.bodyClass ? ` class="${escape(scene.bodyClass)}"` : ''}>${html}</body></html>`
|
|
54
|
+
} finally { engine.dispose() }
|
|
55
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { typeSpecimens } from '@master/internal-site/demo/reference/type-specimens.ts'
|
|
3
|
+
|
|
4
|
+
const properties: Record<string, string[]> = {
|
|
5
|
+
border: ['border-width', 'border-style', 'border-color'],
|
|
6
|
+
'border-color': ['border-color', 'border-width'],
|
|
7
|
+
'border-style': ['border-style', 'border-width'],
|
|
8
|
+
'border-width': ['border-width', 'box-sizing'],
|
|
9
|
+
'border-radius': ['border-radius'],
|
|
10
|
+
outline: ['outline-width', 'outline-style', 'outline-color'],
|
|
11
|
+
'outline-color': ['outline-color', 'color'],
|
|
12
|
+
'outline-style': ['outline-style', 'outline-width'],
|
|
13
|
+
'outline-width': ['outline-width', 'outline-style'],
|
|
14
|
+
'outline-offset': ['outline-offset', 'outline-width'],
|
|
15
|
+
'box-shadow': ['box-shadow'],
|
|
16
|
+
}
|
|
17
|
+
const captions: Record<string, string> = {
|
|
18
|
+
border: 'Border readings show width, style and color. The measured box includes padding and borders.',
|
|
19
|
+
'border-color': 'Border color changes paint independently of width and style. Transparent edges still occupy their used border width.',
|
|
20
|
+
'border-style': 'The browser reports both the style and used border width. None and hidden remove used width on these ordinary boxes.',
|
|
21
|
+
'border-width': 'Compare the resolved edge widths with the measured outer box. Box sizing determines whether the border fits within the declared dimensions.',
|
|
22
|
+
'border-radius': 'Compare the painted corners with the measured layout box. Radius, aspect ratio and overflow are separate properties.',
|
|
23
|
+
outline: 'Outlines paint around the box without adding layout space. Use the actual keyboard focus state to inspect conditional treatments.',
|
|
24
|
+
'outline-color': 'The outline has an explicitly authored width and style. Current color follows the same element’s foreground.',
|
|
25
|
+
'outline-style': 'Style and used width are separate readings. Dedicated style utilities preserve the other outline components.',
|
|
26
|
+
'outline-width': 'The readout reports this browser’s resolved width, including native keywords. The measured layout box excludes the outline.',
|
|
27
|
+
'outline-offset': 'Offset moves the painted ring without changing the layout dimensions. The surrounding space keeps outward outlines visible.',
|
|
28
|
+
'box-shadow': 'These are the browser’s actual shadow layers. The measured box excludes their paint; theme tokens may resolve differently in each mode.',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Preserve the complete authored edge, focus and theme prerequisites. */
|
|
32
|
+
export function edges(section: ReferenceDemoSection): DemoScene {
|
|
33
|
+
const { page, id } = section
|
|
34
|
+
const observed = page === 'border-radius' && id === 'create-an-icon-button' ? ['border-radius', 'aspect-ratio']
|
|
35
|
+
: page === 'border-radius' && id === 'use-a-radius-token' ? ['border-radius', 'overflow'] : properties[page]
|
|
36
|
+
return {
|
|
37
|
+
...typeSpecimens(section, { appearance: 'plain', measure: true, properties: observed, caption: captions[page] }),
|
|
38
|
+
theme: page === 'box-shadow' || page === 'border-color' && id === 'customize-line-colors',
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { typeSpecimens } from '@master/internal-site/demo/reference/type-specimens.ts'
|
|
3
|
+
|
|
4
|
+
const properties: Record<string, string[]> = {
|
|
5
|
+
'filter': ['filter'],
|
|
6
|
+
'backdrop-filter': ['backdrop-filter'],
|
|
7
|
+
'clip-path': ['clip-path'],
|
|
8
|
+
'mask-image': ['mask-image', 'mask-mode'],
|
|
9
|
+
'mix-blend-mode': ['mix-blend-mode'],
|
|
10
|
+
'opacity': ['opacity', 'background-color'],
|
|
11
|
+
}
|
|
12
|
+
const captions: Record<string, string> = {
|
|
13
|
+
'filter': 'The source and its dimensions are explicit. Filters change the painted group; the measured layout box stays unchanged.',
|
|
14
|
+
'backdrop-filter': 'The complete composition supplies the backdrop and panel. Filtering changes pixels behind the panel, while its own text remains sharp.',
|
|
15
|
+
'clip-path': 'The outer outline marks the original box. Clipping changes paint and hit testing without changing layout dimensions.',
|
|
16
|
+
'mask-image': 'The mask changes painted opacity. The CSS box keeps its dimensions and hit area; annotations remain outside the mask.',
|
|
17
|
+
'mix-blend-mode': 'The explicitly isolated group contains both backdrops. Foreground geometry and source colors are identical in each comparison.',
|
|
18
|
+
'opacity': 'Opacity changes the entire painted group. Native controls keep their names and keyboard behavior; color alpha changes only that color.',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Preserve authored source paint, compositing groups and native interaction. */
|
|
22
|
+
export function effects(section: ReferenceDemoSection): DemoScene {
|
|
23
|
+
return typeSpecimens(section, {
|
|
24
|
+
appearance: 'plain', properties: properties[section.page],
|
|
25
|
+
measure: true, caption: captions[section.page],
|
|
26
|
+
})
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DemoScene, ReferenceDemoSection } from '@master/internal-site/demo/reference/types.ts'
|
|
2
|
+
import { label } from '@master/internal-site/demo/reference/html.ts'
|
|
3
|
+
import { paintLayout } from '@master/internal-site/demo/reference/layout-html.ts'
|
|
4
|
+
|
|
5
|
+
const sampleNames: Record<string, string[]> = {
|
|
6
|
+
'remember-the-parent-display': ['Block parent', 'Flex parent'],
|
|
7
|
+
'use-content-or-parent-sized-basis-values': ['100% of the container', 'Fit-content basis', 'Max-content basis'],
|
|
8
|
+
'reverse-visual-order': ['Reversed row', 'Reversed column'],
|
|
9
|
+
'change-visual-order': ['Flex items', 'Auto-placed grid items'],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Paint the authored boxes without providing their flex or grid prerequisites. */
|
|
13
|
+
export function flexbox(section: ReferenceDemoSection): DemoScene {
|
|
14
|
+
const { page, id } = section
|
|
15
|
+
const containerProperty = page === 'flex-wrap' || page === 'flex-direction'
|
|
16
|
+
const html = section.html.map((source, index) => {
|
|
17
|
+
const prefix = section.html.length > 1 ? `example-${index}-` : ''
|
|
18
|
+
const measured = source.includes('id="target"') ? 'target' : 'item-1'
|
|
19
|
+
const decorated = paintLayout(source, prefix, index === 0 ? containerProperty ? 'layout' : 'target' : '', measured)
|
|
20
|
+
const comparisonSize = page === 'flex-grow' || page === 'flex-shrink'
|
|
21
|
+
? `<span>Violet item <output data-size-readout="${prefix}peer">—</output></span>` : ''
|
|
22
|
+
return `<section data-ui="layout-example">${sampleNames[id] ? label(sampleNames[id][index]) : ''}<div data-ui="label"><output data-layout-axis="${prefix}layout">Main axis</output></div>${decorated}<div data-ui="layout-readings"><span>Container <output data-size-readout="${prefix}layout">—</output></span><span>Blue item <output data-size-readout="${prefix}${measured}">—</output></span>${comparisonSize}</div></section>`
|
|
23
|
+
}).join('')
|
|
24
|
+
const captions: Record<string, string> = {
|
|
25
|
+
'flex-basis': 'Basis is the starting main-axis size. Compare it with the live border-box measurements after flexing and constraints.',
|
|
26
|
+
'flex-grow': 'Grow factors divide the extra space, not the final widths. Both items keep their authored bases and padding.',
|
|
27
|
+
'flex-shrink': 'The constrained row creates a real shortage of space. Shrink factors and starting bases determine how that shortage is shared.',
|
|
28
|
+
'flex-wrap': id === 'reverse-wrap-direction' ? 'Read the source numbers within each line, then compare how the lines stack. Reversing wrapping does not reverse the items within a line.' : 'Each item keeps a 96px width. The actual container width, gap and wrapping rule decide whether another line is needed.',
|
|
29
|
+
'flex-direction': id === 'reverse-visual-order' ? 'Focus Source 1, then press Tab. The focus sequence follows the DOM even as the visual main axis is reversed.' : 'The annotation follows the actual layout. In horizontal writing, inline runs across the row and block runs down the column.',
|
|
30
|
+
order: id === 'keep-source-order-meaningful' ? 'Focus Source 1, then press Tab. The browser follows the source sequence; CSS order changes only these items’ visual positions.' : 'Lower order values appear first. Equal values keep their source sequence; the blue item remains first in the DOM.',
|
|
31
|
+
}
|
|
32
|
+
return { html, caption: captions[page], inspect: [page], sizing: 'content' }
|
|
33
|
+
}
|