@wrksz/docs 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -2
  3. package/dist/agents.d.ts +30 -0
  4. package/dist/agents.js +70 -0
  5. package/dist/components/agent-logos.js +90 -0
  6. package/dist/components/agent-prompt.d.ts +29 -0
  7. package/dist/components/agent-prompt.js +100 -0
  8. package/dist/components/badge.d.ts +16 -0
  9. package/dist/components/badge.js +26 -0
  10. package/dist/components/brand.js +30 -0
  11. package/dist/components/callout.d.ts +24 -0
  12. package/dist/components/callout.js +58 -0
  13. package/dist/components/cards.d.ts +26 -0
  14. package/dist/components/cards.js +48 -0
  15. package/dist/components/code-body.js +18 -0
  16. package/dist/components/code-group.d.ts +20 -0
  17. package/dist/components/code-group.js +41 -0
  18. package/dist/components/code-tabs.d.ts +30 -0
  19. package/dist/components/code-tabs.js +49 -0
  20. package/dist/components/content-tabs.d.ts +14 -0
  21. package/dist/components/content-tabs.js +27 -0
  22. package/dist/components/copy-code.js +41 -0
  23. package/dist/components/deferred-analytics.js +5 -0
  24. package/dist/components/details.d.ts +20 -0
  25. package/dist/components/details.js +29 -0
  26. package/dist/components/heading-link.js +23 -0
  27. package/dist/components/heading.d.ts +5 -0
  28. package/dist/components/heading.js +22 -0
  29. package/dist/components/icons.js +362 -0
  30. package/dist/components/image.d.ts +27 -0
  31. package/dist/components/image.js +204 -0
  32. package/dist/components/inline-text.js +14 -0
  33. package/dist/components/install.d.ts +22 -0
  34. package/dist/components/install.js +62 -0
  35. package/dist/components/mdx-tabs.d.ts +22 -0
  36. package/dist/components/mdx-tabs.js +30 -0
  37. package/dist/components/practice.d.ts +41 -0
  38. package/dist/components/practice.js +99 -0
  39. package/dist/components/props.d.ts +37 -0
  40. package/dist/components/props.js +70 -0
  41. package/dist/components/status.js +35 -0
  42. package/dist/components/steps.d.ts +18 -0
  43. package/dist/components/steps.js +23 -0
  44. package/dist/components/theme-switch.js +31 -0
  45. package/dist/components/ui/kbd.js +410 -0
  46. package/dist/components/ui/scroll-area.js +169 -0
  47. package/dist/components/ui/table.d.ts +33 -0
  48. package/dist/components/ui/table.js +103 -0
  49. package/dist/components/ui/tabs.js +69 -0
  50. package/dist/components/ui/toast.js +629 -0
  51. package/dist/components/ui/tooltip.js +31 -0
  52. package/dist/components/wrksz-mark.js +12 -0
  53. package/dist/docs/index.d.ts +8 -0
  54. package/dist/docs/index.js +8 -0
  55. package/dist/docs/layout.d.ts +6 -0
  56. package/dist/docs/layout.js +10 -0
  57. package/dist/docs/page-actions.d.ts +36 -0
  58. package/dist/docs/page-actions.js +136 -0
  59. package/dist/docs/page-footer.d.ts +14 -0
  60. package/dist/docs/page-footer.js +68 -0
  61. package/dist/docs/page-header.d.ts +13 -0
  62. package/dist/docs/page-header.js +57 -0
  63. package/dist/docs/page.d.ts +16 -0
  64. package/dist/docs/page.js +38 -0
  65. package/dist/docs/reading.js +64 -0
  66. package/dist/docs/shell.js +101 -0
  67. package/dist/docs/sidebar.js +161 -0
  68. package/dist/docs/toc-bar.d.ts +12 -0
  69. package/dist/docs/toc-bar.js +132 -0
  70. package/dist/docs/toc.d.ts +11 -0
  71. package/dist/docs/toc.js +127 -0
  72. package/dist/fonts/Inter-Italic.woff2 +0 -0
  73. package/dist/fonts/Inter-LICENSE.txt +92 -0
  74. package/dist/fonts/Inter.woff2 +0 -0
  75. package/dist/fonts/IoskeleyMono-Bold.woff2 +0 -0
  76. package/dist/fonts/IoskeleyMono-Italic.woff2 +0 -0
  77. package/dist/fonts/IoskeleyMono-LICENSE.txt +92 -0
  78. package/dist/fonts/IoskeleyMono-Regular.woff2 +0 -0
  79. package/dist/fonts.d.ts +1 -0
  80. package/dist/fonts.js +38 -0
  81. package/dist/home/features.d.ts +39 -0
  82. package/dist/home/features.js +75 -0
  83. package/dist/home/footer.d.ts +4 -0
  84. package/dist/home/footer.js +79 -0
  85. package/dist/home/hero-content.js +102 -0
  86. package/dist/home/hero-install.js +128 -0
  87. package/dist/home/hero-stage.d.ts +4 -0
  88. package/dist/home/hero-stage.js +9 -0
  89. package/dist/home/hero.d.ts +6 -0
  90. package/dist/home/hero.js +16 -0
  91. package/dist/home/home-header.d.ts +1 -0
  92. package/dist/home/home-header.js +173 -0
  93. package/dist/home/index.d.ts +7 -0
  94. package/dist/home/index.js +7 -0
  95. package/dist/home/layout.d.ts +6 -0
  96. package/dist/home/layout.js +15 -0
  97. package/dist/home/reveal.js +31 -0
  98. package/dist/index.d.ts +4 -0
  99. package/dist/index.js +4 -0
  100. package/dist/lib/clipboard.js +55 -0
  101. package/dist/lib/cn.js +1 -0
  102. package/dist/lib/format.js +9 -0
  103. package/dist/lib/package-manager-script.js +12 -0
  104. package/dist/lib/package-manager.js +54 -0
  105. package/dist/lib/theme-config.js +10 -0
  106. package/dist/llms.d.ts +34 -0
  107. package/dist/llms.js +111 -0
  108. package/dist/next.d.ts +18 -0
  109. package/dist/next.js +45 -0
  110. package/dist/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +930 -0
  111. package/dist/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.ts +81 -0
  112. package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +80 -0
  113. package/dist/registry.d.ts +61 -0
  114. package/dist/registry.js +113 -0
  115. package/dist/root.d.ts +9 -0
  116. package/dist/root.js +34 -0
  117. package/dist/search.d.ts +5 -0
  118. package/dist/search.js +43 -0
  119. package/dist/seo/index.d.ts +6 -0
  120. package/dist/seo/index.js +6 -0
  121. package/dist/seo/json-ld.d.ts +17 -0
  122. package/dist/seo/json-ld.js +88 -0
  123. package/dist/seo/metadata.d.ts +21 -0
  124. package/dist/seo/metadata.js +75 -0
  125. package/dist/seo/robots.d.ts +14 -0
  126. package/dist/seo/robots.js +18 -0
  127. package/dist/seo/sitemap.d.ts +16 -0
  128. package/dist/seo/sitemap.js +26 -0
  129. package/dist/seo/url.d.ts +6 -0
  130. package/dist/seo/url.js +11 -0
  131. package/dist/server.js +63 -0
  132. package/dist/site-context.js +17 -0
  133. package/dist/site.d.ts +41 -0
  134. package/dist/site.js +13 -0
  135. package/dist/source/compile.d.ts +6 -0
  136. package/dist/source/compile.js +32 -0
  137. package/dist/source/errors.d.ts +4 -0
  138. package/dist/source/errors.js +10 -0
  139. package/dist/source/frontmatter.d.ts +13 -0
  140. package/dist/source/frontmatter.js +102 -0
  141. package/dist/source/highlight.js +102 -0
  142. package/dist/source/index.d.ts +36 -0
  143. package/dist/source/index.js +102 -0
  144. package/dist/source/markdown.d.ts +48 -0
  145. package/dist/source/markdown.js +393 -0
  146. package/dist/source/prompt.js +33 -0
  147. package/dist/source/scan.d.ts +8 -0
  148. package/dist/source/scan.js +64 -0
  149. package/dist/source/toc.d.ts +5 -0
  150. package/dist/source/toc.js +28 -0
  151. package/dist/source/tree.d.ts +29 -0
  152. package/dist/source/tree.js +91 -0
  153. package/dist/styles.css +879 -0
  154. package/dist/typography.d.ts +101 -0
  155. package/dist/typography.js +232 -0
  156. package/package.json +84 -4
