@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,7 +1,7 @@
1
1
  // ../../src/components/async-action-button/react.tsx
2
2
  import { Check, LoaderCircle, RotateCcw } from "lucide-react";
3
3
  import { Component as Component2 } from "effect/ui";
4
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
4
+ import { useLayoutEffect, useRef, useState } from "react";
5
5
 
6
6
  // ../../src/components/ui/button.tsx
7
7
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
@@ -53,161 +53,7 @@ function Button({
53
53
 
54
54
  // ../../src/components/async-action-button/react.tsx
55
55
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
56
-
57
- // ../../src/lib/effect-ui-adapter/use-model.ts
58
- import { MessageLog as MessageLog2 } from "effect/ui";
59
- import {
60
- createContext,
61
- useCallback,
62
- useContext,
63
- useEffect,
64
- useLayoutEffect,
65
- useRef,
66
- useState,
67
- useSyncExternalStore
68
- } from "react";
69
-
70
- // ../../src/lib/effect-ui-adapter/model-runtime.ts
71
- import { MessageLog, Renderer, View } from "effect/ui";
72
- import { BrowserHost, Html } from "effect/ui/html";
73
- import { Cause, Effect, Fiber } from "effect";
74
- var node = () => ({ children: [] });
75
- var modelHost = (commit) => {
76
- const remove = (child) => {
77
- if (!child.parent)
78
- return;
79
- child.parent.children.splice(child.parent.children.indexOf(child), 1);
80
- delete child.parent;
81
- };
82
- return {
83
- createElement: node,
84
- createText: node,
85
- setText: () => {},
86
- setAttr: () => {},
87
- setProp: () => {},
88
- setEvents: () => {},
89
- insertBefore: (parent, child, before) => {
90
- if (child === before)
91
- return;
92
- remove(child);
93
- const index = before ? parent.children.indexOf(before) : parent.children.length;
94
- parent.children.splice(index, 0, child);
95
- child.parent = parent;
96
- },
97
- remove,
98
- parentOf: (child) => child.parent,
99
- nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
100
- elements: ["html"],
101
- controlled: new Set,
102
- runsMounts: false,
103
- commit
104
- };
105
- };
106
- var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
107
- let currentProps = props;
108
- let root;
109
- let active = true;
110
- let failure;
111
- const publish = () => {
112
- if (!active)
113
- return;
114
- if (failure) {
115
- publishSnapshot({ error: failure });
116
- return;
117
- }
118
- const current = root?.model();
119
- if (current !== undefined)
120
- publishSnapshot({ model: current });
121
- };
122
- const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
123
- const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
124
- head: false,
125
- onEmit,
126
- fallback: ({ cause }) => {
127
- failure = new Error("Effect UI root failed", {
128
- cause: Cause.squash(cause)
129
- });
130
- return View.text("");
131
- }
132
- });
133
- if (!active)
134
- return;
135
- root = mounted;
136
- if (props !== currentProps)
137
- mounted.setProps(currentProps);
138
- publish();
139
- return yield* Effect.never;
140
- }).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
141
- return {
142
- send: (message) => {
143
- root?.send(message);
144
- publish();
145
- },
146
- setProps: (next) => {
147
- currentProps = next;
148
- root?.setProps(next);
149
- },
150
- dispose: () => {
151
- active = false;
152
- root = undefined;
153
- Effect.runFork(Fiber.interrupt(fiber));
154
- }
155
- };
156
- };
157
-
158
- // ../../src/lib/effect-ui-adapter/use-model.ts
159
- "use client";
160
- var ModelMessageLogContext = createContext(undefined);
161
- var useModel = (component, props, options = {}) => {
162
- const contextLog = useContext(ModelMessageLogContext);
163
- const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
164
- const [store] = useState(() => {
165
- const initial = { model: component.init(props).model };
166
- let snapshot = initial;
167
- const listeners = new Set;
168
- return {
169
- subscribe: (listener) => {
170
- listeners.add(listener);
171
- return () => {
172
- listeners.delete(listener);
173
- };
174
- },
175
- getSnapshot: () => snapshot,
176
- getServerSnapshot: () => initial,
177
- publish: (next) => {
178
- if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
179
- return;
180
- if ("error" in snapshot && "error" in next && snapshot.error === next.error)
181
- return;
182
- snapshot = next;
183
- listeners.forEach((listener) => listener());
184
- }
185
- };
186
- });
187
- const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
188
- const committed = useRef(props);
189
- const onEmit = useRef(options.onEmit);
190
- const runtime = useRef(undefined);
191
- const send = useCallback((message) => runtime.current?.send(message), []);
192
- useLayoutEffect(() => {
193
- onEmit.current = options.onEmit;
194
- committed.current = props;
195
- runtime.current?.setProps(props);
196
- }, [props, options.onEmit]);
197
- useEffect(() => {
198
- if (messageLog === null)
199
- return;
200
- const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
201
- runtime.current = mounted;
202
- return () => {
203
- runtime.current = undefined;
204
- mounted.dispose();
205
- };
206
- }, [component, messageLog, store]);
207
- if ("error" in snapshot)
208
- throw snapshot.error;
209
- return { model: snapshot.model, send };
210
- };
56
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
211
57
 
