@master/internal-site 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/astro.d.mts +3 -0
- package/dist/astro.mjs +510 -0
- package/dist/config.d.mts +69 -0
- package/dist/config.mjs +10 -0
- package/package.json +384 -4
- package/src/astro/Page.astro +12 -0
- package/src/astro/content-pages.ts +75 -0
- package/src/astro/index.ts +124 -0
- package/src/astro/module-id.ts +4 -0
- package/src/astro/propagated-assets.ts +29 -0
- package/src/astro/route-paths.ts +78 -0
- package/src/astro/routes.template.ts +110 -0
- package/src/astro/server-styles.ts +26 -0
- package/src/astro/site-context.ts +27 -0
- package/src/astro/source-url.ts +22 -0
- package/src/astro/svelte-renderer.ts +45 -0
- package/src/astro/svg-markup.ts +23 -0
- package/src/benchmarks/BenchmarkBarRows.astro +34 -0
- package/src/benchmarks/BenchmarkBars.astro +14 -0
- package/src/benchmarks/BenchmarkChart.astro +53 -0
- package/src/benchmarks/BenchmarkChartGroup.astro +24 -0
- package/src/benchmarks/BenchmarkDataTable.astro +24 -0
- package/src/benchmarks/BenchmarkDelta.astro +23 -0
- package/src/benchmarks/BenchmarkFigure.astro +30 -0
- package/src/benchmarks/BenchmarkMetricTable.astro +38 -0
- package/src/benchmarks/BenchmarkMetrics.astro +23 -0
- package/src/benchmarks/BenchmarkSampleSummary.astro +30 -0
- package/src/benchmarks/BenchmarkScrollRegion.svelte +27 -0
- package/src/benchmarks/BenchmarkSource.astro +20 -0
- package/src/benchmarks/BenchmarkStackedBars.astro +54 -0
- package/src/benchmarks/BenchmarkStatus.astro +16 -0
- package/src/benchmarks/types.ts +98 -0
- package/src/benchmarks/utils.ts +42 -0
- package/src/blog/BlogAuthors.astro +25 -0
- package/src/blog/article/BlogArticleContents.svelte +24 -0
- package/src/blog/article/BlogArticleEnd.astro +55 -0
- package/src/blog/article/BlogArticleMasthead.astro +61 -0
- package/src/blog/article/language.ts +29 -0
- package/src/blog/article/neighbors.ts +27 -0
- package/src/blog/article/title-lines.astro +14 -0
- package/src/blog/article/title-parts.ts +9 -0
- package/src/components.d.ts +5 -0
- package/src/config.ts +68 -0
- package/src/css/ButtonPreview.astro +22 -0
- package/src/css/ConfiguredExample.astro +15 -0
- package/src/css/NamespaceUtilityTable.astro +50 -0
- package/src/css/StylesheetExample.astro +15 -0
- package/src/css/ThemeNumberVariableTable.astro +57 -0
- package/src/css/configured-example.ts +53 -0
- package/src/css/foundation-data/elevation/shadow-data.ts +52 -0
- package/src/css/foundation-data/sizing/scale-data.ts +37 -0
- package/src/css/foundation-data/specimen-content.ts +10 -0
- package/src/css/foundation-data/specimens.ts +96 -0
- package/src/css/foundation-data/tokens.ts +32 -0
- package/src/css/generate-preset-css.ts +12 -0
- package/src/css/highlight.ts +34 -0
- package/src/css/manifest-utilities.ts +29 -0
- package/src/css/markdown.ts +279 -0
- package/src/css/preset-css.ts +15 -0
- package/src/css/preset-manifest.ts +3 -0
- package/src/css/stylesheet-example.ts +26 -0
- package/src/css/theme-variables.ts +74 -0
- package/src/css/variable-namespace-sources.ts +20 -0
- package/src/demo/Demo.svelte +55 -0
- package/src/demo/DemoAsset.astro +38 -0
- package/src/demo/DemoAxes.svelte +22 -0
- package/src/demo/DemoBadge.svelte +18 -0
- package/src/demo/DemoCatalog.astro +36 -0
- package/src/demo/DemoComparison.svelte +36 -0
- package/src/demo/DemoConfiguredExample.astro +48 -0
- package/src/demo/DemoContainer.svelte +48 -0
- package/src/demo/DemoControls.svelte +16 -0
- package/src/demo/DemoCopyButton.svelte +50 -0
- package/src/demo/DemoCopyGroup.svelte +15 -0
- package/src/demo/DemoExample.astro +27 -0
- package/src/demo/DemoFeatureSupport.svelte +18 -0
- package/src/demo/DemoGeneratedCSS.svelte +8 -0
- package/src/demo/DemoIndex.astro +23 -0
- package/src/demo/DemoInstallation.astro +17 -0
- package/src/demo/DemoItem.svelte +17 -0
- package/src/demo/DemoLabel.svelte +15 -0
- package/src/demo/DemoLegend.svelte +15 -0
- package/src/demo/DemoMeasure.svelte +28 -0
- package/src/demo/DemoMedia.svelte +43 -0
- package/src/demo/DemoMotion.svelte +41 -0
- package/src/demo/DemoPageViewport.astro +17 -0
- package/src/demo/DemoPalette.astro +29 -0
- package/src/demo/DemoPaletteGroups.svelte +15 -0
- package/src/demo/DemoScrollArea.svelte +15 -0
- package/src/demo/DemoStyleComparison.astro +25 -0
- package/src/demo/DemoSurface.svelte +15 -0
- package/src/demo/DemoSwatch.svelte +19 -0
- package/src/demo/DemoThemeComparison.astro +30 -0
- package/src/demo/DemoTokenTable.astro +34 -0
- package/src/demo/DemoViewTransition.astro +18 -0
- package/src/demo/DemoViewport.svelte +324 -0
- package/src/demo/DemoWaterfall.astro +30 -0
- package/src/demo/FoundationBreakpoint.astro +12 -0
- package/src/demo/ProjectStyleExample.astro +13 -0
- package/src/demo/copy-feedback.ts +10 -0
- package/src/demo/demo-waterfall.ts +17 -0
- package/src/demo/drag-readings.ts +20 -0
- package/src/demo/foundations/FoundationAxes.astro +12 -0
- package/src/demo/foundations/FoundationColorRoles.astro +5 -0
- package/src/demo/foundations/FoundationContainerGrid.astro +24 -0
- package/src/demo/foundations/FoundationDialog.astro +14 -0
- package/src/demo/foundations/FoundationElevation.astro +5 -0
- package/src/demo/foundations/FoundationElevationState.astro +5 -0
- package/src/demo/foundations/FoundationHue.astro +5 -0
- package/src/demo/foundations/FoundationLines.astro +5 -0
- package/src/demo/foundations/FoundationMedia.astro +28 -0
- package/src/demo/foundations/FoundationMotion.astro +5 -0
- package/src/demo/foundations/FoundationPalette.astro +8 -0
- package/src/demo/foundations/FoundationRadius.astro +13 -0
- package/src/demo/foundations/FoundationShapes.astro +12 -0
- package/src/demo/foundations/FoundationShrink.astro +14 -0
- package/src/demo/foundations/FoundationSizing.astro +19 -0
- package/src/demo/foundations/FoundationSpecimen.astro +20 -0
- package/src/demo/foundations/FoundationSurfaces.astro +5 -0
- package/src/demo/foundations/FoundationTextHue.astro +5 -0
- package/src/demo/foundations/FoundationTextRoles.astro +5 -0
- package/src/demo/foundations/FoundationTokens.astro +22 -0
- package/src/demo/foundations/FoundationTokensView.astro +65 -0
- package/src/demo/foundations/FoundationTransition.astro +5 -0
- package/src/demo/foundations/FoundationTypeComparison.astro +12 -0
- package/src/demo/foundations/FoundationTypography.astro +5 -0
- package/src/demo/foundations/Palette.svelte +37 -0
- package/src/demo/foundations/ShadowScaleDemo.astro +22 -0
- package/src/demo/illustration-materials.ts +180 -0
- package/src/demo/maintenance-example.ts +62 -0
- package/src/demo/playback.ts +75 -0
- package/src/demo/project-style-examples.ts +128 -0
- package/src/demo/reference/alignment.ts +42 -0
- package/src/demo/reference/animations.ts +30 -0
- package/src/demo/reference/backgrounds.ts +39 -0
- package/src/demo/reference/border-paint.ts +31 -0
- package/src/demo/reference/clipping.ts +26 -0
- package/src/demo/reference/document.ts +55 -0
- package/src/demo/reference/edges.ts +40 -0
- package/src/demo/reference/effects.ts +27 -0
- package/src/demo/reference/flexbox.ts +33 -0
- package/src/demo/reference/frame.css +118 -0
- package/src/demo/reference/grid.ts +42 -0
- package/src/demo/reference/html.ts +40 -0
- package/src/demo/reference/interaction.ts +42 -0
- package/src/demo/reference/layout-html.ts +10 -0
- package/src/demo/reference/layout.ts +102 -0
- package/src/demo/reference/media.ts +29 -0
- package/src/demo/reference/positioning.ts +90 -0
- package/src/demo/reference/scenes.ts +197 -0
- package/src/demo/reference/scrolling.ts +66 -0
- package/src/demo/reference/shapes.ts +22 -0
- package/src/demo/reference/sizing.ts +43 -0
- package/src/demo/reference/source.ts +8 -0
- package/src/demo/reference/text-effects.ts +37 -0
- package/src/demo/reference/text-flow.ts +41 -0
- package/src/demo/reference/transforms.ts +26 -0
- package/src/demo/reference/transitions.ts +24 -0
- package/src/demo/reference/type-specimens.ts +56 -0
- package/src/demo/reference/types.ts +30 -0
- package/src/demo/reference/typography.ts +32 -0
- package/src/demo/specimens/accent-color.json +50 -0
- package/src/demo/specimens/align-items.json +56 -0
- package/src/demo/specimens/animation-delay.json +55 -0
- package/src/demo/specimens/animation-direction.json +49 -0
- package/src/demo/specimens/animation-fill-mode.json +55 -0
- package/src/demo/specimens/animation-iteration-count.json +55 -0
- package/src/demo/specimens/animation-play-state.json +83 -0
- package/src/demo/specimens/animation-timing-function.json +48 -0
- package/src/demo/specimens/appearance.json +44 -0
- package/src/demo/specimens/aspect-ratio.json +28 -0
- package/src/demo/specimens/backdrop-filter.json +44 -0
- package/src/demo/specimens/background-attachment.json +49 -0
- package/src/demo/specimens/background-image.json +25 -0
- package/src/demo/specimens/background-origin.json +36 -0
- package/src/demo/specimens/background-size.json +29 -0
- package/src/demo/specimens/border-collapse.json +45 -0
- package/src/demo/specimens/border-color.json +35 -0
- package/src/demo/specimens/border-image-repeat.json +50 -0
- package/src/demo/specimens/border-image-slice.json +45 -0
- package/src/demo/specimens/border-radius.json +30 -0
- package/src/demo/specimens/box-decoration-break.json +35 -0
- package/src/demo/specimens/box-shadow.json +33 -0
- package/src/demo/specimens/clear.json +77 -0
- package/src/demo/specimens/clip-path.json +38 -0
- package/src/demo/specimens/content.json +27 -0
- package/src/demo/specimens/counter-set.json +31 -0
- package/src/demo/specimens/fill.json +23 -0
- package/src/demo/specimens/filter.json +23 -0
- package/src/demo/specimens/flex-direction.json +27 -0
- package/src/demo/specimens/flex-grow.json +27 -0
- package/src/demo/specimens/font-style.json +23 -0
- package/src/demo/specimens/font-variant-numeric.json +28 -0
- package/src/demo/specimens/grid-auto-columns.json +29 -0
- package/src/demo/specimens/grid-auto-flow.json +37 -0
- package/src/demo/specimens/grid-template-areas.json +34 -0
- package/src/demo/specimens/grid-template-columns.json +36 -0
- package/src/demo/specimens/isolation.json +25 -0
- package/src/demo/specimens/justify-content.json +36 -0
- package/src/demo/specimens/line-height.json +28 -0
- package/src/demo/specimens/list-style-position.json +36 -0
- package/src/demo/specimens/mask-image.json +54 -0
- package/src/demo/specimens/min-width.json +39 -0
- package/src/demo/specimens/mix-blend-mode.json +43 -0
- package/src/demo/specimens/object-fit.json +27 -0
- package/src/demo/specimens/object-position.json +27 -0
- package/src/demo/specimens/opacity.json +37 -0
- package/src/demo/specimens/order.json +28 -0
- package/src/demo/specimens/overflow-wrap.json +26 -0
- package/src/demo/specimens/overflow.json +53 -0
- package/src/demo/specimens/overscroll-behavior.json +29 -0
- package/src/demo/specimens/padding.json +84 -0
- package/src/demo/specimens/place-content.json +31 -0
- package/src/demo/specimens/pointer-events.json +46 -0
- package/src/demo/specimens/position.json +29 -0
- package/src/demo/specimens/resize.json +32 -0
- package/src/demo/specimens/screen-readers.json +37 -0
- package/src/demo/specimens/scroll-padding.json +29 -0
- package/src/demo/specimens/scroll-snap-stop.json +33 -0
- package/src/demo/specimens/shape-image-threshold.json +37 -0
- package/src/demo/specimens/shape-margin.json +40 -0
- package/src/demo/specimens/shape-outside.json +37 -0
- package/src/demo/specimens/stroke-width.json +27 -0
- package/src/demo/specimens/text-fill-color.json +23 -0
- package/src/demo/specimens/text-stroke-width.json +32 -0
- package/src/demo/specimens/touch-action.json +45 -0
- package/src/demo/specimens/transform-box.json +37 -0
- package/src/demo/specimens/transform-origin.json +56 -0
- package/src/demo/specimens/transform-style.json +55 -0
- package/src/demo/specimens/transform.json +47 -0
- package/src/demo/specimens/transition-delay.json +57 -0
- package/src/demo/specimens/transition-duration.json +60 -0
- package/src/demo/specimens/transition-property.json +60 -0
- package/src/demo/specimens/transition-timing-function.json +65 -0
- package/src/demo/specimens/user-drag.json +28 -0
- package/src/demo/specimens/user-select.json +25 -0
- package/src/demo/specimens/vertical-align.json +28 -0
- package/src/demo/specimens/width.json +56 -0
- package/src/demo/specimens/will-change.json +50 -0
- package/src/demo/specimens/writing-mode.json +26 -0
- package/src/demo/specimens/z-index.json +35 -0
- package/src/demo/style.ts +15 -0
- package/src/demo/tone.ts +4 -0
- package/src/demo/useDemoViewTransition.svelte.ts +71 -0
- package/src/docs-shell/common/i18n.config.d.ts +2 -0
- package/src/docs-shell/common/i18n.config.js +13 -0
- package/src/docs-shell/common/svgo.config.d.ts +2 -0
- package/src/docs-shell/common/svgo.config.js +11 -0
- package/src/docs-shell/components/ArticleHeader.astro +65 -0
- package/src/docs-shell/components/ArticleTOC.astro +18 -0
- package/src/docs-shell/components/Callout.astro +26 -0
- package/src/docs-shell/components/Code.astro +25 -0
- package/src/docs-shell/components/CodeCopyButton.astro +25 -0
- package/src/docs-shell/components/CodeTabBar.astro +40 -0
- package/src/docs-shell/components/CodeTabs.astro +53 -0
- package/src/docs-shell/components/CodeView.astro +23 -0
- package/src/docs-shell/components/Do.astro +5 -0
- package/src/docs-shell/components/DoNot.astro +5 -0
- package/src/docs-shell/components/DocArticle.astro +14 -0
- package/src/docs-shell/components/DocHeader.svelte +93 -0
- package/src/docs-shell/components/DocHeading.astro +28 -0
- package/src/docs-shell/components/DocMain.astro +19 -0
- package/src/docs-shell/components/DocMenuButton.svelte +96 -0
- package/src/docs-shell/components/DocSidebar.svelte +62 -0
- package/src/docs-shell/components/DocVersionSelect.svelte +22 -0
- package/src/docs-shell/components/DocWrapper.astro +11 -0
- package/src/docs-shell/components/DocumentAPIIndex.astro +24 -0
- package/src/docs-shell/components/DocumentChoices.astro +24 -0
- package/src/docs-shell/components/DocumentCodeExample.astro +20 -0
- package/src/docs-shell/components/DocumentCodeExampleView.astro +35 -0
- package/src/docs-shell/components/DocumentCodeTable.astro +19 -0
- package/src/docs-shell/components/DocumentComparison.astro +7 -0
- package/src/docs-shell/components/DocumentCopyButton.svelte +41 -0
- package/src/docs-shell/components/DocumentDeclaration.astro +17 -0
- package/src/docs-shell/components/DocumentDeclarationView.astro +12 -0
- package/src/docs-shell/components/DocumentDisclosure.astro +14 -0
- package/src/docs-shell/components/DocumentFileTree.astro +34 -0
- package/src/docs-shell/components/DocumentFlow.astro +27 -0
- package/src/docs-shell/components/DocumentIdentifier.astro +14 -0
- package/src/docs-shell/components/DocumentIllustration.astro +46 -0
- package/src/docs-shell/components/DocumentKeyList.astro +22 -0
- package/src/docs-shell/components/DocumentNamespaceTable.astro +20 -0
- package/src/docs-shell/components/DocumentOptionEntry.astro +15 -0
- package/src/docs-shell/components/DocumentOptionList.astro +11 -0
- package/src/docs-shell/components/DocumentOptions.astro +23 -0
- package/src/docs-shell/components/DocumentParameters.astro +30 -0
- package/src/docs-shell/components/DocumentPrompt.astro +16 -0
- package/src/docs-shell/components/DocumentValueList.astro +25 -0
- package/src/docs-shell/components/DocumentationIndex.svelte +144 -0
- package/src/docs-shell/components/Dropped.astro +21 -0
- package/src/docs-shell/components/ExpandContent.svelte +21 -0
- package/src/docs-shell/components/ExplorerView.astro +37 -0
- package/src/docs-shell/components/FileIcon.astro +123 -0
- package/src/docs-shell/components/Footer.svelte +80 -0
- package/src/docs-shell/components/GeneratedCSS.astro +8 -0
- package/src/docs-shell/components/Header.svelte +121 -0
- package/src/docs-shell/components/HeaderIcon.astro +14 -0
- package/src/docs-shell/components/HeaderNav.svelte +20 -0
- package/src/docs-shell/components/Image.svelte +56 -0
- package/src/docs-shell/components/Info.astro +5 -0
- package/src/docs-shell/components/InlineCode.astro +30 -0
- package/src/docs-shell/components/InteractingIndicator.astro +19 -0
- package/src/docs-shell/components/LanguageButton.svelte +18 -0
- package/src/docs-shell/components/LanguageSelect.svelte +44 -0
- package/src/docs-shell/components/Link.svelte +127 -0
- package/src/docs-shell/components/ModeImg.astro +11 -0
- package/src/docs-shell/components/NotFound.astro +21 -0
- package/src/docs-shell/components/OverviewButtons.astro +36 -0
- package/src/docs-shell/components/PMAction.astro +25 -0
- package/src/docs-shell/components/PackageBadges.astro +39 -0
- package/src/docs-shell/components/PageContent.svelte +38 -0
- package/src/docs-shell/components/PageContentBootstrap.astro +13 -0
- package/src/docs-shell/components/PageContentDisclosure.astro +25 -0
- package/src/docs-shell/components/PageContentList.svelte +70 -0
- package/src/docs-shell/components/PageContentProvider.svelte +15 -0
- package/src/docs-shell/components/PageContentTitle.svelte +16 -0
- package/src/docs-shell/components/PageNavs.astro +40 -0
- package/src/docs-shell/components/PreparedCodeView.astro +12 -0
- package/src/docs-shell/components/RenderNode.astro +16 -0
- package/src/docs-shell/components/RouteLayers.astro +17 -0
- package/src/docs-shell/components/SearchButton.svelte +31 -0
- package/src/docs-shell/components/SearchDialog.svelte +174 -0
- package/src/docs-shell/components/Segments.svelte +62 -0
- package/src/docs-shell/components/Step.astro +13 -0
- package/src/docs-shell/components/StepL.astro +10 -0
- package/src/docs-shell/components/StepR.astro +10 -0
- package/src/docs-shell/components/StepSection.astro +12 -0
- package/src/docs-shell/components/Tab.astro +8 -0
- package/src/docs-shell/components/Tabs.astro +10 -0
- package/src/docs-shell/components/ThemeIcon.astro +19 -0
- package/src/docs-shell/components/ThemeSelect.svelte +20 -0
- package/src/docs-shell/components/TimeAgo.svelte +32 -0
- package/src/docs-shell/components/Translate.astro +14 -0
- package/src/docs-shell/components/Warn.astro +5 -0
- package/src/docs-shell/components/code-props.ts +28 -0
- package/src/docs-shell/components/document-types.ts +119 -0
- package/src/docs-shell/components/markdown/Anchor.astro +5 -0
- package/src/docs-shell/components/markdown/Heading2.astro +5 -0
- package/src/docs-shell/components/markdown/Heading3.astro +5 -0
- package/src/docs-shell/components/markdown/Table.astro +6 -0
- package/src/docs-shell/components/markdown-components.ts +36 -0
- package/src/docs-shell/components/page-content-bootstrap.ts +115 -0
- package/src/docs-shell/components/page-content.svelte.ts +125 -0
- package/src/docs-shell/contexts/search.ts +18 -0
- package/src/docs-shell/contexts/theme-mode.svelte.ts +61 -0
- package/src/docs-shell/data/authors.ts +17 -0
- package/src/docs-shell/data/base-colors.ts +29 -0
- package/src/docs-shell/data/brands.ts +79 -0
- package/src/docs-shell/data/color-names.ts +1 -0
- package/src/docs-shell/data/color-palette.ts +50 -0
- package/src/docs-shell/data/colors.ts +1 -0
- package/src/docs-shell/factories/Page.astro +35 -0
- package/src/docs-shell/factories/create-page.ts +31 -0
- package/src/docs-shell/layouts/BlogArticle.astro +53 -0
- package/src/docs-shell/layouts/Doc.astro +41 -0
- package/src/docs-shell/remark/markdown-components.d.ts +2 -0
- package/src/docs-shell/remark/markdown-components.js +101 -0
- package/src/docs-shell/remark/slug-and-toc.d.ts +2 -0
- package/src/docs-shell/remark/slug-and-toc.js +53 -0
- package/src/docs-shell/scripts/code-tabs-bootstrap.ts +34 -0
- package/src/docs-shell/scripts/code.ts +124 -0
- package/src/docs-shell/scripts/document-anchor.ts +57 -0
- package/src/docs-shell/scripts/document.ts +47 -0
- package/src/docs-shell/site.ts +67 -0
- package/src/docs-shell/types/IllustrationImages.ts +2 -0
- package/src/docs-shell/types/Metadata.ts +17 -0
- package/src/docs-shell/types/Props.ts +9 -0
- package/src/docs-shell/types/StaticImage.ts +6 -0
- package/src/docs-shell/uses/use-selected-preview-syntax.svelte.ts +16 -0
- package/src/docs-shell/utils/anchor.ts +24 -0
- package/src/docs-shell/utils/beautify-css.ts +14 -0
- package/src/docs-shell/utils/beautify-html.ts +12 -0
- package/src/docs-shell/utils/beautify-js.ts +9 -0
- package/src/docs-shell/utils/create-highlighter.ts +50 -0
- package/src/docs-shell/utils/css-modern-grammar.ts +339 -0
- package/src/docs-shell/utils/documentation-search.ts +68 -0
- package/src/docs-shell/utils/generate-metadata.ts +60 -0
- package/src/docs-shell/utils/group-page-content.ts +10 -0
- package/src/docs-shell/utils/head.ts +72 -0
- package/src/docs-shell/utils/highlight-code-core.ts +146 -0
- package/src/docs-shell/utils/highlight-code.ts +1 -0
- package/src/docs-shell/utils/highlighted-code-text.ts +27 -0
- package/src/docs-shell/utils/i18n-pathname.ts +98 -0
- package/src/docs-shell/utils/i18n.ts +12 -0
- package/src/docs-shell/utils/is-date-within-seven-days.ts +16 -0
- package/src/docs-shell/utils/isBrowser.ts +1 -0
- package/src/docs-shell/utils/isInteractOutside.ts +16 -0
- package/src/docs-shell/utils/markdown-tree.ts +22 -0
- package/src/docs-shell/utils/metadata.ts +25 -0
- package/src/docs-shell/utils/prepared-code.ts +21 -0
- package/src/docs-shell/utils/resolve-heading.d.ts +1 -0
- package/src/docs-shell/utils/resolve-heading.js +19 -0
- package/src/docs-shell/utils/search-pages.ts +271 -0
- package/src/docs-shell/utils/slot-text.ts +15 -0
- package/src/docs-shell/utils/snackbar.ts +39 -0
- package/src/docs-shell/utils/syntax-theme.ts +53 -0
- package/src/docs-shell/utils/transformer-notation-word-mark.ts +146 -0
- package/src/docs-shell/utils/unique-id.ts +11 -0
- package/src/examples/article-transitions/page.astro +7 -0
- package/src/examples/article-transitions/transitions.css +10 -0
- package/src/examples/components/ArticleTransitionScene.svelte +83 -0
- package/src/examples/components/ViewTransitionScene.svelte +31 -0
- package/src/examples/images/article-aurora.jpg +0 -0
- package/src/examples/images/article-coast.jpg +0 -0
- package/src/examples/images/article-grid.jpg +0 -0
- package/src/examples/images/article-studio.jpg +0 -0
- package/src/examples/layout-system/page.astro +59 -0
- package/src/examples/scene.css +3 -0
- package/src/examples/view-transitions/page.astro +7 -0
- package/src/examples/view-transitions/transitions.css +9 -0
- package/src/home/HeroCanvas.svelte +617 -0
- package/src/home/HomeAction.astro +17 -0
- package/src/home/HomeBentoFrame.astro +9 -0
- package/src/home/HomeBentoGrid.astro +9 -0
- package/src/home/HomeCompactIcon.astro +15 -0
- package/src/home/HomeFooter.svelte +63 -0
- package/src/home/HomeIllustration.astro +17 -0
- package/src/home/HomeIllustrationArt.svelte +15 -0
- package/src/home/HomeLamp.svelte +18 -0
- package/src/home/design.css +532 -0
- package/src/home/footer.css +225 -0
- package/src/home/hero-shaders.ts +460 -0
- package/src/home/hero-title-mask.ts +175 -0
- package/src/home/hero.css +547 -0
- package/src/home/home-illustration.ts +5 -0
- package/src/home/home-lamp.ts +225 -0
- package/src/home/home.css +1081 -0
- package/src/home/icons/agent-check-preview-apply.svg +24 -0
- package/src/home/icons/agent-clients.svg +26 -0
- package/src/home/icons/agent-project-tools.svg +23 -0
- package/src/home/icons/artwork/agent-check-preview-apply-dark.webp +0 -0
- package/src/home/icons/artwork/agent-check-preview-apply-light.webp +0 -0
- package/src/home/icons/artwork/agent-clients-dark.webp +0 -0
- package/src/home/icons/artwork/agent-clients-light.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-dark.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-light.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-dark.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-light.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-dark.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-light.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-dark.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-light.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-dark.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-dark.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-light.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-dark.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-light.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-dark.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-light.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-dark.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-light.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-dark.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-light.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-dark.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-light.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-dark.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-light.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-light.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-light.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-light.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-light.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-light.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-light.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-light.webp +0 -0
- package/src/home/icons/artwork/render-progressive-dark.webp +0 -0
- package/src/home/icons/artwork/render-progressive-light.webp +0 -0
- package/src/home/icons/artwork/render-runtime-dark.webp +0 -0
- package/src/home/icons/artwork/render-runtime-light.webp +0 -0
- package/src/home/icons/artwork/render-static-dark.webp +0 -0
- package/src/home/icons/artwork/render-static-light.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-dark.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-light.webp +0 -0
- package/src/home/icons/artwork/section-css-size-dark.webp +0 -0
- package/src/home/icons/artwork/section-css-size-light.webp +0 -0
- package/src/home/icons/artwork/section-design-system-dark.webp +0 -0
- package/src/home/icons/artwork/section-design-system-light.webp +0 -0
- package/src/home/icons/artwork/section-editor-dark.webp +0 -0
- package/src/home/icons/artwork/section-editor-light.webp +0 -0
- package/src/home/icons/artwork/section-lint-dark.webp +0 -0
- package/src/home/icons/artwork/section-lint-light.webp +0 -0
- package/src/home/icons/artwork/section-rendering-dark.webp +0 -0
- package/src/home/icons/artwork/section-rendering-light.webp +0 -0
- package/src/home/icons/artwork/section-workflow-dark.webp +0 -0
- package/src/home/icons/artwork/section-workflow-light.webp +0 -0
- package/src/home/icons/artwork/source.json +303 -0
- package/src/home/icons/artwork/workflow-integrations-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-integrations-light.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-light.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-light.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-light.webp +0 -0
- package/src/home/icons/artwork.css +4 -0
- package/src/home/icons/artwork.ts +131 -0
- package/src/home/icons/catalog.ts +381 -0
- package/src/home/icons/design-cascade-layers.svg +32 -0
- package/src/home/icons/design-layout-motion.svg +16 -0
- package/src/home/icons/design-p3-gamut.svg +12 -0
- package/src/home/icons/design-theme-modes.svg +12 -0
- package/src/home/icons/design-theme-tokens.svg +20 -0
- package/src/home/icons/editor-color-tools.svg +18 -0
- package/src/home/icons/editor-focused-highlighting.svg +15 -0
- package/src/home/icons/editor-hover-inspection.svg +19 -0
- package/src/home/icons/editor-manifest-completions.svg +24 -0
- package/src/home/icons/lint-class-order-compact.svg +15 -0
- package/src/home/icons/lint-class-order.svg +28 -0
- package/src/home/icons/lint-conflicting-classes-compact.svg +11 -0
- package/src/home/icons/lint-conflicting-classes.svg +24 -0
- package/src/home/icons/lint-fix-previews-compact.svg +9 -0
- package/src/home/icons/lint-fix-previews.svg +19 -0
- package/src/home/icons/lint-invalid-classes-compact.svg +7 -0
- package/src/home/icons/lint-invalid-classes.svg +17 -0
- package/src/home/icons/lint-strict-vocabulary-compact.svg +8 -0
- package/src/home/icons/lint-strict-vocabulary.svg +16 -0
- package/src/home/icons/lint-theme-tokens-compact.svg +7 -0
- package/src/home/icons/lint-theme-tokens.svg +14 -0
- package/src/home/icons/mcp-apply-preview-compact.svg +9 -0
- package/src/home/icons/mcp-apply-preview.svg +18 -0
- package/src/home/icons/mcp-css-compare-compact.svg +9 -0
- package/src/home/icons/mcp-css-compare.svg +20 -0
- package/src/home/icons/mcp-inspect-class-compact.svg +9 -0
- package/src/home/icons/mcp-inspect-class.svg +18 -0
- package/src/home/icons/mcp-lint-project-compact.svg +14 -0
- package/src/home/icons/mcp-lint-project.svg +30 -0
- package/src/home/icons/mcp-manifest-query-compact.svg +14 -0
- package/src/home/icons/mcp-manifest-query.svg +27 -0
- package/src/home/icons/mcp-preview-fixes-compact.svg +9 -0
- package/src/home/icons/mcp-preview-fixes.svg +15 -0
- package/src/home/icons/mcp-render-css-compact.svg +13 -0
- package/src/home/icons/mcp-render-css.svg +30 -0
- package/src/home/icons/mcp-scan-project-compact.svg +7 -0
- package/src/home/icons/mcp-scan-project.svg +13 -0
- package/src/home/icons/mcp-trace-class-compact.svg +11 -0
- package/src/home/icons/mcp-trace-class.svg +24 -0
- package/src/home/icons/render-progressive.svg +17 -0
- package/src/home/icons/render-runtime.svg +23 -0
- package/src/home/icons/render-static.svg +29 -0
- package/src/home/icons/section-ai-agents.svg +24 -0
- package/src/home/icons/section-css-size.svg +13 -0
- package/src/home/icons/section-design-system.svg +24 -0
- package/src/home/icons/section-editor.svg +14 -0
- package/src/home/icons/section-lint.svg +14 -0
- package/src/home/icons/section-rendering.svg +30 -0
- package/src/home/icons/section-workflow.svg +22 -0
- package/src/home/icons/workflow-integrations.svg +15 -0
- package/src/home/icons/workflow-monorepo.svg +27 -0
- package/src/home/icons/workflow-route-styles.svg +24 -0
- package/src/home/icons/workflow-trace-change.svg +21 -0
- package/src/layouts/Document.astro +71 -0
- package/src/public/brand/v2/logo/mark/master-mark-small-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-light.svg +1 -0
- package/src/public/demo/border-grid.svg +7 -0
- package/src/public/demo/landscape.svg +1 -0
- package/src/public/demo/marker.svg +1 -0
- package/src/public/demo/mask.svg +1 -0
- package/src/public/fonts/Geist-Medium.ttf +0 -0
- package/src/public/fonts/Geist-Regular.ttf +0 -0
- package/src/public/fonts/GeistVariable.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Bold.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Medium.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Regular.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-SemiBold.woff2 +0 -0
- package/src/public/fonts/index.css +40 -0
- package/src/public/icons/csharp.svg +1 -0
- package/src/public/icons/css.svg +1 -0
- package/src/public/icons/eslint.svg +1 -0
- package/src/public/icons/folder.svg +12 -0
- package/src/public/icons/html.svg +1 -0
- package/src/public/icons/php.svg +1 -0
- package/src/public/icons/sass.svg +1 -0
- package/src/public/icons/storybook.svg +1 -0
- package/src/public/icons/visualstudiocode.svg +41 -0
- package/src/public/images/authors/aron.jpg +0 -0
- package/src/public/images/authors/benseage.jpg +0 -0
- package/src/public/images/authors/joy.jpg +0 -0
- package/src/public/images/authors/lola.jpg +0 -0
- package/src/public/images/authors/miles.jpg +0 -0
- package/src/public/images/bootstrap.svg +23 -0
- package/src/public/images/build-tools/rsbuild.svg +1 -0
- package/src/public/images/build-tools/rspack.svg +1 -0
- package/src/public/images/build-tools/vite.svg +15 -0
- package/src/public/images/build-tools/webpack.svg +10 -0
- package/src/public/images/cdns/esm-sh.svg +1 -0
- package/src/public/images/chevron-left.svg +4 -0
- package/src/public/images/cover-bg.jpg +0 -0
- package/src/public/images/emotion.svg +1 -0
- package/src/public/images/frameworks/angular.svg +29 -0
- package/src/public/images/frameworks/astro.svg +4 -0
- package/src/public/images/frameworks/blazor.svg +22 -0
- package/src/public/images/frameworks/express.svg +1 -0
- package/src/public/images/frameworks/laravel.svg +8 -0
- package/src/public/images/frameworks/line-liff.svg +1 -0
- package/src/public/images/frameworks/lit.svg +1 -0
- package/src/public/images/frameworks/nextjs.svg +16 -0
- package/src/public/images/frameworks/nuxtjs.svg +3 -0
- package/src/public/images/frameworks/rails.svg +1 -0
- package/src/public/images/frameworks/react.svg +8 -0
- package/src/public/images/frameworks/remix.svg +5 -0
- package/src/public/images/frameworks/shopify.svg +1 -0
- package/src/public/images/frameworks/svelte.svg +6 -0
- package/src/public/images/frameworks/tanstack.svg +1 -0
- package/src/public/images/frameworks/vuejs.svg +11 -0
- package/src/public/images/frameworks/wordpress.svg +1 -0
- package/src/public/images/mui.svg +1 -0
- package/src/public/images/styled-components.svg +4 -0
- package/src/public/images/tailwindcss.svg +1 -0
- package/src/scripts/bundler-imports.ts +25 -0
- package/src/scripts/static-social.ts +333 -0
- package/src/scripts/write-if-changed.ts +26 -0
- package/src/sections/blog.astro +11 -0
- package/src/sections/design-system.astro +14 -0
- package/src/sections/document.astro +8 -0
- package/src/sections/examples.astro +6 -0
- package/src/sections/guide.astro +26 -0
- package/src/sections/home.astro +7 -0
- package/src/sections/page.astro +12 -0
- package/src/styles/base.css +57 -0
- package/src/styles/benchmarks.css +20 -0
- package/src/styles/blog-article.css +670 -0
- package/src/styles/blog-materials.css +399 -0
- package/src/styles/blog.css +568 -0
- package/src/styles/demo.css +30 -0
- package/src/styles/design-system.css +15 -0
- package/src/styles/docs-shell/code.css +61 -0
- package/src/styles/docs-shell/docs.css +79 -0
- package/src/styles/docs-shell/documentation-search.css +42 -0
- package/src/styles/docs-shell/footer.css +38 -0
- package/src/styles/docs-shell/header.css +73 -0
- package/src/styles/docs-shell/materials.css +25 -0
- package/src/styles/docs-shell/menu.css +19 -0
- package/src/styles/docs-shell/not-found.css +10 -0
- package/src/styles/docs-shell/page-content.css +37 -0
- package/src/styles/docs-shell/prose.css +89 -0
- package/src/styles/docs-shell/segments.css +13 -0
- package/src/styles/docs-shell/steps.css +39 -0
- package/src/styles/docs-shell/syntax-theme.css +18 -0
- package/src/styles/docs-shell/theme.css +68 -0
- package/src/styles/docs-shell/wrapper.css +10 -0
- package/src/styles/document-comparison.css +7 -0
- package/src/styles/documentation-illustration.css +34 -0
- package/src/styles/documentation-index.css +100 -0
- package/src/styles/documents.css +4 -0
- package/src/styles/documents.ts +2 -0
- package/src/styles/foundation.css +4 -0
- package/src/styles/globals.css +2 -0
- package/src/styles/interface.css +3 -0
- package/src/styles/interface.ts +2 -0
- package/src/styles/site.ts +2 -0
- package/src/styles/system/DESIGN.md +108 -0
- package/src/styles/system/buttons.css +51 -0
- package/src/styles/system/code.css +85 -0
- package/src/styles/system/controls.css +110 -0
- package/src/styles/system/data.css +134 -0
- package/src/styles/system/mixins.css +7 -0
- package/src/styles/system/prose.css +75 -0
- package/src/styles/system/shell.css +102 -0
- package/src/styles/system/specimens.css +98 -0
- package/src/styles/system/surfaces.css +104 -0
- package/src/styles/system/tokens.css +136 -0
- package/src/utils/cloudflare-image-loader.js +85 -0
- package/src/virtual.d.ts +36 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import tailwindcss from '../../public/images/tailwindcss.svg'
|
|
2
|
+
import bootstrap from '../../public/images/bootstrap.svg'
|
|
3
|
+
import mui from '../../public/images/mui.svg'
|
|
4
|
+
import styledComponents from '../../public/images/styled-components.svg'
|
|
5
|
+
import emotion from '../../public/images/emotion.svg'
|
|
6
|
+
import cssIcon from '../../public/icons/css.svg'
|
|
7
|
+
import sass from '../../public/icons/sass.svg'
|
|
8
|
+
import nextjs from '../../public/images/frameworks/nextjs.svg'
|
|
9
|
+
import svelte from '../../public/images/frameworks/svelte.svg'
|
|
10
|
+
import nuxtjs from '../../public/images/frameworks/nuxtjs.svg'
|
|
11
|
+
import laravel from '../../public/images/frameworks/laravel.svg'
|
|
12
|
+
import wordpress from '../../public/images/frameworks/wordpress.svg'
|
|
13
|
+
import php from '../../public/icons/php.svg'
|
|
14
|
+
import shopify from '../../public/images/frameworks/shopify.svg'
|
|
15
|
+
import aspnetCore from '../../public/icons/csharp.svg'
|
|
16
|
+
import express from '../../public/images/frameworks/express.svg'
|
|
17
|
+
import rails from '../../public/images/frameworks/rails.svg'
|
|
18
|
+
import lineLiff from '../../public/images/frameworks/line-liff.svg'
|
|
19
|
+
import astro from '../../public/images/frameworks/astro.svg'
|
|
20
|
+
import remix from '../../public/images/frameworks/remix.svg'
|
|
21
|
+
import blazor from '../../public/images/frameworks/blazor.svg'
|
|
22
|
+
import react from '../../public/images/frameworks/react.svg'
|
|
23
|
+
import lit from '../../public/images/frameworks/lit.svg'
|
|
24
|
+
import vuejs from '../../public/images/frameworks/vuejs.svg'
|
|
25
|
+
import angular from '../../public/images/frameworks/angular.svg'
|
|
26
|
+
import eslint from '../../public/icons/eslint.svg'
|
|
27
|
+
import storybook from '../../public/icons/storybook.svg'
|
|
28
|
+
import vite from '../../public/images/build-tools/vite.svg'
|
|
29
|
+
import webpack from '../../public/images/build-tools/webpack.svg'
|
|
30
|
+
import rspack from '../../public/images/build-tools/rspack.svg'
|
|
31
|
+
import rsbuild from '../../public/images/build-tools/rsbuild.svg'
|
|
32
|
+
import tanstack from '../../public/images/frameworks/tanstack.svg'
|
|
33
|
+
import esmSh from '../../public/images/cdns/esm-sh.svg'
|
|
34
|
+
import html from '../../public/icons/html.svg'
|
|
35
|
+
import vscode from '../../public/icons/visualstudiocode.svg'
|
|
36
|
+
import logo from '../../public/brand/v2/logo/mark/master-mark-small-on-dark.svg'
|
|
37
|
+
|
|
38
|
+
const brands = {
|
|
39
|
+
tailwindcss: { name: 'Tailwind CSS', src: tailwindcss, path: 'tailwindcss', color: 'cyan', className: '(transform:scale(.85))' },
|
|
40
|
+
bootstrap: { name: 'Bootstrap', src: bootstrap, color: 'purple', disabled: true, className: '(transform:scale(.85))' },
|
|
41
|
+
mui: { name: 'Material UI', src: mui, color: 'sky' },
|
|
42
|
+
'styled-components': { name: 'Styled Components', src: styledComponents, path: 'styled-components', className: '(transform:scale(.9))' },
|
|
43
|
+
emotion: { name: 'Emotion', src: emotion, path: 'emotion', className: '(transform:scale(.9))', disabled: true },
|
|
44
|
+
css: { name: 'CSS', src: cssIcon, className: '(transform:scale(.9))', disabled: true },
|
|
45
|
+
eslint: { name: 'ESLint', src: eslint, className: '(transform:scale(.9))', disabled: true },
|
|
46
|
+
sass: { name: 'Sass', src: sass, className: '(transform:scale(.9))', disabled: true },
|
|
47
|
+
nextjs: { name: 'Next.js', src: nextjs, className: '(transform:scale(1.3)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)', path: 'nextjs', color: 'gray' },
|
|
48
|
+
svelte: { name: 'Svelte', src: svelte, className: '(transform:scale(.85))', color: 'orange' },
|
|
49
|
+
nuxtjs: { name: 'Nuxt.js', src: nuxtjs, className: '(transform:scale(1.15))', path: 'nuxtjs', color: 'beryl' },
|
|
50
|
+
laravel: { name: 'Laravel', src: laravel, className: '(transform:scale(.8))' },
|
|
51
|
+
wordpress: { name: 'WordPress', src: wordpress, className: '(transform:scale(.85))', path: 'wordpress', color: 'blue' },
|
|
52
|
+
php: { name: 'PHP', src: php, className: '(transform:scale(.9))', path: 'php', color: 'purple' },
|
|
53
|
+
shopify: { name: 'Shopify', src: shopify, className: '(transform:scale(.9))', path: 'shopify', color: 'green' },
|
|
54
|
+
'aspnet-core': { name: 'ASP.NET Core', src: aspnetCore, className: '(transform:scale(.9))', path: 'aspnet-core', color: 'sky' },
|
|
55
|
+
express: { name: 'Express', src: express, className: '(transform:scale(.9))', path: 'express', color: 'gray' },
|
|
56
|
+
rails: { name: 'Rails', src: rails, className: '(transform:scale(.85))', path: 'rails', color: 'red' },
|
|
57
|
+
'line-liff': { name: 'LINE LIFF', src: lineLiff, className: '(transform:scale(.85))', path: 'line-liff', color: 'green' },
|
|
58
|
+
astro: { name: 'Astro', src: astro, className: '(transform:scale(.9)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)' },
|
|
59
|
+
remix: { name: 'Remix', src: remix, className: '(transform:scale(1.2)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)', disabled: true },
|
|
60
|
+
'react-router': { name: 'React Router', src: remix, className: '(transform:scale(1.2)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)', path: 'react-router' },
|
|
61
|
+
blazor: { name: 'Blazor', src: blazor, className: '(transform:scale(1.05))' },
|
|
62
|
+
react: { name: 'React', src: react, className: '(transform:scale(.85))', color: 'cyan' },
|
|
63
|
+
lit: { name: 'Lit', src: lit, className: '(transform:scale(.85))', color: 'cyan' },
|
|
64
|
+
vuejs: { name: 'Vue.js', src: vuejs, className: '(transform:scale(.85))', path: 'vuejs', color: 'green' },
|
|
65
|
+
angular: { name: 'Angular', src: angular, className: '(transform:scale(.85))', color: 'pink' },
|
|
66
|
+
vite: { name: 'Vite', src: vite, className: '(transform:scale(.85))' },
|
|
67
|
+
webpack: { name: 'Webpack', src: webpack, className: '(transform:scale(.9))' },
|
|
68
|
+
rspack: { name: 'Rspack', src: rspack, className: '(transform:scale(.85))' },
|
|
69
|
+
rsbuild: { name: 'Rsbuild', src: rsbuild, className: '(transform:scale(.85))' },
|
|
70
|
+
'tanstack-start': { name: 'TanStack Start', src: tanstack, path: 'tanstack-start', className: '(transform:scale(.85)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)' },
|
|
71
|
+
storybook: { name: 'Storybook', src: storybook, className: '(transform:scale(.85))', path: 'storybook', color: 'pink' },
|
|
72
|
+
'esm-sh': { name: 'esm.sh', src: esmSh, className: '(transform:scale(.8)) (filter:invert(1))@apply(--site-dark)', headerClassName: '(filter:invert(1))@apply(--site-dark)', path: 'esm-sh' },
|
|
73
|
+
html: { name: 'HTML', src: html, path: 'html' },
|
|
74
|
+
vscode: { name: 'Visual Studio Code', src: vscode, className: '(transform:scale(.8))', path: 'vscode' },
|
|
75
|
+
v1: { name: 'v1.0', src: logo, path: 'v1', className: '(transform:scale(.85))' },
|
|
76
|
+
mastercss: { name: 'Master CSS', src: logo, color: 'yellow' },
|
|
77
|
+
} as Record<string, { name: string; src: any; path?: string; className?: string; headerClassName?: string; disabled?: boolean; color?: string }>
|
|
78
|
+
|
|
79
|
+
export default brands
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { colorNames as default } from './color-palette'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
flattenMasterCSSManifestVariables,
|
|
3
|
+
type MasterCSSManifest
|
|
4
|
+
} from '@master/css-schema/manifest'
|
|
5
|
+
import defaultManifestJSON from '@master/css-preset/default-manifest.json' with { type: 'json' }
|
|
6
|
+
import Color from 'colorjs.io'
|
|
7
|
+
|
|
8
|
+
const defaultManifest = defaultManifestJSON as unknown as MasterCSSManifest
|
|
9
|
+
|
|
10
|
+
export const COLOR_LEVELS = [0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100] as const
|
|
11
|
+
|
|
12
|
+
export type ColorLevel = typeof COLOR_LEVELS[number]
|
|
13
|
+
export type ColorPalette = Record<string, Partial<Record<ColorLevel, string>>>
|
|
14
|
+
|
|
15
|
+
const colorLevelSet = new Set<number>(COLOR_LEVELS)
|
|
16
|
+
|
|
17
|
+
const palette = flattenMasterCSSManifestVariables(defaultManifest.variables).reduce<ColorPalette>((palette, variable) => {
|
|
18
|
+
if (!variable.name || variable.namespace !== 'color' || variable.values.length !== 1 || typeof variable.values[0]?.value !== 'string') return palette
|
|
19
|
+
|
|
20
|
+
const match = variable.name.match(/^color-(.+)-(\d+)$/)
|
|
21
|
+
if (!match) return palette
|
|
22
|
+
|
|
23
|
+
const [, colorName, levelText] = match
|
|
24
|
+
const level = Number(levelText)
|
|
25
|
+
if (!colorLevelSet.has(level)) return palette
|
|
26
|
+
|
|
27
|
+
palette[colorName] ??= {}
|
|
28
|
+
palette[colorName][level as ColorLevel] = variable.values[0].value
|
|
29
|
+
return palette
|
|
30
|
+
}, {})
|
|
31
|
+
|
|
32
|
+
export const colorNames = Object.keys(palette)
|
|
33
|
+
|
|
34
|
+
export const colors = colorNames.flatMap((colorName) =>
|
|
35
|
+
COLOR_LEVELS
|
|
36
|
+
.filter((level) => palette[colorName][level])
|
|
37
|
+
.map((level) => `${colorName}-${level}`)
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
export function getColor(colorName: string, level: ColorLevel) {
|
|
41
|
+
const color = palette[colorName]?.[level]
|
|
42
|
+
if (!color) throw new Error(`Unknown preset color token: color-${colorName}-${level}`)
|
|
43
|
+
return color
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getColorHex(colorName: string, level: ColorLevel) {
|
|
47
|
+
return new Color(getColor(colorName, level)).to('srgb').toString({ format: 'hex' }).replace(/^#/, '')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default palette
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { colors as default } from './color-palette'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
|
|
3
|
+
import type { PageParams } from '../types/Props'
|
|
4
|
+
import { resolveContent, type ContentModule } from './create-page'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
params: PageParams
|
|
8
|
+
metadata: any
|
|
9
|
+
dictionaries: Record<string, () => Promise<any>>
|
|
10
|
+
categories?: any
|
|
11
|
+
/** The page's MDX module; its translation replaces it in other locales. Pages without MDX pass content as children. */
|
|
12
|
+
content?: ContentModule
|
|
13
|
+
Layout?: AstroComponentFactory
|
|
14
|
+
noTOC?: boolean
|
|
15
|
+
subtitle?: string
|
|
16
|
+
/** Further layout props, such as `categoryLink` or a header `icon`. */
|
|
17
|
+
[key: string]: any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { params, metadata, dictionaries, categories, content, Layout, noTOC = false, subtitle, ...options } = Astro.props
|
|
21
|
+
const contentModule = content ? await resolveContent(params.locale, metadata, content) : undefined
|
|
22
|
+
if (contentModule && !contentModule.default) throw new Error('Invalid content module')
|
|
23
|
+
const Content = contentModule?.default
|
|
24
|
+
const toc = contentModule?.toc
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
{Layout
|
|
28
|
+
? <Layout {...options} params={params} pageCategories={categories} dictionaries={dictionaries} metadata={metadata} toc={noTOC ? null : toc} subtitle={subtitle}>
|
|
29
|
+
{Content && <Content pageCategories={categories} />}
|
|
30
|
+
<slot />
|
|
31
|
+
</Layout>
|
|
32
|
+
: <Fragment>
|
|
33
|
+
{Content && <Content pageCategories={categories} />}
|
|
34
|
+
<slot />
|
|
35
|
+
</Fragment>}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
|
|
2
|
+
import type { Props } from '../types/Props'
|
|
3
|
+
import generate from '../utils/generate-metadata'
|
|
4
|
+
|
|
5
|
+
export interface ContentModule {
|
|
6
|
+
default: AstroComponentFactory
|
|
7
|
+
toc?: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Translated MDX lives beside its source as `content.<locale>.mdx`. */
|
|
11
|
+
import translatedContent from 'virtual:master-site/translations'
|
|
12
|
+
|
|
13
|
+
/** `generateMetadata` for a page rendered by `factories/Page.astro`. */
|
|
14
|
+
export function createPageMetadata(metadata: any, dictionaries: Record<string, () => Promise<any>>) {
|
|
15
|
+
return (props: Pick<Props, 'params'>) => generate(metadata, props, dictionaries)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The page's MDX in the requested locale. Import the source statically (`import * as content from './content.mdx'`):
|
|
20
|
+
* Astro collects a page's stylesheets from its module graph when the page module loads, before a pending dynamic import finishes in dev.
|
|
21
|
+
*/
|
|
22
|
+
export async function resolveContent(locale: string, metadata: any, content: ContentModule) {
|
|
23
|
+
const directory = contentDirectoryOf(metadata)
|
|
24
|
+
return (directory ? await translatedContent[`/content/${directory}/content.${locale}.mdx`]?.() : undefined) ?? content
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function contentDirectoryOf(metadata: any) {
|
|
28
|
+
const sourcePath = metadata?.sourcePath
|
|
29
|
+
if (typeof sourcePath !== 'string') return
|
|
30
|
+
return sourcePath.match(/^site\/content\/(.+)\/content\.mdx$/)?.[1]
|
|
31
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '@master/internal-site/styles/docs-shell/prose.css'
|
|
3
|
+
import '@master/internal-site/styles/blog-materials.css'
|
|
4
|
+
import '@master/internal-site/styles/blog-article.css'
|
|
5
|
+
import translations from 'virtual:master-site/translations'
|
|
6
|
+
import Footer from '@master/internal-site/components/Footer.svelte'
|
|
7
|
+
import PageContentBootstrap from '@master/internal-site/components/PageContentBootstrap.astro'
|
|
8
|
+
import { siteOf } from '@master/internal-site/astro/site-context'
|
|
9
|
+
import BlogArticleMasthead from '@master/internal-site/blog/article/BlogArticleMasthead.astro'
|
|
10
|
+
import BlogArticleContents from '@master/internal-site/blog/article/BlogArticleContents.svelte'
|
|
11
|
+
import BlogArticleEnd from '@master/internal-site/blog/article/BlogArticleEnd.astro'
|
|
12
|
+
import { neighborsOf } from '@master/internal-site/blog/article/neighbors'
|
|
13
|
+
import { contentLanguageOf } from '@master/internal-site/blog/article/language'
|
|
14
|
+
|
|
15
|
+
/** Translated MDX lives beside its source as `content.<locale>.mdx` (see docs-shell/factories/create-page). */
|
|
16
|
+
const translatedContent = new Set(Object.keys(translations))
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A blog post, drawn with the homepage's drafting guides: the header, the reading column (the documentation's measure
|
|
20
|
+
* and typography, `styles/docs-shell/prose`) and the next read are sections of one framed drawing, each opened by a
|
|
21
|
+
* rule crossed at the rails, the rulers restarting there. The contents ruler stands outside the frame, in the page's
|
|
22
|
+
* left margin.
|
|
23
|
+
*/
|
|
24
|
+
const { metadata, toc, pageCategories: posts = [], footerProps = {} } = Astro.props
|
|
25
|
+
const { t: $, i18n, locale } = siteOf(Astro)
|
|
26
|
+
const { defaultLocale, hreflangOfLocale } = i18n
|
|
27
|
+
const { newer, older } = neighborsOf(metadata.sourcePath, posts)
|
|
28
|
+
// A post not yet translated is shown in its own language; the body says so, for screen readers and Han type rules.
|
|
29
|
+
const proseLanguage = contentLanguageOf(metadata.sourcePath, translatedContent, { locale, defaultLocale, hreflangOfLocale })
|
|
30
|
+
const contents = (toc ?? []).filter((item: any) => item.level === 2 || item.level === 3).map(({ id, title, level }: any) => ({ id, title, level }))
|
|
31
|
+
const hasSections = contents.some((item: any) => item.level === 2)
|
|
32
|
+
// As on the blog index, a category every post shares says nothing about the next one.
|
|
33
|
+
const showCategory = posts.length > 1
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<div class="blog-article-page blog-materials">
|
|
37
|
+
<main class="blog-article-main">
|
|
38
|
+
<article class="blog-article">
|
|
39
|
+
{/* The post's own header, so the title, date and authors belong to the article. */}
|
|
40
|
+
<BlogArticleMasthead metadata={metadata} />
|
|
41
|
+
{/* In the page's outer left margin, beside the text it lists. */}
|
|
42
|
+
{hasSections ? <BlogArticleContents client:idle={{ timeout: 500 }} items={contents} label={$('On this page')} lang={proseLanguage} /> : null}
|
|
43
|
+
<div class="blog-article-body blog-rails blog-rails-rule">
|
|
44
|
+
<div class="blog-article-prose ui-prose" lang={proseLanguage}>
|
|
45
|
+
<slot />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</article>
|
|
49
|
+
<BlogArticleEnd newer={newer} older={older} showCategory={showCategory} />
|
|
50
|
+
</main>
|
|
51
|
+
{hasSections ? <PageContentBootstrap items={contents} /> : null}
|
|
52
|
+
<Footer client:load {...footerProps} class="app-wrapper blog-article-footer" />
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
import ArticleHeader from '../components/ArticleHeader.astro'
|
|
3
|
+
import PageNavs from '../components/PageNavs.astro'
|
|
4
|
+
import DocMain from '../components/DocMain.astro'
|
|
5
|
+
import PageContent from '../components/PageContent.svelte'
|
|
6
|
+
import PageContentBootstrap from '../components/PageContentBootstrap.astro'
|
|
7
|
+
import DocArticle from '../components/DocArticle.astro'
|
|
8
|
+
import type { FooterProps } from '../components/Footer.svelte'
|
|
9
|
+
import type { PageParams } from '../types/Props'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
params: PageParams
|
|
13
|
+
toc?: any[] | null
|
|
14
|
+
pageCategories?: any
|
|
15
|
+
metadata: any
|
|
16
|
+
dictionaries: Record<string, () => Promise<any>>
|
|
17
|
+
footerProps?: FooterProps
|
|
18
|
+
class?: string
|
|
19
|
+
/** The rest reaches `ArticleHeader`: `subtitle`, `categoryLink`, `icon`, `end`, … */
|
|
20
|
+
[key: string]: any
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { params, toc, pageCategories, metadata, dictionaries, footerProps, ...props } = Astro.props
|
|
24
|
+
const { locale } = params
|
|
25
|
+
const pageContent = Array.isArray(toc) && toc.length > 0 ? toc : null
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<DocMain class={props.class} footerProps={footerProps}>
|
|
29
|
+
<DocArticle aside={Boolean(pageContent)}>
|
|
30
|
+
<ArticleHeader {...props} locale={locale} metadata={metadata} dictionaries={dictionaries} toc={pageContent} />
|
|
31
|
+
<slot />
|
|
32
|
+
<PageNavs locale={locale} metadata={metadata} pageCategories={pageCategories} dictionaries={dictionaries} />
|
|
33
|
+
</DocArticle>
|
|
34
|
+
{pageContent && (
|
|
35
|
+
<Fragment>
|
|
36
|
+
{/* The rail's island serializes only the fields it renders. */}
|
|
37
|
+
<PageContent client:load items={pageContent.map(({ id, title, level }) => ({ id, title, level }))} metadata={{ sourcePath: metadata.sourcePath, title: metadata.title }} />
|
|
38
|
+
<PageContentBootstrap items={pageContent} />
|
|
39
|
+
</Fragment>
|
|
40
|
+
)}
|
|
41
|
+
</DocMain>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { parse, parseExpressionAt } from 'acorn'
|
|
2
|
+
import { visit, SKIP } from 'unist-util-visit'
|
|
3
|
+
|
|
4
|
+
/** Paragraph markers that turn a Markdown paragraph into a callout or a gesture hint. */
|
|
5
|
+
const paragraphMarkers = [
|
|
6
|
+
['(o) ', 'Do'],
|
|
7
|
+
['(x) ', 'DoNot'],
|
|
8
|
+
['(i) ', 'Info'],
|
|
9
|
+
['(!) ', 'Warn'],
|
|
10
|
+
['(!|) ', 'Warn', { leaded: true }],
|
|
11
|
+
['(hover) ', 'InteractingIndicator', { icon: 'hover' }],
|
|
12
|
+
['(resize) ', 'InteractingIndicator', { icon: 'resize' }],
|
|
13
|
+
['(click) ', 'InteractingIndicator', { icon: 'click' }],
|
|
14
|
+
['(type) ', 'InteractingIndicator', { icon: 'type' }],
|
|
15
|
+
['(wand) ', 'InteractingIndicator', { icon: 'wand' }]
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
/** Inline code may lead with its grammar, as in `html <div>`. */
|
|
19
|
+
const inlineLanguages = new Set(['html', 'js', 'ts', 'css', 'json', 'mcss'])
|
|
20
|
+
|
|
21
|
+
function attribute(name, value) {
|
|
22
|
+
if (typeof value === 'string') return { type: 'mdxJsxAttribute', name, value }
|
|
23
|
+
const source = JSON.stringify(value)
|
|
24
|
+
const expression = parseExpressionAt(source, 0, { ecmaVersion: 'latest' })
|
|
25
|
+
return {
|
|
26
|
+
type: 'mdxJsxAttribute',
|
|
27
|
+
name,
|
|
28
|
+
value: {
|
|
29
|
+
type: 'mdxJsxAttributeValueExpression',
|
|
30
|
+
value: source,
|
|
31
|
+
data: { estree: { type: 'Program', sourceType: 'module', body: [{ type: 'ExpressionStatement', expression }] } }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function element(type, name, props, children = []) {
|
|
37
|
+
return { type, name, attributes: Object.entries(props).filter(([, value]) => value !== undefined).map(([key, value]) => attribute(key, value)), children }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Fence meta reads as URL parameters whose values may be JSON, as in ```html name=index.html beautify=true. */
|
|
41
|
+
function fenceProps(node) {
|
|
42
|
+
const props = { name: '', lang: '', dedent: 'block' }
|
|
43
|
+
if (node.meta) {
|
|
44
|
+
for (const [key, value] of new URLSearchParams(node.meta.trim())) {
|
|
45
|
+
try {
|
|
46
|
+
props[key] = JSON.parse(value)
|
|
47
|
+
} catch {
|
|
48
|
+
props[key] = value
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!props.lang) props.lang = node.lang ?? ''
|
|
53
|
+
return props
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const componentsExport = `import { markdownComponents as __markdownComponents } from '@master/internal-site/components/markdown-components'
|
|
57
|
+
export const components = __markdownComponents`
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Markdown constructs that render through site components: fences become `Code` (or a
|
|
61
|
+
* package-manager `PMAction`), inline code becomes `InlineCode`, and marked paragraphs become
|
|
62
|
+
* callouts. Every MDX module exports the site's `components`, so imported MDX renders the same way.
|
|
63
|
+
*/
|
|
64
|
+
export default function remarkMarkdownComponents() {
|
|
65
|
+
return (tree) => {
|
|
66
|
+
tree.children.unshift({
|
|
67
|
+
type: 'mdxjsEsm',
|
|
68
|
+
value: componentsExport,
|
|
69
|
+
data: { estree: parse(componentsExport, { ecmaVersion: 'latest', sourceType: 'module' }) }
|
|
70
|
+
})
|
|
71
|
+
visit(tree, (node, index, parent) => {
|
|
72
|
+
if (!parent || index === undefined) return
|
|
73
|
+
if (node.type === 'code') {
|
|
74
|
+
const props = fenceProps(node)
|
|
75
|
+
// Markdown fences end with a newline, as their `<pre>` text did.
|
|
76
|
+
const code = node.value ? node.value + '\n' : ''
|
|
77
|
+
parent.children[index] = props.lang === 'bash' && props.action
|
|
78
|
+
? element('mdxJsxFlowElement', 'PMAction', { action: props.action, code: node.value })
|
|
79
|
+
: element('mdxJsxFlowElement', 'Code', { ...props, code })
|
|
80
|
+
return SKIP
|
|
81
|
+
}
|
|
82
|
+
if (node.type === 'inlineCode') {
|
|
83
|
+
const [first, ...rest] = node.value.split(' ')
|
|
84
|
+
const lang = rest.length && inlineLanguages.has(first) ? first : ''
|
|
85
|
+
parent.children[index] = element('mdxJsxTextElement', 'InlineCode', { lang, code: lang ? rest.join(' ') : node.value })
|
|
86
|
+
return SKIP
|
|
87
|
+
}
|
|
88
|
+
if (node.type === 'paragraph') {
|
|
89
|
+
const first = node.children[0]
|
|
90
|
+
if (first?.type !== 'text') return
|
|
91
|
+
const marker = paragraphMarkers.find(([prefix]) => first.value.startsWith(prefix))
|
|
92
|
+
if (!marker) return
|
|
93
|
+
const [prefix, name, props = {}] = marker
|
|
94
|
+
first.value = first.value.slice(prefix.length)
|
|
95
|
+
parent.children[index] = element('mdxJsxFlowElement', name, props, node.children)
|
|
96
|
+
// Visit the callout again so its inline code becomes `InlineCode` too.
|
|
97
|
+
return index
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Slugger from 'github-slugger'
|
|
2
|
+
import { visit } from 'unist-util-visit'
|
|
3
|
+
import resolveHeading from '../utils/resolve-heading.js'
|
|
4
|
+
import { parse } from 'acorn'
|
|
5
|
+
|
|
6
|
+
export default function remarkSlugAndTOC() {
|
|
7
|
+
return (tree) => {
|
|
8
|
+
const slugs = new Slugger()
|
|
9
|
+
const toc = []
|
|
10
|
+
|
|
11
|
+
visit(tree, 'heading', (node) => {
|
|
12
|
+
const depth = node.depth
|
|
13
|
+
if (depth !== 2 && depth !== 3) return
|
|
14
|
+
|
|
15
|
+
// Extract raw text from heading children
|
|
16
|
+
const title = node.children
|
|
17
|
+
.filter((n) => n.type === 'text' || n.type === 'inlineCode')
|
|
18
|
+
.map((n) => n.value)
|
|
19
|
+
.join(' ')
|
|
20
|
+
.trim()
|
|
21
|
+
|
|
22
|
+
const id = slugs.slug(title)
|
|
23
|
+
const resolved = resolveHeading(title, id)
|
|
24
|
+
// Explicit IDs survive title edits and translations; they are not visible prose.
|
|
25
|
+
const lastText = node.children.findLast((child) => child.type === 'text')
|
|
26
|
+
if (lastText) lastText.value = lastText.value.replace(/\s+\{#[\w-]+\}$/, '')
|
|
27
|
+
node.data ??= {}
|
|
28
|
+
node.data.hProperties ??= {}
|
|
29
|
+
node.data.id = resolved.id
|
|
30
|
+
node.data.hProperties.id = resolved.id
|
|
31
|
+
|
|
32
|
+
toc.push({
|
|
33
|
+
id: resolved.id,
|
|
34
|
+
title: resolved.title,
|
|
35
|
+
level: depth
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const tocCode = `export const toc = ${JSON.stringify(toc, null, 2)};`
|
|
40
|
+
|
|
41
|
+
// Inject toc as ESM export
|
|
42
|
+
tree.children.unshift({
|
|
43
|
+
type: 'mdxjsEsm',
|
|
44
|
+
value: tocCode,
|
|
45
|
+
data: {
|
|
46
|
+
estree: parse(tocCode, {
|
|
47
|
+
ecmaVersion: 'latest',
|
|
48
|
+
sourceType: 'module',
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies persisted code tab choices before paint. The document inlines it after
|
|
3
|
+
* the content, so every tab set has already parsed.
|
|
4
|
+
*/
|
|
5
|
+
export function codeTabsBootstrap() {
|
|
6
|
+
const readStoredName = (key: string) => {
|
|
7
|
+
try {
|
|
8
|
+
const raw = window.localStorage.getItem(key)
|
|
9
|
+
if (!raw) return
|
|
10
|
+
const parsed = JSON.parse(raw)
|
|
11
|
+
return typeof parsed === 'string' ? parsed : undefined
|
|
12
|
+
} catch {
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
document.querySelectorAll<HTMLElement>('[data-code-tabs-storage-key]').forEach((root) => {
|
|
18
|
+
const storedName = readStoredName(root.dataset.codeTabsStorageKey!)
|
|
19
|
+
const triggers = Array.from(root.querySelectorAll<HTMLElement>('[data-code-tabs-tab-name]'))
|
|
20
|
+
if (!storedName || !triggers.some((trigger) => trigger.dataset.codeTabsTabName === storedName)) return
|
|
21
|
+
|
|
22
|
+
root.dataset.codeTabsCurrentName = storedName
|
|
23
|
+
triggers.forEach((trigger) => {
|
|
24
|
+
const active = trigger.dataset.codeTabsTabName === storedName
|
|
25
|
+
trigger.setAttribute('aria-selected', String(active))
|
|
26
|
+
trigger.tabIndex = active ? 0 : -1
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
root.querySelectorAll<HTMLElement>('[data-code-tabs-panel-name]').forEach((panel) => {
|
|
30
|
+
const active = panel.dataset.codeTabsPanelName === storedName
|
|
31
|
+
panel.hidden = !active
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Code blocks render as static markup; these delegated handlers switch tabs and copy code. */
|
|
2
|
+
|
|
3
|
+
const tabChange = 'site-code-tabs:change'
|
|
4
|
+
const resetTimers = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>()
|
|
5
|
+
const pendingCopies = new WeakSet<HTMLButtonElement>()
|
|
6
|
+
|
|
7
|
+
function tabsOf(root: HTMLElement) {
|
|
8
|
+
return [...root.querySelectorAll<HTMLButtonElement>('[data-code-tabs-tab-name]')]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function selectTab(root: HTMLElement, name: string) {
|
|
12
|
+
const tabs = tabsOf(root)
|
|
13
|
+
if (!tabs.some(tab => tab.dataset.codeTabsTabName === name)) return
|
|
14
|
+
root.dataset.codeTabsCurrentName = name
|
|
15
|
+
for (const tab of tabs) {
|
|
16
|
+
const active = tab.dataset.codeTabsTabName === name
|
|
17
|
+
tab.setAttribute('aria-selected', String(active))
|
|
18
|
+
tab.tabIndex = active ? 0 : -1
|
|
19
|
+
}
|
|
20
|
+
root.querySelectorAll<HTMLElement>('[data-code-tabs-panel-name]').forEach(panel => {
|
|
21
|
+
const active = panel.dataset.codeTabsPanelName === name
|
|
22
|
+
panel.hidden = !active
|
|
23
|
+
})
|
|
24
|
+
const copy = root.querySelector<HTMLButtonElement>('[data-code-copy]')
|
|
25
|
+
if (copy) {
|
|
26
|
+
copy.dataset.codeCopy = name
|
|
27
|
+
copy.ariaLabel = copy.title = `Copy ${name}`
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Tab sets with one storage key share a choice, such as the package manager. */
|
|
32
|
+
function chooseTab(root: HTMLElement, name: string) {
|
|
33
|
+
const key = root.dataset.codeTabsStorageKey
|
|
34
|
+
if (!key) return selectTab(root, name)
|
|
35
|
+
try { localStorage.setItem(key, JSON.stringify(name)) } catch { /* Storage may be unavailable. */ }
|
|
36
|
+
window.dispatchEvent(new CustomEvent(tabChange, { detail: { key, name } }))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function syncTabs(key: string, name: string) {
|
|
40
|
+
document.querySelectorAll<HTMLElement>('[data-code-tabs]').forEach(root => {
|
|
41
|
+
if (root.dataset.codeTabsStorageKey === key) selectTab(root, name)
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Mirror `highlightedCodeText`: Shiki lines without trailing notation whitespace. */
|
|
46
|
+
function codeText(button: HTMLButtonElement) {
|
|
47
|
+
if (button.dataset.codeCopyText !== undefined) return button.dataset.codeCopyText
|
|
48
|
+
const container = button.closest<HTMLElement>('[data-code-tabs]')
|
|
49
|
+
const scope = container?.querySelector<HTMLElement>('[data-code-tabs-panel-name]:not([hidden])') ?? button.closest<HTMLElement>('.ui-code')
|
|
50
|
+
return [...scope?.querySelectorAll<HTMLElement>('.line') ?? []].map(line => (line.textContent ?? '').replace(/[\t ]+$/u, '')).join('\n')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The icon swaps and the status beside the button says what happened, then both return to rest. */
|
|
54
|
+
function showCopyStatus(button: HTMLButtonElement, status: 'idle' | 'pending' | 'copied' | 'error', name = button.dataset.codeCopy) {
|
|
55
|
+
const element = button.closest('.ui-copy')?.querySelector<HTMLElement>('.ui-copy-status')
|
|
56
|
+
const result = status === 'copied' ? 'success' : status === 'error' ? 'error' : undefined
|
|
57
|
+
if (element) {
|
|
58
|
+
element.textContent = status === 'copied' ? `${name || 'Code'} copied` : status === 'error' ? 'Clipboard unavailable. Select the code to copy it.' : ''
|
|
59
|
+
if (result) element.dataset.result = result
|
|
60
|
+
else delete element.dataset.result
|
|
61
|
+
}
|
|
62
|
+
if (result) button.dataset.result = result
|
|
63
|
+
else delete button.dataset.result
|
|
64
|
+
clearTimeout(resetTimers.get(button))
|
|
65
|
+
if (result) resetTimers.set(button, setTimeout(() => showCopyStatus(button, 'idle'), status === 'error' ? 5000 : 2000))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function copy(button: HTMLButtonElement) {
|
|
69
|
+
if (pendingCopies.has(button)) return
|
|
70
|
+
const name = button.dataset.codeCopy
|
|
71
|
+
pendingCopies.add(button)
|
|
72
|
+
button.setAttribute('aria-busy', 'true')
|
|
73
|
+
showCopyStatus(button, 'pending', name)
|
|
74
|
+
try {
|
|
75
|
+
if (!navigator.clipboard?.writeText) throw new Error('Clipboard unavailable')
|
|
76
|
+
await navigator.clipboard.writeText(codeText(button))
|
|
77
|
+
showCopyStatus(button, 'copied', name)
|
|
78
|
+
} catch {
|
|
79
|
+
showCopyStatus(button, 'error')
|
|
80
|
+
} finally {
|
|
81
|
+
pendingCopies.delete(button)
|
|
82
|
+
button.removeAttribute('aria-busy')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
document.addEventListener('click', event => {
|
|
87
|
+
if (!(event.target instanceof Element)) return
|
|
88
|
+
const copyButton = event.target.closest<HTMLButtonElement>('[data-code-copy]')
|
|
89
|
+
if (copyButton) return void copy(copyButton)
|
|
90
|
+
const tab = event.target.closest<HTMLButtonElement>('[data-code-tabs-tab-name]')
|
|
91
|
+
const root = tab?.closest<HTMLElement>('[data-code-tabs]')
|
|
92
|
+
if (tab && root) chooseTab(root, tab.dataset.codeTabsTabName!)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
document.addEventListener('keydown', event => {
|
|
96
|
+
if (!(event.target instanceof HTMLElement) || !event.target.matches('[data-code-tabs-tab-name]')) return
|
|
97
|
+
const root = event.target.closest<HTMLElement>('[data-code-tabs]')
|
|
98
|
+
if (!root) return
|
|
99
|
+
const tabs = tabsOf(root)
|
|
100
|
+
const index = tabs.indexOf(event.target as HTMLButtonElement)
|
|
101
|
+
const next = { ArrowRight: (index + 1) % tabs.length, ArrowLeft: (index - 1 + tabs.length) % tabs.length, Home: 0, End: tabs.length - 1 }[event.key]
|
|
102
|
+
if (next === undefined) return
|
|
103
|
+
event.preventDefault()
|
|
104
|
+
chooseTab(root, tabs[next].dataset.codeTabsTabName!)
|
|
105
|
+
tabs[next].focus()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
window.addEventListener(tabChange, event => {
|
|
109
|
+
const { key, name } = (event as CustomEvent<{ key: string, name: string }>).detail
|
|
110
|
+
syncTabs(key, name)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
window.addEventListener('storage', event => {
|
|
114
|
+
if (!event.key || event.newValue === null) return
|
|
115
|
+
try {
|
|
116
|
+
const name = JSON.parse(event.newValue)
|
|
117
|
+
if (typeof name === 'string') syncTabs(event.key, name)
|
|
118
|
+
} catch { /* Not a code tab choice. */ }
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// The bootstrap script restored persisted choices before paint; align their copy labels.
|
|
122
|
+
document.querySelectorAll<HTMLElement>('[data-code-tabs][data-code-tabs-storage-key]').forEach(root => {
|
|
123
|
+
if (root.dataset.codeTabsCurrentName) selectTab(root, root.dataset.codeTabsCurrentName)
|
|
124
|
+
})
|