@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.
Files changed (76) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +22 -0
  3. package/dist/components/agent/react.js +29 -183
  4. package/dist/components/animated-list/html.js +1 -105
  5. package/dist/components/animated-list/react.js +16 -168
  6. package/dist/components/animated-number/react.js +8 -162
  7. package/dist/components/app-switcher/html.js +1 -103
  8. package/dist/components/async-action-button/html.js +1 -101
  9. package/dist/components/async-action-button/react.js +10 -164
  10. package/dist/components/audit-log-table/react.js +59 -213
  11. package/dist/components/bulk-list-input/html.js +2 -102
  12. package/dist/components/choice-cards/html.js +1 -101
  13. package/dist/components/code-block/html.js +1 -101
  14. package/dist/components/code-block/react.js +10 -164
  15. package/dist/components/copy-button/html.d.ts +2 -2
  16. package/dist/components/copy-button/html.js +1 -101
  17. package/dist/components/copy-button/react.js +10 -164
  18. package/dist/components/copy-value/html.js +6 -105
  19. package/dist/components/copy-value/react.js +20 -172
  20. package/dist/components/danger-confirmation/react.js +13 -167
  21. package/dist/components/data-table/html.d.ts +51 -51
  22. package/dist/components/data-table/html.js +28 -101
  23. package/dist/components/data-table/react.js +59 -213
  24. package/dist/components/date-input/html.js +2 -105
  25. package/dist/components/editable-text/html.d.ts +2 -2
  26. package/dist/components/editable-text/html.js +4 -102
  27. package/dist/components/editable-text/react.js +14 -168
  28. package/dist/components/editing-locale-switcher/html.js +2 -102
  29. package/dist/components/email-composer/react.js +25 -174
  30. package/dist/components/email-editor/html.js +8 -107
  31. package/dist/components/email-editor/react.js +34 -186
  32. package/dist/components/error-component/html.d.ts +4 -4
  33. package/dist/components/error-component/html.js +10 -107
  34. package/dist/components/error-component/react.js +15 -169
  35. package/dist/components/file-input/html.js +6 -106
  36. package/dist/components/icon-input/html.js +3 -103
  37. package/dist/components/icon-input/react.js +7 -161
  38. package/dist/components/image-crop-editor/html.js +1 -101
  39. package/dist/components/image-crop-editor/react.js +19 -173
  40. package/dist/components/loading/html.js +1 -101
  41. package/dist/components/locale-switcher/html.js +1 -103
  42. package/dist/components/map-menu/html.d.ts +8 -8
  43. package/dist/components/map-menu/html.js +7 -106
  44. package/dist/components/markdown/html.js +1 -101
  45. package/dist/components/markdown/react.js +10 -164
  46. package/dist/components/notification-menu/html.js +7 -114
  47. package/dist/components/pagination/html.js +5 -100
  48. package/dist/components/presence-transition/react.js +9 -163
  49. package/dist/components/registry-previews/component-example.js +10 -164
  50. package/dist/components/rich-text-editor/html.js +14 -108
  51. package/dist/components/rich-text-editor/react.js +9 -161
  52. package/dist/components/search-menu/html.js +1 -103
  53. package/dist/components/search-menu/react.js +11 -165
  54. package/dist/components/sidebar-layout/html.js +2 -102
  55. package/dist/components/sidebar-layout/react.js +3 -157
  56. package/dist/components/stepper/html.js +4 -102
  57. package/dist/components/support/html.js +1 -101
  58. package/dist/components/support/react.js +14 -168
  59. package/dist/components/theme-switcher/html.js +4 -105
  60. package/dist/components/time-input/html.d.ts +2 -2
  61. package/dist/components/time-input/html.js +1 -103
  62. package/dist/components/timezone-input/react.js +9 -163
  63. package/dist/components/toast/html.js +11 -104
  64. package/dist/components/upload-attachment/html.d.ts +4 -4
  65. package/dist/components/upload-attachment/html.js +7 -102
  66. package/dist/components/webhook-delivery-table/html.js +28 -101
  67. package/dist/components/webhook-delivery-table/react.js +74 -226
  68. package/dist/lib/docs.integrations.server.js +16 -35
  69. package/dist/lib/docs.js +31 -183
  70. package/dist/lib/docs.server.js +16 -35
  71. package/dist/lib/documentation-toolkit.js +19 -38
  72. package/dist/lib/effect-ui-adapter/use-model.js +158 -0
  73. package/dist/lib/lucide-effect.d.ts +2432 -0
  74. package/dist/lib/lucide-effect.js +7428 -0
  75. package/dist/services/agent/client/index.js +29 -183
  76. package/package.json +10 -2
