@wrksz/docs 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +32 -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,629 @@
1
+ "use client";
2
+ import { useRef, useState, useSyncExternalStore } from "react";
3
+ import { matchShortcut } from "./kbd.js";
4
+ import { CloseIcon, DangerIcon, InfoIcon, RetryIcon, SpinnerIcon, SuccessIcon, WarningIcon } from "../icons.js";
5
+ import { Tooltip } from "./tooltip.js";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/ui/toast.tsx
8
+ const empty = [];
9
+ const timers = /* @__PURE__ */ new Map();
10
+ const listeners = /* @__PURE__ */ new Set();
11
+ const holds = /* @__PURE__ */ new Set();
12
+ let toasts = empty;
13
+ let limit = 3;
14
+ let sequence = 0;
15
+ function emit() {
16
+ for (const listener of listeners) listener();
17
+ }
18
+ function subscribe(listener) {
19
+ listeners.add(listener);
20
+ return () => {
21
+ listeners.delete(listener);
22
+ };
23
+ }
24
+ function lifetime(toast) {
25
+ if (toast.tone === "loading") return 1e400;
26
+ if (toast.duration !== void 0) return toast.duration;
27
+ if (toast.tone === "danger" || toast.action || toast.undo || toast.retry) return 7e3;
28
+ return 4e3;
29
+ }
30
+ function stop(timer) {
31
+ if (timer.handle === null) return;
32
+ clearTimeout(timer.handle);
33
+ timer.handle = null;
34
+ timer.remaining -= Date.now() - timer.started;
35
+ }
36
+ function arm() {
37
+ let shown = 0;
38
+ for (const toast of toasts) {
39
+ if (toast.leaving) continue;
40
+ const timer = timers.get(toast.id);
41
+ const running = holds.size === 0 && shown < limit && !toast.busy && timer !== void 0 && Number.isFinite(timer.remaining);
42
+ shown++;
43
+ if (!timer) continue;
44
+ if (running && timer.handle === null) {
45
+ timer.started = Date.now();
46
+ timer.handle = setTimeout(() => dismiss(toast.id), Math.max(0, timer.remaining));
47
+ } else if (!running) stop(timer);
48
+ }
49
+ }
50
+ function restart(toast) {
51
+ const timer = timers.get(toast.id);
52
+ if (timer) stop(timer);
53
+ timers.set(toast.id, {
54
+ remaining: lifetime(toast),
55
+ started: 0,
56
+ handle: null
57
+ });
58
+ }
59
+ function commit(next) {
60
+ toasts = next;
61
+ arm();
62
+ emit();
63
+ }
64
+ function plain(options) {
65
+ return !options.action && !options.undo && !options.retry;
66
+ }
67
+ function show(title, options = {}) {
68
+ const { id: wanted, ...rest } = options;
69
+ if (wanted) {
70
+ const current = toasts.find((toast) => toast.id === wanted && !toast.leaving);
71
+ if (current) {
72
+ const next = {
73
+ ...current,
74
+ ...rest,
75
+ title,
76
+ tone: options.tone ?? current.tone,
77
+ busy: false
78
+ };
79
+ restart(next);
80
+ commit([next, ...toasts.filter((toast) => toast.id !== wanted)]);
81
+ return wanted;
82
+ }
83
+ } else if (typeof title === "string" && plain(options)) {
84
+ const tone = options.tone ?? "neutral";
85
+ const twin = toasts.find((toast) => !toast.leaving && toast.title === title && toast.tone === tone && toast.description === options.description && plain(toast));
86
+ if (twin) {
87
+ const next = {
88
+ ...twin,
89
+ count: twin.count + 1
90
+ };
91
+ restart(next);
92
+ commit([next, ...toasts.filter((toast) => toast.id !== twin.id)]);
93
+ return twin.id;
94
+ }
95
+ }
96
+ sequence += 1;
97
+ const id = wanted ?? `toast-${sequence}`;
98
+ const created = {
99
+ ...rest,
100
+ id,
101
+ title,
102
+ tone: options.tone ?? "neutral",
103
+ count: 1,
104
+ busy: false,
105
+ leaving: null
106
+ };
107
+ restart(created);
108
+ commit([created, ...toasts.filter((toast) => toast.id !== id)]);
109
+ return id;
110
+ }
111
+ function patch(id, changes) {
112
+ commit(toasts.map((toast) => toast.id === id ? {
113
+ ...toast,
114
+ ...changes
115
+ } : toast));
116
+ }
117
+ function remove(id) {
118
+ toasts = toasts.filter((toast) => !(toast.id === id && toast.leaving));
119
+ if (toasts.length === 0) {
120
+ for (const reason of holds) if (reason !== "hidden" && reason !== "blur") holds.delete(reason);
121
+ }
122
+ emit();
123
+ }
124
+ function dismiss(id, reason = "close") {
125
+ let changed = false;
126
+ const next = toasts.map((toast) => {
127
+ if (toast.leaving || id !== void 0 && toast.id !== id) return toast;
128
+ changed = true;
129
+ const timer = timers.get(toast.id);
130
+ if (timer) stop(timer);
131
+ timers.delete(toast.id);
132
+ toast.onDismiss?.();
133
+ setTimeout(() => remove(toast.id), 400);
134
+ return {
135
+ ...toast,
136
+ leaving: reason
137
+ };
138
+ });
139
+ if (changed) commit(next);
140
+ }
141
+ function hold(reason, on) {
142
+ if (on) holds.add(reason);
143
+ else holds.delete(reason);
144
+ arm();
145
+ }
146
+ function thenable(value) {
147
+ return typeof value === "object" && value !== null && typeof value.then === "function";
148
+ }
149
+ function run(toast, kind) {
150
+ const handler = kind === "undo" ? toast.undo : kind === "retry" ? toast.retry : toast.action?.onClick;
151
+ if (!handler || toast.busy) return;
152
+ const result = handler();
153
+ if (kind === "undo") {
154
+ dismiss(toast.id);
155
+ return;
156
+ }
157
+ const current = toasts.find((item) => item.id === toast.id);
158
+ if (current?.tone === "loading" || current?.leaving) return;
159
+ if (thenable(result)) {
160
+ patch(toast.id, { busy: true });
161
+ result.then(() => {
162
+ const done = toasts.find((item) => item.id === toast.id);
163
+ if (!done || done.leaving) return;
164
+ if (done.success === void 0) {
165
+ dismiss(toast.id);
166
+ return;
167
+ }
168
+ show(done.success, {
169
+ id: toast.id,
170
+ tone: "success",
171
+ description: void 0,
172
+ action: void 0,
173
+ undo: void 0,
174
+ retry: void 0,
175
+ success: void 0
176
+ });
177
+ }, () => {
178
+ const failed = toasts.find((item) => item.id === toast.id);
179
+ if (!failed || failed.leaving) return;
180
+ const next = {
181
+ ...failed,
182
+ busy: false
183
+ };
184
+ restart(next);
185
+ commit(toasts.map((item) => item.id === toast.id ? next : item));
186
+ });
187
+ return;
188
+ }
189
+ if (current === toast) dismiss(toast.id);
190
+ }
191
+ function undoLatest() {
192
+ let shown = 0;
193
+ for (const toast of toasts) {
194
+ if (toast.leaving) continue;
195
+ if (shown >= limit) return false;
196
+ shown++;
197
+ if (toast.undo) {
198
+ run(toast, "undo");
199
+ return true;
200
+ }
201
+ }
202
+ return false;
203
+ }
204
+ function resolve(message, value) {
205
+ return typeof message === "function" ? message(value) : message;
206
+ }
207
+ function promise(task, messages, options = {}) {
208
+ const { retry = true, ...rest } = options;
209
+ sequence += 1;
210
+ const id = rest.id ?? `toast-${sequence}`;
211
+ const attempt = () => {
212
+ const pending = typeof task === "function" ? task() : task;
213
+ show(messages.loading, {
214
+ ...rest,
215
+ id,
216
+ tone: "loading"
217
+ });
218
+ pending.then((value) => {
219
+ show(resolve(messages.success, value), {
220
+ ...rest,
221
+ id,
222
+ tone: "success",
223
+ retry: void 0
224
+ });
225
+ }, (error) => {
226
+ show(resolve(messages.error, error), {
227
+ ...rest,
228
+ id,
229
+ tone: "danger",
230
+ retry: retry && typeof task === "function" ? () => {
231
+ attempt().catch(() => void 0);
232
+ } : void 0
233
+ });
234
+ });
235
+ return pending;
236
+ };
237
+ return attempt();
238
+ }
239
+ const tone = (value) => (title, options) => show(title, {
240
+ ...options,
241
+ tone: value
242
+ });
243
+ const toast = Object.assign((title, options) => show(title, options), {
244
+ info: tone("info"),
245
+ success: tone("success"),
246
+ warning: tone("warning"),
247
+ error: tone("danger"),
248
+ loading: tone("loading"),
249
+ promise,
250
+ dismiss: (id) => dismiss(id),
251
+ undo: () => undoLatest()
252
+ });
253
+ const tones = {
254
+ neutral: "[--tone:var(--color-fd-muted-foreground)]",
255
+ info: "[--tone:var(--color-info)]",
256
+ success: "[--tone:var(--color-success)]",
257
+ warning: "[--tone:var(--color-warning)]",
258
+ danger: "[--tone:var(--color-danger)]",
259
+ loading: "[--tone:var(--color-fd-muted-foreground)]"
260
+ };
261
+ const ease = "ease-[cubic-bezier(0.32,0.72,0,1)]";
262
+ const button = "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg bg-linear-to-b from-(--control-raised-top) to-(--control-raised-bottom) px-2.5 text-[0.8125rem] font-medium whitespace-nowrap text-fd-foreground shadow-[0_0_0_1px_var(--control-ring),0_1px_2px_oklch(0%_0_0/8%)] transition-[background-color,scale] duration-150 ease-out outline-offset-2 select-none hover:to-(--control-raised-top) focus-visible:outline-2 focus-visible:outline-fd-ring active:scale-[0.96]";
263
+ function ToneIcon({ tone }) {
264
+ const Icon = tone === "loading" ? SpinnerIcon : TONE_ICONS[tone];
265
+ return /* @__PURE__ */ jsx(Icon, {});
266
+ }
267
+ const TONE_ICONS = {
268
+ neutral: InfoIcon,
269
+ info: InfoIcon,
270
+ success: SuccessIcon,
271
+ warning: WarningIcon,
272
+ danger: DangerIcon
273
+ };
274
+ function Body({ toast: item, labels, undoHotkey, onRun }) {
275
+ const resting = item.tone === "loading" || item.busy;
276
+ const buttons = Boolean(item.undo || item.retry || item.action);
277
+ const lead = buttons && !item.description ? "h-7" : "h-5";
278
+ const icon = item.icon === false ? null : resting ? "spinner" : item.icon ? "custom" : item.tone === "neutral" ? null : item.tone;
279
+ const undo = /* @__PURE__ */ jsx("button", {
280
+ type: "button",
281
+ onClick: () => onRun?.("undo"),
282
+ className: button,
283
+ children: labels?.undo ?? "Undo"
284
+ });
285
+ return /* @__PURE__ */ jsxs("div", {
286
+ className: "flex items-start gap-3 py-3.5 pr-3.5 pl-4",
287
+ children: [
288
+ icon && /* @__PURE__ */ jsx("span", {
289
+ className: `flex ${lead} shrink-0 items-center text-(--tone) transition-[scale,opacity,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] starting:scale-25 starting:opacity-0 starting:blur-xs motion-reduce:transition-none [&>svg]:size-4`,
290
+ children: icon === "spinner" ? /* @__PURE__ */ jsx(SpinnerIcon, { className: "animate-spin text-fd-muted-foreground" }) : icon === "custom" ? item.icon : /* @__PURE__ */ jsx(ToneIcon, { tone: item.tone })
291
+ }, icon),
292
+ /* @__PURE__ */ jsxs("div", {
293
+ className: `flex min-w-0 flex-1 flex-col justify-center gap-0.5 ${lead === "h-7" ? "min-h-7" : ""}`,
294
+ children: [/* @__PURE__ */ jsxs("p", {
295
+ className: "text-sm leading-5 font-medium text-pretty wrap-break-word",
296
+ children: [item.title, item.count > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
297
+ "aria-hidden": true,
298
+ className: "ml-1.5 inline-flex h-4.5 min-w-4.5 -translate-y-px items-center justify-center rounded-full bg-fd-foreground/8 px-1.5 align-middle text-[0.6875rem] font-medium text-fd-muted-foreground tabular-nums transition-[scale] duration-300 ease-[cubic-bezier(0.2,0,0,1)] starting:scale-125 motion-reduce:transition-none",
299
+ children: item.count
300
+ }, item.count), /* @__PURE__ */ jsx("span", {
301
+ className: "sr-only",
302
+ children: labels?.times?.(item.count) ?? `, ${item.count} times`
303
+ })] })]
304
+ }), item.description && /* @__PURE__ */ jsx("div", {
305
+ className: "text-[0.8125rem] leading-5 text-pretty wrap-break-word text-fd-foreground/70",
306
+ children: item.description
307
+ })]
308
+ }),
309
+ buttons && /* @__PURE__ */ jsx("div", {
310
+ "data-gone": resting ? "" : void 0,
311
+ inert: resting,
312
+ className: "-my-1 -mr-1 -ml-3 grid shrink-0 grid-cols-[1fr] self-center transition-[grid-template-columns,opacity] duration-300 ease-[cubic-bezier(0.2,0,0,1)] data-gone:grid-cols-[0fr] data-gone:opacity-0 motion-reduce:transition-none",
313
+ children: /* @__PURE__ */ jsxs("div", {
314
+ className: "flex min-w-0 items-center gap-1.5 overflow-hidden py-1 pr-1 pl-3",
315
+ children: [
316
+ item.undo && (undoHotkey ? /* @__PURE__ */ jsx(Tooltip, {
317
+ content: labels?.undo ?? "Undo",
318
+ shortcut: undoHotkey,
319
+ children: undo
320
+ }) : undo),
321
+ item.retry && /* @__PURE__ */ jsxs("button", {
322
+ type: "button",
323
+ onClick: () => onRun?.("retry"),
324
+ className: button,
325
+ children: [/* @__PURE__ */ jsx(RetryIcon, { className: "size-3.5" }), labels?.retry ?? "Retry"]
326
+ }),
327
+ item.action && !item.retry && /* @__PURE__ */ jsx("button", {
328
+ type: "button",
329
+ onClick: () => onRun?.("action"),
330
+ className: button,
331
+ children: item.action.label
332
+ })
333
+ ]
334
+ })
335
+ })
336
+ ]
337
+ });
338
+ }
339
+ function Close({ label, shown, side = "left", onClick }) {
340
+ return /* @__PURE__ */ jsx("button", {
341
+ type: "button",
342
+ "aria-label": label,
343
+ onClick,
344
+ className: `absolute -top-1.5 z-1 ${side === "left" ? "-left-1.5" : "-right-1.5"} grid size-5 place-items-center rounded-full bg-(--panel) text-fd-muted-foreground opacity-0 shadow-[0_0_0_1px_var(--control-ring),0_1px_2px_oklch(0%_0_0/8%)] transition-[opacity,scale,color] duration-150 outline-offset-1 hover:text-fd-foreground focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-fd-ring active:scale-[0.9] pointer-coarse:hidden ${shown ? "group-hover/toast:opacity-100" : ""}`,
345
+ children: /* @__PURE__ */ jsx(CloseIcon, { className: "size-2.5" })
346
+ });
347
+ }
348
+ const card = "rounded-[14px] bg-(--panel) text-fd-foreground shadow-[0_0_0_1px_var(--control-ring),0_6px_16px_-6px_oklch(0%_0_0/10%),0_18px_40px_-14px_oklch(0%_0_0/16%)]";
349
+ function Item({ toast: item, y, scale, height, layer, front, hidden, top, closeSide, labels, undoHotkey, onHeight, onDrag, onLeave }) {
350
+ const node = useRef(null);
351
+ const drag = useRef(null);
352
+ const direction = top ? -1 : 1;
353
+ const dismissible = item.dismissible !== false;
354
+ const measure = (content) => {
355
+ if (!content || typeof ResizeObserver === "undefined") return;
356
+ const observer = new ResizeObserver(() => onHeight(item.id, content.offsetHeight));
357
+ observer.observe(content);
358
+ onHeight(item.id, content.offsetHeight);
359
+ return () => observer.disconnect();
360
+ };
361
+ const leave = (then) => {
362
+ const li = node.current;
363
+ const active = document.activeElement;
364
+ const focused = active !== null && (li?.contains(active) ?? false) && active.matches(":focus-visible");
365
+ then();
366
+ const after = toasts.find((entry) => entry.id === item.id);
367
+ if (li && focused && (!after || after.leaving)) onLeave(li);
368
+ };
369
+ const down = (event) => {
370
+ if (event.button !== 0 || item.leaving || !dismissible) return;
371
+ if (event.target.closest("button, a, input, textarea")) return;
372
+ drag.current = {
373
+ pointer: event.pointerId,
374
+ start: event.clientY,
375
+ offset: 0,
376
+ active: false,
377
+ samples: [{
378
+ y: event.clientY,
379
+ time: event.timeStamp
380
+ }]
381
+ };
382
+ };
383
+ const move = (event) => {
384
+ const state = drag.current;
385
+ const li = node.current;
386
+ if (!state || !li || event.pointerId !== state.pointer) return;
387
+ const toward = (event.clientY - state.start) * direction;
388
+ if (!state.active) {
389
+ if (Math.abs(toward) < 5) return;
390
+ state.active = true;
391
+ li.setPointerCapture(event.pointerId);
392
+ li.dataset.swiping = "";
393
+ onDrag(true);
394
+ }
395
+ state.offset = toward > 0 ? toward : -Math.sqrt(-toward) * 2;
396
+ state.samples.push({
397
+ y: event.clientY,
398
+ time: event.timeStamp
399
+ });
400
+ if (state.samples.length > 6) state.samples.shift();
401
+ li.style.transform = `translateY(${state.offset * direction}px)`;
402
+ };
403
+ const up = (event) => {
404
+ const state = drag.current;
405
+ const li = node.current;
406
+ drag.current = null;
407
+ if (!state?.active || !li || event.pointerId !== state.pointer) return;
408
+ delete li.dataset.swiping;
409
+ onDrag(false);
410
+ const first = state.samples[0];
411
+ const last = state.samples.at(-1);
412
+ const velocity = first && last && last.time > first.time ? (last.y - first.y) * direction / (last.time - first.time) : 0;
413
+ if (state.offset > 44 || velocity > .4) {
414
+ li.style.transform = `translateY(${(li.offsetHeight + 32) * direction}px)`;
415
+ leave(() => dismiss(item.id, "swipe"));
416
+ } else li.style.transform = "";
417
+ };
418
+ const urgent = item.tone === "danger" || item.tone === "warning";
419
+ return /* @__PURE__ */ jsxs("li", {
420
+ ref: node,
421
+ "data-toast": "",
422
+ "data-leaving": item.leaving ?? void 0,
423
+ "data-front": front ? "" : void 0,
424
+ role: urgent ? "alert" : "status",
425
+ "aria-atomic": true,
426
+ tabIndex: hidden || item.leaving ? -1 : 0,
427
+ inert: hidden || item.leaving !== null,
428
+ onPointerDown: down,
429
+ onPointerMove: move,
430
+ onPointerUp: up,
431
+ onPointerCancel: up,
432
+ onKeyDown: (event) => {
433
+ if (event.key !== "Escape" || !dismissible) return;
434
+ event.preventDefault();
435
+ leave(() => dismiss(item.id));
436
+ },
437
+ style: {
438
+ "--y": `${y}px`,
439
+ "--s": scale,
440
+ height: height === void 0 ? void 0 : `${height}px`,
441
+ zIndex: layer
442
+ },
443
+ className: `group/toast absolute inset-x-0 translate-y-(--y) scale-(--s) touch-none transition-[translate,scale,opacity,height,transform] duration-400 ${ease} focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fd-ring data-leaving:pointer-events-none data-leaving:opacity-0 data-leaving:duration-300 data-swiping:transition-none data-swiping:select-none motion-reduce:transition-opacity ${top ? "top-0 origin-top starting:-translate-y-full" : "bottom-0 origin-bottom starting:translate-y-full"} starting:opacity-0 ${hidden ? "pointer-events-none opacity-0" : ""} ${card} ${tones[item.tone]}`,
444
+ children: [/* @__PURE__ */ jsx("div", {
445
+ className: "h-full overflow-hidden rounded-[inherit]",
446
+ children: /* @__PURE__ */ jsx("div", {
447
+ ref: measure,
448
+ className: `transition-opacity duration-300 ${front ? "" : "opacity-0"}`,
449
+ children: /* @__PURE__ */ jsx(Body, {
450
+ toast: item,
451
+ labels,
452
+ undoHotkey,
453
+ onRun: (kind) => leave(() => run(item, kind))
454
+ })
455
+ })
456
+ }), dismissible && /* @__PURE__ */ jsx(Close, {
457
+ label: labels?.close ?? "Close",
458
+ shown: front,
459
+ side: closeSide,
460
+ onClick: () => leave(() => dismiss(item.id))
461
+ })]
462
+ });
463
+ }
464
+ const placements = {
465
+ "top-left": "top-4 left-4 sm:top-6 sm:left-6",
466
+ "top-center": "top-4 left-1/2 -translate-x-1/2 sm:top-6",
467
+ "top-right": "top-4 right-4 sm:top-6 sm:right-6",
468
+ "bottom-left": "bottom-[calc(1rem+env(safe-area-inset-bottom))] left-4 sm:bottom-6 sm:left-6",
469
+ "bottom-center": "bottom-[calc(1rem+env(safe-area-inset-bottom))] left-1/2 -translate-x-1/2 sm:bottom-6",
470
+ "bottom-right": "right-4 bottom-[calc(1rem+env(safe-area-inset-bottom))] sm:right-6 sm:bottom-6"
471
+ };
472
+ const gap = 10;
473
+ const strip = 8;
474
+ const shrink = .05;
475
+ function arrange(list, heights, visible) {
476
+ let slot = 0;
477
+ let offset = 0;
478
+ const layout = [];
479
+ for (const [index, item] of list.entries()) {
480
+ layout.push({
481
+ item,
482
+ slot,
483
+ offset,
484
+ layer: list.length - index
485
+ });
486
+ if (item.leaving) continue;
487
+ slot += 1;
488
+ if (slot <= visible) offset += (heights[item.id] ?? 0) + gap;
489
+ }
490
+ return {
491
+ layout,
492
+ offset
493
+ };
494
+ }
495
+ function visibility() {
496
+ hold("hidden", document.hidden);
497
+ }
498
+ function focusChange() {
499
+ hold("blur", !document.hasFocus());
500
+ }
501
+ function editable(target) {
502
+ return target instanceof HTMLElement && (target.isContentEditable || target.closest("input, textarea, select, [contenteditable]") !== null);
503
+ }
504
+ function Toaster({ position = "bottom-right", visible = 3, hotkey = "alt+t", undoHotkey = "mod+z", labels, className = "" }) {
505
+ const list = useSyncExternalStore(subscribe, () => toasts, () => empty);
506
+ const [heights, setHeights] = useState({});
507
+ const [expanded, setExpanded] = useState(false);
508
+ const returnFocus = useRef(null);
509
+ const stack = useRef(null);
510
+ const top = position.startsWith("top");
511
+ const sign = top ? 1 : -1;
512
+ const active = list.filter((item) => !item.leaving);
513
+ if (expanded && active.length === 0) setExpanded(false);
514
+ const outside = (event) => {
515
+ if (event.pointerType === "mouse") return;
516
+ if (stack.current?.contains(event.target)) return;
517
+ setExpanded(false);
518
+ hold("touch", false);
519
+ };
520
+ const connect = (node) => {
521
+ if (!node) return;
522
+ limit = visible;
523
+ arm();
524
+ const keydown = (event) => {
525
+ if (hotkey && matchShortcut(event, hotkey)) {
526
+ const first = node.querySelector("li[data-toast]:not([data-leaving]):not([inert])");
527
+ if (!first) return;
528
+ event.preventDefault();
529
+ if (!node.contains(document.activeElement)) returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
530
+ first.focus({ focusVisible: true });
531
+ return;
532
+ }
533
+ if (undoHotkey && !editable(event.target) && matchShortcut(event, undoHotkey) && undoLatest()) event.preventDefault();
534
+ };
535
+ document.addEventListener("keydown", keydown);
536
+ document.addEventListener("pointerdown", outside);
537
+ document.addEventListener("visibilitychange", visibility);
538
+ window.addEventListener("blur", focusChange);
539
+ window.addEventListener("focus", focusChange);
540
+ visibility();
541
+ focusChange();
542
+ return () => {
543
+ window.removeEventListener("blur", focusChange);
544
+ window.removeEventListener("focus", focusChange);
545
+ document.removeEventListener("keydown", keydown);
546
+ document.removeEventListener("pointerdown", outside);
547
+ document.removeEventListener("visibilitychange", visibility);
548
+ };
549
+ };
550
+ const onHeight = (id, height) => setHeights((current) => current[id] === height ? current : {
551
+ ...current,
552
+ [id]: height
553
+ });
554
+ const onLeave = (node) => {
555
+ const all = [...stack.current?.querySelectorAll("li[data-toast]") ?? []];
556
+ const index = all.indexOf(node);
557
+ const open = all.filter((item) => item !== node && !item.hasAttribute("data-leaving") && !item.inert);
558
+ const next = open.find((item) => all.indexOf(item) > index) ?? open.at(-1);
559
+ if (next) next.focus({ focusVisible: true });
560
+ else {
561
+ returnFocus.current?.focus();
562
+ returnFocus.current = null;
563
+ hold("focus", false);
564
+ }
565
+ };
566
+ const frontHeight = active[0] ? heights[active[0].id] ?? 0 : 0;
567
+ const shown = Math.min(active.length, visible);
568
+ const { layout, offset } = arrange(list, heights, visible);
569
+ const height = expanded ? Math.max(0, offset - gap) : shown ? frontHeight + strip * (shown - 1) : 0;
570
+ return /* @__PURE__ */ jsx("section", {
571
+ ref: connect,
572
+ "aria-label": labels?.region ?? "Notifications",
573
+ className: `pointer-events-none fixed z-50 w-90 max-sm:inset-x-4 max-sm:w-auto max-sm:translate-x-0 ${placements[position]} ${className}`,
574
+ children: /* @__PURE__ */ jsx("ol", {
575
+ ref: stack,
576
+ style: { height: `${height}px` },
577
+ onPointerEnter: (event) => {
578
+ if (event.pointerType !== "mouse") return;
579
+ setExpanded(true);
580
+ hold("hover", true);
581
+ },
582
+ onPointerLeave: (event) => {
583
+ if (event.pointerType !== "mouse") return;
584
+ hold("hover", false);
585
+ setExpanded(event.currentTarget.matches(":has(:focus-visible)"));
586
+ },
587
+ onPointerDown: (event) => {
588
+ if (event.pointerType === "mouse" || expanded) return;
589
+ if (active.length < 2) return;
590
+ setExpanded(true);
591
+ hold("touch", true);
592
+ },
593
+ onFocus: (event) => {
594
+ if (!event.target.matches(":focus-visible")) return;
595
+ setExpanded(true);
596
+ hold("focus", true);
597
+ },
598
+ onBlur: (event) => {
599
+ if (event.currentTarget.contains(event.relatedTarget)) return;
600
+ hold("focus", false);
601
+ setExpanded(event.currentTarget.matches(":hover"));
602
+ },
603
+ className: `relative transition-[height] duration-400 ${ease} ${active.length ? "pointer-events-auto" : ""}`,
604
+ children: layout.map(({ item, slot: place, offset: distance, layer }) => {
605
+ const own = heights[item.id];
606
+ const behind = !expanded && place > 0;
607
+ const y = expanded ? sign * distance : sign * (strip * place + frontHeight * shrink * place);
608
+ const scale = (expanded ? 1 : 1 - shrink * place) * (item.leaving === "close" ? .96 : 1);
609
+ return /* @__PURE__ */ jsx(Item, {
610
+ toast: item,
611
+ y,
612
+ scale,
613
+ height: behind && frontHeight ? frontHeight : own,
614
+ layer,
615
+ front: expanded || place === 0,
616
+ hidden: place >= visible,
617
+ top,
618
+ closeSide: position.endsWith("right") ? "left" : "right",
619
+ labels,
620
+ undoHotkey,
621
+ onHeight,
622
+ onDrag: (dragging) => hold("drag", dragging),
623
+ onLeave
624
+ }, item.id);
625
+ })
626
+ })
627
+ });
628
+ }
629
+ export { Toaster, toast };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
3
+ import { Shortcut } from "./kbd.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/ui/tooltip.tsx
6
+ function Tooltip({ content, shortcut, side = "top", align = "center", sideOffset = 8, delay, open, onOpenChange, disabled = false, children }) {
7
+ return /* @__PURE__ */ jsxs(Tooltip$1.Root, {
8
+ open: disabled ? false : open,
9
+ onOpenChange,
10
+ disableHoverablePopup: true,
11
+ children: [/* @__PURE__ */ jsx(Tooltip$1.Trigger, {
12
+ delay,
13
+ render: children
14
+ }), /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
15
+ side,
16
+ align,
17
+ sideOffset,
18
+ collisionPadding: 8,
19
+ className: "z-50",
20
+ children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, {
21
+ className: "pointer-events-none flex min-h-7 max-w-70 origin-(--transform-origin) items-center gap-2 rounded-[10px] bg-fd-foreground px-2.5 py-1.5 text-xs leading-[1.35] font-medium text-pretty text-fd-background shadow-[0_8px_24px_-6px_oklch(0%_0_0/28%),0_2px_4px_oklch(0%_0_0/10%)] transition-[opacity,scale,translate] duration-150 ease-[cubic-bezier(0.2,0,0,1)] data-ending-style:scale-[0.96] data-ending-style:opacity-0 data-ending-style:duration-100 data-instant:duration-0 data-starting-style:scale-[0.96] data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-0.5 data-[side=left]:data-starting-style:translate-x-0.5 data-[side=right]:data-starting-style:-translate-x-0.5 data-[side=top]:data-starting-style:translate-y-0.5 motion-reduce:transition-none dark:bg-[oklch(30%_0_0)] dark:text-fd-foreground dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0/6%),0_8px_24px_-6px_oklch(0%_0_0/50%)]",
22
+ children: [content, shortcut && /* @__PURE__ */ jsx(Shortcut, {
23
+ keys: shortcut,
24
+ size: "sm",
25
+ className: "-mr-1"
26
+ })]
27
+ })
28
+ }) })]
29
+ });
30
+ }
31
+ export { Tooltip };
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ // src/components/wrksz-mark.tsx
3
+ function WrkszMark(props) {
4
+ return /* @__PURE__ */ jsx("svg", {
5
+ viewBox: "0 0 1280 720",
6
+ fill: "currentColor",
7
+ "aria-hidden": true,
8
+ ...props,
9
+ children: /* @__PURE__ */ jsx("path", { d: "m-0.15 15.82l599.08 698.44c92.49-57.45 101.23-222.34 100.38-325.3-0.23-10.56 12.93-15.56 19.8-7.54 163.32 223 403.42 67.44 402.85 50.95l-115.56-134.73c-5.76-6.71-0.96-17.06 7.88-17.06 314.51-0.13 262.52-280.48 262.52-280.48h-309.09v252.43l-216.52-252.43h-359.14l270.26 315.07-5.86 74.97-321.07-374.32z" })
10
+ });
11
+ }
12
+ export { WrkszMark };
@@ -0,0 +1,8 @@
1
+ import { DocsLayout } from "./layout.js";
2
+ import { CopyMarkdownAction, EditPageAction, OpenPageMenu, PageAction, PageActionProps, PageActions } from "./page-actions.js";
3
+ import { PageFooter, PageFooterProps } from "./page-footer.js";
4
+ import { PageHeader, PageHeaderContext, PageHeaderProps } from "./page-header.js";
5
+ import { DocsPage, DocsPageProps } from "./page.js";
6
+ import { TableOfContents } from "./toc.js";
7
+ import { TocBar } from "./toc-bar.js";
8
+ export { CopyMarkdownAction, DocsLayout, DocsPage, type DocsPageProps, EditPageAction, OpenPageMenu, PageAction, type PageActionProps, PageActions, PageFooter, type PageFooterProps, PageHeader, type PageHeaderContext, type PageHeaderProps, TableOfContents, TocBar };
@@ -0,0 +1,8 @@
1
+ import { DocsLayout } from "./layout.js";
2
+ import { CopyMarkdownAction, EditPageAction, OpenPageMenu, PageAction, PageActions } from "./page-actions.js";
3
+ import { PageFooter } from "./page-footer.js";
4
+ import { PageHeader } from "./page-header.js";
5
+ import { DocsPage } from "./page.js";
6
+ import { TableOfContents } from "./toc.js";
7
+ import { TocBar } from "./toc-bar.js";
8
+ export { CopyMarkdownAction, DocsLayout, DocsPage, EditPageAction, OpenPageMenu, PageAction, PageActions, PageFooter, PageHeader, TableOfContents, TocBar };