212
58
  // ../../src/components/async-action-button/classes.ts
213
59
  var asyncActionButtonClasses = {
@@ -221,8 +67,8 @@ var resolveAsyncActionButtonClasses = (overrides) => ({
221
67
  });
222
68
 
223
69
  // ../../src/components/async-action-button/index.ts
224
- import { Effect as Effect2, Schema as Schema2 } from "effect";
225
- import { Command, Component, UiSchema, View as View2 } from "effect/ui";
70
+ import { Effect, Schema as Schema2 } from "effect";
71
+ import { Command, Component, UiSchema, View } from "effect/ui";
226
72
 
227
73
  // ../../src/components/async-action-button/schema.ts
228
74
  import { Schema, Struct } from "effect";
@@ -272,11 +118,11 @@ var AsyncActionButtonMessage = UiSchema.TaggedEnum({
272
118
  }).annotate({ identifier: "AsyncActionButtonMessage" });
273
119
 
274
120
  class RunAsyncAction extends Command.Service()("async-action-button/RunAsyncAction", { args: {}, success: AsyncActionButtonMessage }) {
275
- static layerFromEffect = (run) => RunAsyncAction.toLayer(() => Effect2.suspend(run).pipe(Effect2.match({
121
+ static layerFromEffect = (run) => RunAsyncAction.toLayer(() => Effect.suspend(run).pipe(Effect.match({
276
122
  onSuccess: () => AsyncActionButtonMessage.Finished({ success: true }),
277
123
  onFailure: () => AsyncActionButtonMessage.Finished({ success: false })
278
124
  })));
279
- static layerFromAction = (run) => RunAsyncAction.layerFromEffect(() => Effect2.tryPromise(() => run()));
125
+ static layerFromAction = (run) => RunAsyncAction.layerFromEffect(() => Effect.tryPromise(() => run()));
280
126
  }
281
127
  var asyncActionButtonOptions = {
282
128
  name: "AsyncActionButton",
@@ -298,7 +144,7 @@ var asyncActionButtonBehaviours = {
298
144
  };
299
145
  var AsyncActionButtonModel = Definition.make({
300
146
  ...asyncActionButtonBehaviours,
301
- view: () => View2.text("")
147
+ view: () => View.text("")
302
148
  });
303
149
  var getAsyncActionButtonFeedback = (status, copy) => ({
304
150
  label: status === "idle" ? undefined : status === "error" ? copy.retry : copy[status],
@@ -321,11 +167,11 @@ var AsyncActionButton = ({
321
167
  }) => {
322
168
  const asyncActionButtonClasses = resolveAsyncActionButtonClasses(classOverrides);
323
169
  const copy = getAsyncActionButtonMessages(useKrakstackLocale(override), messages);
324
- const callbacks = useRef2({ onAction, onPendingChange });
325
- useLayoutEffect2(() => {
170
+ const callbacks = useRef({ onAction, onPendingChange });
171
+ useLayoutEffect(() => {
326
172
  callbacks.current = { onAction, onPendingChange };
327
173
  }, [onAction, onPendingChange]);
328
- const [component] = useState2(() => AsyncActionButtonModel.pipe(Component2.provide(RunAsyncAction.layerFromAction(async () => {
174
+ const [component] = useState(() => AsyncActionButtonModel.pipe(Component2.provide(RunAsyncAction.layerFromAction(async () => {
329
175
  const { onAction, onPendingChange } = callbacks.current;
330
176
  onPendingChange?.(true);
331
177
  try {