@inferencesh/ui 0.0.0-stage → 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 (165) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -2
  3. package/components.json +22 -0
  4. package/package.json +231 -4
  5. package/src/components/audio-player.tsx +549 -0
  6. package/src/components/button.tsx +13 -0
  7. package/src/components/chart.tsx +403 -0
  8. package/src/components/circuit.tsx +276 -0
  9. package/src/components/code-block/code-block.tsx +260 -0
  10. package/src/components/code-block/index.ts +18 -0
  11. package/src/components/code-block/languages.ts +311 -0
  12. package/src/components/code-block/styles.ts +39 -0
  13. package/src/components/code-block/tokenizer.ts +290 -0
  14. package/src/components/code-block/types.ts +38 -0
  15. package/src/components/code-block/utils.ts +39 -0
  16. package/src/components/code.tsx +48 -0
  17. package/src/components/cookie-consent.tsx +137 -0
  18. package/src/components/copy-button.tsx +44 -0
  19. package/src/components/country-dropdown.tsx +188 -0
  20. package/src/components/glow-loader-fast.tsx +32 -0
  21. package/src/components/glow-loader-mono.tsx +33 -0
  22. package/src/components/glow-loader-sm-fast.tsx +32 -0
  23. package/src/components/glow-loader-sm-mono.tsx +34 -0
  24. package/src/components/glow-loader-sm.tsx +32 -0
  25. package/src/components/glow-loader.tsx +32 -0
  26. package/src/components/glow-logo.tsx +32 -0
  27. package/src/components/gradient.tsx +80 -0
  28. package/src/components/index.ts +45 -0
  29. package/src/components/inline-sidebar.tsx +351 -0
  30. package/src/components/input-color.tsx +349 -0
  31. package/src/components/logo-base.tsx +213 -0
  32. package/src/components/logo-color.tsx +23 -0
  33. package/src/components/logo-full.tsx +71 -0
  34. package/src/components/logo-svg.tsx +23 -0
  35. package/src/components/menu-navigation.tsx +359 -0
  36. package/src/components/multi-select.tsx +721 -0
  37. package/src/components/pastel-gradient.tsx +25 -0
  38. package/src/components/pixel-symmetry.tsx +151 -0
  39. package/src/components/progress.tsx +28 -0
  40. package/src/components/scroll-more.tsx +131 -0
  41. package/src/components/select.tsx +85 -0
  42. package/src/components/shimmering-text.tsx +108 -0
  43. package/src/components/sidebar-light.tsx +102 -0
  44. package/src/components/sonner.tsx +38 -0
  45. package/src/components/theme-switcher-sidebar.tsx +56 -0
  46. package/src/components/theme-switcher-simple.tsx +110 -0
  47. package/src/components/theme-switcher.tsx +47 -0
  48. package/src/components/toggle-group.tsx +55 -0
  49. package/src/components/tooltip-button.tsx +91 -0
  50. package/src/components/tooltip.tsx +71 -0
  51. package/src/components/tree-view.tsx +499 -0
  52. package/src/components/unglow-loader.tsx +33 -0
  53. package/src/components/waveform.tsx +1632 -0
  54. package/src/components/zoomable-image.tsx +76 -0
  55. package/src/docs/api-docs.tsx +763 -0
  56. package/src/docs/callout.tsx +160 -0
  57. package/src/docs/code-group.tsx +215 -0
  58. package/src/docs/copy-menu.tsx +143 -0
  59. package/src/docs/doc-tabs.tsx +84 -0
  60. package/src/docs/index.ts +16 -0
  61. package/src/docs/steps.tsx +105 -0
  62. package/src/docs/table-of-contents.tsx +174 -0
  63. package/src/examples/guide-markdown.ts +129 -0
  64. package/src/examples/index.ts +1153 -0
  65. package/src/global.d.ts +1 -0
  66. package/src/hooks/use-copy-to-clipboard.ts +36 -0
  67. package/src/hooks/use-mobile.ts +19 -0
  68. package/src/lib/display-name.ts +15 -0
  69. package/src/lib/example-input.ts +130 -0
  70. package/src/lib/plans.ts +44 -0
  71. package/src/lib/safe-content.ts +137 -0
  72. package/src/lib/schema.ts +320 -0
  73. package/src/lib/storage.ts +108 -0
  74. package/src/markdown/docs-markdown-renderer.tsx +518 -0
  75. package/src/markdown/helpers.ts +95 -0
  76. package/src/markdown/index.ts +24 -0
  77. package/src/markdown/markdown-renderer.tsx +232 -0
  78. package/src/markdown/youtube-embed.tsx +43 -0
  79. package/src/og/image.ts +312 -0
  80. package/src/og/index.tsx +430 -0
  81. package/src/og/query.ts +26 -0
  82. package/src/shadcn/accordion.tsx +71 -0
  83. package/src/shadcn/alert-dialog.tsx +187 -0
  84. package/src/shadcn/alert.tsx +75 -0
  85. package/src/shadcn/aspect-ratio.tsx +22 -0
  86. package/src/shadcn/attachment.tsx +207 -0
  87. package/src/shadcn/avatar.tsx +106 -0
  88. package/src/shadcn/badge.tsx +51 -0
  89. package/src/shadcn/breadcrumb.tsx +124 -0
  90. package/src/shadcn/bubble.tsx +127 -0
  91. package/src/shadcn/button-group.tsx +87 -0
  92. package/src/shadcn/button.tsx +57 -0
  93. package/src/shadcn/calendar.tsx +219 -0
  94. package/src/shadcn/card.tsx +102 -0
  95. package/src/shadcn/carousel.tsx +242 -0
  96. package/src/shadcn/chart.tsx +372 -0
  97. package/src/shadcn/checkbox.tsx +28 -0
  98. package/src/shadcn/collapsible.tsx +19 -0
  99. package/src/shadcn/combobox.tsx +297 -0
  100. package/src/shadcn/command.tsx +194 -0
  101. package/src/shadcn/context-menu.tsx +270 -0
  102. package/src/shadcn/dialog.tsx +158 -0
  103. package/src/shadcn/direction.tsx +4 -0
  104. package/src/shadcn/drawer.tsx +227 -0
  105. package/src/shadcn/dropdown-menu.tsx +265 -0
  106. package/src/shadcn/empty.tsx +103 -0
  107. package/src/shadcn/field.tsx +238 -0
  108. package/src/shadcn/form.tsx +173 -0
  109. package/src/shadcn/hover-card.tsx +50 -0
  110. package/src/shadcn/index.ts +53 -0
  111. package/src/shadcn/input-group.tsx +156 -0
  112. package/src/shadcn/input-otp.tsx +84 -0
  113. package/src/shadcn/input.tsx +19 -0
  114. package/src/shadcn/item.tsx +201 -0
  115. package/src/shadcn/kbd.tsx +26 -0
  116. package/src/shadcn/label.tsx +19 -0
  117. package/src/shadcn/marker.tsx +70 -0
  118. package/src/shadcn/menubar.tsx +278 -0
  119. package/src/shadcn/message-scroller.tsx +131 -0
  120. package/src/shadcn/message.tsx +91 -0
  121. package/src/shadcn/native-select.tsx +60 -0
  122. package/src/shadcn/navigation-menu.tsx +167 -0
  123. package/src/shadcn/pagination.tsx +130 -0
  124. package/src/shadcn/popover.tsx +87 -0
  125. package/src/shadcn/progress.tsx +82 -0
  126. package/src/shadcn/radio-group.tsx +35 -0
  127. package/src/shadcn/resizable.tsx +49 -0
  128. package/src/shadcn/scroll-area.tsx +52 -0
  129. package/src/shadcn/select.tsx +200 -0
  130. package/src/shadcn/separator.tsx +22 -0
  131. package/src/shadcn/sheet.tsx +136 -0
  132. package/src/shadcn/sidebar.tsx +721 -0
  133. package/src/shadcn/skeleton.tsx +13 -0
  134. package/src/shadcn/slider.tsx +51 -0
  135. package/src/shadcn/sonner.tsx +49 -0
  136. package/src/shadcn/spinner.tsx +10 -0
  137. package/src/shadcn/switch.tsx +29 -0
  138. package/src/shadcn/table.tsx +115 -0
  139. package/src/shadcn/tabs.tsx +79 -0
  140. package/src/shadcn/textarea.tsx +17 -0
  141. package/src/shadcn/toggle-group.tsx +89 -0
  142. package/src/shadcn/toggle.tsx +44 -0
  143. package/src/shadcn/tooltip.tsx +63 -0
  144. package/src/theme/config.ts +48 -0
  145. package/src/theme/css/base.css +92 -0
  146. package/src/theme/css/bitboy.css +75 -0
  147. package/src/theme/css/dark.css +47 -0
  148. package/src/theme/css/designer.css +122 -0
  149. package/src/theme/css/fonts.css +33 -0
  150. package/src/theme/css/globals.css +14 -0
  151. package/src/theme/css/hackintosh.css +57 -0
  152. package/src/theme/css/llama.css +103 -0
  153. package/src/theme/css/safelist.css +39 -0
  154. package/src/theme/css/shadcn.css +77 -0
  155. package/src/theme/css/theme.css +216 -0
  156. package/src/theme/embed-theme.ts +146 -0
  157. package/src/theme/fonts/FiraCode-VF.woff2 +0 -0
  158. package/src/theme/fonts/Hack-Regular.woff2 +0 -0
  159. package/src/theme/fonts/LICENSE-FiraCode.txt +93 -0
  160. package/src/theme/fonts/LICENSE-Hack.txt +45 -0
  161. package/src/theme/fonts/LICENSE-MonaSans.txt +93 -0
  162. package/src/theme/fonts/Mona-Sans.woff2 +0 -0
  163. package/src/theme/index.ts +15 -0
  164. package/src/utils/cn.ts +3 -0
  165. package/src/utils/index.ts +2 -0
