@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ../../src/components/search-menu/react.tsx
|
|
2
2
|
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
3
|
-
import { useCallback
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
|
|
5
5
|
// ../../src/components/ui/button.tsx
|
|
6
6
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
@@ -256,162 +256,8 @@ function CommandShortcut({
|
|
|
256
256
|
|
|
257
257
|
// ../../src/components/search-menu/react.tsx
|
|
258
258
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
259
|
-
import { Component as Component2, View
|
|
260
|
-
|
|
261
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
262
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
263
|
-
import {
|
|
264
|
-
createContext,
|
|
265
|
-
useCallback,
|
|
266
|
-
useContext,
|
|
267
|
-
useEffect,
|
|
268
|
-
useLayoutEffect,
|
|
269
|
-
useRef,
|
|
270
|
-
useState,
|
|
271
|
-
useSyncExternalStore
|
|
272
|
-
} from "react";
|
|
273
|
-
|
|
274
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
275
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
276
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
277
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
278
|
-
var node = () => ({ children: [] });
|
|
279
|
-
var modelHost = (commit) => {
|
|
280
|
-
const remove = (child) => {
|
|
281
|
-
if (!child.parent)
|
|
282
|
-
return;
|
|
283
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
284
|
-
delete child.parent;
|
|
285
|
-
};
|
|
286
|
-
return {
|
|
287
|
-
createElement: node,
|
|
288
|
-
createText: node,
|
|
289
|
-
setText: () => {},
|
|
290
|
-
setAttr: () => {},
|
|
291
|
-
setProp: () => {},
|
|
292
|
-
setEvents: () => {},
|
|
293
|
-
insertBefore: (parent, child, before) => {
|
|
294
|
-
if (child === before)
|
|
295
|
-
return;
|
|
296
|
-
remove(child);
|
|
297
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
298
|
-
parent.children.splice(index, 0, child);
|
|
299
|
-
child.parent = parent;
|
|
300
|
-
},
|
|
301
|
-
remove,
|
|
302
|
-
parentOf: (child) => child.parent,
|
|
303
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
304
|
-
elements: ["html"],
|
|
305
|
-
controlled: new Set,
|
|
306
|
-
runsMounts: false,
|
|
307
|
-
commit
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
311
|
-
let currentProps = props;
|
|
312
|
-
let root;
|
|
313
|
-
let active = true;
|
|
314
|
-
let failure;
|
|
315
|
-
const publish = () => {
|
|
316
|
-
if (!active)
|
|
317
|
-
return;
|
|
318
|
-
if (failure) {
|
|
319
|
-
publishSnapshot({ error: failure });
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
const current = root?.model();
|
|
323
|
-
if (current !== undefined)
|
|
324
|
-
publishSnapshot({ model: current });
|
|
325
|
-
};
|
|
326
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
327
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
328
|
-
head: false,
|
|
329
|
-
onEmit,
|
|
330
|
-
fallback: ({ cause }) => {
|
|
331
|
-
failure = new Error("Effect UI root failed", {
|
|
332
|
-
cause: Cause.squash(cause)
|
|
333
|
-
});
|
|
334
|
-
return View.text("");
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
if (!active)
|
|
338
|
-
return;
|
|
339
|
-
root = mounted;
|
|
340
|
-
if (props !== currentProps)
|
|
341
|
-
mounted.setProps(currentProps);
|
|
342
|
-
publish();
|
|
343
|
-
return yield* Effect.never;
|
|
344
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
345
|
-
return {
|
|
346
|
-
send: (message) => {
|
|
347
|
-
root?.send(message);
|
|
348
|
-
publish();
|
|
349
|
-
},
|
|
350
|
-
setProps: (next) => {
|
|
351
|
-
currentProps = next;
|
|
352
|
-
root?.setProps(next);
|
|
353
|
-
},
|
|
354
|
-
dispose: () => {
|
|
355
|
-
active = false;
|
|
356
|
-
root = undefined;
|
|
357
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
363
|
-
"use client";
|
|
364
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
365
|
-
var useModel = (component, props, options = {}) => {
|
|
366
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
367
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
368
|
-
const [store] = useState(() => {
|
|
369
|
-
const initial = { model: component.init(props).model };
|
|
370
|
-
let snapshot = initial;
|
|
371
|
-
const listeners = new Set;
|
|
372
|
-
return {
|
|
373
|
-
subscribe: (listener) => {
|
|
374
|
-
listeners.add(listener);
|
|
375
|
-
return () => {
|
|
376
|
-
listeners.delete(listener);
|
|
377
|
-
};
|
|
378
|
-
},
|
|
379
|
-
getSnapshot: () => snapshot,
|
|
380
|
-
getServerSnapshot: () => initial,
|
|
381
|
-
publish: (next) => {
|
|
382
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
383
|
-
return;
|
|
384
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
385
|
-
return;
|
|
386
|
-
snapshot = next;
|
|
387
|
-
listeners.forEach((listener) => listener());
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
});
|
|
391
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
392
|
-
const committed = useRef(props);
|
|
393
|
-
const onEmit = useRef(options.onEmit);
|
|
394
|
-
const runtime = useRef(undefined);
|
|
395
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
396
|
-
useLayoutEffect(() => {
|
|
397
|
-
onEmit.current = options.onEmit;
|
|
398
|
-
committed.current = props;
|
|
399
|
-
runtime.current?.setProps(props);
|
|
400
|
-
}, [props, options.onEmit]);
|
|
401
|
-
useEffect(() => {
|
|
402
|
-
if (messageLog === null)
|
|
403
|
-
return;
|
|
404
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
405
|
-
runtime.current = mounted;
|
|
406
|
-
return () => {
|
|
407
|
-
runtime.current = undefined;
|
|
408
|
-
mounted.dispose();
|
|
409
|
-
};
|
|
410
|
-
}, [component, messageLog, store]);
|
|
411
|
-
if ("error" in snapshot)
|
|
412
|
-
throw snapshot.error;
|
|
413
|
-
return { model: snapshot.model, send };
|
|
414
|
-
};
|
|
259
|
+
import { Component as Component2, View } from "effect/ui";
|
|
260
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
415
261
|
|
|
416
262
|
// ../../src/components/search-menu/classes.ts
|
|
417
263
|
var searchMenuClasses = {
|
|
@@ -534,7 +380,7 @@ var searchMenuBehaviours = {
|
|
|
534
380
|
import { jsx as jsx4, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
535
381
|
var SearchModel = Component2.define(searchMenuOptions).make({
|
|
536
382
|
...searchMenuBehaviours,
|
|
537
|
-
view: () =>
|
|
383
|
+
view: () => View.text("")
|
|
538
384
|
});
|
|
539
385
|
function SearchMenu({
|
|
540
386
|
classes: classOverrides,
|
|
@@ -568,23 +414,23 @@ function SearchMenu({
|
|
|
568
414
|
const isOpen = open ?? model.open;
|
|
569
415
|
const searchQuery = query ?? model.query;
|
|
570
416
|
const externalGroups = shouldFilter === false ? groups : undefined;
|
|
571
|
-
const [selection, setSelection] =
|
|
417
|
+
const [selection, setSelection] = useState();
|
|
572
418
|
const externalItems = externalGroups?.flatMap(({ items }) => items.filter(({ disabled }) => !disabled));
|
|
573
419
|
const selectedValue = selection?.groups === externalGroups && selection?.query === searchQuery && externalItems?.some(({ label }) => label.trim() === selection?.value) ? selection.value : externalItems?.[0]?.label.trim() ?? "";
|
|
574
|
-
const inputRef =
|
|
575
|
-
const listRef =
|
|
420
|
+
const inputRef = useRef(null);
|
|
421
|
+
const listRef = useRef(null);
|
|
576
422
|
const setQuery = (value) => {
|
|
577
423
|
if (query === undefined)
|
|
578
424
|
send(SearchMenuMessage.SetQuery({ query: value }));
|
|
579
425
|
onQueryChange?.(value);
|
|
580
426
|
};
|
|
581
|
-
|
|
427
|
+
useEffect(() => {
|
|
582
428
|
if (!isOpen) {
|
|
583
429
|
send(SearchMenuMessage.Reset());
|
|
584
430
|
setSelection(undefined);
|
|
585
431
|
}
|
|
586
432
|
}, [isOpen, send]);
|
|
587
|
-
|
|
433
|
+
useEffect(() => {
|
|
588
434
|
const list = listRef.current;
|
|
589
435
|
if (!isOpen || !list)
|
|
590
436
|
return;
|
|
@@ -593,12 +439,12 @@ function SearchMenu({
|
|
|
593
439
|
});
|
|
594
440
|
return () => cancelAnimationFrame(frame);
|
|
595
441
|
}, [isOpen, searchQuery, externalGroups]);
|
|
596
|
-
const setOpen =
|
|
442
|
+
const setOpen = useCallback((value) => {
|
|
597
443
|
if (open === undefined)
|
|
598
444
|
send(SearchMenuMessage.SetOpen({ open: value }));
|
|
599
445
|
onOpenChange?.(value);
|
|
600
446
|
}, [open, onOpenChange, send]);
|
|
601
|
-
|
|
447
|
+
useEffect(() => {
|
|
602
448
|
if (!enableShortcut)
|
|
603
449
|
return;
|
|
604
450
|
const onKeyDown = (event) => {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { Schema as Schema3 } from "effect";
|
|
3
3
|
import { Html } from "effect/ui/html";
|
|
4
4
|
import { Dialog } from "effect/ui/kit";
|
|
5
|
-
import { PanelLeft } from "lucide";
|
|
6
5
|
|
|
7
6
|
// ../../src/components/effectcn/button.ts
|
|
8
7
|
import {
|
|
@@ -38,106 +37,8 @@ var DialogViewport = (h, dialog, options = {}) => dialog.viewport(h.div.class(cn
|
|
|
38
37
|
var DialogPopup = (h, dialog, options = {}) => dialog.popup(h.div.class(cn("bg-popover text-popover-foreground pointer-events-auto relative flex max-h-full w-full max-w-[440px] flex-col gap-4 rounded-lg border p-6 text-sm shadow-lg outline-none", "transition-[opacity,scale,translate,filter] duration-200 ease-out data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[nested-dialog-open]:-translate-y-[calc(14px*var(--nested-dialogs))] data-[nested-dialog-open]:scale-[calc(1-0.05*var(--nested-dialogs))] data-[nested-dialog-open]:brightness-95", options.class)));
|
|
39
38
|
var DialogTitle = (h, dialog, options = {}) => dialog.title(h.h2.class(cn("m-0 border-0 p-0 text-[16px] leading-snug font-semibold tracking-tight", options.class)));
|
|
40
39
|
|
|
41
|
-
// ../../src/
|
|
42
|
-
import {
|
|
43
|
-
ArrowDown as arrowDown,
|
|
44
|
-
ArrowUp as arrowUp,
|
|
45
|
-
ListFilter as listFilter,
|
|
46
|
-
Check as check,
|
|
47
|
-
ChevronLeft as chevronLeft,
|
|
48
|
-
ChevronDown as chevronDown,
|
|
49
|
-
ChevronRight as chevronRight,
|
|
50
|
-
ChevronsLeft as chevronsLeft,
|
|
51
|
-
ChevronsRight as chevronsRight,
|
|
52
|
-
ChevronsUpDown as chevronsUpDown,
|
|
53
|
-
Copy as copy,
|
|
54
|
-
Download as download,
|
|
55
|
-
Eye as eye,
|
|
56
|
-
EyeOff as eyeOff,
|
|
57
|
-
Ellipsis as ellipsis,
|
|
58
|
-
FileJson as fileJson,
|
|
59
|
-
FileText as fileText,
|
|
60
|
-
GripVertical as gripVertical,
|
|
61
|
-
Image as image,
|
|
62
|
-
LayoutGrid as layoutGrid,
|
|
63
|
-
LoaderCircle as loaderCircle,
|
|
64
|
-
Mail as mail,
|
|
65
|
-
Paperclip as paperclip,
|
|
66
|
-
RefreshCw as refreshCw,
|
|
67
|
-
RotateCcw as rotateCcw,
|
|
68
|
-
Rows3 as rows3,
|
|
69
|
-
Search as search,
|
|
70
|
-
Settings2 as settings2,
|
|
71
|
-
TriangleAlert as triangleAlert,
|
|
72
|
-
X as x
|
|
73
|
-
} from "lucide";
|
|
74
|
-
var createLucideIcon = (icon) => (h, {
|
|
75
|
-
size = 24,
|
|
76
|
-
color = "currentColor",
|
|
77
|
-
strokeWidth = 2,
|
|
78
|
-
className
|
|
79
|
-
} = {}) => h.svg.attrs({
|
|
80
|
-
class: className,
|
|
81
|
-
width: String(size),
|
|
82
|
-
height: String(size),
|
|
83
|
-
viewBox: "0 0 24 24",
|
|
84
|
-
fill: "none",
|
|
85
|
-
stroke: color,
|
|
86
|
-
"stroke-width": String(strokeWidth),
|
|
87
|
-
"stroke-linecap": "round",
|
|
88
|
-
"stroke-linejoin": "round",
|
|
89
|
-
"aria-hidden": "true"
|
|
90
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
91
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
92
|
-
switch (tag) {
|
|
93
|
-
case "path":
|
|
94
|
-
return h.path.attrs(attrs);
|
|
95
|
-
case "circle":
|
|
96
|
-
return h.circle.attrs(attrs);
|
|
97
|
-
case "ellipse":
|
|
98
|
-
return h.ellipse.attrs(attrs);
|
|
99
|
-
case "line":
|
|
100
|
-
return h.line.attrs(attrs);
|
|
101
|
-
case "polyline":
|
|
102
|
-
return h.polyline.attrs(attrs);
|
|
103
|
-
case "polygon":
|
|
104
|
-
return h.polygon.attrs(attrs);
|
|
105
|
-
case "rect":
|
|
106
|
-
return h.rect.attrs(attrs);
|
|
107
|
-
default:
|
|
108
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
109
|
-
}
|
|
110
|
-
}));
|
|
111
|
-
var Check = createLucideIcon(check);
|
|
112
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
113
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
114
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
115
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
116
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
117
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
118
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
119
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
120
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
121
|
-
var Copy = createLucideIcon(copy);
|
|
122
|
-
var Download = createLucideIcon(download);
|
|
123
|
-
var Eye = createLucideIcon(eye);
|
|
124
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
125
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
126
|
-
var FileJson = createLucideIcon(fileJson);
|
|
127
|
-
var FileText = createLucideIcon(fileText);
|
|
128
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
129
|
-
var Image = createLucideIcon(image);
|
|
130
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
131
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
132
|
-
var Mail = createLucideIcon(mail);
|
|
133
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
134
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
135
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
136
|
-
var Rows3 = createLucideIcon(rows3);
|
|
137
|
-
var Search = createLucideIcon(search);
|
|
138
|
-
var Settings2 = createLucideIcon(settings2);
|
|
139
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
140
|
-
var X = createLucideIcon(x);
|
|
40
|
+
// ../../src/components/sidebar-layout/html.ts
|
|
41
|
+
import { PanelLeft as PanelIcon, createLucideIcon } from "@krak-stack/registry/lucide-effect";
|
|
141
42
|
|
|
142
43
|
// ../../src/components/sidebar-layout/classes.ts
|
|
143
44
|
var sidebarLayoutClasses = {
|
|
@@ -244,7 +145,6 @@ var sidebarLayoutBehaviours = {
|
|
|
244
145
|
};
|
|
245
146
|
|
|
246
147
|
// ../../src/components/sidebar-layout/html.ts
|
|
247
|
-
var PanelIcon = createLucideIcon(PanelLeft);
|
|
248
148
|
var badges = {
|
|
249
149
|
default: "bg-primary text-primary-foreground",
|
|
250
150
|
secondary: "bg-secondary text-secondary-foreground",
|
|
@@ -1,161 +1,7 @@
|
|
|
1
1
|
// ../../src/components/sidebar-layout/react.tsx
|
|
2
2
|
import { Link, Outlet } from "@tanstack/react-router";
|
|
3
|
-
import { Component as Component2, View
|
|
4
|
-
|
|
5
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
6
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
7
|
-
import {
|
|
8
|
-
createContext,
|
|
9
|
-
useCallback,
|
|
10
|
-
useContext,
|
|
11
|
-
useEffect,
|
|
12
|
-
useLayoutEffect,
|
|
13
|
-
useRef,
|
|
14
|
-
useState,
|
|
15
|
-
useSyncExternalStore
|
|
16
|
-
} from "react";
|
|
17
|
-
|
|
18
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
19
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
20
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
21
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
22
|
-
var node = () => ({ children: [] });
|
|
23
|
-
var modelHost = (commit) => {
|
|
24
|
-
const remove = (child) => {
|
|
25
|
-
if (!child.parent)
|
|
26
|
-
return;
|
|
27
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
28
|
-
delete child.parent;
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
createElement: node,
|
|
32
|
-
createText: node,
|
|
33
|
-
setText: () => {},
|
|
34
|
-
setAttr: () => {},
|
|
35
|
-
setProp: () => {},
|
|
36
|
-
setEvents: () => {},
|
|
37
|
-
insertBefore: (parent, child, before) => {
|
|
38
|
-
if (child === before)
|
|
39
|
-
return;
|
|
40
|
-
remove(child);
|
|
41
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
42
|
-
parent.children.splice(index, 0, child);
|
|
43
|
-
child.parent = parent;
|
|
44
|
-
},
|
|
45
|
-
remove,
|
|
46
|
-
parentOf: (child) => child.parent,
|
|
47
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
48
|
-
elements: ["html"],
|
|
49
|
-
controlled: new Set,
|
|
50
|
-
runsMounts: false,
|
|
51
|
-
commit
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
55
|
-
let currentProps = props;
|
|
56
|
-
let root;
|
|
57
|
-
let active = true;
|
|
58
|
-
let failure;
|
|
59
|
-
const publish = () => {
|
|
60
|
-
if (!active)
|
|
61
|
-
return;
|
|
62
|
-
if (failure) {
|
|
63
|
-
publishSnapshot({ error: failure });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const current = root?.model();
|
|
67
|
-
if (current !== undefined)
|
|
68
|
-
publishSnapshot({ model: current });
|
|
69
|
-
};
|
|
70
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
71
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
72
|
-
head: false,
|
|
73
|
-
onEmit,
|
|
74
|
-
fallback: ({ cause }) => {
|
|
75
|
-
failure = new Error("Effect UI root failed", {
|
|
76
|
-
cause: Cause.squash(cause)
|
|
77
|
-
});
|
|
78
|
-
return View.text("");
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
if (!active)
|
|
82
|
-
return;
|
|
83
|
-
root = mounted;
|
|
84
|
-
if (props !== currentProps)
|
|
85
|
-
mounted.setProps(currentProps);
|
|
86
|
-
publish();
|
|
87
|
-
return yield* Effect.never;
|
|
88
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
89
|
-
return {
|
|
90
|
-
send: (message) => {
|
|
91
|
-
root?.send(message);
|
|
92
|
-
publish();
|
|
93
|
-
},
|
|
94
|
-
setProps: (next) => {
|
|
95
|
-
currentProps = next;
|
|
96
|
-
root?.setProps(next);
|
|
97
|
-
},
|
|
98
|
-
dispose: () => {
|
|
99
|
-
active = false;
|
|
100
|
-
root = undefined;
|
|
101
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
107
|
-
"use client";
|
|
108
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
109
|
-
var useModel = (component, props, options = {}) => {
|
|
110
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
111
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
112
|
-
const [store] = useState(() => {
|
|
113
|
-
const initial = { model: component.init(props).model };
|
|
114
|
-
let snapshot = initial;
|
|
115
|
-
const listeners = new Set;
|
|
116
|
-
return {
|
|
117
|
-
subscribe: (listener) => {
|
|
118
|
-
listeners.add(listener);
|
|
119
|
-
return () => {
|
|
120
|
-
listeners.delete(listener);
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
getSnapshot: () => snapshot,
|
|
124
|
-
getServerSnapshot: () => initial,
|
|
125
|
-
publish: (next) => {
|
|
126
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
127
|
-
return;
|
|
128
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
129
|
-
return;
|
|
130
|
-
snapshot = next;
|
|
131
|
-
listeners.forEach((listener) => listener());
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
136
|
-
const committed = useRef(props);
|
|
137
|
-
const onEmit = useRef(options.onEmit);
|
|
138
|
-
const runtime = useRef(undefined);
|
|
139
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
140
|
-
useLayoutEffect(() => {
|
|
141
|
-
onEmit.current = options.onEmit;
|
|
142
|
-
committed.current = props;
|
|
143
|
-
runtime.current?.setProps(props);
|
|
144
|
-
}, [props, options.onEmit]);
|
|
145
|
-
useEffect(() => {
|
|
146
|
-
if (messageLog === null)
|
|
147
|
-
return;
|
|
148
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
149
|
-
runtime.current = mounted;
|
|
150
|
-
return () => {
|
|
151
|
-
runtime.current = undefined;
|
|
152
|
-
mounted.dispose();
|
|
153
|
-
};
|
|
154
|
-
}, [component, messageLog, store]);
|
|
155
|
-
if ("error" in snapshot)
|
|
156
|
-
throw snapshot.error;
|
|
157
|
-
return { model: snapshot.model, send };
|
|
158
|
-
};
|
|
3
|
+
import { Component as Component2, View } from "effect/ui";
|
|
4
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
159
5
|
|
|
160
6
|
// ../../src/components/ui/badge.tsx
|
|
161
7
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
@@ -878,7 +724,7 @@ var sidebarLayoutBehaviours = {
|
|
|
878
724
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
879
725
|
var SidebarModel = Component2.define(sidebarLayoutOptions).make({
|
|
880
726
|
...sidebarLayoutBehaviours,
|
|
881
|
-
view: () =>
|
|
727
|
+
view: () => View.text("")
|
|
882
728
|
});
|
|
883
729
|
var useSidebarLayout = () => {
|
|
884
730
|
const { isMobile } = useSidebar();
|
|
@@ -2,109 +2,12 @@
|
|
|
2
2
|
import { Effect, Schema as Schema3, Stream } from "effect";
|
|
3
3
|
import { Component as Component2, Mount, View } from "effect/ui";
|
|
4
4
|
import { Html } from "effect/ui/html";
|
|
5
|
-
import { CircleAlert } from "lucide";
|
|
6
5
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
7
|
-
|
|
8
|
-
// ../../src/lib/lucide-effect.ts
|
|
9
6
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ChevronLeft as chevronLeft,
|
|
15
|
-
ChevronDown as chevronDown,
|
|
16
|
-
ChevronRight as chevronRight,
|
|
17
|
-
ChevronsLeft as chevronsLeft,
|
|
18
|
-
ChevronsRight as chevronsRight,
|
|
19
|
-
ChevronsUpDown as chevronsUpDown,
|
|
20
|
-
Copy as copy,
|
|
21
|
-
Download as download,
|
|
22
|
-
Eye as eye,
|
|
23
|
-
EyeOff as eyeOff,
|
|
24
|
-
Ellipsis as ellipsis,
|
|
25
|
-
FileJson as fileJson,
|
|
26
|
-
FileText as fileText,
|
|
27
|
-
GripVertical as gripVertical,
|
|
28
|
-
Image as image,
|
|
29
|
-
LayoutGrid as layoutGrid,
|
|
30
|
-
LoaderCircle as loaderCircle,
|
|
31
|
-
Mail as mail,
|
|
32
|
-
Paperclip as paperclip,
|
|
33
|
-
RefreshCw as refreshCw,
|
|
34
|
-
RotateCcw as rotateCcw,
|
|
35
|
-
Rows3 as rows3,
|
|
36
|
-
Search as search,
|
|
37
|
-
Settings2 as settings2,
|
|
38
|
-
TriangleAlert as triangleAlert,
|
|
39
|
-
X as x
|
|
40
|
-
} from "lucide";
|
|
41
|
-
var createLucideIcon = (icon) => (h, {
|
|
42
|
-
size = 24,
|
|
43
|
-
color = "currentColor",
|
|
44
|
-
strokeWidth = 2,
|
|
45
|
-
className
|
|
46
|
-
} = {}) => h.svg.attrs({
|
|
47
|
-
class: className,
|
|
48
|
-
width: String(size),
|
|
49
|
-
height: String(size),
|
|
50
|
-
viewBox: "0 0 24 24",
|
|
51
|
-
fill: "none",
|
|
52
|
-
stroke: color,
|
|
53
|
-
"stroke-width": String(strokeWidth),
|
|
54
|
-
"stroke-linecap": "round",
|
|
55
|
-
"stroke-linejoin": "round",
|
|
56
|
-
"aria-hidden": "true"
|
|
57
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
58
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
59
|
-
switch (tag) {
|
|
60
|
-
case "path":
|
|
61
|
-
return h.path.attrs(attrs);
|
|
62
|
-
case "circle":
|
|
63
|
-
return h.circle.attrs(attrs);
|
|
64
|
-
case "ellipse":
|
|
65
|
-
return h.ellipse.attrs(attrs);
|
|
66
|
-
case "line":
|
|
67
|
-
return h.line.attrs(attrs);
|
|
68
|
-
case "polyline":
|
|
69
|
-
return h.polyline.attrs(attrs);
|
|
70
|
-
case "polygon":
|
|
71
|
-
return h.polygon.attrs(attrs);
|
|
72
|
-
case "rect":
|
|
73
|
-
return h.rect.attrs(attrs);
|
|
74
|
-
default:
|
|
75
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
var Check = createLucideIcon(check);
|
|
79
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
80
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
81
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
82
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
83
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
84
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
85
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
86
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
87
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
88
|
-
var Copy = createLucideIcon(copy);
|
|
89
|
-
var Download = createLucideIcon(download);
|
|
90
|
-
var Eye = createLucideIcon(eye);
|
|
91
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
92
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
93
|
-
var FileJson = createLucideIcon(fileJson);
|
|
94
|
-
var FileText = createLucideIcon(fileText);
|
|
95
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
96
|
-
var Image = createLucideIcon(image);
|
|
97
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
98
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
99
|
-
var Mail = createLucideIcon(mail);
|
|
100
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
101
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
102
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
103
|
-
var Rows3 = createLucideIcon(rows3);
|
|
104
|
-
var Search = createLucideIcon(search);
|
|
105
|
-
var Settings2 = createLucideIcon(settings2);
|
|
106
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
107
|
-
var X = createLucideIcon(x);
|
|
7
|
+
Check,
|
|
8
|
+
CircleAlert as ErrorIcon,
|
|
9
|
+
createLucideIcon
|
|
10
|
+
} from "@krak-stack/registry/lucide-effect";
|
|
108
11
|
|
|
109
12
|
// ../../src/lib/utils.ts
|
|
110
13
|
import { cn } from "cn";
|
|
@@ -227,7 +130,6 @@ var stepperBehaviours = {
|
|
|
227
130
|
};
|
|
228
131
|
|
|
229
132
|
// ../../src/components/stepper/html.ts
|
|
230
|
-
var ErrorIcon = createLucideIcon(CircleAlert);
|
|
231
133
|
var IconNode = Schema3.mutable(Schema3.Array(Schema3.mutable(Schema3.Tuple([
|
|
232
134
|
Schema3.String,
|
|
233
135
|
Schema3.Record(Schema3.String, Schema3.UndefinedOr(Schema3.Union([Schema3.String, Schema3.Number])))
|