@@ -1,13 +1,13 @@
1
1
  // ../../src/components/email-composer/react.tsx
2
- import { Effect as Effect3 } from "effect";
3
- import { useEffect as useEffect3, useEffectEvent as useEffectEvent2, useState as useState2 } from "react";
2
+ import { Effect as Effect2 } from "effect";
3
+ import { useEffect as useEffect2, useEffectEvent as useEffectEvent2, useState } from "react";
4
4
 
5
5
  // ../../src/components/rich-text-editor/react.tsx
6
6
  import { Schema as Schema6 } from "effect";
7
7
  import { EditorContent, useEditor } from "@tiptap/react";
8
8
  import { renderToReactElement } from "@tiptap/static-renderer/pm/react";
9
9
  import {
10
- useEffect as useEffect2,
10
+ useEffect,
11
11
  useEffectEvent,
12
12
  useId
13
13
  } from "react";
@@ -349,160 +349,8 @@ var richTextValidation = ({
349
349
  ]
350
350
  });
351
351
 
352
- // ../../src/lib/effect-ui-adapter/use-model.ts
353
- import { MessageLog as MessageLog2 } from "effect/ui";
354
- import {
355
- createContext,
356
- useCallback,
357
- useContext,
358
- useEffect,
359
- useLayoutEffect,
360
- useRef,
361
- useState,
362
- useSyncExternalStore
363
- } from "react";
364
-
365
- // ../../src/lib/effect-ui-adapter/model-runtime.ts
366
- import { MessageLog, Renderer, View } from "effect/ui";
367
- import { BrowserHost, Html } from "effect/ui/html";
368
- import { Cause, Effect, Fiber } from "effect";
369
- var node = () => ({ children: [] });
370
- var modelHost = (commit) => {
371
- const remove = (child) => {
372
- if (!child.parent)
373
- return;
374
- child.parent.children.splice(child.parent.children.indexOf(child), 1);
375
- delete child.parent;
376
- };
377
- return {
378
- createElement: node,
379
- createText: node,
380
- setText: () => {},
381
- setAttr: () => {},
382
- setProp: () => {},
383
- setEvents: () => {},
384
- insertBefore: (parent, child, before) => {
385
- if (child === before)
386
- return;
387
- remove(child);
388
- const index = before ? parent.children.indexOf(before) : parent.children.length;
389
- parent.children.splice(index, 0, child);
390
- child.parent = parent;
391
- },
392
- remove,
393
- parentOf: (child) => child.parent,
394
- nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
395
- elements: ["html"],
396
- controlled: new Set,
397
- runsMounts: false,
398
- commit
399
- };
400
- };
401
- var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
402
- let currentProps = props;
403
- let root;
404
- let active = true;
405
- let failure;
406
- const publish = () => {
407
- if (!active)
408
- return;
409
- if (failure) {
410
- publishSnapshot({ error: failure });
411
- return;
412
- }
413
- const current = root?.model();
414
- if (current !== undefined)
415
- publishSnapshot({ model: current });
416
- };
417
- const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
418
- const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
419
- head: false,
420
- onEmit,
421
- fallback: ({ cause }) => {
422
- failure = new Error("Effect UI root failed", {
423
- cause: Cause.squash(cause)
424
- });
425
- return View.text("");
426
- }
427
- });
428
- if (!active)
429
- return;
430
- root = mounted;
431
- if (props !== currentProps)
432
- mounted.setProps(currentProps);
433
- publish();
434
- return yield* Effect.never;
435
- }).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
436
- return {
437
- send: (message) => {
438
- root?.send(message);
439
- publish();
440
- },
441
- setProps: (next) => {
442
- currentProps = next;
443
- root?.setProps(next);
444
- },
445
- dispose: () => {
446
- active = false;
447
- root = undefined;
448
- Effect.runFork(Fiber.interrupt(fiber));
449
- }
450
- };
451
- };
452
-
453
- // ../../src/lib/effect-ui-adapter/use-model.ts
454
- "use client";
455
- var ModelMessageLogContext = createContext(undefined);
456
- var useModel = (component, props, options = {}) => {
457
- const contextLog = useContext(ModelMessageLogContext);
458
- const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
459
- const [store] = useState(() => {
460
- const initial = { model: component.init(props).model };
461
- let snapshot = initial;
462
- const listeners = new Set;
463
- return {
464
- subscribe: (listener) => {
465
- listeners.add(listener);
466
- return () => {
467
- listeners.delete(listener);
468
- };
469
- },
470
- getSnapshot: () => snapshot,
471
- getServerSnapshot: () => initial,
472
- publish: (next) => {
473
- if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
474
- return;
475
- if ("error" in snapshot && "error" in next && snapshot.error === next.error)
476
- return;
477
- snapshot = next;
478
- listeners.forEach((listener) => listener());
479
- }
480
- };
481
- });
482
- const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
483
- const committed = useRef(props);
484
- const onEmit = useRef(options.onEmit);
485
- const runtime = useRef(undefined);
486
- const send = useCallback((message) => runtime.current?.send(message), []);
487
- useLayoutEffect(() => {
488
- onEmit.current = options.onEmit;
489
- committed.current = props;
490
- runtime.current?.setProps(props);
491
- }, [props, options.onEmit]);
492
- useEffect(() => {
493
- if (messageLog === null)
494
- return;
495
- const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
496
- runtime.current = mounted;
497
- return () => {
498
- runtime.current = undefined;
499
- mounted.dispose();
500
- };
501
- }, [component, messageLog, store]);
502
- if ("error" in snapshot)
503
- throw snapshot.error;
504
- return { model: snapshot.model, send };
505
- };
352
+ // ../../src/components/rich-text-editor/react.tsx
353
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
506
354
 
