@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,5 +1,5 @@
1
1
  // ../../src/lib/documentation-toolkit.ts
2
- import { Effect as Effect3, Schema as Schema9 } from "effect";
2
+ import { Effect as Effect2, Schema as Schema9 } from "effect";
3
3
  import { Tool, Toolkit } from "effect/ai";
4
4
 
5
5
  // ../../src/lib/docs.tsx
@@ -10,8 +10,8 @@ import { Cookies as Cookies2 } from "effect/http";
10
10
  import {
11
11
  forwardRef,
12
12
  useDeferredValue,
13
- useEffect as useEffect4,
14
- useState as useState5
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 as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
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 as Effect2, Redacted, Schema as Schema2 } from "effect";
100
- import { Command, Component, UiSchema, View as View2 } from "effect/ui";
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 }) => Effect2.tryPromise(() => write(Redacted.value(value))).pipe(Effect2.match({
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 }) => Effect2.sleep(Math.max(0, delay)).pipe(Effect2.as(CopyButtonMessage.Reset())));
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: () => View2.text("")
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 as useCallback2, useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
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 View3 } from "effect/ui";
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: () => View3.text("")
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 View4 } from "effect/ui";
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: () => View4.text("")
442
+ view: () => View3.text("")
462
443
  });
463
444
  // ../../src/lib/docs.tsx
464
445
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
@@ -604,7 +585,7 @@ var ReadDocumentation = Tool.make("readDocumentation", {
604
585
  }).annotate({ identifier: "ReadDocumentationResult" })
605
586
  }).annotate(Tool.Title, "Read documentation").annotate(Tool.Readonly, true).annotate(Tool.Destructive, false).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
606
587
  var DocumentationToolkit = Toolkit.make(SearchDocumentation, ReadDocumentation);
607
- var searchDocumentation = Effect3.fn("ChatDocumentation.search")(function* ({
588
+ var searchDocumentation = Effect2.fn("ChatDocumentation.search")(function* ({
608
589
  docs,
609
590
  locale,
610
591
  query
@@ -616,7 +597,7 @@ var searchDocumentation = Effect3.fn("ChatDocumentation.search")(function* ({
616
597
  heading: heading?.id
617
598
  }));
618
599
  });
619
- var readDocumentation = Effect3.fn("ChatDocumentation.read")(function* ({
600
+ var readDocumentation = Effect2.fn("ChatDocumentation.read")(function* ({
620
601
  locale,
621
602
  paths,
622
603
  docs
@@ -0,0 +1,158 @@
1
+ // ../../src/lib/effect-ui-adapter/use-model.ts
2
+ import { MessageLog as MessageLog2 } from "effect/ui";
3
+ import {
4
+ createContext,
5
+ useCallback,
6
+ useContext,
7
+ useEffect,
8
+ useLayoutEffect,
9
+ useRef,
10
+ useState,
11
+ useSyncExternalStore
12
+ } from "react";
13
+
14
+ // ../../src/lib/effect-ui-adapter/model-runtime.ts
15
+ import { MessageLog, Renderer, View } from "effect/ui";
16
+ import { BrowserHost, Html } from "effect/ui/html";
17
+ import { Cause, Effect, Fiber } from "effect";
18
+ var node = () => ({ children: [] });
19
+ var modelHost = (commit) => {
20
+ const remove = (child) => {
21
+ if (!child.parent)
22
+ return;
23
+ child.parent.children.splice(child.parent.children.indexOf(child), 1);
24
+ delete child.parent;
25
+ };
26
+ return {
27
+ createElement: node,
28
+ createText: node,
29
+ setText: () => {},
30
+ setAttr: () => {},
31
+ setProp: () => {},
32
+ setEvents: () => {},
33
+ insertBefore: (parent, child, before) => {
34
+ if (child === before)
35
+ return;
36
+ remove(child);
37
+ const index = before ? parent.children.indexOf(before) : parent.children.length;
38
+ parent.children.splice(index, 0, child);
39
+ child.parent = parent;
40
+ },
41
+ remove,
42
+ parentOf: (child) => child.parent,
43
+ nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
44
+ elements: ["html"],
45
+ controlled: new Set,
46
+ runsMounts: false,
47
+ commit
48
+ };
49
+ };
50
+ var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
51
+ let currentProps = props;
52
+ let root;
53
+ let active = true;
54
+ let failure;
55
+ const publish = () => {
56
+ if (!active)
57
+ return;
58
+ if (failure) {
59
+ publishSnapshot({ error: failure });
60
+ return;
61
+ }
62
+ const current = root?.model();
63
+ if (current !== undefined)
64
+ publishSnapshot({ model: current });
65
+ };
66
+ const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
67
+ const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
68
+ head: false,
69
+ onEmit,
70
+ fallback: ({ cause }) => {
71
+ failure = new Error("Effect UI root failed", {
72
+ cause: Cause.squash(cause)
73
+ });
74
+ return View.text("");
75
+ }
76
+ });
77
+ if (!active)
78
+ return;
79
+ root = mounted;
80
+ if (props !== currentProps)
81
+ mounted.setProps(currentProps);
82
+ publish();
83
+ return yield* Effect.never;
84
+ }).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
85
+ return {
86
+ send: (message) => {
87
+ root?.send(message);
88
+ publish();
89
+ },
90
+ setProps: (next) => {
91
+ currentProps = next;
92
+ root?.setProps(next);
93
+ },
94
+ dispose: () => {
95
+ active = false;
96
+ root = undefined;
97
+ Effect.runFork(Fiber.interrupt(fiber));
98
+ }
99
+ };
100
+ };
101
+
102
+ // ../../src/lib/effect-ui-adapter/use-model.ts
103
+ "use client";
104
+ var ModelMessageLogContext = createContext(undefined);
105
+ var useModel = (component, props, options = {}) => {
106
+ const contextLog = useContext(ModelMessageLogContext);
107
+ const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
108
+ const [store] = useState(() => {
109
+ const initial = { model: component.init(props).model };
110
+ let snapshot = initial;
111
+ const listeners = new Set;
112
+ return {
113
+ subscribe: (listener) => {
114
+ listeners.add(listener);
115
+ return () => {
116
+ listeners.delete(listener);
117
+ };
118
+ },
119
+ getSnapshot: () => snapshot,
120
+ getServerSnapshot: () => initial,
121
+ publish: (next) => {
122
+ if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
123
+ return;
124
+ if ("error" in snapshot && "error" in next && snapshot.error === next.error)
125
+ return;
126
+ snapshot = next;
127
+ listeners.forEach((listener) => listener());
128
+ }
129
+ };
130
+ });
131
+ const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
132
+ const committed = useRef(props);
133
+ const onEmit = useRef(options.onEmit);
134
+ const runtime = useRef(undefined);
135
+ const send = useCallback((message) => runtime.current?.send(message), []);
136
+ useLayoutEffect(() => {
137
+ onEmit.current = options.onEmit;
138
+ committed.current = props;
139
+ runtime.current?.setProps(props);
140
+ }, [props, options.onEmit]);
141
+ useEffect(() => {
142
+ if (messageLog === null)
143
+ return;
144
+ const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
145
+ runtime.current = mounted;
146
+ return () => {
147
+ runtime.current = undefined;
148
+ mounted.dispose();
149
+ };
150
+ }, [component, messageLog, store]);
151
+ if ("error" in snapshot)
152
+ throw snapshot.error;
153
+ return { model: snapshot.model, send };
154
+ };
155
+ export {
156
+ ModelMessageLogContext,
157
+ useModel
158
+ };