@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,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/system/data.css'
|
|
3
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
4
|
+
import type { BenchmarkSampleSummaryStats } from '@master/internal-site/benchmarks/types.ts'
|
|
5
|
+
import { formatMetricValue } from '@master/internal-site/benchmarks/utils.ts'
|
|
6
|
+
|
|
7
|
+
interface Props extends BenchmarkSampleSummaryStats {
|
|
8
|
+
valueFormatter?: (value: number) => string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { min, median, mean, max, sampleCount, unit, valueFormatter } = Astro.props
|
|
12
|
+
const { t } = siteOf(Astro)
|
|
13
|
+
const format = (value: number) => valueFormatter ? valueFormatter(value) : formatMetricValue(value, unit)
|
|
14
|
+
const entries = [
|
|
15
|
+
['Median', format(median)],
|
|
16
|
+
['Mean', format(mean)],
|
|
17
|
+
['Min', format(min)],
|
|
18
|
+
['Max', format(max)],
|
|
19
|
+
['Samples', sampleCount.toLocaleString('en-US')]
|
|
20
|
+
] as const
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<div class="ui-metrics">
|
|
24
|
+
{entries.map(([label, value]) => (
|
|
25
|
+
<div class="ui-metric">
|
|
26
|
+
<small>{t(label)}</small>
|
|
27
|
+
<b>{value}</b>
|
|
28
|
+
</div>
|
|
29
|
+
))}
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '@master/internal-site/styles/system/data.css'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
|
|
5
|
+
let { title, children }: { title: string; children?: Snippet } = $props()
|
|
6
|
+
const descriptionId = $props.id()
|
|
7
|
+
|
|
8
|
+
/** Mobile WebKit does not consistently scroll a focused div with arrow keys. */
|
|
9
|
+
function scrollWithKeyboard(event: KeyboardEvent & { currentTarget: HTMLDivElement }) {
|
|
10
|
+
if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return
|
|
11
|
+
const region = event.currentTarget
|
|
12
|
+
const horizontal = event.key === 'ArrowLeft' || event.key === 'ArrowRight'
|
|
13
|
+
const vertical = event.key === 'ArrowUp' || event.key === 'ArrowDown'
|
|
14
|
+
if (!horizontal && !vertical) return
|
|
15
|
+
if (horizontal ? region.scrollWidth <= region.clientWidth : region.scrollHeight <= region.clientHeight) return
|
|
16
|
+
const step = event.key === 'ArrowLeft' || event.key === 'ArrowUp' ? -40 : 40
|
|
17
|
+
event.preventDefault()
|
|
18
|
+
region.scrollBy({ left: horizontal ? step : 0, top: vertical ? step : 0, behavior: 'instant' })
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!-- Scroll regions need a tab stop; arrow keys operate this region without intercepting children. -->
|
|
23
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions -->
|
|
24
|
+
<div class="ui-table" data-density="compact" role="region" aria-label={title} aria-describedby={descriptionId} tabindex="0" onkeydown={scrollWithKeyboard}>
|
|
25
|
+
<span class="sr-only" id={descriptionId}>Use arrow keys to scroll the table.</span>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/system/data.css'
|
|
3
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
generatedAt: string
|
|
7
|
+
href: string
|
|
8
|
+
label?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** The evidence and its date stay beside the claim. */
|
|
12
|
+
const { generatedAt, href, label = 'Committed snapshot' } = Astro.props
|
|
13
|
+
const { t } = siteOf(Astro)
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<p class="ui-source">
|
|
17
|
+
{t('Evidence')}
|
|
18
|
+
<a href={href}>{t(label)}</a>
|
|
19
|
+
<span>{t('Recorded')} <time datetime={generatedAt}>{generatedAt.slice(0, 10)} UTC</time></span>
|
|
20
|
+
</p>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/system/data.css'
|
|
3
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
4
|
+
import '@master/internal-site/styles/benchmarks.css'
|
|
5
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
6
|
+
import { uniqueId } from '@master/internal-site/utils/unique-id'
|
|
7
|
+
import type { BenchmarkStackedBarsProps } from '@master/internal-site/benchmarks/types.ts'
|
|
8
|
+
import { benchmarkColors, benchmarkTone, clampPercent, formatMetricValue } from '@master/internal-site/benchmarks/utils.ts'
|
|
9
|
+
|
|
10
|
+
interface Props extends BenchmarkStackedBarsProps {
|
|
11
|
+
class?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Segments carry hue only because each row's legend names them with their values. */
|
|
15
|
+
const { items, max, unit, valueFormatter, class: className } = Astro.props
|
|
16
|
+
const { t } = siteOf(Astro)
|
|
17
|
+
const labelPrefix = uniqueId(Astro, 'benchmark-stacked-bars')
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div class={className ? `ui-chart ${className}` : 'ui-chart'}>
|
|
21
|
+
{items.map((item, index) => {
|
|
22
|
+
const labelId = `${labelPrefix}-label-${index}`
|
|
23
|
+
const valueId = `${labelPrefix}-value-${index}`
|
|
24
|
+
const total = item.total ?? item.segments.reduce((sum, segment) => sum + segment.value, 0)
|
|
25
|
+
const totalLabel = valueFormatter ? valueFormatter(total) : formatMetricValue(total, unit)
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div class="ui-chart-row">
|
|
29
|
+
<span>
|
|
30
|
+
{item.icon && <img src={item.icon.src} alt="" width={item.icon.width} height={item.icon.height} class={item.icon.class} />}
|
|
31
|
+
<span id={labelId}>{t(item.label)}</span>
|
|
32
|
+
{item.detail && <small>{t(item.detail)}</small>}
|
|
33
|
+
</span>
|
|
34
|
+
<div class="ui-bar" data-variant="stacked" role="img" aria-labelledby={`${labelId} ${valueId}`}>
|
|
35
|
+
{item.segments.map((segment, segmentIndex) => <i
|
|
36
|
+
data-tone={benchmarkTone(segment.color ?? benchmarkColors[segmentIndex % benchmarkColors.length])}
|
|
37
|
+
title={`${segment.label}: ${segment.valueLabel ?? formatMetricValue(segment.value, unit)}`}
|
|
38
|
+
style={{ width: `${clampPercent(segment.value, max ?? total)}%` }} />)}
|
|
39
|
+
</div>
|
|
40
|
+
<output id={valueId}>{totalLabel}</output>
|
|
41
|
+
<ul class="ui-legend" role="group" aria-label={`${item.label} breakdown`}>
|
|
42
|
+
{item.segments.map((segment, segmentIndex) => {
|
|
43
|
+
const valueLabel = segment.valueLabel ?? (valueFormatter ? valueFormatter(segment.value) : formatMetricValue(segment.value, unit))
|
|
44
|
+
return <li>
|
|
45
|
+
<i data-tone={benchmarkTone(segment.color ?? benchmarkColors[segmentIndex % benchmarkColors.length])} />
|
|
46
|
+
<span>{t(segment.label)}</span>
|
|
47
|
+
<b>{valueLabel}</b>
|
|
48
|
+
</li>
|
|
49
|
+
})}
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
})}
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/system/specimens.css'
|
|
3
|
+
import type { BenchmarkTone } from '@master/internal-site/benchmarks/types.ts'
|
|
4
|
+
import { benchmarkStatusTones } from '@master/internal-site/benchmarks/utils.ts'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
tone?: BenchmarkTone
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const names: Record<Exclude<BenchmarkTone, 'neutral'>, string> = { good: 'Good', warn: 'Check', bad: 'Regression' }
|
|
11
|
+
|
|
12
|
+
/** A measured value's status is named, not only colored. */
|
|
13
|
+
const { tone } = Astro.props
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{tone && tone !== 'neutral' && <span class="ui-badge" data-tone={benchmarkStatusTones[tone]} data-variant="dot" data-size="sm">{names[tone]}</span>}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export type BenchmarkTone = 'neutral' | 'good' | 'warn' | 'bad'
|
|
2
|
+
export type BenchmarkColor = 'yellow' | 'green' | 'cyan' | 'blue' | 'red' | 'violet' | 'neutral'
|
|
3
|
+
|
|
4
|
+
/** A decorative image before a row label; the label always names the row. */
|
|
5
|
+
export interface BenchmarkIcon {
|
|
6
|
+
src: string
|
|
7
|
+
width?: number
|
|
8
|
+
height?: number
|
|
9
|
+
class?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BenchmarkBarItem {
|
|
13
|
+
id: string
|
|
14
|
+
label: string
|
|
15
|
+
/** A quieter note set right after the label, such as a comparison ratio. */
|
|
16
|
+
labelNote?: string
|
|
17
|
+
value: number
|
|
18
|
+
max?: number
|
|
19
|
+
valueLabel?: string
|
|
20
|
+
detail?: string
|
|
21
|
+
icon?: BenchmarkIcon
|
|
22
|
+
color?: BenchmarkColor
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BenchmarkSegment {
|
|
26
|
+
id: string
|
|
27
|
+
label: string
|
|
28
|
+
value: number
|
|
29
|
+
valueLabel?: string
|
|
30
|
+
color?: BenchmarkColor
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface BenchmarkStackedBarItem {
|
|
34
|
+
id: string
|
|
35
|
+
label: string
|
|
36
|
+
segments: BenchmarkSegment[]
|
|
37
|
+
total?: number
|
|
38
|
+
detail?: string
|
|
39
|
+
icon?: BenchmarkIcon
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface BenchmarkMetric {
|
|
43
|
+
label: string
|
|
44
|
+
value: string | number
|
|
45
|
+
detail?: string
|
|
46
|
+
tone?: BenchmarkTone
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface BenchmarkSampleSummaryStats {
|
|
50
|
+
min: number
|
|
51
|
+
median: number
|
|
52
|
+
mean: number
|
|
53
|
+
max: number
|
|
54
|
+
sampleCount: number
|
|
55
|
+
unit?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface BenchmarkBarsProps {
|
|
59
|
+
items: BenchmarkBarItem[]
|
|
60
|
+
max?: number
|
|
61
|
+
unit?: string
|
|
62
|
+
valueFormatter?: (value: number) => string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface BenchmarkStackedBarsProps {
|
|
66
|
+
items: BenchmarkStackedBarItem[]
|
|
67
|
+
max?: number
|
|
68
|
+
unit?: string
|
|
69
|
+
valueFormatter?: (value: number) => string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** One metric's bars under a small heading that names its statistic. */
|
|
73
|
+
export interface BenchmarkChartGroupModel {
|
|
74
|
+
title: string
|
|
75
|
+
detail: string
|
|
76
|
+
items: BenchmarkBarItem[]
|
|
77
|
+
unit?: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* An authored benchmark chart as data. `BenchmarkChart.astro` renders it on the page and
|
|
82
|
+
* `utils/benchmark-content` serializes the same object into Markdown, so both always agree.
|
|
83
|
+
*/
|
|
84
|
+
export type BenchmarkChartModel =
|
|
85
|
+
| { kind: 'bars' } & BenchmarkBarsProps
|
|
86
|
+
| { kind: 'stacked-bars' } & BenchmarkStackedBarsProps
|
|
87
|
+
| { kind: 'metric-table'; label: string; metrics: BenchmarkMetric[] }
|
|
88
|
+
| { kind: 'chart-groups'; groups: BenchmarkChartGroupModel[] }
|
|
89
|
+
| {
|
|
90
|
+
kind: 'data-table'
|
|
91
|
+
/** Names the scrollable region. */
|
|
92
|
+
label: string
|
|
93
|
+
/** First column, counted from 1, that holds numbers. */
|
|
94
|
+
numericFrom: number
|
|
95
|
+
headers: string[]
|
|
96
|
+
/** The first cell of each row is its row header. */
|
|
97
|
+
rows: (string | number)[][]
|
|
98
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BenchmarkColor, BenchmarkTone } from '@master/internal-site/benchmarks/types.ts'
|
|
2
|
+
|
|
3
|
+
/** Series take the teaching hues that never read as a status first: blue, violet, then neutral. */
|
|
4
|
+
export const benchmarkColors: BenchmarkColor[] = ['blue', 'violet', 'neutral', 'yellow', 'green']
|
|
5
|
+
|
|
6
|
+
/** Series hues map onto the named teaching tones; a legend always names them. */
|
|
7
|
+
const benchmarkTones: Record<BenchmarkColor, 'blue' | 'green' | 'amber' | 'red' | 'violet' | 'neutral'> = {
|
|
8
|
+
blue: 'blue',
|
|
9
|
+
green: 'green',
|
|
10
|
+
yellow: 'amber',
|
|
11
|
+
red: 'red',
|
|
12
|
+
violet: 'violet',
|
|
13
|
+
cyan: 'neutral',
|
|
14
|
+
neutral: 'neutral'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function benchmarkTone(color: BenchmarkColor) {
|
|
18
|
+
return benchmarkTones[color]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Status of a measured value, never a series color. */
|
|
22
|
+
export const benchmarkStatusTones: Record<BenchmarkTone, 'neutral' | 'green' | 'amber' | 'red'> = {
|
|
23
|
+
neutral: 'neutral',
|
|
24
|
+
good: 'green',
|
|
25
|
+
warn: 'amber',
|
|
26
|
+
bad: 'red'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function clampPercent(value: number, max: number) {
|
|
30
|
+
if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return 0
|
|
31
|
+
return Math.max(0, Math.min(100, value / max * 100))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function formatMetricNumber(value: number) {
|
|
35
|
+
return new Intl.NumberFormat('en-US', {
|
|
36
|
+
maximumFractionDigits: value >= 10 ? 1 : 2
|
|
37
|
+
}).format(value)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function formatMetricValue(value: number, unit?: string) {
|
|
41
|
+
return unit ? `${formatMetricNumber(value)} ${unit}` : formatMetricNumber(value)
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/blog-materials.css'
|
|
3
|
+
import Image from '@master/internal-site/components/Image.svelte'
|
|
4
|
+
import authors from '@master/internal-site/data/authors'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
names: { name: string }[]
|
|
8
|
+
class?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Overlapping portraits and the names they belong to; portraits are decorative beside the names. */
|
|
12
|
+
const { names, class: className } = Astro.props
|
|
13
|
+
const known = names.flatMap(({ name }) => authors.find((author) => author.name === name) ?? [])
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<span class={['blog-authors', className].filter(Boolean).join(' ')}>
|
|
17
|
+
<span class="blog-avatar-stack" aria-hidden="true">
|
|
18
|
+
{known.map((author, index) => (
|
|
19
|
+
<span class="blog-avatar" style={{ zIndex: known.length - index }}>
|
|
20
|
+
<Image src={author.image} width={24} height={24} alt="" />
|
|
21
|
+
</span>
|
|
22
|
+
))}
|
|
23
|
+
</span>
|
|
24
|
+
<span class="blog-author-names">{names.map(({ name }) => name).join(' · ')}</span>
|
|
25
|
+
</span>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '@master/internal-site/styles/docs-shell/page-content.css'
|
|
3
|
+
import PageContentList from '@master/internal-site/components/PageContentList.svelte'
|
|
4
|
+
import PageContentProvider from '@master/internal-site/components/PageContentProvider.svelte'
|
|
5
|
+
import type { PageContentItem } from '@master/internal-site/components/page-content.svelte'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The post's contents in the page's left margin: the documentation's contents ruler (the same list, the same live
|
|
9
|
+
* mark, the same scroll tracking), under a label in the reader's language. A list taller than the window scrolls on
|
|
10
|
+
* its own and keeps the current entry in view. `lang` names the language of the section titles when the post is not
|
|
11
|
+
* yet translated.
|
|
12
|
+
*/
|
|
13
|
+
let { items, label, lang }: { items: PageContentItem[], label: string, lang?: string } = $props()
|
|
14
|
+
let nav = $state<HTMLElement>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<nav bind:this={nav} class="blog-article-contents ui-toc" aria-label={label}>
|
|
18
|
+
<!-- The visible label repeats the landmark's name, so assistive technology reads it once. -->
|
|
19
|
+
<!-- svelte-ignore a11y_hidden -->
|
|
20
|
+
<h4 aria-hidden="true">{label}</h4>
|
|
21
|
+
<PageContentProvider {items}>
|
|
22
|
+
<PageContentList {lang} translate={false} scrollContainer={nav} />
|
|
23
|
+
</PageContentProvider>
|
|
24
|
+
</nav>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
import dayjs from 'dayjs'
|
|
3
|
+
import IconArrowLeft from '@tabler/icons-svelte-runes/icons/arrow-left'
|
|
4
|
+
import IconArrowRight from '@tabler/icons-svelte-runes/icons/arrow-right'
|
|
5
|
+
import Link from '@master/internal-site/components/Link.svelte'
|
|
6
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
7
|
+
import TitleLines from './title-lines.astro'
|
|
8
|
+
import { sourceLanguageOf } from './language'
|
|
9
|
+
import type { BlogArticleNeighbor } from './neighbors'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
newer?: BlogArticleNeighbor
|
|
13
|
+
older?: BlogArticleNeighbor
|
|
14
|
+
showCategory?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The close of a post, set like its header: an eyebrow, the next read as an open title with its italic description
|
|
19
|
+
* (marked on hover with the index's artboard corners, not a card), then the other neighbour and the way back to every
|
|
20
|
+
* article as quiet links.
|
|
21
|
+
*/
|
|
22
|
+
const { newer, older, showCategory = true } = Astro.props
|
|
23
|
+
const { t: $, i18n, locale } = siteOf(Astro)
|
|
24
|
+
const tw = locale === 'tw'
|
|
25
|
+
const languageOf = (text?: string) => sourceLanguageOf(text, { ...i18n, locale })
|
|
26
|
+
// Readers who finish a post usually continue backwards through the archive; the newest post leads with the one before it.
|
|
27
|
+
const lead = older ?? newer
|
|
28
|
+
const other = lead === older ? newer : undefined
|
|
29
|
+
// Written out in full, as on the post's own header and on the index's featured sheet.
|
|
30
|
+
const date = (value: string) => dayjs(value).format(tw ? 'YYYY 年 M 月 D 日' : 'MMMM D, YYYY')
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<nav class="blog-article-end blog-rails blog-rails-rule" aria-labelledby="blog-article-end-title">
|
|
34
|
+
<p class="blog-article-end-title" id="blog-article-end-title">{$('Keep reading')}</p>
|
|
35
|
+
{lead && (
|
|
36
|
+
<Link class="blog-article-next blog-marks" href={lead.pathname}>
|
|
37
|
+
<span class="blog-article-next-meta">
|
|
38
|
+
{showCategory && lead.category && <span>{$(lead.category)}</span>}
|
|
39
|
+
{lead.date && <time datetime={lead.date}>{date(lead.date)}</time>}
|
|
40
|
+
</span>
|
|
41
|
+
<span class="blog-article-next-title" lang={languageOf(lead.title)}><TitleLines title={$(lead.title)} class="blog-article-next-title-line" /><IconArrowRight class="blog-article-next-arrow" aria-hidden="true" size={22} stroke={1.25} /></span>
|
|
42
|
+
{lead.description && <span class="blog-article-next-description" lang={languageOf(lead.description)}>{$(lead.description)}</span>}
|
|
43
|
+
</Link>
|
|
44
|
+
)}
|
|
45
|
+
<div class="blog-article-end-links">
|
|
46
|
+
<Link class="blog-article-end-link" href="/blog"><IconArrowLeft aria-hidden="true" size={14} stroke={1.75} />{$('All articles')}</Link>
|
|
47
|
+
{other && (
|
|
48
|
+
<Link class="blog-article-end-link" href={other.pathname}>
|
|
49
|
+
<span class="blog-article-end-link-label">{$('Newer')}</span>
|
|
50
|
+
<span class="blog-article-end-link-title" lang={languageOf(other.title)}>{$(other.title)}</span>
|
|
51
|
+
<IconArrowRight aria-hidden="true" size={14} stroke={1.75} />
|
|
52
|
+
</Link>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
</nav>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
import dayjs from 'dayjs'
|
|
3
|
+
import authors from '@master/internal-site/data/authors'
|
|
4
|
+
import Image from '@master/internal-site/components/Image.svelte'
|
|
5
|
+
import Link from '@master/internal-site/components/Link.svelte'
|
|
6
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
7
|
+
import TitleLines from './title-lines.astro'
|
|
8
|
+
import { sourceLanguageOf } from './language'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
metadata: any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The post's own header, the first section of the drawing: a quiet line of category and date, the title in a soft
|
|
16
|
+
* stone tone, the description, and the authors. Nothing moves and nothing glows; the page's one light simply
|
|
17
|
+
* falls on it from above and to the left.
|
|
18
|
+
*/
|
|
19
|
+
const { metadata } = Astro.props
|
|
20
|
+
const { t: $, i18n, locale } = siteOf(Astro)
|
|
21
|
+
const tw = locale === 'tw'
|
|
22
|
+
const source: string = metadata.title?.absolute || metadata.title
|
|
23
|
+
const title: string = $(source)
|
|
24
|
+
const languageOf = (text?: string) => sourceLanguageOf(text, { ...i18n, locale })
|
|
25
|
+
const people = (metadata.authors ?? [])
|
|
26
|
+
.map(({ name }: { name: string }) => authors.find((author) => author.name === name))
|
|
27
|
+
.filter(Boolean) as typeof authors
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<header class="blog-article-masthead blog-rails">
|
|
31
|
+
{(metadata.category || metadata.date) && (
|
|
32
|
+
<p class="blog-article-meta">
|
|
33
|
+
{metadata.category && <span>{$(metadata.category)}</span>}
|
|
34
|
+
{metadata.date && <time datetime={metadata.date}>{dayjs(metadata.date).format(tw ? 'YYYY 年 M 月 D 日' : 'MMMM D, YYYY')}</time>}
|
|
35
|
+
</p>
|
|
36
|
+
)}
|
|
37
|
+
<h1 class="blog-article-title blog-stone-text" lang={languageOf(source)}><TitleLines title={title} class="blog-article-title-line" /></h1>
|
|
38
|
+
{metadata.description && <p class="blog-article-dek" lang={languageOf(metadata.description)}>{$(metadata.description)}</p>}
|
|
39
|
+
{people.length > 0 && (
|
|
40
|
+
<div class="blog-article-byline">
|
|
41
|
+
<span class="blog-article-byline-label">{$('Written by')}</span>
|
|
42
|
+
<ul class="blog-article-authors">
|
|
43
|
+
{people.map((author) => (
|
|
44
|
+
<li>
|
|
45
|
+
{author.url ? (
|
|
46
|
+
<Link class="blog-article-author" href={author.url}>
|
|
47
|
+
<Image class="blog-article-avatar" src={author.image} width={28} height={28} alt="" />
|
|
48
|
+
<span>{author.name}</span>
|
|
49
|
+
</Link>
|
|
50
|
+
) : (
|
|
51
|
+
<span class="blog-article-author">
|
|
52
|
+
<Image class="blog-article-avatar" src={author.image} width={28} height={28} alt="" />
|
|
53
|
+
<span>{author.name}</span>
|
|
54
|
+
</span>
|
|
55
|
+
)}
|
|
56
|
+
</li>
|
|
57
|
+
))}
|
|
58
|
+
</ul>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</header>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Locales {
|
|
2
|
+
locale: string
|
|
3
|
+
defaultLocale: string
|
|
4
|
+
hreflangOfLocale?: Record<string, string>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Languages extends Locales {
|
|
8
|
+
translations: Record<string, string>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Text a translated page shows in the post's own language (the title or body before it is translated) keeps that
|
|
13
|
+
* language, so screen readers pronounce it correctly and type set for Han text leaves it alone.
|
|
14
|
+
*/
|
|
15
|
+
export function sourceLanguageOf(text: string | undefined, { locale, defaultLocale, translations, hreflangOfLocale }: Languages) {
|
|
16
|
+
if (!text || locale === defaultLocale || translations[text]) return undefined
|
|
17
|
+
return hreflangOfLocale?.[defaultLocale] ?? defaultLocale
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The language of a post's body on a translated page: its source language while no `content.<locale>.mdx` sits beside
|
|
22
|
+
* the source (the key format of docs-shell/factories/create-page), otherwise the page's own.
|
|
23
|
+
*/
|
|
24
|
+
export function contentLanguageOf(sourcePath: string | undefined, translatedContent: Set<string>, { locale, defaultLocale, hreflangOfLocale }: Locales) {
|
|
25
|
+
if (locale === defaultLocale) return undefined
|
|
26
|
+
const directory = /^site\/content\/(.+)\/content\.mdx$/.exec(sourcePath ?? '')?.[1]
|
|
27
|
+
if (directory && translatedContent.has(`/content/${directory}/content.${locale}.mdx`)) return undefined
|
|
28
|
+
return hreflangOfLocale?.[defaultLocale] ?? defaultLocale
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface BlogArticleNeighbor {
|
|
2
|
+
title: string
|
|
3
|
+
description?: string
|
|
4
|
+
category?: string
|
|
5
|
+
date?: string
|
|
6
|
+
pathname: string
|
|
7
|
+
sourcePath?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Undated announcements lead the archive without inventing a publication date. */
|
|
11
|
+
export function compareBlogDates(a: { date?: string }, b: { date?: string }) {
|
|
12
|
+
if (!a.date || !b.date) return Number(Boolean(a.date)) - Number(Boolean(b.date))
|
|
13
|
+
return Date.parse(b.date) - Date.parse(a.date)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The posts beside one post, newest first as on the blog index. A post that is not listed (a draft)
|
|
18
|
+
* leads to the newest post.
|
|
19
|
+
*/
|
|
20
|
+
export function neighborsOf(sourcePath: string | undefined, categories: { pages: BlogArticleNeighbor[] }[]) {
|
|
21
|
+
const ordered = categories
|
|
22
|
+
.flatMap(({ pages }) => pages)
|
|
23
|
+
.sort(compareBlogDates)
|
|
24
|
+
const index = ordered.findIndex((post) => post.sourcePath === sourcePath)
|
|
25
|
+
if (index < 0) return { newer: undefined, older: ordered[0] }
|
|
26
|
+
return { newer: ordered[index - 1], older: ordered[index + 1] }
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { titleParts } from './title-parts'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string
|
|
6
|
+
class: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** The title, split at its colon into lines the stylesheet sets apart; see `titleParts`. */
|
|
10
|
+
const { title, class: className } = Astro.props
|
|
11
|
+
const parts = titleParts(title)
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
{parts ? <Fragment><span class={className}>{parts.first}</span>{parts.space ? ' ' : null}<span class={className}>{parts.second}</span></Fragment> : title}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A "Subject: question" title breaks at its colon, never inside a phrase: each half becomes a span the stylesheet
|
|
3
|
+
* sets on its own line(s). A full-width colon carries its own space, so none is added after it.
|
|
4
|
+
*/
|
|
5
|
+
export function titleParts(title: string) {
|
|
6
|
+
const match = /^(.+?[::])\s*(.+)$/.exec(title)
|
|
7
|
+
if (!match) return undefined
|
|
8
|
+
return { first: match[1], space: !match[1].endsWith(':'), second: match[2] }
|
|
9
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Component } from 'svelte'
|
|
2
|
+
|
|
3
|
+
export interface AppNavItem {
|
|
4
|
+
name: string
|
|
5
|
+
href?: string
|
|
6
|
+
fullName?: string
|
|
7
|
+
date?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
Icon?: Component<any>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SiteApp {
|
|
13
|
+
name: string
|
|
14
|
+
brandURL: string
|
|
15
|
+
Logotype: Component<any>
|
|
16
|
+
navs: AppNavItem[]
|
|
17
|
+
communityNavs?: AppNavItem[]
|
|
18
|
+
sourceBaseURL?: string
|
|
19
|
+
feedbackURL?: string
|
|
20
|
+
versions: { name: string, href: string }[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SiteI18nConfig {
|
|
24
|
+
defaultLocale: string
|
|
25
|
+
locales: readonly string[]
|
|
26
|
+
hreflangOfLocale: Record<string, string>
|
|
27
|
+
nameOfLocale: Record<string, string>
|
|
28
|
+
localizablePathnameRoots: string[]
|
|
29
|
+
translations: Record<string, Record<string, string>>
|
|
30
|
+
sectionLocales?: Record<string, readonly string[]>
|
|
31
|
+
/** These sections emit translated URLs only when translated MDX exists. */
|
|
32
|
+
translatedOnly?: readonly string[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DocumentConfig {
|
|
36
|
+
layout: URL
|
|
37
|
+
dictionaries: URL
|
|
38
|
+
categories?: URL
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Configuration contains module URLs, not imported page components, to preserve lazy routes. */
|
|
42
|
+
export interface SiteConfig {
|
|
43
|
+
id: string
|
|
44
|
+
name: string
|
|
45
|
+
origin: string
|
|
46
|
+
content: URL
|
|
47
|
+
app: URL
|
|
48
|
+
i18n: SiteI18nConfig
|
|
49
|
+
sections: Record<string, URL>
|
|
50
|
+
feeds?: { title: string, type: 'application/rss+xml' | 'application/atom+xml', href: string }[]
|
|
51
|
+
documents?: Record<string, DocumentConfig>
|
|
52
|
+
/** Server-only category sources, keyed by section. */
|
|
53
|
+
navigation?: Record<string, URL>
|
|
54
|
+
/** Server module exporting a highlighter. Product semantic integrations live here. */
|
|
55
|
+
highlighter?: URL
|
|
56
|
+
styles?: { site?: URL, interface?: URL, documents?: URL }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function defineSite(config: SiteConfig): SiteConfig {
|
|
60
|
+
if (!config.id || !config.name) throw new Error('Site id and name are required')
|
|
61
|
+
const origin = new URL(config.origin)
|
|
62
|
+
if (!['http:', 'https:'].includes(origin.protocol)) throw new Error('Site origin must use HTTP or HTTPS')
|
|
63
|
+
if (!config.i18n.locales.includes(config.i18n.defaultLocale)) throw new Error('The default locale must be listed in locales')
|
|
64
|
+
if (!config.sections.home) throw new Error('A homepage section is required')
|
|
65
|
+
return config
|
|
66
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { generatePresetCSS } from '@master/internal-site/css/generate-preset-css.ts'
|
|
3
|
+
import { getThemeNumericVariableEntries } from '@master/internal-site/css/theme-variables.ts'
|
|
4
|
+
import DemoViewport from '@master/internal-site/demo/DemoViewport.svelte'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
classes: string[]
|
|
8
|
+
responsive?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { classes, responsive = false } = Astro.props
|
|
12
|
+
const breakpoint = getThemeNumericVariableEntries('breakpoint').find(entry => entry.key === 'sm')
|
|
13
|
+
if (!breakpoint) throw new Error('Syntax Tutorial requires the preset sm breakpoint')
|
|
14
|
+
const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><style>
|
|
15
|
+
@layer theme, base, defaults, components, utilities;
|
|
16
|
+
@layer base { :root { color-scheme: light dark; } body { margin: 24px; font: 16px system-ui; } button { font: inherit; } }
|
|
17
|
+
${generatePresetCSS(classes)}
|
|
18
|
+
</style></head><body><button type="button" class="${classes.join(' ')}">Save</button></body></html>`
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<DemoViewport client:idle={{ timeout: 500 }} document={html} title="Responsive button padding" responsive={responsive} height={140}
|
|
22
|
+
widthPresets={responsive ? [{ label: 'Below sm', width: Math.floor(breakpoint.px) - 1 }, { label: 'At sm and above', width: Math.ceil(breakpoint.px) + 1 }] : undefined} />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Code from '@master/internal-site/components/Code.astro'
|
|
3
|
+
import GeneratedCSS from '@master/internal-site/components/GeneratedCSS.astro'
|
|
4
|
+
import { configuredExampleCSS, configuredExampleHTML, configuredMarkupClasses } from '@master/internal-site/css/configured-example.ts'
|
|
5
|
+
|
|
6
|
+
type Props = { source: string } & ({ html: string; classes?: never } | { classes: string[]; html?: never; element?: 'div' | 'button'; label?: string })
|
|
7
|
+
|
|
8
|
+
const props = Astro.props
|
|
9
|
+
const html = props.html ?? configuredExampleHTML(props.classes!, 'element' in props ? props.element : 'div', 'label' in props ? props.label : 'Example')
|
|
10
|
+
const classes = props.classes ?? configuredMarkupClasses(html)
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
{props.source && <Code lang="css" beautify code={props.source} />}
|
|
14
|
+
<Code lang="html" code={html} />
|
|
15
|
+
<GeneratedCSS><Code lang="css" beautify code={configuredExampleCSS(props.source, classes)} /></GeneratedCSS>
|