@@ -0,0 +1,410 @@
1
+ "use client";
2
+ import { Fragment, useSyncExternalStore } from "react";
3
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/ui/kbd.tsx
5
+ const sizes = {
6
+ sm: "h-5 min-w-5 rounded-[5px] px-1 text-[0.6875rem] [--glyph:0.75rem] [--side:4px]",
7
+ md: "h-6 min-w-6 rounded-md px-1.5 text-xs [--glyph:0.8125rem] [--side:5px]"
8
+ };
9
+ function Kbd({ size = "md", className = "", ...props }) {
10
+ return /* @__PURE__ */ jsx("kbd", {
11
+ className: `relative inline-flex items-center justify-center bg-current/8 font-sans font-medium text-[color-mix(in_oklab,currentColor_62%,transparent)] select-none [&>svg]:size-(--glyph) ${sizes[size]} ${className}`,
12
+ ...props
13
+ });
14
+ }
15
+ function KbdGroup({ className = "", ...props }) {
16
+ return /* @__PURE__ */ jsx("span", {
17
+ className: `inline-flex shrink-0 items-center gap-1 ${className}`,
18
+ ...props
19
+ });
20
+ }
21
+ function Glyph({ d }) {
22
+ return /* @__PURE__ */ jsx("svg", {
23
+ viewBox: "0 0 16 16",
24
+ fill: "none",
25
+ stroke: "currentColor",
26
+ strokeWidth: "1.5",
27
+ strokeLinecap: "round",
28
+ strokeLinejoin: "round",
29
+ "aria-hidden": true,
30
+ children: /* @__PURE__ */ jsx("path", { d })
31
+ });
32
+ }
33
+ const glyphs = {
34
+ command: "M6 6V4.5A1.5 1.5 0 1 0 4.5 6H6Zm0 0v4m0-4h4m-4 4H4.5A1.5 1.5 0 1 0 6 11.5V10Zm0 0h4m0 0v1.5a1.5 1.5 0 1 0 1.5-1.5H10Zm0 0V6m0 0h1.5A1.5 1.5 0 1 0 10 4.5V6Z",
35
+ shift: "M8 2.75 2.75 8.25h2.75v5h5v-5h2.75Z",
36
+ option: "M2.75 4.5h3.5l3.5 7h3.5M10 4.5h3.25",
37
+ control: "m4.25 7.75 3.75-3.5 3.75 3.5",
38
+ enter: "M12.75 3.5v4.75a1.75 1.75 0 0 1-1.75 1.75H3.5m0 0 2.75-2.75M3.5 10l2.75 2.75",
39
+ backspace: "M5.75 4h6.5A1.75 1.75 0 0 1 14 5.75v4.5A1.75 1.75 0 0 1 12.25 12h-6.5L2 8Z M8.25 6.5l3 3m0-3-3 3",
40
+ up: "M8 12.75v-9.5m0 0L4.5 6.75M8 3.25l3.5 3.5",
41
+ down: "M8 3.25v9.5m0 0L4.5 9.25M8 12.75l3.5-3.5",
42
+ left: "M12.75 8h-9.5m0 0 3.5-3.5M3.25 8l3.5 3.5",
43
+ right: "M3.25 8h9.5m0 0-3.5-3.5M12.75 8l-3.5 3.5"
44
+ };
45
+ function detect() {
46
+ const agent = navigator.userAgentData?.platform ?? navigator.platform;
47
+ return /mac|iphone|ipad|ipod/i.test(agent) ? "mac" : "other";
48
+ }
49
+ const subscribe = () => () => {};
50
+ function usePlatform() {
51
+ return useSyncExternalStore(subscribe, detect, () => "mac");
52
+ }
53
+ function describe(key, platform) {
54
+ const mac = platform === "mac";
55
+ switch (key) {
56
+ case "mod": return mac ? {
57
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.command }),
58
+ name: "Command"
59
+ } : {
60
+ label: "Ctrl",
61
+ name: "Control"
62
+ };
63
+ case "cmd":
64
+ case "command":
65
+ case "meta": return {
66
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.command }),
67
+ name: "Command"
68
+ };
69
+ case "ctrl":
70
+ case "control": return mac ? {
71
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.control }),
72
+ name: "Control"
73
+ } : {
74
+ label: "Ctrl",
75
+ name: "Control"
76
+ };
77
+ case "alt":
78
+ case "option": return mac ? {
79
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.option }),
80
+ name: "Option"
81
+ } : {
82
+ label: "Alt",
83
+ name: "Alt"
84
+ };
85
+ case "shift": return {
86
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.shift }),
87
+ name: "Shift"
88
+ };
89
+ case "enter":
90
+ case "return": return {
91
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.enter }),
92
+ name: "Enter"
93
+ };
94
+ case "backspace":
95
+ case "delete": return {
96
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.backspace }),
97
+ name: "Backspace"
98
+ };
99
+ case "up":
100
+ case "down":
101
+ case "left":
102
+ case "right": return {
103
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs[key] }),
104
+ name: `${key[0]?.toUpperCase()}${key.slice(1)} arrow`
105
+ };
106
+ case "esc":
107
+ case "escape": return {
108
+ label: "Esc",
109
+ name: "Escape"
110
+ };
111
+ case "tab": return {
112
+ label: "Tab",
113
+ name: "Tab"
114
+ };
115
+ case "space": return {
116
+ label: "Space",
117
+ name: "Space"
118
+ };
119
+ case "+":
120
+ case "plus": return {
121
+ label: "+",
122
+ name: "Plus"
123
+ };
124
+ case "-":
125
+ case "minus": return {
126
+ label: "-",
127
+ name: "Minus"
128
+ };
129
+ default:
130
+ if (/^f([1-9]|1\d|2[0-4])$/.test(key)) return {
131
+ label: key.toUpperCase(),
132
+ name: key.toUpperCase()
133
+ };
134
+ if (named[key]) return named[key];
135
+ return {
136
+ label: key.toUpperCase(),
137
+ name: key.toUpperCase()
138
+ };
139
+ }
140
+ }
141
+ const named = {
142
+ home: {
143
+ label: "Home",
144
+ name: "Home"
145
+ },
146
+ end: {
147
+ label: "End",
148
+ name: "End"
149
+ },
150
+ pageup: {
151
+ label: "PgUp",
152
+ name: "Page Up"
153
+ },
154
+ pagedown: {
155
+ label: "PgDn",
156
+ name: "Page Down"
157
+ },
158
+ capslock: {
159
+ label: "Caps",
160
+ name: "Caps Lock"
161
+ },
162
+ fn: {
163
+ label: "fn",
164
+ name: "Function"
165
+ },
166
+ insert: {
167
+ label: "Ins",
168
+ name: "Insert"
169
+ }
170
+ };
171
+ const knownWords = /* @__PURE__ */ new Set([
172
+ "enter",
173
+ "return",
174
+ "backspace",
175
+ "delete",
176
+ "up",
177
+ "down",
178
+ "left",
179
+ "right",
180
+ "esc",
181
+ "escape",
182
+ "tab",
183
+ "space",
184
+ "plus",
185
+ "minus",
186
+ ...Object.keys(named)
187
+ ]);
188
+ function isKnownKey(key) {
189
+ return key.length === 1 || knownWords.has(key) || /^f([1-9]|1\d|2[0-4])$/.test(key);
190
+ }
191
+ const modifiers = {
192
+ mod: "mod",
193
+ cmd: "meta",
194
+ command: "meta",
195
+ meta: "meta",
196
+ ctrl: "ctrl",
197
+ control: "ctrl",
198
+ alt: "alt",
199
+ option: "alt",
200
+ shift: "shift"
201
+ };
202
+ function readModifier(part, platform) {
203
+ const side = /^(left|l)(?=[a-z])/.test(part) ? "left" : /^(right|r)(?=[a-z])/.test(part) ? "right" : null;
204
+ const name = side ? part.replace(/^(left|right|l|r)/, "") : part;
205
+ const modifier = modifiers[name];
206
+ if (!modifier) return null;
207
+ return {
208
+ modifier: modifier === "mod" ? platform === "mac" ? "meta" : "ctrl" : modifier,
209
+ side
210
+ };
211
+ }
212
+ function tokens(step) {
213
+ const out = [];
214
+ let current = "";
215
+ let quoted = false;
216
+ for (const char of step) if (char === "\"") {
217
+ quoted = !quoted;
218
+ current += char;
219
+ } else if (char === "+" && !quoted && current.trim() !== "") {
220
+ out.push(current.trim());
221
+ current = "";
222
+ } else current += char;
223
+ if (current.trim()) out.push(current.trim());
224
+ return out;
225
+ }
226
+ function warn(message) {
227
+ if (process.env.NODE_ENV !== "production") console.warn(message);
228
+ }
229
+ function parseShortcut(keys, platform) {
230
+ const parsed = {
231
+ ctrl: 0,
232
+ alt: 0,
233
+ shift: 0,
234
+ meta: 0,
235
+ sides: {},
236
+ keys: []
237
+ };
238
+ const add = (value, literal) => {
239
+ if (!parsed.keys.some((entry) => entry.value === value)) parsed.keys.push({
240
+ value,
241
+ literal
242
+ });
243
+ };
244
+ for (const token of tokens(keys)) {
245
+ if (token.length > 1 && token.startsWith("\"") && token.endsWith("\"")) {
246
+ add(token.slice(1, -1), true);
247
+ continue;
248
+ }
249
+ const part = token.toLowerCase();
250
+ const found = readModifier(part, platform);
251
+ if (found) {
252
+ parsed[found.modifier] = Math.min(2, parsed[found.modifier] + 1);
253
+ if (found.side) parsed.sides[found.modifier] = found.side;
254
+ } else if (isKnownKey(part)) add(part, false);
255
+ else warn(`Shortcut "${keys}": "${token}" isn't a key. Wrap custom labels in quotes, like cmd+"Hyper".`);
256
+ }
257
+ return parsed;
258
+ }
259
+ function splitShortcut(keys) {
260
+ return keys.replace(/\s*\+\s*/g, "+").match(/(?:"[^"]*"|\S)+/g) ?? [];
261
+ }
262
+ const sideGlyphs = {
263
+ left: "M151 0 150 1440H365L364 179H1054V0Z",
264
+ right: "M150 0V1440H720Q1211 1440 1212 1051Q1210 659 708 659H365V0ZM976 0 597 718H837L1217 0ZM364 832H715Q850 832 923 887.5Q996 943 995 1048Q996 1154 923 1210.5Q850 1267 714 1267H364Z"
265
+ };
266
+ function sided(key, side) {
267
+ if (!side) return key;
268
+ return {
269
+ label: /* @__PURE__ */ jsxs(Fragment$1, { children: [key.label, /* @__PURE__ */ jsx("span", {
270
+ "aria-hidden": true,
271
+ className: "absolute right-0.75 bottom-0.75 flex h-(--side)",
272
+ children: /* @__PURE__ */ jsx("svg", {
273
+ viewBox: side === "left" ? "150 0 904 1440" : "150 0 1067 1440",
274
+ fill: "currentColor",
275
+ stroke: "currentColor",
276
+ strokeWidth: 40,
277
+ strokeLinejoin: "round",
278
+ className: "h-full w-auto overflow-visible",
279
+ children: /* @__PURE__ */ jsx("path", {
280
+ transform: "matrix(1 0 0 -1 0 1440)",
281
+ d: side === "left" ? sideGlyphs.left : sideGlyphs.right
282
+ })
283
+ })
284
+ })] }),
285
+ name: `${side === "left" ? "Left" : "Right"} ${key.name}`
286
+ };
287
+ }
288
+ function modifierKeys(parsed, platform) {
289
+ const mac = platform === "mac";
290
+ const base = {
291
+ ctrl: mac ? {
292
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.control }),
293
+ name: "Control"
294
+ } : {
295
+ label: "Ctrl",
296
+ name: "Control"
297
+ },
298
+ alt: mac ? {
299
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.option }),
300
+ name: "Option"
301
+ } : {
302
+ label: "Alt",
303
+ name: "Alt"
304
+ },
305
+ shift: {
306
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.shift }),
307
+ name: "Shift"
308
+ },
309
+ meta: mac ? {
310
+ label: /* @__PURE__ */ jsx(Glyph, { d: glyphs.command }),
311
+ name: "Command"
312
+ } : {
313
+ label: "Win",
314
+ name: "Windows"
315
+ }
316
+ };
317
+ const list = [];
318
+ for (const modifier of [
319
+ "ctrl",
320
+ "alt",
321
+ "shift",
322
+ "meta"
323
+ ]) {
324
+ const key = base[modifier];
325
+ if (parsed[modifier] === 2) list.push(sided(key, "left"), sided(key, "right"));
326
+ else if (parsed[modifier] === 1) list.push(sided(key, parsed.sides[modifier]));
327
+ }
328
+ return list;
329
+ }
330
+ function Shortcut({ keys, size = "md", labels, className = "" }) {
331
+ const platform = usePlatform();
332
+ const then = labels?.then ?? "then";
333
+ const steps = [];
334
+ let position = 0;
335
+ for (const step of splitShortcut(keys)) {
336
+ const parsed = parseShortcut(step, platform);
337
+ const parts = modifierKeys(parsed, platform);
338
+ for (const key of parsed.keys) parts.push(key.literal ? {
339
+ label: key.value,
340
+ name: key.value
341
+ } : describe(key.value, platform));
342
+ steps.push({
343
+ id: `${position}-${step}`,
344
+ parts
345
+ });
346
+ position += step.length + 1;
347
+ }
348
+ return /* @__PURE__ */ jsxs(KbdGroup, {
349
+ className,
350
+ children: [/* @__PURE__ */ jsx("span", {
351
+ "aria-hidden": true,
352
+ className: "contents",
353
+ children: steps.map(({ id, parts }, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 && /* @__PURE__ */ jsx("span", {
354
+ className: "px-0.5 text-[0.75em] text-current/50",
355
+ children: then
356
+ }), parts.map((part) => /* @__PURE__ */ jsx(Kbd, {
357
+ size,
358
+ children: part.label
359
+ }, part.name))] }, id))
360
+ }), /* @__PURE__ */ jsx("span", {
361
+ className: "sr-only",
362
+ children: steps.map(({ parts }) => parts.map((part) => part.name).join(" ")).join(`, ${then} `)
363
+ })]
364
+ });
365
+ }
366
+ const codes = {
367
+ enter: "Enter",
368
+ return: "Enter",
369
+ esc: "Escape",
370
+ escape: "Escape",
371
+ tab: "Tab",
372
+ space: " ",
373
+ backspace: "Backspace",
374
+ delete: "Backspace",
375
+ up: "ArrowUp",
376
+ down: "ArrowDown",
377
+ left: "ArrowLeft",
378
+ right: "ArrowRight",
379
+ plus: "+",
380
+ minus: "-"
381
+ };
382
+ function matchShortcut(event, keys) {
383
+ const steps = splitShortcut(keys);
384
+ if (steps.length !== 1 || !steps[0]) return false;
385
+ const parsed = parseShortcut(steps[0], detect());
386
+ if (parsed.keys.length > 1 || parsed.keys[0]?.literal || [
387
+ parsed.ctrl,
388
+ parsed.alt,
389
+ parsed.shift,
390
+ parsed.meta
391
+ ].some((count) => count > 1)) return false;
392
+ const only = parsed.keys[0]?.value;
393
+ if (!only) {
394
+ const held = Object.keys(parsed.sides)[0];
395
+ const code = {
396
+ ctrl: "Control",
397
+ alt: "Alt",
398
+ shift: "Shift",
399
+ meta: "Meta"
400
+ };
401
+ if (!held) return false;
402
+ const side = parsed.sides[held] === "left" ? "Left" : "Right";
403
+ return event.code === `${code[held]}${side}`;
404
+ }
405
+ const key = codes[only] ?? only;
406
+ const pressed = event.key.length === 1 ? event.key.toLowerCase() : event.key;
407
+ const target = key.length === 1 ? key.toLowerCase() : key;
408
+ return pressed === target && event.metaKey === parsed.meta > 0 && event.ctrlKey === parsed.ctrl > 0 && event.altKey === parsed.alt > 0 && (event.shiftKey === parsed.shift > 0 || target.length === 1 && !/[a-z0-9]/.test(target));
409
+ }
410
+ export { Kbd, KbdGroup, Shortcut, matchShortcut, parseShortcut, splitShortcut, usePlatform };
@@ -0,0 +1,169 @@
1
+ "use client";
2
+ import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
3
+ import { useRef } from "react";
4
+ import { cn } from "../../lib/cn.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/ui/scroll-area.tsx
7
+ const edges = {
8
+ top: {
9
+ axis: "y",
10
+ direction: -1,
11
+ path: "m4 10 4-4 4 4",
12
+ place: "top-0.5 left-1/2 h-7 w-20 -translate-x-1/2",
13
+ shown: "group-data-[overflow-y-start]/scroll:group-hover/scroll:pointer-events-auto group-data-[overflow-y-start]/scroll:group-hover/scroll:scale-100 group-data-[overflow-y-start]/scroll:group-hover/scroll:opacity-100"
14
+ },
15
+ bottom: {
16
+ axis: "y",
17
+ direction: 1,
18
+ path: "m4 6 4 4 4-4",
19
+ place: "bottom-0.5 left-1/2 h-7 w-20 -translate-x-1/2",
20
+ shown: "group-data-[overflow-y-end]/scroll:group-hover/scroll:pointer-events-auto group-data-[overflow-y-end]/scroll:group-hover/scroll:scale-100 group-data-[overflow-y-end]/scroll:group-hover/scroll:opacity-100"
21
+ },
22
+ left: {
23
+ axis: "x",
24
+ direction: -1,
25
+ path: "m10 4-4 4 4 4",
26
+ place: "top-1/2 left-0.5 h-20 w-7 -translate-y-1/2",
27
+ shown: "group-data-[overflow-x-start]/scroll:group-hover/scroll:pointer-events-auto group-data-[overflow-x-start]/scroll:group-hover/scroll:scale-100 group-data-[overflow-x-start]/scroll:group-hover/scroll:opacity-100"
28
+ },
29
+ right: {
30
+ axis: "x",
31
+ direction: 1,
32
+ path: "m6 4 4 4-4 4",
33
+ place: "top-1/2 right-0.5 h-20 w-7 -translate-y-1/2",
34
+ shown: "group-data-[overflow-x-end]/scroll:group-hover/scroll:pointer-events-auto group-data-[overflow-x-end]/scroll:group-hover/scroll:scale-100 group-data-[overflow-x-end]/scroll:group-hover/scroll:opacity-100"
35
+ }
36
+ };
37
+ /**
38
+ * A mask that fades an edge while content hides past it. Base UI reports how far the
39
+ * content overflows on each side, so the fade grows in over the first pixels of scroll
40
+ * instead of switching on.
41
+ */
42
+ const shade = (axis, from, to) => {
43
+ const [start, end, side] = axis === "y" ? [
44
+ "--scroll-area-overflow-y-start",
45
+ "--scroll-area-overflow-y-end",
46
+ "bottom"
47
+ ] : [
48
+ "--scroll-area-overflow-x-start",
49
+ "--scroll-area-overflow-x-end",
50
+ "right"
51
+ ];
52
+ return `linear-gradient(to ${side}, transparent 0, #000 min(${from}px, var(${start}, 0px)), #000 calc(100% - min(${to}px, var(${end}, ${to}px))), transparent 100%)`;
53
+ };
54
+ function fadeSizes(fade) {
55
+ if (typeof fade === "object") return {
56
+ start: fade.start || 0,
57
+ end: fade.end || 0
58
+ };
59
+ return {
60
+ start: fade || 0,
61
+ end: fade || 0
62
+ };
63
+ }
64
+ const reduced = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
65
+ /**
66
+ * A scroll container with its own thin scrollbar, faded edges where content hides and
67
+ * optional edge buttons. The mask covers only the content, never the scrollbar.
68
+ */
69
+ function ScrollArea({ orientation = "vertical", fade = 32, edgeButtons = true, glideSpeed = 700, scrollbar = "auto", className = "", contentClassName = "", viewportRef, children }) {
70
+ const viewport = useRef(null);
71
+ const frame = useRef(0);
72
+ const axes = orientation === "both" ? ["y", "x"] : orientation === "horizontal" ? ["x"] : ["y"];
73
+ const stop = () => cancelAnimationFrame(frame.current);
74
+ const glide = (axis, direction) => {
75
+ stop();
76
+ const element = viewport.current;
77
+ if (!element) return;
78
+ const calm = reduced();
79
+ const start = performance.now();
80
+ let last = start;
81
+ let position = axis === "y" ? element.scrollTop : element.scrollLeft;
82
+ const step = (now) => {
83
+ const ramp = Math.min(1, (now - start) / 500);
84
+ position += direction * glideSpeed * (calm ? 1 : ramp * ramp) * ((now - last) / 1e3);
85
+ last = now;
86
+ const max = axis === "y" ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;
87
+ position = Math.min(max, Math.max(0, position));
88
+ if (axis === "y") element.scrollTop = position;
89
+ else element.scrollLeft = position;
90
+ if (direction > 0 ? position < max : position > 0) frame.current = requestAnimationFrame(step);
91
+ };
92
+ frame.current = requestAnimationFrame(step);
93
+ };
94
+ const jump = (axis, direction) => {
95
+ const element = viewport.current;
96
+ if (!element) return;
97
+ const distance = (axis === "y" ? element.clientHeight : element.clientWidth) * .8;
98
+ element.scrollBy({
99
+ [axis === "y" ? "top" : "left"]: direction * distance,
100
+ behavior: reduced() ? "auto" : "smooth"
101
+ });
102
+ };
103
+ const layers = axes.flatMap((axis) => {
104
+ const { start, end } = fadeSizes(typeof fade === "object" && ("x" in fade || "y" in fade) ? fade[axis] : fade);
105
+ return start || end ? [shade(axis, start, end)] : [];
106
+ });
107
+ const mask = layers.length > 0 ? {
108
+ maskImage: layers.join(", "),
109
+ maskComposite: layers.length > 1 ? "intersect" : void 0,
110
+ maskRepeat: "no-repeat"
111
+ } : void 0;
112
+ const bar = `z-3 flex touch-none opacity-0 transition-opacity duration-300 select-none group-hover/scroll:opacity-100 group-hover/scroll:duration-150 data-scrolling:opacity-100 data-scrolling:duration-150 before:absolute before:rounded-full before:bg-fd-foreground/6 before:opacity-0 before:transition-opacity before:duration-150 pointer-fine:hover:before:opacity-100 motion-reduce:transition-none ${scrollbar === "always" ? "opacity-100" : ""} ${scrollbar === "hidden" ? "hidden" : ""}`;
113
+ const thumb = "relative rounded-full bg-fd-foreground/24 pointer-fine:active:bg-fd-foreground/40";
114
+ return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
115
+ className: cn("group/scroll relative flex min-h-0 min-w-0", className),
116
+ children: [
117
+ /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
118
+ ref: (element) => {
119
+ viewport.current = element;
120
+ return viewportRef?.(element);
121
+ },
122
+ style: mask,
123
+ className: `relative min-h-0 min-w-0 flex-1 rounded-[inherit] outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--color-fd-ring)] ${orientation === "horizontal" ? "overflow-y-hidden!" : "data-has-overflow-y:overscroll-y-contain"} ${orientation === "vertical" ? "overflow-x-hidden!" : "data-has-overflow-x:overscroll-x-contain"}`,
124
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Content, {
125
+ className: contentClassName,
126
+ children
127
+ })
128
+ }),
129
+ edgeButtons && Object.keys(edges).filter((edge) => axes.includes(edges[edge].axis)).map((edge) => {
130
+ const { axis, direction, path, place, shown } = edges[edge];
131
+ return /* @__PURE__ */ jsx("button", {
132
+ type: "button",
133
+ tabIndex: -1,
134
+ "aria-hidden": true,
135
+ onPointerEnter: () => glide(axis, direction),
136
+ onPointerLeave: stop,
137
+ onClick: () => {
138
+ stop();
139
+ jump(axis, direction);
140
+ },
141
+ className: `pointer-events-none absolute z-2 flex scale-90 items-center justify-center bg-[radial-gradient(closest-side,var(--scroll-area-bg,var(--panel))_45%,transparent)] text-fd-muted-foreground opacity-0 transition-[opacity,scale,color] duration-150 ease-out hover:text-fd-foreground active:scale-[0.92] pointer-coarse:hidden motion-reduce:transition-none ${place} ${shown}`,
142
+ children: /* @__PURE__ */ jsx("svg", {
143
+ viewBox: "0 0 16 16",
144
+ fill: "none",
145
+ stroke: "currentColor",
146
+ strokeWidth: "1.5",
147
+ strokeLinecap: "round",
148
+ strokeLinejoin: "round",
149
+ "aria-hidden": true,
150
+ className: "size-3.5",
151
+ children: /* @__PURE__ */ jsx("path", { d: path })
152
+ })
153
+ }, edge);
154
+ }),
155
+ axes.includes("y") && /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
156
+ orientation: "vertical",
157
+ className: `${bar} my-1.5 w-4 justify-end pr-1 before:top-0 before:right-1.5 before:bottom-0 before:w-1`,
158
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: `${thumb} mr-0.5 w-1` })
159
+ }),
160
+ axes.includes("x") && /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
161
+ orientation: "horizontal",
162
+ className: `${bar} mx-1.5 h-4 items-end pb-1 before:right-0 before:bottom-1.5 before:left-0 before:h-1`,
163
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: `${thumb} mb-0.5 h-1` })
164
+ }),
165
+ orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
166
+ ]
167
+ });
168
+ }
169
+ export { ScrollArea };
@@ -0,0 +1,33 @@
1
+ import { ComponentProps } from "react";
2
+ export type TableProps = ComponentProps<"table"> & {
3
+ /** `framed` sets the table in a rounded card with a hairline edge; `plain` has no frame. */
4
+ variant?: "framed" | "plain";
5
+ /** Row height: 44px by default, 36px for `compact`. */
6
+ density?: "default" | "compact";
7
+ /** Keeps the header row in view while the body scrolls; pair it with `maxHeight`. */
8
+ stickyHeader?: boolean;
9
+ /** Height after which the body scrolls, in pixels or any CSS length. */
10
+ maxHeight?: number | string;
11
+ /** Keeps the first column in place while the rest scrolls sideways. */
12
+ pinFirstColumn?: boolean;
13
+ };
14
+ /**
15
+ * A data table in a scroll area. It fills the width and grows past it when the content
16
+ * needs more room (cells wrap after 20rem), then scrolls sideways with faded edges. Rows
17
+ * tint on hover, and numbers in right-aligned columns line up. Markdown tables use it too.
18
+ */
19
+ export declare function Table({ variant, density, stickyHeader, maxHeight, pinFirstColumn, className, style, children, ...props }: TableProps): import("react").JSX.Element;
20
+ export declare function TableHeader({ className, ...props }: ComponentProps<"thead">): import("react").JSX.Element;
21
+ export declare function TableBody({ className, ...props }: ComponentProps<"tbody">): import("react").JSX.Element;
22
+ export declare function TableFooter({ className, ...props }: ComponentProps<"tfoot">): import("react").JSX.Element;
23
+ export declare function TableRow({ className, ...props }: ComponentProps<"tr">): import("react").JSX.Element;
24
+ type Align = "left" | "center" | "right";
25
+ /** A column heading; `align` sets the column alignment, `right` also lines up digits. */
26
+ export declare function TableHead({ align, className, ...props }: ComponentProps<"th"> & {
27
+ align?: Align;
28
+ }): import("react").JSX.Element;
29
+ export declare function TableCell({ align, className, ...props }: ComponentProps<"td"> & {
30
+ align?: Align;
31
+ }): import("react").JSX.Element;
32
+ export declare function TableCaption({ className, ...props }: ComponentProps<"caption">): import("react").JSX.Element;
33
+ export {};