@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
@@ -147,7 +147,7 @@ var makeAgentAtoms = ({
147
147
  return { removeContext, reset, state, submit };
148
148
  };
149
149
  // ../../src/components/agent/react.tsx
150
- import { useEffect as useEffect2, useId, useRef as useRef3, useState as useState3 } from "react";
150
+ import { useEffect, useId, useRef as useRef2, useState as useState2 } from "react";
151
151
  import { Dialog as DialogPrimitive2 } from "@base-ui/react/dialog";
152
152
  import {
153
153
  ArrowDownIcon as ArrowDownIcon2,
@@ -214,167 +214,13 @@ function Button({
214
214
  import { Check, Copy, TriangleAlert } from "lucide-react";
215
215
  import { Redacted as Redacted2 } from "effect";
216
216
  import { Component as Component2 } from "effect/ui";
217
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
217
+ import { useLayoutEffect, useRef, useState } from "react";
218
218
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
219
-
220
- // ../../src/lib/effect-ui-adapter/use-model.ts
221
- import { MessageLog as MessageLog2 } from "effect/ui";
222
- import {
223
- createContext,
224
- useCallback,
225
- useContext,
226
- useEffect,
227
- useLayoutEffect,
228
- useRef,
229
- useState,
230
- useSyncExternalStore
231
- } from "react";
232
-
233
- // ../../src/lib/effect-ui-adapter/model-runtime.ts
234
- import { MessageLog, Renderer, View } from "effect/ui";
235
- import { BrowserHost, Html } from "effect/ui/html";
236
- import { Cause, Effect as Effect2, Fiber } from "effect";
237
- var node = () => ({ children: [] });
238
- var modelHost = (commit) => {
239
- const remove = (child) => {
240
- if (!child.parent)
241
- return;
242
- child.parent.children.splice(child.parent.children.indexOf(child), 1);
243
- delete child.parent;
244
- };
245
- return {
246
- createElement: node,
247
- createText: node,
248
- setText: () => {},
249
- setAttr: () => {},
250
- setProp: () => {},
251
- setEvents: () => {},
252
- insertBefore: (parent, child, before) => {
253
- if (child === before)
254
- return;
255
- remove(child);
256
- const index = before ? parent.children.indexOf(before) : parent.children.length;
257
- parent.children.splice(index, 0, child);
258
- child.parent = parent;
259
- },
260
- remove,
261
- parentOf: (child) => child.parent,
262
- nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
263
- elements: ["html"],
264
- controlled: new Set,
265
- runsMounts: false,
266
- commit
267
- };
268
- };
269
- var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
270
- let currentProps = props;
271
- let root;
272
- let active = true;
273
- let failure;
274
- const publish = () => {
275
- if (!active)
276
- return;
277
- if (failure) {
278
- publishSnapshot({ error: failure });
279
- return;
280
- }
281
- const current = root?.model();
282
- if (current !== undefined)
283
- publishSnapshot({ model: current });
284
- };
285
- const fiber = Effect2.runFork(Effect2.scoped(Effect2.gen(function* () {
286
- const mounted = yield* Renderer.mount(component, Effect2.succeed(props), node(), {
287
- head: false,
288
- onEmit,
289
- fallback: ({ cause }) => {
290
- failure = new Error("Effect UI root failed", {
291
- cause: Cause.squash(cause)
292
- });
293
- return View.text("");
294
- }
295
- });
296
- if (!active)
297
- return;
298
- root = mounted;
299
- if (props !== currentProps)
300
- mounted.setProps(currentProps);
301
- publish();
302
- return yield* Effect2.never;
303
- }).pipe(Effect2.provide(Renderer.layer(modelHost(publish))), Effect2.provideService(Html.Host, BrowserHost.htmlHost), Effect2.provideService(MessageLog.MessageLog, messageLog))));
304
- return {
305
- send: (message) => {
306
- root?.send(message);
307
- publish();
308
- },
309
- setProps: (next) => {
310
- currentProps = next;
311
- root?.setProps(next);
312
- },
313
- dispose: () => {
314
- active = false;
315
- root = undefined;
316
- Effect2.runFork(Fiber.interrupt(fiber));
317
- }
318
- };
319
- };
320
-
321
- // ../../src/lib/effect-ui-adapter/use-model.ts
322
- "use client";
323
- var ModelMessageLogContext = createContext(undefined);
324
- var useModel = (component, props, options = {}) => {
325
- const contextLog = useContext(ModelMessageLogContext);
326
- const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
327
- const [store] = useState(() => {
328
- const initial = { model: component.init(props).model };
329
- let snapshot = initial;
330
- const listeners = new Set;
331
- return {
332
- subscribe: (listener) => {
333
- listeners.add(listener);
334
- return () => {
335
- listeners.delete(listener);
336
- };
337
- },
338
- getSnapshot: () => snapshot,
339
- getServerSnapshot: () => initial,
340
- publish: (next) => {
341
- if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
342
- return;
343
- if ("error" in snapshot && "error" in next && snapshot.error === next.error)
344
- return;
345
- snapshot = next;
346
- listeners.forEach((listener) => listener());
347
- }
348
- };
349
- });
350
- const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
351
- const committed = useRef(props);
352
- const onEmit = useRef(options.onEmit);
353
- const runtime = useRef(undefined);
354
- const send = useCallback((message) => runtime.current?.send(message), []);
355
- useLayoutEffect(() => {
356
- onEmit.current = options.onEmit;
357
- committed.current = props;
358
- runtime.current?.setProps(props);
359
- }, [props, options.onEmit]);
360
- useEffect(() => {
361
- if (messageLog === null)
362
- return;
363
- const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
364
- runtime.current = mounted;
365
- return () => {
366
- runtime.current = undefined;
367
- mounted.dispose();
368
- };
369
- }, [component, messageLog, store]);
370
- if ("error" in snapshot)
371
- throw snapshot.error;
372
- return { model: snapshot.model, send };
373
- };
219
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
374
220
 
375
221
  // ../../src/components/copy-button/index.ts
376
- import { Effect as Effect3, Redacted, Schema as Schema3 } from "effect";
377
- import { Command, Component, UiSchema, View as View2 } from "effect/ui";
222
+ import { Effect as Effect2, Redacted, Schema as Schema3 } from "effect";
223
+ import { Command, Component, UiSchema, View } from "effect/ui";
378
224
 
379
225
  // ../../src/components/copy-button/schema.ts
380
226
  import { Schema as Schema2 } from "effect";
@@ -429,13 +275,13 @@ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
429
275
  },
430
276
  success: CopyButtonMessage
431
277
  }) {
432
- static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect3.tryPromise(() => write(Redacted.value(value))).pipe(Effect3.match({
278
+ static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect2.tryPromise(() => write(Redacted.value(value))).pipe(Effect2.match({
433
279
  onSuccess: () => CopyButtonMessage.Finished({ success: true }),
434
280
  onFailure: () => CopyButtonMessage.Finished({ success: false })
435
281
  })));
436
282
  static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
437
283
  }
438
- var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema3.Number }, mode: "switch" }, ({ delay }) => Effect3.sleep(Math.max(0, delay)).pipe(Effect3.as(CopyButtonMessage.Reset())));
284
+ var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema3.Number }, mode: "switch" }, ({ delay }) => Effect2.sleep(Math.max(0, delay)).pipe(Effect2.as(CopyButtonMessage.Reset())));
439
285
  var copyButtonOptions = {
440
286
  name: "CopyButton",
441
287
  props: CopyButtonModelProps,
@@ -457,7 +303,7 @@ var copyButtonBehaviours = {
457
303
  };
458
304
  var CopyButtonModel = Definition.make({
459
305
  ...copyButtonBehaviours,
460
- view: () => View2.text("")
306
+ view: () => View.text("")
461
307
  });
462
308
  var copyButtonStatus = (status, copy, description) => {
463
309
  if (status === "idle")
@@ -485,19 +331,19 @@ function CopyButton({
485
331
  }) {
486
332
  const locale = useKrakstackLocale(localeOverride);
487
333
  const labels = copyButtonMessages(locale, messages);
488
- const callbacks = useRef2({
334
+ const callbacks = useRef({
489
335
  onCopied,
490
336
  onCopyError,
491
337
  failureLabel: labels.copyFailed
492
338
  });
493
- useLayoutEffect2(() => {
339
+ useLayoutEffect(() => {
494
340
  callbacks.current = {
495
341
  onCopied,
496
342
  onCopyError,
497
343
  failureLabel: labels.copyFailed
498
344
  };
499
345
  }, [onCopied, onCopyError, labels.copyFailed]);
500
- const [component] = useState2(() => CopyButtonModel.pipe(Component2.provide(WriteClipboard.layerFromWrite(async (text) => {
346
+ const [component] = useState(() => CopyButtonModel.pipe(Component2.provide(WriteClipboard.layerFromWrite(async (text) => {
501
347
  const { onCopied, onCopyError, failureLabel } = callbacks.current;
502
348
  try {
503
349
  await navigator.clipboard.writeText(text);
@@ -1669,7 +1515,7 @@ var AgentStreamError = Schema4.Struct({
1669
1515
  import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
1670
1516
 
1671
1517
  // ../../src/components/agent/index.ts
1672
- import { Context, Effect as Effect4, Layer as Layer2, Redacted as Redacted3, Schema as Schema6, Stream as Stream2 } from "effect";
1518
+ import { Context, Effect as Effect3, Layer as Layer2, Redacted as Redacted3, Schema as Schema6, Stream as Stream2 } from "effect";
1673
1519
  import { AtomRegistry } from "effect/reactivity";
1674
1520
  import { Command as Command3, Component as Component3, Subscription, UiSchema as UiSchema2 } from "effect/ui";
1675
1521
 
@@ -1732,7 +1578,7 @@ var AgentWidgetIntentSchema = Schema5.Union([
1732
1578
 
1733
1579
  // ../../src/components/agent/index.ts
1734
1580
  class ConversationHost extends Context.Service()("agent/ConversationHost") {
1735
- static layer = (host) => Layer2.merge(Layer2.succeed(ConversationHost, host), DispatchIntent.toLayer(({ intent }) => Effect4.suspend(() => host.dispatch(intent)).pipe(Effect4.match({
1581
+ static layer = (host) => Layer2.merge(Layer2.succeed(ConversationHost, host), DispatchIntent.toLayer(({ intent }) => Effect3.suspend(() => host.dispatch(intent)).pipe(Effect3.match({
1736
1582
  onSuccess: () => AgentWidgetMessage.Delivered({ success: true }),
1737
1583
  onFailure: () => AgentWidgetMessage.Delivered({ success: false })
1738
1584
  }))));
@@ -1877,7 +1723,7 @@ var agentWidgetBehaviours = {
1877
1723
  maximized: false
1878
1724
  }),
1879
1725
  subscriptions: () => [
1880
- Subscription.make("agent/conversation", Stream2.unwrap(Effect4.map(ConversationHost, (host) => host.snapshots.pipe(Stream2.map((snapshot) => AgentWidgetMessage.Received({
1726
+ Subscription.make("agent/conversation", Stream2.unwrap(Effect3.map(ConversationHost, (host) => host.snapshots.pipe(Stream2.map((snapshot) => AgentWidgetMessage.Received({
1881
1727
  snapshot: Redacted3.make(snapshot)
1882
1728
  })), Stream2.concat(Stream2.make(AgentWidgetMessage.Disconnected()))))))
1883
1729
  ],
@@ -2175,7 +2021,7 @@ function ToolActivityLog({
2175
2021
  tools,
2176
2022
  workedSeconds
2177
2023
  }) {
2178
- const [open, setOpen] = useState3();
2024
+ const [open, setOpen] = useState2();
2179
2025
  const approvals = tools.filter((tool) => tool.status === "approval-required");
2180
2026
  const activity = tools.filter((tool) => tool.status !== "approval-required");
2181
2027
  const currentTool = activity.at(-1);
@@ -2252,12 +2098,12 @@ function AgentMessageRow({
2252
2098
  pending
2253
2099
  }) {
2254
2100
  const isUser = message.role === "user";
2255
- const activeStartedAt = useRef3(undefined);
2256
- const activeMilliseconds = useRef3(0);
2257
- const wasPending = useRef3(pending);
2258
- const [workedSeconds, setWorkedSeconds] = useState3();
2101
+ const activeStartedAt = useRef2(undefined);
2102
+ const activeMilliseconds = useRef2(0);
2103
+ const wasPending = useRef2(pending);
2104
+ const [workedSeconds, setWorkedSeconds] = useState2();
2259
2105
  const hasPendingApproval = message.tools.some((tool) => tool.status === "approval-required");
2260
- useEffect2(() => {
2106
+ useEffect(() => {
2261
2107
  const isWorking = pending && !hasPendingApproval;
2262
2108
  if (isWorking) {
2263
2109
  wasPending.current = true;
@@ -2342,15 +2188,15 @@ function AgentWidget({
2342
2188
  const labels = agentWidgetMessages(locale, messageOverrides);
2343
2189
  const referenceInputId = useId();
2344
2190
  const referenceListId = `${referenceInputId}-list`;
2345
- const [open, setOpen] = useState3(false);
2346
- const [maximized, setMaximized] = useState3(false);
2347
- const [referencePickerOpen, setReferencePickerOpen] = useState3(false);
2348
- const [activeReferenceKey, setActiveReferenceKey] = useState3("");
2349
- const [activeReferenceSearch, setActiveReferenceSearch] = useState3();
2350
- const [input, setInput] = useState3("");
2351
- const inputRef = useRef3(null);
2352
- const inputOverlayRef = useRef3(null);
2353
- const [references, setReferences] = useState3([]);
2191
+ const [open, setOpen] = useState2(false);
2192
+ const [maximized, setMaximized] = useState2(false);
2193
+ const [referencePickerOpen, setReferencePickerOpen] = useState2(false);
2194
+ const [activeReferenceKey, setActiveReferenceKey] = useState2("");
2195
+ const [activeReferenceSearch, setActiveReferenceSearch] = useState2();
2196
+ const [input, setInput] = useState2("");
2197
+ const inputRef = useRef2(null);
2198
+ const inputOverlayRef = useRef2(null);
2199
+ const [references, setReferences] = useState2([]);
2354
2200
  const activeContext = state.contextLocked ? state.context ? {
2355
2201
  ...state.context,
2356
2202
  icon: availableReferences.find(({ key }) => key === state.context?.key)?.icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,6 +21,14 @@
21
21
  "types": "./dist/components/ui/select.d.ts",
22
22
  "import": "./dist/components/ui/select.js"
23
23
  },
24
+ "./effect-ui-adapter/react": {
25
+ "types": "./dist/lib/effect-ui-adapter/use-model.d.ts",
26
+ "import": "./dist/lib/effect-ui-adapter/use-model.js"
27
+ },
28
+ "./lucide-effect": {
29
+ "types": "./dist/lib/lucide-effect.d.ts",
30
+ "import": "./dist/lib/lucide-effect.js"
31
+ },
24
32
  "./*/react": {
25
33
  "types": "./dist/components/*/react.d.ts",
26
34
  "import": "./dist/components/*/react.js"
@@ -474,7 +482,7 @@
474
482
  "@tiptap/pm": "^3.35.1",
475
483
  "@tiptap/starter-kit": "^3.35.1",
476
484
  "bowser": "^2.14.1",
477
- "lucide": "^1.83.0",
485
+ "lucide": "1.84.0",
478
486
  "parse5": "^8.0.1",
479
487
  "web-vitals": "^5.1.0"
480
488
  },