507
355
  // ../../src/components/rich-text-editor/classes.ts
508
356
  var richTextEditorClasses = {
@@ -519,7 +367,7 @@ var resolveRichTextEditorClasses = (overrides) => ({
519
367
 
520
368
  // ../../src/components/rich-text-editor/index.ts
521
369
  import { Schema as Schema4 } from "effect";
522
- import { Component, UiSchema, View as View2 } from "effect/ui";
370
+ import { Component, UiSchema, View } from "effect/ui";
523
371
 
524
372
  // ../../src/components/rich-text-editor/schema.ts
525
373
  import { Schema as Schema3, Struct } from "effect";
@@ -749,7 +597,7 @@ var richTextEditorBehaviours = {
749
597
  };
750
598
  var RichTextEditorModel = Component.define(modelOptions).make({
751
599
  ...richTextEditorBehaviours,
752
- view: () => View2.text("")
600
+ view: () => View.text("")
753
601
  });
754
602
 
755
603
  // ../../src/components/rich-text-editor/engine.ts
@@ -932,15 +780,15 @@ var RichTextEditor = ({
932
780
  editor?.view.focus();
933
781
  return false;
934
782
  };
935
- useEffect2(() => {
783
+ useEffect(() => {
936
784
  if (!editor)
937
785
  return;
938
786
  replaceRichText(editor, value);
939
787
  }, [editor, value]);
940
- useEffect2(() => {
788
+ useEffect(() => {
941
789
  editor?.setEditable(!disabled, false);
942
790
  }, [editor, disabled]);
943
- useEffect2(() => {
791
+ useEffect(() => {
944
792
  if (!editor)
945
793
  return;
946
794
  refreshMentionLabels(editor, variables);
@@ -949,7 +797,7 @@ var RichTextEditor = ({
949
797
  if (editor)
950
798
  runEditorAction(editor, action, variables);
951
799
  });
952
- useEffect2(() => {
800
+ useEffect(() => {
953
801
  if (request)
954
802
  applyAction(request.action);
955
803
  }, [request]);
@@ -1163,7 +1011,7 @@ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/
1163
1011
  // ../../src/lib/email-composer/index.ts
1164
1012
  import { composeReactEmail, EmailNode } from "@react-email/editor/core";
1165
1013
  import { StarterKit as StarterKit2 } from "@react-email/editor/extensions";
1166
- import { Effect as Effect2, Schema as Schema8 } from "effect";
1014
+ import { Effect, Schema as Schema8 } from "effect";
1167
1015
 
1168
1016
  // ../../src/lib/email-composer/schema.ts
1169
1017
  import { Schema as Schema7 } from "effect";
@@ -1192,22 +1040,25 @@ var createEmailComposerExtensions = (resolveVariable = (key) => `{{${key}}}`) =>
1192
1040
  EmailNode.from(richTextMention(), ({ node }) => resolveVariable(Schema8.decodeUnknownSync(RichTextVariable.fields.key)(node.attrs?.id)))
1193
1041
  ];
1194
1042
  var emailComposerExtensions = createEmailComposerExtensions();
1195
- var exportEmail = Effect2.fn("EmailComposer.export")(function* ({
1043
+ var exportEmail = Effect.fn("EmailComposer.export")(function* ({
1196
1044
  editor
1197
1045
  }) {
1198
- const result = yield* Effect2.tryPromise({
1046
+ const result = yield* Effect.tryPromise({
1199
1047
  try: () => composeReactEmail({ editor, pretty: false }),
1200
1048
  catch: (cause) => new EmailComposerExportError({ cause })
1201
1049
  });
1202
1050
  return yield* Schema8.decodeEffect(EmailExport)({
1203
1051
  html: result.unformattedHtml,
1204
1052
  text: result.text
1205
- }).pipe(Effect2.mapError((cause) => new EmailComposerExportError({ cause })));
1053
+ }).pipe(Effect.mapError((cause) => new EmailComposerExportError({ cause })));
1206
1054
  });
1207
1055
 
1056
+ // ../../src/components/email-composer/react.tsx
1057
+ import { useModel as useModel2 } from "@krak-stack/registry/effect-ui-adapter/react";
1058
+
1208
1059
  // ../../src/components/email-composer/index.ts
1209
1060
  import { Schema as Schema10 } from "effect";
1210
- import { Component as Component2, UiSchema as UiSchema2, View as View3 } from "effect/ui";
1061
+ import { Component as Component2, UiSchema as UiSchema2, View as View2 } from "effect/ui";
1211
1062
 
1212
1063
  // ../../src/components/email-composer/schema.ts
1213
1064
  import { Schema as Schema9 } from "effect";
@@ -1275,7 +1126,7 @@ var emailComposerBehaviours = {
1275
1126
  };
1276
1127
  var EmailComposerModel = Component2.define(emailComposerOptions).make({
1277
1128
  ...emailComposerBehaviours,
1278
- view: () => View3.text("")
1129
+ view: () => View2.text("")
1279
1130
  });
1280
1131
  var emailComposerHtmlOptions = {
1281
1132
  ...emailComposerOptions,
@@ -1290,18 +1141,18 @@ var EmailComposer = ({
1290
1141
  }) => {
1291
1142
  const locale = useKrakstackLocale2(props.locale);
1292
1143
  const copy = emailComposerMessages(locale, previewMessages);
1293
- const [editor, setEditor] = useState2(null);
1144
+ const [editor, setEditor] = useState(null);
1294
1145
  const {
1295
1146
  model: { email, previewError },
1296
1147
  send
1297
- } = useModel(EmailComposerModel, props);
1148
+ } = useModel2(EmailComposerModel, props);
1298
1149
  const resolveVariable = useEffectEvent2((key) => resolveVariableSample(props.variables ?? [], key));
1299
- const [extensions] = useState2(() => createEmailComposerExtensions((key) => resolveVariable(key)));
1300
- useEffect3(() => {
1150
+ const [extensions] = useState(() => createEmailComposerExtensions((key) => resolveVariable(key)));
1151
+ useEffect2(() => {
1301
1152
  if (!editor || editor.isDestroyed)
1302
1153
  return;
1303
1154
  let current = true;
1304
- Effect3.runPromise(exportEmail({ editor }).pipe(Effect3.match({
1155
+ Effect2.runPromise(exportEmail({ editor }).pipe(Effect2.match({
1305
1156
  onFailure: () => {
1306
1157
  if (current)
1307
1158
  send(EmailComposerMessage.Failed());
@@ -57,110 +57,15 @@ var PopoverTitle = (h, popover, options = {}) => popover.title(h.h2.class(cn("m-
57
57
 
58
58
  // ../../src/components/email-editor/html.ts
59
59
  import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
60
-
61
- // ../../src/lib/lucide-effect.ts
62
60
  import {
63
- ArrowDown as arrowDown,
64
- ArrowUp as arrowUp,
65
- ListFilter as listFilter,
66
- Check as check,
67
- ChevronLeft as chevronLeft,
68
- ChevronDown as chevronDown,
69
- ChevronRight as chevronRight,
70
- ChevronsLeft as chevronsLeft,
71
- ChevronsRight as chevronsRight,
72
- ChevronsUpDown as chevronsUpDown,
73
- Copy as copy,
74
- Download as download,
75
- Eye as eye,
76
- EyeOff as eyeOff,
77
- Ellipsis as ellipsis,
78
- FileJson as fileJson,
79
- FileText as fileText,
80
- GripVertical as gripVertical,
81
- Image as image,
82
- LayoutGrid as layoutGrid,
83
- LoaderCircle as loaderCircle,
84
- Mail as mail,
85
- Paperclip as paperclip,
86
- RefreshCw as refreshCw,
87
- RotateCcw as rotateCcw,
88
- Rows3 as rows3,
89
- Search as search,
90
- Settings2 as settings2,
91
- TriangleAlert as triangleAlert,
92
- X as x
93
- } from "lucide";
94
- var createLucideIcon = (icon) => (h, {
95
- size = 24,
96
- color = "currentColor",
97
- strokeWidth = 2,
98
- className
99
- } = {}) => h.svg.attrs({
100
- class: className,
101
- width: String(size),
102
- height: String(size),
103
- viewBox: "0 0 24 24",
104
- fill: "none",
105
- stroke: color,
106
- "stroke-width": String(strokeWidth),
107
- "stroke-linecap": "round",
108
- "stroke-linejoin": "round",
109
- "aria-hidden": "true"
110
- }).children(...icon.map(([tag, attributes]) => {
111
- const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
112
- switch (tag) {
113
- case "path":
114
- return h.path.attrs(attrs);
115
- case "circle":
116
- return h.circle.attrs(attrs);
117
- case "ellipse":
118
- return h.ellipse.attrs(attrs);
119
- case "line":
120
- return h.line.attrs(attrs);
121
- case "polyline":
122
- return h.polyline.attrs(attrs);
123
- case "polygon":
124
- return h.polygon.attrs(attrs);
125
- case "rect":
126
- return h.rect.attrs(attrs);
127
- default:
128
- throw new Error(`Unsupported Lucide SVG element: ${tag}`);
129
- }
130
- }));
131
- var Check = createLucideIcon(check);
132
- var ArrowDown = createLucideIcon(arrowDown);
133
- var ArrowUp = createLucideIcon(arrowUp);
134
- var ListFilter = createLucideIcon(listFilter);
135
- var ChevronLeft = createLucideIcon(chevronLeft);
136
- var ChevronDown = createLucideIcon(chevronDown);
137
- var ChevronRight = createLucideIcon(chevronRight);
138
- var ChevronsLeft = createLucideIcon(chevronsLeft);
139
- var ChevronsRight = createLucideIcon(chevronsRight);
140
- var ChevronsUpDown = createLucideIcon(chevronsUpDown);
141
- var Copy = createLucideIcon(copy);
142
- var Download = createLucideIcon(download);
143
- var Eye = createLucideIcon(eye);
144
- var EyeOff = createLucideIcon(eyeOff);
145
- var Ellipsis = createLucideIcon(ellipsis);
146
- var FileJson = createLucideIcon(fileJson);
147
- var FileText = createLucideIcon(fileText);
148
- var GripVertical = createLucideIcon(gripVertical);
149
- var Image = createLucideIcon(image);
150
- var LayoutGrid = createLucideIcon(layoutGrid);
151
- var LoaderCircle = createLucideIcon(loaderCircle);
152
- var Mail = createLucideIcon(mail);
153
- var Paperclip = createLucideIcon(paperclip);
154
- var RefreshCw = createLucideIcon(refreshCw);
155
- var RotateCcw = createLucideIcon(rotateCcw);
156
- var Rows3 = createLucideIcon(rows3);
157
- var Search = createLucideIcon(search);
158
- var Settings2 = createLucideIcon(settings2);
159
- var TriangleAlert = createLucideIcon(triangleAlert);
160
- var X = createLucideIcon(x);
161
-
162
- // ../../src/components/email-editor/html.ts
163
- import { GripVertical as GripVertical2, Pencil, Plus, Trash2 } from "lucide";
61
+ Copy,
62
+ GripVertical as Grip,
63
+ Image,
64
+ Pencil as Edit,
65
+ Plus as Add,
66
+ Trash2 as Remove,
67
+ X
68
+ } from "@krak-stack/registry/lucide-effect";
164
69
 
165
70
  // ../../src/lib/email-document/model.ts
166
71
  import { Schema as Schema4 } from "effect";
@@ -1504,10 +1409,6 @@ var LegacyEditor = Html.component({
1504
1409
  });
1505
1410
 
1506
1411
  // ../../src/components/email-editor/html.ts
1507
- var Grip = createLucideIcon(GripVertical2);
1508
- var Edit = createLucideIcon(Pencil);
1509
- var Add = createLucideIcon(Plus);
1510
- var Remove = createLucideIcon(Trash2);
1511
1412
  var EmailEditor = Html2.component({
1512
1413
  ...emailEditorOptions,
1513
1414
  reads: { localeConfig: krakstackLocaleRead },