@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,121 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
export interface HeaderProps {
|
|
5
|
+
/** Overlays the page, slides away while reading down and is transparent at the top (homepage, blog). */
|
|
6
|
+
stickable?: boolean
|
|
7
|
+
/** With `stickable`, each change of the header runs as a view transition of the header alone. */
|
|
8
|
+
transitionAtTop?: boolean
|
|
9
|
+
class?: string
|
|
10
|
+
children?: Snippet
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import '../../styles/docs-shell/header.css'
|
|
16
|
+
import { throttle } from 'throttle-debounce'
|
|
17
|
+
import { flushSync } from 'svelte'
|
|
18
|
+
import clsx from 'clsx'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The site header. By default it sticks to the top of the canvas; a stickable header overlays the page instead.
|
|
22
|
+
* Its state is on data attributes: `data-background="transparent"` at the top of the page, `data-tucked` while hidden.
|
|
23
|
+
*/
|
|
24
|
+
let { stickable, transitionAtTop = false, class: className, children }: HeaderProps = $props()
|
|
25
|
+
let header = $state<HTMLElement>()
|
|
26
|
+
// Mirrors the server render: a stickable header starts transparent at the top.
|
|
27
|
+
// svelte-ignore state_referenced_locally
|
|
28
|
+
let atTop = $state(!!stickable)
|
|
29
|
+
|
|
30
|
+
$effect(() => {
|
|
31
|
+
if (!stickable || !header) return
|
|
32
|
+
const element = header
|
|
33
|
+
const transitionAtTopEnabled = transitionAtTop
|
|
34
|
+
const root = document.documentElement
|
|
35
|
+
const motion = matchMedia('(prefers-reduced-motion: reduce)')
|
|
36
|
+
let lastScrollTop = window.scrollY
|
|
37
|
+
let scrollDirection = 0
|
|
38
|
+
let activeTransition: ViewTransition | null = null
|
|
39
|
+
// What the header should show now; each change applies all of it, so a skipped transition loses nothing.
|
|
40
|
+
const desired = { atTop: lastScrollTop <= 10, tucked: false }
|
|
41
|
+
|
|
42
|
+
// Restored scroll positions use their final state without an entrance animation.
|
|
43
|
+
atTop = desired.atTop
|
|
44
|
+
|
|
45
|
+
const apply = () => {
|
|
46
|
+
element.toggleAttribute('data-tucked', desired.tucked)
|
|
47
|
+
flushSync(() => { atTop = desired.atTop })
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// With `transitionAtTop`, every change of the header runs as a view transition of the header alone. The marker
|
|
51
|
+
// is a data attribute, not a class, so canvases watching the root's class for theme changes stay still.
|
|
52
|
+
const change = (kind: 'top' | 'tuck') => {
|
|
53
|
+
activeTransition?.skipTransition()
|
|
54
|
+
if (!transitionAtTopEnabled || !document.startViewTransition || motion.matches) {
|
|
55
|
+
apply()
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
root.dataset.headerTransition = kind
|
|
59
|
+
const transition = document.startViewTransition(apply)
|
|
60
|
+
activeTransition = transition
|
|
61
|
+
void transition.ready.catch(() => {})
|
|
62
|
+
const finish = () => {
|
|
63
|
+
if (activeTransition !== transition) return
|
|
64
|
+
activeTransition = null
|
|
65
|
+
delete root.dataset.headerTransition
|
|
66
|
+
}
|
|
67
|
+
void transition.finished.then(finish, finish)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const reduceMotion = () => { if (motion.matches) activeTransition?.skipTransition() }
|
|
71
|
+
const handleScroll = throttle(
|
|
72
|
+
50,
|
|
73
|
+
() => {
|
|
74
|
+
const st = Math.max(0, window.scrollY)
|
|
75
|
+
const nextAtTop = st <= 10
|
|
76
|
+
let kind: 'top' | 'tuck' | undefined
|
|
77
|
+
if (nextAtTop) {
|
|
78
|
+
scrollDirection = -1
|
|
79
|
+
if (desired.tucked) {
|
|
80
|
+
desired.tucked = false
|
|
81
|
+
kind = 'tuck'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (nextAtTop !== desired.atTop) {
|
|
85
|
+
desired.atTop = nextAtTop
|
|
86
|
+
kind = 'top'
|
|
87
|
+
}
|
|
88
|
+
if (Math.abs(st - lastScrollTop) > 100) {
|
|
89
|
+
const direction = st > lastScrollTop ? 1 : -1
|
|
90
|
+
if (direction !== scrollDirection) {
|
|
91
|
+
scrollDirection = direction
|
|
92
|
+
const tucked = direction === 1 && !nextAtTop
|
|
93
|
+
if (tucked !== desired.tucked) {
|
|
94
|
+
desired.tucked = tucked
|
|
95
|
+
kind ??= 'tuck'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
lastScrollTop = st
|
|
99
|
+
}
|
|
100
|
+
if (kind) change(kind)
|
|
101
|
+
},
|
|
102
|
+
)
|
|
103
|
+
motion.addEventListener('change', reduceMotion)
|
|
104
|
+
window.addEventListener('scroll', handleScroll, { passive: true })
|
|
105
|
+
return () => {
|
|
106
|
+
handleScroll.cancel()
|
|
107
|
+
window.removeEventListener('scroll', handleScroll)
|
|
108
|
+
motion.removeEventListener('change', reduceMotion)
|
|
109
|
+
activeTransition?.skipTransition()
|
|
110
|
+
if (transitionAtTopEnabled) delete root.dataset.headerTransition
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<!-- A view transition animates the header itself; a CSS transition would run again after it. -->
|
|
116
|
+
<header bind:this={header} class={clsx('ui-header', className)}
|
|
117
|
+
data-variant={stickable ? 'stickable' : undefined}
|
|
118
|
+
data-background={stickable && atTop ? 'transparent' : undefined}
|
|
119
|
+
style={transitionAtTop ? 'transition: none' : undefined}>
|
|
120
|
+
{@render children?.()}
|
|
121
|
+
</header>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import brands from '../data/brands'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
name: keyof typeof brands
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** A brand mark in an article header, resolved at the page that requests it. */
|
|
9
|
+
const brand = brands[Astro.props.name]
|
|
10
|
+
if (!brand) throw new Error(`Brand ${Astro.props.name} not found`)
|
|
11
|
+
const Icon = brand.src
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<Icon class:list={['block w-full h-full max-w-full max-h-full', brand.headerClassName]} style={{ display: 'block', width: '100%', height: '100%', maxWidth: '100%', maxHeight: '100%' }} />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import IconArrowUpRight from '@tabler/icons-svelte-runes/icons/arrow-up-right'
|
|
4
|
+
import Link from './Link.svelte'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
name?: string
|
|
8
|
+
isNew?: boolean
|
|
9
|
+
children?: Snippet
|
|
10
|
+
[key: string]: any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** A primary section link; it is current anywhere inside its section. */
|
|
14
|
+
let { name: _name, children, isNew: _isNew, ...props }: Props = $props()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Link {...props} current="true" ambiguous>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
{#if props.href?.startsWith('http')}<IconArrowUpRight class="ui-header-external" size={10} stroke={1.5} aria-hidden="true" />{/if}
|
|
20
|
+
</Link>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLImgAttributes } from 'svelte/elements'
|
|
3
|
+
import { createCloudflareImageUrl } from '../../utils/cloudflare-image-loader.js'
|
|
4
|
+
import type { StaticImage } from '../types/StaticImage'
|
|
5
|
+
|
|
6
|
+
export type { StaticImage }
|
|
7
|
+
|
|
8
|
+
export type ImageProps = Omit<HTMLImgAttributes, 'src' | 'width' | 'height' | 'placeholder'> & {
|
|
9
|
+
src: string | StaticImage
|
|
10
|
+
width?: number | `${number}`
|
|
11
|
+
height?: number | `${number}`
|
|
12
|
+
/** Cover the positioned parent, like a background image. */
|
|
13
|
+
fill?: boolean
|
|
14
|
+
/** Load immediately with high fetch priority. */
|
|
15
|
+
priority?: boolean
|
|
16
|
+
quality?: number
|
|
17
|
+
placeholder?: 'blur' | 'empty'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const deviceSizes = [640, 750, 828, 1080, 1200, 1920, 2048, 3840]
|
|
21
|
+
const imageSizes = [16, 32, 48, 64, 96, 128, 256, 384]
|
|
22
|
+
const allSizes = [...imageSizes, ...deviceSizes]
|
|
23
|
+
const transformations = import.meta.env.PUBLIC_IMAGE_TRANSFORMATIONS === 'true'
|
|
24
|
+
const fillStyle = 'position:absolute;inset:0;width:100%;height:100%'
|
|
25
|
+
|
|
26
|
+
function candidateWidths(width: number | undefined, sizes: string | undefined | null) {
|
|
27
|
+
if (sizes || !width) return deviceSizes
|
|
28
|
+
return [...new Set([width, width * 2].map((size) => allSizes.find((candidate) => candidate >= size) ?? allSizes.at(-1)!))]
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
/** Render a bitmap with intrinsic dimensions and, on Cloudflare, resized sources. */
|
|
34
|
+
let { src, width, height, fill, priority, quality, placeholder: _placeholder, loading, sizes, style, alt = '', fetchpriority, ...props }: ImageProps = $props()
|
|
35
|
+
|
|
36
|
+
const source = $derived(typeof src === 'string' ? src : src.src)
|
|
37
|
+
const intrinsicWidth = $derived(fill ? undefined : Number(width ?? (typeof src === 'object' ? src.width : undefined)) || undefined)
|
|
38
|
+
const intrinsicHeight = $derived(fill ? undefined : Number(height ?? (typeof src === 'object' ? src.height : undefined)) || undefined)
|
|
39
|
+
const url = (size: number) => createCloudflareImageUrl({ src: source, width: size, quality, siteUrl: import.meta.env.PUBLIC_URL })
|
|
40
|
+
const widths = $derived(candidateWidths(intrinsicWidth, sizes))
|
|
41
|
+
const resized = $derived(transformations && url(widths[0]) !== source)
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<img
|
|
45
|
+
{...props}
|
|
46
|
+
{alt}
|
|
47
|
+
src={resized ? url(widths.at(-1)!) : source}
|
|
48
|
+
srcset={resized ? widths.map((size, index) => sizes || !intrinsicWidth ? `${url(size)} ${size}w` : `${url(size)} ${index + 1}x`).join(', ') : undefined}
|
|
49
|
+
sizes={resized ? sizes ?? (fill ? '100vw' : undefined) : undefined}
|
|
50
|
+
width={intrinsicWidth}
|
|
51
|
+
height={intrinsicHeight}
|
|
52
|
+
loading={priority ? 'eager' : loading ?? 'lazy'}
|
|
53
|
+
fetchpriority={priority ? 'high' : fetchpriority}
|
|
54
|
+
decoding="async"
|
|
55
|
+
style={fill ? [fillStyle, style].filter(Boolean).join(';') : style}
|
|
56
|
+
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
import clsx from 'clsx'
|
|
3
|
+
import { toHtml } from 'hast-util-to-html'
|
|
4
|
+
import highlightCode from '../utils/highlight-code'
|
|
5
|
+
import { slotText } from '../utils/slot-text'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** The source; text children work too. */
|
|
9
|
+
code?: string
|
|
10
|
+
lang?: string
|
|
11
|
+
class?: string
|
|
12
|
+
[key: string]: any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Highlighted inline code, drawn as a `ui-inline-code` chip. */
|
|
16
|
+
const { code: source, class: className, ...props } = Astro.props
|
|
17
|
+
const code = source ?? await slotText(Astro.slots) ?? ''
|
|
18
|
+
const hast: any = await highlightCode(code, {
|
|
19
|
+
inline: true,
|
|
20
|
+
...props,
|
|
21
|
+
className: clsx('ui-inline-code', className)
|
|
22
|
+
})
|
|
23
|
+
// A single token (no spaces) is marked, so reading text can keep it whole rather than split it at a hyphen.
|
|
24
|
+
const element = hast.children?.[0]
|
|
25
|
+
if (element?.type === 'element' && !/\s/.test(code.trim())) {
|
|
26
|
+
element.properties = { ...element.properties, dataToken: '' }
|
|
27
|
+
}
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<Fragment set:html={toHtml(hast)} />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import IconForms from '@tabler/icons-svelte-runes/icons/forms'
|
|
3
|
+
import IconHandClick from '@tabler/icons-svelte-runes/icons/hand-click'
|
|
4
|
+
import IconHandMove from '@tabler/icons-svelte-runes/icons/hand-move'
|
|
5
|
+
import IconResize from '@tabler/icons-svelte-runes/icons/resize'
|
|
6
|
+
import IconTestPipe from '@tabler/icons-svelte-runes/icons/test-pipe'
|
|
7
|
+
import IconWand from '@tabler/icons-svelte-runes/icons/wand'
|
|
8
|
+
|
|
9
|
+
const icons = { wand: IconWand, hover: IconHandMove, click: IconHandClick, type: IconForms, observe: IconTestPipe, resize: IconResize, test: IconTestPipe }
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
icon: keyof typeof icons
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** How to use the example that follows: a muted line led by its gesture. */
|
|
16
|
+
const Icon = icons[Astro.props.icon]
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<p class="ui-hint"><Icon aria-hidden="true" /><slot /></p>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import IconLanguage from '@tabler/icons-svelte-runes/icons/language'
|
|
3
|
+
import LanguageSelect from './LanguageSelect.svelte'
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import { getSite } from '../site'
|
|
6
|
+
|
|
7
|
+
/** An icon button that opens the native language list laid over it. */
|
|
8
|
+
let { class: className }: { class?: string } = $props()
|
|
9
|
+
const { t, i18n } = getSite()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if i18n.locales.length > 1}
|
|
13
|
+
<label class={clsx('ui-button', className)} data-variant="quiet" data-shape="icon" data-size="sm">
|
|
14
|
+
<IconLanguage size={18} stroke={1.5} aria-hidden="true" />
|
|
15
|
+
<LanguageSelect aria-label={t('Language switch')} />
|
|
16
|
+
<span class="ui-tooltip" data-side="bottom" aria-hidden="true">{t('Language')}</span>
|
|
17
|
+
</label>
|
|
18
|
+
{/if}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLSelectAttributes } from 'svelte/elements'
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import { getSite } from '../site'
|
|
6
|
+
import { localizePathname } from '../utils/i18n-pathname'
|
|
7
|
+
|
|
8
|
+
interface Props extends Omit<HTMLSelectAttributes, 'value' | 'onchange'> {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** A native select; by default invisible over its positioned label (`ui-select[data-variant="overlay"]`), which shows the value. */
|
|
13
|
+
let { class: className, children, ...props }: Props = $props()
|
|
14
|
+
const { pathname, locale, i18n } = getSite()
|
|
15
|
+
|
|
16
|
+
function onchange(event: Event & { currentTarget: HTMLSelectElement }) {
|
|
17
|
+
const newLocale = event.currentTarget.value
|
|
18
|
+
const splits = pathname.split('/')
|
|
19
|
+
for (const eachLocale of i18n.locales) {
|
|
20
|
+
if (splits[1] === eachLocale) {
|
|
21
|
+
splits.splice(1, 1)
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const target = localizePathname(splits.join('/') || '/', {
|
|
26
|
+
defaultLocale: i18n.defaultLocale,
|
|
27
|
+
locale: newLocale,
|
|
28
|
+
locales: i18n.locales as string[],
|
|
29
|
+
localizablePathnameRoots: i18n.localizablePathnameRoots
|
|
30
|
+
})
|
|
31
|
+
location.assign(target + location.search + location.hash)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<select data-variant="overlay" {...props} class={clsx('ui-select', className)}
|
|
36
|
+
{onchange}
|
|
37
|
+
value={locale}>
|
|
38
|
+
{#each Object.entries(i18n.nameOfLocale) as [eachLocale, localeName] (eachLocale)}
|
|
39
|
+
<option value={eachLocale}>
|
|
40
|
+
{localeName}
|
|
41
|
+
</option>
|
|
42
|
+
{/each}
|
|
43
|
+
</select>
|
|
44
|
+
{@render children?.()}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
const initializedScrollPositionParent = new Set<HTMLElement>()
|
|
3
|
+
|
|
4
|
+
function getScrollParent(element: HTMLElement) {
|
|
5
|
+
let style = getComputedStyle(element)
|
|
6
|
+
const excludeStaticParent = style.position === 'absolute'
|
|
7
|
+
const overflowRegex = /(auto|scroll|overlay)/
|
|
8
|
+
|
|
9
|
+
if (style.position === 'fixed') return document.body
|
|
10
|
+
for (let parent: HTMLElement | null = element; (parent = parent.parentElement);) {
|
|
11
|
+
style = getComputedStyle(parent)
|
|
12
|
+
if (excludeStaticParent && style.position === 'static') {
|
|
13
|
+
continue
|
|
14
|
+
}
|
|
15
|
+
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) return parent
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return document.body
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import type { Snippet } from 'svelte'
|
|
24
|
+
import clsx from 'clsx'
|
|
25
|
+
import { anchor } from '../utils/anchor'
|
|
26
|
+
import { getSite } from '../site'
|
|
27
|
+
import { canonicalizeDefaultLocalePathname, localizePathname } from '../utils/i18n-pathname'
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
href?: string
|
|
31
|
+
class?: any
|
|
32
|
+
/** Active anywhere inside the linked section rather than only on the page itself. */
|
|
33
|
+
ambiguous?: boolean
|
|
34
|
+
/** Keep the active link scrolled into view in its scrolling container. */
|
|
35
|
+
scrollIntoView?: boolean
|
|
36
|
+
unfinished?: boolean
|
|
37
|
+
active?: boolean
|
|
38
|
+
/** Mark external and same-page links after the text; see `styles/docs-shell/prose.css`. */
|
|
39
|
+
indicate?: boolean
|
|
40
|
+
/** The `aria-current` token for an active link that is not the page itself, such as `true`. */
|
|
41
|
+
current?: string
|
|
42
|
+
disabled?: boolean
|
|
43
|
+
onclick?: (event: MouseEvent) => void
|
|
44
|
+
element?: HTMLAnchorElement | HTMLButtonElement
|
|
45
|
+
children?: Snippet
|
|
46
|
+
[key: string]: any
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A localized anchor. It renders statically; when hydrated it also keeps active links scrolled into view.
|
|
51
|
+
* Same-page hash links scroll through `docs-shell/scripts/document`. A link to the page being read carries
|
|
52
|
+
* `aria-current="page"`; with `current`, a link that is only active (inside its section, see `ambiguous`) carries
|
|
53
|
+
* that token instead, such as `true`.
|
|
54
|
+
*/
|
|
55
|
+
let { children, class: className, ambiguous, scrollIntoView, unfinished, active, indicate, current, element = $bindable(), onclick, ...props }: Props = $props()
|
|
56
|
+
|
|
57
|
+
const { i18n, locale, pathname } = getSite()
|
|
58
|
+
const isHash = $derived(props.href?.startsWith('#'))
|
|
59
|
+
const external = $derived(props.href?.startsWith('http'))
|
|
60
|
+
const href: string = $derived.by(() => {
|
|
61
|
+
if (!props.href?.startsWith('/')) return props.href || ''
|
|
62
|
+
return localizePathname(props.href, {
|
|
63
|
+
defaultLocale: i18n.defaultLocale,
|
|
64
|
+
locale,
|
|
65
|
+
locales: i18n.locales,
|
|
66
|
+
localizablePathnameRoots: i18n.localizablePathnameRoots
|
|
67
|
+
}) || ''
|
|
68
|
+
})
|
|
69
|
+
const canonicalHref = $derived(canonicalizeDefaultLocalePathname(href, i18n.defaultLocale))
|
|
70
|
+
|
|
71
|
+
function handleClick(event: MouseEvent) {
|
|
72
|
+
if (isHash && event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
|
|
73
|
+
event.preventDefault()
|
|
74
|
+
anchor(href.slice(1), { offset: 110 })
|
|
75
|
+
}
|
|
76
|
+
if (props.disabled) {
|
|
77
|
+
event.preventDefault()
|
|
78
|
+
}
|
|
79
|
+
onclick?.(event)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const pathnameActive = $derived.by(() => {
|
|
83
|
+
if (active !== undefined) {
|
|
84
|
+
return active
|
|
85
|
+
} else if (href.startsWith('http')) {
|
|
86
|
+
return false
|
|
87
|
+
} else if (ambiguous) {
|
|
88
|
+
const pathnameSplits = pathname?.split('/')
|
|
89
|
+
const hrefSplits = canonicalHref.split('/')
|
|
90
|
+
return hrefSplits.every((eachHrefSplit: string, i: number) => eachHrefSplit === pathnameSplits?.[i])
|
|
91
|
+
}
|
|
92
|
+
return pathname === canonicalHref
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
// A link to the page being read says so; section-level (ambiguous) matches only change its styling.
|
|
96
|
+
const currentPage = $derived(!isHash && !external && pathname === canonicalHref)
|
|
97
|
+
|
|
98
|
+
$effect.pre(() => {
|
|
99
|
+
const currentLink = element
|
|
100
|
+
if (currentLink && pathnameActive && scrollIntoView) {
|
|
101
|
+
const scrollableParent = getScrollParent(currentLink)
|
|
102
|
+
if (scrollableParent) {
|
|
103
|
+
const scrollableParentRect = scrollableParent.getBoundingClientRect()
|
|
104
|
+
const targetRect = currentLink.getBoundingClientRect()
|
|
105
|
+
scrollableParent.scrollTo({
|
|
106
|
+
top: currentLink.offsetTop + targetRect.height - scrollableParentRect.height / 2,
|
|
107
|
+
behavior: initializedScrollPositionParent.has(scrollableParent) && !matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'instant' as ScrollBehavior
|
|
108
|
+
})
|
|
109
|
+
initializedScrollPositionParent.add(scrollableParent)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const resolvedClassName = $derived(clsx(className, {
|
|
115
|
+
'fg-text-disabled': props.disabled
|
|
116
|
+
}) || undefined)
|
|
117
|
+
// The mark after an indicated link is drawn by styles/docs-shell/prose.css.
|
|
118
|
+
const indication = $derived(indicate ? external ? 'external' : isHash ? 'hash' : undefined : undefined)
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
{#if props.href && !props.disabled}
|
|
122
|
+
<a bind:this={element} {...props} data-indicate={indication} {href} aria-current={props['aria-current'] ?? (currentPage ? 'page' : current && pathnameActive ? current : undefined)} rel={external ? 'noreferrer noopener' : props.rel} target={external ? '_blank' : props.target} onclick={handleClick}
|
|
123
|
+
class={resolvedClassName}>{@render children?.()}{#if unfinished}<span class="ml-2xs (font-size:.5em)">🚧</span>{/if}</a>
|
|
124
|
+
{:else}
|
|
125
|
+
<button bind:this={element} {...props} onclick={handleClick}
|
|
126
|
+
class={resolvedClassName}>{@render children?.()}{#if unfinished}<span class="ml-2xs (font-size:.5em)">🚧</span>{/if}</button>
|
|
127
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
type Props = HTMLAttributes<'img'>
|
|
5
|
+
|
|
6
|
+
// Each image shows in one mode; the dark one is the source with `@dark` before its extension.
|
|
7
|
+
const { class: _class, ...props } = Astro.props
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<img {...props} class="hidden@apply(--site-dark)" />
|
|
11
|
+
<img {...props} src={(props.src as string)?.replace(/(\.\w+)$/, '@dark$1')} class="hidden@apply(--site-light)" />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '../../styles/docs-shell/not-found.css'
|
|
3
|
+
import { siteOf } from '../../astro/site-context'
|
|
4
|
+
import SearchButton from './SearchButton.svelte'
|
|
5
|
+
import Link from './Link.svelte'
|
|
6
|
+
import config from 'virtual:master-site/config'
|
|
7
|
+
|
|
8
|
+
const { t: $, locale } = siteOf(Astro)
|
|
9
|
+
const tw = locale === 'tw'
|
|
10
|
+
const guide = Boolean(config.sections.guide)
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<main class="ui-not-found">
|
|
14
|
+
<div class="ui-pagehead">
|
|
15
|
+
<span class="ui-pagehead-kicker">404</span>
|
|
16
|
+
<h1>{$('This page does not exist')}</h1>
|
|
17
|
+
<p>{guide ? (tw ? '試著搜尋文件,或返回 Guide 繼續閱讀。' : 'Try searching the documentation or return to the Guide.') : (tw ? '試著搜尋網站,或返回首頁。' : 'Try searching the site or return to the homepage.')}</p>
|
|
18
|
+
</div>
|
|
19
|
+
<SearchButton client:load class="ui-search-trigger" />
|
|
20
|
+
<Link href={guide ? "/guide" : "/"} class="ui-button" data-variant="quiet">{guide ? (tw ? '瀏覽 Guide' : 'Browse the Guide') : (tw ? '返回首頁' : 'Back to home')}<span aria-hidden="true">→</span></Link>
|
|
21
|
+
</main>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
import clsx from 'clsx'
|
|
3
|
+
import Link from './Link.svelte'
|
|
4
|
+
import type { DefinedMetadata } from '../types/Metadata'
|
|
5
|
+
import { siteOf } from '../../astro/site-context'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** The pages to link, such as a category's `pages`. */
|
|
9
|
+
pages: DefinedMetadata[]
|
|
10
|
+
class?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { pages, class: className } = Astro.props
|
|
14
|
+
const { t: $, locale } = siteOf(Astro)
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<section class={clsx(className, 'mt-md@layer(defaults) grid-cols(1) bl-solid bl(1) bt-solid bt(1) bl-line-subtle bt-line-subtle grid-cols(2)@sm grid-cols(3)@lg')}>{
|
|
18
|
+
pages.map((definedMetadata: DefinedMetadata) =>
|
|
19
|
+
<Link
|
|
20
|
+
class={clsx(
|
|
21
|
+
'flex-col items-start! justify-between! p-xl bb-solid bb(1) br-solid br(1) bb-line-subtle br-line-subtle text-left (transition-duration:var(--duration-normal)) (transition-property:background-color) bg-surface-raised:hover',
|
|
22
|
+
{
|
|
23
|
+
'disabled': definedMetadata.disabled
|
|
24
|
+
}
|
|
25
|
+
)}
|
|
26
|
+
href={definedMetadata.pathname}
|
|
27
|
+
disabled={definedMetadata.disabled}
|
|
28
|
+
rel="noreferrer noopener">
|
|
29
|
+
<div class={clsx('font-md leading-md (word-break:break-all)')}>
|
|
30
|
+
{$(((definedMetadata.title as any)?.absolute || definedMetadata.title) as string)}
|
|
31
|
+
{definedMetadata.type === 'entity' && locale !== 'en' && typeof definedMetadata.title === 'string' && <span class="(margin-left:.25em)" translate="no">{definedMetadata.title}</span>}
|
|
32
|
+
</div>
|
|
33
|
+
{definedMetadata.description && <div class="clamp-lines(2) mt-3xs text-xs font-regular fg-text-muted">{definedMetadata.description as string}</div>}
|
|
34
|
+
</Link>
|
|
35
|
+
)
|
|
36
|
+
}</section>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { resolveCommand } from 'package-manager-detector/commands'
|
|
3
|
+
import CodeTabs from './CodeTabs.astro'
|
|
4
|
+
import { slotText } from '../utils/slot-text'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
action?: string
|
|
8
|
+
/** The package or arguments; text children work too. */
|
|
9
|
+
code?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** One command for every package manager, as `ui-code` tabs that share the reader's choice. */
|
|
13
|
+
const { action = 'install', code: source } = Astro.props
|
|
14
|
+
const code = source ?? await slotText(Astro.slots) ?? ''
|
|
15
|
+
const tabs = ['npm', 'pnpm', 'bun', 'yarn'].map((pm) => {
|
|
16
|
+
const resolvedCommand = resolveCommand(pm as any, action as any, [code])
|
|
17
|
+
return {
|
|
18
|
+
name: pm,
|
|
19
|
+
lang: 'bash',
|
|
20
|
+
code: resolvedCommand ? resolvedCommand.command + ' ' + resolvedCommand.args.join(' ') : `${pm} ${action} ${code}`
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<CodeTabs localStorageKey="pm" tabs={tabs} />
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getColorHex } from '../data/color-palette'
|
|
3
|
+
import Link from './Link.svelte'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
repo?: string
|
|
7
|
+
npm?: string
|
|
8
|
+
source?: string
|
|
9
|
+
translate?: (text: string) => string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { repo, npm, source, translate = (text: string) => text } = Astro.props
|
|
13
|
+
const lightBg = getColorHex('neutral', 5)
|
|
14
|
+
const lightFg = getColorHex('neutral', 50)
|
|
15
|
+
const darkBg = getColorHex('neutral', 80)
|
|
16
|
+
const darkFg = getColorHex('neutral', 40)
|
|
17
|
+
const lightQ = `color=${lightBg}&logoColor=${lightFg}&style=for-the-badge`
|
|
18
|
+
const darkQ = `color=${darkBg}&logoColor=${darkFg}&style=for-the-badge`
|
|
19
|
+
const $ = translate
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<div class="flex gap-xs min-h(28) mt-md">
|
|
23
|
+
{repo && <Link aria-label={$('GitHub release (latest by date including pre-releases)')} href={`https://github.com/${repo}/releases`}>
|
|
24
|
+
<img class="hidden@apply(--site-dark) r-sm" alt={$('GitHub release (latest by date including pre-releases)')} src={`https://img.shields.io/github/v/release/${repo}?${lightQ}&label=%20&logo=github&include_prereleases`} />
|
|
25
|
+
<img class="hidden@apply(--site-light) r-sm" alt={$('GitHub release (latest by date including pre-releases)')} src={`https://img.shields.io/github/v/release/${repo}?${darkQ}&label=%20&logo=github&include_prereleases`} />
|
|
26
|
+
</Link>}
|
|
27
|
+
{npm && <Link aria-label={$('NPM package')} href={`https://www.npmjs.com/package/${npm}`}>
|
|
28
|
+
<img class="hidden@apply(--site-dark) r-sm" alt={$('NPM package (download/month)')} src={`https://img.shields.io/npm/dm/${npm}?${lightQ}&label=%20&logo=npm`} />
|
|
29
|
+
<img class="hidden@apply(--site-light) r-sm" alt={$('NPM package (download/month)')} src={`https://img.shields.io/npm/dm/${npm}?${darkQ}&label=%20&logo=npm`} />
|
|
30
|
+
</Link>}
|
|
31
|
+
{npm && <Link aria-label={$('NPM package size (gzipped size)')} href={`https://www.npmjs.com/package/${npm}`}>
|
|
32
|
+
<img class="hidden@apply(--site-dark) r-sm" alt={$('NPM package size (gzipped size)')} src={`https://img.shields.io/bundlephobia/minzip/${npm}?${lightQ}&label=%20&logo=npm`} />
|
|
33
|
+
<img class="hidden@apply(--site-light) r-sm" alt={$('NPM package size (gzipped size)')} src={`https://img.shields.io/bundlephobia/minzip/${npm}?${darkQ}&label=%20&logo=npm`} />
|
|
34
|
+
</Link>}
|
|
35
|
+
{source && <Link aria-label={$('Source code')} href={source}>
|
|
36
|
+
<img class="hidden@apply(--site-dark) r-sm" alt={$('Source code')} src={`https://img.shields.io/badge/Source-${lightBg}?${lightQ}&label=%20`} />
|
|
37
|
+
<img class="hidden@apply(--site-light) r-sm" alt={$('Source code')} src={`https://img.shields.io/badge/Source-${darkBg}?${darkQ}&label=%20`} />
|
|
38
|
+
</Link>}
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '../../styles/docs-shell/page-content.css'
|
|
3
|
+
import Link from './Link.svelte'
|
|
4
|
+
import app from 'virtual:master-site/app'
|
|
5
|
+
import PageContentProvider from './PageContentProvider.svelte'
|
|
6
|
+
import PageContentList from './PageContentList.svelte'
|
|
7
|
+
import type { PageContentItem } from './page-content.svelte'
|
|
8
|
+
import { getSite } from '../site'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
/** The page's contents; the rail owns their provider, so the list and its live mark hydrate as one island. */
|
|
12
|
+
items: PageContentItem[]
|
|
13
|
+
metadata: any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The documentation rail (`ui-toc`): the page's contents and the source links. The rail stands still;
|
|
18
|
+
* a list taller than the window scrolls inside it, so the source links stay in view under it.
|
|
19
|
+
*/
|
|
20
|
+
let { items, metadata }: Props = $props()
|
|
21
|
+
const { t } = getSite()
|
|
22
|
+
let list = $state<HTMLOListElement>()
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<nav aria-labelledby="page-content-label" class="ui-toc" data-rail="">
|
|
26
|
+
<h4 id="page-content-label">{t('On this page')}</h4>
|
|
27
|
+
<PageContentProvider {items}>
|
|
28
|
+
<PageContentList bind:element={list} scrollContainer={list} />
|
|
29
|
+
</PageContentProvider>
|
|
30
|
+
<div class="ui-toc-actions">
|
|
31
|
+
{#if app.sourceBaseURL && metadata.sourcePath}<Link href={`${app.sourceBaseURL}${encodeURI(metadata.sourcePath)}`} indicate>
|
|
32
|
+
{t('Edit this page')}
|
|
33
|
+
</Link>{/if}
|
|
34
|
+
{#if app.feedbackURL}<Link href={app.feedbackURL} indicate>
|
|
35
|
+
{t('Issue on this page')}
|
|
36
|
+
</Link>{/if}
|
|
37
|
+
</div>
|
|
38
|
+
</nav>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PageContentItem } from './page-content.svelte'
|
|
3
|
+
import { pageContentBootstrapScript } from './page-content-bootstrap'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
items: PageContentItem[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Marks the doc-page active state while the document parses, before islands hydrate. */
|
|
10
|
+
const script = pageContentBootstrapScript(Astro.props.items)
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<script is:inline data-page-content-bootstrap id="page-content-bootstrap" set:html={script} />
|