@krak-stack/registry 0.11.1 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +22 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/html.js +1 -105
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/app-switcher/html.js +1 -103
- package/dist/components/async-action-button/html.js +1 -101
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/bulk-list-input/html.js +2 -102
- package/dist/components/choice-cards/html.js +1 -101
- package/dist/components/code-block/html.js +1 -101
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/html.d.ts +2 -2
- package/dist/components/copy-button/html.js +1 -101
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +6 -105
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/html.d.ts +51 -51
- package/dist/components/data-table/html.js +28 -101
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/date-input/html.js +2 -105
- package/dist/components/editable-text/html.d.ts +2 -2
- package/dist/components/editable-text/html.js +4 -102
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/editing-locale-switcher/html.js +2 -102
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/html.js +8 -107
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/html.d.ts +4 -4
- package/dist/components/error-component/html.js +10 -107
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/file-input/html.js +6 -106
- package/dist/components/icon-input/html.js +3 -103
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/html.js +1 -101
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/loading/html.js +1 -101
- package/dist/components/locale-switcher/html.js +1 -103
- package/dist/components/map-menu/html.d.ts +8 -8
- package/dist/components/map-menu/html.js +7 -106
- package/dist/components/markdown/html.js +1 -101
- package/dist/components/markdown/react.js +10 -164
- package/dist/components/notification-menu/html.js +7 -114
- package/dist/components/pagination/html.js +5 -100
- package/dist/components/presence-transition/react.js +9 -163
- package/dist/components/registry-previews/component-example.js +10 -164
- package/dist/components/rich-text-editor/html.js +14 -108
- package/dist/components/rich-text-editor/react.js +9 -161
- package/dist/components/search-menu/html.js +1 -103
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/html.js +2 -102
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/stepper/html.js +4 -102
- package/dist/components/support/html.js +1 -101
- package/dist/components/support/react.js +14 -168
- package/dist/components/theme-switcher/html.js +4 -105
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/time-input/html.js +1 -103
- package/dist/components/timezone-input/react.js +9 -163
- package/dist/components/toast/html.js +11 -104
- package/dist/components/upload-attachment/html.d.ts +4 -4
- package/dist/components/upload-attachment/html.js +7 -102
- package/dist/components/webhook-delivery-table/html.js +28 -101
- package/dist/components/webhook-delivery-table/react.js +74 -226
- package/dist/lib/docs.integrations.server.js +16 -35
- package/dist/lib/docs.js +31 -183
- package/dist/lib/docs.server.js +16 -35
- package/dist/lib/documentation-toolkit.js +19 -38
- package/dist/lib/effect-ui-adapter/use-model.js +158 -0
- package/dist/lib/lucide-effect.d.ts +2432 -0
- package/dist/lib/lucide-effect.js +7428 -0
- package/dist/services/agent/client/index.js +29 -183
- package/package.json +10 -2
|
@@ -10,8 +10,8 @@ import { Cookies as Cookies2 } from "effect/http";
|
|
|
10
10
|
import {
|
|
11
11
|
forwardRef,
|
|
12
12
|
useDeferredValue,
|
|
13
|
-
useEffect as
|
|
14
|
-
useState as
|
|
13
|
+
useEffect as useEffect3,
|
|
14
|
+
useState as useState4
|
|
15
15
|
} from "react";
|
|
16
16
|
|
|
17
17
|
// ../../src/lib/utils.ts
|
|
@@ -70,34 +70,13 @@ var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justif
|
|
|
70
70
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
71
71
|
import { Redacted as Redacted2 } from "effect";
|
|
72
72
|
import { Component as Component2 } from "effect/ui";
|
|
73
|
-
import { useLayoutEffect
|
|
73
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
74
74
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
75
|
-
|
|
76
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
77
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
78
|
-
import {
|
|
79
|
-
createContext,
|
|
80
|
-
useCallback,
|
|
81
|
-
useContext,
|
|
82
|
-
useEffect,
|
|
83
|
-
useLayoutEffect,
|
|
84
|
-
useRef,
|
|
85
|
-
useState,
|
|
86
|
-
useSyncExternalStore
|
|
87
|
-
} from "react";
|
|
88
|
-
|
|
89
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
90
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
91
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
92
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
93
|
-
|
|
94
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
95
|
-
"use client";
|
|
96
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
75
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
97
76
|
|
|
98
77
|
// ../../src/components/copy-button/index.ts
|
|
99
|
-
import { Effect
|
|
100
|
-
import { Command, Component, UiSchema, View
|
|
78
|
+
import { Effect, Redacted, Schema as Schema2 } from "effect";
|
|
79
|
+
import { Command, Component, UiSchema, View } from "effect/ui";
|
|
101
80
|
|
|
102
81
|
// ../../src/components/copy-button/schema.ts
|
|
103
82
|
import { Schema } from "effect";
|
|
@@ -141,13 +120,13 @@ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
|
|
|
141
120
|
},
|
|
142
121
|
success: CopyButtonMessage
|
|
143
122
|
}) {
|
|
144
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) =>
|
|
123
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect.tryPromise(() => write(Redacted.value(value))).pipe(Effect.match({
|
|
145
124
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
146
125
|
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
147
126
|
})));
|
|
148
127
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
149
128
|
}
|
|
150
|
-
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) =>
|
|
129
|
+
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) => Effect.sleep(Math.max(0, delay)).pipe(Effect.as(CopyButtonMessage.Reset())));
|
|
151
130
|
var copyButtonOptions = {
|
|
152
131
|
name: "CopyButton",
|
|
153
132
|
props: CopyButtonModelProps,
|
|
@@ -169,7 +148,7 @@ var copyButtonBehaviours = {
|
|
|
169
148
|
};
|
|
170
149
|
var CopyButtonModel = Definition.make({
|
|
171
150
|
...copyButtonBehaviours,
|
|
172
|
-
view: () =>
|
|
151
|
+
view: () => View.text("")
|
|
173
152
|
});
|
|
174
153
|
// ../../src/components/copy-button/react.tsx
|
|
175
154
|
"use client";
|
|
@@ -206,7 +185,7 @@ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
|
|
|
206
185
|
|
|
207
186
|
// ../../src/components/search-menu/react.tsx
|
|
208
187
|
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
209
|
-
import { useCallback
|
|
188
|
+
import { useCallback, useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
210
189
|
|
|
211
190
|
// ../../src/components/ui/command.tsx
|
|
212
191
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -219,7 +198,8 @@ import { XIcon } from "lucide-react";
|
|
|
219
198
|
|
|
220
199
|
// ../../src/components/search-menu/react.tsx
|
|
221
200
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
222
|
-
import { Component as Component4, View as
|
|
201
|
+
import { Component as Component4, View as View2 } from "effect/ui";
|
|
202
|
+
import { useModel as useModel2 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
223
203
|
|
|
224
204
|
// ../../src/components/search-menu/classes.ts
|
|
225
205
|
var searchMenuClasses = {
|
|
@@ -314,11 +294,12 @@ var searchMenuBehaviours = {
|
|
|
314
294
|
// ../../src/components/search-menu/react.tsx
|
|
315
295
|
var SearchModel = Component4.define(searchMenuOptions).make({
|
|
316
296
|
...searchMenuBehaviours,
|
|
317
|
-
view: () =>
|
|
297
|
+
view: () => View2.text("")
|
|
318
298
|
});
|
|
319
299
|
// ../../src/components/sidebar-layout/react.tsx
|
|
320
300
|
import { Link, Outlet } from "@tanstack/react-router";
|
|
321
|
-
import { Component as Component6, View as
|
|
301
|
+
import { Component as Component6, View as View3 } from "effect/ui";
|
|
302
|
+
import { useModel as useModel3 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
322
303
|
|
|
323
304
|
// ../../src/components/ui/sidebar.tsx
|
|
324
305
|
import * as React2 from "react";
|
|
@@ -458,7 +439,7 @@ var sidebarLayoutBehaviours = {
|
|
|
458
439
|
// ../../src/components/sidebar-layout/react.tsx
|
|
459
440
|
var SidebarModel = Component6.define(sidebarLayoutOptions).make({
|
|
460
441
|
...sidebarLayoutBehaviours,
|
|
461
|
-
view: () =>
|
|
442
|
+
view: () => View3.text("")
|
|
462
443
|
});
|
|
463
444
|
// ../../src/lib/docs.tsx
|
|
464
445
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
package/dist/lib/docs.js
CHANGED
|
@@ -6,8 +6,8 @@ import { Cookies as Cookies2 } from "effect/http";
|
|
|
6
6
|
import {
|
|
7
7
|
forwardRef,
|
|
8
8
|
useDeferredValue,
|
|
9
|
-
useEffect as
|
|
10
|
-
useState as
|
|
9
|
+
useEffect as useEffect3,
|
|
10
|
+
useState as useState4
|
|
11
11
|
} from "react";
|
|
12
12
|
|
|
13
13
|
// ../../src/lib/utils.ts
|
|
@@ -178,167 +178,13 @@ function Button({
|
|
|
178
178
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
179
179
|
import { Redacted as Redacted2 } from "effect";
|
|
180
180
|
import { Component as Component2 } from "effect/ui";
|
|
181
|
-
import { useLayoutEffect
|
|
181
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
182
182
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
183
|
-
|
|
184
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
185
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
186
|
-
import {
|
|
187
|
-
createContext,
|
|
188
|
-
useCallback,
|
|
189
|
-
useContext,
|
|
190
|
-
useEffect,
|
|
191
|
-
useLayoutEffect,
|
|
192
|
-
useRef,
|
|
193
|
-
useState,
|
|
194
|
-
useSyncExternalStore
|
|
195
|
-
} from "react";
|
|
196
|
-
|
|
197
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
198
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
199
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
200
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
201
|
-
var node = () => ({ children: [] });
|
|
202
|
-
var modelHost = (commit) => {
|
|
203
|
-
const remove = (child) => {
|
|
204
|
-
if (!child.parent)
|
|
205
|
-
return;
|
|
206
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
207
|
-
delete child.parent;
|
|
208
|
-
};
|
|
209
|
-
return {
|
|
210
|
-
createElement: node,
|
|
211
|
-
createText: node,
|
|
212
|
-
setText: () => {},
|
|
213
|
-
setAttr: () => {},
|
|
214
|
-
setProp: () => {},
|
|
215
|
-
setEvents: () => {},
|
|
216
|
-
insertBefore: (parent, child, before) => {
|
|
217
|
-
if (child === before)
|
|
218
|
-
return;
|
|
219
|
-
remove(child);
|
|
220
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
221
|
-
parent.children.splice(index, 0, child);
|
|
222
|
-
child.parent = parent;
|
|
223
|
-
},
|
|
224
|
-
remove,
|
|
225
|
-
parentOf: (child) => child.parent,
|
|
226
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
227
|
-
elements: ["html"],
|
|
228
|
-
controlled: new Set,
|
|
229
|
-
runsMounts: false,
|
|
230
|
-
commit
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
234
|
-
let currentProps = props;
|
|
235
|
-
let root;
|
|
236
|
-
let active = true;
|
|
237
|
-
let failure;
|
|
238
|
-
const publish = () => {
|
|
239
|
-
if (!active)
|
|
240
|
-
return;
|
|
241
|
-
if (failure) {
|
|
242
|
-
publishSnapshot({ error: failure });
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const current = root?.model();
|
|
246
|
-
if (current !== undefined)
|
|
247
|
-
publishSnapshot({ model: current });
|
|
248
|
-
};
|
|
249
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
250
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
251
|
-
head: false,
|
|
252
|
-
onEmit,
|
|
253
|
-
fallback: ({ cause }) => {
|
|
254
|
-
failure = new Error("Effect UI root failed", {
|
|
255
|
-
cause: Cause.squash(cause)
|
|
256
|
-
});
|
|
257
|
-
return View.text("");
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
if (!active)
|
|
261
|
-
return;
|
|
262
|
-
root = mounted;
|
|
263
|
-
if (props !== currentProps)
|
|
264
|
-
mounted.setProps(currentProps);
|
|
265
|
-
publish();
|
|
266
|
-
return yield* Effect.never;
|
|
267
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
268
|
-
return {
|
|
269
|
-
send: (message) => {
|
|
270
|
-
root?.send(message);
|
|
271
|
-
publish();
|
|
272
|
-
},
|
|
273
|
-
setProps: (next) => {
|
|
274
|
-
currentProps = next;
|
|
275
|
-
root?.setProps(next);
|
|
276
|
-
},
|
|
277
|
-
dispose: () => {
|
|
278
|
-
active = false;
|
|
279
|
-
root = undefined;
|
|
280
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
286
|
-
"use client";
|
|
287
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
288
|
-
var useModel = (component, props, options = {}) => {
|
|
289
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
290
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
291
|
-
const [store] = useState(() => {
|
|
292
|
-
const initial = { model: component.init(props).model };
|
|
293
|
-
let snapshot = initial;
|
|
294
|
-
const listeners = new Set;
|
|
295
|
-
return {
|
|
296
|
-
subscribe: (listener) => {
|
|
297
|
-
listeners.add(listener);
|
|
298
|
-
return () => {
|
|
299
|
-
listeners.delete(listener);
|
|
300
|
-
};
|
|
301
|
-
},
|
|
302
|
-
getSnapshot: () => snapshot,
|
|
303
|
-
getServerSnapshot: () => initial,
|
|
304
|
-
publish: (next) => {
|
|
305
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
306
|
-
return;
|
|
307
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
308
|
-
return;
|
|
309
|
-
snapshot = next;
|
|
310
|
-
listeners.forEach((listener) => listener());
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
});
|
|
314
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
315
|
-
const committed = useRef(props);
|
|
316
|
-
const onEmit = useRef(options.onEmit);
|
|
317
|
-
const runtime = useRef(undefined);
|
|
318
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
319
|
-
useLayoutEffect(() => {
|
|
320
|
-
onEmit.current = options.onEmit;
|
|
321
|
-
committed.current = props;
|
|
322
|
-
runtime.current?.setProps(props);
|
|
323
|
-
}, [props, options.onEmit]);
|
|
324
|
-
useEffect(() => {
|
|
325
|
-
if (messageLog === null)
|
|
326
|
-
return;
|
|
327
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
328
|
-
runtime.current = mounted;
|
|
329
|
-
return () => {
|
|
330
|
-
runtime.current = undefined;
|
|
331
|
-
mounted.dispose();
|
|
332
|
-
};
|
|
333
|
-
}, [component, messageLog, store]);
|
|
334
|
-
if ("error" in snapshot)
|
|
335
|
-
throw snapshot.error;
|
|
336
|
-
return { model: snapshot.model, send };
|
|
337
|
-
};
|
|
183
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
338
184
|
|
|
339
185
|
// ../../src/components/copy-button/index.ts
|
|
340
|
-
import { Effect
|
|
341
|
-
import { Command, Component, UiSchema, View
|
|
186
|
+
import { Effect, Redacted, Schema as Schema2 } from "effect";
|
|
187
|
+
import { Command, Component, UiSchema, View } from "effect/ui";
|
|
342
188
|
|
|
343
189
|
// ../../src/components/copy-button/schema.ts
|
|
344
190
|
import { Schema } from "effect";
|
|
@@ -393,13 +239,13 @@ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
|
|
|
393
239
|
},
|
|
394
240
|
success: CopyButtonMessage
|
|
395
241
|
}) {
|
|
396
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) =>
|
|
242
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect.tryPromise(() => write(Redacted.value(value))).pipe(Effect.match({
|
|
397
243
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
398
244
|
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
399
245
|
})));
|
|
400
246
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
401
247
|
}
|
|
402
|
-
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) =>
|
|
248
|
+
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) => Effect.sleep(Math.max(0, delay)).pipe(Effect.as(CopyButtonMessage.Reset())));
|
|
403
249
|
var copyButtonOptions = {
|
|
404
250
|
name: "CopyButton",
|
|
405
251
|
props: CopyButtonModelProps,
|
|
@@ -421,7 +267,7 @@ var copyButtonBehaviours = {
|
|
|
421
267
|
};
|
|
422
268
|
var CopyButtonModel = Definition.make({
|
|
423
269
|
...copyButtonBehaviours,
|
|
424
|
-
view: () =>
|
|
270
|
+
view: () => View.text("")
|
|
425
271
|
});
|
|
426
272
|
var copyButtonStatus = (status, copy, description) => {
|
|
427
273
|
if (status === "idle")
|
|
@@ -449,19 +295,19 @@ function CopyButton({
|
|
|
449
295
|
}) {
|
|
450
296
|
const locale = useKrakstackLocale(localeOverride);
|
|
451
297
|
const labels = copyButtonMessages(locale, messages);
|
|
452
|
-
const callbacks =
|
|
298
|
+
const callbacks = useRef({
|
|
453
299
|
onCopied,
|
|
454
300
|
onCopyError,
|
|
455
301
|
failureLabel: labels.copyFailed
|
|
456
302
|
});
|
|
457
|
-
|
|
303
|
+
useLayoutEffect(() => {
|
|
458
304
|
callbacks.current = {
|
|
459
305
|
onCopied,
|
|
460
306
|
onCopyError,
|
|
461
307
|
failureLabel: labels.copyFailed
|
|
462
308
|
};
|
|
463
309
|
}, [onCopied, onCopyError, labels.copyFailed]);
|
|
464
|
-
const [component] =
|
|
310
|
+
const [component] = useState(() => CopyButtonModel.pipe(Component2.provide(WriteClipboard.layerFromWrite(async (text) => {
|
|
465
311
|
const { onCopied, onCopyError, failureLabel } = callbacks.current;
|
|
466
312
|
try {
|
|
467
313
|
await navigator.clipboard.writeText(text);
|
|
@@ -693,7 +539,7 @@ function CollapsibleContent({ ...props }) {
|
|
|
693
539
|
|
|
694
540
|
// ../../src/components/search-menu/react.tsx
|
|
695
541
|
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
696
|
-
import { useCallback
|
|
542
|
+
import { useCallback, useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
697
543
|
|
|
698
544
|
// ../../src/components/ui/command.tsx
|
|
699
545
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -901,7 +747,8 @@ function CommandShortcut({
|
|
|
901
747
|
|
|
902
748
|
// ../../src/components/search-menu/react.tsx
|
|
903
749
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
904
|
-
import { Component as Component4, View as
|
|
750
|
+
import { Component as Component4, View as View2 } from "effect/ui";
|
|
751
|
+
import { useModel as useModel2 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
905
752
|
|
|
906
753
|
// ../../src/components/search-menu/classes.ts
|
|
907
754
|
var searchMenuClasses = {
|
|
@@ -1024,7 +871,7 @@ var searchMenuBehaviours = {
|
|
|
1024
871
|
import { jsx as jsx9, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
|
|
1025
872
|
var SearchModel = Component4.define(searchMenuOptions).make({
|
|
1026
873
|
...searchMenuBehaviours,
|
|
1027
|
-
view: () =>
|
|
874
|
+
view: () => View2.text("")
|
|
1028
875
|
});
|
|
1029
876
|
function SearchMenu({
|
|
1030
877
|
classes: classOverrides,
|
|
@@ -1054,27 +901,27 @@ function SearchMenu({
|
|
|
1054
901
|
const resolvedPlaceholder = placeholder ?? labels.placeholder;
|
|
1055
902
|
const resolvedInputPlaceholder = inputPlaceholder ?? labels.inputPlaceholder;
|
|
1056
903
|
const resolvedEmptyMessage = emptyMessage ?? labels.emptyMessage;
|
|
1057
|
-
const { model, send } =
|
|
904
|
+
const { model, send } = useModel2(SearchModel, { groups, open, query });
|
|
1058
905
|
const isOpen = open ?? model.open;
|
|
1059
906
|
const searchQuery = query ?? model.query;
|
|
1060
907
|
const externalGroups = shouldFilter === false ? groups : undefined;
|
|
1061
|
-
const [selection, setSelection] =
|
|
908
|
+
const [selection, setSelection] = useState2();
|
|
1062
909
|
const externalItems = externalGroups?.flatMap(({ items }) => items.filter(({ disabled }) => !disabled));
|
|
1063
910
|
const selectedValue = selection?.groups === externalGroups && selection?.query === searchQuery && externalItems?.some(({ label }) => label.trim() === selection?.value) ? selection.value : externalItems?.[0]?.label.trim() ?? "";
|
|
1064
|
-
const inputRef =
|
|
1065
|
-
const listRef =
|
|
911
|
+
const inputRef = useRef2(null);
|
|
912
|
+
const listRef = useRef2(null);
|
|
1066
913
|
const setQuery = (value) => {
|
|
1067
914
|
if (query === undefined)
|
|
1068
915
|
send(SearchMenuMessage.SetQuery({ query: value }));
|
|
1069
916
|
onQueryChange?.(value);
|
|
1070
917
|
};
|
|
1071
|
-
|
|
918
|
+
useEffect(() => {
|
|
1072
919
|
if (!isOpen) {
|
|
1073
920
|
send(SearchMenuMessage.Reset());
|
|
1074
921
|
setSelection(undefined);
|
|
1075
922
|
}
|
|
1076
923
|
}, [isOpen, send]);
|
|
1077
|
-
|
|
924
|
+
useEffect(() => {
|
|
1078
925
|
const list = listRef.current;
|
|
1079
926
|
if (!isOpen || !list)
|
|
1080
927
|
return;
|
|
@@ -1083,12 +930,12 @@ function SearchMenu({
|
|
|
1083
930
|
});
|
|
1084
931
|
return () => cancelAnimationFrame(frame);
|
|
1085
932
|
}, [isOpen, searchQuery, externalGroups]);
|
|
1086
|
-
const setOpen =
|
|
933
|
+
const setOpen = useCallback((value) => {
|
|
1087
934
|
if (open === undefined)
|
|
1088
935
|
send(SearchMenuMessage.SetOpen({ open: value }));
|
|
1089
936
|
onOpenChange?.(value);
|
|
1090
937
|
}, [open, onOpenChange, send]);
|
|
1091
|
-
|
|
938
|
+
useEffect(() => {
|
|
1092
939
|
if (!enableShortcut)
|
|
1093
940
|
return;
|
|
1094
941
|
const onKeyDown = (event) => {
|
|
@@ -1221,7 +1068,8 @@ function SearchMenu({
|
|
|
1221
1068
|
}
|
|
1222
1069
|
// ../../src/components/sidebar-layout/react.tsx
|
|
1223
1070
|
import { Link, Outlet } from "@tanstack/react-router";
|
|
1224
|
-
import { Component as Component6, View as
|
|
1071
|
+
import { Component as Component6, View as View3 } from "effect/ui";
|
|
1072
|
+
import { useModel as useModel3 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
1225
1073
|
|
|
1226
1074
|
// ../../src/components/ui/sidebar.tsx
|
|
1227
1075
|
import * as React2 from "react";
|
|
@@ -1858,7 +1706,7 @@ var sidebarLayoutBehaviours = {
|
|
|
1858
1706
|
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1859
1707
|
var SidebarModel = Component6.define(sidebarLayoutOptions).make({
|
|
1860
1708
|
...sidebarLayoutBehaviours,
|
|
1861
|
-
view: () =>
|
|
1709
|
+
view: () => View3.text("")
|
|
1862
1710
|
});
|
|
1863
1711
|
function AppSidebar({ collapsible, footer, groups, header }) {
|
|
1864
1712
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
@@ -1964,7 +1812,7 @@ function SidebarLayout({
|
|
|
1964
1812
|
const {
|
|
1965
1813
|
model: { open: sidebarOpen },
|
|
1966
1814
|
send
|
|
1967
|
-
} =
|
|
1815
|
+
} = useModel3(SidebarModel, {
|
|
1968
1816
|
groups: [],
|
|
1969
1817
|
defaultOpen
|
|
1970
1818
|
});
|
|
@@ -2590,8 +2438,8 @@ var DocsArticle = ({
|
|
|
2590
2438
|
});
|
|
2591
2439
|
};
|
|
2592
2440
|
var useActiveDocsHeading = (headings) => {
|
|
2593
|
-
const [activeHeadingId, setActiveHeadingId] =
|
|
2594
|
-
|
|
2441
|
+
const [activeHeadingId, setActiveHeadingId] = useState4();
|
|
2442
|
+
useEffect3(() => {
|
|
2595
2443
|
const elements = headings.flatMap((heading) => {
|
|
2596
2444
|
const element = document.getElementById(heading.id);
|
|
2597
2445
|
return element ? [element] : [];
|
|
@@ -2702,7 +2550,7 @@ var DocsSearch = ({
|
|
|
2702
2550
|
locale,
|
|
2703
2551
|
messages
|
|
2704
2552
|
}) => {
|
|
2705
|
-
const [query, setQuery] =
|
|
2553
|
+
const [query, setQuery] = useState4("");
|
|
2706
2554
|
const deferredQuery = useDeferredValue(query);
|
|
2707
2555
|
const results = docs.search(deferredQuery, locale);
|
|
2708
2556
|
const isSearching = deferredQuery.trim().length > 0;
|
package/dist/lib/docs.server.js
CHANGED
|
@@ -10,8 +10,8 @@ import { Cookies as Cookies2 } from "effect/http";
|
|
|
10
10
|
import {
|
|
11
11
|
forwardRef,
|
|
12
12
|
useDeferredValue,
|
|
13
|
-
useEffect as
|
|
14
|
-
useState as
|
|
13
|
+
useEffect as useEffect3,
|
|
14
|
+
useState as useState4
|
|
15
15
|
} from "react";
|
|
16
16
|
|
|
17
17
|
// ../../src/lib/utils.ts
|
|
@@ -70,34 +70,13 @@ var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justif
|
|
|
70
70
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
71
71
|
import { Redacted as Redacted2 } from "effect";
|
|
72
72
|
import { Component as Component2 } from "effect/ui";
|
|
73
|
-
import { useLayoutEffect
|
|
73
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
74
74
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
75
|
-
|
|
76
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
77
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
78
|
-
import {
|
|
79
|
-
createContext,
|
|
80
|
-
useCallback,
|
|
81
|
-
useContext,
|
|
82
|
-
useEffect,
|
|
83
|
-
useLayoutEffect,
|
|
84
|
-
useRef,
|
|
85
|
-
useState,
|
|
86
|
-
useSyncExternalStore
|
|
87
|
-
} from "react";
|
|
88
|
-
|
|
89
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
90
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
91
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
92
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
93
|
-
|
|
94
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
95
|
-
"use client";
|
|
96
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
75
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
97
76
|
|
|
98
77
|
// ../../src/components/copy-button/index.ts
|
|
99
|
-
import { Effect
|
|
100
|
-
import { Command, Component, UiSchema, View
|
|
78
|
+
import { Effect, Redacted, Schema as Schema2 } from "effect";
|
|
79
|
+
import { Command, Component, UiSchema, View } from "effect/ui";
|
|
101
80
|
|
|
102
81
|
// ../../src/components/copy-button/schema.ts
|
|
103
82
|
import { Schema } from "effect";
|
|
@@ -141,13 +120,13 @@ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
|
|
|
141
120
|
},
|
|
142
121
|
success: CopyButtonMessage
|
|
143
122
|
}) {
|
|
144
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) =>
|
|
123
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect.tryPromise(() => write(Redacted.value(value))).pipe(Effect.match({
|
|
145
124
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
146
125
|
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
147
126
|
})));
|
|
148
127
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
149
128
|
}
|
|
150
|
-
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) =>
|
|
129
|
+
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) => Effect.sleep(Math.max(0, delay)).pipe(Effect.as(CopyButtonMessage.Reset())));
|
|
151
130
|
var copyButtonOptions = {
|
|
152
131
|
name: "CopyButton",
|
|
153
132
|
props: CopyButtonModelProps,
|
|
@@ -169,7 +148,7 @@ var copyButtonBehaviours = {
|
|
|
169
148
|
};
|
|
170
149
|
var CopyButtonModel = Definition.make({
|
|
171
150
|
...copyButtonBehaviours,
|
|
172
|
-
view: () =>
|
|
151
|
+
view: () => View.text("")
|
|
173
152
|
});
|
|
174
153
|
// ../../src/components/copy-button/react.tsx
|
|
175
154
|
"use client";
|
|
@@ -206,7 +185,7 @@ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
|
|
|
206
185
|
|
|
207
186
|
// ../../src/components/search-menu/react.tsx
|
|
208
187
|
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
209
|
-
import { useCallback
|
|
188
|
+
import { useCallback, useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
210
189
|
|
|
211
190
|
// ../../src/components/ui/command.tsx
|
|
212
191
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -219,7 +198,8 @@ import { XIcon } from "lucide-react";
|
|
|
219
198
|
|
|
220
199
|
// ../../src/components/search-menu/react.tsx
|
|
221
200
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
222
|
-
import { Component as Component4, View as
|
|
201
|
+
import { Component as Component4, View as View2 } from "effect/ui";
|
|
202
|
+
import { useModel as useModel2 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
223
203
|
|
|
224
204
|
// ../../src/components/search-menu/classes.ts
|
|
225
205
|
var searchMenuClasses = {
|
|
@@ -314,11 +294,12 @@ var searchMenuBehaviours = {
|
|
|
314
294
|
// ../../src/components/search-menu/react.tsx
|
|
315
295
|
var SearchModel = Component4.define(searchMenuOptions).make({
|
|
316
296
|
...searchMenuBehaviours,
|
|
317
|
-
view: () =>
|
|
297
|
+
view: () => View2.text("")
|
|
318
298
|
});
|
|
319
299
|
// ../../src/components/sidebar-layout/react.tsx
|
|
320
300
|
import { Link, Outlet } from "@tanstack/react-router";
|
|
321
|
-
import { Component as Component6, View as
|
|
301
|
+
import { Component as Component6, View as View3 } from "effect/ui";
|
|
302
|
+
import { useModel as useModel3 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
322
303
|
|
|
323
304
|
// ../../src/components/ui/sidebar.tsx
|
|
324
305
|
import * as React2 from "react";
|
|
@@ -458,7 +439,7 @@ var sidebarLayoutBehaviours = {
|
|
|
458
439
|
// ../../src/components/sidebar-layout/react.tsx
|
|
459
440
|
var SidebarModel = Component6.define(sidebarLayoutOptions).make({
|
|
460
441
|
...sidebarLayoutBehaviours,
|
|
461
|
-
view: () =>
|
|
442
|
+
view: () => View3.text("")
|
|
462
443
|
});
|
|
463
444
|
// ../../src/lib/docs.tsx
|
|
464
445
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|