skyloom-ui 0.1.1 → 0.1.2

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.
Files changed (101) hide show
  1. package/README.md +291 -4
  2. package/dist/advanced.css +89 -0
  3. package/dist/components/accordion.js +3 -2
  4. package/dist/components/advanced-forms.d.ts +40 -0
  5. package/dist/components/advanced-forms.js +66 -0
  6. package/dist/components/advanced-layout.d.ts +29 -0
  7. package/dist/components/advanced-layout.js +49 -0
  8. package/dist/components/ai-status.d.ts +29 -0
  9. package/dist/components/ai-status.js +19 -0
  10. package/dist/components/alert.d.ts +1 -1
  11. package/dist/components/alert.js +1 -0
  12. package/dist/components/animated-tooltip.d.ts +10 -0
  13. package/dist/components/animated-tooltip.js +17 -0
  14. package/dist/components/badge.d.ts +4 -2
  15. package/dist/components/badge.js +7 -4
  16. package/dist/components/breadcrumb.d.ts +1 -1
  17. package/dist/components/breadcrumb.js +2 -1
  18. package/dist/components/button-group.d.ts +5 -0
  19. package/dist/components/button-group.js +8 -0
  20. package/dist/components/button.d.ts +4 -4
  21. package/dist/components/button.js +8 -3
  22. package/dist/components/card.d.ts +6 -1
  23. package/dist/components/card.js +13 -2
  24. package/dist/components/code-block.d.ts +31 -0
  25. package/dist/components/code-block.js +49 -0
  26. package/dist/components/compare.d.ts +17 -0
  27. package/dist/components/compare.js +39 -0
  28. package/dist/components/data-table-columns.d.ts +24 -0
  29. package/dist/components/data-table-columns.js +60 -0
  30. package/dist/components/data-table.d.ts +9 -1
  31. package/dist/components/data-table.js +16 -6
  32. package/dist/components/dialog.d.ts +11 -2
  33. package/dist/components/dialog.js +13 -2
  34. package/dist/components/dropdown-menu.js +2 -2
  35. package/dist/components/feature-card.d.ts +9 -0
  36. package/dist/components/feature-card.js +6 -0
  37. package/dist/components/fields.d.ts +9 -2
  38. package/dist/components/fields.js +10 -5
  39. package/dist/components/globe-renderer.d.ts +7 -0
  40. package/dist/components/globe-renderer.js +32 -0
  41. package/dist/components/globe.d.ts +9 -0
  42. package/dist/components/globe.js +25 -0
  43. package/dist/components/icon.d.ts +26 -0
  44. package/dist/components/icon.js +26 -0
  45. package/dist/components/image-generation-loader.d.ts +15 -0
  46. package/dist/components/image-generation-loader.js +93 -0
  47. package/dist/components/interactive-card.d.ts +6 -0
  48. package/dist/components/interactive-card.js +18 -0
  49. package/dist/components/link-preview.d.ts +25 -0
  50. package/dist/components/link-preview.js +84 -0
  51. package/dist/components/loader.d.ts +18 -0
  52. package/dist/components/loader.js +17 -0
  53. package/dist/components/loading.js +1 -1
  54. package/dist/components/message.d.ts +8 -0
  55. package/dist/components/message.js +11 -0
  56. package/dist/components/motion.d.ts +32 -0
  57. package/dist/components/motion.js +63 -0
  58. package/dist/components/multi-step-loader.d.ts +16 -0
  59. package/dist/components/multi-step-loader.js +29 -0
  60. package/dist/components/navigation.d.ts +76 -0
  61. package/dist/components/navigation.js +99 -0
  62. package/dist/components/popover.js +1 -1
  63. package/dist/components/progress.js +1 -1
  64. package/dist/components/prompt-input.d.ts +17 -0
  65. package/dist/components/prompt-input.js +27 -0
  66. package/dist/components/select.js +4 -3
  67. package/dist/components/sheet.js +2 -1
  68. package/dist/components/stat-card.d.ts +10 -0
  69. package/dist/components/stat-card.js +6 -0
  70. package/dist/components/tabs.d.ts +3 -1
  71. package/dist/components/tabs.js +4 -4
  72. package/dist/components/text-effects.d.ts +48 -0
  73. package/dist/components/text-effects.js +105 -0
  74. package/dist/components/theme-controls.d.ts +2 -0
  75. package/dist/components/theme-controls.js +17 -0
  76. package/dist/components/theme-provider.d.ts +20 -0
  77. package/dist/components/theme-provider.js +50 -0
  78. package/dist/components/theme-script.d.ts +9 -0
  79. package/dist/components/theme-script.js +8 -0
  80. package/dist/components/timeline.d.ts +12 -0
  81. package/dist/components/timeline.js +11 -0
  82. package/dist/components/tooltip.js +1 -1
  83. package/dist/components/use-column-layout.d.ts +6 -0
  84. package/dist/components/use-column-layout.js +38 -0
  85. package/dist/components/use-column-pinning.d.ts +10 -0
  86. package/dist/components/use-column-pinning.js +50 -0
  87. package/dist/components/world-map.d.ts +17 -0
  88. package/dist/components/world-map.js +13 -0
  89. package/dist/data/land.d.ts +1 -0
  90. package/dist/data/land.js +2 -0
  91. package/dist/index.d.ts +33 -5
  92. package/dist/index.js +30 -3
  93. package/dist/lib/canvas-tokens.d.ts +5 -0
  94. package/dist/lib/canvas-tokens.js +34 -0
  95. package/dist/lib/column-layout.d.ts +36 -0
  96. package/dist/lib/column-layout.js +69 -0
  97. package/dist/lib/theme-settings.d.ts +22 -0
  98. package/dist/lib/theme-settings.js +36 -0
  99. package/dist/styles.css +56 -3
  100. package/dist/tokens.css +273 -153
  101. package/package.json +20 -3
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
4
+ import { motion as animated } from "motion/react";
5
+ import { Button } from "./button.js";
6
+ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "./card.js";
7
+ import { useAnimationActivity } from "./motion.js";
8
+ import { canvas2D, resolveCanvasColor } from "../lib/canvas-tokens.js";
9
+ import { cn } from "../lib/utils.js";
10
+ const segments = (text) => Array.from(new Intl.Segmenter(undefined, { granularity: "grapheme" }).segment(text), part => part.segment);
11
+ function RevealText({ text, className, duration = 1200, motion, replayKey, effect }) {
12
+ const activity = useAnimationActivity(motion), [count, setCount] = useState(0), [tick, setTick] = useState(0);
13
+ const units = useMemo(() => effect === "generate" ? text.split(/(\s+)/) : segments(text), [text, effect]);
14
+ const started = useRef(false), completed = useRef(false), elapsed = useRef(0);
15
+ useEffect(() => { setCount(0); elapsed.current = 0; started.current = false; completed.current = false; }, [text, replayKey]);
16
+ useEffect(() => {
17
+ if (!activity.enabled || completed.current)
18
+ return;
19
+ started.current = true;
20
+ const start = performance.now() - elapsed.current;
21
+ const ms = Math.max(100, Number.isFinite(duration) ? duration : 1200);
22
+ const timer = setInterval(() => { elapsed.current = performance.now() - start; const next = Math.min(units.length, Math.floor(elapsed.current / ms * units.length)); setCount(next); setTick(value => value + 1); if (next >= units.length) {
23
+ completed.current = true;
24
+ clearInterval(timer);
25
+ } }, 40);
26
+ return () => clearInterval(timer);
27
+ }, [activity.enabled, units.length, duration, text, replayKey]);
28
+ const shown = !activity.enabled ? units.length : count;
29
+ return _jsx("span", { ref: activity.ref, className: cn("inline-block whitespace-pre-wrap", className), "aria-label": text, children: _jsxs("span", { "aria-hidden": "true", children: [units.map((unit, index) => _jsx("span", { className: cn(effect === "board" && "sky-flap", effect === "generate" && "sky-word-reveal"), style: { opacity: index < shown || effect === "encrypted" || effect === "board" ? 1 : 0, transform: effect === "board" && index >= shown ? "rotateX(70deg)" : undefined }, children: index < shown ? unit : effect === "encrypted" && !/\s/.test(unit) ? "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[(index * 7 + tick * 13) % 36] : unit }, index)), effect === "typewriter" && activity.enabled && !completed.current && _jsx("span", { className: "sky-text-cursor", children: "|" })] }) });
30
+ }
31
+ export const EncryptedText = (props) => _jsx(RevealText, { ...props, effect: "encrypted" });
32
+ export const TextGenerateEffect = ({ words, ...props }) => _jsx(RevealText, { ...props, text: words, effect: "generate" });
33
+ export const TypewriterEffect = (props) => _jsx(RevealText, { ...props, effect: "typewriter" });
34
+ export const TextFlippingBoard = (props) => _jsx(RevealText, { ...props, effect: "board" });
35
+ function CyclingWords({ words, interval = 3000, className, motion, text, effect }) {
36
+ const activity = useAnimationActivity(motion), [index, setIndex] = useState(0), [playing, setPlaying] = useState(true), [revision, setRevision] = useState(0);
37
+ useEffect(() => { if (!activity.enabled || !playing || words.length < 2)
38
+ return; const timer = setInterval(() => setIndex(value => (value + 1) % words.length), Math.max(300, Number.isFinite(interval) ? interval : 3000)); return () => clearInterval(timer); }, [activity.enabled, playing, words.length, interval]);
39
+ const value = words[index % Math.max(1, words.length)] ?? "";
40
+ return _jsxs("div", { ref: activity.ref, className: cn("flex flex-wrap items-center gap-control", className), children: [text && _jsx("span", { children: text }), _jsx(animated.span, { layout: effect !== "words" && activity.enabled, className: cn("inline-block overflow-hidden", effect === "container" && "rounded-control bg-secondary px-inline py-control"), children: _jsx(animated.span, { initial: activity.enabled ? { y: "75%", opacity: 0, rotateX: -45 } : false, animate: { y: "0%", opacity: 1, rotateX: 0 }, transition: { duration: activity.enabled ? .3 : 0 }, className: "inline-block", children: value }, `${index}-${revision}`) }), words.length > 1 && _jsxs("span", { className: "inline-flex gap-control", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setPlaying(!playing), children: playing ? "Pause words" : "Play words" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => { setIndex(0); setRevision(value => value + 1); }, children: "Replay words" })] })] });
41
+ }
42
+ export const FlipWords = (props) => _jsx(CyclingWords, { ...props, effect: "words" });
43
+ export const LayoutTextFlip = (props) => _jsx(CyclingWords, { ...props, effect: "layout" });
44
+ export const ContainerTextFlip = (props) => _jsx(CyclingWords, { ...props, effect: "container" });
45
+ export function ColourfulText({ text, className, motion }) { const activity = useAnimationActivity(motion); return _jsx("span", { ref: activity.ref, "aria-label": text, "data-running": activity.enabled, className: cn("sky-colourful whitespace-pre-wrap", className), children: segments(text).map((char, index) => _jsx("span", { "aria-hidden": "true", style: { "--sky-index": index, color: `var(--chart-${index % 5 + 1})` }, children: char }, index)) }); }
46
+ export function SquigglyText({ children, className, motion }) { const id = useId(), activity = useAnimationActivity(motion); return _jsxs("span", { ref: activity.ref, "data-running": activity.enabled, className: cn("sky-squiggly inline-block", className), children: [_jsx("svg", { "aria-hidden": "true", className: "absolute size-0", children: _jsx("defs", { children: _jsxs("filter", { id: id, children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: ".02", numOctaves: 2, seed: 3 }), _jsx("feDisplacementMap", { in: "SourceGraphic", scale: activity.enabled ? 3 : 0 })] }) }) }), _jsx("span", { style: { filter: activity.enabled ? `url(#${id})` : undefined }, children: children })] }); }
47
+ export function CanvasText({ text, className, motion }) {
48
+ const activity = useAnimationActivity(motion), canvas = useRef(null);
49
+ useEffect(() => {
50
+ const element = activity.node, surface = canvas.current;
51
+ if (!element || !surface)
52
+ return;
53
+ const ctx = canvas2D(surface);
54
+ if (!ctx)
55
+ return;
56
+ const color = resolveCanvasColor(element, "var(--primary)"), accent = resolveCanvasColor(element, "var(--info)");
57
+ let frame = 0;
58
+ const draw = (time) => {
59
+ const rect = element.getBoundingClientRect(), ratio = Math.min(devicePixelRatio || 1, 2);
60
+ if (!rect.width || !rect.height)
61
+ return;
62
+ if (surface.width !== Math.ceil(rect.width * ratio) || surface.height !== Math.ceil(rect.height * ratio)) {
63
+ surface.width = Math.ceil(rect.width * ratio);
64
+ surface.height = Math.ceil(rect.height * ratio);
65
+ }
66
+ ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
67
+ ctx.clearRect(0, 0, rect.width, rect.height);
68
+ const style = getComputedStyle(element);
69
+ ctx.font = `${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
70
+ ctx.textBaseline = "middle";
71
+ ctx.fillStyle = color;
72
+ ctx.fillText(text, 0, rect.height / 2, rect.width);
73
+ ctx.globalCompositeOperation = "source-atop";
74
+ ctx.strokeStyle = accent;
75
+ ctx.lineWidth = rect.height / 8;
76
+ for (let i = -2; i < 8; i++) {
77
+ const x = i * rect.width / 5 + Math.sin(time / 1200) * rect.width / 5;
78
+ ctx.beginPath();
79
+ ctx.moveTo(x, 0);
80
+ ctx.bezierCurveTo(x + rect.height, rect.height / 3, x - rect.height, rect.height * .7, x, rect.height);
81
+ ctx.stroke();
82
+ }
83
+ ctx.globalCompositeOperation = "source-over";
84
+ if (activity.enabled)
85
+ frame = requestAnimationFrame(draw);
86
+ };
87
+ const resize = () => { cancelAnimationFrame(frame); draw(performance.now()); };
88
+ const observer = new ResizeObserver(resize);
89
+ observer.observe(element);
90
+ resize();
91
+ return () => { observer.disconnect(); cancelAnimationFrame(frame); };
92
+ }, [activity.node, activity.enabled, activity.themeKey, text]);
93
+ return _jsxs("span", { ref: activity.ref, className: cn("relative inline-block text-title font-semibold", className), children: [_jsx("span", { children: text }), _jsx("canvas", { ref: canvas, "aria-hidden": "true", className: "pointer-events-none absolute inset-0 size-full" })] });
94
+ }
95
+ export function TextHoverEffect({ text, className }) { const activity = useAnimationActivity(); const [position, setPosition] = useState(50); return _jsx("span", { ref: activity.ref, className: cn("sky-text-hover inline-block text-title font-semibold", className), style: { "--sky-text-position": `${position}%` }, onPointerMove: event => { if (!activity.enabled || event.pointerType === "touch")
96
+ return; const rect = event.currentTarget.getBoundingClientRect(); setPosition((event.clientX - rect.left) / rect.width * 100); }, children: text }); }
97
+ export function HeroHighlight({ children, className }) { return _jsx("div", { className: cn("sky-hero-highlight rounded-surface p-panel", className), children: children }); }
98
+ export function Highlight({ children, className }) { return _jsx("mark", { className: cn("rounded-control bg-secondary px-control text-primary", className), children: children }); }
99
+ export function TextRevealCard({ text, revealText, title = "Reveal another perspective", description, className }) {
100
+ const [revealed, setRevealed] = useState(false), [amount, setAmount] = useState(0), activity = useAnimationActivity();
101
+ return _jsxs(Card, { className: className, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: title }), description && _jsx(CardDescription, { children: description })] }), _jsxs(CardContent, { children: [_jsxs("div", { ref: activity.ref, className: "relative overflow-hidden py-panel text-title font-semibold", onPointerMove: event => { if (event.pointerType === "mouse" && activity.enabled) {
102
+ const rect = event.currentTarget.getBoundingClientRect();
103
+ setAmount((event.clientX - rect.left) / rect.width * 100);
104
+ } }, onPointerLeave: () => setAmount(0), children: [_jsx("span", { children: text }), _jsx("span", { "aria-hidden": !revealed, className: "absolute inset-0 bg-card py-panel text-primary", style: { clipPath: `inset(0 ${100 - (revealed ? 100 : amount)}% 0 0)` }, children: revealText })] }), _jsx(Button, { variant: "outline", "aria-expanded": revealed, onClick: () => setRevealed(!revealed), children: revealed ? "Show original" : "Reveal text" }), !revealed && _jsx("span", { className: "sr-only", children: revealText })] })] });
105
+ }
@@ -0,0 +1,2 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export declare function ThemeControls({ className, ...props }: ComponentPropsWithRef<"div">): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
4
+ import { useTheme } from "./theme-provider.js";
5
+ import { cn } from "../lib/utils.js";
6
+ export function ThemeControls({ className, ...props }) {
7
+ const { settings, themes, fontProfiles, updateSettings } = useTheme();
8
+ const controls = [
9
+ { key: "theme", label: "Color theme", choices: [...themes, { id: "system", label: "System" }] },
10
+ { key: "palette", label: "Color palette", choices: ["sage", "ocean", "violet", "neutral"].map(id => ({ id, label: id[0].toUpperCase() + id.slice(1) })) },
11
+ { key: "appearance", label: "Component appearance", choices: ["default", "classic", "modern"].map(id => ({ id, label: id[0].toUpperCase() + id.slice(1) })) },
12
+ { key: "density", label: "Interface density", choices: [{ id: "comfortable", label: "Comfortable" }, { id: "compact", label: "Compact" }] },
13
+ { key: "font", label: "Typography profile", choices: fontProfiles },
14
+ { key: "motion", label: "Motion preference", choices: [{ id: "system", label: "System motion" }, { id: "reduced", label: "Reduced motion" }, { id: "none", label: "No motion" }] },
15
+ ];
16
+ return _jsx("div", { className: cn("flex min-w-0 flex-wrap items-center gap-control", className), ...props, children: controls.map(control => _jsxs(Select, { value: settings[control.key], onValueChange: value => updateSettings({ [control.key]: value }), children: [_jsx(SelectTrigger, { "aria-label": control.label, className: "w-auto", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: control.choices.map(choice => _jsx(SelectItem, { value: choice.id, children: choice.label }, choice.id)) })] }, control.key)) });
17
+ }
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ import { type FontProfileDefinition, type ThemeDefinition, type ThemeSettings } from "../lib/theme-settings.js";
3
+ type ThemeContextValue = {
4
+ settings: ThemeSettings;
5
+ resolvedTheme: string;
6
+ themes: readonly ThemeDefinition[];
7
+ fontProfiles: readonly FontProfileDefinition[];
8
+ updateSettings: (settings: Partial<ThemeSettings>) => void;
9
+ resetSettings: () => void;
10
+ };
11
+ export type ThemeProviderProps = {
12
+ children: ReactNode;
13
+ themes?: readonly ThemeDefinition[];
14
+ fontProfiles?: readonly FontProfileDefinition[];
15
+ defaultSettings?: Partial<ThemeSettings>;
16
+ storagePrefix?: string;
17
+ };
18
+ export declare function ThemeProvider({ children, themes: registry, fontProfiles: suppliedFonts, defaultSettings, storagePrefix }: ThemeProviderProps): import("react").JSX.Element;
19
+ export declare function useTheme(): ThemeContextValue;
20
+ export {};
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
4
+ import { defaultThemeSettings, initializeTheme, themes, fontProfiles } from "../lib/theme-settings.js";
5
+ const ThemeContext = createContext(null);
6
+ export function ThemeProvider({ children, themes: registry = themes, fontProfiles: suppliedFonts = fontProfiles, defaultSettings, storagePrefix = "sky-ui" }) {
7
+ const fonts = suppliedFonts.length ? suppliedFonts : fontProfiles;
8
+ const defaults = useMemo(() => ({ ...defaultThemeSettings, ...defaultSettings }), [defaultSettings]);
9
+ const [settings, setSettings] = useState(defaults);
10
+ const settingsRef = useRef(settings);
11
+ const initializedNamespace = useRef(null);
12
+ const [resolvedTheme, setResolvedTheme] = useState(defaults.theme === "system" ? "light" : defaults.theme);
13
+ useEffect(() => {
14
+ const refresh = (override) => {
15
+ const next = initializeTheme(registry, fonts, defaults, storagePrefix, override);
16
+ settingsRef.current = next;
17
+ setSettings(next);
18
+ setResolvedTheme(document.documentElement.dataset.theme);
19
+ };
20
+ // Equivalent parent configurations must not reset choices when storage is blocked.
21
+ refresh(initializedNamespace.current === storagePrefix ? settingsRef.current : undefined);
22
+ initializedNamespace.current = storagePrefix;
23
+ const media = window.matchMedia("(prefers-color-scheme: dark)");
24
+ const storage = (event) => { if (event.key === null || event.key.startsWith(`${storagePrefix}-`))
25
+ refresh(); };
26
+ const systemChanged = () => refresh(settingsRef.current);
27
+ media.addEventListener("change", systemChanged);
28
+ window.addEventListener("storage", storage);
29
+ return () => { media.removeEventListener("change", systemChanged); window.removeEventListener("storage", storage); };
30
+ }, [registry, fonts, defaults, storagePrefix]);
31
+ function updateSettings(next) {
32
+ const updated = initializeTheme(registry, fonts, defaults, storagePrefix, { ...settingsRef.current, ...next });
33
+ settingsRef.current = updated;
34
+ setSettings(updated);
35
+ setResolvedTheme(document.documentElement.dataset.theme);
36
+ for (const [key, value] of Object.entries(updated)) {
37
+ try {
38
+ localStorage.setItem(`${storagePrefix}-${key}`, value);
39
+ }
40
+ catch { /* Optional persistence. */ }
41
+ }
42
+ }
43
+ return _jsx(ThemeContext.Provider, { value: { settings, resolvedTheme, themes: registry, fontProfiles: fonts, updateSettings, resetSettings: () => updateSettings(defaults) }, children: children });
44
+ }
45
+ export function useTheme() {
46
+ const context = useContext(ThemeContext);
47
+ if (!context)
48
+ throw new Error("useTheme must be used inside ThemeProvider.");
49
+ return context;
50
+ }
@@ -0,0 +1,9 @@
1
+ import { type FontProfileDefinition, type ThemeDefinition, type ThemeSettings } from "../lib/theme-settings.js";
2
+ /** Place in head; use matching configuration on ThemeProvider. */
3
+ export declare function ThemeScript({ nonce, themes: registry, fontProfiles: suppliedFonts, defaultSettings, storagePrefix }: {
4
+ nonce?: string;
5
+ themes?: readonly ThemeDefinition[];
6
+ fontProfiles?: readonly FontProfileDefinition[];
7
+ defaultSettings?: Partial<ThemeSettings>;
8
+ storagePrefix?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { defaultThemeSettings, initializeTheme, themes, fontProfiles } from "../lib/theme-settings.js";
3
+ /** Place in head; use matching configuration on ThemeProvider. */
4
+ export function ThemeScript({ nonce, themes: registry = themes, fontProfiles: suppliedFonts = fontProfiles, defaultSettings, storagePrefix = "sky-ui" }) {
5
+ const fonts = suppliedFonts.length ? suppliedFonts : fontProfiles;
6
+ const args = JSON.stringify([registry, fonts, { ...defaultThemeSettings, ...defaultSettings }, storagePrefix]).replace(/</g, "\\u003c");
7
+ return _jsx("script", { nonce: nonce, dangerouslySetInnerHTML: { __html: `(${initializeTheme.toString()})(...${args});` } });
8
+ }
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from "react";
2
+ export type TimelineItem = {
3
+ id: string;
4
+ title: string;
5
+ content: ReactNode;
6
+ date?: string;
7
+ };
8
+ export declare function Timeline({ items, variant, className }: {
9
+ items: readonly TimelineItem[];
10
+ variant?: "simple" | "progress";
11
+ className?: string;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { motion as animated, useScroll } from "motion/react";
5
+ import { useMotionPolicy } from "./motion.js";
6
+ import { cn } from "../lib/utils.js";
7
+ export function Timeline({ items, variant = "simple", className }) {
8
+ const ref = useRef(null), { enabled } = useMotionPolicy();
9
+ const { scrollYProgress } = useScroll({ target: ref, offset: ["start end", "end center"] });
10
+ return _jsxs("div", { ref: ref, className: cn("relative grid gap-panel ps-panel", className), children: [_jsx("span", { "aria-hidden": "true", className: "absolute inset-y-0 start-0 w-hairline bg-border" }), variant === "progress" && _jsx(animated.span, { "aria-hidden": "true", className: "absolute inset-y-0 start-0 w-hairline origin-top bg-primary", style: { scaleY: enabled ? scrollYProgress : 1 } }), _jsx("ol", { className: "grid gap-panel", children: items.map(item => _jsxs("li", { className: "grid min-w-0 gap-stack tablet:grid-cols-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-title font-semibold", children: item.title }), item.date && _jsx("time", { className: "text-caption text-muted-foreground", children: item.date })] }), _jsx("div", { className: "min-w-0 text-label leading-body tablet:col-span-2", children: item.content })] }, item.id)) })] });
11
+ }
@@ -6,5 +6,5 @@ export const TooltipProvider = Primitive.Provider;
6
6
  export const Tooltip = Primitive.Root;
7
7
  export const TooltipTrigger = Primitive.Trigger;
8
8
  export function TooltipContent({ className, children, ...props }) {
9
- return _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { className: cn("sky-tooltip max-w-tooltip rounded-control bg-foreground px-inline py-control text-label text-background shadow-raised", className), ...props, children: [children, _jsx(Primitive.Arrow, { className: "fill-foreground" })] }) });
9
+ return _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { className: cn("sky-enter sky-tooltip max-w-tooltip rounded-control bg-foreground px-inline py-control text-label text-background shadow-raised", className), ...props, children: [children, _jsx(Primitive.Arrow, { className: "fill-foreground" })] }) });
10
10
  }
@@ -0,0 +1,6 @@
1
+ import { type ColumnLayoutAction, type ColumnLayoutDefinition, type DataTableColumnLayout } from "../lib/column-layout.js";
2
+ export declare function useColumnLayout(columns: readonly ColumnLayoutDefinition[], controlled: DataTableColumnLayout | undefined, defaults: DataTableColumnLayout | undefined, onChange: ((layout: DataTableColumnLayout) => void) | undefined, storageKey: string | undefined): {
3
+ layout: DataTableColumnLayout;
4
+ change: (action: ColumnLayoutAction) => void;
5
+ reset: () => void;
6
+ };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
+ import { changeColumnLayout, normalizeColumnLayout, readStoredColumnLayout } from "../lib/column-layout.js";
4
+ export function useColumnLayout(columns, controlled, defaults, onChange, storageKey) {
5
+ const [internal, setInternal] = useState(() => normalizeColumnLayout(columns, defaults));
6
+ const controlledRef = useRef(controlled);
7
+ controlledRef.current = controlled;
8
+ const defaultsRef = useRef(defaults);
9
+ defaultsRef.current = defaults;
10
+ useEffect(() => {
11
+ if (controlledRef.current !== undefined)
12
+ return;
13
+ let value = defaultsRef.current;
14
+ if (storageKey) {
15
+ try {
16
+ const saved = JSON.parse(localStorage.getItem(storageKey) ?? "null");
17
+ value = readStoredColumnLayout(saved) ?? value;
18
+ }
19
+ catch { /* Missing, invalid, or unavailable storage uses defaults. */ }
20
+ }
21
+ // Normalization happens on render against the latest definitions.
22
+ setInternal(value ?? normalizeColumnLayout([]));
23
+ }, [storageKey, controlled !== undefined]);
24
+ const layout = useMemo(() => normalizeColumnLayout(columns, controlled ?? internal), [columns, controlled, internal]);
25
+ function commit(next) {
26
+ if (controlled === undefined) {
27
+ setInternal(next);
28
+ if (storageKey) {
29
+ try {
30
+ localStorage.setItem(storageKey, JSON.stringify({ version: 1, layout: next }));
31
+ }
32
+ catch { /* Optional persistence. */ }
33
+ }
34
+ }
35
+ onChange?.(next);
36
+ }
37
+ return { layout, change: (action) => commit(changeColumnLayout(columns, layout, action)), reset: () => commit(normalizeColumnLayout(columns, defaults)) };
38
+ }
@@ -0,0 +1,10 @@
1
+ import { type CSSProperties } from "react";
2
+ import { type DataTableColumnLayout } from "../lib/column-layout.js";
3
+ export declare function useColumnPinning(layout: DataTableColumnLayout): {
4
+ tableRef: import("react").Dispatch<import("react").SetStateAction<HTMLTableElement | null>>;
5
+ cellProps: (id: string) => {
6
+ "data-pinned"?: string;
7
+ style?: CSSProperties;
8
+ };
9
+ suspended: boolean;
10
+ };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ import { columnsInRegion, columnRegion } from "../lib/column-layout.js";
4
+ export function useColumnPinning(layout) {
5
+ const [table, setTable] = useState(null);
6
+ const [measurements, setMeasurements] = useState({ widths: {}, viewport: 0, minimum: 0 });
7
+ const signature = JSON.stringify(layout);
8
+ useEffect(() => {
9
+ const viewport = table?.parentElement;
10
+ if (!table || !viewport || typeof ResizeObserver === "undefined")
11
+ return;
12
+ let frame = 0, disposed = false;
13
+ const measure = () => {
14
+ if (disposed)
15
+ return;
16
+ cancelAnimationFrame(frame);
17
+ frame = requestAnimationFrame(() => {
18
+ const root = getComputedStyle(document.documentElement);
19
+ const minimum = parseFloat(root.getPropertyValue("--sky-table-center-min")) * parseFloat(root.fontSize);
20
+ const widths = Object.fromEntries([...table.querySelectorAll("thead th[data-column-id]")].map(cell => [cell.dataset.columnId, cell.getBoundingClientRect().width]));
21
+ const next = { widths, viewport: viewport.clientWidth, minimum };
22
+ setMeasurements(previous => JSON.stringify(previous) === JSON.stringify(next) ? previous : next);
23
+ });
24
+ };
25
+ const observer = new ResizeObserver(measure);
26
+ observer.observe(viewport);
27
+ observer.observe(table);
28
+ table.querySelectorAll("thead th").forEach(cell => observer.observe(cell));
29
+ const rootObserver = new MutationObserver(measure);
30
+ rootObserver.observe(document.documentElement, { attributes: true });
31
+ document.fonts?.ready.then(measure);
32
+ document.fonts?.addEventListener("loadingdone", measure);
33
+ measure();
34
+ return () => { disposed = true; cancelAnimationFrame(frame); observer.disconnect(); rootObserver.disconnect(); document.fonts?.removeEventListener("loadingdone", measure); };
35
+ }, [table, signature]);
36
+ const start = columnsInRegion(layout, "start", true), end = columnsInRegion(layout, "end", true);
37
+ const pinnedWidth = [...start, ...end].reduce((sum, id) => sum + (measurements.widths[id] ?? 0), 0);
38
+ const hasPins = start.length + end.length > 0;
39
+ const active = hasPins && measurements.viewport > 0 && [...start, ...end].every(id => measurements.widths[id] > 0) && pinnedWidth + measurements.minimum <= measurements.viewport;
40
+ function cellProps(id) {
41
+ const region = columnRegion(layout, id);
42
+ if (!active || region === "center")
43
+ return {};
44
+ const group = region === "start" ? start : [...end].reverse();
45
+ const offset = group.slice(0, group.indexOf(id)).reduce((sum, item) => sum + (measurements.widths[item] ?? 0), 0);
46
+ // Measured browser geometry, not an authored fixed dimension.
47
+ return { "data-pinned": region, style: region === "start" ? { insetInlineStart: offset } : { insetInlineEnd: offset } };
48
+ }
49
+ return { tableRef: setTable, cellProps, suspended: hasPins && !active };
50
+ }
@@ -0,0 +1,17 @@
1
+ export type GeoPoint = {
2
+ lat: number;
3
+ lng: number;
4
+ label?: string;
5
+ };
6
+ export type GeoConnection = {
7
+ id: string;
8
+ start: GeoPoint;
9
+ end: GeoPoint;
10
+ };
11
+ export declare const validPoint: (point: GeoPoint) => boolean;
12
+ export declare function WorldMap({ connections, variant, label, className }: {
13
+ connections?: readonly GeoConnection[];
14
+ variant?: "dots" | "outline";
15
+ label?: string;
16
+ className?: string;
17
+ }): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from "react";
4
+ import { landRings } from "../data/land.js";
5
+ import { useAnimationActivity } from "./motion.js";
6
+ export const validPoint = (point) => Number.isFinite(point.lat) && Number.isFinite(point.lng) && Math.abs(point.lat) <= 90 && Math.abs(point.lng) <= 180;
7
+ const project = ([lng, lat]) => [lng + 180, 90 - lat];
8
+ const land = landRings.map(ring => ring.map((point, index) => `${index ? "L" : "M"}${project(point).join(",")}`).join(" ") + "Z").join(" ");
9
+ export function WorldMap({ connections = [], variant = "dots", label = "World connections", className }) {
10
+ const id = useId(), activity = useAnimationActivity();
11
+ const valid = connections.filter(item => validPoint(item.start) && validPoint(item.end));
12
+ return _jsxs("figure", { ref: activity.ref, className: className, children: [_jsxs("svg", { viewBox: "0 0 360 180", role: "img", "aria-label": label, className: "w-full rounded-surface bg-card", children: [_jsx("defs", { children: _jsx("pattern", { id: `${id}-dots`, width: 3, height: 3, patternUnits: "userSpaceOnUse", children: _jsx("circle", { cx: 1, cy: 1, r: .6, fill: "var(--muted-foreground)" }) }) }), _jsx("path", { d: land, fill: variant === "dots" ? `url(#${id}-dots)` : "var(--muted)", stroke: variant === "outline" ? "var(--border)" : "none", strokeWidth: .4 }), valid.map(item => { const [x1, y1] = project([item.start.lng, item.start.lat]), [x2, y2] = project([item.end.lng, item.end.lat]); return _jsxs("g", { children: [_jsx("path", { className: activity.enabled ? "sky-map-arc" : undefined, d: `M${x1},${y1} Q${(x1 + x2) / 2},${Math.min(y1, y2) - Math.abs(x2 - x1) / 4} ${x2},${y2}`, fill: "none", stroke: "var(--primary)", strokeWidth: 1, pathLength: 1 }), _jsx("circle", { cx: x1, cy: y1, r: 1.8, fill: "var(--primary)" }), _jsx("circle", { cx: x2, cy: y2, r: 1.8, fill: "var(--info)" })] }, item.id); })] }), _jsx("figcaption", { className: "mt-control text-caption text-muted-foreground", children: label }), _jsxs("details", { className: "text-caption", children: [_jsxs("summary", { className: "sky-focus cursor-pointer", children: ["Connection details (", valid.length, ")"] }), _jsx("ul", { children: valid.map(item => _jsxs("li", { children: [item.start.label ?? `${item.start.lat}, ${item.start.lng}`, " to ", item.end.label ?? `${item.end.lat}, ${item.end.lng}`] }, item.id)) })] })] });
13
+ }
@@ -0,0 +1 @@
1
+ export declare const landRings: number[][][];