@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,192 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@hraness/ui";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
|
|
6
|
+
import { effectsStyles } from "./effects.stylex.js";
|
|
7
|
+
import {
|
|
8
|
+
createProceduralBackdropRecipe,
|
|
9
|
+
type ProceduralBackdropInput,
|
|
10
|
+
type ProceduralColorRole,
|
|
11
|
+
} from "./procedural-recipe.js";
|
|
12
|
+
|
|
13
|
+
type ProceduralStyle = CSSProperties & Record<`--hraness-design-${string}`, string | number>;
|
|
14
|
+
|
|
15
|
+
export type ProceduralBackdropProps = ProceduralBackdropInput
|
|
16
|
+
& Omit<
|
|
17
|
+
HTMLAttributes<HTMLDivElement>,
|
|
18
|
+
| "accessKey"
|
|
19
|
+
| "aria-hidden"
|
|
20
|
+
| "children"
|
|
21
|
+
| "contentEditable"
|
|
22
|
+
| "inert"
|
|
23
|
+
| "role"
|
|
24
|
+
| "suppressContentEditableWarning"
|
|
25
|
+
| "tabIndex"
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
const colorVariables = {
|
|
29
|
+
highlight: "var(--hraness-design-procedural-highlight)",
|
|
30
|
+
key: "var(--hraness-design-procedural-key)",
|
|
31
|
+
shadow: "var(--hraness-design-procedural-shadow)",
|
|
32
|
+
support: "var(--hraness-design-procedural-support)",
|
|
33
|
+
} as const satisfies Readonly<Record<ProceduralColorRole, string>>;
|
|
34
|
+
|
|
35
|
+
const INERT_PROPS = { inert: true } as unknown as HTMLAttributes<HTMLDivElement>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A deterministic, server-rendered atmosphere, grid, ripple, or composite
|
|
39
|
+
* field. It never captures or replaces the semantic page beneath it.
|
|
40
|
+
*/
|
|
41
|
+
export function ProceduralBackdrop({
|
|
42
|
+
className,
|
|
43
|
+
palette,
|
|
44
|
+
seed,
|
|
45
|
+
style,
|
|
46
|
+
variation,
|
|
47
|
+
variant,
|
|
48
|
+
...props
|
|
49
|
+
}: ProceduralBackdropProps) {
|
|
50
|
+
const recipe = createProceduralBackdropRecipe({
|
|
51
|
+
seed,
|
|
52
|
+
...(palette === undefined ? {} : { palette }),
|
|
53
|
+
...(variation === undefined ? {} : { variation }),
|
|
54
|
+
...(variant === undefined ? {} : { variant }),
|
|
55
|
+
});
|
|
56
|
+
const rootStyle: ProceduralStyle = {
|
|
57
|
+
"--hraness-design-procedural-highlight": recipe.palette.highlight,
|
|
58
|
+
"--hraness-design-procedural-key": recipe.palette.key,
|
|
59
|
+
"--hraness-design-procedural-shadow": recipe.palette.shadow,
|
|
60
|
+
"--hraness-design-procedural-support": recipe.palette.support,
|
|
61
|
+
...style,
|
|
62
|
+
};
|
|
63
|
+
const showAtmosphere = recipe.variant === "atmosphere"
|
|
64
|
+
|| recipe.variant === "composite";
|
|
65
|
+
const showGrid = recipe.variant === "grid" || recipe.variant === "composite";
|
|
66
|
+
const showRipple = recipe.variant === "ripple"
|
|
67
|
+
|| recipe.variant === "composite";
|
|
68
|
+
const gridStyle: ProceduralStyle = {
|
|
69
|
+
"--hraness-design-procedural-grid-offset-x": `${recipe.grid.offsetX}px`,
|
|
70
|
+
"--hraness-design-procedural-grid-offset-y": `${recipe.grid.offsetY}px`,
|
|
71
|
+
"--hraness-design-procedural-grid-opacity": recipe.grid.opacity,
|
|
72
|
+
"--hraness-design-procedural-grid-rotation": `${recipe.grid.rotation}deg`,
|
|
73
|
+
"--hraness-design-procedural-grid-size": `${recipe.grid.size}px`,
|
|
74
|
+
};
|
|
75
|
+
const rippleStyle: ProceduralStyle = {
|
|
76
|
+
"--hraness-design-procedural-ripple-aspect": recipe.ripple.aspect,
|
|
77
|
+
"--hraness-design-procedural-ripple-color":
|
|
78
|
+
colorVariables[recipe.ripple.color],
|
|
79
|
+
"--hraness-design-procedural-ripple-rotation":
|
|
80
|
+
`${recipe.ripple.rotation}deg`,
|
|
81
|
+
"--hraness-design-procedural-ripple-x": `${recipe.ripple.x}%`,
|
|
82
|
+
"--hraness-design-procedural-ripple-y": `${recipe.ripple.y}%`,
|
|
83
|
+
};
|
|
84
|
+
const rootPresentation = stylex.props(effectsStyles.proceduralRoot);
|
|
85
|
+
const atmospherePresentation = stylex.props(
|
|
86
|
+
effectsStyles.proceduralSlot,
|
|
87
|
+
effectsStyles.proceduralAtmosphere,
|
|
88
|
+
);
|
|
89
|
+
const cloudPresentation = stylex.props(effectsStyles.proceduralCloud);
|
|
90
|
+
const gridPresentation = stylex.props(
|
|
91
|
+
effectsStyles.proceduralSlot,
|
|
92
|
+
effectsStyles.proceduralGrid,
|
|
93
|
+
);
|
|
94
|
+
const ripplesPresentation = stylex.props(
|
|
95
|
+
effectsStyles.proceduralSlot,
|
|
96
|
+
effectsStyles.proceduralRipples,
|
|
97
|
+
);
|
|
98
|
+
const ripplePresentation = stylex.props(effectsStyles.proceduralRipple);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div
|
|
102
|
+
{...props}
|
|
103
|
+
{...INERT_PROPS}
|
|
104
|
+
aria-hidden="true"
|
|
105
|
+
className={cn(
|
|
106
|
+
"hraness-design-procedural-backdrop",
|
|
107
|
+
rootPresentation.className,
|
|
108
|
+
className,
|
|
109
|
+
)}
|
|
110
|
+
data-recipe-version={recipe.version}
|
|
111
|
+
data-variation={recipe.variation}
|
|
112
|
+
data-variant={recipe.variant}
|
|
113
|
+
role="presentation"
|
|
114
|
+
style={rootStyle}
|
|
115
|
+
>
|
|
116
|
+
{showAtmosphere ? (
|
|
117
|
+
<span
|
|
118
|
+
className={cn(
|
|
119
|
+
"hraness-design-procedural-backdrop__atmosphere",
|
|
120
|
+
atmospherePresentation.className,
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
{recipe.atmosphere.map((layer, index) => {
|
|
124
|
+
const layerStyle: ProceduralStyle = {
|
|
125
|
+
"--hraness-design-procedural-layer-blur": `${layer.blur}px`,
|
|
126
|
+
"--hraness-design-procedural-layer-color": colorVariables[layer.color],
|
|
127
|
+
"--hraness-design-procedural-layer-delay": `${layer.delay}ms`,
|
|
128
|
+
"--hraness-design-procedural-layer-drift-x": `${layer.driftX}px`,
|
|
129
|
+
"--hraness-design-procedural-layer-drift-y": `${layer.driftY}px`,
|
|
130
|
+
"--hraness-design-procedural-layer-duration": `${layer.duration}ms`,
|
|
131
|
+
"--hraness-design-procedural-layer-height": `${layer.height}%`,
|
|
132
|
+
"--hraness-design-procedural-layer-opacity": layer.opacity,
|
|
133
|
+
"--hraness-design-procedural-layer-rotation": `${layer.rotation}deg`,
|
|
134
|
+
"--hraness-design-procedural-layer-scale": layer.scale,
|
|
135
|
+
"--hraness-design-procedural-layer-width": `${layer.width}%`,
|
|
136
|
+
"--hraness-design-procedural-layer-x": `${layer.x}%`,
|
|
137
|
+
"--hraness-design-procedural-layer-y": `${layer.y}%`,
|
|
138
|
+
};
|
|
139
|
+
return (
|
|
140
|
+
<i
|
|
141
|
+
className={cn(
|
|
142
|
+
"hraness-design-procedural-backdrop__cloud",
|
|
143
|
+
cloudPresentation.className,
|
|
144
|
+
)}
|
|
145
|
+
key={index}
|
|
146
|
+
style={layerStyle}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
})}
|
|
150
|
+
</span>
|
|
151
|
+
) : null}
|
|
152
|
+
{showGrid ? (
|
|
153
|
+
<span
|
|
154
|
+
className={cn(
|
|
155
|
+
"hraness-design-procedural-backdrop__grid",
|
|
156
|
+
gridPresentation.className,
|
|
157
|
+
)}
|
|
158
|
+
style={gridStyle}
|
|
159
|
+
/>
|
|
160
|
+
) : null}
|
|
161
|
+
{showRipple ? (
|
|
162
|
+
<span
|
|
163
|
+
className={cn(
|
|
164
|
+
"hraness-design-procedural-backdrop__ripples",
|
|
165
|
+
ripplesPresentation.className,
|
|
166
|
+
)}
|
|
167
|
+
style={rippleStyle}
|
|
168
|
+
>
|
|
169
|
+
{recipe.ripple.contours.map((contour, index) => {
|
|
170
|
+
const contourStyle: ProceduralStyle = {
|
|
171
|
+
"--hraness-design-procedural-ripple-delay": `${contour.delay}ms`,
|
|
172
|
+
"--hraness-design-procedural-ripple-duration":
|
|
173
|
+
`${contour.duration}ms`,
|
|
174
|
+
"--hraness-design-procedural-ripple-opacity": contour.opacity,
|
|
175
|
+
"--hraness-design-procedural-ripple-size": `${contour.size}%`,
|
|
176
|
+
};
|
|
177
|
+
return (
|
|
178
|
+
<i
|
|
179
|
+
className={cn(
|
|
180
|
+
"hraness-design-procedural-backdrop__ripple",
|
|
181
|
+
ripplePresentation.className,
|
|
182
|
+
)}
|
|
183
|
+
key={index}
|
|
184
|
+
style={contourStyle}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
})}
|
|
188
|
+
</span>
|
|
189
|
+
) : null}
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
export const proceduralBackdropVariants = [
|
|
2
|
+
"atmosphere",
|
|
3
|
+
"grid",
|
|
4
|
+
"ripple",
|
|
5
|
+
"composite",
|
|
6
|
+
] as const;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Increment this whenever recipe generation changes intentionally. The value
|
|
10
|
+
* participates in the PRNG namespace so old and new compositions cannot be
|
|
11
|
+
* mistaken for the same brand artifact.
|
|
12
|
+
*/
|
|
13
|
+
export const proceduralRecipeVersion = 1 as const;
|
|
14
|
+
|
|
15
|
+
export type ProceduralBackdropVariant =
|
|
16
|
+
(typeof proceduralBackdropVariants)[number];
|
|
17
|
+
|
|
18
|
+
export type ProceduralEffectPalette = Readonly<{
|
|
19
|
+
highlight: string;
|
|
20
|
+
key: string;
|
|
21
|
+
shadow: string;
|
|
22
|
+
support: string;
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
export type ProceduralEffectInput = Readonly<{
|
|
26
|
+
palette?: ProceduralEffectPalette;
|
|
27
|
+
seed: string;
|
|
28
|
+
variation?: number;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export type ProceduralBackdropInput = ProceduralEffectInput & Readonly<{
|
|
32
|
+
variant?: ProceduralBackdropVariant;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
export type ProceduralColorRole = keyof ProceduralEffectPalette;
|
|
36
|
+
|
|
37
|
+
export type ProceduralAtmosphereLayer = Readonly<{
|
|
38
|
+
blur: number;
|
|
39
|
+
color: ProceduralColorRole;
|
|
40
|
+
delay: number;
|
|
41
|
+
driftX: number;
|
|
42
|
+
driftY: number;
|
|
43
|
+
duration: number;
|
|
44
|
+
height: number;
|
|
45
|
+
opacity: number;
|
|
46
|
+
rotation: number;
|
|
47
|
+
scale: number;
|
|
48
|
+
width: number;
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
export type ProceduralGridRecipe = Readonly<{
|
|
54
|
+
offsetX: number;
|
|
55
|
+
offsetY: number;
|
|
56
|
+
opacity: number;
|
|
57
|
+
rotation: number;
|
|
58
|
+
size: number;
|
|
59
|
+
}>;
|
|
60
|
+
|
|
61
|
+
export type ProceduralRippleContour = Readonly<{
|
|
62
|
+
delay: number;
|
|
63
|
+
duration: number;
|
|
64
|
+
opacity: number;
|
|
65
|
+
size: number;
|
|
66
|
+
}>;
|
|
67
|
+
|
|
68
|
+
export type ProceduralRippleRecipe = Readonly<{
|
|
69
|
+
aspect: number;
|
|
70
|
+
color: ProceduralColorRole;
|
|
71
|
+
contours: readonly ProceduralRippleContour[];
|
|
72
|
+
rotation: number;
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
}>;
|
|
76
|
+
|
|
77
|
+
export type ProceduralBackdropRecipe = Readonly<{
|
|
78
|
+
atmosphere: readonly ProceduralAtmosphereLayer[];
|
|
79
|
+
grid: ProceduralGridRecipe;
|
|
80
|
+
palette: ProceduralEffectPalette;
|
|
81
|
+
ripple: ProceduralRippleRecipe;
|
|
82
|
+
seed: string;
|
|
83
|
+
variation: number;
|
|
84
|
+
variant: ProceduralBackdropVariant;
|
|
85
|
+
version: typeof proceduralRecipeVersion;
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
export type ParticleHaloParticle = Readonly<{
|
|
89
|
+
color: ProceduralColorRole;
|
|
90
|
+
delay: number;
|
|
91
|
+
driftX: number;
|
|
92
|
+
driftY: number;
|
|
93
|
+
duration: number;
|
|
94
|
+
opacity: number;
|
|
95
|
+
size: number;
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
}>;
|
|
99
|
+
|
|
100
|
+
export type ParticleHaloRecipe = Readonly<{
|
|
101
|
+
palette: ProceduralEffectPalette;
|
|
102
|
+
particles: readonly ParticleHaloParticle[];
|
|
103
|
+
seed: string;
|
|
104
|
+
variation: number;
|
|
105
|
+
version: typeof proceduralRecipeVersion;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
const defaultProceduralEffectPalette = {
|
|
109
|
+
highlight: "var(--aurora-gold)",
|
|
110
|
+
key: "var(--aurora-rose)",
|
|
111
|
+
shadow: "var(--aurora-violet)",
|
|
112
|
+
support: "var(--aurora-cyan)",
|
|
113
|
+
} as const satisfies ProceduralEffectPalette;
|
|
114
|
+
|
|
115
|
+
const colorRoles = [
|
|
116
|
+
"key",
|
|
117
|
+
"support",
|
|
118
|
+
"highlight",
|
|
119
|
+
"shadow",
|
|
120
|
+
] as const satisfies readonly ProceduralColorRole[];
|
|
121
|
+
|
|
122
|
+
function normalizeSeed(seed: string): string {
|
|
123
|
+
const normalized = seed.trim();
|
|
124
|
+
if (normalized.length === 0) {
|
|
125
|
+
throw new RangeError("A procedural effect seed must contain a non-whitespace character.");
|
|
126
|
+
}
|
|
127
|
+
return normalized;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function normalizeVariation(variation: number | undefined): number {
|
|
131
|
+
const normalized = variation ?? 0;
|
|
132
|
+
if (!Number.isSafeInteger(normalized)) {
|
|
133
|
+
throw new RangeError("A procedural effect variation must be a safe integer.");
|
|
134
|
+
}
|
|
135
|
+
return normalized === 0 ? 0 : normalized;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function normalizePalette(
|
|
139
|
+
palette: ProceduralEffectPalette | undefined,
|
|
140
|
+
): ProceduralEffectPalette {
|
|
141
|
+
const normalized = palette ?? defaultProceduralEffectPalette;
|
|
142
|
+
for (const role of colorRoles) {
|
|
143
|
+
if (normalized[role].trim().length === 0) {
|
|
144
|
+
throw new RangeError(`A procedural effect palette requires a nonblank ${role} color.`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
highlight: normalized.highlight.trim(),
|
|
149
|
+
key: normalized.key.trim(),
|
|
150
|
+
shadow: normalized.shadow.trim(),
|
|
151
|
+
support: normalized.support.trim(),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function seedHash(value: string): number {
|
|
156
|
+
let hash = 0x811c9dc5;
|
|
157
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
158
|
+
hash ^= value.charCodeAt(index);
|
|
159
|
+
hash = Math.imul(hash, 0x01000193);
|
|
160
|
+
}
|
|
161
|
+
return hash >>> 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function seededUnitSequence(seed: string): () => number {
|
|
165
|
+
let state = seedHash(seed);
|
|
166
|
+
return () => {
|
|
167
|
+
state = (state + 0x6d2b79f5) >>> 0;
|
|
168
|
+
let value = state;
|
|
169
|
+
value = Math.imul(value ^ (value >>> 15), value | 1);
|
|
170
|
+
value ^= value + Math.imul(value ^ (value >>> 7), value | 61);
|
|
171
|
+
return ((value ^ (value >>> 14)) >>> 0) / 4_294_967_296;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function rounded(value: number, places = 3): number {
|
|
176
|
+
const scale = 10 ** places;
|
|
177
|
+
const result = Math.round(value * scale) / scale;
|
|
178
|
+
return result === 0 ? 0 : result;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function between(
|
|
182
|
+
next: () => number,
|
|
183
|
+
minimum: number,
|
|
184
|
+
maximum: number,
|
|
185
|
+
): number {
|
|
186
|
+
return rounded(minimum + next() * (maximum - minimum));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function integerBetween(
|
|
190
|
+
next: () => number,
|
|
191
|
+
minimum: number,
|
|
192
|
+
maximum: number,
|
|
193
|
+
): number {
|
|
194
|
+
return Math.floor(minimum + next() * (maximum - minimum + 1));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function negativeIntegerBetween(
|
|
198
|
+
next: () => number,
|
|
199
|
+
minimum: number,
|
|
200
|
+
maximum: number,
|
|
201
|
+
): number {
|
|
202
|
+
const value = integerBetween(next, minimum, maximum);
|
|
203
|
+
return value === 0 ? 0 : -value;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function colorRole(next: () => number): ProceduralColorRole {
|
|
207
|
+
return colorRoles[integerBetween(next, 0, colorRoles.length - 1)] ?? "key";
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function proceduralIdentity(
|
|
211
|
+
input: ProceduralEffectInput,
|
|
212
|
+
recipeName: "backdrop" | "halo",
|
|
213
|
+
) {
|
|
214
|
+
const seed = normalizeSeed(input.seed);
|
|
215
|
+
const variation = normalizeVariation(input.variation);
|
|
216
|
+
return {
|
|
217
|
+
next: seededUnitSequence(
|
|
218
|
+
`hraness-design-procedural-v${proceduralRecipeVersion}\0${recipeName}\0${seed}\0${variation}`,
|
|
219
|
+
),
|
|
220
|
+
palette: normalizePalette(input.palette),
|
|
221
|
+
seed,
|
|
222
|
+
variation,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Produces stable, bounded, JSON-serializable geometry for the decorative
|
|
228
|
+
* backdrop. Rendering stays separate so this recipe can be tested without a
|
|
229
|
+
* browser and emitted during server rendering.
|
|
230
|
+
*/
|
|
231
|
+
export function createProceduralBackdropRecipe(
|
|
232
|
+
input: ProceduralBackdropInput,
|
|
233
|
+
): ProceduralBackdropRecipe {
|
|
234
|
+
const { next, palette, seed, variation } = proceduralIdentity(
|
|
235
|
+
input,
|
|
236
|
+
"backdrop",
|
|
237
|
+
);
|
|
238
|
+
const variant = input.variant ?? "composite";
|
|
239
|
+
if (!proceduralBackdropVariants.includes(variant)) {
|
|
240
|
+
throw new RangeError(`Unsupported procedural backdrop variant: ${variant}.`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const atmosphere = Array.from({ length: 5 }, () => ({
|
|
244
|
+
blur: between(next, 24, 54),
|
|
245
|
+
color: colorRole(next),
|
|
246
|
+
delay: negativeIntegerBetween(next, 0, 9_000),
|
|
247
|
+
driftX: between(next, -18, 18),
|
|
248
|
+
driftY: between(next, -14, 14),
|
|
249
|
+
duration: integerBetween(next, 10_000, 18_000),
|
|
250
|
+
height: between(next, 34, 68),
|
|
251
|
+
opacity: between(next, 0.16, 0.34),
|
|
252
|
+
rotation: between(next, -28, 28),
|
|
253
|
+
scale: between(next, 1.02, 1.12),
|
|
254
|
+
width: between(next, 42, 78),
|
|
255
|
+
x: between(next, 8, 92),
|
|
256
|
+
y: between(next, 8, 92),
|
|
257
|
+
}));
|
|
258
|
+
|
|
259
|
+
const gridSize = integerBetween(next, 42, 72);
|
|
260
|
+
const grid = {
|
|
261
|
+
offsetX: integerBetween(next, 0, gridSize - 1),
|
|
262
|
+
offsetY: integerBetween(next, 0, gridSize - 1),
|
|
263
|
+
opacity: between(next, 0.045, 0.095),
|
|
264
|
+
rotation: between(next, -2.5, 2.5),
|
|
265
|
+
size: gridSize,
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const ripple = {
|
|
269
|
+
aspect: between(next, 0.62, 0.9),
|
|
270
|
+
color: colorRole(next),
|
|
271
|
+
contours: Array.from({ length: 4 }, (_, index) => ({
|
|
272
|
+
delay: negativeIntegerBetween(next, 0, 7_000),
|
|
273
|
+
duration: integerBetween(next, 8_000, 14_000),
|
|
274
|
+
opacity: between(next, 0.08, 0.18),
|
|
275
|
+
size: between(next, 28 + index * 13, 36 + index * 16),
|
|
276
|
+
})),
|
|
277
|
+
rotation: between(next, -18, 18),
|
|
278
|
+
x: between(next, 24, 76),
|
|
279
|
+
y: between(next, 22, 78),
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
atmosphere,
|
|
284
|
+
grid,
|
|
285
|
+
palette,
|
|
286
|
+
ripple,
|
|
287
|
+
seed,
|
|
288
|
+
variation,
|
|
289
|
+
variant,
|
|
290
|
+
version: proceduralRecipeVersion,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** Produces a stable particle ring while leaving semantic content untouched. */
|
|
295
|
+
export function createParticleHaloRecipe(
|
|
296
|
+
input: ProceduralEffectInput,
|
|
297
|
+
): ParticleHaloRecipe {
|
|
298
|
+
const { next, palette, seed, variation } = proceduralIdentity(input, "halo");
|
|
299
|
+
const particles = Array.from({ length: 24 }, (_, index) => {
|
|
300
|
+
const angle = (index / 24) * Math.PI * 2 + between(next, -0.11, 0.11);
|
|
301
|
+
const radiusX = between(next, 35, 49);
|
|
302
|
+
const radiusY = between(next, 34, 48);
|
|
303
|
+
return {
|
|
304
|
+
color: colorRole(next),
|
|
305
|
+
delay: negativeIntegerBetween(next, 0, 7_000),
|
|
306
|
+
driftX: between(next, -7, 7),
|
|
307
|
+
driftY: between(next, -7, 7),
|
|
308
|
+
duration: integerBetween(next, 7_000, 13_000),
|
|
309
|
+
opacity: between(next, 0.26, 0.62),
|
|
310
|
+
size: between(next, 2, 6),
|
|
311
|
+
x: rounded(50 + Math.cos(angle) * radiusX),
|
|
312
|
+
y: rounded(50 + Math.sin(angle) * radiusY),
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
palette,
|
|
318
|
+
particles,
|
|
319
|
+
seed,
|
|
320
|
+
variation,
|
|
321
|
+
version: proceduralRecipeVersion,
|
|
322
|
+
};
|
|
323
|
+
}
|