@master/internal-site 0.0.0-stage → 0.1.0
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 +66 -2
- package/dist/astro.d.mts +3 -0
- package/dist/astro.mjs +510 -0
- package/dist/config.d.mts +64 -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 +66 -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 +87 -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 +95 -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 +18 -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 +1077 -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 +69 -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,279 @@
|
|
|
1
|
+
import { readFile, access } from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fromMarkdown } from 'mdast-util-from-markdown'
|
|
4
|
+
import { mdxjsEsm } from 'micromark-extension-mdxjs-esm'
|
|
5
|
+
import { mdxjsEsmFromMarkdown } from 'mdast-util-mdxjs-esm'
|
|
6
|
+
import { mdxJsx } from 'micromark-extension-mdx-jsx'
|
|
7
|
+
import { mdxJsxFromMarkdown } from 'mdast-util-mdx-jsx'
|
|
8
|
+
import * as acorn from 'acorn'
|
|
9
|
+
import { generatePresetCSS } from '@master/internal-site/css/generate-preset-css.ts'
|
|
10
|
+
import { selectedSpecimensMarkdown } from '@master/internal-site/css/foundation-data/specimen-content.ts'
|
|
11
|
+
import { getVariableNamespacePublicKeys } from '@master/internal-site/css/manifest-utilities.ts'
|
|
12
|
+
import { configuredExampleCSS, configuredExampleHTML, configuredMarkupClasses, configuredMarkupMarkdown } from '@master/internal-site/css/configured-example.ts'
|
|
13
|
+
import { stylesheetExampleMarkdown } from '@master/internal-site/css/stylesheet-example.ts'
|
|
14
|
+
|
|
15
|
+
export interface SyntaxRow {
|
|
16
|
+
id: string
|
|
17
|
+
syntax: string
|
|
18
|
+
declarations: string
|
|
19
|
+
identifiers: string[]
|
|
20
|
+
group?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ReferenceExample {
|
|
24
|
+
id: string
|
|
25
|
+
title: string
|
|
26
|
+
classes: string[]
|
|
27
|
+
css: string
|
|
28
|
+
configuration?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function syntaxMarkdown(rows: SyntaxRow[]) {
|
|
32
|
+
return rows.map(row => `### \`${row.syntax}\` {#${row.id}}\n\n\`\`\`css\n${row.declarations}\n\`\`\``).join('\n\n')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function portableMarkdown(markdown: string) {
|
|
36
|
+
return markdown.split(/(```[\s\S]*?```)/g).map(part => part.startsWith('```') ? part : part.replace(/<!-- \/?reference-illustration(?::[\w-]+)? -->\n*/g, '').replace(/^(#{2,3}) (.+) \{#([\w-]+)\}$/gm, '<a id="$3"></a>\n\n$1 $2')).join('')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Resolve authored literals only. Never execute MDX expressions to extract documents. */
|
|
40
|
+
function literal(node: any, variables: Record<string, unknown>): unknown {
|
|
41
|
+
if (node.type === 'Literal') return node.value
|
|
42
|
+
if (node.type === 'ObjectExpression') return Object.fromEntries(node.properties.map((property: any) => {
|
|
43
|
+
if (property.type !== 'Property' || property.computed || property.method || property.kind !== 'init') throw new Error('Only literal document properties are supported')
|
|
44
|
+
return [property.key.name ?? property.key.value, literal(property.value, variables)]
|
|
45
|
+
}))
|
|
46
|
+
if (node.type === 'ArrayExpression') return node.elements.map((item: any) => literal(item, variables))
|
|
47
|
+
if (node.type === 'Identifier' && node.name in variables) return variables[node.name]
|
|
48
|
+
if (node.type === 'TemplateLiteral' && !node.expressions.length) return node.quasis[0].value.cooked
|
|
49
|
+
throw new Error(`Unsupported document expression: ${node.type}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface MdxContentOptions {
|
|
53
|
+
/** Reference Overview renders syntax rows; Guide Overview may be a local MDX include. */
|
|
54
|
+
overview?: 'syntax' | 'include'
|
|
55
|
+
component?: (name: string, attributes: Record<string, any>, file: string, context: { expression: (source: string) => Promise<unknown> }) => string | undefined | Promise<string | undefined>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* An element whose children are one expression, such as `<Code lang="html">{`…`}</Code>`. Attribute values may hold
|
|
60
|
+
* `>` inside quotes or braces; a self-closing element (`<Class2CSS classes={[…]} />`) has no children to extract.
|
|
61
|
+
*/
|
|
62
|
+
const expressionElement = /(<(Code|Class2CSS|DocumentDeclaration)\b(?:"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}|[^>"'{/])*>)([\s\S]*?)(<\/\2>)/g
|
|
63
|
+
|
|
64
|
+
export async function extractReferenceMdx(file: string, rows: SyntaxRow[] = [], stack: string[] = [], options: MdxContentOptions = {}) {
|
|
65
|
+
if (stack.includes(file)) throw new Error(`Recursive document include: ${file}`)
|
|
66
|
+
const expressions: Record<string, string> = {}
|
|
67
|
+
const source = (await readFile(file, 'utf8')).split(/(```[\s\S]*?```)/g).map(part => part.startsWith('```') ? part : part.replace(/\{?<Demo\b[\s\S]*?<\/Demo>\}?/g, '').replace(expressionElement, (_, start, _name, expression, end) => { const key = `MCSS_EXPRESSION_${Object.keys(expressions).length}`; expressions[key] = expression; return `${start}\n${key}\n${end}` })).join('')
|
|
68
|
+
const examples: ReferenceExample[] = []
|
|
69
|
+
const notes: string[] = []
|
|
70
|
+
const variables: Record<string, unknown> = {}
|
|
71
|
+
const imports: Record<string, string> = {}
|
|
72
|
+
const rawImports: Record<string, string> = {}
|
|
73
|
+
let tree: any
|
|
74
|
+
try { tree = fromMarkdown(source, {
|
|
75
|
+
extensions: [{ disable: { null: ['htmlFlow', 'htmlText', 'codeIndented'] } }, mdxjsEsm({ acorn, addResult: true }), mdxJsx({ acorn, addResult: true })],
|
|
76
|
+
mdastExtensions: [mdxjsEsmFromMarkdown(), mdxJsxFromMarkdown()]
|
|
77
|
+
}) } catch (error) { throw new Error(`Cannot parse ${file}`, { cause: error }) }
|
|
78
|
+
const raw = (node: any) => source.slice(node.position.start.offset, node.position.end.offset)
|
|
79
|
+
const collectEsm = (node: any) => {
|
|
80
|
+
if (node.type === 'mdxjsEsm') {
|
|
81
|
+
const program = node.data?.estree ?? acorn.parse(node.value, { ecmaVersion: 'latest', sourceType: 'module' })
|
|
82
|
+
for (const statement of program.body) {
|
|
83
|
+
if (statement.type === 'ImportDeclaration') {
|
|
84
|
+
for (const specifier of statement.specifiers) {
|
|
85
|
+
imports[specifier.local.name] = statement.source.value
|
|
86
|
+
if (statement.source.value.endsWith('?raw')) {
|
|
87
|
+
rawImports[specifier.local.name] = statement.source.value
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const declaration = statement.declaration ?? statement
|
|
92
|
+
if (declaration.type === 'VariableDeclaration') {
|
|
93
|
+
for (const item of declaration.declarations) {
|
|
94
|
+
try { variables[item.id.name] = literal(item.init, variables) } catch { /* only literal snippets are exportable */ }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
node.children?.forEach(collectEsm)
|
|
100
|
+
}
|
|
101
|
+
collectEsm(tree)
|
|
102
|
+
const readRawImport = (base: string, importedPath: string) => {
|
|
103
|
+
const target = path.resolve(base, importedPath.replace(/\?raw$/, ''))
|
|
104
|
+
if (!target.startsWith(path.resolve(base) + path.sep)) throw new Error('Raw import must be package local')
|
|
105
|
+
return readFile(target, 'utf8')
|
|
106
|
+
}
|
|
107
|
+
const expression = async (text: string) => {
|
|
108
|
+
// JSX attributes already omit the expression container. Only protected child
|
|
109
|
+
// expressions still have that container; object literals must retain braces.
|
|
110
|
+
const child = expressions[text.trim()]
|
|
111
|
+
const value = child === undefined ? text.trim() : child.trim().replace(/^\{([\s\S]*)\}$/, '$1').trim()
|
|
112
|
+
const rawImport = rawImports[value]
|
|
113
|
+
if (rawImport) return readRawImport(path.dirname(file), rawImport)
|
|
114
|
+
// Follow a small TS module that owns raw imports without executing its code during extraction.
|
|
115
|
+
if (imports[value]?.startsWith('./')) {
|
|
116
|
+
const moduleFile = path.resolve(path.dirname(file), `${imports[value]}.ts`)
|
|
117
|
+
const moduleSource = await readFile(moduleFile, 'utf8').catch(() => '')
|
|
118
|
+
if (moduleSource) {
|
|
119
|
+
const rawModuleAst = acorn.parse(moduleSource, { ecmaVersion: 'latest', sourceType: 'module' }) as any
|
|
120
|
+
for (const statement of rawModuleAst.body) {
|
|
121
|
+
if (statement.type !== 'ImportDeclaration' || !statement.specifiers.some((specifier: any) => specifier.local.name === value)) continue
|
|
122
|
+
if (statement.source.value.endsWith('?raw')) {
|
|
123
|
+
return readRawImport(path.dirname(moduleFile), statement.source.value)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return literal(acorn.parseExpressionAt(value, 0, { ecmaVersion: 'latest' }), variables)
|
|
129
|
+
}
|
|
130
|
+
async function render(node: any): Promise<string> {
|
|
131
|
+
if (node.type === 'mdxjsEsm') return ''
|
|
132
|
+
if (node.type === 'code') return `\`\`\`${node.lang ?? ''}${node.meta ? ` ${node.meta}` : ''}\n${node.value}\n\`\`\``
|
|
133
|
+
if (node.type === 'inlineCode') return raw(node)
|
|
134
|
+
if (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') {
|
|
135
|
+
const name = node.name ?? ''
|
|
136
|
+
const attrs: Record<string, any> = Object.fromEntries((node.attributes ?? []).filter((a: any) => a.name).map((a: any) => [a.name, a.value]))
|
|
137
|
+
const inner = (node.children ?? []).map(raw).join('\n')
|
|
138
|
+
const adapted = await options.component?.(name, attrs, file, { expression })
|
|
139
|
+
if (adapted !== undefined) return adapted
|
|
140
|
+
const attribute = (value: any) => value?.type === 'mdxJsxAttributeValueExpression' ? expression(value.value) : value
|
|
141
|
+
if (name === 'DocumentPrompt') {
|
|
142
|
+
const text = await attribute(attrs.text)
|
|
143
|
+
if (typeof attrs.title !== 'string' || typeof text !== 'string') throw new Error('DocumentPrompt requires a literal title and text')
|
|
144
|
+
return `**${attrs.title}**\n\n\`\`\`text\n${text}\n\`\`\``
|
|
145
|
+
}
|
|
146
|
+
if (name === 'DocumentCodeExample') {
|
|
147
|
+
const source = await attribute(attrs.source)
|
|
148
|
+
const result = await attribute(attrs.result)
|
|
149
|
+
const diagnostic = await attribute(attrs.diagnostic)
|
|
150
|
+
if (typeof source !== 'string' || typeof attrs.language !== 'string') throw new Error('DocumentCodeExample requires literal source and language')
|
|
151
|
+
const parts = [`**${attrs.title}**`, `\`\`\`${attrs.language}\n${source}\n\`\`\``]
|
|
152
|
+
if (result !== undefined) {
|
|
153
|
+
if (typeof result !== 'string') throw new Error('DocumentCodeExample requires a literal result')
|
|
154
|
+
parts.push(`**${attrs.resultLabel ?? (attrs.resultKind === 'generated-css' ? 'Generated CSS' : 'Result')}**`, `\`\`\`${attrs.resultLanguage ?? attrs.language}\n${result}\n\`\`\``)
|
|
155
|
+
}
|
|
156
|
+
if (diagnostic) parts.push(`${diagnostic.severity} (\`${diagnostic.rule}\`): ${diagnostic.message}`)
|
|
157
|
+
return parts.join('\n\n')
|
|
158
|
+
}
|
|
159
|
+
if (['DocumentOptions', 'DocumentParameters'].includes(name)) {
|
|
160
|
+
const values = await expression(attrs[name === 'DocumentOptions' ? 'options' : 'parameters'].value) as { name: string, type?: string, requirement?: string, defaultValue?: string, description: string }[]
|
|
161
|
+
if (!Array.isArray(values) || values.some(value => typeof value.name !== 'string' || typeof value.description !== 'string')) throw new Error(`${name} requires literal names and descriptions`)
|
|
162
|
+
return values.map(value => `**\`${value.name}\`**${value.type ? ` — \`${value.type}\`` : ''}${value.requirement ? ` (${value.requirement})` : ''}\n\n${value.defaultValue !== undefined ? `Default: \`${value.defaultValue}\`. ` : ''}${value.description}`).join('\n\n')
|
|
163
|
+
}
|
|
164
|
+
if (name === 'DocumentAPIIndex') {
|
|
165
|
+
const values = await expression(attrs.entries.value) as { name: string, href: string, description: string }[]
|
|
166
|
+
if (!Array.isArray(values) || values.some(value => !['name', 'href', 'description'].every(key => typeof value[key as keyof typeof value] === 'string'))) throw new Error('DocumentAPIIndex requires literal entries')
|
|
167
|
+
return values.map(value => `- [\`${value.name}\`](${value.href}) — ${value.description}`).join('\n')
|
|
168
|
+
}
|
|
169
|
+
if (name === 'DocumentDeclaration') return `**${attrs.label}**\n\n\`\`\`typescript\n${await expression(inner)}\n\`\`\``
|
|
170
|
+
if (name === 'DocumentValueList') {
|
|
171
|
+
const values = await expression(attrs.rows.value) as { id: string, title: string, identifier?: string, values: { label: string, value: string }[] }[]
|
|
172
|
+
return values.map(value => `### ${value.title} {#${value.id}}\n\n${value.identifier ? `\`${value.identifier}\`\n\n` : ''}${value.values.map(pair => `${pair.label}: \`${pair.value}\``).join('\n\n')}`).join('\n\n')
|
|
173
|
+
}
|
|
174
|
+
if (name === 'DocumentFlow') {
|
|
175
|
+
const steps = await expression(attrs.steps.value) as { title: string, description: string }[]
|
|
176
|
+
return `**${attrs.title}**\n\n${steps.map((step, index) => `${index + 1}. **${step.title}** — ${step.description}`).join('\n')}${attrs.caption ? `\n\n${attrs.caption}` : ''}`
|
|
177
|
+
}
|
|
178
|
+
if (name === 'DocumentFileTree') {
|
|
179
|
+
type Entry = { name: string, description?: string, children?: Entry[] }
|
|
180
|
+
const entries = await expression(attrs.entries.value) as Entry[]
|
|
181
|
+
const lines = (items: Entry[], level = 0): string => items.map(item => `${' '.repeat(level)}- \`${item.name}${item.children ? '/' : ''}\`${item.description ? ` — ${item.description}` : ''}${item.children?.length ? `\n${lines(item.children, level + 1)}` : ''}`).join('\n')
|
|
182
|
+
return `**${attrs.title}**\n\n${lines(entries)}${attrs.caption ? `\n\n${attrs.caption}` : ''}`
|
|
183
|
+
}
|
|
184
|
+
if (name === 'Overview' && options.overview !== 'include') return syntaxMarkdown(rows)
|
|
185
|
+
if (name === 'StylesheetExample') {
|
|
186
|
+
const source = typeof attrs.source === 'string' ? attrs.source : await expression(attrs.source.value)
|
|
187
|
+
if (typeof attrs.title !== 'string' || typeof source !== 'string') throw new Error('StylesheetExample requires a literal title and source')
|
|
188
|
+
return stylesheetExampleMarkdown(attrs.title, source)
|
|
189
|
+
}
|
|
190
|
+
if (name === 'FoundationTokens') return selectedSpecimensMarkdown(attrs.namespace, await expression(attrs.keys.value) as string[])
|
|
191
|
+
if (name === 'DemoPageViewport') return `[Open the resizable ${attrs.title} example](${attrs.src}). The viewport slider also supports arrow keys.`
|
|
192
|
+
if (name === 'DemoConfiguredExample') {
|
|
193
|
+
const configuration = typeof attrs.source === 'string' ? attrs.source : await expression(attrs.source.value) as string
|
|
194
|
+
const html = typeof attrs.html === 'string' ? attrs.html : await expression(attrs.html.value) as string
|
|
195
|
+
const classes = configuredMarkupClasses(html)
|
|
196
|
+
const css = configuredExampleCSS(configuration, classes)
|
|
197
|
+
examples.push({ id: `example-${examples.length + 1}`, title: attrs.title ?? classes.join(' '), classes, configuration, css })
|
|
198
|
+
return `${configuredMarkupMarkdown(configuration, html, css)}${typeof attrs.caption === 'string' ? `\n\n${attrs.caption}` : ''}`
|
|
199
|
+
}
|
|
200
|
+
if (name === 'ConfiguredExample') {
|
|
201
|
+
const configuration = typeof attrs.source === 'string' ? attrs.source : await expression(attrs.source.value) as string
|
|
202
|
+
const html = attrs.html !== undefined ? typeof attrs.html === 'string' ? attrs.html : await expression(attrs.html.value) as string : undefined
|
|
203
|
+
const classes = html !== undefined ? configuredMarkupClasses(html) : await expression(attrs.classes.value) as string[]
|
|
204
|
+
const css = configuredExampleCSS(configuration, classes)
|
|
205
|
+
examples.push({ id: `example-${examples.length + 1}`, title: classes.join(' '), classes, configuration, css })
|
|
206
|
+
return `${configuration ? `\`\`\`css\n${configuration}\n\`\`\`\n\n` : ''}\`\`\`html\n${html ?? configuredExampleHTML(classes, attrs.element ?? 'div', attrs.label ?? 'Example')}\n\`\`\`\n\n\`\`\`css disclosure=generated-css\n${css}\n\`\`\``
|
|
207
|
+
}
|
|
208
|
+
if (name === 'TextHeirs') return getVariableNamespacePublicKeys('color-text').map(key => `\`${key}:\``).join(', ')
|
|
209
|
+
if (name === 'StartingStyleExample' || name === 'AnimationDirectionBasicDemo') return '' // Visual demos accompany the adjacent complete code examples.
|
|
210
|
+
if (name === 'Class2CSS') {
|
|
211
|
+
// `<Class2CSS classes={[...]} />`; older sources pass the classes as children.
|
|
212
|
+
const value = attrs.classes !== undefined ? typeof attrs.classes === 'string' ? attrs.classes : await expression(attrs.classes.value) : await expression(inner)
|
|
213
|
+
const classes = (Array.isArray(value) ? value : [value]).flatMap(item => String(item).split(/\s+/)).filter(Boolean)
|
|
214
|
+
const css = generatePresetCSS(classes)
|
|
215
|
+
examples.push({ id: `example-${examples.length + 1}`, title: classes.join(' '), classes, css })
|
|
216
|
+
return `\`\`\`css disclosure=generated-css\n${css}\n\`\`\``
|
|
217
|
+
}
|
|
218
|
+
if (name === 'Code') {
|
|
219
|
+
try { return `\`\`\`${typeof attrs.lang === 'string' ? attrs.lang : ''}\n${attrs.code !== undefined ? typeof attrs.code === 'string' ? attrs.code : await expression(attrs.code.value) : await expression(inner)}\n\`\`\`` }
|
|
220
|
+
catch { notes.push(`${path.basename(file)}: Code expression requires a text equivalent`); return '' }
|
|
221
|
+
}
|
|
222
|
+
if (name === 'Basic' && typeof (attrs.class ?? attrs.className) === 'string') return `\`\`\`html\n<div class="${attrs.class ?? attrs.className}">…</div>\n\`\`\``
|
|
223
|
+
if (name === 'DemoIndex') {
|
|
224
|
+
const groups = await expression(attrs.groups.value) as { title: string, links: { href: string, label: string }[] }[]
|
|
225
|
+
if (!Array.isArray(groups) || groups.some(group => !group || typeof group.title !== 'string' || !Array.isArray(group.links)
|
|
226
|
+
|| group.links.some(link => !link || typeof link.href !== 'string' || typeof link.label !== 'string'))) throw new Error('DemoIndex requires literal group titles and labeled links')
|
|
227
|
+
return groups.map(group => `**${group.title}**\n\n${group.links.map(link => `- [${link.label}](${link.href})`).join('\n')}`).join('\n\n')
|
|
228
|
+
}
|
|
229
|
+
// The setup result is visual only; the source it wraps stays in the export.
|
|
230
|
+
if (name === 'HelloWorld' || name === 'InstallationPreview') return (await Promise.all((node.children ?? []).map(render))).join('\n\n')
|
|
231
|
+
if (/^(Demo|DemoPanel|Image|InteractingIndicator|Dropped|Icon\w+)/.test(name)) return ''
|
|
232
|
+
if (name === 'DocumentChoices') {
|
|
233
|
+
const entries = await expression(attrs.entries.value) as { title: string, href: string, description: string }[]
|
|
234
|
+
if (!Array.isArray(entries) || entries.some(entry => !['title', 'href', 'description'].every(key => typeof entry[key as keyof typeof entry] === 'string'))) throw new Error('DocumentChoices requires literal titles, links and descriptions')
|
|
235
|
+
return entries.map(entry => `- [${entry.title}](${entry.href}) — ${entry.description}`).join('\n')
|
|
236
|
+
}
|
|
237
|
+
if (name === 'DocumentDisclosure') {
|
|
238
|
+
if (typeof attrs.title !== 'string') throw new Error('DocumentDisclosure requires a literal title')
|
|
239
|
+
return `**${attrs.title}**\n\n${(await Promise.all((node.children ?? []).map(render))).join('\n\n')}`
|
|
240
|
+
}
|
|
241
|
+
if (name === 'DocumentOptionEntry') {
|
|
242
|
+
if (typeof attrs.name !== 'string') throw new Error('DocumentOptionEntry requires a literal name')
|
|
243
|
+
return `**\`${attrs.name}\`**\n\n${(await Promise.all((node.children ?? []).map(render))).join('\n\n')}`
|
|
244
|
+
}
|
|
245
|
+
if (['DocumentOptionList', 'DocumentComparison', 'StepSection', 'Step', 'StepL', 'StepR', 'CodeTabs', 'Tab'].includes(name)) return (await Promise.all((node.children ?? []).map(render))).join('\n\n')
|
|
246
|
+
if (/^[A-Z]/.test(name)) {
|
|
247
|
+
const imported = imports[name]
|
|
248
|
+
const siteRoot = file.slice(0, file.lastIndexOf('/content/'))
|
|
249
|
+
const target = imported?.startsWith('~/site/') ? path.join(siteRoot, imported.slice(7))
|
|
250
|
+
: imported?.startsWith('.') ? path.resolve(path.dirname(file), imported)
|
|
251
|
+
: path.join(path.dirname(file), 'components', `${name}.mdx`)
|
|
252
|
+
if (target.endsWith('.mdx') && await access(target).then(() => true, () => false)) {
|
|
253
|
+
const result = await extractReferenceMdx(target, rows, [...stack, file], options)
|
|
254
|
+
examples.push(...result.examples)
|
|
255
|
+
notes.push(...result.notes)
|
|
256
|
+
return result.markdown
|
|
257
|
+
}
|
|
258
|
+
notes.push(`${path.basename(file)}: ${name} has no Markdown adapter`)
|
|
259
|
+
}
|
|
260
|
+
if (name === 'a' && attrs.id) return `<a id="${attrs.id}"></a>`
|
|
261
|
+
return (await Promise.all((node.children ?? []).map(render))).join(name === 'details' ? '\n\n' : '')
|
|
262
|
+
}
|
|
263
|
+
if (!node.children?.length) return raw(node)
|
|
264
|
+
// Replace only MDX descendants, preserving Markdown punctuation and fenced examples.
|
|
265
|
+
let text = raw(node)
|
|
266
|
+
for (const child of [...node.children].reverse()) {
|
|
267
|
+
const start = child.position.start.offset - node.position.start.offset
|
|
268
|
+
const end = child.position.end.offset - node.position.start.offset
|
|
269
|
+
text = text.slice(0, start) + await render(child) + text.slice(end)
|
|
270
|
+
}
|
|
271
|
+
return node.type === 'heading' ? text.replace(/\\([{}])/g, '$1') : text
|
|
272
|
+
}
|
|
273
|
+
const parts: string[] = []
|
|
274
|
+
for (const child of tree.children) parts.push(await render(child))
|
|
275
|
+
const markdown = parts.join('\n\n').split(/(```[\s\S]*?```)/g).map(part => part.startsWith('```') ? part : part.replace(/\{?\/\*\s*eslint-[\s\S]*?\*\/\}?/g, '')).join('')
|
|
276
|
+
.replace(/ \[sr-only\]/g, '').replace(/<!--\s*@MARK[\s\S]*?-->/g, '')
|
|
277
|
+
.replace(/\n{3,}/g, '\n\n').trim()
|
|
278
|
+
return { markdown, examples, notes: [...new Set(notes)] }
|
|
279
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createEngineSync } from '@master/css/node'
|
|
2
|
+
import defaultManifestJSON from '@master/css-preset/default-manifest.json' with { type: 'json' }
|
|
3
|
+
import type { MasterCSSManifest } from '@master/css-schema/manifest'
|
|
4
|
+
import { createToolingSessionSync } from '@master/css-tooling/node'
|
|
5
|
+
|
|
6
|
+
const defaultManifest = defaultManifestJSON as unknown as MasterCSSManifest
|
|
7
|
+
const presetTooling = createToolingSessionSync({ manifest: defaultManifest })
|
|
8
|
+
|
|
9
|
+
export const createPresetEngine = () => {
|
|
10
|
+
return createEngineSync({ manifest: defaultManifest })
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const generatePresetClasses = (classNames: readonly string[]) => {
|
|
14
|
+
return presetTooling.validateClassNames(classNames)
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { compileManifestSync } from '@master/css-compiler/node'
|
|
2
|
+
import { createRenderSessionSync } from '@master/css/node'
|
|
3
|
+
import { beautifyCSS } from '@master/internal-site/utils/beautify-css'
|
|
4
|
+
import preset from '@master/internal-site/css/preset-manifest.ts'
|
|
5
|
+
|
|
6
|
+
/** Compile trusted, standalone documentation CSS through the public rendering API. */
|
|
7
|
+
export async function stylesheetExampleCSS(source: string) {
|
|
8
|
+
const result = compileManifestSync(source, {
|
|
9
|
+
baseManifest: preset,
|
|
10
|
+
preserveNativeCSS: true,
|
|
11
|
+
})
|
|
12
|
+
const errors = result.diagnostics.filter(diagnostic => diagnostic.severity === 'error')
|
|
13
|
+
if (errors.length) throw new Error(`Invalid documentation stylesheet: ${JSON.stringify(errors)}`)
|
|
14
|
+
const renderer = createRenderSessionSync({ manifest: result.manifest })
|
|
15
|
+
try {
|
|
16
|
+
renderer.ensureStylesheetResources(result.css)
|
|
17
|
+
renderer.ensureClassRules([...result.directiveSummary.extractionPolicy.safelist])
|
|
18
|
+
const snapshot = renderer.snapshot()
|
|
19
|
+
// The compiler owns native rules; the engine snapshot owns generated rules.
|
|
20
|
+
return beautifyCSS([result.css, snapshot.cssText].filter(Boolean).join('\n\n')).trim()
|
|
21
|
+
} finally { renderer.dispose() }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function stylesheetExampleMarkdown(title: string, source: string) {
|
|
25
|
+
return `**${title}**\n\n\`\`\`css name=Source stylesheet=source\n${source}\n\`\`\`\n\n\`\`\`css name=Result stylesheet=result disclosure=generated-css\n${await stylesheetExampleCSS(source)}\n\`\`\``
|
|
26
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import presetManifest from '@master/internal-site/css/preset-manifest.ts'
|
|
2
|
+
import {
|
|
3
|
+
flattenMasterCSSManifestVariables,
|
|
4
|
+
type MasterCSSManifest,
|
|
5
|
+
type MasterCSSManifestVariable
|
|
6
|
+
} from '@master/css-schema/manifest'
|
|
7
|
+
|
|
8
|
+
const presetVariables = flattenMasterCSSManifestVariables((presetManifest as MasterCSSManifest).variables)
|
|
9
|
+
// Display-only equivalents for the documentation preview, never compiler units.
|
|
10
|
+
const previewRootPixels = 16
|
|
11
|
+
|
|
12
|
+
export interface ThemeNumericVariableEntry {
|
|
13
|
+
key: string
|
|
14
|
+
value: string
|
|
15
|
+
unit?: string
|
|
16
|
+
px: number
|
|
17
|
+
rem: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Documentation displays authored values for a specific scope, never computed browser values.
|
|
21
|
+
export type ThemeDisplayVariable = MasterCSSManifestVariable & { value: string }
|
|
22
|
+
export function getThemeVariables(namespace: string): ThemeDisplayVariable[] {
|
|
23
|
+
return presetVariables.flatMap(variable => {
|
|
24
|
+
const entry = variable.namespace === namespace && variable.values.find(value => value.path.length === 1 && value.path[0] === ':root,:host')
|
|
25
|
+
return entry ? [{ ...variable, value: entry.value }] : []
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getThemeNumberVariableEntries(namespace: string) {
|
|
30
|
+
return getThemeNumericVariableEntries(namespace).map(({ key, px }) => [key, px] as const)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getNumericRemValue(variable: MasterCSSManifestVariable) {
|
|
34
|
+
if (!variable.numeric) return
|
|
35
|
+
const numeric = variable.numeric
|
|
36
|
+
switch (numeric.unit) {
|
|
37
|
+
case 'rem':
|
|
38
|
+
return numeric.value
|
|
39
|
+
case undefined:
|
|
40
|
+
case '':
|
|
41
|
+
case 'px':
|
|
42
|
+
return numeric.value / previewRootPixels
|
|
43
|
+
default:
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getNumericUnit(variable: MasterCSSManifestVariable) {
|
|
49
|
+
return variable.numeric?.unit
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getThemeNumericVariableEntries(namespace: string): ThemeNumericVariableEntry[] {
|
|
53
|
+
if (namespace === 'breakpoint') {
|
|
54
|
+
return Object.entries(presetManifest.customMedia || {}).flatMap(([name, expression]) => {
|
|
55
|
+
if (expression.type !== 'feature') return []
|
|
56
|
+
const match = expression.value.match(/^\(width\s*>=\s*([\d.]+)(rem|px)\)$/)
|
|
57
|
+
if (!match) return []
|
|
58
|
+
const value = Number(match[1]), unit = match[2]
|
|
59
|
+
const rem = unit === 'rem' ? value : value / previewRootPixels
|
|
60
|
+
return [{ key: name.slice(2), value: `${value}${unit}`, unit, px: rem * previewRootPixels, rem }]
|
|
61
|
+
}).sort((a, b) => a.px - b.px)
|
|
62
|
+
}
|
|
63
|
+
return getThemeVariables(namespace).flatMap((variable) => {
|
|
64
|
+
const rem = getNumericRemValue(variable)
|
|
65
|
+
if (rem === undefined || variable.value === undefined) return []
|
|
66
|
+
return [{
|
|
67
|
+
key: variable.key,
|
|
68
|
+
value: String(variable.value),
|
|
69
|
+
...(getNumericUnit(variable) ? { unit: getNumericUnit(variable) } : {}),
|
|
70
|
+
px: rem * previewRootPixels,
|
|
71
|
+
rem
|
|
72
|
+
}]
|
|
73
|
+
})
|
|
74
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getVariableNamespacePublicKeys, tokenFamilies } from '@master/internal-site/css/manifest-utilities.ts'
|
|
2
|
+
|
|
3
|
+
/** Registry consumers can exist before a project defines any values in that namespace. */
|
|
4
|
+
export const variableNamespaceSources = [
|
|
5
|
+
...[...new Set([
|
|
6
|
+
...tokenFamilies.flatMap(family => family.namespaces),
|
|
7
|
+
])].filter(namespace => namespace !== 'breakpoint').sort().map(namespace => ({
|
|
8
|
+
namespace,
|
|
9
|
+
consumers: [
|
|
10
|
+
...getVariableNamespacePublicKeys(namespace).map(key => `${key}-`),
|
|
11
|
+
],
|
|
12
|
+
})),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
export function variableNamespaceSourcesMarkdown(namespaces?: readonly string[]) {
|
|
16
|
+
const rows = namespaces ? variableNamespaceSources.filter(row => namespaces.includes(row.namespace)) : variableNamespaceSources
|
|
17
|
+
return ['| Namespace | Consumers |', '| --- | --- |', ...rows.map(({ namespace, consumers }) =>
|
|
18
|
+
`| \`${namespace}-*\` | ${consumers.map(key => `\`${key}\``).join(', ')} |`,
|
|
19
|
+
)].join('\n')
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
import type { DemoStyle } from './style'
|
|
5
|
+
|
|
6
|
+
export type DemoBackground = 'plain' | 'grid' | 'dots' | 'hatch' | 'checkerboard'
|
|
7
|
+
export type DemoPadding = 'none' | 'sm' | 'lg'
|
|
8
|
+
export type DemoFrame = 'default' | 'none'
|
|
9
|
+
export type DemoAlign = 'center' | 'start'
|
|
10
|
+
/** Markup props take text, or a snippet (a named slot from `.astro` and `.mdx`). */
|
|
11
|
+
export type DemoNode = string | Snippet
|
|
12
|
+
|
|
13
|
+
export interface DemoProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'style' | 'children'> {
|
|
14
|
+
title?: string
|
|
15
|
+
description?: DemoNode
|
|
16
|
+
caption?: DemoNode
|
|
17
|
+
background?: DemoBackground
|
|
18
|
+
padding?: DemoPadding
|
|
19
|
+
/** `none` omits the stage when the content already owns its frame: a browser, a comparison, a code window. */
|
|
20
|
+
frame?: DemoFrame
|
|
21
|
+
/** Placement on the stage: centered specimens by default, or from the start edge. */
|
|
22
|
+
align?: DemoAlign
|
|
23
|
+
controls?: DemoNode
|
|
24
|
+
/** Source and generated output, placed under the stage inside the same tray. */
|
|
25
|
+
source?: DemoNode
|
|
26
|
+
frameClassName?: string
|
|
27
|
+
style?: DemoStyle
|
|
28
|
+
children?: Snippet
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import '@master/internal-site/styles/demo.css'
|
|
34
|
+
import { styleText } from './style'
|
|
35
|
+
|
|
36
|
+
/** One example is one tray: head, stage, source, caption. class and style belong to the stage; the chrome never joins the demonstrated layout. */
|
|
37
|
+
let {
|
|
38
|
+
title, description, caption, background = 'plain', padding = 'lg', frame = 'default', align = 'center', controls, source,
|
|
39
|
+
frameClassName, class: className, style, children, ...props
|
|
40
|
+
}: DemoProps = $props()
|
|
41
|
+
const head = $derived(Boolean(title || description || controls))
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#snippet node(value: DemoNode)}{#if typeof value === 'function'}{@render value()}{:else}{value}{/if}{/snippet}
|
|
45
|
+
|
|
46
|
+
<figure {...props} class={['ui-tray', frameClassName]}>{#if head}<figcaption class="ui-tray-head">
|
|
47
|
+
{#if title || description}<div>
|
|
48
|
+
{#if title}<p class="ui-tray-title">{title}</p>{/if}
|
|
49
|
+
{#if description}<p class="ui-tray-description">{@render node(description)}</p>{/if}
|
|
50
|
+
</div>{/if}
|
|
51
|
+
{#if controls}<div class="ui-tray-tools">{@render node(controls)}</div>{/if}
|
|
52
|
+
</figcaption>{/if}{#if frame === 'none'}{@render children?.()}{:else}<div class={['ui-stage', className]} style={styleText(style)}
|
|
53
|
+
data-background={background === 'plain' ? undefined : background}
|
|
54
|
+
data-padding={padding === 'lg' ? undefined : padding}
|
|
55
|
+
data-align={align === 'center' ? undefined : align}>{@render children?.()}</div>{/if}{#if source}{@render node(source)}{/if}{#if caption}{#if head}<div class="ui-tray-caption">{@render node(caption)}</div>{:else}<figcaption class="ui-tray-caption">{@render node(caption)}</figcaption>{/if}{/if}</figure>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
3
|
+
import IconDownload from '@tabler/icons-svelte-runes/icons/download'
|
|
4
|
+
import Demo from './Demo.svelte'
|
|
5
|
+
import Image from '@master/internal-site/components/Image.svelte'
|
|
6
|
+
|
|
7
|
+
export interface DemoAssetProps {
|
|
8
|
+
title: string
|
|
9
|
+
description: string
|
|
10
|
+
src: string
|
|
11
|
+
alt: string
|
|
12
|
+
width: number
|
|
13
|
+
height: number
|
|
14
|
+
format?: string
|
|
15
|
+
surface?: 'light' | 'dark' | 'transparent'
|
|
16
|
+
}
|
|
17
|
+
type Props = DemoAssetProps
|
|
18
|
+
|
|
19
|
+
/** A downloadable specimen, not a CSS test subject. Intrinsic dimensions reserve
|
|
20
|
+
* the image ratio; only the preview is constrained. The file stays unchanged.
|
|
21
|
+
* Light and dark artwork turns the stage itself to that mode, so the artwork has no frame of its own inside it;
|
|
22
|
+
* transparent artwork sits on a checkerboard. A demo container keeps the prose media perimeter off the artwork.
|
|
23
|
+
*/
|
|
24
|
+
const { title, description, src, alt, width, height, format = 'SVG', surface = 'transparent' } = Astro.props
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
<Demo title={title} description={description} background={surface === 'transparent' ? 'checkerboard' : 'plain'} class={surface === 'transparent' ? undefined : surface} data-asset={surface}>
|
|
28
|
+
<Fragment slot="caption">
|
|
29
|
+
<span class="flex flex-wrap items-center justify-between gap-sm">
|
|
30
|
+
<span class="ui-badge" data-size="sm">{format}</span>
|
|
31
|
+
<a href={src} download class="ui-button" data-size="sm" aria-label={`Download ${title} (${format})`}>
|
|
32
|
+
<IconDownload aria-hidden="true" />
|
|
33
|
+
Download {format}
|
|
34
|
+
</a>
|
|
35
|
+
</span>
|
|
36
|
+
</Fragment>
|
|
37
|
+
<div class="grid (place-items:center) w-full" data-demo-container=""><Image src={src} alt={alt} width={width} height={height} class="block h-auto w-auto max-w-full (max-height:var(--spacing-4xl))" /></div>
|
|
38
|
+
</Demo>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
5
|
+
import { styleText, type DemoStyle } from '@master/internal-site/demo/style.ts'
|
|
6
|
+
|
|
7
|
+
/** `inline` and `block` take text, or a snippet (a named slot from `.astro` and `.mdx`). */
|
|
8
|
+
let { inline = 'Main axis', block = 'Cross axis', children, class: className, style, ...props }: Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
9
|
+
inline?: string | Snippet
|
|
10
|
+
block?: string | Snippet
|
|
11
|
+
style?: DemoStyle
|
|
12
|
+
children?: Snippet
|
|
13
|
+
} = $props()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#snippet node(value: string | Snippet)}{#if typeof value === 'function'}{@render value()}{:else}{value}{/if}{/snippet}
|
|
17
|
+
|
|
18
|
+
<div {...props} class={['ui-axes', className]} style={styleText(style)}>
|
|
19
|
+
<div class="ui-axes-inline"><span>{@render node(inline)}</span><span class="ui-axes-rule" aria-hidden="true"></span></div>
|
|
20
|
+
<div class="ui-axes-block"><span>{@render node(block)}</span><span class="ui-axes-rule" aria-hidden="true"></span></div>
|
|
21
|
+
<div class="ui-axes-content">{@render children?.()}</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
5
|
+
import { styleText, type DemoStyle } from '@master/internal-site/demo/style.ts'
|
|
6
|
+
import { tone, type DemoTone } from '@master/internal-site/demo/tone.ts'
|
|
7
|
+
|
|
8
|
+
/** An inline category or state; keep it outside measured layouts. */
|
|
9
|
+
let { tone: value = 'neutral', size = 'md', variant = 'soft', class: className, style, children, ...props }: Omit<HTMLAttributes<HTMLSpanElement>, 'style'> & {
|
|
10
|
+
tone?: DemoTone
|
|
11
|
+
size?: 'sm' | 'md'
|
|
12
|
+
variant?: 'soft' | 'dot'
|
|
13
|
+
style?: DemoStyle
|
|
14
|
+
children?: Snippet
|
|
15
|
+
} = $props()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<span {...props} data-tone={tone(value)} data-size={size === 'md' ? undefined : size} data-variant={variant === 'soft' ? undefined : variant} class={['ui-badge', className]} style={styleText(style)}>{@render children?.()}</span>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/demo.css'
|
|
3
|
+
import RenderNode from '@master/internal-site/components/RenderNode.astro'
|
|
4
|
+
import DemoIndex from '@master/internal-site/demo/DemoIndex.astro'
|
|
5
|
+
|
|
6
|
+
export interface DemoCatalogGroup {
|
|
7
|
+
id: string
|
|
8
|
+
title: string
|
|
9
|
+
/** `children` is markup: an Astro template value or MDX JSX, rendered with RenderNode. */
|
|
10
|
+
entries: readonly { id: string, title: string, label: string, href?: string, children: unknown }[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
groups: readonly DemoCatalogGroup[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The complete specimens stay server-rendered inside native disclosures. */
|
|
18
|
+
const { groups } = Astro.props
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<div class="ui-catalog">
|
|
22
|
+
<DemoIndex label="Utility recipe categories" groups={[{
|
|
23
|
+
title: 'Choose a behavior',
|
|
24
|
+
links: groups.map(group => ({ href: `#${group.id}`, label: `${group.title} · ${group.entries.length}` }))
|
|
25
|
+
}]} />
|
|
26
|
+
{groups.map(group => <section aria-labelledby={group.id}>
|
|
27
|
+
<h3 id={group.id}>{group.title}<small>{group.entries.length} recipes</small></h3>
|
|
28
|
+
{group.entries.map(entry => <details class="ui-disclosure" data-variant="rule">
|
|
29
|
+
<summary>{entry.title}<span class="ui-disclosure-meta">{entry.label}</span></summary>
|
|
30
|
+
<div class="ui-catalog-entry">
|
|
31
|
+
{entry.href && <a href={entry.href}>Read related documentation ↗</a>}
|
|
32
|
+
<RenderNode node={entry.children} />
|
|
33
|
+
</div>
|
|
34
|
+
</details>)}
|
|
35
|
+
</section>)}
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
export interface DemoComparisonItem {
|
|
5
|
+
label: string | Snippet
|
|
6
|
+
/** Text or a snippet. From `.astro` and `.mdx`, omit it and pass a named slot called `key` instead. */
|
|
7
|
+
children?: string | Snippet
|
|
8
|
+
key?: string
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
14
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
15
|
+
import { styleText, type DemoStyle } from '@master/internal-site/demo/style.ts'
|
|
16
|
+
|
|
17
|
+
/** The same subject under named conditions: each item is a captioned stage. */
|
|
18
|
+
let { items, class: className, style, ...rest }: Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'children'> & {
|
|
19
|
+
children?: Snippet
|
|
20
|
+
items: DemoComparisonItem[]
|
|
21
|
+
style?: DemoStyle
|
|
22
|
+
} = $props()
|
|
23
|
+
// Slot content arrives as snippet props named by each item's key; everything else is an attribute.
|
|
24
|
+
const slots = $derived(new Set(items.flatMap(item => item.key == null ? [] : [item.key])))
|
|
25
|
+
const attributes = $derived(Object.fromEntries(Object.entries(rest).filter(([name]) => !slots.has(name))))
|
|
26
|
+
const content = (item: DemoComparisonItem) => item.children ?? (item.key == null ? undefined : (rest as Record<string, Snippet | undefined>)[item.key])
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#snippet node(value: string | Snippet | undefined)}{#if typeof value === 'function'}{@render value()}{:else}{value}{/if}{/snippet}
|
|
30
|
+
|
|
31
|
+
<div {...attributes} class={['ui-compare', className]} style={styleText(style)}>
|
|
32
|
+
{#each items as item, index (item.key ?? index)}<figure>
|
|
33
|
+
<figcaption>{@render node(item.label)}</figcaption>
|
|
34
|
+
<div class="ui-stage">{@render node(content(item))}</div>
|
|
35
|
+
</figure>{/each}
|
|
36
|
+
</div>
|