@krak-stack/registry 0.11.1 → 0.11.2
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 +6 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +4 -4
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/markdown/react.js +10 -164
- 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/react.js +9 -161
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/support/react.js +14 -168
- package/dist/components/timezone-input/react.js +9 -163
- 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/services/agent/client/index.js +29 -183
- package/package.json +5 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// ../../src/components/webhook-delivery-table/react.tsx
|
|
2
|
-
import { Component as Component7, View as
|
|
2
|
+
import { Component as Component7, View as View3 } from "effect/ui";
|
|
3
3
|
import { Check as Check3, Clock, FileJson as FileJson2, X as X2 } from "lucide-react";
|
|
4
4
|
|
|
5
5
|
// ../../src/components/data-table/react.tsx
|
|
6
6
|
import { ScrollArea as ScrollAreaPrimitive2 } from "@base-ui/react/scroll-area";
|
|
7
7
|
import { useVirtualizer, useWindowVirtualizer } from "@tanstack/react-virtual";
|
|
8
8
|
import { Formatter, Option as Option4, Schema as Schema6 } from "effect";
|
|
9
|
-
import { Component as Component3, View
|
|
9
|
+
import { Component as Component3, View } from "effect/ui";
|
|
10
10
|
import {
|
|
11
11
|
ArrowDown,
|
|
12
12
|
ArrowUp,
|
|
@@ -31,17 +31,17 @@ import {
|
|
|
31
31
|
X
|
|
32
32
|
} from "lucide-react";
|
|
33
33
|
import {
|
|
34
|
-
createContext
|
|
34
|
+
createContext,
|
|
35
35
|
isValidElement,
|
|
36
|
-
useCallback
|
|
37
|
-
useContext
|
|
38
|
-
useEffect
|
|
36
|
+
useCallback,
|
|
37
|
+
useContext,
|
|
38
|
+
useEffect,
|
|
39
39
|
useId as useId2,
|
|
40
|
-
useLayoutEffect
|
|
40
|
+
useLayoutEffect,
|
|
41
41
|
useMemo as useMemo2,
|
|
42
|
-
useRef
|
|
43
|
-
useState
|
|
44
|
-
useSyncExternalStore
|
|
42
|
+
useRef,
|
|
43
|
+
useState,
|
|
44
|
+
useSyncExternalStore
|
|
45
45
|
} from "react";
|
|
46
46
|
import { createPortal } from "react-dom";
|
|
47
47
|
|
|
@@ -1323,162 +1323,8 @@ var PaginationMeta = Schema3.Struct({
|
|
|
1323
1323
|
examples: [{ page: 0, pageSize: 20, total: 125, pageCount: 7 }]
|
|
1324
1324
|
}));
|
|
1325
1325
|
|
|
1326
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1327
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
1328
|
-
import {
|
|
1329
|
-
createContext,
|
|
1330
|
-
useCallback,
|
|
1331
|
-
useContext,
|
|
1332
|
-
useEffect,
|
|
1333
|
-
useLayoutEffect,
|
|
1334
|
-
useRef,
|
|
1335
|
-
useState,
|
|
1336
|
-
useSyncExternalStore
|
|
1337
|
-
} from "react";
|
|
1338
|
-
|
|
1339
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
1340
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
1341
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
1342
|
-
import { Cause, Effect as Effect2, Fiber } from "effect";
|
|
1343
|
-
var node = () => ({ children: [] });
|
|
1344
|
-
var modelHost = (commit) => {
|
|
1345
|
-
const remove = (child) => {
|
|
1346
|
-
if (!child.parent)
|
|
1347
|
-
return;
|
|
1348
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
1349
|
-
delete child.parent;
|
|
1350
|
-
};
|
|
1351
|
-
return {
|
|
1352
|
-
createElement: node,
|
|
1353
|
-
createText: node,
|
|
1354
|
-
setText: () => {},
|
|
1355
|
-
setAttr: () => {},
|
|
1356
|
-
setProp: () => {},
|
|
1357
|
-
setEvents: () => {},
|
|
1358
|
-
insertBefore: (parent, child, before) => {
|
|
1359
|
-
if (child === before)
|
|
1360
|
-
return;
|
|
1361
|
-
remove(child);
|
|
1362
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
1363
|
-
parent.children.splice(index, 0, child);
|
|
1364
|
-
child.parent = parent;
|
|
1365
|
-
},
|
|
1366
|
-
remove,
|
|
1367
|
-
parentOf: (child) => child.parent,
|
|
1368
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
1369
|
-
elements: ["html"],
|
|
1370
|
-
controlled: new Set,
|
|
1371
|
-
runsMounts: false,
|
|
1372
|
-
commit
|
|
1373
|
-
};
|
|
1374
|
-
};
|
|
1375
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
1376
|
-
let currentProps = props;
|
|
1377
|
-
let root;
|
|
1378
|
-
let active = true;
|
|
1379
|
-
let failure;
|
|
1380
|
-
const publish = () => {
|
|
1381
|
-
if (!active)
|
|
1382
|
-
return;
|
|
1383
|
-
if (failure) {
|
|
1384
|
-
publishSnapshot({ error: failure });
|
|
1385
|
-
return;
|
|
1386
|
-
}
|
|
1387
|
-
const current = root?.model();
|
|
1388
|
-
if (current !== undefined)
|
|
1389
|
-
publishSnapshot({ model: current });
|
|
1390
|
-
};
|
|
1391
|
-
const fiber = Effect2.runFork(Effect2.scoped(Effect2.gen(function* () {
|
|
1392
|
-
const mounted = yield* Renderer.mount(component, Effect2.succeed(props), node(), {
|
|
1393
|
-
head: false,
|
|
1394
|
-
onEmit,
|
|
1395
|
-
fallback: ({ cause }) => {
|
|
1396
|
-
failure = new Error("Effect UI root failed", {
|
|
1397
|
-
cause: Cause.squash(cause)
|
|
1398
|
-
});
|
|
1399
|
-
return View.text("");
|
|
1400
|
-
}
|
|
1401
|
-
});
|
|
1402
|
-
if (!active)
|
|
1403
|
-
return;
|
|
1404
|
-
root = mounted;
|
|
1405
|
-
if (props !== currentProps)
|
|
1406
|
-
mounted.setProps(currentProps);
|
|
1407
|
-
publish();
|
|
1408
|
-
return yield* Effect2.never;
|
|
1409
|
-
}).pipe(Effect2.provide(Renderer.layer(modelHost(publish))), Effect2.provideService(Html.Host, BrowserHost.htmlHost), Effect2.provideService(MessageLog.MessageLog, messageLog))));
|
|
1410
|
-
return {
|
|
1411
|
-
send: (message) => {
|
|
1412
|
-
root?.send(message);
|
|
1413
|
-
publish();
|
|
1414
|
-
},
|
|
1415
|
-
setProps: (next) => {
|
|
1416
|
-
currentProps = next;
|
|
1417
|
-
root?.setProps(next);
|
|
1418
|
-
},
|
|
1419
|
-
dispose: () => {
|
|
1420
|
-
active = false;
|
|
1421
|
-
root = undefined;
|
|
1422
|
-
Effect2.runFork(Fiber.interrupt(fiber));
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
};
|
|
1426
|
-
|
|
1427
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1428
|
-
"use client";
|
|
1429
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
1430
|
-
var useModel = (component, props, options = {}) => {
|
|
1431
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
1432
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
1433
|
-
const [store] = useState(() => {
|
|
1434
|
-
const initial = { model: component.init(props).model };
|
|
1435
|
-
let snapshot = initial;
|
|
1436
|
-
const listeners = new Set;
|
|
1437
|
-
return {
|
|
1438
|
-
subscribe: (listener) => {
|
|
1439
|
-
listeners.add(listener);
|
|
1440
|
-
return () => {
|
|
1441
|
-
listeners.delete(listener);
|
|
1442
|
-
};
|
|
1443
|
-
},
|
|
1444
|
-
getSnapshot: () => snapshot,
|
|
1445
|
-
getServerSnapshot: () => initial,
|
|
1446
|
-
publish: (next) => {
|
|
1447
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
1448
|
-
return;
|
|
1449
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
1450
|
-
return;
|
|
1451
|
-
snapshot = next;
|
|
1452
|
-
listeners.forEach((listener) => listener());
|
|
1453
|
-
}
|
|
1454
|
-
};
|
|
1455
|
-
});
|
|
1456
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
1457
|
-
const committed = useRef(props);
|
|
1458
|
-
const onEmit = useRef(options.onEmit);
|
|
1459
|
-
const runtime = useRef(undefined);
|
|
1460
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
1461
|
-
useLayoutEffect(() => {
|
|
1462
|
-
onEmit.current = options.onEmit;
|
|
1463
|
-
committed.current = props;
|
|
1464
|
-
runtime.current?.setProps(props);
|
|
1465
|
-
}, [props, options.onEmit]);
|
|
1466
|
-
useEffect(() => {
|
|
1467
|
-
if (messageLog === null)
|
|
1468
|
-
return;
|
|
1469
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
1470
|
-
runtime.current = mounted;
|
|
1471
|
-
return () => {
|
|
1472
|
-
runtime.current = undefined;
|
|
1473
|
-
mounted.dispose();
|
|
1474
|
-
};
|
|
1475
|
-
}, [component, messageLog, store]);
|
|
1476
|
-
if ("error" in snapshot)
|
|
1477
|
-
throw snapshot.error;
|
|
1478
|
-
return { model: snapshot.model, send };
|
|
1479
|
-
};
|
|
1480
|
-
|
|
1481
1326
|
// ../../src/components/data-table/react.tsx
|
|
1327
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
1482
1328
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
1483
1329
|
|
|
1484
1330
|
// ../../src/components/data-table/classes.ts
|
|
@@ -1519,7 +1365,7 @@ var resolveTableClasses = (overrides) => ({
|
|
|
1519
1365
|
});
|
|
1520
1366
|
|
|
1521
1367
|
// ../../src/components/data-table/index.ts
|
|
1522
|
-
import { DateTime as DateTime3, Effect as
|
|
1368
|
+
import { DateTime as DateTime3, Effect as Effect2, Option as Option3, Redacted, Schema as Schema5, Stream } from "effect";
|
|
1523
1369
|
import { Csv } from "effect/encoding";
|
|
1524
1370
|
import { Command, Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
1525
1371
|
|
|
@@ -2426,8 +2272,8 @@ var dataTablePage = (props, model, locale) => {
|
|
|
2426
2272
|
pageSizes: pagination && pagination.pageSizes || defaultPageSizes
|
|
2427
2273
|
};
|
|
2428
2274
|
};
|
|
2429
|
-
var encodeTableCsv = (headers, data) =>
|
|
2430
|
-
` })), Stream.runCollect,
|
|
2275
|
+
var encodeTableCsv = (headers, data) => Effect2.runSync(Stream.fromIterable([headers, ...data]).pipe(Stream.map((row) => row.map((value) => value == null ? "" : String(value))), Stream.pipeThroughChannel(Csv.encodeString({ newline: `
|
|
2276
|
+
` })), Stream.runCollect, Effect2.map((parts) => parts.join("").slice(0, -1))));
|
|
2431
2277
|
var tableExportFilename = (name, extension) => name.includes(".") ? name.replace(/\.[^/.]+$/, `.${extension}`) : `${name}.${extension}`;
|
|
2432
2278
|
var downloadTableBlob = (content, type, filename) => {
|
|
2433
2279
|
const url = window.URL.createObjectURL(new Blob([content], { type }));
|
|
@@ -2468,7 +2314,7 @@ var DownloadTable = Command.make("DataTable/Download", {
|
|
|
2468
2314
|
content: Schema5.Redacted(Schema5.String, { disallowJsonEncode: true }),
|
|
2469
2315
|
type: Schema5.String
|
|
2470
2316
|
}
|
|
2471
|
-
}, ({ filename, content, type }) =>
|
|
2317
|
+
}, ({ filename, content, type }) => Effect2.try(() => downloadTableBlob(Redacted.value(content), type, filename)).pipe(Effect2.match({
|
|
2472
2318
|
onSuccess: () => DataTableMessage.ExportFinished({ failed: false }),
|
|
2473
2319
|
onFailure: () => DataTableMessage.ExportFinished({ failed: true })
|
|
2474
2320
|
})));
|
|
@@ -2777,11 +2623,11 @@ var dataTableBehaviours = {
|
|
|
2777
2623
|
|
|
2778
2624
|
// ../../src/components/data-table/react.tsx
|
|
2779
2625
|
import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
|
|
2780
|
-
var DataTableStylesContext =
|
|
2781
|
-
var DataTableSlotClassesContext =
|
|
2626
|
+
var DataTableStylesContext = createContext(undefined);
|
|
2627
|
+
var DataTableSlotClassesContext = createContext(resolveTableClasses());
|
|
2782
2628
|
var styledTablePart = (Part, slot, style) => {
|
|
2783
2629
|
const StyledPart = (props) => {
|
|
2784
|
-
const styles =
|
|
2630
|
+
const styles = useContext(DataTableStylesContext);
|
|
2785
2631
|
const className = cn(props.className, style(styles));
|
|
2786
2632
|
return /* @__PURE__ */ jsx15(Part, {
|
|
2787
2633
|
"data-table-slot": slot,
|
|
@@ -2822,8 +2668,8 @@ var DataTableReferenceCell = ({
|
|
|
2822
2668
|
emptyLabel = "—",
|
|
2823
2669
|
imageVariant = "circle"
|
|
2824
2670
|
}) => {
|
|
2825
|
-
const tableClasses =
|
|
2826
|
-
const [failedImage, setFailedImage] =
|
|
2671
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
2672
|
+
const [failedImage, setFailedImage] = useState();
|
|
2827
2673
|
if (!item)
|
|
2828
2674
|
return emptyLabel;
|
|
2829
2675
|
const initials = tableInitials(item.label);
|
|
@@ -3107,10 +2953,10 @@ var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
|
3107
2953
|
reordered.splice(targetIndex, 0, source);
|
|
3108
2954
|
return reordered;
|
|
3109
2955
|
};
|
|
3110
|
-
var RowIdContext =
|
|
3111
|
-
var ColumnIdContext =
|
|
2956
|
+
var RowIdContext = createContext(null);
|
|
2957
|
+
var ColumnIdContext = createContext(null);
|
|
3112
2958
|
var useRequiredId = (context) => {
|
|
3113
|
-
const id =
|
|
2959
|
+
const id = useContext(context);
|
|
3114
2960
|
if (!id)
|
|
3115
2961
|
throw new Error("DataTable internal ID context is missing");
|
|
3116
2962
|
return id;
|
|
@@ -3335,7 +3181,7 @@ var DataTableRowActions = ({
|
|
|
3335
3181
|
row,
|
|
3336
3182
|
title
|
|
3337
3183
|
}) => {
|
|
3338
|
-
const tableClasses =
|
|
3184
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3339
3185
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
3340
3186
|
if (!visible.length)
|
|
3341
3187
|
return null;
|
|
@@ -3422,9 +3268,9 @@ var DataTableRowActionMenu = ({
|
|
|
3422
3268
|
var DataTableToolbar = ({
|
|
3423
3269
|
table
|
|
3424
3270
|
}) => {
|
|
3425
|
-
const tableClasses =
|
|
3271
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3426
3272
|
const [store, send] = table;
|
|
3427
|
-
const exportPending =
|
|
3273
|
+
const exportPending = useRef(false);
|
|
3428
3274
|
const { exporting, exportFailed } = store.ui;
|
|
3429
3275
|
const { features, labels } = store.config;
|
|
3430
3276
|
const model = deriveModel(store);
|
|
@@ -3662,7 +3508,7 @@ var FilterEditor = ({
|
|
|
3662
3508
|
}) => {
|
|
3663
3509
|
const inputId = useId2();
|
|
3664
3510
|
const kind = getDataTableFilterKind(column);
|
|
3665
|
-
const [draft, setDraft] =
|
|
3511
|
+
const [draft, setDraft] = useState(() => tableFilterDraft(column.id, current));
|
|
3666
3512
|
const { primary, secondary, operator } = draft;
|
|
3667
3513
|
const operatorOptions = [
|
|
3668
3514
|
{ value: "contains", label: labels.filterContains },
|
|
@@ -3670,8 +3516,8 @@ var FilterEditor = ({
|
|
|
3670
3516
|
{ value: "startsWith", label: labels.filterStartsWith },
|
|
3671
3517
|
{ value: "endsWith", label: labels.filterEndsWith }
|
|
3672
3518
|
];
|
|
3673
|
-
const [invalid, setInvalid] =
|
|
3674
|
-
const [optionSearch, setOptionSearch] =
|
|
3519
|
+
const [invalid, setInvalid] = useState(false);
|
|
3520
|
+
const [optionSearch, setOptionSearch] = useState("");
|
|
3675
3521
|
const apply = (candidate) => {
|
|
3676
3522
|
const decoded = parseTableFilterDraft(kind, candidate);
|
|
3677
3523
|
if (Option4.isNone(decoded)) {
|
|
@@ -4146,7 +3992,7 @@ var ColumnMenu = ({
|
|
|
4146
3992
|
var ResizeHandle = ({
|
|
4147
3993
|
table
|
|
4148
3994
|
}) => {
|
|
4149
|
-
const tableClasses =
|
|
3995
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4150
3996
|
const [store, send] = table;
|
|
4151
3997
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4152
3998
|
const column = deriveModel(store).columns.find(({ id }) => id === columnId);
|
|
@@ -4197,8 +4043,8 @@ var DragHandle = ({
|
|
|
4197
4043
|
}) => {
|
|
4198
4044
|
const [store] = table;
|
|
4199
4045
|
const rowId = useRequiredId(RowIdContext);
|
|
4200
|
-
const dragRef =
|
|
4201
|
-
const [overlay, setOverlay] =
|
|
4046
|
+
const dragRef = useRef(null);
|
|
4047
|
+
const [overlay, setOverlay] = useState(null);
|
|
4202
4048
|
const reset = (element) => {
|
|
4203
4049
|
clearDragPresentation(element.closest("[data-table-root]"));
|
|
4204
4050
|
dragRef.current = null;
|
|
@@ -4328,7 +4174,7 @@ var TableDataRow = ({
|
|
|
4328
4174
|
virtualIndex,
|
|
4329
4175
|
measureRef
|
|
4330
4176
|
}) => {
|
|
4331
|
-
const tableClasses =
|
|
4177
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4332
4178
|
const [store, send] = table;
|
|
4333
4179
|
const model = deriveModel(store);
|
|
4334
4180
|
const selection = store.config.features.selection;
|
|
@@ -4440,7 +4286,7 @@ var GroupHeaderRow = ({
|
|
|
4440
4286
|
virtualIndex,
|
|
4441
4287
|
measureRef
|
|
4442
4288
|
}) => {
|
|
4443
|
-
const tableClasses =
|
|
4289
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4444
4290
|
const [store, send] = table;
|
|
4445
4291
|
const collapsed = !!store.state.collapsedGroups[section.key];
|
|
4446
4292
|
return /* @__PURE__ */ jsx15(TableRow2, {
|
|
@@ -4531,7 +4377,7 @@ var GroupedTable = ({
|
|
|
4531
4377
|
var ColumnHeaderMenu = ({
|
|
4532
4378
|
table
|
|
4533
4379
|
}) => {
|
|
4534
|
-
const tableClasses =
|
|
4380
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4535
4381
|
const [store, send] = table;
|
|
4536
4382
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4537
4383
|
const model = deriveModel(store);
|
|
@@ -4692,7 +4538,7 @@ var DataTableHeader = ({
|
|
|
4692
4538
|
table,
|
|
4693
4539
|
sticky
|
|
4694
4540
|
}) => {
|
|
4695
|
-
const tableClasses =
|
|
4541
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4696
4542
|
const [store, send] = table;
|
|
4697
4543
|
const model = deriveModel(store);
|
|
4698
4544
|
const selection = store.config.features.selection;
|
|
@@ -4791,7 +4637,7 @@ var VirtualTableRows = ({
|
|
|
4791
4637
|
result.push({ key: `row:${row.id}`, kind: "data", row });
|
|
4792
4638
|
return result;
|
|
4793
4639
|
}, [rows, sections, state.collapsedGroups]);
|
|
4794
|
-
|
|
4640
|
+
useLayoutEffect(() => {
|
|
4795
4641
|
if (!pageScroll && scrollElement)
|
|
4796
4642
|
scrollElement.scrollTop = 0;
|
|
4797
4643
|
}, [
|
|
@@ -4806,7 +4652,7 @@ var VirtualTableRows = ({
|
|
|
4806
4652
|
]);
|
|
4807
4653
|
const options = {
|
|
4808
4654
|
count: entries.length,
|
|
4809
|
-
getItemKey:
|
|
4655
|
+
getItemKey: useCallback((index) => entries[index].key, [entries]),
|
|
4810
4656
|
estimateSize: () => viewport.options.estimateRowHeight ?? 64,
|
|
4811
4657
|
overscan: viewport.options.overscan ?? 5,
|
|
4812
4658
|
scrollMargin
|
|
@@ -4874,7 +4720,7 @@ var DataTableBody = ({
|
|
|
4874
4720
|
table,
|
|
4875
4721
|
viewport
|
|
4876
4722
|
}) => {
|
|
4877
|
-
const styles =
|
|
4723
|
+
const styles = useContext(DataTableStylesContext);
|
|
4878
4724
|
const [store] = table;
|
|
4879
4725
|
const model = deriveModel(store);
|
|
4880
4726
|
const fields = getActiveGrouping(store);
|
|
@@ -5040,7 +4886,7 @@ var GalleryCard = ({
|
|
|
5040
4886
|
var DataTableGallery = ({
|
|
5041
4887
|
table
|
|
5042
4888
|
}) => {
|
|
5043
|
-
const styles =
|
|
4889
|
+
const styles = useContext(DataTableStylesContext);
|
|
5044
4890
|
const [store, send] = table;
|
|
5045
4891
|
const model = deriveModel(store);
|
|
5046
4892
|
const fields = getActiveGrouping(store);
|
|
@@ -5144,13 +4990,13 @@ var DataTableGallery = ({
|
|
|
5144
4990
|
var DataTablePagination = ({
|
|
5145
4991
|
table
|
|
5146
4992
|
}) => {
|
|
5147
|
-
const styles =
|
|
4993
|
+
const styles = useContext(DataTableStylesContext);
|
|
5148
4994
|
const [store, send] = table;
|
|
5149
4995
|
const model = deriveModel(store);
|
|
5150
4996
|
const pagination = store.config.features.pagination ?? false;
|
|
5151
4997
|
const { paginationVisible, page } = model;
|
|
5152
4998
|
const pageIndex = store.state.page;
|
|
5153
|
-
|
|
4999
|
+
useLayoutEffect(() => {
|
|
5154
5000
|
if (paginationVisible && pagination && pagination.mode === "client" && pageIndex > page) {
|
|
5155
5001
|
send(DataTableMessage.PageRequested({ page }));
|
|
5156
5002
|
}
|
|
@@ -5178,7 +5024,7 @@ var DataTablePagination = ({
|
|
|
5178
5024
|
};
|
|
5179
5025
|
var ReactTableModel = Component3.define(dataTableOptions).make({
|
|
5180
5026
|
...dataTableBehaviours,
|
|
5181
|
-
view: () =>
|
|
5027
|
+
view: () => View.text("")
|
|
5182
5028
|
});
|
|
5183
5029
|
var modelField = (id, definition) => {
|
|
5184
5030
|
const field = {
|
|
@@ -5275,8 +5121,8 @@ var HydratedDataTable = (props) => {
|
|
|
5275
5121
|
}
|
|
5276
5122
|
}
|
|
5277
5123
|
});
|
|
5278
|
-
const [storageKey] =
|
|
5279
|
-
|
|
5124
|
+
const [storageKey] = useState(() => tablePreferencesKey(globalThis.window?.location.pathname ?? "/", columns.map(({ id }) => id), !!props.features?.gallery));
|
|
5125
|
+
useEffect(() => {
|
|
5280
5126
|
if (!model.preferencesLoaded) {
|
|
5281
5127
|
send(DataTableMessage.PreferencesLoaded({
|
|
5282
5128
|
preferences: readTablePreferences(storageKey)
|
|
@@ -5284,8 +5130,8 @@ var HydratedDataTable = (props) => {
|
|
|
5284
5130
|
}
|
|
5285
5131
|
}, [model, send, storageKey]);
|
|
5286
5132
|
const { columnVisibility, columnSizing, grouping, view, preferencesLoaded } = model;
|
|
5287
|
-
const loadedPreferences =
|
|
5288
|
-
|
|
5133
|
+
const loadedPreferences = useRef(false);
|
|
5134
|
+
useEffect(() => {
|
|
5289
5135
|
const preferences = tablePreferences({
|
|
5290
5136
|
columnVisibility,
|
|
5291
5137
|
columnSizing,
|
|
@@ -5371,7 +5217,7 @@ var TablePlaceholder = ({
|
|
|
5371
5217
|
});
|
|
5372
5218
|
var DataTable = (props) => {
|
|
5373
5219
|
const locale = useKrakstackLocale3(props.locale);
|
|
5374
|
-
const hydrated =
|
|
5220
|
+
const hydrated = useSyncExternalStore(subscribeToHydration, clientSnapshot, serverSnapshot);
|
|
5375
5221
|
if (!hydrated)
|
|
5376
5222
|
return /* @__PURE__ */ jsx15(TablePlaceholder, {
|
|
5377
5223
|
props
|
|
@@ -5391,11 +5237,11 @@ var DataTableContent = ({
|
|
|
5391
5237
|
table
|
|
5392
5238
|
}) => {
|
|
5393
5239
|
const [store] = table;
|
|
5394
|
-
const [scrollElement, setScrollElement] =
|
|
5395
|
-
const [headerHeight, setHeaderHeight] =
|
|
5396
|
-
const [pageTable, setPageTable] =
|
|
5397
|
-
const [pageOffset, setPageOffset] =
|
|
5398
|
-
|
|
5240
|
+
const [scrollElement, setScrollElement] = useState(null);
|
|
5241
|
+
const [headerHeight, setHeaderHeight] = useState(48);
|
|
5242
|
+
const [pageTable, setPageTable] = useState(null);
|
|
5243
|
+
const [pageOffset, setPageOffset] = useState();
|
|
5244
|
+
useLayoutEffect(() => {
|
|
5399
5245
|
const header = pageTable?.querySelector("thead");
|
|
5400
5246
|
if (!pageTable || !header)
|
|
5401
5247
|
return;
|
|
@@ -5410,7 +5256,7 @@ var DataTableContent = ({
|
|
|
5410
5256
|
observer?.disconnect();
|
|
5411
5257
|
};
|
|
5412
5258
|
}, [pageTable]);
|
|
5413
|
-
|
|
5259
|
+
useLayoutEffect(() => {
|
|
5414
5260
|
const header = scrollElement?.querySelector("thead");
|
|
5415
5261
|
if (!header)
|
|
5416
5262
|
return;
|
|
@@ -5533,7 +5379,7 @@ var DataTableContent = ({
|
|
|
5533
5379
|
});
|
|
5534
5380
|
};
|
|
5535
5381
|
var DataTableListCell = (props) => {
|
|
5536
|
-
const tableClasses =
|
|
5382
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5537
5383
|
const locale = useKrakstackLocale3(props.locale);
|
|
5538
5384
|
const resolvedProps = { ...props, locale };
|
|
5539
5385
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
@@ -5595,9 +5441,9 @@ var EditableDataTableListCell = ({
|
|
|
5595
5441
|
locale = "en",
|
|
5596
5442
|
messages
|
|
5597
5443
|
}) => {
|
|
5598
|
-
const tableClasses =
|
|
5599
|
-
const [selected, setSelected] =
|
|
5600
|
-
const [previousItems, setPreviousItems] =
|
|
5444
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5445
|
+
const [selected, setSelected] = useState([...items]);
|
|
5446
|
+
const [previousItems, setPreviousItems] = useState(items);
|
|
5601
5447
|
if (previousItems !== items) {
|
|
5602
5448
|
setPreviousItems(items);
|
|
5603
5449
|
setSelected([...items]);
|
|
@@ -5785,8 +5631,8 @@ var DataTableListAddMenu = ({
|
|
|
5785
5631
|
options,
|
|
5786
5632
|
searchLabel
|
|
5787
5633
|
}) => {
|
|
5788
|
-
const [search, setSearch] =
|
|
5789
|
-
const focusSearch =
|
|
5634
|
+
const [search, setSearch] = useState("");
|
|
5635
|
+
const focusSearch = useCallback((input) => {
|
|
5790
5636
|
input?.focus({ preventScroll: true });
|
|
5791
5637
|
}, []);
|
|
5792
5638
|
const labels = dataTableMessages(locale, messages);
|
|
@@ -5963,12 +5809,13 @@ var DataTableListEntry = ({
|
|
|
5963
5809
|
import { Check as Check2, Copy, TriangleAlert } from "lucide-react";
|
|
5964
5810
|
import { Redacted as Redacted3 } from "effect";
|
|
5965
5811
|
import { Component as Component5 } from "effect/ui";
|
|
5966
|
-
import { useLayoutEffect as
|
|
5812
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
5967
5813
|
import { useKrakstackLocale as useKrakstackLocale4 } from "@krak-stack/registry/krakstack-provider/react";
|
|
5814
|
+
import { useModel as useModel2 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
5968
5815
|
|
|
5969
5816
|
// ../../src/components/copy-button/index.ts
|
|
5970
|
-
import { Effect as
|
|
5971
|
-
import { Command as Command2, Component as Component4, UiSchema as UiSchema3, View as
|
|
5817
|
+
import { Effect as Effect3, Redacted as Redacted2, Schema as Schema8 } from "effect";
|
|
5818
|
+
import { Command as Command2, Component as Component4, UiSchema as UiSchema3, View as View2 } from "effect/ui";
|
|
5972
5819
|
|
|
5973
5820
|
// ../../src/components/copy-button/schema.ts
|
|
5974
5821
|
import { Schema as Schema7 } from "effect";
|
|
@@ -6023,13 +5870,13 @@ class WriteClipboard extends Command2.Service()("copy-button/WriteClipboard", {
|
|
|
6023
5870
|
},
|
|
6024
5871
|
success: CopyButtonMessage
|
|
6025
5872
|
}) {
|
|
6026
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) =>
|
|
5873
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect3.tryPromise(() => write(Redacted2.value(value))).pipe(Effect3.match({
|
|
6027
5874
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
6028
5875
|
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
6029
5876
|
})));
|
|
6030
5877
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
6031
5878
|
}
|
|
6032
|
-
var ResetClipboardFeedback = Command2.make("copy-button/ResetFeedback", { args: { delay: Schema8.Number }, mode: "switch" }, ({ delay }) =>
|
|
5879
|
+
var ResetClipboardFeedback = Command2.make("copy-button/ResetFeedback", { args: { delay: Schema8.Number }, mode: "switch" }, ({ delay }) => Effect3.sleep(Math.max(0, delay)).pipe(Effect3.as(CopyButtonMessage.Reset())));
|
|
6033
5880
|
var copyButtonOptions = {
|
|
6034
5881
|
name: "CopyButton",
|
|
6035
5882
|
props: CopyButtonModelProps,
|
|
@@ -6051,7 +5898,7 @@ var copyButtonBehaviours = {
|
|
|
6051
5898
|
};
|
|
6052
5899
|
var CopyButtonModel = Definition.make({
|
|
6053
5900
|
...copyButtonBehaviours,
|
|
6054
|
-
view: () =>
|
|
5901
|
+
view: () => View2.text("")
|
|
6055
5902
|
});
|
|
6056
5903
|
var copyButtonStatus = (status, copy, description) => {
|
|
6057
5904
|
if (status === "idle")
|
|
@@ -6079,19 +5926,19 @@ function CopyButton({
|
|
|
6079
5926
|
}) {
|
|
6080
5927
|
const locale = useKrakstackLocale4(localeOverride);
|
|
6081
5928
|
const labels = copyButtonMessages(locale, messages);
|
|
6082
|
-
const callbacks =
|
|
5929
|
+
const callbacks = useRef2({
|
|
6083
5930
|
onCopied,
|
|
6084
5931
|
onCopyError,
|
|
6085
5932
|
failureLabel: labels.copyFailed
|
|
6086
5933
|
});
|
|
6087
|
-
|
|
5934
|
+
useLayoutEffect2(() => {
|
|
6088
5935
|
callbacks.current = {
|
|
6089
5936
|
onCopied,
|
|
6090
5937
|
onCopyError,
|
|
6091
5938
|
failureLabel: labels.copyFailed
|
|
6092
5939
|
};
|
|
6093
5940
|
}, [onCopied, onCopyError, labels.copyFailed]);
|
|
6094
|
-
const [component] =
|
|
5941
|
+
const [component] = useState2(() => CopyButtonModel.pipe(Component5.provide(WriteClipboard.layerFromWrite(async (text) => {
|
|
6095
5942
|
const { onCopied, onCopyError, failureLabel } = callbacks.current;
|
|
6096
5943
|
try {
|
|
6097
5944
|
await navigator.clipboard.writeText(text);
|
|
@@ -6104,7 +5951,7 @@ function CopyButton({
|
|
|
6104
5951
|
const {
|
|
6105
5952
|
model: { status },
|
|
6106
5953
|
send
|
|
6107
|
-
} =
|
|
5954
|
+
} = useModel2(component, {
|
|
6108
5955
|
value: Redacted3.make(value),
|
|
6109
5956
|
disabled: disabled ?? false,
|
|
6110
5957
|
resetDelay
|
|
@@ -6324,6 +6171,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
6324
6171
|
|
|
6325
6172
|
// ../../src/components/webhook-delivery-table/react.tsx
|
|
6326
6173
|
import { useKrakstackLocale as useKrakstackLocale6 } from "@krak-stack/registry/krakstack-provider/react";
|
|
6174
|
+
import { useModel as useModel3 } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
6327
6175
|
|
|
6328
6176
|
// ../../src/components/webhook-delivery-table/index.ts
|
|
6329
6177
|
import { Schema as Schema10 } from "effect";
|
|
@@ -6490,7 +6338,7 @@ var webhookDeliveryTableBehaviours = {
|
|
|
6490
6338
|
import { jsx as jsx19, jsxs as jsxs13, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
6491
6339
|
var DeliveryTableModel = Component7.define(webhookDeliveryTableOptions).make({
|
|
6492
6340
|
...webhookDeliveryTableBehaviours,
|
|
6493
|
-
view: () =>
|
|
6341
|
+
view: () => View3.text("")
|
|
6494
6342
|
});
|
|
6495
6343
|
var WebhookDeliveryTable = ({
|
|
6496
6344
|
entries,
|
|
@@ -6505,7 +6353,7 @@ var WebhookDeliveryTable = ({
|
|
|
6505
6353
|
}) => {
|
|
6506
6354
|
const locale = useKrakstackLocale6(localeOverride);
|
|
6507
6355
|
const labels = webhookDeliveryMessages(locale, messages);
|
|
6508
|
-
const { model, send } =
|
|
6356
|
+
const { model, send } = useModel3(DeliveryTableModel, {
|
|
6509
6357
|
entries,
|
|
6510
6358
|
rowCount,
|
|
6511
6359
|
query: { page: state?.page ?? 0, pageSize: state?.pageSize ?? 20 }
|