@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,5 +1,5 @@
|
|
|
1
1
|
// ../../src/components/timezone-input/react.tsx
|
|
2
|
-
import { useId, useMemo, useSyncExternalStore
|
|
2
|
+
import { useId, useMemo, useSyncExternalStore } from "react";
|
|
3
3
|
|
|
4
4
|
// ../../src/components/ui/button.tsx
|
|
5
5
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
@@ -634,165 +634,11 @@ var TimezoneSelectPropsSchema = Schema3.Struct({
|
|
|
634
634
|
}).annotate({ identifier: "TimezoneSelectProps" });
|
|
635
635
|
|
|
636
636
|
// ../../src/components/timezone-input/react.tsx
|
|
637
|
-
import { Component as Component3, View
|
|
638
|
-
|
|
639
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
640
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
641
|
-
import {
|
|
642
|
-
createContext,
|
|
643
|
-
useCallback as useCallback2,
|
|
644
|
-
useContext,
|
|
645
|
-
useEffect as useEffect2,
|
|
646
|
-
useLayoutEffect,
|
|
647
|
-
useRef as useRef2,
|
|
648
|
-
useState,
|
|
649
|
-
useSyncExternalStore
|
|
650
|
-
} from "react";
|
|
651
|
-
|
|
652
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
653
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
654
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
655
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
656
|
-
var node = () => ({ children: [] });
|
|
657
|
-
var modelHost = (commit) => {
|
|
658
|
-
const remove = (child) => {
|
|
659
|
-
if (!child.parent)
|
|
660
|
-
return;
|
|
661
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
662
|
-
delete child.parent;
|
|
663
|
-
};
|
|
664
|
-
return {
|
|
665
|
-
createElement: node,
|
|
666
|
-
createText: node,
|
|
667
|
-
setText: () => {},
|
|
668
|
-
setAttr: () => {},
|
|
669
|
-
setProp: () => {},
|
|
670
|
-
setEvents: () => {},
|
|
671
|
-
insertBefore: (parent, child, before) => {
|
|
672
|
-
if (child === before)
|
|
673
|
-
return;
|
|
674
|
-
remove(child);
|
|
675
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
676
|
-
parent.children.splice(index, 0, child);
|
|
677
|
-
child.parent = parent;
|
|
678
|
-
},
|
|
679
|
-
remove,
|
|
680
|
-
parentOf: (child) => child.parent,
|
|
681
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
682
|
-
elements: ["html"],
|
|
683
|
-
controlled: new Set,
|
|
684
|
-
runsMounts: false,
|
|
685
|
-
commit
|
|
686
|
-
};
|
|
687
|
-
};
|
|
688
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
689
|
-
let currentProps = props;
|
|
690
|
-
let root;
|
|
691
|
-
let active = true;
|
|
692
|
-
let failure;
|
|
693
|
-
const publish = () => {
|
|
694
|
-
if (!active)
|
|
695
|
-
return;
|
|
696
|
-
if (failure) {
|
|
697
|
-
publishSnapshot({ error: failure });
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
const current = root?.model();
|
|
701
|
-
if (current !== undefined)
|
|
702
|
-
publishSnapshot({ model: current });
|
|
703
|
-
};
|
|
704
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
705
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
706
|
-
head: false,
|
|
707
|
-
onEmit,
|
|
708
|
-
fallback: ({ cause }) => {
|
|
709
|
-
failure = new Error("Effect UI root failed", {
|
|
710
|
-
cause: Cause.squash(cause)
|
|
711
|
-
});
|
|
712
|
-
return View.text("");
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
if (!active)
|
|
716
|
-
return;
|
|
717
|
-
root = mounted;
|
|
718
|
-
if (props !== currentProps)
|
|
719
|
-
mounted.setProps(currentProps);
|
|
720
|
-
publish();
|
|
721
|
-
return yield* Effect.never;
|
|
722
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
723
|
-
return {
|
|
724
|
-
send: (message) => {
|
|
725
|
-
root?.send(message);
|
|
726
|
-
publish();
|
|
727
|
-
},
|
|
728
|
-
setProps: (next) => {
|
|
729
|
-
currentProps = next;
|
|
730
|
-
root?.setProps(next);
|
|
731
|
-
},
|
|
732
|
-
dispose: () => {
|
|
733
|
-
active = false;
|
|
734
|
-
root = undefined;
|
|
735
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
741
|
-
"use client";
|
|
742
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
743
|
-
var useModel = (component, props, options = {}) => {
|
|
744
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
745
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
746
|
-
const [store] = useState(() => {
|
|
747
|
-
const initial = { model: component.init(props).model };
|
|
748
|
-
let snapshot = initial;
|
|
749
|
-
const listeners = new Set;
|
|
750
|
-
return {
|
|
751
|
-
subscribe: (listener) => {
|
|
752
|
-
listeners.add(listener);
|
|
753
|
-
return () => {
|
|
754
|
-
listeners.delete(listener);
|
|
755
|
-
};
|
|
756
|
-
},
|
|
757
|
-
getSnapshot: () => snapshot,
|
|
758
|
-
getServerSnapshot: () => initial,
|
|
759
|
-
publish: (next) => {
|
|
760
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
761
|
-
return;
|
|
762
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
763
|
-
return;
|
|
764
|
-
snapshot = next;
|
|
765
|
-
listeners.forEach((listener) => listener());
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
});
|
|
769
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
770
|
-
const committed = useRef2(props);
|
|
771
|
-
const onEmit = useRef2(options.onEmit);
|
|
772
|
-
const runtime = useRef2(undefined);
|
|
773
|
-
const send = useCallback2((message) => runtime.current?.send(message), []);
|
|
774
|
-
useLayoutEffect(() => {
|
|
775
|
-
onEmit.current = options.onEmit;
|
|
776
|
-
committed.current = props;
|
|
777
|
-
runtime.current?.setProps(props);
|
|
778
|
-
}, [props, options.onEmit]);
|
|
779
|
-
useEffect2(() => {
|
|
780
|
-
if (messageLog === null)
|
|
781
|
-
return;
|
|
782
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
783
|
-
runtime.current = mounted;
|
|
784
|
-
return () => {
|
|
785
|
-
runtime.current = undefined;
|
|
786
|
-
mounted.dispose();
|
|
787
|
-
};
|
|
788
|
-
}, [component, messageLog, store]);
|
|
789
|
-
if ("error" in snapshot)
|
|
790
|
-
throw snapshot.error;
|
|
791
|
-
return { model: snapshot.model, send };
|
|
792
|
-
};
|
|
637
|
+
import { Component as Component3, View } from "effect/ui";
|
|
638
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
793
639
|
|
|
794
640
|
// ../../src/components/timezone-input/index.ts
|
|
795
|
-
import { Effect
|
|
641
|
+
import { Effect, Schema as Schema4, Stream } from "effect";
|
|
796
642
|
import { Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
797
643
|
var defaultMessages2 = {
|
|
798
644
|
en: {
|
|
@@ -1086,12 +932,12 @@ var timezoneSelectBehaviours = {
|
|
|
1086
932
|
init: () => ({ timestamp: null, detected: null, search: "" }),
|
|
1087
933
|
update: update2,
|
|
1088
934
|
subscriptions: ({ props }) => {
|
|
1089
|
-
const tick =
|
|
935
|
+
const tick = Effect.sync(() => TimezoneSelectMessage.Ticked({
|
|
1090
936
|
timestamp: currentMinute(),
|
|
1091
937
|
detected: browserTimeZone()
|
|
1092
938
|
}));
|
|
1093
939
|
return [
|
|
1094
|
-
Subscription.make("timezone-clock", !!props.referenceTime, (fixed) => fixed ? Stream.fromEffect(tick) : Stream.fromEffect(tick).pipe(Stream.concat(Stream.fromEffect(tick.pipe(
|
|
940
|
+
Subscription.make("timezone-clock", !!props.referenceTime, (fixed) => fixed ? Stream.fromEffect(tick) : Stream.fromEffect(tick).pipe(Stream.concat(Stream.fromEffect(tick.pipe(Effect.delay("15 seconds"))).pipe(Stream.forever))))
|
|
1095
941
|
];
|
|
1096
942
|
}
|
|
1097
943
|
};
|
|
@@ -1101,7 +947,7 @@ import { jsx as jsx5, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-run
|
|
|
1101
947
|
var TimezoneSelectModel = Component3.define(timezoneSelectOptions).make({
|
|
1102
948
|
init: timezoneSelectBehaviours.init,
|
|
1103
949
|
update: timezoneSelectBehaviours.update,
|
|
1104
|
-
view: () =>
|
|
950
|
+
view: () => View.text("")
|
|
1105
951
|
});
|
|
1106
952
|
var subscribeClock = (notify) => {
|
|
1107
953
|
const timer = setInterval(notify, 15000);
|
|
@@ -1132,8 +978,8 @@ var TimezoneInput = ({
|
|
|
1132
978
|
model: { search },
|
|
1133
979
|
send
|
|
1134
980
|
} = useModel(TimezoneSelectModel, { value, referenceTime });
|
|
1135
|
-
const detected =
|
|
1136
|
-
const clock =
|
|
981
|
+
const detected = useSyncExternalStore(noSubscription, browserTimeZone, noTime);
|
|
982
|
+
const clock = useSyncExternalStore(referenceTime ? noSubscription : subscribeClock, currentMinute, noTime);
|
|
1137
983
|
const referenceValid = !referenceTime || isTimeZoneReferenceDate(referenceTime);
|
|
1138
984
|
const timestamp = referenceTime ? referenceValid ? referenceTime.getTime() : null : clock;
|
|
1139
985
|
const baselineZone = comparisonTimeZone === undefined ? detected : comparisonTimeZone;
|