@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
|
@@ -4,8 +4,8 @@ import { Popover } from "@base-ui/react/popover";
|
|
|
4
4
|
import {
|
|
5
5
|
useId as useId3,
|
|
6
6
|
useMemo,
|
|
7
|
-
useRef as
|
|
8
|
-
useState as
|
|
7
|
+
useRef as useRef3,
|
|
8
|
+
useState as useState4
|
|
9
9
|
} from "react";
|
|
10
10
|
import {
|
|
11
11
|
Type,
|
|
@@ -242,14 +242,14 @@ function PopoverTitle({ className, ...props }) {
|
|
|
242
242
|
|
|
243
243
|
// ../../src/components/animated-list/react.tsx
|
|
244
244
|
import {
|
|
245
|
-
useEffect as
|
|
245
|
+
useEffect as useEffect2,
|
|
246
246
|
useEffectEvent as useEffectEvent2,
|
|
247
247
|
useId,
|
|
248
|
-
useRef as
|
|
249
|
-
useState as
|
|
248
|
+
useRef as useRef2,
|
|
249
|
+
useState as useState2
|
|
250
250
|
} from "react";
|
|
251
251
|
import { GripVertical } from "lucide-react";
|
|
252
|
-
import { Component as Component2, View
|
|
252
|
+
import { Component as Component2, View } from "effect/ui";
|
|
253
253
|
import { cn as cn2 } from "cn";
|
|
254
254
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
255
255
|
|
|
@@ -450,160 +450,8 @@ var useVerticalDrag = ({
|
|
|
450
450
|
};
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
-
// ../../src/
|
|
454
|
-
import {
|
|
455
|
-
import {
|
|
456
|
-
createContext,
|
|
457
|
-
useCallback,
|
|
458
|
-
useContext,
|
|
459
|
-
useEffect as useEffect2,
|
|
460
|
-
useLayoutEffect as useLayoutEffect2,
|
|
461
|
-
useRef as useRef2,
|
|
462
|
-
useState as useState2,
|
|
463
|
-
useSyncExternalStore as useSyncExternalStore2
|
|
464
|
-
} from "react";
|
|
465
|
-
|
|
466
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
467
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
468
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
469
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
470
|
-
var node = () => ({ children: [] });
|
|
471
|
-
var modelHost = (commit) => {
|
|
472
|
-
const remove = (child) => {
|
|
473
|
-
if (!child.parent)
|
|
474
|
-
return;
|
|
475
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
476
|
-
delete child.parent;
|
|
477
|
-
};
|
|
478
|
-
return {
|
|
479
|
-
createElement: node,
|
|
480
|
-
createText: node,
|
|
481
|
-
setText: () => {},
|
|
482
|
-
setAttr: () => {},
|
|
483
|
-
setProp: () => {},
|
|
484
|
-
setEvents: () => {},
|
|
485
|
-
insertBefore: (parent, child, before) => {
|
|
486
|
-
if (child === before)
|
|
487
|
-
return;
|
|
488
|
-
remove(child);
|
|
489
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
490
|
-
parent.children.splice(index, 0, child);
|
|
491
|
-
child.parent = parent;
|
|
492
|
-
},
|
|
493
|
-
remove,
|
|
494
|
-
parentOf: (child) => child.parent,
|
|
495
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
496
|
-
elements: ["html"],
|
|
497
|
-
controlled: new Set,
|
|
498
|
-
runsMounts: false,
|
|
499
|
-
commit
|
|
500
|
-
};
|
|
501
|
-
};
|
|
502
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
503
|
-
let currentProps = props;
|
|
504
|
-
let root;
|
|
505
|
-
let active = true;
|
|
506
|
-
let failure;
|
|
507
|
-
const publish = () => {
|
|
508
|
-
if (!active)
|
|
509
|
-
return;
|
|
510
|
-
if (failure) {
|
|
511
|
-
publishSnapshot({ error: failure });
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
const current = root?.model();
|
|
515
|
-
if (current !== undefined)
|
|
516
|
-
publishSnapshot({ model: current });
|
|
517
|
-
};
|
|
518
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
519
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
520
|
-
head: false,
|
|
521
|
-
onEmit,
|
|
522
|
-
fallback: ({ cause }) => {
|
|
523
|
-
failure = new Error("Effect UI root failed", {
|
|
524
|
-
cause: Cause.squash(cause)
|
|
525
|
-
});
|
|
526
|
-
return View.text("");
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
if (!active)
|
|
530
|
-
return;
|
|
531
|
-
root = mounted;
|
|
532
|
-
if (props !== currentProps)
|
|
533
|
-
mounted.setProps(currentProps);
|
|
534
|
-
publish();
|
|
535
|
-
return yield* Effect.never;
|
|
536
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
537
|
-
return {
|
|
538
|
-
send: (message) => {
|
|
539
|
-
root?.send(message);
|
|
540
|
-
publish();
|
|
541
|
-
},
|
|
542
|
-
setProps: (next) => {
|
|
543
|
-
currentProps = next;
|
|
544
|
-
root?.setProps(next);
|
|
545
|
-
},
|
|
546
|
-
dispose: () => {
|
|
547
|
-
active = false;
|
|
548
|
-
root = undefined;
|
|
549
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
555
|
-
"use client";
|
|
556
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
557
|
-
var useModel = (component, props, options = {}) => {
|
|
558
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
559
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
560
|
-
const [store] = useState2(() => {
|
|
561
|
-
const initial = { model: component.init(props).model };
|
|
562
|
-
let snapshot = initial;
|
|
563
|
-
const listeners = new Set;
|
|
564
|
-
return {
|
|
565
|
-
subscribe: (listener) => {
|
|
566
|
-
listeners.add(listener);
|
|
567
|
-
return () => {
|
|
568
|
-
listeners.delete(listener);
|
|
569
|
-
};
|
|
570
|
-
},
|
|
571
|
-
getSnapshot: () => snapshot,
|
|
572
|
-
getServerSnapshot: () => initial,
|
|
573
|
-
publish: (next) => {
|
|
574
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
575
|
-
return;
|
|
576
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
577
|
-
return;
|
|
578
|
-
snapshot = next;
|
|
579
|
-
listeners.forEach((listener) => listener());
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
});
|
|
583
|
-
const snapshot = useSyncExternalStore2(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
584
|
-
const committed = useRef2(props);
|
|
585
|
-
const onEmit = useRef2(options.onEmit);
|
|
586
|
-
const runtime = useRef2(undefined);
|
|
587
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
588
|
-
useLayoutEffect2(() => {
|
|
589
|
-
onEmit.current = options.onEmit;
|
|
590
|
-
committed.current = props;
|
|
591
|
-
runtime.current?.setProps(props);
|
|
592
|
-
}, [props, options.onEmit]);
|
|
593
|
-
useEffect2(() => {
|
|
594
|
-
if (messageLog === null)
|
|
595
|
-
return;
|
|
596
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
597
|
-
runtime.current = mounted;
|
|
598
|
-
return () => {
|
|
599
|
-
runtime.current = undefined;
|
|
600
|
-
mounted.dispose();
|
|
601
|
-
};
|
|
602
|
-
}, [component, messageLog, store]);
|
|
603
|
-
if ("error" in snapshot)
|
|
604
|
-
throw snapshot.error;
|
|
605
|
-
return { model: snapshot.model, send };
|
|
606
|
-
};
|
|
453
|
+
// ../../src/components/animated-list/react.tsx
|
|
454
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
607
455
|
|
|
608
456
|
// ../../src/components/animated-list/classes.ts
|
|
609
457
|
var animatedListClasses = {
|
|
@@ -758,7 +606,7 @@ var animatedListBehaviours = {
|
|
|
758
606
|
import { jsx as jsx5, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
759
607
|
var Model = Component2.define(animatedListOptions).make({
|
|
760
608
|
...animatedListBehaviours,
|
|
761
|
-
view: () =>
|
|
609
|
+
view: () => View.text("")
|
|
762
610
|
});
|
|
763
611
|
var AnimatedList = ({
|
|
764
612
|
classes: classOverrides,
|
|
@@ -779,7 +627,7 @@ var AnimatedList = ({
|
|
|
779
627
|
const locale = useKrakstackLocale(override);
|
|
780
628
|
const copy = animatedListCopy(locale, messages);
|
|
781
629
|
const instructions = useId();
|
|
782
|
-
const container =
|
|
630
|
+
const container = useRef2(null);
|
|
783
631
|
const descriptors = items.map((item) => ({
|
|
784
632
|
key: getKey(item),
|
|
785
633
|
label: getItemLabel?.(item)
|
|
@@ -790,7 +638,7 @@ var AnimatedList = ({
|
|
|
790
638
|
});
|
|
791
639
|
const retained = retainedRows(descriptors, model.rows);
|
|
792
640
|
const current = new Map(items.map((item) => [getKey(item), { item }]));
|
|
793
|
-
const [previous, setPrevious] =
|
|
641
|
+
const [previous, setPrevious] = useState2(() => ({
|
|
794
642
|
items,
|
|
795
643
|
rows: model.rows,
|
|
796
644
|
rendered: current
|
|
@@ -802,8 +650,8 @@ var AnimatedList = ({
|
|
|
802
650
|
if (previous.items !== items || previous.rows !== model.rows) {
|
|
803
651
|
setPrevious({ items, rows: model.rows, rendered });
|
|
804
652
|
}
|
|
805
|
-
const committed =
|
|
806
|
-
|
|
653
|
+
const committed = useRef2(false);
|
|
654
|
+
useEffect2(() => {
|
|
807
655
|
committed.current = true;
|
|
808
656
|
}, []);
|
|
809
657
|
useListLayout(container, duration);
|
|
@@ -885,10 +733,10 @@ var ListItem = ({
|
|
|
885
733
|
onKeyMove,
|
|
886
734
|
children
|
|
887
735
|
}) => {
|
|
888
|
-
const ref =
|
|
889
|
-
const mounted =
|
|
890
|
-
const lastPresent =
|
|
891
|
-
const transitioning =
|
|
736
|
+
const ref = useRef2(null);
|
|
737
|
+
const mounted = useRef2(false);
|
|
738
|
+
const lastPresent = useRef2(present);
|
|
739
|
+
const transitioning = useRef2(false);
|
|
892
740
|
const exit = useEffectEvent2(onExit);
|
|
893
741
|
const reduced = useReducedMotion();
|
|
894
742
|
const drag = useVerticalDrag({
|
|
@@ -898,7 +746,7 @@ var ListItem = ({
|
|
|
898
746
|
overflow: dragOverflow,
|
|
899
747
|
onMove
|
|
900
748
|
});
|
|
901
|
-
|
|
749
|
+
useEffect2(() => {
|
|
902
750
|
const element = ref.current;
|
|
903
751
|
const first = !mounted.current;
|
|
904
752
|
mounted.current = true;
|
|
@@ -954,10 +802,10 @@ import { EditorContent, useEditor } from "@tiptap/react";
|
|
|
954
802
|
import { EditorState } from "@tiptap/pm/state";
|
|
955
803
|
import { closeHistory } from "@tiptap/pm/history";
|
|
956
804
|
import {
|
|
957
|
-
useEffect as
|
|
805
|
+
useEffect as useEffect3,
|
|
958
806
|
useEffectEvent as useEffectEvent3,
|
|
959
807
|
useId as useId2,
|
|
960
|
-
useState as
|
|
808
|
+
useState as useState3
|
|
961
809
|
} from "react";
|
|
962
810
|
import {
|
|
963
811
|
Bold,
|
|
@@ -1393,11 +1241,11 @@ var RichTextEditor = ({
|
|
|
1393
1241
|
...messages?.[locale.split("-")[0] ?? locale],
|
|
1394
1242
|
...messages?.[locale]
|
|
1395
1243
|
};
|
|
1396
|
-
const [error, setError] =
|
|
1397
|
-
const [linkOpen, setLinkOpen] =
|
|
1398
|
-
const [link, setLink] =
|
|
1399
|
-
const [linkError, setLinkError] =
|
|
1400
|
-
const [revision, setRevision] =
|
|
1244
|
+
const [error, setError] = useState3(false);
|
|
1245
|
+
const [linkOpen, setLinkOpen] = useState3(false);
|
|
1246
|
+
const [link, setLink] = useState3("");
|
|
1247
|
+
const [linkError, setLinkError] = useState3(false);
|
|
1248
|
+
const [revision, setRevision] = useState3(0);
|
|
1401
1249
|
const id = useId2();
|
|
1402
1250
|
const getMaxLength = useEffectEvent3(() => maxLength);
|
|
1403
1251
|
const getVariables = useEffectEvent3(() => variables);
|
|
@@ -1491,7 +1339,7 @@ var RichTextEditor = ({
|
|
|
1491
1339
|
editor.chain().insertContent({ type: "variable", attrs: { key } }).run();
|
|
1492
1340
|
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
1493
1341
|
};
|
|
1494
|
-
|
|
1342
|
+
useEffect3(() => {
|
|
1495
1343
|
if (!editor)
|
|
1496
1344
|
return;
|
|
1497
1345
|
const incoming = editor.schema.nodeFromJSON(toTiptapDocument(value, singleLine));
|
|
@@ -1504,12 +1352,12 @@ var RichTextEditor = ({
|
|
|
1504
1352
|
editor.view.dispatch(editor.state.tr.setMeta(externalReplacementMeta, true));
|
|
1505
1353
|
}
|
|
1506
1354
|
}, [editor, value, singleLine]);
|
|
1507
|
-
|
|
1355
|
+
useEffect3(() => {
|
|
1508
1356
|
if (!editor)
|
|
1509
1357
|
return;
|
|
1510
1358
|
editor.setEditable(!disabled, false);
|
|
1511
1359
|
}, [editor, disabled]);
|
|
1512
|
-
|
|
1360
|
+
useEffect3(() => {
|
|
1513
1361
|
if (!editor)
|
|
1514
1362
|
return;
|
|
1515
1363
|
for (const chip of editor.view.dom.querySelectorAll("[data-rich-variable]")) {
|
|
@@ -2395,12 +2243,12 @@ var EmailEditor = ({
|
|
|
2395
2243
|
const emailEditorClasses = resolveEmailEditorClasses(classOverrides);
|
|
2396
2244
|
const locale = useKrakstackLocale3(override);
|
|
2397
2245
|
const copy = emailEditorMessages(locale, messages);
|
|
2398
|
-
const [active, setActive] =
|
|
2246
|
+
const [active, setActive] = useState4(() => initialActive(value));
|
|
2399
2247
|
const selected = value.elements.find((element) => element.id === active);
|
|
2400
|
-
const [view, setView] =
|
|
2401
|
-
const canvas =
|
|
2402
|
-
const elementSurfaces =
|
|
2403
|
-
const [settingsOpen, setSettingsOpen] =
|
|
2248
|
+
const [view, setView] = useState4("design");
|
|
2249
|
+
const canvas = useRef3(null);
|
|
2250
|
+
const elementSurfaces = useRef3(new Map);
|
|
2251
|
+
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
2404
2252
|
const settingsAnchor = useMemo(() => settingsOpen ? {
|
|
2405
2253
|
get contextElement() {
|
|
2406
2254
|
return canvas.current ?? undefined;
|
|
@@ -2412,7 +2260,7 @@ var EmailEditor = ({
|
|
|
2412
2260
|
}
|
|
2413
2261
|
} : null, [active, settingsOpen]);
|
|
2414
2262
|
const id = useId3();
|
|
2415
|
-
const [insertOpen, setInsertOpen] =
|
|
2263
|
+
const [insertOpen, setInsertOpen] = useState4(false);
|
|
2416
2264
|
const update = (element) => {
|
|
2417
2265
|
if (!disabled)
|
|
2418
2266
|
onChange(replaceElement(value, element));
|
|
@@ -50,14 +50,14 @@ export declare const makeErrorComponent: (renderFeedback?: FeedbackView) => impo
|
|
|
50
50
|
readonly success: boolean;
|
|
51
51
|
} | null;
|
|
52
52
|
}, {
|
|
53
|
-
readonly _tag: "Retry";
|
|
54
|
-
} | {
|
|
55
53
|
readonly _tag: "Copied";
|
|
56
54
|
readonly report: Redacted.Redacted<string>;
|
|
57
55
|
readonly success: boolean;
|
|
58
56
|
} | {
|
|
59
57
|
readonly _tag: "Copy";
|
|
60
58
|
readonly report: Redacted.Redacted<string>;
|
|
59
|
+
} | {
|
|
60
|
+
readonly _tag: "Retry";
|
|
61
61
|
}, {
|
|
62
62
|
readonly _tag: "Retry";
|
|
63
63
|
}, never, Html.Elements, {}, never>;
|
|
@@ -106,14 +106,14 @@ export declare const ErrorComponent: import("effect/ui/Component").Component<"Er
|
|
|
106
106
|
readonly success: boolean;
|
|
107
107
|
} | null;
|
|
108
108
|
}, {
|
|
109
|
-
readonly _tag: "Retry";
|
|
110
|
-
} | {
|
|
111
109
|
readonly _tag: "Copied";
|
|
112
110
|
readonly report: Redacted.Redacted<string>;
|
|
113
111
|
readonly success: boolean;
|
|
114
112
|
} | {
|
|
115
113
|
readonly _tag: "Copy";
|
|
116
114
|
readonly report: Redacted.Redacted<string>;
|
|
115
|
+
} | {
|
|
116
|
+
readonly _tag: "Retry";
|
|
117
117
|
}, {
|
|
118
118
|
readonly _tag: "Retry";
|
|
119
119
|
}, never, Html.Elements, {}, never>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { Effect as Effect2, Redacted as Redacted2 } from "effect";
|
|
3
3
|
import { Mount } from "effect/ui";
|
|
4
4
|
import { Html } from "effect/ui/html";
|
|
5
|
-
import { CircleAlert, RefreshCw as RefreshCw2 } from "lucide";
|
|
6
5
|
|
|
7
6
|
// ../../src/components/effectcn/button.ts
|
|
8
7
|
import {
|
|
@@ -51,107 +50,13 @@ var inputVariants = (options = {}) => cn(base2, sizes2[options.size ?? "default"
|
|
|
51
50
|
|
|
52
51
|
// ../../src/components/error-component/html.ts
|
|
53
52
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
54
|
-
|
|
55
|
-
// ../../src/lib/lucide-effect.ts
|
|
56
53
|
import {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ChevronRight as chevronRight,
|
|
64
|
-
ChevronsLeft as chevronsLeft,
|
|
65
|
-
ChevronsRight as chevronsRight,
|
|
66
|
-
ChevronsUpDown as chevronsUpDown,
|
|
67
|
-
Copy as copy,
|
|
68
|
-
Download as download,
|
|
69
|
-
Eye as eye,
|
|
70
|
-
EyeOff as eyeOff,
|
|
71
|
-
Ellipsis as ellipsis,
|
|
72
|
-
FileJson as fileJson,
|
|
73
|
-
FileText as fileText,
|
|
74
|
-
GripVertical as gripVertical,
|
|
75
|
-
Image as image,
|
|
76
|
-
LayoutGrid as layoutGrid,
|
|
77
|
-
LoaderCircle as loaderCircle,
|
|
78
|
-
Mail as mail,
|
|
79
|
-
Paperclip as paperclip,
|
|
80
|
-
RefreshCw as refreshCw,
|
|
81
|
-
RotateCcw as rotateCcw,
|
|
82
|
-
Rows3 as rows3,
|
|
83
|
-
Search as search,
|
|
84
|
-
Settings2 as settings2,
|
|
85
|
-
TriangleAlert as triangleAlert,
|
|
86
|
-
X as x
|
|
87
|
-
} from "lucide";
|
|
88
|
-
var createLucideIcon = (icon) => (h, {
|
|
89
|
-
size = 24,
|
|
90
|
-
color = "currentColor",
|
|
91
|
-
strokeWidth = 2,
|
|
92
|
-
className
|
|
93
|
-
} = {}) => h.svg.attrs({
|
|
94
|
-
class: className,
|
|
95
|
-
width: String(size),
|
|
96
|
-
height: String(size),
|
|
97
|
-
viewBox: "0 0 24 24",
|
|
98
|
-
fill: "none",
|
|
99
|
-
stroke: color,
|
|
100
|
-
"stroke-width": String(strokeWidth),
|
|
101
|
-
"stroke-linecap": "round",
|
|
102
|
-
"stroke-linejoin": "round",
|
|
103
|
-
"aria-hidden": "true"
|
|
104
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
105
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
106
|
-
switch (tag) {
|
|
107
|
-
case "path":
|
|
108
|
-
return h.path.attrs(attrs);
|
|
109
|
-
case "circle":
|
|
110
|
-
return h.circle.attrs(attrs);
|
|
111
|
-
case "ellipse":
|
|
112
|
-
return h.ellipse.attrs(attrs);
|
|
113
|
-
case "line":
|
|
114
|
-
return h.line.attrs(attrs);
|
|
115
|
-
case "polyline":
|
|
116
|
-
return h.polyline.attrs(attrs);
|
|
117
|
-
case "polygon":
|
|
118
|
-
return h.polygon.attrs(attrs);
|
|
119
|
-
case "rect":
|
|
120
|
-
return h.rect.attrs(attrs);
|
|
121
|
-
default:
|
|
122
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
123
|
-
}
|
|
124
|
-
}));
|
|
125
|
-
var Check = createLucideIcon(check);
|
|
126
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
127
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
128
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
129
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
130
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
131
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
132
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
133
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
134
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
135
|
-
var Copy = createLucideIcon(copy);
|
|
136
|
-
var Download = createLucideIcon(download);
|
|
137
|
-
var Eye = createLucideIcon(eye);
|
|
138
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
139
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
140
|
-
var FileJson = createLucideIcon(fileJson);
|
|
141
|
-
var FileText = createLucideIcon(fileText);
|
|
142
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
143
|
-
var Image = createLucideIcon(image);
|
|
144
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
145
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
146
|
-
var Mail = createLucideIcon(mail);
|
|
147
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
148
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
149
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
150
|
-
var Rows3 = createLucideIcon(rows3);
|
|
151
|
-
var Search = createLucideIcon(search);
|
|
152
|
-
var Settings2 = createLucideIcon(settings2);
|
|
153
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
154
|
-
var X = createLucideIcon(x);
|
|
54
|
+
Check,
|
|
55
|
+
CircleAlert as AlertIcon,
|
|
56
|
+
Copy as Copy2,
|
|
57
|
+
RefreshCw as RetryIcon,
|
|
58
|
+
TriangleAlert
|
|
59
|
+
} from "@krak-stack/registry/lucide-effect";
|
|
155
60
|
|
|
156
61
|
// ../../src/components/error-component/classes.ts
|
|
157
62
|
var errorComponentClasses = {
|
|
@@ -168,7 +73,7 @@ import { Command, Component, UiSchema } from "effect/ui";
|
|
|
168
73
|
|
|
169
74
|
// ../../src/components/error-component/schema.ts
|
|
170
75
|
import { Schema, Struct } from "effect";
|
|
171
|
-
var
|
|
76
|
+
var Copy = {
|
|
172
77
|
title: Schema.String,
|
|
173
78
|
description: Schema.String,
|
|
174
79
|
retry: Schema.String,
|
|
@@ -186,8 +91,8 @@ var Copy2 = {
|
|
|
186
91
|
versionLabel: Schema.String,
|
|
187
92
|
referenceLabel: Schema.String
|
|
188
93
|
};
|
|
189
|
-
var Messages = Schema.Struct(
|
|
190
|
-
var Overrides = Schema.Record(Schema.Literals(Object.keys(
|
|
94
|
+
var Messages = Schema.Struct(Copy);
|
|
95
|
+
var Overrides = Schema.Record(Schema.Literals(Object.keys(Copy)), Schema.optionalKey(Schema.String));
|
|
191
96
|
var Translations = Schema.Record(Schema.String, Schema.UndefinedOr(Overrides));
|
|
192
97
|
var ErrorComponentClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(errorComponentClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "ErrorComponentClassesOverrides" });
|
|
193
98
|
var ErrorComponentSharedPropsSchema = Schema.Struct({
|
|
@@ -308,8 +213,6 @@ var errorComponentBehaviours = {
|
|
|
308
213
|
};
|
|
309
214
|
|
|
310
215
|
// ../../src/components/error-component/html.ts
|
|
311
|
-
var AlertIcon = createLucideIcon(CircleAlert);
|
|
312
|
-
var RetryIcon = createLucideIcon(RefreshCw2);
|
|
313
216
|
var SelectReportOnFocus = Mount.make("ErrorComponent/SelectReportOnFocus", {}, (node) => {
|
|
314
217
|
const select = () => node.select();
|
|
315
218
|
return Effect2.acquireRelease(Effect2.sync(() => node.addEventListener("focus", select)), () => Effect2.sync(() => node.removeEventListener("focus", select))).pipe(Effect2.andThen(Effect2.never));
|
|
@@ -332,7 +235,7 @@ var makeErrorComponent = (renderFeedback) => Html.component({
|
|
|
332
235
|
props: { type: "button" },
|
|
333
236
|
variant: "link",
|
|
334
237
|
onPress: ErrorComponentMessage.Copy({ report: Redacted2.make(report) })
|
|
335
|
-
}).children(current?.success ? Check(h, { size: 16 }) : current?.success === false ? TriangleAlert(h, { size: 16 }) :
|
|
238
|
+
}).children(current?.success ? Check(h, { size: 16 }) : current?.success === false ? TriangleAlert(h, { size: 16 }) : Copy2(h, { size: 16 }), copy.copy), h.p.attr("role", "status").class(current?.success === false ? "text-sm" : "sr-only").children(current ? current.success ? copy.copied : copy.copyFailed : ""), current?.success === false && h.textarea.class(inputVariants({ class: "h-auto min-h-16 py-2" })).onMount(SelectReportOnFocus({})).attrs({
|
|
336
239
|
"aria-label": copy.details,
|
|
337
240
|
readonly: "",
|
|
338
241
|
rows: "10"
|