@@ -0,0 +1,216 @@
1
+ /* --brand-pink: 330 100% 67%; */
2
+ /* #FF569D */
3
+ /* --brand-green: 161 100% 41%; */
4
+ /* #00D08A */
5
+ /* --brand-purple: 255 100% 54%; */
6
+ /* #5415FF */
7
+ /* --brand-lavender: 291 100% 77%; */
8
+ /* #F08AFF */
9
+ /* --brand-yellow: 56 100% 65%; */
10
+ /* #FFF14C */
11
+ /* --brand-lime: 69 100% 50%; */
12
+ /* #E3FF00 */
13
+ /* --brand-blue: 201 100% 55%; */
14
+ /* #1CAEFF */
15
+ /* --brand-red: 0 100% 60%; */
16
+ /* #FF3333 */
17
+ /* --brand-orange: 36 100% 50%; */
18
+ /* #FF9900 */
19
+ /* --brand-teal: 161 100% 41%; */
20
+ /* #00D08A */
21
+
22
+ @theme {
23
+ --font-sans: "Mona Sans", system-ui, -apple-system, sans-serif;
24
+ --font-display: var(--font-sans);
25
+ /* font-serif predates the display face; it now means the heading face */
26
+ --font-serif: var(--font-display);
27
+ --font-mono: "Fira Code", ui-monospace, "SF Mono", Menlo, monospace;
28
+ /* wordmark; @font-face in fonts.css */
29
+ --font-hack: "hack", monospace;
30
+
31
+ /* variable cuts: 420 body, 520 medium */
32
+ --font-weight-normal: 420;
33
+ --font-weight-medium: 520;
34
+
35
+ --tracking-tight: -0.02em;
36
+ --tracking-snug: -0.01em;
37
+
38
+ --text-tiny: 0.725rem;
39
+ --text-xs: 0.8rem;
40
+ --text-sm: 0.9rem;
41
+ --text-base: 1rem;
42
+ --text-lg: 1.15rem;
43
+ --text-xl: 1.5rem;
44
+ --text-2xl: 1.8rem;
45
+
46
+ /* Brand colors */
47
+ --brand-pink: 330 100% 67%;
48
+ --brand-green: 161 100% 41%;
49
+ --brand-purple: 255 100% 54%;
50
+ --brand-lavender: 291 100% 77%;
51
+ --brand-yellow: 56 100% 65%;
52
+ --brand-lime: 69 100% 50%;
53
+ --brand-blue: 201 100% 55%;
54
+ --brand-red: 0 100% 60%;
55
+ --brand-orange: 36 100% 50%;
56
+ --brand-teal: 161 100% 41%;
57
+
58
+ --background: 0 0% 98%;
59
+ --foreground: 0 0% 5.9%;
60
+ --card: 0 0% 98%;
61
+ --card-foreground: 0 0% 5.9%;
62
+ --popover: 0 0% 98%;
63
+ --popover-foreground: 0 0% 5.9%;
64
+ --primary: 0 0% 9%;
65
+ --primary-foreground: 0 0% 98%;
66
+ --secondary: 0 0% 94.1%;
67
+ --secondary-foreground: 0 0% 9%;
68
+ --muted: 0 0% 94.1%;
69
+ --muted-foreground: 0 0% 40%;
70
+ --accent: 0 0% 94.1%;
71
+ --accent-foreground: 0 0% 9%;
72
+ --destructive: 0 84.2% 60.2%;
73
+ --destructive-foreground: 0 0% 98%;
74
+ --ring: 0 0% 65.9%;
75
+ --border: 0 0% 86.8%;
76
+ --input: 0 0% 86.8%;
77
+
78
+
79
+ --chart-1: 12 76% 61%;
80
+ --chart-2: 173 58% 39%;
81
+ --chart-3: 197 37% 24%;
82
+ --chart-4: 43 74% 66%;
83
+ --chart-5: 27 87% 67%;
84
+
85
+ --radius: 0.5rem;
86
+
87
+ --radius-radius: var(--radius);
88
+
89
+ --border-radius-full: calc(var(--radius) + 8px);
90
+ --border-radius-2xl: calc(var(--radius) + 4px);
91
+ --border-radius-xl: calc(var(--radius) + 2px);
92
+ --border-radius-lg: var(--radius);
93
+ --border-radius-md: calc(var(--radius) - 2px);
94
+ --border-radius-sm: calc(var(--radius) - 4px);
95
+ }
96
+
97
+ @utility container {
98
+ margin-inline: auto;
99
+ padding-inline: 2rem;
100
+ }
101
+
102
+ @theme inline {
103
+ --color-background: hsl(var(--background));
104
+ --color-foreground: hsl(var(--foreground));
105
+ --color-card: hsl(var(--card));
106
+ --color-card-foreground: hsl(var(--card-foreground));
107
+ --color-popover: hsl(var(--popover));
108
+ --color-popover-foreground: hsl(var(--popover-foreground));
109
+ --color-primary: hsl(var(--primary));
110
+ --color-primary-foreground: hsl(var(--primary-foreground));
111
+ --color-secondary: hsl(var(--secondary));
112
+ --color-secondary-foreground: hsl(var(--secondary-foreground));
113
+ --color-muted: hsl(var(--muted));
114
+ --color-muted-foreground: hsl(var(--muted-foreground));
115
+ --color-accent: hsl(var(--accent));
116
+ --color-accent-foreground: hsl(var(--accent-foreground));
117
+ --color-destructive: hsl(var(--destructive));
118
+ --color-destructive-foreground: hsl(var(--destructive-foreground));
119
+ --color-border: hsl(var(--border));
120
+ --color-input: hsl(var(--input));
121
+ --color-ring: hsl(var(--ring));
122
+ --color-chart-1: hsl(var(--chart-1));
123
+ --color-chart-2: hsl(var(--chart-2));
124
+ --color-chart-3: hsl(var(--chart-3));
125
+ --color-chart-4: hsl(var(--chart-4));
126
+ --color-chart-5: hsl(var(--chart-5));
127
+
128
+ --color-brand-pink: hsl(var(--brand-pink));
129
+ --color-brand-green: hsl(var(--brand-green));
130
+ --color-brand-purple: hsl(var(--brand-purple));
131
+ --color-brand-lavender: hsl(var(--brand-lavender));
132
+ --color-brand-yellow: hsl(var(--brand-yellow));
133
+ --color-brand-lime: hsl(var(--brand-lime));
134
+ --color-brand-blue: hsl(var(--brand-blue));
135
+ --color-brand-red: hsl(var(--brand-red));
136
+ --color-brand-orange: hsl(var(--brand-orange));
137
+ --color-brand-teal: hsl(var(--brand-teal));
138
+
139
+
140
+ /* Shiki colors */
141
+ --color-shiki-light: hsl(var(--shiki-light));
142
+ --color-shiki-light-bg: hsl(var(--shiki-light-bg));
143
+ --color-shiki-dark: hsl(var(--shiki-dark));
144
+ --color-shiki-dark-bg: hsl(var(--shiki-dark-bg));
145
+
146
+ /* Base colors */
147
+ --color-black: #000;
148
+ --color-white: #fff;
149
+
150
+ --radius-sm: calc(var(--radius) - 4px);
151
+ --radius-md: calc(var(--radius) - 2px);
152
+ --radius-lg: var(--radius);
153
+ --radius-xl: calc(var(--radius) + 4px);
154
+
155
+ --animate-accordion-down: accordion-down 0.2s ease-out;
156
+ --animate-accordion-up: accordion-up 0.2s ease-out;
157
+ --animate-typing-dot-bounce: typing-dot-bounce 1.4s infinite ease-in-out;
158
+
159
+ @keyframes accordion-down {
160
+ from {
161
+ height: 0;
162
+ }
163
+
164
+ to {
165
+ height: var(--radix-accordion-content-height);
166
+ }
167
+ }
168
+
169
+ @keyframes accordion-up {
170
+ from {
171
+ height: var(--radix-accordion-content-height);
172
+ }
173
+
174
+ to {
175
+ height: 0;
176
+ }
177
+ }
178
+
179
+ @keyframes typing-dot-bounce {
180
+
181
+ 0%,
182
+ 60%,
183
+ 100% {
184
+ transform: translateY(0);
185
+ }
186
+
187
+ 30% {
188
+ transform: translateY(-4px);
189
+ }
190
+ }
191
+ }
192
+
193
+ /* Override sidebar colors */
194
+ :root {
195
+ --sidebar: hsl(var(--background));
196
+
197
+ --sidebar-foreground: hsl(var(--foreground));
198
+
199
+ --sidebar-primary: hsl(var(--primary));
200
+
201
+ --sidebar-primary-foreground: hsl(var(--primary-foreground));
202
+
203
+ --sidebar-accent: hsl(var(--brand-pink) / 0.1);
204
+
205
+ --sidebar-accent-foreground: hsl(var(--brand-pink));
206
+
207
+ --sidebar-border: hsl(var(--border));
208
+
209
+ --sidebar-ring: hsl(var(--ring));
210
+ }
211
+
212
+ :root.pintura-editor,
213
+ .pintura-editor {
214
+ --color-background: 255, 255, 255 !important;
215
+ --color-foreground: 15, 15, 15 !important;
216
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Embed theme utilities — build CSS variables from simple color inputs.
3
+ * Used by published embeds to apply customer branding.
4
+ *
5
+ * TODO: Generalize color conversion utilities
6
+ * - Move hexToHsl, adjustLightness, getContrastForeground to a shared color utils module
7
+ * - Add proper WCAG contrast ratio calculation (current 70% lightness threshold is a rough heuristic)
8
+ * - Support more input formats: rgb(), hsl(), named colors
9
+ * - Add hslToHex for bidirectional conversion
10
+ * - Consider using a small color library (culori, colord) if complexity grows
11
+ * - The delta values for muted/border derivation (8, -4, 15, -13) are magic numbers —
12
+ * could be configurable or derived from color theory (e.g. perceptual contrast steps)
13
+ */
14
+
15
+ import { useState, useEffect, useMemo } from 'react';
16
+
17
+ /** Core colors for one mode */
18
+ export interface ThemeColors {
19
+ primary: string; // hex, e.g. "#3682ff"
20
+ secondary: string; // hex, e.g. "#36d48f"
21
+ background: string; // hex, e.g. "#f5f9ff"
22
+ text: string; // hex, e.g. "#0b1f40"
23
+ border?: string; // hex, optional — derived from background if not set
24
+ }
25
+
26
+ /** Customer provides light + optional dark mode colors */
27
+ export interface EmbedThemeInput {
28
+ light: ThemeColors;
29
+ dark?: ThemeColors;
30
+ }
31
+
32
+ /** Convert hex to HSL string "h s% l%" */
33
+ export function hexToHsl(hex: string): string {
34
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
35
+ if (!result) return '0 0% 50%';
36
+ let r = parseInt(result[1], 16) / 255;
37
+ let g = parseInt(result[2], 16) / 255;
38
+ let b = parseInt(result[3], 16) / 255;
39
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
40
+ let h = 0, s = 0, l = (max + min) / 2;
41
+ if (max !== min) {
42
+ const d = max - min;
43
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
44
+ switch (max) {
45
+ case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
46
+ case g: h = ((b - r) / d + 2) / 6; break;
47
+ case b: h = ((r - g) / d + 4) / 6; break;
48
+ }
49
+ }
50
+ return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;
51
+ }
52
+
53
+ /** Derive lightness-adjusted variant */
54
+ export function adjustLightness(hsl: string, delta: number): string {
55
+ const [h, s, l] = hsl.split(' ');
56
+ const lVal = Math.max(0, Math.min(100, parseInt(l) + delta));
57
+ return `${h} ${s} ${lVal}%`;
58
+ }
59
+
60
+ /** Get contrasting foreground (white or black) based on HSL lightness */
61
+ function getContrastForeground(hsl: string): string {
62
+ const parts = hsl.split(' ');
63
+ const lightness = parseInt(parts[2]);
64
+ // If background is very light (>70%), use dark text; otherwise white
65
+ return lightness > 70 ? '0 0% 10%' : '0 0% 100%';
66
+ }
67
+
68
+ /** Build full CSS vars from core colors */
69
+ export function buildThemeVars(colors: ThemeColors, isDark: boolean): Record<string, string> {
70
+ const primary = hexToHsl(colors.primary);
71
+ const secondary = hexToHsl(colors.secondary);
72
+ const background = hexToHsl(colors.background);
73
+ const foreground = hexToHsl(colors.text);
74
+
75
+ // Derive variants — adjust direction based on mode
76
+ const mutedDelta = isDark ? 8 : -4;
77
+ const borderDelta = isDark ? 15 : -13;
78
+ const muted = adjustLightness(background, mutedDelta);
79
+ const mutedFg = adjustLightness(foreground, isDark ? -25 : 25);
80
+ const border = colors.border ? hexToHsl(colors.border) : adjustLightness(background, borderDelta);
81
+
82
+ // Helper to set both raw and computed versions
83
+ const vars: Record<string, string> = {};
84
+ const set = (name: string, hsl: string) => {
85
+ vars[`--${name}`] = hsl;
86
+ vars[`--color-${name}`] = `hsl(${hsl})`;
87
+ };
88
+
89
+ set('primary', primary);
90
+ set('primary-foreground', getContrastForeground(primary));
91
+ set('secondary', secondary);
92
+ set('secondary-foreground', getContrastForeground(secondary));
93
+ set('accent', secondary);
94
+ set('accent-foreground', getContrastForeground(secondary));
95
+ set('background', background);
96
+ set('foreground', foreground);
97
+ set('card', background);
98
+ set('card-foreground', foreground);
99
+ set('popover', isDark ? adjustLightness(background, 5) : '0 0% 100%');
100
+ set('popover-foreground', foreground);
101
+ set('muted', muted);
102
+ set('muted-foreground', mutedFg);
103
+ set('border', border);
104
+ set('input', border);
105
+ set('ring', primary);
106
+
107
+ return vars;
108
+ }
109
+
110
+ /** Check if user prefers dark mode */
111
+ export function usePrefersDark(): boolean {
112
+ const [dark, setDark] = useState(() =>
113
+ typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches
114
+ );
115
+ useEffect(() => {
116
+ const mq = window.matchMedia('(prefers-color-scheme: dark)');
117
+ const handler = (e: MediaQueryListEvent) => setDark(e.matches);
118
+ mq.addEventListener('change', handler);
119
+ return () => mq.removeEventListener('change', handler);
120
+ }, []);
121
+ return dark;
122
+ }
123
+
124
+ /** Build theme CSS vars for current mode, reacting to system preference */
125
+ export function useEmbedTheme(input: EmbedThemeInput): Record<string, string> {
126
+ const prefersDark = usePrefersDark();
127
+ return useMemo(() => {
128
+ const isDark = prefersDark && !!input.dark;
129
+ const colors = isDark ? input.dark! : input.light;
130
+ return buildThemeVars(colors, isDark);
131
+ }, [input, prefersDark]);
132
+ }
133
+
134
+ /** Convert CSS vars record to React CSSProperties */
135
+ export function themeVarsToStyle(vars: Record<string, string>): React.CSSProperties {
136
+ const style: Record<string, string> = {};
137
+ for (const [key, value] of Object.entries(vars)) {
138
+ style[key] = value;
139
+ }
140
+ return style as React.CSSProperties;
141
+ }
142
+
143
+ /** Default fallback theme (neutral grayscale) */
144
+ export const DEFAULT_THEME_INPUT: EmbedThemeInput = {
145
+ light: { primary: '#000000', secondary: '#666666', background: '#ffffff', text: '#000000' },
146
+ };
@@ -0,0 +1,93 @@
1
+ Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,45 @@
1
+ The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License
2
+
3
+ The work in the DejaVu project was committed to the public domain.
4
+
5
+ Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"
6
+
7
+ ### MIT License
8
+
9
+ Copyright (c) 2018 Source Foundry Authors
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ ### BITSTREAM VERA LICENSE
30
+
31
+ Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
36
+
37
+ The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
38
+
39
+ This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
40
+
41
+ The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
42
+
43
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
44
+
45
+ Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
@@ -0,0 +1,93 @@
1
+ Copyright (c) 2023, GitHub https://github.com/github/mona-sans
2
+ with Reserved Font Name "Mona Sans"
3
+
4
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
+ This license is copied below, and is also available with a FAQ at:
6
+ http://scripts.sil.org/OFL
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting — in part or in whole — any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
@@ -0,0 +1,15 @@
1
+ export { themeConfig, themeNames, menuThemeNames, darkThemeClassNames, isDarkTheme } from "./config";
2
+ export type { ThemeName, ThemeConfig } from "./config";
3
+
4
+ // Embed theming
5
+ export {
6
+ hexToHsl,
7
+ adjustLightness,
8
+ buildThemeVars,
9
+ usePrefersDark,
10
+ useEmbedTheme,
11
+ themeVarsToStyle,
12
+ DEFAULT_THEME_INPUT,
13
+ } from "./embed-theme";
14
+ export type { ThemeColors, EmbedThemeInput } from "./embed-theme";
15
+
@@ -0,0 +1,3 @@
1
+ // Class names joined and Tailwind conflicts resolved: shadcn's cn, which
2
+ // the shadcn components import directly.
3
+ export { cn } from "cn"
@@ -0,0 +1,2 @@
1
+ export { cn } from "./cn"
2
+