@master/internal-site 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/astro.d.mts +3 -0
- package/dist/astro.mjs +510 -0
- package/dist/config.d.mts +64 -0
- package/dist/config.mjs +10 -0
- package/package.json +384 -4
- package/src/astro/Page.astro +12 -0
- package/src/astro/content-pages.ts +75 -0
- package/src/astro/index.ts +124 -0
- package/src/astro/module-id.ts +4 -0
- package/src/astro/propagated-assets.ts +29 -0
- package/src/astro/route-paths.ts +78 -0
- package/src/astro/routes.template.ts +110 -0
- package/src/astro/server-styles.ts +26 -0
- package/src/astro/site-context.ts +27 -0
- package/src/astro/source-url.ts +22 -0
- package/src/astro/svelte-renderer.ts +45 -0
- package/src/astro/svg-markup.ts +23 -0
- package/src/benchmarks/BenchmarkBarRows.astro +34 -0
- package/src/benchmarks/BenchmarkBars.astro +14 -0
- package/src/benchmarks/BenchmarkChart.astro +53 -0
- package/src/benchmarks/BenchmarkChartGroup.astro +24 -0
- package/src/benchmarks/BenchmarkDataTable.astro +24 -0
- package/src/benchmarks/BenchmarkDelta.astro +23 -0
- package/src/benchmarks/BenchmarkFigure.astro +30 -0
- package/src/benchmarks/BenchmarkMetricTable.astro +38 -0
- package/src/benchmarks/BenchmarkMetrics.astro +23 -0
- package/src/benchmarks/BenchmarkSampleSummary.astro +30 -0
- package/src/benchmarks/BenchmarkScrollRegion.svelte +27 -0
- package/src/benchmarks/BenchmarkSource.astro +20 -0
- package/src/benchmarks/BenchmarkStackedBars.astro +54 -0
- package/src/benchmarks/BenchmarkStatus.astro +16 -0
- package/src/benchmarks/types.ts +98 -0
- package/src/benchmarks/utils.ts +42 -0
- package/src/blog/BlogAuthors.astro +25 -0
- package/src/blog/article/BlogArticleContents.svelte +24 -0
- package/src/blog/article/BlogArticleEnd.astro +55 -0
- package/src/blog/article/BlogArticleMasthead.astro +61 -0
- package/src/blog/article/language.ts +29 -0
- package/src/blog/article/neighbors.ts +27 -0
- package/src/blog/article/title-lines.astro +14 -0
- package/src/blog/article/title-parts.ts +9 -0
- package/src/components.d.ts +5 -0
- package/src/config.ts +66 -0
- package/src/css/ButtonPreview.astro +22 -0
- package/src/css/ConfiguredExample.astro +15 -0
- package/src/css/NamespaceUtilityTable.astro +50 -0
- package/src/css/StylesheetExample.astro +15 -0
- package/src/css/ThemeNumberVariableTable.astro +57 -0
- package/src/css/configured-example.ts +53 -0
- package/src/css/foundation-data/elevation/shadow-data.ts +52 -0
- package/src/css/foundation-data/sizing/scale-data.ts +37 -0
- package/src/css/foundation-data/specimen-content.ts +10 -0
- package/src/css/foundation-data/specimens.ts +96 -0
- package/src/css/foundation-data/tokens.ts +32 -0
- package/src/css/generate-preset-css.ts +12 -0
- package/src/css/highlight.ts +34 -0
- package/src/css/manifest-utilities.ts +29 -0
- package/src/css/markdown.ts +279 -0
- package/src/css/preset-css.ts +15 -0
- package/src/css/preset-manifest.ts +3 -0
- package/src/css/stylesheet-example.ts +26 -0
- package/src/css/theme-variables.ts +74 -0
- package/src/css/variable-namespace-sources.ts +20 -0
- package/src/demo/Demo.svelte +55 -0
- package/src/demo/DemoAsset.astro +38 -0
- package/src/demo/DemoAxes.svelte +22 -0
- package/src/demo/DemoBadge.svelte +18 -0
- package/src/demo/DemoCatalog.astro +36 -0
- package/src/demo/DemoComparison.svelte +36 -0
- package/src/demo/DemoConfiguredExample.astro +48 -0
- package/src/demo/DemoContainer.svelte +48 -0
- package/src/demo/DemoControls.svelte +16 -0
- package/src/demo/DemoCopyButton.svelte +50 -0
- package/src/demo/DemoCopyGroup.svelte +15 -0
- package/src/demo/DemoExample.astro +27 -0
- package/src/demo/DemoFeatureSupport.svelte +18 -0
- package/src/demo/DemoGeneratedCSS.svelte +8 -0
- package/src/demo/DemoIndex.astro +23 -0
- package/src/demo/DemoInstallation.astro +17 -0
- package/src/demo/DemoItem.svelte +17 -0
- package/src/demo/DemoLabel.svelte +15 -0
- package/src/demo/DemoLegend.svelte +15 -0
- package/src/demo/DemoMeasure.svelte +28 -0
- package/src/demo/DemoMedia.svelte +43 -0
- package/src/demo/DemoMotion.svelte +41 -0
- package/src/demo/DemoPageViewport.astro +17 -0
- package/src/demo/DemoPalette.astro +29 -0
- package/src/demo/DemoPaletteGroups.svelte +15 -0
- package/src/demo/DemoScrollArea.svelte +15 -0
- package/src/demo/DemoStyleComparison.astro +25 -0
- package/src/demo/DemoSurface.svelte +15 -0
- package/src/demo/DemoSwatch.svelte +19 -0
- package/src/demo/DemoThemeComparison.astro +30 -0
- package/src/demo/DemoTokenTable.astro +34 -0
- package/src/demo/DemoViewTransition.astro +18 -0
- package/src/demo/DemoViewport.svelte +324 -0
- package/src/demo/DemoWaterfall.astro +30 -0
- package/src/demo/FoundationBreakpoint.astro +12 -0
- package/src/demo/ProjectStyleExample.astro +13 -0
- package/src/demo/copy-feedback.ts +10 -0
- package/src/demo/demo-waterfall.ts +17 -0
- package/src/demo/drag-readings.ts +20 -0
- package/src/demo/foundations/FoundationAxes.astro +12 -0
- package/src/demo/foundations/FoundationColorRoles.astro +5 -0
- package/src/demo/foundations/FoundationContainerGrid.astro +24 -0
- package/src/demo/foundations/FoundationDialog.astro +14 -0
- package/src/demo/foundations/FoundationElevation.astro +5 -0
- package/src/demo/foundations/FoundationElevationState.astro +5 -0
- package/src/demo/foundations/FoundationHue.astro +5 -0
- package/src/demo/foundations/FoundationLines.astro +5 -0
- package/src/demo/foundations/FoundationMedia.astro +28 -0
- package/src/demo/foundations/FoundationMotion.astro +5 -0
- package/src/demo/foundations/FoundationPalette.astro +8 -0
- package/src/demo/foundations/FoundationRadius.astro +13 -0
- package/src/demo/foundations/FoundationShapes.astro +12 -0
- package/src/demo/foundations/FoundationShrink.astro +14 -0
- package/src/demo/foundations/FoundationSizing.astro +19 -0
- package/src/demo/foundations/FoundationSpecimen.astro +20 -0
- package/src/demo/foundations/FoundationSurfaces.astro +5 -0
- package/src/demo/foundations/FoundationTextHue.astro +5 -0
- package/src/demo/foundations/FoundationTextRoles.astro +5 -0
- package/src/demo/foundations/FoundationTokens.astro +22 -0
- package/src/demo/foundations/FoundationTokensView.astro +65 -0
- package/src/demo/foundations/FoundationTransition.astro +5 -0
- package/src/demo/foundations/FoundationTypeComparison.astro +12 -0
- package/src/demo/foundations/FoundationTypography.astro +5 -0
- package/src/demo/foundations/Palette.svelte +37 -0
- package/src/demo/foundations/ShadowScaleDemo.astro +22 -0
- package/src/demo/illustration-materials.ts +180 -0
- package/src/demo/maintenance-example.ts +62 -0
- package/src/demo/playback.ts +75 -0
- package/src/demo/project-style-examples.ts +128 -0
- package/src/demo/reference/alignment.ts +42 -0
- package/src/demo/reference/animations.ts +30 -0
- package/src/demo/reference/backgrounds.ts +39 -0
- package/src/demo/reference/border-paint.ts +31 -0
- package/src/demo/reference/clipping.ts +26 -0
- package/src/demo/reference/document.ts +55 -0
- package/src/demo/reference/edges.ts +40 -0
- package/src/demo/reference/effects.ts +27 -0
- package/src/demo/reference/flexbox.ts +33 -0
- package/src/demo/reference/frame.css +118 -0
- package/src/demo/reference/grid.ts +42 -0
- package/src/demo/reference/html.ts +40 -0
- package/src/demo/reference/interaction.ts +42 -0
- package/src/demo/reference/layout-html.ts +10 -0
- package/src/demo/reference/layout.ts +102 -0
- package/src/demo/reference/media.ts +29 -0
- package/src/demo/reference/positioning.ts +90 -0
- package/src/demo/reference/scenes.ts +197 -0
- package/src/demo/reference/scrolling.ts +66 -0
- package/src/demo/reference/shapes.ts +22 -0
- package/src/demo/reference/sizing.ts +43 -0
- package/src/demo/reference/source.ts +8 -0
- package/src/demo/reference/text-effects.ts +37 -0
- package/src/demo/reference/text-flow.ts +41 -0
- package/src/demo/reference/transforms.ts +26 -0
- package/src/demo/reference/transitions.ts +24 -0
- package/src/demo/reference/type-specimens.ts +56 -0
- package/src/demo/reference/types.ts +30 -0
- package/src/demo/reference/typography.ts +32 -0
- package/src/demo/specimens/accent-color.json +50 -0
- package/src/demo/specimens/align-items.json +56 -0
- package/src/demo/specimens/animation-delay.json +55 -0
- package/src/demo/specimens/animation-direction.json +49 -0
- package/src/demo/specimens/animation-fill-mode.json +55 -0
- package/src/demo/specimens/animation-iteration-count.json +55 -0
- package/src/demo/specimens/animation-play-state.json +83 -0
- package/src/demo/specimens/animation-timing-function.json +48 -0
- package/src/demo/specimens/appearance.json +44 -0
- package/src/demo/specimens/aspect-ratio.json +28 -0
- package/src/demo/specimens/backdrop-filter.json +44 -0
- package/src/demo/specimens/background-attachment.json +49 -0
- package/src/demo/specimens/background-image.json +25 -0
- package/src/demo/specimens/background-origin.json +36 -0
- package/src/demo/specimens/background-size.json +29 -0
- package/src/demo/specimens/border-collapse.json +45 -0
- package/src/demo/specimens/border-color.json +35 -0
- package/src/demo/specimens/border-image-repeat.json +50 -0
- package/src/demo/specimens/border-image-slice.json +45 -0
- package/src/demo/specimens/border-radius.json +30 -0
- package/src/demo/specimens/box-decoration-break.json +35 -0
- package/src/demo/specimens/box-shadow.json +33 -0
- package/src/demo/specimens/clear.json +77 -0
- package/src/demo/specimens/clip-path.json +38 -0
- package/src/demo/specimens/content.json +27 -0
- package/src/demo/specimens/counter-set.json +31 -0
- package/src/demo/specimens/fill.json +23 -0
- package/src/demo/specimens/filter.json +23 -0
- package/src/demo/specimens/flex-direction.json +27 -0
- package/src/demo/specimens/flex-grow.json +27 -0
- package/src/demo/specimens/font-style.json +23 -0
- package/src/demo/specimens/font-variant-numeric.json +28 -0
- package/src/demo/specimens/grid-auto-columns.json +29 -0
- package/src/demo/specimens/grid-auto-flow.json +37 -0
- package/src/demo/specimens/grid-template-areas.json +34 -0
- package/src/demo/specimens/grid-template-columns.json +36 -0
- package/src/demo/specimens/isolation.json +25 -0
- package/src/demo/specimens/justify-content.json +36 -0
- package/src/demo/specimens/line-height.json +28 -0
- package/src/demo/specimens/list-style-position.json +36 -0
- package/src/demo/specimens/mask-image.json +54 -0
- package/src/demo/specimens/min-width.json +39 -0
- package/src/demo/specimens/mix-blend-mode.json +43 -0
- package/src/demo/specimens/object-fit.json +27 -0
- package/src/demo/specimens/object-position.json +27 -0
- package/src/demo/specimens/opacity.json +37 -0
- package/src/demo/specimens/order.json +28 -0
- package/src/demo/specimens/overflow-wrap.json +26 -0
- package/src/demo/specimens/overflow.json +53 -0
- package/src/demo/specimens/overscroll-behavior.json +29 -0
- package/src/demo/specimens/padding.json +84 -0
- package/src/demo/specimens/place-content.json +31 -0
- package/src/demo/specimens/pointer-events.json +46 -0
- package/src/demo/specimens/position.json +29 -0
- package/src/demo/specimens/resize.json +32 -0
- package/src/demo/specimens/screen-readers.json +37 -0
- package/src/demo/specimens/scroll-padding.json +29 -0
- package/src/demo/specimens/scroll-snap-stop.json +33 -0
- package/src/demo/specimens/shape-image-threshold.json +37 -0
- package/src/demo/specimens/shape-margin.json +40 -0
- package/src/demo/specimens/shape-outside.json +37 -0
- package/src/demo/specimens/stroke-width.json +27 -0
- package/src/demo/specimens/text-fill-color.json +23 -0
- package/src/demo/specimens/text-stroke-width.json +32 -0
- package/src/demo/specimens/touch-action.json +45 -0
- package/src/demo/specimens/transform-box.json +37 -0
- package/src/demo/specimens/transform-origin.json +56 -0
- package/src/demo/specimens/transform-style.json +55 -0
- package/src/demo/specimens/transform.json +47 -0
- package/src/demo/specimens/transition-delay.json +57 -0
- package/src/demo/specimens/transition-duration.json +60 -0
- package/src/demo/specimens/transition-property.json +60 -0
- package/src/demo/specimens/transition-timing-function.json +65 -0
- package/src/demo/specimens/user-drag.json +28 -0
- package/src/demo/specimens/user-select.json +25 -0
- package/src/demo/specimens/vertical-align.json +28 -0
- package/src/demo/specimens/width.json +56 -0
- package/src/demo/specimens/will-change.json +50 -0
- package/src/demo/specimens/writing-mode.json +26 -0
- package/src/demo/specimens/z-index.json +35 -0
- package/src/demo/style.ts +15 -0
- package/src/demo/tone.ts +4 -0
- package/src/demo/useDemoViewTransition.svelte.ts +71 -0
- package/src/docs-shell/common/i18n.config.d.ts +2 -0
- package/src/docs-shell/common/i18n.config.js +13 -0
- package/src/docs-shell/common/svgo.config.d.ts +2 -0
- package/src/docs-shell/common/svgo.config.js +11 -0
- package/src/docs-shell/components/ArticleHeader.astro +65 -0
- package/src/docs-shell/components/ArticleTOC.astro +18 -0
- package/src/docs-shell/components/Callout.astro +26 -0
- package/src/docs-shell/components/Code.astro +25 -0
- package/src/docs-shell/components/CodeCopyButton.astro +25 -0
- package/src/docs-shell/components/CodeTabBar.astro +40 -0
- package/src/docs-shell/components/CodeTabs.astro +53 -0
- package/src/docs-shell/components/CodeView.astro +23 -0
- package/src/docs-shell/components/Do.astro +5 -0
- package/src/docs-shell/components/DoNot.astro +5 -0
- package/src/docs-shell/components/DocArticle.astro +14 -0
- package/src/docs-shell/components/DocHeader.svelte +87 -0
- package/src/docs-shell/components/DocHeading.astro +28 -0
- package/src/docs-shell/components/DocMain.astro +19 -0
- package/src/docs-shell/components/DocMenuButton.svelte +95 -0
- package/src/docs-shell/components/DocSidebar.svelte +62 -0
- package/src/docs-shell/components/DocVersionSelect.svelte +22 -0
- package/src/docs-shell/components/DocWrapper.astro +11 -0
- package/src/docs-shell/components/DocumentAPIIndex.astro +24 -0
- package/src/docs-shell/components/DocumentChoices.astro +24 -0
- package/src/docs-shell/components/DocumentCodeExample.astro +20 -0
- package/src/docs-shell/components/DocumentCodeExampleView.astro +35 -0
- package/src/docs-shell/components/DocumentCodeTable.astro +19 -0
- package/src/docs-shell/components/DocumentComparison.astro +7 -0
- package/src/docs-shell/components/DocumentCopyButton.svelte +41 -0
- package/src/docs-shell/components/DocumentDeclaration.astro +17 -0
- package/src/docs-shell/components/DocumentDeclarationView.astro +12 -0
- package/src/docs-shell/components/DocumentDisclosure.astro +14 -0
- package/src/docs-shell/components/DocumentFileTree.astro +34 -0
- package/src/docs-shell/components/DocumentFlow.astro +27 -0
- package/src/docs-shell/components/DocumentIdentifier.astro +14 -0
- package/src/docs-shell/components/DocumentIllustration.astro +46 -0
- package/src/docs-shell/components/DocumentKeyList.astro +22 -0
- package/src/docs-shell/components/DocumentNamespaceTable.astro +20 -0
- package/src/docs-shell/components/DocumentOptionEntry.astro +15 -0
- package/src/docs-shell/components/DocumentOptionList.astro +11 -0
- package/src/docs-shell/components/DocumentOptions.astro +23 -0
- package/src/docs-shell/components/DocumentParameters.astro +30 -0
- package/src/docs-shell/components/DocumentPrompt.astro +16 -0
- package/src/docs-shell/components/DocumentValueList.astro +25 -0
- package/src/docs-shell/components/DocumentationIndex.svelte +144 -0
- package/src/docs-shell/components/Dropped.astro +21 -0
- package/src/docs-shell/components/ExpandContent.svelte +21 -0
- package/src/docs-shell/components/ExplorerView.astro +37 -0
- package/src/docs-shell/components/FileIcon.astro +123 -0
- package/src/docs-shell/components/Footer.svelte +80 -0
- package/src/docs-shell/components/GeneratedCSS.astro +8 -0
- package/src/docs-shell/components/Header.svelte +121 -0
- package/src/docs-shell/components/HeaderIcon.astro +14 -0
- package/src/docs-shell/components/HeaderNav.svelte +18 -0
- package/src/docs-shell/components/Image.svelte +56 -0
- package/src/docs-shell/components/Info.astro +5 -0
- package/src/docs-shell/components/InlineCode.astro +30 -0
- package/src/docs-shell/components/InteractingIndicator.astro +19 -0
- package/src/docs-shell/components/LanguageButton.svelte +18 -0
- package/src/docs-shell/components/LanguageSelect.svelte +44 -0
- package/src/docs-shell/components/Link.svelte +127 -0
- package/src/docs-shell/components/ModeImg.astro +11 -0
- package/src/docs-shell/components/NotFound.astro +21 -0
- package/src/docs-shell/components/OverviewButtons.astro +36 -0
- package/src/docs-shell/components/PMAction.astro +25 -0
- package/src/docs-shell/components/PackageBadges.astro +39 -0
- package/src/docs-shell/components/PageContent.svelte +38 -0
- package/src/docs-shell/components/PageContentBootstrap.astro +13 -0
- package/src/docs-shell/components/PageContentDisclosure.astro +25 -0
- package/src/docs-shell/components/PageContentList.svelte +70 -0
- package/src/docs-shell/components/PageContentProvider.svelte +15 -0
- package/src/docs-shell/components/PageContentTitle.svelte +16 -0
- package/src/docs-shell/components/PageNavs.astro +40 -0
- package/src/docs-shell/components/PreparedCodeView.astro +12 -0
- package/src/docs-shell/components/RenderNode.astro +16 -0
- package/src/docs-shell/components/RouteLayers.astro +17 -0
- package/src/docs-shell/components/SearchButton.svelte +31 -0
- package/src/docs-shell/components/SearchDialog.svelte +174 -0
- package/src/docs-shell/components/Segments.svelte +62 -0
- package/src/docs-shell/components/Step.astro +13 -0
- package/src/docs-shell/components/StepL.astro +10 -0
- package/src/docs-shell/components/StepR.astro +10 -0
- package/src/docs-shell/components/StepSection.astro +12 -0
- package/src/docs-shell/components/Tab.astro +8 -0
- package/src/docs-shell/components/Tabs.astro +10 -0
- package/src/docs-shell/components/ThemeIcon.astro +19 -0
- package/src/docs-shell/components/ThemeSelect.svelte +20 -0
- package/src/docs-shell/components/TimeAgo.svelte +32 -0
- package/src/docs-shell/components/Translate.astro +14 -0
- package/src/docs-shell/components/Warn.astro +5 -0
- package/src/docs-shell/components/code-props.ts +28 -0
- package/src/docs-shell/components/document-types.ts +119 -0
- package/src/docs-shell/components/markdown/Anchor.astro +5 -0
- package/src/docs-shell/components/markdown/Heading2.astro +5 -0
- package/src/docs-shell/components/markdown/Heading3.astro +5 -0
- package/src/docs-shell/components/markdown/Table.astro +6 -0
- package/src/docs-shell/components/markdown-components.ts +36 -0
- package/src/docs-shell/components/page-content-bootstrap.ts +115 -0
- package/src/docs-shell/components/page-content.svelte.ts +125 -0
- package/src/docs-shell/contexts/search.ts +18 -0
- package/src/docs-shell/contexts/theme-mode.svelte.ts +61 -0
- package/src/docs-shell/data/authors.ts +17 -0
- package/src/docs-shell/data/base-colors.ts +29 -0
- package/src/docs-shell/data/brands.ts +79 -0
- package/src/docs-shell/data/color-names.ts +1 -0
- package/src/docs-shell/data/color-palette.ts +50 -0
- package/src/docs-shell/data/colors.ts +1 -0
- package/src/docs-shell/factories/Page.astro +35 -0
- package/src/docs-shell/factories/create-page.ts +31 -0
- package/src/docs-shell/layouts/BlogArticle.astro +53 -0
- package/src/docs-shell/layouts/Doc.astro +41 -0
- package/src/docs-shell/remark/markdown-components.d.ts +2 -0
- package/src/docs-shell/remark/markdown-components.js +101 -0
- package/src/docs-shell/remark/slug-and-toc.d.ts +2 -0
- package/src/docs-shell/remark/slug-and-toc.js +53 -0
- package/src/docs-shell/scripts/code-tabs-bootstrap.ts +34 -0
- package/src/docs-shell/scripts/code.ts +124 -0
- package/src/docs-shell/scripts/document-anchor.ts +57 -0
- package/src/docs-shell/scripts/document.ts +47 -0
- package/src/docs-shell/site.ts +67 -0
- package/src/docs-shell/types/IllustrationImages.ts +2 -0
- package/src/docs-shell/types/Metadata.ts +17 -0
- package/src/docs-shell/types/Props.ts +9 -0
- package/src/docs-shell/types/StaticImage.ts +6 -0
- package/src/docs-shell/uses/use-selected-preview-syntax.svelte.ts +16 -0
- package/src/docs-shell/utils/anchor.ts +24 -0
- package/src/docs-shell/utils/beautify-css.ts +14 -0
- package/src/docs-shell/utils/beautify-html.ts +12 -0
- package/src/docs-shell/utils/beautify-js.ts +9 -0
- package/src/docs-shell/utils/create-highlighter.ts +50 -0
- package/src/docs-shell/utils/css-modern-grammar.ts +339 -0
- package/src/docs-shell/utils/documentation-search.ts +68 -0
- package/src/docs-shell/utils/generate-metadata.ts +60 -0
- package/src/docs-shell/utils/group-page-content.ts +10 -0
- package/src/docs-shell/utils/head.ts +72 -0
- package/src/docs-shell/utils/highlight-code-core.ts +146 -0
- package/src/docs-shell/utils/highlight-code.ts +1 -0
- package/src/docs-shell/utils/highlighted-code-text.ts +27 -0
- package/src/docs-shell/utils/i18n-pathname.ts +98 -0
- package/src/docs-shell/utils/i18n.ts +12 -0
- package/src/docs-shell/utils/is-date-within-seven-days.ts +16 -0
- package/src/docs-shell/utils/isBrowser.ts +1 -0
- package/src/docs-shell/utils/isInteractOutside.ts +16 -0
- package/src/docs-shell/utils/markdown-tree.ts +22 -0
- package/src/docs-shell/utils/metadata.ts +25 -0
- package/src/docs-shell/utils/prepared-code.ts +21 -0
- package/src/docs-shell/utils/resolve-heading.d.ts +1 -0
- package/src/docs-shell/utils/resolve-heading.js +19 -0
- package/src/docs-shell/utils/search-pages.ts +271 -0
- package/src/docs-shell/utils/slot-text.ts +15 -0
- package/src/docs-shell/utils/snackbar.ts +39 -0
- package/src/docs-shell/utils/syntax-theme.ts +53 -0
- package/src/docs-shell/utils/transformer-notation-word-mark.ts +146 -0
- package/src/docs-shell/utils/unique-id.ts +11 -0
- package/src/examples/article-transitions/page.astro +7 -0
- package/src/examples/article-transitions/transitions.css +10 -0
- package/src/examples/components/ArticleTransitionScene.svelte +83 -0
- package/src/examples/components/ViewTransitionScene.svelte +31 -0
- package/src/examples/images/article-aurora.jpg +0 -0
- package/src/examples/images/article-coast.jpg +0 -0
- package/src/examples/images/article-grid.jpg +0 -0
- package/src/examples/images/article-studio.jpg +0 -0
- package/src/examples/layout-system/page.astro +59 -0
- package/src/examples/scene.css +3 -0
- package/src/examples/view-transitions/page.astro +7 -0
- package/src/examples/view-transitions/transitions.css +9 -0
- package/src/home/HeroCanvas.svelte +617 -0
- package/src/home/HomeAction.astro +17 -0
- package/src/home/HomeBentoFrame.astro +9 -0
- package/src/home/HomeBentoGrid.astro +9 -0
- package/src/home/HomeCompactIcon.astro +15 -0
- package/src/home/HomeFooter.svelte +63 -0
- package/src/home/HomeIllustration.astro +17 -0
- package/src/home/HomeIllustrationArt.svelte +15 -0
- package/src/home/HomeLamp.svelte +18 -0
- package/src/home/design.css +532 -0
- package/src/home/footer.css +225 -0
- package/src/home/hero-shaders.ts +460 -0
- package/src/home/hero-title-mask.ts +175 -0
- package/src/home/hero.css +547 -0
- package/src/home/home-illustration.ts +5 -0
- package/src/home/home-lamp.ts +225 -0
- package/src/home/home.css +1077 -0
- package/src/home/icons/agent-check-preview-apply.svg +24 -0
- package/src/home/icons/agent-clients.svg +26 -0
- package/src/home/icons/agent-project-tools.svg +23 -0
- package/src/home/icons/artwork/agent-check-preview-apply-dark.webp +0 -0
- package/src/home/icons/artwork/agent-check-preview-apply-light.webp +0 -0
- package/src/home/icons/artwork/agent-clients-dark.webp +0 -0
- package/src/home/icons/artwork/agent-clients-light.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-dark.webp +0 -0
- package/src/home/icons/artwork/agent-edit-file-light.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-dark.webp +0 -0
- package/src/home/icons/artwork/agent-project-tools-light.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-dark.webp +0 -0
- package/src/home/icons/artwork/design-cascade-layers-light.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-dark.webp +0 -0
- package/src/home/icons/artwork/design-layout-motion-light.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-dark.webp +0 -0
- package/src/home/icons/artwork/design-p3-gamut-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-modes-light.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/design-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-dark.webp +0 -0
- package/src/home/icons/artwork/editor-color-tools-light.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-dark.webp +0 -0
- package/src/home/icons/artwork/editor-focused-highlighting-light.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-dark.webp +0 -0
- package/src/home/icons/artwork/editor-hover-inspection-light.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-dark.webp +0 -0
- package/src/home/icons/artwork/editor-manifest-completions-light.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-dark.webp +0 -0
- package/src/home/icons/artwork/lint-class-order-light.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-conflicting-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-dark.webp +0 -0
- package/src/home/icons/artwork/lint-fix-previews-light.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-dark.webp +0 -0
- package/src/home/icons/artwork/lint-invalid-classes-light.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-dark.webp +0 -0
- package/src/home/icons/artwork/lint-strict-vocabulary-light.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-dark.webp +0 -0
- package/src/home/icons/artwork/lint-theme-tokens-light.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-apply-preview-light.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-css-compare-light.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-inspect-class-light.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-lint-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-manifest-query-light.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-preview-fixes-light.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-render-css-light.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-scan-project-light.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-dark.webp +0 -0
- package/src/home/icons/artwork/mcp-trace-class-light.webp +0 -0
- package/src/home/icons/artwork/render-progressive-dark.webp +0 -0
- package/src/home/icons/artwork/render-progressive-light.webp +0 -0
- package/src/home/icons/artwork/render-runtime-dark.webp +0 -0
- package/src/home/icons/artwork/render-runtime-light.webp +0 -0
- package/src/home/icons/artwork/render-static-dark.webp +0 -0
- package/src/home/icons/artwork/render-static-light.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-dark.webp +0 -0
- package/src/home/icons/artwork/section-ai-agents-light.webp +0 -0
- package/src/home/icons/artwork/section-css-size-dark.webp +0 -0
- package/src/home/icons/artwork/section-css-size-light.webp +0 -0
- package/src/home/icons/artwork/section-design-system-dark.webp +0 -0
- package/src/home/icons/artwork/section-design-system-light.webp +0 -0
- package/src/home/icons/artwork/section-editor-dark.webp +0 -0
- package/src/home/icons/artwork/section-editor-light.webp +0 -0
- package/src/home/icons/artwork/section-lint-dark.webp +0 -0
- package/src/home/icons/artwork/section-lint-light.webp +0 -0
- package/src/home/icons/artwork/section-rendering-dark.webp +0 -0
- package/src/home/icons/artwork/section-rendering-light.webp +0 -0
- package/src/home/icons/artwork/section-workflow-dark.webp +0 -0
- package/src/home/icons/artwork/section-workflow-light.webp +0 -0
- package/src/home/icons/artwork/source.json +303 -0
- package/src/home/icons/artwork/workflow-integrations-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-integrations-light.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-monorepo-light.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-route-styles-light.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-dark.webp +0 -0
- package/src/home/icons/artwork/workflow-trace-change-light.webp +0 -0
- package/src/home/icons/artwork.css +4 -0
- package/src/home/icons/artwork.ts +131 -0
- package/src/home/icons/catalog.ts +381 -0
- package/src/home/icons/design-cascade-layers.svg +32 -0
- package/src/home/icons/design-layout-motion.svg +16 -0
- package/src/home/icons/design-p3-gamut.svg +12 -0
- package/src/home/icons/design-theme-modes.svg +12 -0
- package/src/home/icons/design-theme-tokens.svg +20 -0
- package/src/home/icons/editor-color-tools.svg +18 -0
- package/src/home/icons/editor-focused-highlighting.svg +15 -0
- package/src/home/icons/editor-hover-inspection.svg +19 -0
- package/src/home/icons/editor-manifest-completions.svg +24 -0
- package/src/home/icons/lint-class-order-compact.svg +15 -0
- package/src/home/icons/lint-class-order.svg +28 -0
- package/src/home/icons/lint-conflicting-classes-compact.svg +11 -0
- package/src/home/icons/lint-conflicting-classes.svg +24 -0
- package/src/home/icons/lint-fix-previews-compact.svg +9 -0
- package/src/home/icons/lint-fix-previews.svg +19 -0
- package/src/home/icons/lint-invalid-classes-compact.svg +7 -0
- package/src/home/icons/lint-invalid-classes.svg +17 -0
- package/src/home/icons/lint-strict-vocabulary-compact.svg +8 -0
- package/src/home/icons/lint-strict-vocabulary.svg +16 -0
- package/src/home/icons/lint-theme-tokens-compact.svg +7 -0
- package/src/home/icons/lint-theme-tokens.svg +14 -0
- package/src/home/icons/mcp-apply-preview-compact.svg +9 -0
- package/src/home/icons/mcp-apply-preview.svg +18 -0
- package/src/home/icons/mcp-css-compare-compact.svg +9 -0
- package/src/home/icons/mcp-css-compare.svg +20 -0
- package/src/home/icons/mcp-inspect-class-compact.svg +9 -0
- package/src/home/icons/mcp-inspect-class.svg +18 -0
- package/src/home/icons/mcp-lint-project-compact.svg +14 -0
- package/src/home/icons/mcp-lint-project.svg +30 -0
- package/src/home/icons/mcp-manifest-query-compact.svg +14 -0
- package/src/home/icons/mcp-manifest-query.svg +27 -0
- package/src/home/icons/mcp-preview-fixes-compact.svg +9 -0
- package/src/home/icons/mcp-preview-fixes.svg +15 -0
- package/src/home/icons/mcp-render-css-compact.svg +13 -0
- package/src/home/icons/mcp-render-css.svg +30 -0
- package/src/home/icons/mcp-scan-project-compact.svg +7 -0
- package/src/home/icons/mcp-scan-project.svg +13 -0
- package/src/home/icons/mcp-trace-class-compact.svg +11 -0
- package/src/home/icons/mcp-trace-class.svg +24 -0
- package/src/home/icons/render-progressive.svg +17 -0
- package/src/home/icons/render-runtime.svg +23 -0
- package/src/home/icons/render-static.svg +29 -0
- package/src/home/icons/section-ai-agents.svg +24 -0
- package/src/home/icons/section-css-size.svg +13 -0
- package/src/home/icons/section-design-system.svg +24 -0
- package/src/home/icons/section-editor.svg +14 -0
- package/src/home/icons/section-lint.svg +14 -0
- package/src/home/icons/section-rendering.svg +30 -0
- package/src/home/icons/section-workflow.svg +22 -0
- package/src/home/icons/workflow-integrations.svg +15 -0
- package/src/home/icons/workflow-monorepo.svg +27 -0
- package/src/home/icons/workflow-route-styles.svg +24 -0
- package/src/home/icons/workflow-trace-change.svg +21 -0
- package/src/layouts/Document.astro +71 -0
- package/src/public/brand/v2/logo/mark/master-mark-small-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-dark.svg +1 -0
- package/src/public/brand/v2/logo/master-css/master-css-horizontal-on-light.svg +1 -0
- package/src/public/demo/border-grid.svg +7 -0
- package/src/public/demo/landscape.svg +1 -0
- package/src/public/demo/marker.svg +1 -0
- package/src/public/demo/mask.svg +1 -0
- package/src/public/fonts/Geist-Medium.ttf +0 -0
- package/src/public/fonts/Geist-Regular.ttf +0 -0
- package/src/public/fonts/GeistVariable.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Bold.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Medium.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-Regular.woff2 +0 -0
- package/src/public/fonts/IBMPlexMono-SemiBold.woff2 +0 -0
- package/src/public/fonts/index.css +40 -0
- package/src/public/icons/csharp.svg +1 -0
- package/src/public/icons/css.svg +1 -0
- package/src/public/icons/eslint.svg +1 -0
- package/src/public/icons/folder.svg +12 -0
- package/src/public/icons/html.svg +1 -0
- package/src/public/icons/php.svg +1 -0
- package/src/public/icons/sass.svg +1 -0
- package/src/public/icons/storybook.svg +1 -0
- package/src/public/icons/visualstudiocode.svg +41 -0
- package/src/public/images/authors/aron.jpg +0 -0
- package/src/public/images/authors/benseage.jpg +0 -0
- package/src/public/images/authors/joy.jpg +0 -0
- package/src/public/images/authors/lola.jpg +0 -0
- package/src/public/images/authors/miles.jpg +0 -0
- package/src/public/images/bootstrap.svg +23 -0
- package/src/public/images/build-tools/rsbuild.svg +1 -0
- package/src/public/images/build-tools/rspack.svg +1 -0
- package/src/public/images/build-tools/vite.svg +15 -0
- package/src/public/images/build-tools/webpack.svg +10 -0
- package/src/public/images/cdns/esm-sh.svg +1 -0
- package/src/public/images/chevron-left.svg +4 -0
- package/src/public/images/cover-bg.jpg +0 -0
- package/src/public/images/emotion.svg +1 -0
- package/src/public/images/frameworks/angular.svg +29 -0
- package/src/public/images/frameworks/astro.svg +4 -0
- package/src/public/images/frameworks/blazor.svg +22 -0
- package/src/public/images/frameworks/express.svg +1 -0
- package/src/public/images/frameworks/laravel.svg +8 -0
- package/src/public/images/frameworks/line-liff.svg +1 -0
- package/src/public/images/frameworks/lit.svg +1 -0
- package/src/public/images/frameworks/nextjs.svg +16 -0
- package/src/public/images/frameworks/nuxtjs.svg +3 -0
- package/src/public/images/frameworks/rails.svg +1 -0
- package/src/public/images/frameworks/react.svg +8 -0
- package/src/public/images/frameworks/remix.svg +5 -0
- package/src/public/images/frameworks/shopify.svg +1 -0
- package/src/public/images/frameworks/svelte.svg +6 -0
- package/src/public/images/frameworks/tanstack.svg +1 -0
- package/src/public/images/frameworks/vuejs.svg +11 -0
- package/src/public/images/frameworks/wordpress.svg +1 -0
- package/src/public/images/mui.svg +1 -0
- package/src/public/images/styled-components.svg +4 -0
- package/src/public/images/tailwindcss.svg +1 -0
- package/src/scripts/bundler-imports.ts +25 -0
- package/src/scripts/static-social.ts +333 -0
- package/src/scripts/write-if-changed.ts +26 -0
- package/src/sections/blog.astro +11 -0
- package/src/sections/design-system.astro +14 -0
- package/src/sections/document.astro +8 -0
- package/src/sections/examples.astro +6 -0
- package/src/sections/guide.astro +26 -0
- package/src/sections/home.astro +7 -0
- package/src/sections/page.astro +12 -0
- package/src/styles/base.css +57 -0
- package/src/styles/benchmarks.css +20 -0
- package/src/styles/blog-article.css +670 -0
- package/src/styles/blog-materials.css +399 -0
- package/src/styles/blog.css +568 -0
- package/src/styles/demo.css +30 -0
- package/src/styles/design-system.css +15 -0
- package/src/styles/docs-shell/code.css +61 -0
- package/src/styles/docs-shell/docs.css +79 -0
- package/src/styles/docs-shell/documentation-search.css +42 -0
- package/src/styles/docs-shell/footer.css +38 -0
- package/src/styles/docs-shell/header.css +69 -0
- package/src/styles/docs-shell/materials.css +25 -0
- package/src/styles/docs-shell/menu.css +19 -0
- package/src/styles/docs-shell/not-found.css +10 -0
- package/src/styles/docs-shell/page-content.css +37 -0
- package/src/styles/docs-shell/prose.css +89 -0
- package/src/styles/docs-shell/segments.css +13 -0
- package/src/styles/docs-shell/steps.css +39 -0
- package/src/styles/docs-shell/syntax-theme.css +18 -0
- package/src/styles/docs-shell/theme.css +68 -0
- package/src/styles/docs-shell/wrapper.css +10 -0
- package/src/styles/document-comparison.css +7 -0
- package/src/styles/documentation-illustration.css +34 -0
- package/src/styles/documentation-index.css +100 -0
- package/src/styles/documents.css +4 -0
- package/src/styles/documents.ts +2 -0
- package/src/styles/foundation.css +4 -0
- package/src/styles/globals.css +2 -0
- package/src/styles/interface.css +3 -0
- package/src/styles/interface.ts +2 -0
- package/src/styles/site.ts +2 -0
- package/src/styles/system/DESIGN.md +108 -0
- package/src/styles/system/buttons.css +51 -0
- package/src/styles/system/code.css +85 -0
- package/src/styles/system/controls.css +110 -0
- package/src/styles/system/data.css +134 -0
- package/src/styles/system/mixins.css +7 -0
- package/src/styles/system/prose.css +75 -0
- package/src/styles/system/shell.css +102 -0
- package/src/styles/system/specimens.css +98 -0
- package/src/styles/system/surfaces.css +104 -0
- package/src/styles/system/tokens.css +136 -0
- package/src/utils/cloudflare-image-loader.js +85 -0
- package/src/virtual.d.ts +36 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '../../styles/docs-shell/page-content.css'
|
|
3
|
+
import type { PageContentItem } from './page-content.svelte'
|
|
4
|
+
import PageContentTitle from './PageContentTitle.svelte'
|
|
5
|
+
import groupPageContent from '../utils/group-page-content'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
items: (PageContentItem & { lang?: string })[]
|
|
9
|
+
label: string
|
|
10
|
+
labelLang?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The same heading inventory as the documentation rail, closed in a disclosure, available without hydration. */
|
|
14
|
+
const { items, label, labelLang } = Astro.props
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<details class="ui-disclosure" data-variant="rule" data-contents-disclosure="">
|
|
18
|
+
<summary lang={labelLang}>{label}</summary>
|
|
19
|
+
<nav class="ui-toc" aria-label={label}>
|
|
20
|
+
<ol>{groupPageContent(items).map(({ item, children }) => <li>
|
|
21
|
+
<a href={`#${item.id}`} lang={item.lang} data-level={item.level}><PageContentTitle title={item.title} /></a>
|
|
22
|
+
{children.length > 0 && <ol>{children.map(child => <li><a href={`#${child.id}`} lang={child.lang} data-level={child.level}><PageContentTitle title={child.title} /></a></li>)}</ol>}
|
|
23
|
+
</li>)}</ol>
|
|
24
|
+
</nav>
|
|
25
|
+
</details>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
const initializedPageContentScrollContainers = new WeakSet<HTMLElement>()
|
|
3
|
+
|
|
4
|
+
/** A list longer than this folds every section but the one being read to its title. */
|
|
5
|
+
const foldAfter = 12
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import Link from './Link.svelte'
|
|
10
|
+
import PageContentTitle from './PageContentTitle.svelte'
|
|
11
|
+
import { usePageContent, type PageContentItem } from './page-content.svelte'
|
|
12
|
+
import groupPageContent from '../utils/group-page-content'
|
|
13
|
+
import { getSite } from '../site'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** The list element, for a parent that scrolls the list itself. */
|
|
17
|
+
element?: HTMLOListElement
|
|
18
|
+
scrollContainer?: HTMLElement
|
|
19
|
+
lang?: string
|
|
20
|
+
translate?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The live list inside a `PageContentProvider`, nested as `ui-toc` lists: the entry being read carries
|
|
25
|
+
* `aria-current="location"`. With a scroll container, the current entry is kept in view inside it. Titles are
|
|
26
|
+
* translated unless they come from the page's own (already localized) headings.
|
|
27
|
+
*/
|
|
28
|
+
let { element = $bindable(), scrollContainer, lang, translate = true }: Props = $props()
|
|
29
|
+
const pageContent = usePageContent()
|
|
30
|
+
const { t, i18n, locale } = getSite()
|
|
31
|
+
const { defaultLocale, hreflangOfLocale } = i18n
|
|
32
|
+
const fold = $derived(pageContent.items.length > foldAfter && pageContent.items.some((item) => item.level === 3))
|
|
33
|
+
|
|
34
|
+
// A title the page's language has no translation for is read in its source language.
|
|
35
|
+
const langOf = (title: string) => translate && locale !== defaultLocale && !title.startsWith('`') && t(title) === title ? hreflangOfLocale?.[defaultLocale] ?? defaultLocale : undefined
|
|
36
|
+
|
|
37
|
+
$effect(() => {
|
|
38
|
+
const container = scrollContainer
|
|
39
|
+
const currentId = pageContent.currentId
|
|
40
|
+
const nav = currentId ? element?.querySelector<HTMLElement>(`[data-page-content-nav-id="${CSS.escape(currentId)}"]`) : undefined
|
|
41
|
+
if (nav && container && container.scrollHeight > container.clientHeight) {
|
|
42
|
+
const behavior: ScrollBehavior = initializedPageContentScrollContainers.has(container) && !matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
43
|
+
? 'smooth'
|
|
44
|
+
: 'instant' as ScrollBehavior
|
|
45
|
+
|
|
46
|
+
// The current entry settles about a third of the way down the scrolling list.
|
|
47
|
+
container.scrollTo({
|
|
48
|
+
top: container.scrollTop + nav.getBoundingClientRect().top - container.getBoundingClientRect().top - container.clientHeight / 3,
|
|
49
|
+
behavior
|
|
50
|
+
})
|
|
51
|
+
initializedPageContentScrollContainers.add(container)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<!-- The bootstrap script marks the live entry before hydration, so its attribute may differ from the first render. -->
|
|
57
|
+
{#snippet nav({ id, title, level }: PageContentItem)}
|
|
58
|
+
<Link href={'#' + id} aria-current={pageContent.currentId === id ? 'location' : undefined} data-page-content-nav-id={id} data-level={level} lang={langOf(title)}>
|
|
59
|
+
<PageContentTitle {title} translate={translate ? t : undefined} />
|
|
60
|
+
</Link>
|
|
61
|
+
{/snippet}
|
|
62
|
+
|
|
63
|
+
<ol bind:this={element} {lang} data-fold={fold ? '' : undefined}>
|
|
64
|
+
{#each groupPageContent(pageContent.items) as { item, children } (item.id)}
|
|
65
|
+
<li>
|
|
66
|
+
{@render nav(item)}
|
|
67
|
+
{#if children.length > 0}<ol>{#each children as child (child.id)}<li>{@render nav(child)}</li>{/each}</ol>{/if}
|
|
68
|
+
</li>
|
|
69
|
+
{/each}
|
|
70
|
+
</ol>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import { providePageContent, type PageContentItem } from './page-content.svelte'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
items: PageContentItem[]
|
|
7
|
+
children?: Snippet
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Tracks the entry being read for the `PageContentList`s inside it. */
|
|
11
|
+
let { items, children }: Props = $props()
|
|
12
|
+
providePageContent(() => items)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{@render children?.()}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string
|
|
4
|
+
translate?: (text: string) => string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A contents entry's words: a title written as `code` is set in the mono face, any other title is translated. The
|
|
9
|
+
* heading's text runs are joined with spaces when the contents are collected, so a space before punctuation that
|
|
10
|
+
* followed inline code (`:hover`, `:active`) is taken out again.
|
|
11
|
+
*/
|
|
12
|
+
let { title, translate }: Props = $props()
|
|
13
|
+
const text = $derived(translate ? translate(title) : title)
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#if title.startsWith('`')}<code>{title.replace(/`/g, '')}</code>{:else}{text.replace(/\s+([,.;:!?)])/g, '$1').replace(/\(\s+/g, '(')}{/if}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Link from './Link.svelte'
|
|
3
|
+
import { createTranslation } from '../utils/i18n'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
pageCategories?: { pages: any[] }[]
|
|
7
|
+
metadata: any
|
|
8
|
+
locale: string
|
|
9
|
+
dictionaries: Record<string, () => Promise<any>>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The previous and next documents in the section's order, as a `ui-pager`. */
|
|
13
|
+
const { pageCategories, metadata, locale, dictionaries } = Astro.props
|
|
14
|
+
const $ = await createTranslation(locale, dictionaries)
|
|
15
|
+
const tw = locale === 'tw'
|
|
16
|
+
const unit = metadata?.pathname?.split('/')?.[1]
|
|
17
|
+
const pages = (pageCategories?.flatMap((category: any) => category.pages) || [])
|
|
18
|
+
.filter(({ pathname }: any) => pathname.split('/').length <= 3 && unit)
|
|
19
|
+
const currentPageIndex = pages.findIndex(({ pathname }: any) => metadata.pathname === pathname)
|
|
20
|
+
const prevDefinedMetadata = currentPageIndex !== -1 && pages[currentPageIndex - 1]
|
|
21
|
+
const nextDefinedMetadata = currentPageIndex !== -1 && pages[currentPageIndex + 1]
|
|
22
|
+
const navs = [
|
|
23
|
+
prevDefinedMetadata && { direction: 'prev', definedMetadata: prevDefinedMetadata },
|
|
24
|
+
nextDefinedMetadata && { direction: 'next', definedMetadata: nextDefinedMetadata }
|
|
25
|
+
].filter(Boolean).map(({ direction, definedMetadata }: any) => ({
|
|
26
|
+
direction,
|
|
27
|
+
href: definedMetadata.pathname,
|
|
28
|
+
label: direction === 'prev' ? (tw ? '上一篇' : 'Previous') : (tw ? '下一篇' : 'Next'),
|
|
29
|
+
title: $(definedMetadata.title.absolute || definedMetadata.title)
|
|
30
|
+
}))
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
{navs.length > 0 && (
|
|
34
|
+
<nav class="ui-pager" aria-label={tw ? '前後篇文件' : 'Previous and next documents'}>
|
|
35
|
+
{navs.map(({ direction, href, label, title }) => <Link {href} rel={direction} aria-label={`${label}: ${title}`}>
|
|
36
|
+
<small>{label}</small>
|
|
37
|
+
<b>{title}</b>
|
|
38
|
+
</Link>)}
|
|
39
|
+
</nav>
|
|
40
|
+
)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CodeProp } from './code-props'
|
|
3
|
+
import type { PreparedCode } from '../utils/prepared-code'
|
|
4
|
+
import CodeView from './CodeView.astro'
|
|
5
|
+
|
|
6
|
+
type Props = CodeProp & { prepared: PreparedCode }
|
|
7
|
+
|
|
8
|
+
/** A `CodeView` around a block highlighted ahead of rendering. */
|
|
9
|
+
const { prepared, ...props } = Astro.props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<CodeView {...props}><Fragment set:html={prepared.html} /></CodeView>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { renderJSX } from 'astro/runtime/server/jsx.js'
|
|
3
|
+
import { isVNode } from 'astro/jsx-runtime'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Markup passed as a prop: an Astro template value, or JSX written in MDX. */
|
|
7
|
+
node: unknown
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { node } = Astro.props
|
|
11
|
+
const containsVNode = (value: unknown): boolean => Array.isArray(value) ? value.some(containsVNode) : isVNode(value)
|
|
12
|
+
// MDX writes JSX with Astro's JSX runtime, whose nodes only render through the page's result.
|
|
13
|
+
const html = containsVNode(node) ? await renderJSX($$result, node) : undefined
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{html !== undefined ? <Fragment set:html={html} /> : node}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
|
|
3
|
+
import type { Props as PageProps } from '../types/Props'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Outermost first; each layer renders the next in its default slot. */
|
|
7
|
+
layers: AstroComponentFactory[]
|
|
8
|
+
props: PageProps
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { layers, props } = Astro.props
|
|
12
|
+
const [Layer, ...inner] = layers
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
{inner.length
|
|
16
|
+
? <Layer {...props}><Astro.self layers={inner} props={props} /></Layer>
|
|
17
|
+
: <Layer {...props} />}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
4
|
+
import IconSearch from '@tabler/icons-svelte-runes/icons/search'
|
|
5
|
+
import { openSearch, searchLabels } from '../contexts/search'
|
|
6
|
+
import { getSite } from '../site'
|
|
7
|
+
|
|
8
|
+
interface Props extends HTMLButtonAttributes {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Opens the page's search dialog. Without children it renders the search field trigger (`ui-search-trigger`) with its shortcut. */
|
|
13
|
+
let { class: className, children, onclick, type = 'button', ...props }: Props = $props()
|
|
14
|
+
const { t, locale } = getSite()
|
|
15
|
+
const { searchText, searchLabel } = searchLabels(t, locale)
|
|
16
|
+
|
|
17
|
+
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
18
|
+
onclick?.(event)
|
|
19
|
+
if (!event.defaultPrevented) openSearch(event.currentTarget)
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<button {...props} {type} class={className} aria-label={props['aria-label'] ?? searchLabel} aria-keyshortcuts="Meta+K Control+K" onclick={handleClick}>
|
|
24
|
+
{#if children}
|
|
25
|
+
{@render children()}
|
|
26
|
+
{:else}
|
|
27
|
+
<IconSearch aria-hidden="true" stroke={1.5} />
|
|
28
|
+
{searchText}
|
|
29
|
+
<span class="ui-kbd" aria-hidden="true">⌘K</span>
|
|
30
|
+
{/if}
|
|
31
|
+
</button>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Attachment } from 'svelte/attachments'
|
|
3
|
+
import type { DocumentationSearchPage } from '../utils/documentation-search'
|
|
4
|
+
|
|
5
|
+
const cache: Record<string, Promise<DocumentationSearchPage[]>> = {}
|
|
6
|
+
|
|
7
|
+
async function loadPages(locale: string) {
|
|
8
|
+
cache[locale] ??= fetch(`/search/${encodeURIComponent(locale)}.json`).then(response => {
|
|
9
|
+
if (!response.ok) throw new Error(`Search unavailable (${response.status})`)
|
|
10
|
+
return response.json()
|
|
11
|
+
}).catch(error => { delete cache[locale]; throw error })
|
|
12
|
+
return cache[locale]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The dialog lives at the end of the body, outside the island that opens it. */
|
|
16
|
+
const portal: Attachment<HTMLElement> = (node) => {
|
|
17
|
+
document.body.append(node)
|
|
18
|
+
return () => node.remove()
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import '../../styles/docs-shell/documentation-search.css'
|
|
24
|
+
import { untrack } from 'svelte'
|
|
25
|
+
import Link from './Link.svelte'
|
|
26
|
+
import { getSite } from '../site'
|
|
27
|
+
import { createDocumentationSearch } from '../utils/documentation-search'
|
|
28
|
+
import { openSearchEvent } from '../contexts/search'
|
|
29
|
+
import IconArrowDown from '@tabler/icons-svelte-runes/icons/arrow-down'
|
|
30
|
+
import IconArrowUp from '@tabler/icons-svelte-runes/icons/arrow-up'
|
|
31
|
+
import IconCornerDownLeft from '@tabler/icons-svelte-runes/icons/corner-down-left'
|
|
32
|
+
import IconSearch from '@tabler/icons-svelte-runes/icons/search'
|
|
33
|
+
import IconX from '@tabler/icons-svelte-runes/icons/x'
|
|
34
|
+
import { isInteractOutside } from '../utils/isInteractOutside'
|
|
35
|
+
|
|
36
|
+
/** The page's single search dialog; search triggers in other islands open it by event (`contexts/search`). */
|
|
37
|
+
const { t, locale } = getSite()
|
|
38
|
+
const tw = locale === 'tw'
|
|
39
|
+
let opened = $state(false)
|
|
40
|
+
let query = $state('')
|
|
41
|
+
let pages = $state.raw<DocumentationSearchPage[]>([])
|
|
42
|
+
let error = $state('')
|
|
43
|
+
let loading = $state(false)
|
|
44
|
+
let retry = $state(0)
|
|
45
|
+
let selected = $state(0)
|
|
46
|
+
let dialog = $state<HTMLDialogElement>()
|
|
47
|
+
let input = $state<HTMLInputElement>()
|
|
48
|
+
let scroll = $state<HTMLDivElement>()
|
|
49
|
+
let scrollTop = 0
|
|
50
|
+
let returnFocus: HTMLElement | null = null
|
|
51
|
+
const search = $derived(createDocumentationSearch(pages))
|
|
52
|
+
const results = $derived(search(query))
|
|
53
|
+
|
|
54
|
+
function selectQuery(value: string) {
|
|
55
|
+
query = value
|
|
56
|
+
selected = 0
|
|
57
|
+
scrollTop = 0
|
|
58
|
+
if (scroll) scroll.scrollTop = 0
|
|
59
|
+
input?.focus()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function close() {
|
|
63
|
+
scrollTop = scroll?.scrollTop ?? 0
|
|
64
|
+
dialog?.close()
|
|
65
|
+
opened = false
|
|
66
|
+
returnFocus?.focus()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function open(event?: Event) {
|
|
70
|
+
const trigger = (event as CustomEvent<{ trigger?: HTMLElement }> | undefined)?.detail?.trigger
|
|
71
|
+
returnFocus = trigger instanceof HTMLElement ? trigger : document.activeElement as HTMLElement
|
|
72
|
+
opened = true
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
$effect(() => {
|
|
76
|
+
if (!opened) return
|
|
77
|
+
void retry
|
|
78
|
+
let active = true
|
|
79
|
+
loading = true
|
|
80
|
+
error = ''
|
|
81
|
+
loadPages(locale).then(data => {
|
|
82
|
+
if (active) { pages = data; loading = false }
|
|
83
|
+
}, reason => {
|
|
84
|
+
if (active) { error = reason.message; loading = false }
|
|
85
|
+
})
|
|
86
|
+
return () => { active = false }
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
$effect(() => {
|
|
90
|
+
if (opened && dialog) {
|
|
91
|
+
untrack(() => {
|
|
92
|
+
if (!dialog!.open) dialog!.showModal()
|
|
93
|
+
input?.focus()
|
|
94
|
+
if (scroll) scroll.scrollTop = scrollTop
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const closeOnBackdropClick: Attachment<HTMLDialogElement> = (element) => {
|
|
100
|
+
const onclick = (event: MouseEvent) => {
|
|
101
|
+
if (event.target === element && isInteractOutside(element, event)) close()
|
|
102
|
+
}
|
|
103
|
+
element.addEventListener('click', onclick)
|
|
104
|
+
return () => element.removeEventListener('click', onclick)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$effect(() => {
|
|
108
|
+
window.addEventListener(openSearchEvent, open)
|
|
109
|
+
return () => window.removeEventListener(openSearchEvent, open)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
function shortcut(event: KeyboardEvent) {
|
|
113
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k') { event.preventDefault(); opened ? close() : open() }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function onkeydown(event: KeyboardEvent) {
|
|
117
|
+
if (event.isComposing || event.keyCode === 229) return
|
|
118
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(); return }
|
|
119
|
+
if (event.key === 'Enter' && results.length) { event.preventDefault(); document.getElementById(`documentation-result-${selected}`)?.click() }
|
|
120
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
121
|
+
event.preventDefault()
|
|
122
|
+
const next = Math.max(0, Math.min(results.length - 1, selected + (event.key === 'ArrowDown' ? 1 : -1)))
|
|
123
|
+
selected = next
|
|
124
|
+
document.getElementById(`documentation-result-${next}`)?.scrollIntoView({ block: 'nearest' })
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const reasons: Record<string, string> | undefined = tw ? { Identifier: '識別字', Title: '名稱', Syntax: '語法與範例', Topic: '主題', Content: '內文' } : undefined
|
|
129
|
+
const kinds: Record<string, string> = tw
|
|
130
|
+
? { utility: 'Utility', rule: '規則', tokens: 'Tokens', directive: '指令', tool: '工具', package: 'API' }
|
|
131
|
+
: { utility: 'Utility', rule: 'Rule', tokens: 'Tokens', directive: 'Directive', tool: 'Tool', package: 'API' }
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<svelte:window onkeydown={shortcut} />
|
|
135
|
+
|
|
136
|
+
{#snippet excerpt(text: string, query: string)}
|
|
137
|
+
{@const index = text.toLowerCase().indexOf(query.toLowerCase())}
|
|
138
|
+
{@const start = Math.max(0, index - 45)}
|
|
139
|
+
{@const value = text.slice(start, start + 220)}
|
|
140
|
+
{@const offset = value.toLowerCase().indexOf(query.toLowerCase())}
|
|
141
|
+
{start > 0 ? '…' : ''}{#if offset < 0}{value}{:else}{value.slice(0, offset)}<mark>{value.slice(offset, offset + query.length)}</mark>{value.slice(offset + query.length)}{/if}{start + 220 < text.length ? '…' : ''}
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
144
|
+
{#if opened}
|
|
145
|
+
<dialog bind:this={dialog} {@attach portal} {@attach closeOnBackdropClick} class="ui-dialog" data-variant="search" aria-label={tw ? '搜尋文件' : 'Search documentation'} oncancel={close}>
|
|
146
|
+
<div class="ui-dialog-search">
|
|
147
|
+
<IconSearch size={18} stroke={1.5} aria-hidden="true" />
|
|
148
|
+
<input bind:this={input} type="search" role="combobox" aria-autocomplete="list" aria-expanded={Boolean(query)} value={query} autocomplete="off" spellcheck={false} placeholder={tw ? '搜尋文件…' : 'Search documentation…'} aria-label={tw ? '搜尋文件' : 'Search documentation'} aria-controls="documentation-search-results" aria-activedescendant={results[selected] ? `documentation-result-${selected}` : undefined}
|
|
149
|
+
oninput={event => selectQuery(event.currentTarget.value)}
|
|
150
|
+
{onkeydown} />
|
|
151
|
+
{#if query}<button type="button" class="ui-button" data-variant="quiet" data-shape="icon" data-size="sm" onclick={() => selectQuery('')} aria-label={tw ? '清除搜尋' : 'Clear search'}><IconX size={16} stroke={1.5} aria-hidden="true" /></button>{/if}
|
|
152
|
+
<button type="button" class="ui-button ui-dialog-close" data-variant="quiet" data-size="sm" onclick={close} aria-label={tw ? '關閉搜尋' : 'Close search'}><span class="ui-kbd">esc</span><span>{tw ? '取消' : 'Cancel'}</span></button>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="ui-dialog-body" bind:this={scroll}>
|
|
155
|
+
<p class="ui-dialog-status" role="status">{loading ? (tw ? '正在載入文件…' : 'Loading documentation…') : error ? (tw ? '搜尋暫時無法載入。' : 'Search could not load.') : query ? `${results.length === 40 ? (tw ? '前 ' : 'Top ') : ''}${results.length} ${tw ? '筆結果' : results.length === 1 ? 'result' : 'results'}` : (tw ? '依名稱、別名或 CSS 屬性查找' : 'Find a name, alias or CSS property')}</p>
|
|
156
|
+
{#if error}<div class="ui-dialog-note"><p>{tw ? '請檢查連線,再試一次。' : 'Check your connection and try again.'}</p><button type="button" class="ui-button" data-size="sm" onclick={() => { retry += 1; input?.focus() }}>{tw ? '再試一次' : 'Try again'}</button></div>{/if}
|
|
157
|
+
{#if !query && !error && !loading}<div class="ui-dialog-note">
|
|
158
|
+
<p>{tw ? '試試看' : 'Try searching'}</p>
|
|
159
|
+
{#each ['padding', 'padding-inline-start:', 'fg-red:hover@sm'] as value (value)}<button type="button" class="ui-button" data-size="sm" onclick={() => selectQuery(value)}><code>{value}</code><IconCornerDownLeft size={14} stroke={1.5} aria-hidden="true" /></button>{/each}
|
|
160
|
+
</div>{/if}
|
|
161
|
+
{#if query && !results.length && !error && !loading}<div class="ui-dialog-note" data-align="center"><IconSearch size={24} stroke={1.25} aria-hidden="true" /><b>{tw ? '找不到相符的文件' : 'No matching documents'}</b><p>{tw ? '試試屬性全名、token 名稱或其他關鍵字。' : 'Try a property name, a token name or a different keyword.'}</p></div>{/if}
|
|
162
|
+
<ol id="documentation-search-results" class="ui-results" role="listbox" aria-label={tw ? '搜尋結果' : 'Search results'} aria-busy={loading}>
|
|
163
|
+
{#if !error}{#each results as result, index (result.page.url)}<li role="presentation">
|
|
164
|
+
<Link id={`documentation-result-${index}`} role="option" tabindex={-1} aria-selected={selected === index} href={result.href} onclick={close} onpointermove={() => { selected = index }}>
|
|
165
|
+
<small>{t(result.page.category ?? '')} · {kinds[result.page.kind ?? ''] ?? (result.page.url.includes('/guide') ? 'Guide' : 'Page')} · {reasons?.[result.reason] ?? result.reason}</small>
|
|
166
|
+
<b>{result.page.title}</b>
|
|
167
|
+
<span>{@render excerpt(result.excerpt, query)}</span>
|
|
168
|
+
</Link>
|
|
169
|
+
</li>{/each}{/if}
|
|
170
|
+
</ol>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="ui-dialog-foot" aria-hidden="true"><span><span class="ui-kbd"><IconArrowUp size={12} /></span><span class="ui-kbd"><IconArrowDown size={12} /></span>{tw ? '選擇' : 'Navigate'}</span><span><span class="ui-kbd"><IconCornerDownLeft size={12} /></span>{tw ? '開啟' : 'Open'}</span><span>{tw ? '文件搜尋' : 'Documentation'}</span></div>
|
|
173
|
+
</dialog>
|
|
174
|
+
{/if}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '../../styles/docs-shell/segments.css'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** The views' names, in order. Each view's content is the snippet (a named slot from Astro) of the same name. */
|
|
7
|
+
names: readonly string[]
|
|
8
|
+
label?: string
|
|
9
|
+
children?: Snippet
|
|
10
|
+
// Named slots are supplied by the host; only function-valued entries render.
|
|
11
|
+
[segment: string]: unknown
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Related document views stay available in the HTML, including without scripting. */
|
|
15
|
+
let { names, label = 'Document view', ...segments }: Props = $props()
|
|
16
|
+
const prefix = $props.id()
|
|
17
|
+
const buttons: (HTMLButtonElement | undefined)[] = []
|
|
18
|
+
// The first view opens; the choice is the reader's after that.
|
|
19
|
+
// svelte-ignore state_referenced_locally
|
|
20
|
+
let activeName = $state(names[0])
|
|
21
|
+
const activeIndex = $derived(Math.max(0, names.findIndex(name => name === activeName)))
|
|
22
|
+
|
|
23
|
+
function navigate(event: KeyboardEvent, index: number) {
|
|
24
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? names.length - 1
|
|
25
|
+
: event.key === 'ArrowRight' ? (index + 1) % names.length
|
|
26
|
+
: event.key === 'ArrowLeft' ? (index - 1 + names.length) % names.length : undefined
|
|
27
|
+
if (next === undefined) return
|
|
28
|
+
event.preventDefault()
|
|
29
|
+
activeName = names[next]
|
|
30
|
+
buttons[next]?.focus()
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
{#if names.length}
|
|
35
|
+
<div class="segment-views">
|
|
36
|
+
<div class="ui-segmented" role="tablist" aria-label={label}>
|
|
37
|
+
{#each names as name, index (name)}<button
|
|
38
|
+
bind:this={buttons[index]}
|
|
39
|
+
type="button"
|
|
40
|
+
id={`${prefix}-tab-${index}`}
|
|
41
|
+
role="tab"
|
|
42
|
+
aria-controls={`${prefix}-panel-${index}`}
|
|
43
|
+
aria-selected={activeIndex === index}
|
|
44
|
+
tabindex={activeIndex === index ? 0 : -1}
|
|
45
|
+
onclick={() => { activeName = name }}
|
|
46
|
+
onkeydown={event => navigate(event, index)}>
|
|
47
|
+
{name}
|
|
48
|
+
</button>{/each}
|
|
49
|
+
</div>
|
|
50
|
+
{#each names as name, index (name)}
|
|
51
|
+
<div class="segment-panel"
|
|
52
|
+
id={`${prefix}-panel-${index}`}
|
|
53
|
+
role="tabpanel"
|
|
54
|
+
aria-labelledby={`${prefix}-tab-${index}`}
|
|
55
|
+
tabindex="0"
|
|
56
|
+
hidden={activeIndex !== index}>
|
|
57
|
+
<div class="segment-panel-label">{name}</div>
|
|
58
|
+
{#if typeof segments[name] === 'function'}{@render (segments[name] as Snippet)()}{/if}
|
|
59
|
+
</div>
|
|
60
|
+
{/each}
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
5
|
+
/** Text and source side by side (`StepL`, `StepR`). */
|
|
6
|
+
$row?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** One step of a `StepSection`. */
|
|
10
|
+
const { $row, class: className, ...props } = Astro.props
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<li><div {...props} class:list={['ui-steps-content', className]} data-columns={$row || undefined}><slot /></div></li>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
type Props = HTMLAttributes<'div'>
|
|
5
|
+
|
|
6
|
+
/** A row step's text. */
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div {...props} class:list={['ui-steps-text', className]}><slot /></div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
type Props = HTMLAttributes<'div'>
|
|
5
|
+
|
|
6
|
+
/** A row step's source. */
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div {...props} class:list={['ui-steps-source', className]}><slot /></div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import '../../styles/system/data.css'
|
|
3
|
+
import '../../styles/docs-shell/steps.css'
|
|
4
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<'ol'>
|
|
7
|
+
|
|
8
|
+
/** Document steps on `ui-steps`: the list numbers each step beside its authored heading. Steps are `Step.astro`, split into `StepL.astro` and `StepR.astro`. */
|
|
9
|
+
const { class: className, ...props } = Astro.props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<ol {...props} class:list={['ui-steps', className]} data-variant="document"><slot /></ol>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
type Props = HTMLAttributes<'nav'>
|
|
5
|
+
|
|
6
|
+
/** Links between sibling pages as underlined `ui-segmented` tabs; the page being read is underlined in ink (`aria-current="page"`). Each tab is a `Tab.astro`. */
|
|
7
|
+
const { class: className, ...props } = Astro.props
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<nav {...props} class:list={['ui-segmented', className]} data-variant="underline"><slot /></nav>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
type Props = HTMLAttributes<'svg'>
|
|
5
|
+
|
|
6
|
+
const { class: className, ...props } = Astro.props
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<svg class:list={['block@apply(--site-dark) hidden stroke-accent', className]} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" {...props}>
|
|
10
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
11
|
+
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" class="(fill:var(--color-primary)) (opacity:.2)" />
|
|
12
|
+
<path d="M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2" />
|
|
13
|
+
<path d="M19 11h2m-1 -1v2" />
|
|
14
|
+
</svg>
|
|
15
|
+
<svg class:list={['block@apply(--site-light) hidden stroke-accent', className]} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" {...props}>
|
|
16
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
17
|
+
<circle cx="12" cy="12" r="4" class="(fill:var(--color-primary)) (opacity:.2)" />
|
|
18
|
+
<path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7" />
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLSelectAttributes } from 'svelte/elements'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import { useThemeMode } from '../contexts/theme-mode.svelte'
|
|
5
|
+
import { getSite } from '../site'
|
|
6
|
+
|
|
7
|
+
type Props = Omit<HTMLSelectAttributes, 'value' | 'onchange'>
|
|
8
|
+
|
|
9
|
+
/** A native select; by default invisible over its positioned label (`ui-select[data-variant="overlay"]`), which shows the value. */
|
|
10
|
+
let { class: className, ...props }: Props = $props()
|
|
11
|
+
const themeMode = useThemeMode()
|
|
12
|
+
const { t } = getSite()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<select data-variant="overlay" {...props} class={clsx('ui-select', className)} value={themeMode.preference}
|
|
16
|
+
onchange={(event) => { themeMode.preference = event.currentTarget.value }}>
|
|
17
|
+
<option value="light">{t('Light')}</option>
|
|
18
|
+
<option value="dark">{t('Dark')}</option>
|
|
19
|
+
<option value="system">{t('System')}</option>
|
|
20
|
+
</select>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import dayjs from 'dayjs'
|
|
3
|
+
import relativeTime from 'dayjs/plugin/relativeTime'
|
|
4
|
+
import 'dayjs/locale/zh-tw'
|
|
5
|
+
import 'dayjs/locale/en'
|
|
6
|
+
|
|
7
|
+
dayjs.extend(relativeTime)
|
|
8
|
+
|
|
9
|
+
const locales: Record<string, string> = {
|
|
10
|
+
tw: 'zh-tw',
|
|
11
|
+
en: 'en'
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { onMount } from 'svelte'
|
|
17
|
+
import { getSite } from '../site'
|
|
18
|
+
|
|
19
|
+
/** The date when rendered; the reader's relative time once hydrated. */
|
|
20
|
+
let { timestamp }: { timestamp: string | number | Date } = $props()
|
|
21
|
+
const { locale } = getSite()
|
|
22
|
+
let hydrated = $state(false)
|
|
23
|
+
const formattedDate = $derived(hydrated
|
|
24
|
+
? dayjs(timestamp).locale(locales[locale]).fromNow()
|
|
25
|
+
: dayjs(timestamp).format('ddd, MMMM D YYYY'))
|
|
26
|
+
|
|
27
|
+
onMount(() => {
|
|
28
|
+
hydrated = true
|
|
29
|
+
})
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{formattedDate}
|