@powerhousedao/powerhouse-vetra-packages 6.2.3 → 6.3.0-dev.1
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/dist/browser/document-models/index.js +1 -1
- package/dist/browser/documents-cxt8RRxe.js +18 -0
- package/dist/browser/documents-cxt8RRxe.js.map +1 -0
- package/dist/browser/editor-DXAJ8Mqb.js +2293 -0
- package/dist/browser/editor-DXAJ8Mqb.js.map +1 -0
- package/dist/browser/{editor-CiR6XQBO.js → editor-Dmpkd8pQ.js} +3 -3
- package/dist/browser/{editor-CiR6XQBO.js.map → editor-Dmpkd8pQ.js.map} +1 -1
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/document-model-editor/module.js.map +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +4 -340
- package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/folder-view-CwIU4XEe.js +237 -0
- package/dist/browser/folder-view-CwIU4XEe.js.map +1 -0
- package/dist/browser/graphql-editor-CGxwONKl.js +103 -0
- package/dist/browser/graphql-editor-CGxwONKl.js.map +1 -0
- package/dist/browser/hooks-D15NCia0.js +126 -0
- package/dist/browser/hooks-D15NCia0.js.map +1 -0
- package/dist/browser/index.js +5 -805
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/json-editor--jgLEwP2.js +55 -0
- package/dist/browser/json-editor--jgLEwP2.js.map +1 -0
- package/dist/browser/schema-context-CC_WFs1x.js +73 -0
- package/dist/browser/schema-context-CC_WFs1x.js.map +1 -0
- package/dist/browser/state-schemas-DSY44MOd.js +307 -0
- package/dist/browser/state-schemas-DSY44MOd.js.map +1 -0
- package/dist/node/bundle-mjs-Cuu3DEfT.mjs +3140 -0
- package/dist/node/bundle-mjs-Cuu3DEfT.mjs.map +1 -0
- package/dist/node/{graphql-Dp4j7rmx.mjs → documents-DH2fyf7U.mjs} +32 -3
- package/dist/node/documents-DH2fyf7U.mjs.map +1 -0
- package/dist/node/{editor-96sMeumV.mjs → editor-BcvUeBW7.mjs} +2902 -2738
- package/dist/node/editor-BcvUeBW7.mjs.map +1 -0
- package/dist/node/editor-DJCghViS.mjs +983 -0
- package/dist/node/editor-DJCghViS.mjs.map +1 -0
- package/dist/node/editors/index.mjs +23 -2
- package/dist/node/editors/index.mjs.map +1 -0
- package/dist/node/{graphql-editor-CBJXEY_C.mjs → graphql-editor-u9NStKLL.mjs} +5078 -26
- package/dist/node/graphql-editor-u9NStKLL.mjs.map +1 -0
- package/dist/{browser/hooks-eQxBX7g4.js → node/hooks-BiLz75cj.mjs} +2 -2
- package/dist/node/{hooks-C2b46djt.mjs.map → hooks-BiLz75cj.mjs.map} +1 -1
- package/dist/node/index.mjs +12 -189
- package/dist/node/index.mjs.map +1 -1
- package/dist/{browser/json-editor-DfRD-pfk.js → node/json-editor-BfcrckeT.mjs} +3 -3
- package/dist/node/{json-editor-DaqHARBD.mjs.map → json-editor-BfcrckeT.mjs.map} +1 -1
- package/dist/node/{schema-context-CojjnSE6.mjs → schema-context-r0MTQnRC.mjs} +6 -4
- package/dist/node/schema-context-r0MTQnRC.mjs.map +1 -0
- package/dist/node/{state-schemas-BHuo0GPl.mjs → state-schemas-o3PZdBW2.mjs} +427 -54
- package/dist/node/state-schemas-o3PZdBW2.mjs.map +1 -0
- package/package.json +21 -19
- package/style.css +2 -0
- package/dist/browser/assets/entry-D62sYiFV.js +0 -318
- package/dist/browser/assets/projection-entry-BGcu_9-p.js +0 -446
- package/dist/browser/documents-CRzouuNR.js +0 -6067
- package/dist/browser/documents-CRzouuNR.js.map +0 -1
- package/dist/browser/editor-C7KBR_ar.js +0 -4676
- package/dist/browser/editor-C7KBR_ar.js.map +0 -1
- package/dist/browser/folder-view-DSgXN79D.js +0 -4409
- package/dist/browser/folder-view-DSgXN79D.js.map +0 -1
- package/dist/browser/graphql-editor-Cgi5UOrF.js +0 -11708
- package/dist/browser/graphql-editor-Cgi5UOrF.js.map +0 -1
- package/dist/browser/hooks-eQxBX7g4.js.map +0 -1
- package/dist/browser/json-editor-DfRD-pfk.js.map +0 -1
- package/dist/browser/parser-DtbeHA3H.js +0 -2554
- package/dist/browser/parser-DtbeHA3H.js.map +0 -1
- package/dist/browser/rolldown-runtime-DC62tzP2.js +0 -33
- package/dist/browser/src-CrUksCLW-B2dkRdgq.js +0 -5254
- package/dist/browser/src-CrUksCLW-B2dkRdgq.js.map +0 -1
- package/dist/browser/state-schemas-B5Bk_l1s.js +0 -696
- package/dist/browser/state-schemas-B5Bk_l1s.js.map +0 -1
- package/dist/browser/tslib.es6-Cno80yFJ.js +0 -32
- package/dist/browser/tslib.es6-Cno80yFJ.js.map +0 -1
- package/dist/node/documents-D70S9PZL.mjs +0 -17
- package/dist/node/documents-D70S9PZL.mjs.map +0 -1
- package/dist/node/editor-96sMeumV.mjs.map +0 -1
- package/dist/node/editor-wqvKwcO5.mjs +0 -24
- package/dist/node/editor-wqvKwcO5.mjs.map +0 -1
- package/dist/node/editors/document-model-editor/index.mjs +0 -1
- package/dist/node/editors/document-model-editor/module.mjs +0 -14
- package/dist/node/editors/document-model-editor/module.mjs.map +0 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +0 -461
- package/dist/node/editors/generic-drive-explorer/index.mjs.map +0 -1
- package/dist/node/editors/generic-drive-explorer/module.mjs +0 -14
- package/dist/node/editors/generic-drive-explorer/module.mjs.map +0 -1
- package/dist/node/folder-view-ktfv2Cvw.mjs +0 -4409
- package/dist/node/folder-view-ktfv2Cvw.mjs.map +0 -1
- package/dist/node/graphql-Dp4j7rmx.mjs.map +0 -1
- package/dist/node/graphql-editor-CBJXEY_C.mjs.map +0 -1
- package/dist/node/hooks-C2b46djt.mjs +0 -24593
- package/dist/node/json-editor-DaqHARBD.mjs +0 -153
- package/dist/node/schema-context-CojjnSE6.mjs.map +0 -1
- package/dist/node/src-CrUksCLW-TvF37aMo.mjs +0 -5935
- package/dist/node/src-CrUksCLW-TvF37aMo.mjs.map +0 -1
- package/dist/node/state-schemas-BHuo0GPl.mjs.map +0 -1
- package/dist/node/tslib.es6-VORZjfk3.mjs +0 -583
- package/dist/node/tslib.es6-VORZjfk3.mjs.map +0 -1
|
@@ -1,696 +0,0 @@
|
|
|
1
|
-
import { c as Kind } from "./parser-DtbeHA3H.js";
|
|
2
|
-
import { r as typeDefsDoc } from "./documents-CRzouuNR.js";
|
|
3
|
-
import { a as Presence, c as Primitive, d as createContextScope, f as useComposedRefs, l as createSlot, m as twMerge, o as useId$1, p as composeEventHandlers, s as useCallbackRef, u as useControllableState } from "./src-CrUksCLW-B2dkRdgq.js";
|
|
4
|
-
import { a as makeInitialSchemaDoc, c as validateStateObject, i as StateValidationError, l as safeParseSdl, n as Button, o as makeMinimalObjectForStateType, r as ensureValidStateSchemaName, s as makeStateSchemaNameForScope, u as useSchemaContext } from "./editor-C7KBR_ar.js";
|
|
5
|
-
import * as React$1 from "react";
|
|
6
|
-
import React, { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
//#region ../../node_modules/.pnpm/@radix-ui+react-collection@1.1.7_@types+react-dom@19.2.3_@types+react@19.2.14__@types+r_b94f5365b88697a700662930c56ccffc/node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
9
|
-
function createCollection(name) {
|
|
10
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
11
|
-
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
12
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
13
|
-
collectionRef: { current: null },
|
|
14
|
-
itemMap: /* @__PURE__ */ new Map()
|
|
15
|
-
});
|
|
16
|
-
const CollectionProvider = (props) => {
|
|
17
|
-
const { scope, children } = props;
|
|
18
|
-
const ref = React.useRef(null);
|
|
19
|
-
const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
|
|
20
|
-
return /* @__PURE__ */ jsx(CollectionProviderImpl, {
|
|
21
|
-
scope,
|
|
22
|
-
itemMap,
|
|
23
|
-
collectionRef: ref,
|
|
24
|
-
children
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
28
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
29
|
-
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
30
|
-
const CollectionSlot = React.forwardRef((props, forwardedRef) => {
|
|
31
|
-
const { scope, children } = props;
|
|
32
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
33
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
34
|
-
return /* @__PURE__ */ jsx(CollectionSlotImpl, {
|
|
35
|
-
ref: composedRefs,
|
|
36
|
-
children
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
40
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
41
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
42
|
-
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
43
|
-
const CollectionItemSlot = React.forwardRef((props, forwardedRef) => {
|
|
44
|
-
const { scope, children, ...itemData } = props;
|
|
45
|
-
const ref = React.useRef(null);
|
|
46
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
47
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
context.itemMap.set(ref, {
|
|
50
|
-
ref,
|
|
51
|
-
...itemData
|
|
52
|
-
});
|
|
53
|
-
return () => void context.itemMap.delete(ref);
|
|
54
|
-
});
|
|
55
|
-
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, {
|
|
56
|
-
[ITEM_DATA_ATTR]: "",
|
|
57
|
-
ref: composedRefs,
|
|
58
|
-
children
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
62
|
-
function useCollection(scope) {
|
|
63
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
64
|
-
return React.useCallback(() => {
|
|
65
|
-
const collectionNode = context.collectionRef.current;
|
|
66
|
-
if (!collectionNode) return [];
|
|
67
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
68
|
-
return Array.from(context.itemMap.values()).sort((a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current));
|
|
69
|
-
}, [context.collectionRef, context.itemMap]);
|
|
70
|
-
}
|
|
71
|
-
return [
|
|
72
|
-
{
|
|
73
|
-
Provider: CollectionProvider,
|
|
74
|
-
Slot: CollectionSlot,
|
|
75
|
-
ItemSlot: CollectionItemSlot
|
|
76
|
-
},
|
|
77
|
-
useCollection,
|
|
78
|
-
createCollectionScope
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region ../../node_modules/.pnpm/@radix-ui+react-direction@1.1.1_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
83
|
-
var DirectionContext = React$1.createContext(void 0);
|
|
84
|
-
function useDirection(localDir) {
|
|
85
|
-
const globalDir = React$1.useContext(DirectionContext);
|
|
86
|
-
return localDir || globalDir || "ltr";
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region ../../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14__@type_b849ea542e77d5b397b1fe12d9f00b2e/node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
90
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
91
|
-
var EVENT_OPTIONS = {
|
|
92
|
-
bubbles: false,
|
|
93
|
-
cancelable: true
|
|
94
|
-
};
|
|
95
|
-
var GROUP_NAME = "RovingFocusGroup";
|
|
96
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
97
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(GROUP_NAME, [createCollectionScope]);
|
|
98
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
99
|
-
var RovingFocusGroup = React$1.forwardRef((props, forwardedRef) => {
|
|
100
|
-
return /* @__PURE__ */ jsx(Collection.Provider, {
|
|
101
|
-
scope: props.__scopeRovingFocusGroup,
|
|
102
|
-
children: /* @__PURE__ */ jsx(Collection.Slot, {
|
|
103
|
-
scope: props.__scopeRovingFocusGroup,
|
|
104
|
-
children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, {
|
|
105
|
-
...props,
|
|
106
|
-
ref: forwardedRef
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
RovingFocusGroup.displayName = GROUP_NAME;
|
|
112
|
-
var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
113
|
-
const { __scopeRovingFocusGroup, orientation, loop = false, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, preventScrollOnEntryFocus = false, ...groupProps } = props;
|
|
114
|
-
const ref = React$1.useRef(null);
|
|
115
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
116
|
-
const direction = useDirection(dir);
|
|
117
|
-
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
118
|
-
prop: currentTabStopIdProp,
|
|
119
|
-
defaultProp: defaultCurrentTabStopId ?? null,
|
|
120
|
-
onChange: onCurrentTabStopIdChange,
|
|
121
|
-
caller: GROUP_NAME
|
|
122
|
-
});
|
|
123
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React$1.useState(false);
|
|
124
|
-
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
125
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
126
|
-
const isClickFocusRef = React$1.useRef(false);
|
|
127
|
-
const [focusableItemsCount, setFocusableItemsCount] = React$1.useState(0);
|
|
128
|
-
React$1.useEffect(() => {
|
|
129
|
-
const node = ref.current;
|
|
130
|
-
if (node) {
|
|
131
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
132
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
133
|
-
}
|
|
134
|
-
}, [handleEntryFocus]);
|
|
135
|
-
return /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
136
|
-
scope: __scopeRovingFocusGroup,
|
|
137
|
-
orientation,
|
|
138
|
-
dir: direction,
|
|
139
|
-
loop,
|
|
140
|
-
currentTabStopId,
|
|
141
|
-
onItemFocus: React$1.useCallback((tabStopId) => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]),
|
|
142
|
-
onItemShiftTab: React$1.useCallback(() => setIsTabbingBackOut(true), []),
|
|
143
|
-
onFocusableItemAdd: React$1.useCallback(() => setFocusableItemsCount((prevCount) => prevCount + 1), []),
|
|
144
|
-
onFocusableItemRemove: React$1.useCallback(() => setFocusableItemsCount((prevCount) => prevCount - 1), []),
|
|
145
|
-
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
146
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
147
|
-
"data-orientation": orientation,
|
|
148
|
-
...groupProps,
|
|
149
|
-
ref: composedRefs,
|
|
150
|
-
style: {
|
|
151
|
-
outline: "none",
|
|
152
|
-
...props.style
|
|
153
|
-
},
|
|
154
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
155
|
-
isClickFocusRef.current = true;
|
|
156
|
-
}),
|
|
157
|
-
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
158
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
159
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
160
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
161
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
162
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
163
|
-
const items = getItems().filter((item) => item.focusable);
|
|
164
|
-
focusFirst([
|
|
165
|
-
items.find((item) => item.active),
|
|
166
|
-
items.find((item) => item.id === currentTabStopId),
|
|
167
|
-
...items
|
|
168
|
-
].filter(Boolean).map((item) => item.ref.current), preventScrollOnEntryFocus);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
isClickFocusRef.current = false;
|
|
172
|
-
}),
|
|
173
|
-
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
174
|
-
})
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
var ITEM_NAME = "RovingFocusGroupItem";
|
|
178
|
-
var RovingFocusGroupItem = React$1.forwardRef((props, forwardedRef) => {
|
|
179
|
-
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
|
|
180
|
-
const autoId = useId$1();
|
|
181
|
-
const id = tabStopId || autoId;
|
|
182
|
-
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
183
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
184
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
185
|
-
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
186
|
-
React$1.useEffect(() => {
|
|
187
|
-
if (focusable) {
|
|
188
|
-
onFocusableItemAdd();
|
|
189
|
-
return () => onFocusableItemRemove();
|
|
190
|
-
}
|
|
191
|
-
}, [
|
|
192
|
-
focusable,
|
|
193
|
-
onFocusableItemAdd,
|
|
194
|
-
onFocusableItemRemove
|
|
195
|
-
]);
|
|
196
|
-
return /* @__PURE__ */ jsx(Collection.ItemSlot, {
|
|
197
|
-
scope: __scopeRovingFocusGroup,
|
|
198
|
-
id,
|
|
199
|
-
focusable,
|
|
200
|
-
active,
|
|
201
|
-
children: /* @__PURE__ */ jsx(Primitive.span, {
|
|
202
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
203
|
-
"data-orientation": context.orientation,
|
|
204
|
-
...itemProps,
|
|
205
|
-
ref: forwardedRef,
|
|
206
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
207
|
-
if (!focusable) event.preventDefault();
|
|
208
|
-
else context.onItemFocus(id);
|
|
209
|
-
}),
|
|
210
|
-
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
211
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
212
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
213
|
-
context.onItemShiftTab();
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (event.target !== event.currentTarget) return;
|
|
217
|
-
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
218
|
-
if (focusIntent !== void 0) {
|
|
219
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
220
|
-
event.preventDefault();
|
|
221
|
-
let candidateNodes = getItems().filter((item) => item.focusable).map((item) => item.ref.current);
|
|
222
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
223
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
224
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
225
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
226
|
-
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
227
|
-
}
|
|
228
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
229
|
-
}
|
|
230
|
-
}),
|
|
231
|
-
children: typeof children === "function" ? children({
|
|
232
|
-
isCurrentTabStop,
|
|
233
|
-
hasTabStop: currentTabStopId != null
|
|
234
|
-
}) : children
|
|
235
|
-
})
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
239
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
240
|
-
ArrowLeft: "prev",
|
|
241
|
-
ArrowUp: "prev",
|
|
242
|
-
ArrowRight: "next",
|
|
243
|
-
ArrowDown: "next",
|
|
244
|
-
PageUp: "first",
|
|
245
|
-
Home: "first",
|
|
246
|
-
PageDown: "last",
|
|
247
|
-
End: "last"
|
|
248
|
-
};
|
|
249
|
-
function getDirectionAwareKey(key, dir) {
|
|
250
|
-
if (dir !== "rtl") return key;
|
|
251
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
252
|
-
}
|
|
253
|
-
function getFocusIntent(event, orientation, dir) {
|
|
254
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
255
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
256
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
257
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
258
|
-
}
|
|
259
|
-
function focusFirst(candidates, preventScroll = false) {
|
|
260
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
261
|
-
for (const candidate of candidates) {
|
|
262
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
263
|
-
candidate.focus({ preventScroll });
|
|
264
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function wrapArray(array, startIndex) {
|
|
268
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
269
|
-
}
|
|
270
|
-
var Root = RovingFocusGroup;
|
|
271
|
-
var Item = RovingFocusGroupItem;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region editors/document-model-editor/components/state-error.tsx
|
|
274
|
-
function StateValidationErrorMessage({ error }) {
|
|
275
|
-
const { payload } = error;
|
|
276
|
-
switch (payload.kind) {
|
|
277
|
-
case "MISSING": return /* @__PURE__ */ jsxs("span", { children: [
|
|
278
|
-
"Field ",
|
|
279
|
-
/* @__PURE__ */ jsx("strong", { children: payload.field }),
|
|
280
|
-
" is missing."
|
|
281
|
-
] });
|
|
282
|
-
case "MISSING_OPTIONAL": return /* @__PURE__ */ jsxs("span", { children: [
|
|
283
|
-
"Optional field ",
|
|
284
|
-
/* @__PURE__ */ jsx("strong", { children: payload.field }),
|
|
285
|
-
" is not defined."
|
|
286
|
-
] });
|
|
287
|
-
case "UNKNOWN_FIELD": return /* @__PURE__ */ jsxs("span", { children: [
|
|
288
|
-
"Field ",
|
|
289
|
-
/* @__PURE__ */ jsx("strong", { children: payload.field }),
|
|
290
|
-
" is not a known field."
|
|
291
|
-
] });
|
|
292
|
-
case "NON_NULL": return /* @__PURE__ */ jsxs("span", { children: [
|
|
293
|
-
"Field ",
|
|
294
|
-
/* @__PURE__ */ jsx("strong", { children: payload.field }),
|
|
295
|
-
" cannot be null."
|
|
296
|
-
] });
|
|
297
|
-
case "TYPE": return /* @__PURE__ */ jsxs("span", { children: [
|
|
298
|
-
"Field ",
|
|
299
|
-
/* @__PURE__ */ jsx("strong", { children: payload.field }),
|
|
300
|
-
payload.expectedType ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
301
|
-
" ",
|
|
302
|
-
"must be a",
|
|
303
|
-
" ",
|
|
304
|
-
/* @__PURE__ */ jsx("strong", { children: payload.expectedType.replace(/!/g, "") }),
|
|
305
|
-
"."
|
|
306
|
-
] }) : /* @__PURE__ */ jsx(Fragment, { children: " has an invalid value." })
|
|
307
|
-
] });
|
|
308
|
-
case "RECURSIVE_TYPE": return /* @__PURE__ */ jsxs("span", { children: [
|
|
309
|
-
"Field ",
|
|
310
|
-
/* @__PURE__ */ jsx("strong", { children: payload.typeName }),
|
|
311
|
-
" has a recursive type. It must be optional."
|
|
312
|
-
] });
|
|
313
|
-
default: return /* @__PURE__ */ jsx("span", { children: "Invalid value." });
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region ../../node_modules/.pnpm/@radix-ui+react-tabs@1.1.13_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@_08684373bbac196273bdefb5472f93a8/node_modules/@radix-ui/react-tabs/dist/index.mjs
|
|
318
|
-
var TABS_NAME = "Tabs";
|
|
319
|
-
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [createRovingFocusGroupScope]);
|
|
320
|
-
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
321
|
-
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
|
|
322
|
-
var Tabs$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
323
|
-
const { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", ...tabsProps } = props;
|
|
324
|
-
const direction = useDirection(dir);
|
|
325
|
-
const [value, setValue] = useControllableState({
|
|
326
|
-
prop: valueProp,
|
|
327
|
-
onChange: onValueChange,
|
|
328
|
-
defaultProp: defaultValue ?? "",
|
|
329
|
-
caller: TABS_NAME
|
|
330
|
-
});
|
|
331
|
-
return /* @__PURE__ */ jsx(TabsProvider, {
|
|
332
|
-
scope: __scopeTabs,
|
|
333
|
-
baseId: useId$1(),
|
|
334
|
-
value,
|
|
335
|
-
onValueChange: setValue,
|
|
336
|
-
orientation,
|
|
337
|
-
dir: direction,
|
|
338
|
-
activationMode,
|
|
339
|
-
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
340
|
-
dir: direction,
|
|
341
|
-
"data-orientation": orientation,
|
|
342
|
-
...tabsProps,
|
|
343
|
-
ref: forwardedRef
|
|
344
|
-
})
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
Tabs$1.displayName = TABS_NAME;
|
|
348
|
-
var TAB_LIST_NAME = "TabsList";
|
|
349
|
-
var TabsList$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
350
|
-
const { __scopeTabs, loop = true, ...listProps } = props;
|
|
351
|
-
const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
352
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
353
|
-
return /* @__PURE__ */ jsx(Root, {
|
|
354
|
-
asChild: true,
|
|
355
|
-
...rovingFocusGroupScope,
|
|
356
|
-
orientation: context.orientation,
|
|
357
|
-
dir: context.dir,
|
|
358
|
-
loop,
|
|
359
|
-
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
360
|
-
role: "tablist",
|
|
361
|
-
"aria-orientation": context.orientation,
|
|
362
|
-
...listProps,
|
|
363
|
-
ref: forwardedRef
|
|
364
|
-
})
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
TabsList$1.displayName = TAB_LIST_NAME;
|
|
368
|
-
var TRIGGER_NAME = "TabsTrigger";
|
|
369
|
-
var TabsTrigger$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
370
|
-
const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
|
|
371
|
-
const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
|
|
372
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
373
|
-
const triggerId = makeTriggerId(context.baseId, value);
|
|
374
|
-
const contentId = makeContentId(context.baseId, value);
|
|
375
|
-
const isSelected = value === context.value;
|
|
376
|
-
return /* @__PURE__ */ jsx(Item, {
|
|
377
|
-
asChild: true,
|
|
378
|
-
...rovingFocusGroupScope,
|
|
379
|
-
focusable: !disabled,
|
|
380
|
-
active: isSelected,
|
|
381
|
-
children: /* @__PURE__ */ jsx(Primitive.button, {
|
|
382
|
-
type: "button",
|
|
383
|
-
role: "tab",
|
|
384
|
-
"aria-selected": isSelected,
|
|
385
|
-
"aria-controls": contentId,
|
|
386
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
387
|
-
"data-disabled": disabled ? "" : void 0,
|
|
388
|
-
disabled,
|
|
389
|
-
id: triggerId,
|
|
390
|
-
...triggerProps,
|
|
391
|
-
ref: forwardedRef,
|
|
392
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
393
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
|
|
394
|
-
else event.preventDefault();
|
|
395
|
-
}),
|
|
396
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
397
|
-
if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
|
|
398
|
-
}),
|
|
399
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
400
|
-
const isAutomaticActivation = context.activationMode !== "manual";
|
|
401
|
-
if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
|
|
402
|
-
})
|
|
403
|
-
})
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
TabsTrigger$1.displayName = TRIGGER_NAME;
|
|
407
|
-
var CONTENT_NAME = "TabsContent";
|
|
408
|
-
var TabsContent$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
409
|
-
const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
|
|
410
|
-
const context = useTabsContext(CONTENT_NAME, __scopeTabs);
|
|
411
|
-
const triggerId = makeTriggerId(context.baseId, value);
|
|
412
|
-
const contentId = makeContentId(context.baseId, value);
|
|
413
|
-
const isSelected = value === context.value;
|
|
414
|
-
const isMountAnimationPreventedRef = React$1.useRef(isSelected);
|
|
415
|
-
React$1.useEffect(() => {
|
|
416
|
-
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
417
|
-
return () => cancelAnimationFrame(rAF);
|
|
418
|
-
}, []);
|
|
419
|
-
return /* @__PURE__ */ jsx(Presence, {
|
|
420
|
-
present: forceMount || isSelected,
|
|
421
|
-
children: ({ present }) => /* @__PURE__ */ jsx(Primitive.div, {
|
|
422
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
423
|
-
"data-orientation": context.orientation,
|
|
424
|
-
role: "tabpanel",
|
|
425
|
-
"aria-labelledby": triggerId,
|
|
426
|
-
hidden: !present,
|
|
427
|
-
id: contentId,
|
|
428
|
-
tabIndex: 0,
|
|
429
|
-
...contentProps,
|
|
430
|
-
ref: forwardedRef,
|
|
431
|
-
style: {
|
|
432
|
-
...props.style,
|
|
433
|
-
animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
|
|
434
|
-
},
|
|
435
|
-
children: present && children
|
|
436
|
-
})
|
|
437
|
-
});
|
|
438
|
-
});
|
|
439
|
-
TabsContent$1.displayName = CONTENT_NAME;
|
|
440
|
-
function makeTriggerId(baseId, value) {
|
|
441
|
-
return `${baseId}-trigger-${value}`;
|
|
442
|
-
}
|
|
443
|
-
function makeContentId(baseId, value) {
|
|
444
|
-
return `${baseId}-content-${value}`;
|
|
445
|
-
}
|
|
446
|
-
var Root2 = Tabs$1;
|
|
447
|
-
var List = TabsList$1;
|
|
448
|
-
var Trigger = TabsTrigger$1;
|
|
449
|
-
var Content = TabsContent$1;
|
|
450
|
-
//#endregion
|
|
451
|
-
//#region editors/document-model-editor/components/tabs.tsx
|
|
452
|
-
const Tabs = Root2;
|
|
453
|
-
const TabsList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(List, {
|
|
454
|
-
ref,
|
|
455
|
-
className: twMerge("flex items-center justify-center rounded-xl bg-background p-1 shadow-inner", className),
|
|
456
|
-
...props
|
|
457
|
-
}));
|
|
458
|
-
TabsList.displayName = List.displayName;
|
|
459
|
-
const TabsTrigger = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Trigger, {
|
|
460
|
-
ref,
|
|
461
|
-
className: twMerge("flex w-full items-center justify-center rounded-lg p-1 text-sm whitespace-nowrap text-muted-foreground transition-all disabled:disabled-effect data-[state=active]:bg-accent data-[state=active]:text-foreground data-[state=active]:shadow-tab", className),
|
|
462
|
-
...props
|
|
463
|
-
}));
|
|
464
|
-
TabsTrigger.displayName = Trigger.displayName;
|
|
465
|
-
const TabsContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Content, {
|
|
466
|
-
ref,
|
|
467
|
-
className,
|
|
468
|
-
...props
|
|
469
|
-
}));
|
|
470
|
-
TabsContent.displayName = Content.displayName;
|
|
471
|
-
//#endregion
|
|
472
|
-
//#region editors/document-model-editor/components/state-schemas.tsx
|
|
473
|
-
const GraphqlEditor = lazy(() => import("./graphql-editor-Cgi5UOrF.js"));
|
|
474
|
-
const JSONEditor = lazy(() => import("./json-editor-DfRD-pfk.js"));
|
|
475
|
-
function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, setInitialState, scope }) {
|
|
476
|
-
const { sharedSchema: sharedSchemaSdl, error: sharedSchemaError } = useSchemaContext();
|
|
477
|
-
const [showStandardLib, setShowStandardLib] = useState(false);
|
|
478
|
-
const [syncWithSchema, setSyncWithSchema] = useState(true);
|
|
479
|
-
const customLinter = useCallback((doc) => ensureValidStateSchemaName(doc, modelName, scope), [modelName, scope]);
|
|
480
|
-
const schemaErrors = useMemo(() => {
|
|
481
|
-
const errors = ensureValidStateSchemaName(stateSchema, modelName, scope);
|
|
482
|
-
if (sharedSchemaError) return [...errors, sharedSchemaError];
|
|
483
|
-
return errors;
|
|
484
|
-
}, [
|
|
485
|
-
stateSchema,
|
|
486
|
-
modelName,
|
|
487
|
-
scope,
|
|
488
|
-
sharedSchemaError
|
|
489
|
-
]);
|
|
490
|
-
const handleToggleStandardLib = useCallback(() => {
|
|
491
|
-
setShowStandardLib((prev) => !prev);
|
|
492
|
-
}, []);
|
|
493
|
-
const handleSchemaUpdate = useCallback((newDoc) => setStateSchema(newDoc, scope), [setStateSchema, scope]);
|
|
494
|
-
const handleInitialStateUpdate = useCallback((newDoc) => setInitialState(newDoc, scope), [setInitialState, scope]);
|
|
495
|
-
const hasSyncedRef = useRef(false);
|
|
496
|
-
const { initialValueErrors, fixedState } = useMemo(() => {
|
|
497
|
-
const existingValue = initialValue || "{}";
|
|
498
|
-
const sharedSchemaDocumentNode = safeParseSdl(sharedSchemaSdl);
|
|
499
|
-
if (!sharedSchemaDocumentNode) return {
|
|
500
|
-
initialValueErrors: [],
|
|
501
|
-
fixedState: null
|
|
502
|
-
};
|
|
503
|
-
const stateTypeName = makeStateSchemaNameForScope(modelName, scope);
|
|
504
|
-
if (!stateTypeName) return {
|
|
505
|
-
initialValueErrors: [],
|
|
506
|
-
fixedState: null
|
|
507
|
-
};
|
|
508
|
-
const stateTypeDefinitionNode = sharedSchemaDocumentNode.definitions.find((def) => def.kind === Kind.OBJECT_TYPE_DEFINITION && def.name.value === stateTypeName);
|
|
509
|
-
if (!stateTypeDefinitionNode || stateTypeDefinitionNode.kind !== Kind.OBJECT_TYPE_DEFINITION) return {
|
|
510
|
-
initialValueErrors: [],
|
|
511
|
-
fixedState: null
|
|
512
|
-
};
|
|
513
|
-
const errors = validateStateObject(sharedSchemaDocumentNode, stateTypeDefinitionNode, existingValue);
|
|
514
|
-
if (errors.length && syncWithSchema) {
|
|
515
|
-
const computedFixedState = makeMinimalObjectForStateType({
|
|
516
|
-
sharedSchemaDocumentNode,
|
|
517
|
-
stateTypeDefinitionNode,
|
|
518
|
-
existingValue
|
|
519
|
-
});
|
|
520
|
-
if (initialValue !== computedFixedState) return {
|
|
521
|
-
initialValueErrors: [],
|
|
522
|
-
fixedState: computedFixedState
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
return {
|
|
526
|
-
initialValueErrors: errors,
|
|
527
|
-
fixedState: null
|
|
528
|
-
};
|
|
529
|
-
}, [
|
|
530
|
-
sharedSchemaSdl,
|
|
531
|
-
initialValue,
|
|
532
|
-
syncWithSchema,
|
|
533
|
-
scope,
|
|
534
|
-
modelName
|
|
535
|
-
]);
|
|
536
|
-
useEffect(() => {
|
|
537
|
-
if (fixedState && !hasSyncedRef.current) {
|
|
538
|
-
hasSyncedRef.current = true;
|
|
539
|
-
setInitialState(fixedState, scope);
|
|
540
|
-
} else if (!fixedState) hasSyncedRef.current = false;
|
|
541
|
-
}, [
|
|
542
|
-
fixedState,
|
|
543
|
-
setInitialState,
|
|
544
|
-
scope
|
|
545
|
-
]);
|
|
546
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
547
|
-
className: "grid grid-cols-2 gap-4",
|
|
548
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
549
|
-
/* @__PURE__ */ jsxs("h3", {
|
|
550
|
-
className: "mb-2 text-lg text-foreground capitalize",
|
|
551
|
-
children: [scope, " state schema *"]
|
|
552
|
-
}),
|
|
553
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
554
|
-
onClick: handleToggleStandardLib,
|
|
555
|
-
className: "mb-2 flex w-fit items-center gap-2",
|
|
556
|
-
children: [
|
|
557
|
-
showStandardLib ? "Hide" : "Show",
|
|
558
|
-
" standard library",
|
|
559
|
-
/* @__PURE__ */ jsx("svg", {
|
|
560
|
-
className: twMerge("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"),
|
|
561
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
562
|
-
width: "24",
|
|
563
|
-
height: "24",
|
|
564
|
-
viewBox: "0 0 24 24",
|
|
565
|
-
fill: "currentColor",
|
|
566
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
567
|
-
d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z",
|
|
568
|
-
fill: "currentColor"
|
|
569
|
-
})
|
|
570
|
-
})
|
|
571
|
-
]
|
|
572
|
-
}),
|
|
573
|
-
/* @__PURE__ */ jsxs(Suspense, { children: [
|
|
574
|
-
showStandardLib && /* @__PURE__ */ jsx(GraphqlEditor, {
|
|
575
|
-
doc: typeDefsDoc,
|
|
576
|
-
readonly: true
|
|
577
|
-
}),
|
|
578
|
-
/* @__PURE__ */ jsx(GraphqlEditor, {
|
|
579
|
-
doc: stateSchema,
|
|
580
|
-
updateDocumentInModel: handleSchemaUpdate,
|
|
581
|
-
customLinter
|
|
582
|
-
}),
|
|
583
|
-
schemaErrors.length > 0 && /* @__PURE__ */ jsx("p", {
|
|
584
|
-
className: "mt-2 text-sm text-destructive",
|
|
585
|
-
children: schemaErrors[0].message
|
|
586
|
-
})
|
|
587
|
-
] })
|
|
588
|
-
] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
589
|
-
className: "flex flex-col items-end",
|
|
590
|
-
children: [/* @__PURE__ */ jsxs("h3", {
|
|
591
|
-
className: "mb-2 text-right text-lg text-foreground capitalize",
|
|
592
|
-
children: [scope, " state initial value *"]
|
|
593
|
-
}), /* @__PURE__ */ jsxs("label", {
|
|
594
|
-
className: "mb-2 flex w-fit items-center gap-2 rounded-md border border-border bg-background p-2 text-sm font-medium whitespace-nowrap text-foreground transition-colors hover:hover-effect focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
595
|
-
children: [
|
|
596
|
-
/* @__PURE__ */ jsx("input", {
|
|
597
|
-
type: "checkbox",
|
|
598
|
-
className: "",
|
|
599
|
-
value: syncWithSchema.toString(),
|
|
600
|
-
onChange: (e) => {
|
|
601
|
-
setSyncWithSchema(e.currentTarget.value === "true" ? true : false);
|
|
602
|
-
}
|
|
603
|
-
}),
|
|
604
|
-
"Sync with schema",
|
|
605
|
-
" ",
|
|
606
|
-
/* @__PURE__ */ jsx("svg", {
|
|
607
|
-
className: "inline-block",
|
|
608
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
609
|
-
width: "16",
|
|
610
|
-
height: "16",
|
|
611
|
-
viewBox: "0 0 16 16",
|
|
612
|
-
fill: "none",
|
|
613
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
614
|
-
d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z",
|
|
615
|
-
fill: "currentColor"
|
|
616
|
-
})
|
|
617
|
-
})
|
|
618
|
-
]
|
|
619
|
-
})]
|
|
620
|
-
}), /* @__PURE__ */ jsxs(Suspense, { children: [/* @__PURE__ */ jsx(JSONEditor, {
|
|
621
|
-
doc: initialValue,
|
|
622
|
-
updateDocumentInModel: handleInitialStateUpdate
|
|
623
|
-
}), initialValueErrors.map((error, index) => /* @__PURE__ */ jsx("p", {
|
|
624
|
-
className: "mt-2 text-sm text-destructive",
|
|
625
|
-
children: error instanceof StateValidationError ? /* @__PURE__ */ jsx(StateValidationErrorMessage, { error }) : error.message
|
|
626
|
-
}, index))] })] })]
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, currentScope, onScopeChange }) {
|
|
630
|
-
const handleAddLocalState = useCallback(() => {
|
|
631
|
-
setStateSchema(makeInitialSchemaDoc(modelName, "local"), "local");
|
|
632
|
-
setInitialState("", "local");
|
|
633
|
-
}, [
|
|
634
|
-
modelName,
|
|
635
|
-
setStateSchema,
|
|
636
|
-
setInitialState
|
|
637
|
-
]);
|
|
638
|
-
return /* @__PURE__ */ jsxs(Tabs, {
|
|
639
|
-
className: "pb-8",
|
|
640
|
-
activationMode: "manual",
|
|
641
|
-
value: currentScope,
|
|
642
|
-
onValueChange: (value) => onScopeChange(value),
|
|
643
|
-
children: [
|
|
644
|
-
/* @__PURE__ */ jsx("div", {
|
|
645
|
-
className: "my-6",
|
|
646
|
-
children: /* @__PURE__ */ jsxs(TabsList, {
|
|
647
|
-
className: "mx-auto flex max-w-sm",
|
|
648
|
-
children: [/* @__PURE__ */ jsx(TabsTrigger, {
|
|
649
|
-
value: "global",
|
|
650
|
-
children: "Global"
|
|
651
|
-
}), /* @__PURE__ */ jsx(TabsTrigger, {
|
|
652
|
-
value: "local",
|
|
653
|
-
children: "Local"
|
|
654
|
-
})]
|
|
655
|
-
})
|
|
656
|
-
}),
|
|
657
|
-
/* @__PURE__ */ jsx(TabsContent, {
|
|
658
|
-
value: "global",
|
|
659
|
-
tabIndex: -1,
|
|
660
|
-
children: /* @__PURE__ */ jsx(StateEditor, {
|
|
661
|
-
modelName,
|
|
662
|
-
stateSchema: globalStateSchema,
|
|
663
|
-
initialValue: globalStateInitialValue,
|
|
664
|
-
setStateSchema,
|
|
665
|
-
setInitialState,
|
|
666
|
-
scope: "global"
|
|
667
|
-
})
|
|
668
|
-
}),
|
|
669
|
-
/* @__PURE__ */ jsx(TabsContent, {
|
|
670
|
-
value: "local",
|
|
671
|
-
tabIndex: -1,
|
|
672
|
-
children: !localStateSchema ? /* @__PURE__ */ jsxs("div", {
|
|
673
|
-
className: "",
|
|
674
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
675
|
-
className: "mb-2 text-lg text-foreground capitalize",
|
|
676
|
-
children: "local state schema *"
|
|
677
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
678
|
-
onClick: handleAddLocalState,
|
|
679
|
-
children: "Add local state"
|
|
680
|
-
})]
|
|
681
|
-
}) : /* @__PURE__ */ jsx(StateEditor, {
|
|
682
|
-
modelName,
|
|
683
|
-
stateSchema: localStateSchema,
|
|
684
|
-
initialValue: localStateInitialValue,
|
|
685
|
-
setStateSchema,
|
|
686
|
-
setInitialState,
|
|
687
|
-
scope: "local"
|
|
688
|
-
})
|
|
689
|
-
})
|
|
690
|
-
]
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
//#endregion
|
|
694
|
-
export { StateSchemas as default };
|
|
695
|
-
|
|
696
|
-
//# sourceMappingURL=state-schemas-B5Bk_l1s.js.map
|