@hraness/design-kit 0.31.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/ARTICLE_COPY.md +208 -0
- package/HERO_FIELDS.md +55 -0
- package/ICONS.md +56 -0
- package/LANTERN_MATERIAL.md +60 -0
- package/LICENSE +21 -0
- package/MARKETING_COPY.md +49 -0
- package/MARKETING_PRESET.md +108 -0
- package/PALETTES.md +90 -0
- package/PAPER_THEME.md +128 -0
- package/README.md +745 -0
- package/STATUS_PAGES.md +67 -0
- package/STYLE.md +245 -0
- package/WRITING.md +72 -0
- package/dist/browser/index.js +2345 -0
- package/dist/chunk-44djxk16.js +6872 -0
- package/dist/chunk-5gtx3pza.js +9 -0
- package/dist/chunk-77391vmq.js +454 -0
- package/dist/chunk-7b1586eb.js +1209 -0
- package/dist/chunk-8834fh4n.js +6 -0
- package/dist/chunk-9t8xyqte.js +870 -0
- package/dist/chunk-cejpzyfh.js +446 -0
- package/dist/chunk-eh71jz57.js +429 -0
- package/dist/chunk-evb02bc1.js +516 -0
- package/dist/chunk-h4k7yv6x.js +368 -0
- package/dist/chunk-he8eznb1.js +760 -0
- package/dist/chunk-mr1vdcjq.js +404 -0
- package/dist/chunk-wzvdn8ey.js +116 -0
- package/dist/fonts/nebula-sans/social-fonts.generated.js +53 -0
- package/dist/icons.js +48 -0
- package/dist/index.js +237 -0
- package/dist/launch.js +41 -0
- package/dist/mockups/client.js +422 -0
- package/dist/mockups/index.js +1850 -0
- package/dist/portfolio.js +1549 -0
- package/dist/provider-marks.js +19 -0
- package/dist/react/charts.js +11 -0
- package/dist/react/hero-backdrop.js +8 -0
- package/dist/react/index.js +7252 -0
- package/dist/react/platform-install.js +10 -0
- package/dist/react/server.js +137 -0
- package/dist/stylex-manifest.json +1 -0
- package/dist/stylex.css +5392 -0
- package/dist/syntax-highlighting.js +15 -0
- package/dist/testing.js +250 -0
- package/package.json +377 -0
- package/portfolio-inventory.json +31 -0
- package/scripts/check-lantern-material-snapshot.d.mts +26 -0
- package/scripts/check-lantern-material-snapshot.mjs +126 -0
- package/scripts/check-marketing-snapshot.d.mts +12 -0
- package/scripts/check-marketing-snapshot.mjs +58 -0
- package/scripts/lantern-material-snapshot.ts +101 -0
- package/scripts/marketing-textures.ts +48 -0
- package/scripts/paper-theme-snapshot.ts +97 -0
- package/scripts/product-marketing-snapshot.ts +149 -0
- package/src/appearance-menu.css +266 -0
- package/src/appearance.ts +32 -0
- package/src/article-html.ts +269 -0
- package/src/article.ts +686 -0
- package/src/browser/appearance-menu.ts +604 -0
- package/src/browser/artifact-share.ts +164 -0
- package/src/browser/design-palette.ts +197 -0
- package/src/browser/foil.ts +124 -0
- package/src/browser/hero-light.ts +11 -0
- package/src/browser/index.ts +29 -0
- package/src/browser/status-field.ts +432 -0
- package/src/browser/status-page.ts +100 -0
- package/src/browser/sticky-offset.ts +82 -0
- package/src/browser/theme-color-sync.ts +213 -0
- package/src/charts.css +7 -0
- package/src/compiler-components.css +34 -0
- package/src/compiler-foundation.css +18 -0
- package/src/compiler-palettes.css +7 -0
- package/src/compiler-tokens.css +342 -0
- package/src/components.css +3 -0
- package/src/design-gallery.css +431 -0
- package/src/effects.css +14 -0
- package/src/fonts/geist-mono/GeistMono[wght].woff2 +0 -0
- package/src/fonts/geist-mono/OFL.txt +93 -0
- package/src/fonts/geist-mono/PROVENANCE.md +12 -0
- package/src/fonts/instrument-serif/OFL.txt +93 -0
- package/src/fonts/instrument-serif/UPSTREAM.md +14 -0
- package/src/fonts/instrument-serif/instrument-serif-latin-400.woff2 +0 -0
- package/src/fonts/nebula-sans/LICENSE.txt +96 -0
- package/src/fonts/nebula-sans/NebulaSans-Black.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-BlackItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Bold.otf +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Bold.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-BoldItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Book.otf +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Book.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-BookItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Light.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-LightItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Medium.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-MediumItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-Semibold.woff2 +0 -0
- package/src/fonts/nebula-sans/NebulaSans-SemiboldItalic.woff2 +0 -0
- package/src/fonts/nebula-sans/PROVENANCE.md +14 -0
- package/src/fonts/nebula-sans/social-fonts.generated.ts +3873 -0
- package/src/fonts.css +106 -0
- package/src/icons/act60/act60.svg +5 -0
- package/src/icons/act60/application.svg +9 -0
- package/src/icons/act60/chapter-compare.svg +3 -0
- package/src/icons/act60/decree-residence.svg +6 -0
- package/src/icons/act60/estimate.svg +7 -0
- package/src/icons/act60/export-services.svg +4 -0
- package/src/icons/act60/investor.svg +13 -0
- package/src/icons/act60/presence.svg +7 -0
- package/src/icons/aicharts/aicharts.svg +6 -0
- package/src/icons/aicharts/cost-compare.svg +4 -0
- package/src/icons/aicharts/task-audio.svg +7 -0
- package/src/icons/aicharts/task-coding.svg +6 -0
- package/src/icons/aicharts/task-images.svg +3 -0
- package/src/icons/aicharts/task-reasoning.svg +9 -0
- package/src/icons/aicharts/task-research.svg +5 -0
- package/src/icons/aicharts/task-video.svg +4 -0
- package/src/icons/manifest.json +1371 -0
- package/src/icons/platonik/conversation.svg +3 -0
- package/src/icons/platonik/creature.svg +7 -0
- package/src/icons/platonik/economy.svg +4 -0
- package/src/icons/platonik/keep-light.svg +6 -0
- package/src/icons/platonik/platonik.svg +7 -0
- package/src/icons/platonik/spark-route.svg +15 -0
- package/src/icons/receipts/act60-retry.receipt.json +888 -0
- package/src/icons/receipts/act60.receipt.json +1366 -0
- package/src/icons/receipts/aicharts.receipt.json +1546 -0
- package/src/icons/receipts/platonik.receipt.json +1011 -0
- package/src/icons/receipts/roughday.receipt.json +770 -0
- package/src/icons/receipts/shared.receipt.json +1296 -0
- package/src/icons/receipts/slopcamera.receipt.json +1495 -0
- package/src/icons/receipts/soundfish-retry.receipt.json +460 -0
- package/src/icons/receipts/soundfish.receipt.json +1709 -0
- package/src/icons/receipts/sponge.receipt.json +1743 -0
- package/src/icons/receipts/stripe-history-retry.receipt.json +145 -0
- package/src/icons/receipts/stripe-history.receipt.json +1202 -0
- package/src/icons/receipts/wordcell.receipt.json +1924 -0
- package/src/icons/roughday/finance.svg +7 -0
- package/src/icons/roughday/roughday.svg +6 -0
- package/src/icons/roughday/technology.svg +4 -0
- package/src/icons/roughday/world.svg +4 -0
- package/src/icons/sets/act60.json +63 -0
- package/src/icons/sets/aicharts.json +63 -0
- package/src/icons/sets/platonik.json +39 -0
- package/src/icons/sets/roughday.json +25 -0
- package/src/icons/sets/shared.json +12 -0
- package/src/icons/sets/slopcamera.json +47 -0
- package/src/icons/sets/soundfish.json +43 -0
- package/src/icons/sets/sponge.json +51 -0
- package/src/icons/sets/stripe-history.json +39 -0
- package/src/icons/sets/wordcell.json +51 -0
- package/src/icons/shared/agent-skill.svg +4 -0
- package/src/icons/shared/cli.svg +5 -0
- package/src/icons/shared/privacy.svg +3 -0
- package/src/icons/shared/research.svg +7 -0
- package/src/icons/shared/sdk.svg +3 -0
- package/src/icons/slopcamera/diagram.svg +3 -0
- package/src/icons/slopcamera/direct-scene.svg +5 -0
- package/src/icons/slopcamera/edit-video.svg +17 -0
- package/src/icons/slopcamera/mcp.svg +3 -0
- package/src/icons/slopcamera/native-world.svg +3 -0
- package/src/icons/slopcamera/slopcamera.svg +11 -0
- package/src/icons/soundfish/agent-ui.svg +7 -0
- package/src/icons/soundfish/collaborate.svg +5 -0
- package/src/icons/soundfish/compose.svg +3 -0
- package/src/icons/soundfish/hear.svg +6 -0
- package/src/icons/soundfish/human-ui.svg +6 -0
- package/src/icons/soundfish/share.svg +3 -0
- package/src/icons/soundfish/soundfish.svg +6 -0
- package/src/icons/sponge/api.svg +3 -0
- package/src/icons/sponge/documents.svg +3 -0
- package/src/icons/sponge/library.svg +3 -0
- package/src/icons/sponge/one-question.svg +5 -0
- package/src/icons/sponge/people-direct.svg +5 -0
- package/src/icons/sponge/read.svg +3 -0
- package/src/icons/sponge/save.svg +4 -0
- package/src/icons/sponge/sponge.svg +7 -0
- package/src/icons/stripe-history/company-history.svg +3 -0
- package/src/icons/stripe-history/evidence.svg +4 -0
- package/src/icons/stripe-history/independence.svg +7 -0
- package/src/icons/stripe-history/publications.svg +11 -0
- package/src/icons/stripe-history/sources.svg +6 -0
- package/src/icons/stripe-history/stripe-history.svg +3 -0
- package/src/icons/wordcell/backlinks.svg +6 -0
- package/src/icons/wordcell/capture.svg +6 -0
- package/src/icons/wordcell/git-provenance.svg +4 -0
- package/src/icons/wordcell/kb.svg +4 -0
- package/src/icons/wordcell/markdown.svg +4 -0
- package/src/icons/wordcell/scopes.svg +3 -0
- package/src/icons/wordcell/search.svg +7 -0
- package/src/icons.generated.ts +734 -0
- package/src/icons.ts +51 -0
- package/src/index.ts +275 -0
- package/src/lantern-material.css +213 -0
- package/src/launch.ts +624 -0
- package/src/marketing-assets/UPSTREAM.md +18 -0
- package/src/marketing-assets/cells.svg +1 -0
- package/src/marketing-assets/grain.svg +1 -0
- package/src/marketing-forced-colors.css +12 -0
- package/src/mockups/client.tsx +415 -0
- package/src/mockups/core.tsx +318 -0
- package/src/mockups/frames.tsx +368 -0
- package/src/mockups/index.ts +14 -0
- package/src/mockups/surfaces.tsx +681 -0
- package/src/mockups.css +2607 -0
- package/src/palette-appearance.ts +45 -0
- package/src/palette-bridge.css +124 -0
- package/src/palette-color.ts +41 -0
- package/src/palette-system.css +721 -0
- package/src/palette-themes.ts +23 -0
- package/src/palette-tokens.stylex.ts +519 -0
- package/src/palettes.css +3 -0
- package/src/palettes.ts +161 -0
- package/src/paper-theme.css +244 -0
- package/src/plain-publication.css +1241 -0
- package/src/plain-site.css +397 -0
- package/src/platforms.ts +151 -0
- package/src/portfolio.generated.json +1595 -0
- package/src/portfolio.generated.ts +1596 -0
- package/src/portfolio.ts +226 -0
- package/src/product-marketing-foundation.css +433 -0
- package/src/product-marketing-preset.css +261 -0
- package/src/product-marketing.css +2186 -0
- package/src/provider-marks.generated.ts +112 -0
- package/src/provider-marks.ts +143 -0
- package/src/react/animated-rail-stage.stylex.ts +15 -0
- package/src/react/animated-rail-stage.tsx +51 -0
- package/src/react/app-shell.stylex.ts +104 -0
- package/src/react/app-shell.tsx +121 -0
- package/src/react/article.tsx +602 -0
- package/src/react/aurora-dots-background.tsx +34 -0
- package/src/react/charts.stylex.ts +563 -0
- package/src/react/charts.tsx +610 -0
- package/src/react/chat.stylex.ts +34 -0
- package/src/react/chat.tsx +155 -0
- package/src/react/design-gallery.tsx +943 -0
- package/src/react/design-palette.stylex.ts +124 -0
- package/src/react/design-palette.tsx +196 -0
- package/src/react/design-theme-context.tsx +41 -0
- package/src/react/effects.stylex.ts +325 -0
- package/src/react/fader.stylex.ts +71 -0
- package/src/react/fader.tsx +151 -0
- package/src/react/foil-card-math.ts +100 -0
- package/src/react/foil-card-surface.stylex.ts +326 -0
- package/src/react/foil-card-surface.tsx +742 -0
- package/src/react/foil-mark.tsx +35 -0
- package/src/react/foil.stylex.ts +163 -0
- package/src/react/haptics.ts +228 -0
- package/src/react/hero-backdrop.tsx +22 -0
- package/src/react/index.ts +38 -0
- package/src/react/keyboard-shortcuts.ts +228 -0
- package/src/react/lantern-material-gallery.tsx +166 -0
- package/src/react/lantern-material.stylex.ts +39 -0
- package/src/react/launch-beats.tsx +73 -0
- package/src/react/navigation-rail.stylex.ts +130 -0
- package/src/react/navigation-rail.tsx +228 -0
- package/src/react/particle-halo.tsx +115 -0
- package/src/react/phaser-dots.tsx +501 -0
- package/src/react/platform-icons.tsx +94 -0
- package/src/react/platform-install.stylex.ts +385 -0
- package/src/react/platform-install.tsx +389 -0
- package/src/react/playback-transport.stylex.ts +14 -0
- package/src/react/playback-transport.tsx +112 -0
- package/src/react/procedural-backdrop.tsx +192 -0
- package/src/react/procedural-recipe.ts +323 -0
- package/src/react/product-marketing.stylex.ts +4469 -0
- package/src/react/product-marketing.tsx +1611 -0
- package/src/react/production-data-preview-notice.stylex.ts +40 -0
- package/src/react/production-data-preview-notice.tsx +34 -0
- package/src/react/provider-mark.stylex.ts +132 -0
- package/src/react/provider-mark.tsx +120 -0
- package/src/react/relative-time.tsx +117 -0
- package/src/react/route-state.stylex.ts +39 -0
- package/src/react/route-state.tsx +350 -0
- package/src/react/server.ts +11 -0
- package/src/react/social-kit-panel.tsx +103 -0
- package/src/react/sticky-offset.tsx +33 -0
- package/src/react/surfaces.stylex.ts +179 -0
- package/src/react/surfaces.tsx +330 -0
- package/src/react/syntax-code.tsx +33 -0
- package/src/react/theme-color-sync.ts +1 -0
- package/src/react/theme-resolution.ts +11 -0
- package/src/react/theme.stylex.ts +276 -0
- package/src/react/theme.tsx +402 -0
- package/src/reading.css +72 -0
- package/src/relative-time.ts +185 -0
- package/src/reset.css +2 -0
- package/src/site-shell.css +16 -0
- package/src/status-page-html.ts +63 -0
- package/src/status-page.css +276 -0
- package/src/status-page.ts +323 -0
- package/src/styles.css +21 -0
- package/src/syntax-code-lexers.ts +303 -0
- package/src/syntax-highlighting.css +78 -0
- package/src/syntax-highlighting.ts +477 -0
- package/src/syntax-tokens.ts +33 -0
- package/src/testing.ts +307 -0
- package/src/tokens.css +3 -0
- package/src/typography.css +86 -0
- package/vendor/evilcharts/LICENSE +21 -0
- package/vendor/evilcharts/UPSTREAM.md +14 -0
- package/vendor/platform-marks/LICENSE +30 -0
- package/vendor/platform-marks/UPSTREAM.md +15 -0
- package/vendor/platform-marks/apple.svg +1 -0
- package/vendor/platform-marks/linux.svg +1 -0
- package/vendor/provider-marks/CRUSH-LICENSE.md +134 -0
- package/vendor/provider-marks/LICENSE +21 -0
- package/vendor/provider-marks/UPSTREAM.md +27 -0
- package/vendor/provider-marks/aider.svg +3 -0
- package/vendor/provider-marks/crush-heartbit.svg +8 -0
- package/vendor/provider-marks/lobehub/alibabacloud-color.svg +1 -0
- package/vendor/provider-marks/lobehub/alibabacloud.svg +1 -0
- package/vendor/provider-marks/lobehub/amp-color.svg +1 -0
- package/vendor/provider-marks/lobehub/amp.svg +1 -0
- package/vendor/provider-marks/lobehub/anthropic.svg +1 -0
- package/vendor/provider-marks/lobehub/claude-color.svg +1 -0
- package/vendor/provider-marks/lobehub/claude.svg +1 -0
- package/vendor/provider-marks/lobehub/claudecode-color.svg +1 -0
- package/vendor/provider-marks/lobehub/claudecode.svg +1 -0
- package/vendor/provider-marks/lobehub/codex-color.svg +1 -0
- package/vendor/provider-marks/lobehub/codex.svg +1 -0
- package/vendor/provider-marks/lobehub/cursor.svg +1 -0
- package/vendor/provider-marks/lobehub/deepseek-color.svg +1 -0
- package/vendor/provider-marks/lobehub/deepseek.svg +1 -0
- package/vendor/provider-marks/lobehub/devin-color.svg +1 -0
- package/vendor/provider-marks/lobehub/devin.svg +1 -0
- package/vendor/provider-marks/lobehub/gemini-color.svg +1 -0
- package/vendor/provider-marks/lobehub/gemini.svg +1 -0
- package/vendor/provider-marks/lobehub/geminicli-color.svg +1 -0
- package/vendor/provider-marks/lobehub/geminicli.svg +1 -0
- package/vendor/provider-marks/lobehub/goose.svg +1 -0
- package/vendor/provider-marks/lobehub/meta-color.svg +1 -0
- package/vendor/provider-marks/lobehub/meta.svg +1 -0
- package/vendor/provider-marks/lobehub/mistral-color.svg +1 -0
- package/vendor/provider-marks/lobehub/mistral.svg +1 -0
- package/vendor/provider-marks/lobehub/moonshot.svg +1 -0
- package/vendor/provider-marks/lobehub/nvidia-color.svg +1 -0
- package/vendor/provider-marks/lobehub/nvidia.svg +1 -0
- package/vendor/provider-marks/lobehub/openai.svg +1 -0
- package/vendor/provider-marks/lobehub/opencode.svg +1 -0
- package/vendor/provider-marks/lobehub/perplexity-color.svg +1 -0
- package/vendor/provider-marks/lobehub/perplexity.svg +1 -0
- package/vendor/provider-marks/lobehub/qwen-color.svg +1 -0
- package/vendor/provider-marks/lobehub/qwen.svg +1 -0
- package/vendor/provider-marks/lobehub/xai.svg +1 -0
- package/vendor/provider-marks/lobehub/zai.svg +1 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
@import "./site-shell.css";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plain site theme
|
|
5
|
+
*
|
|
6
|
+
* An opt-in document grammar for personal sites, open-source project pages,
|
|
7
|
+
* and quiet documentation. Color appearance remains owned by `data-theme`;
|
|
8
|
+
* this layer owns measure, typography, spacing, links, and minimal chrome.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
:root:has(> body.plain-site) {
|
|
12
|
+
background: #ffffff;
|
|
13
|
+
overflow-x: clip;
|
|
14
|
+
scrollbar-gutter: stable;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.plain-site {
|
|
18
|
+
--plain-link-target-min: 0px;
|
|
19
|
+
--plain-shell-measure: 34rem;
|
|
20
|
+
--plain-shell-gutter: 1.25rem;
|
|
21
|
+
--plain-background: #ffffff;
|
|
22
|
+
--plain-foreground: #171717;
|
|
23
|
+
--plain-link: #2457a6;
|
|
24
|
+
--plain-line: #d8d8d8;
|
|
25
|
+
--plain-muted: #666666;
|
|
26
|
+
--plain-surface: #f4f4f4;
|
|
27
|
+
--plain-syntax-keyword: #785f28;
|
|
28
|
+
--plain-syntax-string: #2d6a42;
|
|
29
|
+
--plain-syntax-number: #9f3631;
|
|
30
|
+
--plain-syntax-name: #0d61ac;
|
|
31
|
+
|
|
32
|
+
background: var(--plain-background);
|
|
33
|
+
color: var(--plain-foreground);
|
|
34
|
+
font-family: var(--font-text, var(--ui-font-sans, ui-sans-serif, system-ui, sans-serif));
|
|
35
|
+
font-size: 1rem;
|
|
36
|
+
line-height: var(--hraness-type-reading-leading, 1.7);
|
|
37
|
+
margin: 0;
|
|
38
|
+
overflow-x: clip;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:root[data-theme="dark"]:has(> body.plain-site) {
|
|
42
|
+
background: #151515;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:root[data-theme="dark"] .plain-site,
|
|
46
|
+
.plain-site[data-theme="dark"] {
|
|
47
|
+
--plain-background: #151515;
|
|
48
|
+
--plain-foreground: #f2f2f2;
|
|
49
|
+
--plain-link: #8ab4ed;
|
|
50
|
+
--plain-line: #484848;
|
|
51
|
+
--plain-muted: #b6b6b6;
|
|
52
|
+
--plain-surface: #222222;
|
|
53
|
+
--plain-syntax-keyword: #c9ad74;
|
|
54
|
+
--plain-syntax-string: #76b38e;
|
|
55
|
+
--plain-syntax-number: #e18982;
|
|
56
|
+
--plain-syntax-name: #6aa9ed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (prefers-color-scheme: dark) {
|
|
60
|
+
:root:not([data-theme]):has(> body.plain-site) {
|
|
61
|
+
background: #151515;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:root:not([data-theme]) > .plain-site {
|
|
65
|
+
--plain-background: #151515;
|
|
66
|
+
--plain-foreground: #f2f2f2;
|
|
67
|
+
--plain-link: #8ab4ed;
|
|
68
|
+
--plain-line: #484848;
|
|
69
|
+
--plain-muted: #b6b6b6;
|
|
70
|
+
--plain-surface: #222222;
|
|
71
|
+
--plain-syntax-keyword: #c9ad74;
|
|
72
|
+
--plain-syntax-string: #76b38e;
|
|
73
|
+
--plain-syntax-number: #e18982;
|
|
74
|
+
--plain-syntax-name: #6aa9ed;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* An explicit palette supplies the same semantic colors as application surfaces.
|
|
79
|
+
* Match the neutral dark and no-script root fallback specificity so this later
|
|
80
|
+
* bridge owns the aliases. Resolve them on each plain surface so nested palette
|
|
81
|
+
* boundaries retain their own colors, including forced-color system roles. */
|
|
82
|
+
:root[data-palette]:has(> body.plain-site) {
|
|
83
|
+
background: var(--background, Canvas);
|
|
84
|
+
}
|
|
85
|
+
[data-palette][data-palette] .plain-site,
|
|
86
|
+
.plain-site[data-palette][data-palette] {
|
|
87
|
+
--plain-background: var(--background, Canvas);
|
|
88
|
+
--plain-foreground: var(--foreground, CanvasText);
|
|
89
|
+
--plain-link: var(--primary, LinkText);
|
|
90
|
+
--plain-line: color-mix(in oklch, var(--foreground, CanvasText) 14%, var(--background, Canvas));
|
|
91
|
+
--plain-muted: var(--muted, CanvasText);
|
|
92
|
+
--plain-surface: var(--surface, Canvas);
|
|
93
|
+
--plain-syntax-keyword: var(--warning, CanvasText);
|
|
94
|
+
--plain-syntax-string: var(--success, CanvasText);
|
|
95
|
+
--plain-syntax-number: var(--danger, CanvasText);
|
|
96
|
+
--plain-syntax-name: var(--info, CanvasText);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.plain-site .syntax-code {
|
|
100
|
+
--syntax-comment: var(--plain-muted);
|
|
101
|
+
--syntax-keyword: var(--plain-syntax-keyword);
|
|
102
|
+
--syntax-string: var(--plain-syntax-string);
|
|
103
|
+
--syntax-number: var(--plain-syntax-number);
|
|
104
|
+
--syntax-name: var(--plain-syntax-name);
|
|
105
|
+
--syntax-sign: var(--plain-muted);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.plain-site *,
|
|
109
|
+
.plain-site *::before,
|
|
110
|
+
.plain-site *::after {
|
|
111
|
+
box-sizing: border-box;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:where(.plain-header a, .plain-page a, .plain-footer a) {
|
|
115
|
+
color: var(--plain-link);
|
|
116
|
+
overflow-wrap: anywhere;
|
|
117
|
+
text-decoration: none;
|
|
118
|
+
text-decoration-thickness: 1px;
|
|
119
|
+
text-underline-offset: 0.15em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:where(
|
|
123
|
+
.plain-header a:is(:hover, :focus-visible),
|
|
124
|
+
.plain-page a:is(:hover, :focus-visible),
|
|
125
|
+
.plain-footer a:is(:hover, :focus-visible)
|
|
126
|
+
) {
|
|
127
|
+
text-decoration: underline;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.plain-site :where(
|
|
131
|
+
.plain-header a:focus-visible,
|
|
132
|
+
.plain-page a:focus-visible,
|
|
133
|
+
.plain-footer a:focus-visible
|
|
134
|
+
) {
|
|
135
|
+
border-radius: 1px;
|
|
136
|
+
outline: 1px dotted currentColor;
|
|
137
|
+
outline-offset: 3px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.plain-site :where(
|
|
141
|
+
.plain-header a:focus:not(:focus-visible),
|
|
142
|
+
.plain-page a:focus:not(:focus-visible),
|
|
143
|
+
.plain-footer a:focus:not(:focus-visible)
|
|
144
|
+
) {
|
|
145
|
+
outline: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.plain-site ::selection {
|
|
149
|
+
background: color-mix(in srgb, var(--plain-link) 20%, transparent);
|
|
150
|
+
color: var(--plain-foreground);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.plain-page {
|
|
154
|
+
inline-size: 100%;
|
|
155
|
+
margin: clamp(3.5rem, 12vh, 7rem) auto;
|
|
156
|
+
max-width: var(--plain-shell-measure);
|
|
157
|
+
padding-inline: var(--plain-shell-gutter);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.plain-header {
|
|
161
|
+
border: 0;
|
|
162
|
+
inline-size: 100%;
|
|
163
|
+
padding: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.plain-header__inner {
|
|
167
|
+
--plain-header-block-padding: 1.15rem;
|
|
168
|
+
|
|
169
|
+
align-items: center;
|
|
170
|
+
border-bottom: 1px solid var(--plain-line);
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-wrap: wrap;
|
|
173
|
+
gap: 0.75rem 1.5rem;
|
|
174
|
+
inline-size: 100%;
|
|
175
|
+
justify-content: space-between;
|
|
176
|
+
margin-inline: auto;
|
|
177
|
+
max-width: var(--plain-shell-measure);
|
|
178
|
+
padding-top: max(
|
|
179
|
+
var(--plain-header-block-padding),
|
|
180
|
+
env(safe-area-inset-top)
|
|
181
|
+
);
|
|
182
|
+
padding-right: max(var(--plain-shell-gutter), env(safe-area-inset-right));
|
|
183
|
+
padding-bottom: var(--plain-header-block-padding);
|
|
184
|
+
padding-left: max(var(--plain-shell-gutter), env(safe-area-inset-left));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.plain-wordmark {
|
|
188
|
+
align-items: center;
|
|
189
|
+
color: var(--plain-foreground);
|
|
190
|
+
display: inline-flex;
|
|
191
|
+
flex: 1 1 auto;
|
|
192
|
+
font: inherit;
|
|
193
|
+
font-weight: 700;
|
|
194
|
+
letter-spacing: 0;
|
|
195
|
+
min-block-size: var(--plain-link-target-min);
|
|
196
|
+
min-inline-size: var(--plain-link-target-min);
|
|
197
|
+
overflow-wrap: anywhere;
|
|
198
|
+
text-decoration: none;
|
|
199
|
+
text-transform: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.plain-nav,
|
|
203
|
+
.plain-footer__links {
|
|
204
|
+
align-items: center;
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-wrap: wrap;
|
|
207
|
+
gap: 0.35rem 0.85rem;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.plain-nav {
|
|
211
|
+
flex: 0 1 auto;
|
|
212
|
+
justify-content: flex-end;
|
|
213
|
+
margin-inline-start: auto;
|
|
214
|
+
max-inline-size: 100%;
|
|
215
|
+
min-inline-size: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.plain-nav a,
|
|
219
|
+
.plain-footer__links a {
|
|
220
|
+
align-items: center;
|
|
221
|
+
color: var(--plain-muted);
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
font: inherit;
|
|
224
|
+
font-size: 0.9rem;
|
|
225
|
+
font-weight: 400;
|
|
226
|
+
letter-spacing: 0;
|
|
227
|
+
min-block-size: var(--plain-link-target-min);
|
|
228
|
+
min-inline-size: var(--plain-link-target-min);
|
|
229
|
+
padding: 0;
|
|
230
|
+
text-transform: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.plain-page :where(h1, h2, h3, p, ul, ol, pre, figure) {
|
|
234
|
+
font-size: inherit;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.plain-page :where(h1, h2, h3) {
|
|
238
|
+
font-family: var(--font-heading, var(--font-text, ui-sans-serif, system-ui, sans-serif));
|
|
239
|
+
line-height: var(--hraness-type-heading-leading, 1.2);
|
|
240
|
+
letter-spacing: -.02em;
|
|
241
|
+
text-wrap: balance;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.plain-page h1 {
|
|
245
|
+
font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
|
|
246
|
+
font-weight: 700;
|
|
247
|
+
margin: 0 0 1rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.plain-page > p,
|
|
251
|
+
.plain-muted {
|
|
252
|
+
color: var(--plain-muted);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.plain-page > p {
|
|
256
|
+
margin: 0;
|
|
257
|
+
text-wrap: pretty;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.plain-page section {
|
|
261
|
+
margin-top: 2rem;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.plain-page h2 {
|
|
265
|
+
font-size: 1.25rem;
|
|
266
|
+
font-weight: 700;
|
|
267
|
+
margin: 0 0 0.3rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.plain-page section > p {
|
|
271
|
+
margin: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.plain-page section > p + p {
|
|
275
|
+
margin-top: 1rem;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.plain-links {
|
|
279
|
+
list-style: none;
|
|
280
|
+
margin: 0;
|
|
281
|
+
padding: 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.plain-links li {
|
|
285
|
+
margin: 0.1rem 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.plain-links a {
|
|
289
|
+
display: inline-block;
|
|
290
|
+
min-height: 1.5rem;
|
|
291
|
+
min-width: 1.5rem;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.plain-code {
|
|
295
|
+
color: var(--plain-foreground);
|
|
296
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
297
|
+
font-size: var(--hraness-type-code-size, .9rem);
|
|
298
|
+
line-height: 1.55;
|
|
299
|
+
margin: 0;
|
|
300
|
+
max-inline-size: 100%;
|
|
301
|
+
overflow-x: auto;
|
|
302
|
+
overflow-wrap: normal;
|
|
303
|
+
padding-block: 0.75rem;
|
|
304
|
+
tab-size: 2;
|
|
305
|
+
white-space: pre;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.plain-code code {
|
|
309
|
+
font: inherit;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.plain-footer {
|
|
313
|
+
--background: var(--plain-background);
|
|
314
|
+
--foreground: var(--plain-foreground);
|
|
315
|
+
--focus: var(--plain-link);
|
|
316
|
+
--line: var(--plain-line);
|
|
317
|
+
--muted: var(--plain-muted);
|
|
318
|
+
--secondary: var(--plain-surface);
|
|
319
|
+
--secondary-foreground: var(--plain-foreground);
|
|
320
|
+
--surface: var(--plain-background);
|
|
321
|
+
--surface-raised: var(--plain-surface);
|
|
322
|
+
|
|
323
|
+
align-items: center;
|
|
324
|
+
border-top: 1px solid var(--plain-line);
|
|
325
|
+
color: var(--plain-muted);
|
|
326
|
+
display: flex;
|
|
327
|
+
flex: 0 0 auto;
|
|
328
|
+
flex-wrap: wrap;
|
|
329
|
+
gap: 1rem;
|
|
330
|
+
inline-size: 100%;
|
|
331
|
+
justify-content: space-between;
|
|
332
|
+
margin: 0 auto;
|
|
333
|
+
max-width: var(--plain-shell-measure);
|
|
334
|
+
overflow: clip;
|
|
335
|
+
padding-top: 1.25rem;
|
|
336
|
+
padding-right: max(var(--plain-shell-gutter), env(safe-area-inset-right));
|
|
337
|
+
padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
|
|
338
|
+
padding-left: max(var(--plain-shell-gutter), env(safe-area-inset-left));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.plain-site main:has(> .design-gallery[data-design-gallery-nested="true"]) {
|
|
342
|
+
padding-inline: max(var(--plain-shell-gutter), var(--space-6));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.plain-footer p {
|
|
346
|
+
margin: 0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.plain-footer :where(a) {
|
|
350
|
+
align-items: center;
|
|
351
|
+
color: inherit;
|
|
352
|
+
display: inline-flex;
|
|
353
|
+
min-block-size: var(--plain-link-target-min);
|
|
354
|
+
min-inline-size: var(--plain-link-target-min);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@media (max-width: 42rem) {
|
|
358
|
+
.plain-header__inner {
|
|
359
|
+
--plain-header-block-padding: 0.65rem;
|
|
360
|
+
|
|
361
|
+
gap: 0.35rem 0.75rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.plain-wordmark {
|
|
365
|
+
flex-basis: min(11rem, 100%);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
@media (pointer: coarse) {
|
|
370
|
+
.plain-site {
|
|
371
|
+
--plain-link-target-min: var(--interactive-target-min, 48px);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
:root[data-verification-pointer="coarse"] .plain-site {
|
|
376
|
+
--plain-link-target-min: var(--interactive-target-min, 48px);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
@media (max-width: 420px) {
|
|
380
|
+
.plain-site {
|
|
381
|
+
--plain-shell-gutter: 1rem;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.plain-page {
|
|
385
|
+
margin-block: 2.5rem;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
@media (forced-colors: active) {
|
|
390
|
+
.plain-header__inner {
|
|
391
|
+
border-bottom: 1px solid CanvasText;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.plain-footer {
|
|
395
|
+
border-top: 1px solid CanvasText;
|
|
396
|
+
}
|
|
397
|
+
}
|
package/src/platforms.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Operating-system platforms for install commands and "Runs on" rows: known
|
|
3
|
+
* ids, their display names, monochrome marks, and client-side detection.
|
|
4
|
+
* Framework-neutral and side-effect free; React presentation lives in
|
|
5
|
+
* `react/platform-icons.tsx` and `react/platform-install.tsx`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Platforms with a registered mark and display name. */
|
|
9
|
+
export const knownPlatformIds = ["macos", "linux", "windows"] as const;
|
|
10
|
+
export type KnownPlatformId = (typeof knownPlatformIds)[number];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A platform id. Known ids get a mark and a default label; any other
|
|
14
|
+
* lowercase slug (`"freebsd"`, `"docker"`) renders the neutral terminal mark.
|
|
15
|
+
*/
|
|
16
|
+
export type PlatformId = KnownPlatformId | (string & {});
|
|
17
|
+
|
|
18
|
+
/** Ids detection can report. `ios`, `android`, and `chromeos` are never install targets by default. */
|
|
19
|
+
export type DetectedPlatform = KnownPlatformId | "ios" | "android" | "chromeos";
|
|
20
|
+
|
|
21
|
+
export interface PlatformMark {
|
|
22
|
+
/** The single `<path d>` drawn in a 24x24 box with `fill="currentColor"`. */
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly viewBox: "0 0 24 24";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const platformIdPattern = /^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$/u;
|
|
28
|
+
|
|
29
|
+
/** True for a lowercase slug usable as a platform id and in element ids. */
|
|
30
|
+
export function isPlatformId(value: unknown): value is PlatformId {
|
|
31
|
+
return typeof value === "string" && platformIdPattern.test(value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isKnownPlatformId(value: unknown): value is KnownPlatformId {
|
|
35
|
+
return typeof value === "string" && (knownPlatformIds as readonly string[]).includes(value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const platformLabels: Readonly<Record<KnownPlatformId, string>> = {
|
|
39
|
+
linux: "Linux",
|
|
40
|
+
macos: "macOS",
|
|
41
|
+
windows: "Windows",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** The display name for a known platform; unknown ids return themselves. */
|
|
45
|
+
export function platformLabel(id: PlatformId): string {
|
|
46
|
+
return isKnownPlatformId(id) ? platformLabels[id] : id;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Apple and Linux (Tux) paths are Simple Icons 16.33.0, CC0-1.0, unmodified;
|
|
50
|
+
// see vendor/platform-marks/UPSTREAM.md. The four-pane window and the
|
|
51
|
+
// terminal fallback are original geometry for this package.
|
|
52
|
+
const marks: Readonly<Record<KnownPlatformId | "terminal", PlatformMark>> = {
|
|
53
|
+
macos: {
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
path: "M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701",
|
|
56
|
+
},
|
|
57
|
+
linux: {
|
|
58
|
+
viewBox: "0 0 24 24",
|
|
59
|
+
path: "M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.536.058.399.116.728.04.97-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139zm.529 3.405h.013c.213 0 .396.062.584.198.19.135.33.332.438.533.105.259.158.459.166.724 0-.02.006-.04.006-.06v.105a.086.086 0 01-.004-.021l-.004-.024a1.807 1.807 0 01-.15.706.953.953 0 01-.213.335.71.71 0 00-.088-.042c-.104-.045-.198-.064-.284-.133a1.312 1.312 0 00-.22-.066c.05-.06.146-.133.183-.198.053-.128.082-.264.088-.402v-.02a1.21 1.21 0 00-.061-.4c-.045-.134-.101-.2-.183-.333-.084-.066-.167-.132-.267-.132h-.016c-.093 0-.176.03-.262.132a.8.8 0 00-.205.334 1.18 1.18 0 00-.09.4v.019c.002.089.008.179.02.267-.193-.067-.438-.135-.607-.202a1.635 1.635 0 01-.018-.2v-.02a1.772 1.772 0 01.15-.768c.082-.22.232-.406.43-.533a.985.985 0 01.594-.2zm-2.962.059h.036c.142 0 .27.048.399.135.146.129.264.288.344.465.09.199.14.4.153.667v.004c.007.134.006.2-.002.266v.08c-.03.007-.056.018-.083.024-.152.055-.274.135-.393.2.012-.09.013-.18.003-.267v-.015c-.012-.133-.04-.2-.082-.333a.613.613 0 00-.166-.267.248.248 0 00-.183-.064h-.021c-.071.006-.13.04-.186.132a.552.552 0 00-.12.27.944.944 0 00-.023.33v.015c.012.135.037.2.08.334.046.134.098.2.166.268.01.009.02.018.034.024-.07.057-.117.07-.176.136a.304.304 0 01-.131.068 2.62 2.62 0 01-.275-.402 1.772 1.772 0 01-.155-.667 1.759 1.759 0 01.08-.668 1.43 1.43 0 01.283-.535c.128-.133.26-.2.418-.2zm1.37 1.706c.332 0 .733.065 1.216.399.293.2.523.269 1.052.468h.003c.255.136.405.266.478.399v-.131a.571.571 0 01.016.47c-.123.31-.516.643-1.063.842v.002c-.268.135-.501.333-.775.465-.276.135-.588.292-1.012.267a1.139 1.139 0 01-.448-.067 3.566 3.566 0 01-.322-.198c-.195-.135-.363-.332-.612-.465v-.005h-.005c-.4-.246-.616-.512-.686-.71-.07-.268-.005-.47.193-.6.224-.135.38-.271.483-.336.104-.074.143-.102.176-.131h.002v-.003c.169-.202.436-.47.839-.601.139-.036.294-.065.466-.065zm2.8 2.142c.358 1.417 1.196 3.475 1.735 4.473.286.534.855 1.659 1.102 3.024.156-.005.33.018.513.064.646-1.671-.546-3.467-1.089-3.966-.22-.2-.232-.335-.123-.335.59.534 1.365 1.572 1.646 2.757.13.535.16 1.104.021 1.67.067.028.135.06.205.067 1.032.534 1.413.938 1.23 1.537v-.043c-.06-.003-.12 0-.18 0h-.016c.151-.467-.182-.825-1.065-1.224-.915-.4-1.646-.336-1.77.465-.008.043-.013.066-.018.135-.068.023-.139.053-.209.064-.43.268-.662.669-.793 1.187-.13.533-.17 1.156-.205 1.869v.003c-.02.334-.17.838-.319 1.35-1.5 1.072-3.58 1.538-5.348.334a2.645 2.645 0 00-.402-.533 1.45 1.45 0 00-.275-.333c.182 0 .338-.03.465-.067a.615.615 0 00.314-.334c.108-.267 0-.697-.345-1.163-.345-.467-.931-.995-1.788-1.521-.63-.4-.986-.87-1.15-1.396-.165-.534-.143-1.085-.015-1.645.245-1.07.873-2.11 1.274-2.763.107-.065.037.135-.408.974-.396.751-1.14 2.497-.122 3.854a8.123 8.123 0 01.647-2.876c.564-1.278 1.743-3.504 1.836-5.268.048.036.217.135.289.202.218.133.38.333.59.465.21.201.477.335.876.335.039.003.075.006.11.006.412 0 .73-.134.997-.268.29-.134.52-.334.74-.4h.005c.467-.135.835-.402 1.044-.7zm2.185 8.958c.037.6.343 1.245.882 1.377.588.134 1.434-.333 1.791-.765l.211-.01c.315-.007.577.01.847.268l.003.003c.208.199.305.53.391.876.085.4.154.78.409 1.066.486.527.645.906.636 1.14l.003-.007v.018l-.003-.012c-.015.262-.185.396-.498.595-.63.401-1.746.712-2.457 1.57-.618.737-1.37 1.14-2.036 1.191-.664.053-1.237-.2-1.574-.898l-.005-.003c-.21-.4-.12-1.025.056-1.69.176-.668.428-1.344.463-1.897.037-.714.076-1.335.195-1.814.12-.465.308-.797.641-.984l.045-.022zm-10.814.049h.01c.053 0 .105.005.157.014.376.055.706.333 1.023.752l.91 1.664.003.003c.243.533.754 1.064 1.189 1.637.434.598.77 1.131.729 1.57v.006c-.057.744-.48 1.148-1.125 1.294-.645.135-1.52.002-2.395-.464-.968-.536-2.118-.469-2.857-.602-.369-.066-.61-.2-.723-.4-.11-.2-.113-.602.123-1.23v-.004l.002-.003c.117-.334.03-.752-.027-1.118-.055-.401-.083-.71.043-.94.16-.334.396-.4.69-.533.294-.135.64-.202.915-.47h.002v-.002c.256-.268.445-.601.668-.838.19-.201.38-.336.663-.336zm7.159-9.074c-.435.201-.945.535-1.488.535-.542 0-.97-.267-1.28-.466-.154-.134-.28-.268-.373-.335-.164-.134-.144-.333-.074-.333.109.016.129.134.199.2.096.066.215.2.36.333.292.2.68.467 1.167.467.485 0 1.053-.267 1.398-.466.195-.135.445-.334.648-.467.156-.136.149-.267.279-.267.128.016.034.134-.147.332a8.097 8.097 0 01-.69.468zm-1.082-1.583V5.64c-.006-.02.013-.042.029-.05.074-.043.18-.027.26.004.063 0 .16.067.15.135-.006.049-.085.066-.135.066-.055 0-.092-.043-.141-.068-.052-.018-.146-.008-.163-.065zm-.551 0c-.02.058-.113.049-.166.066-.047.025-.086.068-.14.068-.05 0-.13-.02-.136-.068-.01-.066.088-.133.15-.133.08-.031.184-.047.259-.005.019.009.036.03.03.05v.02h.003z",
|
|
60
|
+
},
|
|
61
|
+
windows: {
|
|
62
|
+
viewBox: "0 0 24 24",
|
|
63
|
+
path: "M1.5 1.5h10v10h-10zM12.5 1.5h10v10h-10zM1.5 12.5h10v10h-10zM12.5 12.5h10v10h-10z",
|
|
64
|
+
},
|
|
65
|
+
terminal: {
|
|
66
|
+
viewBox: "0 0 24 24",
|
|
67
|
+
path: "M4 3h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm0 2v14h16V5zm2.3 3.3 1.4-1.4 4.1 4.1-4.1 4.1-1.4-1.4 2.7-2.7zM12 15h6v2h-6z",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** The mark for a platform; ids without a registered mark get the neutral terminal glyph. */
|
|
72
|
+
export function platformMark(id: PlatformId): PlatformMark {
|
|
73
|
+
return isKnownPlatformId(id) ? marks[id] : marks.terminal;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Reads the visitor's operating system from a `navigator`-shaped value.
|
|
78
|
+
* Prefers User-Agent Client Hints (`userAgentData.platform`), then the
|
|
79
|
+
* user-agent string, then the legacy `platform` field. Returns `null` when
|
|
80
|
+
* nothing is recognized. Never throws, whatever the input.
|
|
81
|
+
*/
|
|
82
|
+
export function detectPlatform(navigatorLike: unknown): DetectedPlatform | null {
|
|
83
|
+
if (typeof navigatorLike !== "object" || navigatorLike === null) return null;
|
|
84
|
+
const record = navigatorLike as Record<string, unknown>;
|
|
85
|
+
let hinted: string | undefined;
|
|
86
|
+
try {
|
|
87
|
+
const data = record.userAgentData;
|
|
88
|
+
if (typeof data === "object" && data !== null) {
|
|
89
|
+
const platform = (data as Record<string, unknown>).platform;
|
|
90
|
+
if (typeof platform === "string") hinted = platform;
|
|
91
|
+
}
|
|
92
|
+
} catch {
|
|
93
|
+
hinted = undefined;
|
|
94
|
+
}
|
|
95
|
+
const fromHint = hinted === undefined ? null : classifyHint(hinted);
|
|
96
|
+
if (fromHint !== null) return fromHint;
|
|
97
|
+
const userAgent = stringField(record, "userAgent");
|
|
98
|
+
const fromAgent = userAgent === undefined ? null : classifyUserAgent(userAgent);
|
|
99
|
+
if (fromAgent !== null) return fromAgent;
|
|
100
|
+
const legacy = stringField(record, "platform");
|
|
101
|
+
return legacy === undefined ? null : classifyUserAgent(legacy);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function stringField(record: Record<string, unknown>, key: string): string | undefined {
|
|
105
|
+
try {
|
|
106
|
+
const value = record[key];
|
|
107
|
+
return typeof value === "string" ? value : undefined;
|
|
108
|
+
} catch {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function classifyHint(platform: string): DetectedPlatform | null {
|
|
114
|
+
switch (platform.trim().toLowerCase()) {
|
|
115
|
+
case "macos": return "macos";
|
|
116
|
+
case "windows": return "windows";
|
|
117
|
+
case "linux": return "linux";
|
|
118
|
+
case "chrome os":
|
|
119
|
+
case "chromeos": return "chromeos";
|
|
120
|
+
case "android": return "android";
|
|
121
|
+
case "ios": return "ios";
|
|
122
|
+
default: return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function classifyUserAgent(userAgent: string): DetectedPlatform | null {
|
|
127
|
+
// Order matters: Android agents also say Linux, iPadOS and iOS agents say
|
|
128
|
+
// "like Mac OS X", and ChromeOS agents say X11.
|
|
129
|
+
if (/Windows|Win(?:32|64)\b/u.test(userAgent)) return "windows";
|
|
130
|
+
if (/iPhone|iPad|iPod/u.test(userAgent)) return "ios";
|
|
131
|
+
if (/Android/u.test(userAgent)) return "android";
|
|
132
|
+
if (/CrOS/u.test(userAgent)) return "chromeos";
|
|
133
|
+
if (/Mac OS X|Macintosh|MacIntel|\bMac\b/u.test(userAgent)) return "macos";
|
|
134
|
+
if (/Linux|X11/u.test(userAgent)) return "linux";
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Chooses which of `available` to show for a detected platform: the exact
|
|
140
|
+
* id, ChromeOS falls back to `linux`, and anything else (including no
|
|
141
|
+
* detection) returns `null` so callers keep their default.
|
|
142
|
+
*/
|
|
143
|
+
export function matchDetectedPlatform(
|
|
144
|
+
detected: DetectedPlatform | null,
|
|
145
|
+
available: readonly PlatformId[],
|
|
146
|
+
): PlatformId | null {
|
|
147
|
+
if (detected === null) return null;
|
|
148
|
+
if (available.includes(detected)) return detected;
|
|
149
|
+
if (detected === "chromeos" && available.includes("linux")) return "linux";
|
|
150
|
+
return null;
|
|
151
|
+
}
|