@uniformdev/mesh-sdk-react 19.47.1-alpha.3 → 19.48.0
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/index.d.mts +46 -19
- package/dist/index.d.ts +46 -19
- package/dist/index.esm.js +411 -237
- package/dist/index.js +522 -348
- package/dist/index.mjs +411 -237
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
Button: () => import_design_system40.Button,
|
|
38
38
|
Callout: () => import_design_system40.Callout,
|
|
39
39
|
ControlledValuePlugin: () => ControlledValuePlugin,
|
|
40
|
+
DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
|
|
40
41
|
DamSelectedItem: () => DamSelectedItem,
|
|
41
42
|
DataRefreshButton: () => DataRefreshButton,
|
|
42
43
|
DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
|
|
@@ -197,7 +198,6 @@ __export(src_exports, {
|
|
|
197
198
|
useDynamicInputsAsVariables: () => useDynamicInputsAsVariables,
|
|
198
199
|
useMeshLocation: () => useMeshLocation,
|
|
199
200
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
200
|
-
useOnVariableUpdated: () => useOnVariableUpdated,
|
|
201
201
|
useParameterShell: () => import_design_system14.useParameterShell,
|
|
202
202
|
useProductQueryContext: () => useProductQueryContext,
|
|
203
203
|
useProductSearchContext: () => useProductSearchContext,
|
|
@@ -205,6 +205,7 @@ __export(src_exports, {
|
|
|
205
205
|
useRequestHeader: () => useRequestHeader,
|
|
206
206
|
useRequestParameter: () => useRequestParameter,
|
|
207
207
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
208
|
+
useVariableEditor: () => useVariableEditor,
|
|
208
209
|
useVariables: () => useVariables,
|
|
209
210
|
useVariablesMenu: () => useVariablesMenu,
|
|
210
211
|
variableDefaultTextValue: () => variableDefaultTextValue,
|
|
@@ -3110,11 +3111,11 @@ function ControlledValuePlugin({
|
|
|
3110
3111
|
var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
|
|
3111
3112
|
var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
|
|
3112
3113
|
var import_selection = require("@lexical/selection");
|
|
3113
|
-
var
|
|
3114
|
+
var import_utils2 = require("@lexical/utils");
|
|
3114
3115
|
var import_canvas3 = require("@uniformdev/canvas");
|
|
3115
3116
|
var import_design_system18 = require("@uniformdev/design-system");
|
|
3116
3117
|
var import_lexical4 = require("lexical");
|
|
3117
|
-
var
|
|
3118
|
+
var import_react39 = require("react");
|
|
3118
3119
|
|
|
3119
3120
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3120
3121
|
function prettifyBindExpression(bindExpression) {
|
|
@@ -3180,15 +3181,16 @@ function InfoVariableReference({ children }) {
|
|
|
3180
3181
|
}
|
|
3181
3182
|
|
|
3182
3183
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3183
|
-
var
|
|
3184
|
+
var import_react37 = require("@emotion/react");
|
|
3184
3185
|
var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
|
|
3185
3186
|
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3187
|
+
var import_utils = require("@lexical/utils");
|
|
3186
3188
|
var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
|
|
3187
3189
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
3188
3190
|
var import_design_system17 = require("@uniformdev/design-system");
|
|
3189
3191
|
var import_lite2 = require("dequal/lite");
|
|
3190
3192
|
var import_lexical3 = require("lexical");
|
|
3191
|
-
var
|
|
3193
|
+
var import_react38 = require("react");
|
|
3192
3194
|
var import_react_dom = require("react-dom");
|
|
3193
3195
|
|
|
3194
3196
|
// src/components/Variables/toolbox/SelectVariableMenu.styles.ts
|
|
@@ -3220,16 +3222,17 @@ var variablesTipText = import_react32.css`
|
|
|
3220
3222
|
padding: 0 var(--spacing-sm);
|
|
3221
3223
|
`;
|
|
3222
3224
|
|
|
3223
|
-
// src/components/Variables/
|
|
3224
|
-
var
|
|
3225
|
+
// src/components/Variables/useVariableEditor.ts
|
|
3226
|
+
var import_react36 = require("react");
|
|
3225
3227
|
|
|
3226
3228
|
// src/components/Variables/VariablesProvider.tsx
|
|
3227
3229
|
var import_mitt = __toESM(require("mitt"));
|
|
3228
|
-
var
|
|
3230
|
+
var import_react35 = require("react");
|
|
3229
3231
|
|
|
3230
3232
|
// src/components/Variables/VariableEditor.tsx
|
|
3231
3233
|
var import_zod = require("@hookform/resolvers/zod");
|
|
3232
3234
|
var import_design_system16 = require("@uniformdev/design-system");
|
|
3235
|
+
var import_react34 = require("react");
|
|
3233
3236
|
var import_react_hook_form = require("react-hook-form");
|
|
3234
3237
|
var import_zod2 = require("zod");
|
|
3235
3238
|
|
|
@@ -3240,10 +3243,6 @@ var variablesFormContainer = import_react33.css`
|
|
|
3240
3243
|
margin: var(--spacing-base) 0 0;
|
|
3241
3244
|
}
|
|
3242
3245
|
`;
|
|
3243
|
-
var variablesFormBtnGroup = import_react33.css`
|
|
3244
|
-
display: flex;
|
|
3245
|
-
gap: var(--spacing-sm);
|
|
3246
|
-
`;
|
|
3247
3246
|
|
|
3248
3247
|
// src/components/Variables/VariableEditor.tsx
|
|
3249
3248
|
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
@@ -3255,7 +3254,12 @@ var schema = import_zod2.z.object({
|
|
|
3255
3254
|
order: import_zod2.z.number().optional(),
|
|
3256
3255
|
type: import_zod2.z.string().optional()
|
|
3257
3256
|
});
|
|
3258
|
-
function VariableEditor({
|
|
3257
|
+
function VariableEditor({
|
|
3258
|
+
variable,
|
|
3259
|
+
onSubmit,
|
|
3260
|
+
onCancel,
|
|
3261
|
+
disableMeshTip
|
|
3262
|
+
}) {
|
|
3259
3263
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3260
3264
|
const { variables } = useVariables();
|
|
3261
3265
|
const currentVariable = variables[variable];
|
|
@@ -3277,7 +3281,7 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
|
3277
3281
|
type: values.type || void 0,
|
|
3278
3282
|
displayName: values.displayName || void 0
|
|
3279
3283
|
};
|
|
3280
|
-
return onSubmit(finalValue);
|
|
3284
|
+
return onSubmit(finalValue, null);
|
|
3281
3285
|
});
|
|
3282
3286
|
(0, import_design_system16.useShortcut)({
|
|
3283
3287
|
shortcut: "enter",
|
|
@@ -3286,6 +3290,13 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
|
3286
3290
|
},
|
|
3287
3291
|
activeWhenEditing: true
|
|
3288
3292
|
});
|
|
3293
|
+
const nameRef = (0, import_react34.useRef)(null);
|
|
3294
|
+
const { ref, ...nameRegister } = register("name");
|
|
3295
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
3296
|
+
if (nameRef.current && !nameRef.current.value) {
|
|
3297
|
+
nameRef.current.focus();
|
|
3298
|
+
}
|
|
3299
|
+
}, []);
|
|
3289
3300
|
return (
|
|
3290
3301
|
// NOTE: this is intentionally NOT a <form> because it's regularly used in a nested modal and that can make it bubble
|
|
3291
3302
|
// up a submit to its 'parent form' which is not what we want.
|
|
@@ -3293,12 +3304,15 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
|
3293
3304
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3294
3305
|
import_design_system16.Input,
|
|
3295
3306
|
{
|
|
3296
|
-
...
|
|
3307
|
+
...nameRegister,
|
|
3297
3308
|
label: "Name",
|
|
3298
3309
|
disabled: variable !== "",
|
|
3299
3310
|
caption: "This cannot change once created.",
|
|
3300
3311
|
errorMessage: (_e = formState.errors.name) == null ? void 0 : _e.message,
|
|
3301
|
-
|
|
3312
|
+
ref: (e) => {
|
|
3313
|
+
ref(e);
|
|
3314
|
+
nameRef.current = e;
|
|
3315
|
+
}
|
|
3302
3316
|
}
|
|
3303
3317
|
),
|
|
3304
3318
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -3320,14 +3334,22 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
|
3320
3334
|
errorMessage: (_g = formState.errors.default) == null ? void 0 : _g.message
|
|
3321
3335
|
}
|
|
3322
3336
|
),
|
|
3323
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system16.HorizontalRhythm, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_design_system16.HorizontalRhythm, { gap: "sm", children: [
|
|
3324
3338
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system16.Button, { type: "button", onClick: submitHandler, children: "OK" }),
|
|
3325
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system16.Button, { type: "button", buttonType: "ghost", onClick: onCancel, children: "
|
|
3326
|
-
] }),
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system16.Button, { type: "button", buttonType: "ghost", onClick: () => onCancel({ disconnect: false }), children: "cancel" })
|
|
3340
|
+
] }) }),
|
|
3327
3341
|
disableMeshTip ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_design_system16.Callout, { type: "tip", title: "Customized User Interfaces", children: [
|
|
3328
3342
|
"Developers can create customized user interfaces for variable editing by building a Uniform mesh integration. Get started quickly with our",
|
|
3329
3343
|
" ",
|
|
3330
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3344
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3345
|
+
"a",
|
|
3346
|
+
{
|
|
3347
|
+
href: "https://docs.uniform.app/docs/integrations/mesh-integrations/custom-integrations",
|
|
3348
|
+
target: "_blank",
|
|
3349
|
+
rel: "noopener noreferrer",
|
|
3350
|
+
children: "Mesh SDK"
|
|
3351
|
+
}
|
|
3352
|
+
),
|
|
3331
3353
|
"."
|
|
3332
3354
|
] })
|
|
3333
3355
|
] })
|
|
@@ -3336,7 +3358,7 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
|
3336
3358
|
|
|
3337
3359
|
// src/components/Variables/VariablesProvider.tsx
|
|
3338
3360
|
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
3339
|
-
var VariablesContext = (0,
|
|
3361
|
+
var VariablesContext = (0, import_react35.createContext)(null);
|
|
3340
3362
|
function VariablesProvider({
|
|
3341
3363
|
value,
|
|
3342
3364
|
onChange,
|
|
@@ -3346,14 +3368,17 @@ function VariablesProvider({
|
|
|
3346
3368
|
children,
|
|
3347
3369
|
knownUndefinedValues = {}
|
|
3348
3370
|
}) {
|
|
3349
|
-
const [editing, setEditing] = (0,
|
|
3350
|
-
const [editingContext, setEditingContext] = (0,
|
|
3351
|
-
const events = (0,
|
|
3371
|
+
const [editing, setEditing] = (0, import_react35.useState)();
|
|
3372
|
+
const [editingContext, setEditingContext] = (0, import_react35.useState)();
|
|
3373
|
+
const events = (0, import_react35.useMemo)(
|
|
3374
|
+
() => (0, import_mitt.default)(),
|
|
3375
|
+
[]
|
|
3376
|
+
);
|
|
3352
3377
|
if (!readOnly && !onChange) {
|
|
3353
3378
|
throw new Error("onChange must be provided when readOnly is false");
|
|
3354
3379
|
}
|
|
3355
3380
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3356
|
-
const valueBasedContextValue = (0,
|
|
3381
|
+
const valueBasedContextValue = (0, import_react35.useMemo)(
|
|
3357
3382
|
() => ({
|
|
3358
3383
|
flatVariables: flattenVariables(value),
|
|
3359
3384
|
dispatch: (event) => {
|
|
@@ -3391,7 +3416,7 @@ function VariablesProvider({
|
|
|
3391
3416
|
}),
|
|
3392
3417
|
[onChange, readOnly, value]
|
|
3393
3418
|
);
|
|
3394
|
-
const contextValue = (0,
|
|
3419
|
+
const contextValue = (0, import_react35.useMemo)(() => {
|
|
3395
3420
|
return {
|
|
3396
3421
|
...valueBasedContextValue,
|
|
3397
3422
|
isEditing: typeof editing !== "undefined",
|
|
@@ -3407,15 +3432,23 @@ function VariablesProvider({
|
|
|
3407
3432
|
Editor,
|
|
3408
3433
|
{
|
|
3409
3434
|
context: editingContext,
|
|
3410
|
-
onSubmit: (val) => {
|
|
3435
|
+
onSubmit: (val, editorCompletedContext) => {
|
|
3411
3436
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3412
3437
|
const { name, ...varValue } = val;
|
|
3413
3438
|
const latestValue = { ...value, [name]: varValue };
|
|
3414
3439
|
onChange == null ? void 0 : onChange(latestValue);
|
|
3415
|
-
events.emit("
|
|
3440
|
+
events.emit("editCompleted", {
|
|
3441
|
+
canceled: false,
|
|
3442
|
+
selectedVariable: val,
|
|
3443
|
+
editorCompletedContext
|
|
3444
|
+
});
|
|
3416
3445
|
},
|
|
3417
|
-
onCancel: () => {
|
|
3446
|
+
onCancel: (editorCancelledContext) => {
|
|
3418
3447
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3448
|
+
events.emit("editCompleted", {
|
|
3449
|
+
canceled: true,
|
|
3450
|
+
editorCancelledContext
|
|
3451
|
+
});
|
|
3419
3452
|
},
|
|
3420
3453
|
variable: editing
|
|
3421
3454
|
}
|
|
@@ -3423,7 +3456,7 @@ function VariablesProvider({
|
|
|
3423
3456
|
] });
|
|
3424
3457
|
}
|
|
3425
3458
|
function useVariables(returnEmptyWithoutProvider = false) {
|
|
3426
|
-
const context = (0,
|
|
3459
|
+
const context = (0, import_react35.useContext)(VariablesContext);
|
|
3427
3460
|
if (!context) {
|
|
3428
3461
|
if (returnEmptyWithoutProvider) {
|
|
3429
3462
|
return {
|
|
@@ -3451,16 +3484,57 @@ function flattenVariables(variables) {
|
|
|
3451
3484
|
return flatVariables;
|
|
3452
3485
|
}
|
|
3453
3486
|
|
|
3454
|
-
// src/components/Variables/
|
|
3455
|
-
function
|
|
3456
|
-
const { variables, events, canDispatch } = useVariables(true);
|
|
3457
|
-
(0,
|
|
3458
|
-
|
|
3487
|
+
// src/components/Variables/useVariableEditor.ts
|
|
3488
|
+
function useVariableEditor() {
|
|
3489
|
+
const { variables, events, canDispatch, dispatch, isEditing } = useVariables(true);
|
|
3490
|
+
const [isEditingBinding, setIsEditingBinding] = (0, import_react36.useState)();
|
|
3491
|
+
(0, import_react36.useEffect)(() => {
|
|
3492
|
+
if (!canDispatch || !isEditingBinding) {
|
|
3459
3493
|
return;
|
|
3460
3494
|
}
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3495
|
+
const fn = (e) => {
|
|
3496
|
+
isEditingBinding.resolve(e);
|
|
3497
|
+
setIsEditingBinding(void 0);
|
|
3498
|
+
};
|
|
3499
|
+
events.on("editCompleted", fn);
|
|
3500
|
+
return () => events.off("editCompleted", fn);
|
|
3501
|
+
}, [canDispatch, events, isEditingBinding, variables]);
|
|
3502
|
+
(0, import_react36.useEffect)(() => {
|
|
3503
|
+
if (!isEditing) {
|
|
3504
|
+
setIsEditingBinding(void 0);
|
|
3505
|
+
}
|
|
3506
|
+
}, [isEditing]);
|
|
3507
|
+
return {
|
|
3508
|
+
async editVariable(variable, context) {
|
|
3509
|
+
if (!canDispatch) {
|
|
3510
|
+
throw new Error("Cannot edit variable. VariablesProvider is not mounted.");
|
|
3511
|
+
}
|
|
3512
|
+
if (isEditingBinding) {
|
|
3513
|
+
throw new Error("Cannot edit variable. Another variable is already being edited.");
|
|
3514
|
+
}
|
|
3515
|
+
return new Promise((resolve) => {
|
|
3516
|
+
setIsEditingBinding({
|
|
3517
|
+
resolve,
|
|
3518
|
+
variable
|
|
3519
|
+
});
|
|
3520
|
+
dispatch({ type: "edit", variable, context });
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
// src/components/Variables/util/variableDefaultTextValue.ts
|
|
3527
|
+
function variableDefaultTextValue(defaultValue) {
|
|
3528
|
+
if (defaultValue === void 0 || defaultValue === null) {
|
|
3529
|
+
return "";
|
|
3530
|
+
}
|
|
3531
|
+
if (typeof defaultValue === "string") {
|
|
3532
|
+
return defaultValue;
|
|
3533
|
+
}
|
|
3534
|
+
if (defaultValue.toString) {
|
|
3535
|
+
return defaultValue.toString();
|
|
3536
|
+
}
|
|
3537
|
+
return "unknown";
|
|
3464
3538
|
}
|
|
3465
3539
|
|
|
3466
3540
|
// src/components/Variables/variablesToList.ts
|
|
@@ -3513,6 +3587,9 @@ function variablesToGroupedList(variables, filterFn, context) {
|
|
|
3513
3587
|
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3514
3588
|
var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:open-insert-variable");
|
|
3515
3589
|
var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
|
|
3590
|
+
var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)(
|
|
3591
|
+
"uniform:disconnect-variable"
|
|
3592
|
+
);
|
|
3516
3593
|
var INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:insert-variable");
|
|
3517
3594
|
var TRIGGER = "\\$\\$";
|
|
3518
3595
|
var LENGTH_LIMIT = 20;
|
|
@@ -3538,7 +3615,7 @@ function useVariablesMenu({
|
|
|
3538
3615
|
getEditorContext
|
|
3539
3616
|
}) {
|
|
3540
3617
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
3541
|
-
const canEditVariable = (0,
|
|
3618
|
+
const canEditVariable = (0, import_react38.useCallback)(
|
|
3542
3619
|
(name, variable) => (
|
|
3543
3620
|
// name === '' means new var. Add var perms computed by menu options.
|
|
3544
3621
|
name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
|
|
@@ -3546,7 +3623,7 @@ function useVariablesMenu({
|
|
|
3546
3623
|
[canDispatch, enableEditingVariables, readOnly]
|
|
3547
3624
|
);
|
|
3548
3625
|
const canAddVariable = canDispatch && showAddVariableMenuOption && !readOnly;
|
|
3549
|
-
const { groupedVariables, menuOptions } = (0,
|
|
3626
|
+
const { groupedVariables, menuOptions } = (0, import_react38.useMemo)(() => {
|
|
3550
3627
|
const groupedVariables2 = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
3551
3628
|
if (canAddVariable) {
|
|
3552
3629
|
groupedVariables2.unshift({
|
|
@@ -3568,7 +3645,7 @@ function useVariablesMenu({
|
|
|
3568
3645
|
);
|
|
3569
3646
|
return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
|
|
3570
3647
|
}, [variables, filterVariable, getEditorContext, canAddVariable, showAddVariableMenuOption]);
|
|
3571
|
-
const onSelect = (0,
|
|
3648
|
+
const onSelect = (0, import_react38.useCallback)(
|
|
3572
3649
|
({ queryString, value, nodeToReplace, editor, overwriteExistingValue }) => {
|
|
3573
3650
|
if (value === ADD_VARIABLE_OPTION) {
|
|
3574
3651
|
editor.update(() => {
|
|
@@ -3616,43 +3693,23 @@ function VariablesPlugin({
|
|
|
3616
3693
|
}) {
|
|
3617
3694
|
const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
|
|
3618
3695
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
3619
|
-
const variablesRef = (0,
|
|
3696
|
+
const variablesRef = (0, import_react38.useRef)({ variables, knownUndefinedValues, isLoading });
|
|
3620
3697
|
variablesRef.current = { variables, knownUndefinedValues, isLoading };
|
|
3621
|
-
const canEditVariable = (0,
|
|
3698
|
+
const canEditVariable = (0, import_react38.useCallback)(
|
|
3622
3699
|
(name, variable) => (
|
|
3623
3700
|
// name === '' means new var. Add var perms computed by menu options.
|
|
3624
3701
|
name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
|
|
3625
3702
|
),
|
|
3626
3703
|
[canDispatch, enableEditingVariables, readOnly]
|
|
3627
3704
|
);
|
|
3628
|
-
const
|
|
3629
|
-
|
|
3630
|
-
editor.update(() => {
|
|
3631
|
-
var _a;
|
|
3632
|
-
if (editingKey === null) {
|
|
3633
|
-
return;
|
|
3634
|
-
}
|
|
3635
|
-
const targetKey = editingKey === ADD_VARIABLE_OPTION ? void 0 : editingKey;
|
|
3636
|
-
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
3637
|
-
reference: name,
|
|
3638
|
-
initialDisplayName: (_a = latestValue[name]) == null ? void 0 : _a.displayName,
|
|
3639
|
-
targetKey,
|
|
3640
|
-
overwriteExistingValue: replaceValueOnVariableInsert
|
|
3641
|
-
});
|
|
3642
|
-
});
|
|
3643
|
-
}, editingKey === null);
|
|
3644
|
-
(0, import_react37.useEffect)(() => {
|
|
3645
|
-
if (editingKey !== null && !isEditing) {
|
|
3646
|
-
setEditingKey(null);
|
|
3647
|
-
}
|
|
3648
|
-
}, [editingKey, isEditing]);
|
|
3649
|
-
const [queryString, setQueryString] = (0, import_react37.useState)(null);
|
|
3705
|
+
const { editVariable } = useVariableEditor();
|
|
3706
|
+
const [queryString, setQueryString] = (0, import_react38.useState)(null);
|
|
3650
3707
|
const { groupedVariables, menuOptions, onSelect } = useVariablesMenu({
|
|
3651
3708
|
showAddVariableMenuOption,
|
|
3652
3709
|
filterVariable,
|
|
3653
3710
|
getEditorContext
|
|
3654
3711
|
});
|
|
3655
|
-
const { filteredGroupedVariables, filteredMenuOptions } = (0,
|
|
3712
|
+
const { filteredGroupedVariables, filteredMenuOptions } = (0, import_react38.useMemo)(() => {
|
|
3656
3713
|
if (!queryString) {
|
|
3657
3714
|
return {
|
|
3658
3715
|
filteredGroupedVariables: groupedVariables,
|
|
@@ -3672,11 +3729,8 @@ function VariablesPlugin({
|
|
|
3672
3729
|
)
|
|
3673
3730
|
};
|
|
3674
3731
|
}, [queryString, groupedVariables, menuOptions]);
|
|
3675
|
-
const onSelectOption = (0,
|
|
3732
|
+
const onSelectOption = (0, import_react38.useCallback)(
|
|
3676
3733
|
(selectedOption, nodeToReplace, closeMenu) => {
|
|
3677
|
-
if (selectedOption.key === ADD_VARIABLE_OPTION) {
|
|
3678
|
-
setEditingKey(void 0);
|
|
3679
|
-
}
|
|
3680
3734
|
onSelect({
|
|
3681
3735
|
queryString: queryString != null ? queryString : void 0,
|
|
3682
3736
|
value: selectedOption.key,
|
|
@@ -3688,59 +3742,128 @@ function VariablesPlugin({
|
|
|
3688
3742
|
},
|
|
3689
3743
|
[editor, onSelect, queryString, replaceValueOnVariableInsert]
|
|
3690
3744
|
);
|
|
3691
|
-
(0,
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
editor.registerCommand(
|
|
3715
|
-
INSERT_VARIABLE_COMMAND,
|
|
3716
|
-
({ reference, initialDisplayName, targetKey, overwriteExistingValue }) => {
|
|
3717
|
-
var _a, _b;
|
|
3718
|
-
if (!disableVariables) {
|
|
3719
|
-
const targetVariable = variablesRef.current.variables[reference];
|
|
3720
|
-
if (overwriteExistingValue) {
|
|
3721
|
-
setVariablesEditorValue(editor, (0, import_canvas2.createVariableReference)(reference));
|
|
3722
|
-
return true;
|
|
3745
|
+
(0, import_react38.useEffect)(() => {
|
|
3746
|
+
return (0, import_utils.mergeRegister)(
|
|
3747
|
+
editor.registerCommand(
|
|
3748
|
+
EDIT_VARIABLE_COMMAND,
|
|
3749
|
+
({ reference, sourceKey }) => {
|
|
3750
|
+
const currentValue = variablesRef.current.variables[reference];
|
|
3751
|
+
if (!disableVariables && canEditVariable(reference, currentValue)) {
|
|
3752
|
+
editVariable(reference, getEditorContext == null ? void 0 : getEditorContext()).then((result) => {
|
|
3753
|
+
var _a;
|
|
3754
|
+
if (result.canceled) {
|
|
3755
|
+
if (((_a = result.editorCancelledContext) == null ? void 0 : _a.disconnect) && sourceKey) {
|
|
3756
|
+
editor.dispatchCommand(DISCONNECT_VARIABLE_COMMAND, { sourceKey });
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
return;
|
|
3760
|
+
}
|
|
3761
|
+
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
3762
|
+
variable: result.selectedVariable.name,
|
|
3763
|
+
initialDisplayName: result.selectedVariable.displayName,
|
|
3764
|
+
targetKey: sourceKey,
|
|
3765
|
+
overwriteExistingValue: replaceValueOnVariableInsert
|
|
3766
|
+
});
|
|
3767
|
+
});
|
|
3723
3768
|
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3769
|
+
return true;
|
|
3770
|
+
},
|
|
3771
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3772
|
+
),
|
|
3773
|
+
// disconnects a variable node from its variable value and leaves the variable's default value
|
|
3774
|
+
// as a string literal in its place. Note that single-valued binding UIs override this so that it
|
|
3775
|
+
// acts as a reset to default component as well as a binding disconnect.
|
|
3776
|
+
editor.registerCommand(
|
|
3777
|
+
DISCONNECT_VARIABLE_COMMAND,
|
|
3778
|
+
({ sourceKey }) => {
|
|
3779
|
+
editor.update(() => {
|
|
3780
|
+
var _a;
|
|
3781
|
+
const currentNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
|
|
3782
|
+
if (!$isVariableNode(currentNode)) {
|
|
3783
|
+
throw new Error("Cannot disconnect a non-variable node");
|
|
3784
|
+
}
|
|
3785
|
+
const currentVariableDefinition = variablesRef.current.variables[currentNode.reference];
|
|
3786
|
+
const variableTextNode = (0, import_lexical3.$createTextNode)(
|
|
3787
|
+
variableDefaultTextValue(
|
|
3788
|
+
(_a = currentVariableDefinition == null ? void 0 : currentVariableDefinition.default) != null ? _a : currentNode.getState().displayName
|
|
3789
|
+
)
|
|
3790
|
+
);
|
|
3791
|
+
const variableNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
|
|
3792
|
+
if (!variableNode) {
|
|
3793
|
+
console.error("Disconnected from unknown node.");
|
|
3794
|
+
return true;
|
|
3795
|
+
}
|
|
3796
|
+
variableNode.replace(variableTextNode);
|
|
3797
|
+
variableTextNode.select();
|
|
3731
3798
|
});
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3799
|
+
return true;
|
|
3800
|
+
},
|
|
3801
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3802
|
+
),
|
|
3803
|
+
editor.registerCommand(
|
|
3804
|
+
OPEN_INSERT_VARIABLE_COMMAND,
|
|
3805
|
+
() => {
|
|
3806
|
+
if (!disableVariables) {
|
|
3807
|
+
editVariable("", getEditorContext == null ? void 0 : getEditorContext()).then((result) => {
|
|
3808
|
+
if (result.canceled) {
|
|
3809
|
+
return;
|
|
3810
|
+
}
|
|
3811
|
+
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
3812
|
+
variable: result.selectedVariable.name,
|
|
3813
|
+
initialDisplayName: result.selectedVariable.displayName,
|
|
3814
|
+
targetKey: void 0,
|
|
3815
|
+
overwriteExistingValue: replaceValueOnVariableInsert
|
|
3816
|
+
});
|
|
3817
|
+
});
|
|
3736
3818
|
}
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3819
|
+
return true;
|
|
3820
|
+
},
|
|
3821
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3822
|
+
),
|
|
3823
|
+
// register the insert variable command, used to handle inserting
|
|
3824
|
+
// a variable reference from non-autocomplete menus at the current selection,
|
|
3825
|
+
// or replacing an existing variable node with a new variable reference (when targetKey is set to a node ID)
|
|
3826
|
+
editor.registerCommand(
|
|
3827
|
+
INSERT_VARIABLE_COMMAND,
|
|
3828
|
+
({ variable: reference, initialDisplayName, targetKey, overwriteExistingValue }) => {
|
|
3829
|
+
var _a, _b;
|
|
3830
|
+
if (!disableVariables) {
|
|
3831
|
+
const targetVariable = variablesRef.current.variables[reference];
|
|
3832
|
+
if (overwriteExistingValue) {
|
|
3833
|
+
setVariablesEditorValue(editor, (0, import_canvas2.createVariableReference)(reference));
|
|
3834
|
+
return true;
|
|
3835
|
+
}
|
|
3836
|
+
const variableNode = $createVariableNode(reference, {
|
|
3837
|
+
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
|
|
3838
|
+
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
3839
|
+
referenceIsValid: true,
|
|
3840
|
+
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
3841
|
+
isFresh: true,
|
|
3842
|
+
isLoading: false
|
|
3843
|
+
});
|
|
3844
|
+
if (targetKey) {
|
|
3845
|
+
(_b = (0, import_lexical3.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
|
|
3846
|
+
} else {
|
|
3847
|
+
(0, import_lexical3.$insertNodes)([variableNode]);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
return true;
|
|
3851
|
+
},
|
|
3852
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3853
|
+
)
|
|
3741
3854
|
);
|
|
3742
|
-
}, [
|
|
3743
|
-
|
|
3855
|
+
}, [
|
|
3856
|
+
editor,
|
|
3857
|
+
disableVariables,
|
|
3858
|
+
canDispatch,
|
|
3859
|
+
dispatch,
|
|
3860
|
+
canEditVariable,
|
|
3861
|
+
readOnly,
|
|
3862
|
+
getEditorContext,
|
|
3863
|
+
editVariable,
|
|
3864
|
+
replaceValueOnVariableInsert
|
|
3865
|
+
]);
|
|
3866
|
+
const updateExistingNodeIfChanged = (0, import_react38.useCallback)(
|
|
3744
3867
|
(variableNode) => {
|
|
3745
3868
|
var _a, _b, _c;
|
|
3746
3869
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
@@ -3764,14 +3887,14 @@ function VariablesPlugin({
|
|
|
3764
3887
|
},
|
|
3765
3888
|
[canEditVariable]
|
|
3766
3889
|
);
|
|
3767
|
-
(0,
|
|
3890
|
+
(0, import_react38.useEffect)(() => {
|
|
3768
3891
|
editor.update(() => {
|
|
3769
3892
|
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3770
3893
|
updateExistingNodeIfChanged(variableNode);
|
|
3771
3894
|
});
|
|
3772
3895
|
});
|
|
3773
3896
|
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
3774
|
-
(0,
|
|
3897
|
+
(0, import_react38.useEffect)(() => {
|
|
3775
3898
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3776
3899
|
updateExistingNodeIfChanged(variableNode);
|
|
3777
3900
|
});
|
|
@@ -3787,7 +3910,7 @@ function VariablesPlugin({
|
|
|
3787
3910
|
triggerFn: getPossibleQueryMatch,
|
|
3788
3911
|
options: filteredMenuOptions,
|
|
3789
3912
|
menuRenderFn: (anchorElementRef, { selectOptionAndCleanUp, setHighlightedIndex, selectedIndex }) => {
|
|
3790
|
-
if (!anchorElementRef.current || groupedVariables.length === 0 ||
|
|
3913
|
+
if (!anchorElementRef.current || groupedVariables.length === 0 || isEditing) {
|
|
3791
3914
|
return null;
|
|
3792
3915
|
}
|
|
3793
3916
|
let currentCumulativeMenuIndex = -1;
|
|
@@ -3795,7 +3918,7 @@ function VariablesPlugin({
|
|
|
3795
3918
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3796
3919
|
"div",
|
|
3797
3920
|
{
|
|
3798
|
-
css:
|
|
3921
|
+
css: import_react37.css`
|
|
3799
3922
|
box-shadow: var(--shadow-base);
|
|
3800
3923
|
border-radius: var(--rounded-base);
|
|
3801
3924
|
background: var(--gray-50);
|
|
@@ -3936,7 +4059,7 @@ function VariableNodeComponent({
|
|
|
3936
4059
|
const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
|
|
3937
4060
|
const [isSelected, setSelected, clearSelection] = (0, import_useLexicalNodeSelection.useLexicalNodeSelection)(nodeKey);
|
|
3938
4061
|
const readOnly = !editor.isEditable();
|
|
3939
|
-
const onDelete = (0,
|
|
4062
|
+
const onDelete = (0, import_react39.useCallback)(
|
|
3940
4063
|
(event) => {
|
|
3941
4064
|
if (isSelected && (0, import_lexical4.$isNodeSelection)((0, import_lexical4.$getSelection)())) {
|
|
3942
4065
|
event.preventDefault();
|
|
@@ -3949,8 +4072,8 @@ function VariableNodeComponent({
|
|
|
3949
4072
|
},
|
|
3950
4073
|
[isSelected, nodeKey]
|
|
3951
4074
|
);
|
|
3952
|
-
(0,
|
|
3953
|
-
return (0,
|
|
4075
|
+
(0, import_react39.useEffect)(() => {
|
|
4076
|
+
return (0, import_utils2.mergeRegister)(
|
|
3954
4077
|
editor.registerCommand(import_lexical4.KEY_DELETE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
|
|
3955
4078
|
editor.registerCommand(import_lexical4.KEY_BACKSPACE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
|
|
3956
4079
|
// HACK: see https://github.com/facebook/lexical/issues/4214
|
|
@@ -4037,7 +4160,7 @@ function $isTargetWithinDecorator(target) {
|
|
|
4037
4160
|
|
|
4038
4161
|
// src/components/Variables/InputVariables.tsx
|
|
4039
4162
|
var import_design_system20 = require("@uniformdev/design-system");
|
|
4040
|
-
var
|
|
4163
|
+
var import_react49 = require("react");
|
|
4041
4164
|
var import_uuid2 = require("uuid");
|
|
4042
4165
|
|
|
4043
4166
|
// src/components/Variables/composer/EditorRefPlugin.tsx
|
|
@@ -4056,44 +4179,47 @@ function EditorRefPlugin({
|
|
|
4056
4179
|
|
|
4057
4180
|
// src/components/Variables/composer/PasteTransformerPlugin.tsx
|
|
4058
4181
|
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4182
|
+
var import_utils3 = require("@lexical/utils");
|
|
4059
4183
|
var import_lexical5 = require("lexical");
|
|
4060
|
-
var
|
|
4184
|
+
var import_react40 = require("react");
|
|
4061
4185
|
function PasteTransformerPlugin({ transformPaste }) {
|
|
4062
4186
|
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4063
|
-
(0,
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4187
|
+
(0, import_react40.useEffect)(() => {
|
|
4188
|
+
return (0, import_utils3.mergeRegister)(
|
|
4189
|
+
editor.registerCommand(
|
|
4190
|
+
import_lexical5.PASTE_COMMAND,
|
|
4191
|
+
(event) => {
|
|
4192
|
+
var _a;
|
|
4193
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
4194
|
+
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
4195
|
+
if (pastedText && transformPaste && (0, import_lexical5.$isRangeSelection)(selection)) {
|
|
4196
|
+
const result = transformPaste(pastedText);
|
|
4197
|
+
if (result !== void 0) {
|
|
4198
|
+
selection.insertText(result);
|
|
4199
|
+
return true;
|
|
4200
|
+
}
|
|
4075
4201
|
}
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4202
|
+
return false;
|
|
4203
|
+
},
|
|
4204
|
+
import_lexical5.COMMAND_PRIORITY_HIGH
|
|
4205
|
+
)
|
|
4080
4206
|
);
|
|
4081
4207
|
}, [editor, transformPaste]);
|
|
4082
4208
|
return null;
|
|
4083
4209
|
}
|
|
4084
4210
|
|
|
4085
4211
|
// src/components/Variables/styles/InputVariables.styles.ts
|
|
4086
|
-
var
|
|
4087
|
-
var menuContainer =
|
|
4212
|
+
var import_react41 = require("@emotion/react");
|
|
4213
|
+
var menuContainer = import_react41.css`
|
|
4088
4214
|
position: relative;
|
|
4089
4215
|
`;
|
|
4090
|
-
var menuBtn2 =
|
|
4216
|
+
var menuBtn2 = import_react41.css`
|
|
4091
4217
|
position: absolute;
|
|
4092
4218
|
top: 50%;
|
|
4093
4219
|
right: var(--spacing-sm);
|
|
4094
4220
|
transform: translateY(-50%);
|
|
4095
4221
|
`;
|
|
4096
|
-
var input =
|
|
4222
|
+
var input = import_react41.css`
|
|
4097
4223
|
appearance: none;
|
|
4098
4224
|
background-color: var(--white);
|
|
4099
4225
|
border: 1px solid var(--gray-400);
|
|
@@ -4130,7 +4256,7 @@ var input = import_react40.css`
|
|
|
4130
4256
|
|
|
4131
4257
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4132
4258
|
var React10 = __toESM(require("react"));
|
|
4133
|
-
var
|
|
4259
|
+
var import_react42 = require("react");
|
|
4134
4260
|
|
|
4135
4261
|
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4136
4262
|
var import_canvas4 = require("@uniformdev/canvas");
|
|
@@ -4175,7 +4301,7 @@ function useInputVariablesState({
|
|
|
4175
4301
|
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
|
|
4176
4302
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4177
4303
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4178
|
-
const sharedMenuProps = (0,
|
|
4304
|
+
const sharedMenuProps = (0, import_react42.useMemo)(
|
|
4179
4305
|
() => ({
|
|
4180
4306
|
menuTooltip,
|
|
4181
4307
|
showAddVariableMenuOption,
|
|
@@ -4200,20 +4326,21 @@ function useInputVariablesState({
|
|
|
4200
4326
|
sharedMenuProps,
|
|
4201
4327
|
disableVariablesForReals,
|
|
4202
4328
|
hasVariablesInValue,
|
|
4203
|
-
hadVariablesInValue: hadVariablesInValueForReals
|
|
4329
|
+
hadVariablesInValue: hadVariablesInValueForReals,
|
|
4330
|
+
setHadVariablesInValue
|
|
4204
4331
|
};
|
|
4205
4332
|
}
|
|
4206
4333
|
|
|
4207
4334
|
// src/components/Variables/toolbox/VariableField.styles.ts
|
|
4208
|
-
var
|
|
4209
|
-
var labelText =
|
|
4335
|
+
var import_react43 = require("@emotion/react");
|
|
4336
|
+
var labelText = import_react43.css`
|
|
4210
4337
|
align-items: center;
|
|
4211
4338
|
display: flex;
|
|
4212
4339
|
gap: var(--spacing-xs);
|
|
4213
4340
|
font-weight: var(--fw-regular);
|
|
4214
4341
|
margin: 0 0 var(--spacing-xs);
|
|
4215
4342
|
`;
|
|
4216
|
-
var variableBindButton =
|
|
4343
|
+
var variableBindButton = import_react43.css`
|
|
4217
4344
|
align-items: center;
|
|
4218
4345
|
border: none;
|
|
4219
4346
|
border-radius: var(--rounded-base);
|
|
@@ -4245,7 +4372,7 @@ var import_lexical6 = require("lexical");
|
|
|
4245
4372
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
4246
4373
|
var import_CgUsbC = require("@react-icons/all-files/cg/CgUsbC");
|
|
4247
4374
|
var import_design_system19 = require("@uniformdev/design-system");
|
|
4248
|
-
var
|
|
4375
|
+
var import_react44 = require("react");
|
|
4249
4376
|
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4250
4377
|
function SelectVariableMenu({
|
|
4251
4378
|
onSelectVariable,
|
|
@@ -4258,17 +4385,9 @@ function SelectVariableMenu({
|
|
|
4258
4385
|
menuTooltip = "Insert variable",
|
|
4259
4386
|
filterVariable
|
|
4260
4387
|
}) {
|
|
4261
|
-
const { variables,
|
|
4262
|
-
const btnRef = (0,
|
|
4263
|
-
const
|
|
4264
|
-
useOnVariableUpdated(({ name, latestValue }) => {
|
|
4265
|
-
onSelectVariable == null ? void 0 : onSelectVariable({ ...latestValue[name], name });
|
|
4266
|
-
}, !openedAdd);
|
|
4267
|
-
(0, import_react43.useEffect)(() => {
|
|
4268
|
-
if (openedAdd && !isEditing) {
|
|
4269
|
-
setOpenedAdd(false);
|
|
4270
|
-
}
|
|
4271
|
-
}, [isEditing, openedAdd]);
|
|
4388
|
+
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
4389
|
+
const btnRef = (0, import_react44.useRef)(null);
|
|
4390
|
+
const { editVariable } = useVariableEditor();
|
|
4272
4391
|
const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
4273
4392
|
const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
|
|
4274
4393
|
const menuHasVariableOptions = variablesGroups.length > 0;
|
|
@@ -4297,9 +4416,12 @@ function SelectVariableMenu({
|
|
|
4297
4416
|
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4298
4417
|
import_design_system19.MenuItem,
|
|
4299
4418
|
{
|
|
4300
|
-
onClick: () => {
|
|
4301
|
-
|
|
4302
|
-
|
|
4419
|
+
onClick: async () => {
|
|
4420
|
+
const result = await editVariable("", getEditorContext == null ? void 0 : getEditorContext());
|
|
4421
|
+
if (result.canceled) {
|
|
4422
|
+
return;
|
|
4423
|
+
}
|
|
4424
|
+
onSelectVariable == null ? void 0 : onSelectVariable(result.selectedVariable);
|
|
4303
4425
|
},
|
|
4304
4426
|
"data-testid": "add-variable-button",
|
|
4305
4427
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system19.HorizontalRhythm, { gap: "sm", align: "center", children: [
|
|
@@ -4343,7 +4465,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4343
4465
|
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
4344
4466
|
const onSelectVariable = (selectedVariable) => {
|
|
4345
4467
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
4346
|
-
|
|
4468
|
+
variable: selectedVariable.name,
|
|
4347
4469
|
initialDisplayName: selectedVariable.displayName,
|
|
4348
4470
|
targetKey: void 0,
|
|
4349
4471
|
overwriteExistingValue: props.replaceValueOnVariableInsert
|
|
@@ -4398,14 +4520,14 @@ var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlug
|
|
|
4398
4520
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4399
4521
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4400
4522
|
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4401
|
-
var
|
|
4523
|
+
var import_react47 = require("react");
|
|
4402
4524
|
|
|
4403
4525
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4404
4526
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
4405
|
-
var
|
|
4527
|
+
var import_react45 = require("react");
|
|
4406
4528
|
function DisablePlugin({ disabled }) {
|
|
4407
4529
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
4408
|
-
(0,
|
|
4530
|
+
(0, import_react45.useEffect)(() => {
|
|
4409
4531
|
editor.setEditable(!disabled);
|
|
4410
4532
|
}, [editor, disabled]);
|
|
4411
4533
|
return null;
|
|
@@ -4414,10 +4536,10 @@ function DisablePlugin({ disabled }) {
|
|
|
4414
4536
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4415
4537
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4416
4538
|
var import_lexical7 = require("lexical");
|
|
4417
|
-
var
|
|
4539
|
+
var import_react46 = require("react");
|
|
4418
4540
|
function SingleLineTextPlugin() {
|
|
4419
4541
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4420
|
-
(0,
|
|
4542
|
+
(0, import_react46.useEffect)(() => {
|
|
4421
4543
|
editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
|
|
4422
4544
|
node.remove();
|
|
4423
4545
|
});
|
|
@@ -4470,8 +4592,8 @@ function VariablesComposer(props) {
|
|
|
4470
4592
|
autoFocus,
|
|
4471
4593
|
...variablesPluginProps
|
|
4472
4594
|
} = props;
|
|
4473
|
-
const [lastEmittedValue, setLastEmittedValue] = (0,
|
|
4474
|
-
const editorConfig = (0,
|
|
4595
|
+
const [lastEmittedValue, setLastEmittedValue] = (0, import_react47.useState)(value);
|
|
4596
|
+
const editorConfig = (0, import_react47.useMemo)(
|
|
4475
4597
|
() => ({
|
|
4476
4598
|
namespace: "uniform",
|
|
4477
4599
|
onError(error) {
|
|
@@ -4483,8 +4605,8 @@ function VariablesComposer(props) {
|
|
|
4483
4605
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4484
4606
|
[]
|
|
4485
4607
|
);
|
|
4486
|
-
const editorState = (0,
|
|
4487
|
-
const updateTimeout = (0,
|
|
4608
|
+
const editorState = (0, import_react47.useRef)();
|
|
4609
|
+
const updateTimeout = (0, import_react47.useRef)();
|
|
4488
4610
|
if (typeof document === "undefined")
|
|
4489
4611
|
return null;
|
|
4490
4612
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
@@ -4524,9 +4646,9 @@ var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditab
|
|
|
4524
4646
|
var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
|
|
4525
4647
|
var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
|
|
4526
4648
|
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4527
|
-
var
|
|
4649
|
+
var import_utils4 = require("@lexical/utils");
|
|
4528
4650
|
var import_lexical9 = require("lexical");
|
|
4529
|
-
var
|
|
4651
|
+
var import_react48 = require("react");
|
|
4530
4652
|
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4531
4653
|
function VariablesComposerInput({ css: css37, ...contentEditableProps }) {
|
|
4532
4654
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
@@ -4544,67 +4666,75 @@ function VariablesComposerInput({ css: css37, ...contentEditableProps }) {
|
|
|
4544
4666
|
}
|
|
4545
4667
|
function RichishCopyAndPastePlugin() {
|
|
4546
4668
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
4547
|
-
(0,
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
(
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4669
|
+
(0, import_react48.useEffect)(() => {
|
|
4670
|
+
return (0, import_utils4.mergeRegister)(
|
|
4671
|
+
editor.registerCommand(
|
|
4672
|
+
import_lexical9.COPY_COMMAND,
|
|
4673
|
+
(event) => {
|
|
4674
|
+
(0, import_clipboard.copyToClipboard)(
|
|
4675
|
+
editor,
|
|
4676
|
+
(0, import_utils4.objectKlassEquals)(event, ClipboardEvent) ? event : null
|
|
4677
|
+
);
|
|
4678
|
+
return true;
|
|
4679
|
+
},
|
|
4680
|
+
import_lexical9.COMMAND_PRIORITY_HIGH
|
|
4681
|
+
),
|
|
4682
|
+
editor.registerCommand(
|
|
4683
|
+
import_lexical9.CUT_COMMAND,
|
|
4684
|
+
(event) => {
|
|
4685
|
+
(0, import_clipboard.copyToClipboard)(
|
|
4686
|
+
editor,
|
|
4687
|
+
(0, import_utils4.objectKlassEquals)(event, ClipboardEvent) ? event : null
|
|
4688
|
+
);
|
|
4689
|
+
editor.update(() => {
|
|
4690
|
+
const selection = (0, import_lexical9.$getSelection)();
|
|
4691
|
+
if ((0, import_lexical9.$isRangeSelection)(selection)) {
|
|
4692
|
+
selection.removeText();
|
|
4693
|
+
} else if ((0, import_lexical9.$isNodeSelection)(selection)) {
|
|
4694
|
+
selection.getNodes().forEach((node) => node.remove());
|
|
4695
|
+
}
|
|
4696
|
+
});
|
|
4697
|
+
return true;
|
|
4698
|
+
},
|
|
4699
|
+
import_lexical9.COMMAND_PRIORITY_HIGH
|
|
4700
|
+
),
|
|
4701
|
+
editor.registerCommand(
|
|
4702
|
+
import_lexical9.PASTE_COMMAND,
|
|
4703
|
+
(event) => {
|
|
4561
4704
|
const selection = (0, import_lexical9.$getSelection)();
|
|
4562
4705
|
if ((0, import_lexical9.$isRangeSelection)(selection)) {
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
editor.update(
|
|
4579
|
-
() => {
|
|
4580
|
-
const selection2 = (0, import_lexical9.$getSelection)();
|
|
4581
|
-
const clipboardData = event instanceof InputEvent || event instanceof KeyboardEvent ? null : event.clipboardData;
|
|
4582
|
-
if (clipboardData != null && (0, import_lexical9.$isRangeSelection)(selection2)) {
|
|
4583
|
-
const lexicalString = clipboardData.getData("application/x-lexical-editor");
|
|
4584
|
-
if (lexicalString) {
|
|
4585
|
-
try {
|
|
4586
|
-
const payload = JSON.parse(lexicalString);
|
|
4587
|
-
if (Array.isArray(payload.nodes)) {
|
|
4588
|
-
const nodes = (0, import_clipboard.$generateNodesFromSerializedNodes)(payload.nodes);
|
|
4589
|
-
return (0, import_clipboard.$insertGeneratedNodes)(editor, nodes, selection2);
|
|
4706
|
+
event.preventDefault();
|
|
4707
|
+
editor.update(
|
|
4708
|
+
() => {
|
|
4709
|
+
const selection2 = (0, import_lexical9.$getSelection)();
|
|
4710
|
+
const clipboardData = event instanceof InputEvent || event instanceof KeyboardEvent ? null : event.clipboardData;
|
|
4711
|
+
if (clipboardData != null && (0, import_lexical9.$isRangeSelection)(selection2)) {
|
|
4712
|
+
const lexicalString = clipboardData.getData("application/x-lexical-editor");
|
|
4713
|
+
if (lexicalString) {
|
|
4714
|
+
try {
|
|
4715
|
+
const payload = JSON.parse(lexicalString);
|
|
4716
|
+
if (Array.isArray(payload.nodes)) {
|
|
4717
|
+
const nodes = (0, import_clipboard.$generateNodesFromSerializedNodes)(payload.nodes);
|
|
4718
|
+
return (0, import_clipboard.$insertGeneratedNodes)(editor, nodes, selection2);
|
|
4719
|
+
}
|
|
4720
|
+
} catch (e) {
|
|
4590
4721
|
}
|
|
4591
|
-
}
|
|
4722
|
+
}
|
|
4723
|
+
const text = clipboardData.getData("text/plain") || clipboardData.getData("text/uri-list");
|
|
4724
|
+
if (text != null) {
|
|
4725
|
+
selection2.insertRawText(text);
|
|
4592
4726
|
}
|
|
4593
4727
|
}
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
}
|
|
4728
|
+
},
|
|
4729
|
+
{
|
|
4730
|
+
tag: "paste"
|
|
4598
4731
|
}
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
return true;
|
|
4606
|
-
},
|
|
4607
|
-
import_lexical9.COMMAND_PRIORITY_HIGH
|
|
4732
|
+
);
|
|
4733
|
+
}
|
|
4734
|
+
return true;
|
|
4735
|
+
},
|
|
4736
|
+
import_lexical9.COMMAND_PRIORITY_HIGH
|
|
4737
|
+
)
|
|
4608
4738
|
);
|
|
4609
4739
|
}, [editor]);
|
|
4610
4740
|
return null;
|
|
@@ -4636,7 +4766,7 @@ function InputVariables(props) {
|
|
|
4636
4766
|
editorRef,
|
|
4637
4767
|
filterVariable
|
|
4638
4768
|
} = props;
|
|
4639
|
-
const [finalId] = (0,
|
|
4769
|
+
const [finalId] = (0, import_react49.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4640
4770
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
4641
4771
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
|
|
4642
4772
|
const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
|
|
@@ -4742,11 +4872,11 @@ function InputVariablesOverlayMenu({
|
|
|
4742
4872
|
var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
|
|
4743
4873
|
var import_canvas6 = require("@uniformdev/canvas");
|
|
4744
4874
|
var import_design_system21 = require("@uniformdev/design-system");
|
|
4745
|
-
var
|
|
4875
|
+
var import_react51 = require("react");
|
|
4746
4876
|
|
|
4747
4877
|
// src/components/Variables/styles/ParameterVariables.styles.ts
|
|
4748
|
-
var
|
|
4749
|
-
var variableBindButton2 =
|
|
4878
|
+
var import_react50 = require("@emotion/react");
|
|
4879
|
+
var variableBindButton2 = import_react50.css`
|
|
4750
4880
|
align-items: center;
|
|
4751
4881
|
border: none;
|
|
4752
4882
|
border-radius: var(--rounded-base);
|
|
@@ -4775,7 +4905,7 @@ var variableBindButton2 = import_react49.css`
|
|
|
4775
4905
|
max-height: unset;
|
|
4776
4906
|
}
|
|
4777
4907
|
`;
|
|
4778
|
-
var input2 =
|
|
4908
|
+
var input2 = import_react50.css`
|
|
4779
4909
|
display: block;
|
|
4780
4910
|
appearance: none;
|
|
4781
4911
|
box-sizing: border-box;
|
|
@@ -4824,7 +4954,7 @@ var input2 = import_react49.css`
|
|
|
4824
4954
|
margin: 0;
|
|
4825
4955
|
}
|
|
4826
4956
|
`;
|
|
4827
|
-
var inputMultiLine = (lines) =>
|
|
4957
|
+
var inputMultiLine = (lines) => import_react50.css`
|
|
4828
4958
|
// 1.5 = line height, spacing-md = top and bottom padding
|
|
4829
4959
|
height: calc(${lines * 1.5}em + var(--spacing-md));
|
|
4830
4960
|
resize: vertical;
|
|
@@ -4840,7 +4970,7 @@ function ParameterConnectionIndicator({
|
|
|
4840
4970
|
disabled,
|
|
4841
4971
|
menuTooltip = "Insert variable"
|
|
4842
4972
|
}) {
|
|
4843
|
-
const hasVariablesInValue = (0,
|
|
4973
|
+
const hasVariablesInValue = (0, import_react51.useMemo)(() => {
|
|
4844
4974
|
let result = false;
|
|
4845
4975
|
(0, import_canvas6.bindVariablesToObject)({
|
|
4846
4976
|
value,
|
|
@@ -4877,6 +5007,46 @@ function ParameterConnectionIndicator({
|
|
|
4877
5007
|
|
|
4878
5008
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
4879
5009
|
var import_design_system22 = require("@uniformdev/design-system");
|
|
5010
|
+
var import_react53 = require("react");
|
|
5011
|
+
|
|
5012
|
+
// src/components/Variables/composer/OnDisconnectPlugin.tsx
|
|
5013
|
+
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
5014
|
+
var import_utils5 = require("@lexical/utils");
|
|
5015
|
+
var import_lexical10 = require("lexical");
|
|
5016
|
+
var import_react52 = require("react");
|
|
5017
|
+
function OnDisconnectPlugin({
|
|
5018
|
+
onDisconnect
|
|
5019
|
+
}) {
|
|
5020
|
+
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
5021
|
+
const { variables } = useVariables(true);
|
|
5022
|
+
const variablesRef = (0, import_react52.useRef)(variables);
|
|
5023
|
+
variablesRef.current = variables;
|
|
5024
|
+
(0, import_react52.useEffect)(() => {
|
|
5025
|
+
return (0, import_utils5.mergeRegister)(
|
|
5026
|
+
editor.registerCommand(
|
|
5027
|
+
DISCONNECT_VARIABLE_COMMAND,
|
|
5028
|
+
({ sourceKey }) => {
|
|
5029
|
+
editor.update(() => {
|
|
5030
|
+
const currentNode = (0, import_lexical10.$getNodeByKey)(sourceKey);
|
|
5031
|
+
if (!$isVariableNode(currentNode)) {
|
|
5032
|
+
return;
|
|
5033
|
+
}
|
|
5034
|
+
const currentVariableDefinition = variablesRef.current[currentNode.reference];
|
|
5035
|
+
if (!currentVariableDefinition) {
|
|
5036
|
+
return;
|
|
5037
|
+
}
|
|
5038
|
+
onDisconnect({ name: currentNode.reference, ...currentVariableDefinition });
|
|
5039
|
+
});
|
|
5040
|
+
return false;
|
|
5041
|
+
},
|
|
5042
|
+
import_lexical10.COMMAND_PRIORITY_HIGH
|
|
5043
|
+
)
|
|
5044
|
+
);
|
|
5045
|
+
}, [editor, onDisconnect]);
|
|
5046
|
+
return null;
|
|
5047
|
+
}
|
|
5048
|
+
|
|
5049
|
+
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
4880
5050
|
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
4881
5051
|
function ParameterOrSingleVariable(props) {
|
|
4882
5052
|
const {
|
|
@@ -4886,9 +5056,25 @@ function ParameterOrSingleVariable(props) {
|
|
|
4886
5056
|
enableEditingVariables,
|
|
4887
5057
|
disabled,
|
|
4888
5058
|
editorRef,
|
|
4889
|
-
filterVariable
|
|
5059
|
+
filterVariable,
|
|
5060
|
+
onDisconnect
|
|
4890
5061
|
} = props;
|
|
4891
|
-
const {
|
|
5062
|
+
const {
|
|
5063
|
+
disableVariablesForReals,
|
|
5064
|
+
hadVariablesInValue,
|
|
5065
|
+
sharedMenuProps,
|
|
5066
|
+
hasVariablesInValue,
|
|
5067
|
+
setHadVariablesInValue
|
|
5068
|
+
} = useInputVariablesState(props);
|
|
5069
|
+
const handleDisconnect = (0, import_react53.useCallback)(
|
|
5070
|
+
(variable) => {
|
|
5071
|
+
setHadVariablesInValue(false);
|
|
5072
|
+
if (onDisconnect) {
|
|
5073
|
+
onDisconnect(variable);
|
|
5074
|
+
}
|
|
5075
|
+
},
|
|
5076
|
+
[onDisconnect, setHadVariablesInValue]
|
|
5077
|
+
);
|
|
4892
5078
|
return (
|
|
4893
5079
|
// we use a "fauxical" lexical here to render the vars the same as other editors do,
|
|
4894
5080
|
// and also to enable us to dispatch the same editor commands as other editors do
|
|
@@ -4903,6 +5089,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
4903
5089
|
replaceValueOnVariableInsert: true,
|
|
4904
5090
|
disabled: true,
|
|
4905
5091
|
children: [
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(OnDisconnectPlugin, { onDisconnect: handleDisconnect }),
|
|
4906
5093
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
4907
5094
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ControlledValuePlugin, { enabled: true, value }),
|
|
4908
5095
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
@@ -4932,7 +5119,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
4932
5119
|
}
|
|
4933
5120
|
|
|
4934
5121
|
// src/components/Variables/ParameterVariables.tsx
|
|
4935
|
-
var
|
|
5122
|
+
var import_react54 = require("@emotion/react");
|
|
4936
5123
|
var import_design_system23 = require("@uniformdev/design-system");
|
|
4937
5124
|
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
4938
5125
|
function ParameterVariables(props) {
|
|
@@ -4990,7 +5177,7 @@ function ParameterVariables(props) {
|
|
|
4990
5177
|
"data-text-value": value,
|
|
4991
5178
|
css: [
|
|
4992
5179
|
input2,
|
|
4993
|
-
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(4) :
|
|
5180
|
+
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(4) : import_react54.css``
|
|
4994
5181
|
]
|
|
4995
5182
|
}
|
|
4996
5183
|
) }),
|
|
@@ -5025,28 +5212,14 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5025
5212
|
};
|
|
5026
5213
|
}
|
|
5027
5214
|
|
|
5028
|
-
// src/components/Variables/util/variableDefaultTextValue.ts
|
|
5029
|
-
function variableDefaultTextValue(defaultValue) {
|
|
5030
|
-
if (defaultValue === void 0 || defaultValue === null) {
|
|
5031
|
-
return "";
|
|
5032
|
-
}
|
|
5033
|
-
if (typeof defaultValue === "string") {
|
|
5034
|
-
return defaultValue;
|
|
5035
|
-
}
|
|
5036
|
-
if (defaultValue.toString) {
|
|
5037
|
-
return defaultValue.toString();
|
|
5038
|
-
}
|
|
5039
|
-
return "unknown";
|
|
5040
|
-
}
|
|
5041
|
-
|
|
5042
5215
|
// src/components/Variables/VariablesList.tsx
|
|
5043
|
-
var
|
|
5216
|
+
var import_react56 = require("@emotion/react");
|
|
5044
5217
|
var import_design_system24 = require("@uniformdev/design-system");
|
|
5045
5218
|
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
|
5046
5219
|
|
|
5047
5220
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
5048
|
-
var
|
|
5049
|
-
var tableRow = (isDragging) =>
|
|
5221
|
+
var import_react55 = require("@emotion/react");
|
|
5222
|
+
var tableRow = (isDragging) => import_react55.css`
|
|
5050
5223
|
position: relative;
|
|
5051
5224
|
${isDragging ? `
|
|
5052
5225
|
display: table;
|
|
@@ -5054,7 +5227,7 @@ var tableRow = (isDragging) => import_react52.css`
|
|
|
5054
5227
|
top: auto !important;
|
|
5055
5228
|
` : void 0}
|
|
5056
5229
|
`;
|
|
5057
|
-
var tableCellDragIcon =
|
|
5230
|
+
var tableCellDragIcon = import_react55.css`
|
|
5058
5231
|
&::after {
|
|
5059
5232
|
content: '';
|
|
5060
5233
|
display: block;
|
|
@@ -5072,7 +5245,7 @@ var tableCellDragIcon = import_react52.css`
|
|
|
5072
5245
|
opacity: 1;
|
|
5073
5246
|
}
|
|
5074
5247
|
`;
|
|
5075
|
-
var variableName =
|
|
5248
|
+
var variableName = import_react55.css`
|
|
5076
5249
|
border: none;
|
|
5077
5250
|
color: var(--brand-secondary-5);
|
|
5078
5251
|
font-weight: var(--fw-medium);
|
|
@@ -5083,7 +5256,7 @@ var variableName = import_react52.css`
|
|
|
5083
5256
|
white-space: nowrap;
|
|
5084
5257
|
max-width: 20ch;
|
|
5085
5258
|
`;
|
|
5086
|
-
var variableValue =
|
|
5259
|
+
var variableValue = import_react55.css`
|
|
5087
5260
|
overflow: hidden;
|
|
5088
5261
|
text-overflow: ellipsis;
|
|
5089
5262
|
white-space: nowrap;
|
|
@@ -5160,7 +5333,7 @@ function VariablesList() {
|
|
|
5160
5333
|
title: `delete ${text}`,
|
|
5161
5334
|
css: [
|
|
5162
5335
|
import_design_system24.button,
|
|
5163
|
-
|
|
5336
|
+
import_react56.css`
|
|
5164
5337
|
background: transparent;
|
|
5165
5338
|
`
|
|
5166
5339
|
],
|
|
@@ -5287,9 +5460,9 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
5287
5460
|
}
|
|
5288
5461
|
|
|
5289
5462
|
// src/components/Request/RequestBody.tsx
|
|
5290
|
-
var
|
|
5463
|
+
var import_react58 = require("@emotion/react");
|
|
5291
5464
|
var import_design_system26 = require("@uniformdev/design-system");
|
|
5292
|
-
var
|
|
5465
|
+
var import_react59 = require("react");
|
|
5293
5466
|
|
|
5294
5467
|
// src/components/Request/RequestProvider.tsx
|
|
5295
5468
|
var React11 = __toESM(require("react"));
|
|
@@ -5373,11 +5546,11 @@ function useRequest() {
|
|
|
5373
5546
|
}
|
|
5374
5547
|
|
|
5375
5548
|
// src/components/Request/styles/Request.styles.ts
|
|
5376
|
-
var
|
|
5377
|
-
var innerContentStyles =
|
|
5549
|
+
var import_react57 = require("@emotion/react");
|
|
5550
|
+
var innerContentStyles = import_react57.css`
|
|
5378
5551
|
background: var(--white);
|
|
5379
5552
|
`;
|
|
5380
|
-
var requestTypeContainer = (bgColor) =>
|
|
5553
|
+
var requestTypeContainer = (bgColor) => import_react57.css`
|
|
5381
5554
|
align-items: start;
|
|
5382
5555
|
background: ${bgColor};
|
|
5383
5556
|
display: grid;
|
|
@@ -5415,11 +5588,11 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
5415
5588
|
};
|
|
5416
5589
|
function RequestBody() {
|
|
5417
5590
|
const { request, dispatch } = useRequest();
|
|
5418
|
-
const [language, setLanguage] = (0,
|
|
5591
|
+
const [language, setLanguage] = (0, import_react59.useState)("json");
|
|
5419
5592
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5420
5593
|
"div",
|
|
5421
5594
|
{
|
|
5422
|
-
css:
|
|
5595
|
+
css: import_react58.css`
|
|
5423
5596
|
background: var(--white);
|
|
5424
5597
|
`,
|
|
5425
5598
|
children: [
|
|
@@ -5427,7 +5600,7 @@ function RequestBody() {
|
|
|
5427
5600
|
RequestTypeContainer,
|
|
5428
5601
|
{
|
|
5429
5602
|
bgColor: "var(--gray-100)",
|
|
5430
|
-
css:
|
|
5603
|
+
css: import_react58.css`
|
|
5431
5604
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
5432
5605
|
`,
|
|
5433
5606
|
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
@@ -5698,8 +5871,8 @@ function RequestParameters({
|
|
|
5698
5871
|
}
|
|
5699
5872
|
|
|
5700
5873
|
// src/components/Request/RequestUrl.tsx
|
|
5701
|
-
var
|
|
5702
|
-
var
|
|
5874
|
+
var import_react60 = require("@emotion/react");
|
|
5875
|
+
var import_react61 = require("react");
|
|
5703
5876
|
|
|
5704
5877
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
5705
5878
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -5725,7 +5898,7 @@ function RequestUrl() {
|
|
|
5725
5898
|
var _a, _b;
|
|
5726
5899
|
const { variables } = useVariables();
|
|
5727
5900
|
const { request } = useRequest();
|
|
5728
|
-
const mergedParameters = (0,
|
|
5901
|
+
const mergedParameters = (0, import_react61.useMemo)(() => {
|
|
5729
5902
|
var _a2;
|
|
5730
5903
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
5731
5904
|
return request.parameters;
|
|
@@ -5735,7 +5908,7 @@ function RequestUrl() {
|
|
|
5735
5908
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
5736
5909
|
"small",
|
|
5737
5910
|
{
|
|
5738
|
-
css:
|
|
5911
|
+
css: import_react60.css`
|
|
5739
5912
|
display: inline-block;
|
|
5740
5913
|
margin-bottom: var(--spacing-xs);
|
|
5741
5914
|
word-break: break-word;
|
|
@@ -5973,12 +6146,12 @@ var import_design_system30 = require("@uniformdev/design-system");
|
|
|
5973
6146
|
|
|
5974
6147
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
5975
6148
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
5976
|
-
var
|
|
6149
|
+
var import_react62 = require("react");
|
|
5977
6150
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
5978
|
-
const [error, setError] = (0,
|
|
5979
|
-
const [sdk, setSdk] = (0,
|
|
5980
|
-
const initializationInProgress = (0,
|
|
5981
|
-
(0,
|
|
6151
|
+
const [error, setError] = (0, import_react62.useState)();
|
|
6152
|
+
const [sdk, setSdk] = (0, import_react62.useState)();
|
|
6153
|
+
const initializationInProgress = (0, import_react62.useRef)(false);
|
|
6154
|
+
(0, import_react62.useEffect)(
|
|
5982
6155
|
() => {
|
|
5983
6156
|
if (typeof window === "undefined" || sdk) {
|
|
5984
6157
|
return;
|
|
@@ -6036,7 +6209,7 @@ var MeshApp = ({
|
|
|
6036
6209
|
};
|
|
6037
6210
|
|
|
6038
6211
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
6039
|
-
var
|
|
6212
|
+
var import_react63 = require("@emotion/react");
|
|
6040
6213
|
var import_design_system31 = require("@uniformdev/design-system");
|
|
6041
6214
|
var import_jsx_runtime57 = require("@emotion/react/jsx-runtime");
|
|
6042
6215
|
var DataRefreshButton = ({
|
|
@@ -6049,7 +6222,7 @@ var DataRefreshButton = ({
|
|
|
6049
6222
|
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6050
6223
|
import_design_system31.LoadingIndicator,
|
|
6051
6224
|
{
|
|
6052
|
-
css:
|
|
6225
|
+
css: import_react63.css`
|
|
6053
6226
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
6054
6227
|
`
|
|
6055
6228
|
}
|
|
@@ -6059,15 +6232,15 @@ var DataRefreshButton = ({
|
|
|
6059
6232
|
};
|
|
6060
6233
|
|
|
6061
6234
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6062
|
-
var
|
|
6235
|
+
var import_react65 = require("@emotion/react");
|
|
6063
6236
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6064
6237
|
var import_design_system32 = require("@uniformdev/design-system");
|
|
6065
6238
|
|
|
6066
6239
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6067
6240
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
6068
|
-
var
|
|
6241
|
+
var import_react64 = require("react");
|
|
6069
6242
|
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6070
|
-
var ObjectSearchContext = (0,
|
|
6243
|
+
var ObjectSearchContext = (0, import_react64.createContext)({
|
|
6071
6244
|
onSetQuery: () => {
|
|
6072
6245
|
},
|
|
6073
6246
|
onSelectItem: () => {
|
|
@@ -6082,15 +6255,15 @@ var ObjectSearchContext = (0, import_react61.createContext)({
|
|
|
6082
6255
|
}
|
|
6083
6256
|
});
|
|
6084
6257
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
6085
|
-
const [query, setQuery] = (0,
|
|
6258
|
+
const [query, setQuery] = (0, import_react64.useState)({
|
|
6086
6259
|
contentType: "",
|
|
6087
6260
|
keyword: ""
|
|
6088
6261
|
});
|
|
6089
6262
|
const { flatVariables } = useVariables(true);
|
|
6090
|
-
const querySearchDeferred = (0,
|
|
6091
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6092
|
-
const [list, setList] = (0,
|
|
6093
|
-
const onSetQuery = (0,
|
|
6263
|
+
const querySearchDeferred = (0, import_react64.useDeferredValue)(query);
|
|
6264
|
+
const [selectedItems, setSelectedItems] = (0, import_react64.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
6265
|
+
const [list, setList] = (0, import_react64.useState)({});
|
|
6266
|
+
const onSetQuery = (0, import_react64.useCallback)(
|
|
6094
6267
|
(value2) => {
|
|
6095
6268
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6096
6269
|
return setQuery({
|
|
@@ -6102,7 +6275,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6102
6275
|
},
|
|
6103
6276
|
[setQuery]
|
|
6104
6277
|
);
|
|
6105
|
-
const onSelectItem = (0,
|
|
6278
|
+
const onSelectItem = (0, import_react64.useCallback)(
|
|
6106
6279
|
(selectedResult) => {
|
|
6107
6280
|
if (Array.isArray(selectedResult)) {
|
|
6108
6281
|
setSelectedItems(selectedResult);
|
|
@@ -6116,17 +6289,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6116
6289
|
},
|
|
6117
6290
|
[setSelectedItems, selectedItems]
|
|
6118
6291
|
);
|
|
6119
|
-
const onRemoveAllSelectedItems = (0,
|
|
6292
|
+
const onRemoveAllSelectedItems = (0, import_react64.useCallback)(() => {
|
|
6120
6293
|
setSelectedItems([]);
|
|
6121
6294
|
}, [setSelectedItems]);
|
|
6122
|
-
const onSetList = (0,
|
|
6295
|
+
const onSetList = (0, import_react64.useCallback)(
|
|
6123
6296
|
(value2) => {
|
|
6124
6297
|
setList(value2);
|
|
6125
6298
|
},
|
|
6126
6299
|
[setList]
|
|
6127
6300
|
);
|
|
6128
|
-
const boundQuery = (0,
|
|
6129
|
-
const value = (0,
|
|
6301
|
+
const boundQuery = (0, import_react64.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6302
|
+
const value = (0, import_react64.useMemo)(
|
|
6130
6303
|
() => ({
|
|
6131
6304
|
boundQuery,
|
|
6132
6305
|
onSetQuery,
|
|
@@ -6151,7 +6324,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6151
6324
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6152
6325
|
};
|
|
6153
6326
|
function useObjectSearchContext() {
|
|
6154
|
-
return (0,
|
|
6327
|
+
return (0, import_react64.useContext)(ObjectSearchContext);
|
|
6155
6328
|
}
|
|
6156
6329
|
function bindQuery(query, inputs) {
|
|
6157
6330
|
const { result, errors } = (0, import_canvas7.bindVariablesToObject)({
|
|
@@ -6183,7 +6356,7 @@ var ObjectSearchContainer = ({
|
|
|
6183
6356
|
import_design_system32.ScrollableList,
|
|
6184
6357
|
{
|
|
6185
6358
|
role: "list",
|
|
6186
|
-
css:
|
|
6359
|
+
css: import_react65.css`
|
|
6187
6360
|
> div {
|
|
6188
6361
|
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6189
6362
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
@@ -6237,11 +6410,11 @@ var ObjectSearchContainer = ({
|
|
|
6237
6410
|
|
|
6238
6411
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6239
6412
|
var import_design_system33 = require("@uniformdev/design-system");
|
|
6240
|
-
var
|
|
6413
|
+
var import_react67 = require("react");
|
|
6241
6414
|
|
|
6242
6415
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6243
|
-
var
|
|
6244
|
-
var ObjectSearchFilterContainerLabel =
|
|
6416
|
+
var import_react66 = require("@emotion/react");
|
|
6417
|
+
var ObjectSearchFilterContainerLabel = import_react66.css`
|
|
6245
6418
|
align-items: center;
|
|
6246
6419
|
display: flex;
|
|
6247
6420
|
font-size: var(--fs-sm);
|
|
@@ -6249,14 +6422,14 @@ var ObjectSearchFilterContainerLabel = import_react63.css`
|
|
|
6249
6422
|
line-height: 1rem;
|
|
6250
6423
|
margin-bottom: var(--spacing-sm);
|
|
6251
6424
|
`;
|
|
6252
|
-
var ObjectSearchFilterContainer =
|
|
6425
|
+
var ObjectSearchFilterContainer = import_react66.css`
|
|
6253
6426
|
display: grid;
|
|
6254
6427
|
gap: var(--spacing-base);
|
|
6255
6428
|
`;
|
|
6256
|
-
var ObjectSearchFilterDropdownAndTextSearch =
|
|
6429
|
+
var ObjectSearchFilterDropdownAndTextSearch = import_react66.css`
|
|
6257
6430
|
grid-template-columns: 0.5fr 1fr;
|
|
6258
6431
|
`;
|
|
6259
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6432
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react66.css`
|
|
6260
6433
|
display: grid;
|
|
6261
6434
|
grid-template-columns: ${gridColumns};
|
|
6262
6435
|
gap: var(--spacing-base);
|
|
@@ -6273,7 +6446,7 @@ var ObjectSearchFilter = ({
|
|
|
6273
6446
|
selectOptions
|
|
6274
6447
|
}) => {
|
|
6275
6448
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6276
|
-
const [searchState, setSearchState] = (0,
|
|
6449
|
+
const [searchState, setSearchState] = (0, import_react67.useState)({
|
|
6277
6450
|
contentType: "",
|
|
6278
6451
|
keyword: ""
|
|
6279
6452
|
});
|
|
@@ -6327,9 +6500,9 @@ var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
|
6327
6500
|
var import_design_system35 = require("@uniformdev/design-system");
|
|
6328
6501
|
|
|
6329
6502
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6330
|
-
var
|
|
6503
|
+
var import_react68 = require("@emotion/react");
|
|
6331
6504
|
var import_design_system34 = require("@uniformdev/design-system");
|
|
6332
|
-
var ObjectListItemContainer =
|
|
6505
|
+
var ObjectListItemContainer = import_react68.css`
|
|
6333
6506
|
align-items: center;
|
|
6334
6507
|
border: 1px solid var(--gray-300);
|
|
6335
6508
|
border-radius: var(--rounded-base);
|
|
@@ -6338,11 +6511,11 @@ var ObjectListItemContainer = import_react65.css`
|
|
|
6338
6511
|
grid-template-columns: 1fr auto;
|
|
6339
6512
|
padding: var(--spacing-sm);
|
|
6340
6513
|
`;
|
|
6341
|
-
var ObjectListItemContainerDisabled =
|
|
6514
|
+
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6342
6515
|
opacity: var(--opacity-50);
|
|
6343
6516
|
pointer-events: none;
|
|
6344
6517
|
`;
|
|
6345
|
-
var ObjectListItemLoading =
|
|
6518
|
+
var ObjectListItemLoading = import_react68.css`
|
|
6346
6519
|
animation: ${import_design_system34.skeletonLoading} 1s linear infinite alternate;
|
|
6347
6520
|
border-color: transparent;
|
|
6348
6521
|
min-height: 42px;
|
|
@@ -6366,32 +6539,32 @@ var ObjectListItemLoading = import_react65.css`
|
|
|
6366
6539
|
width: 1rem;
|
|
6367
6540
|
}
|
|
6368
6541
|
`;
|
|
6369
|
-
var ObjectListItemHeadingGroup =
|
|
6542
|
+
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6370
6543
|
align-items: center;
|
|
6371
6544
|
display: grid;
|
|
6372
6545
|
`;
|
|
6373
|
-
var ObjectListItemTitle =
|
|
6546
|
+
var ObjectListItemTitle = import_react68.css`
|
|
6374
6547
|
color: var(--brand-secondary-1);
|
|
6375
6548
|
display: block;
|
|
6376
6549
|
font-size: var(--fs-sm);
|
|
6377
6550
|
`;
|
|
6378
|
-
var ObjectListItemSubtitle =
|
|
6551
|
+
var ObjectListItemSubtitle = import_react68.css`
|
|
6379
6552
|
color: var(--gray-500);
|
|
6380
6553
|
display: block;
|
|
6381
6554
|
font-size: var(--fs-xs);
|
|
6382
6555
|
line-height: 1;
|
|
6383
6556
|
`;
|
|
6384
|
-
var ObjectListItemInfoContainer =
|
|
6557
|
+
var ObjectListItemInfoContainer = import_react68.css`
|
|
6385
6558
|
align-items: center;
|
|
6386
6559
|
display: flex;
|
|
6387
6560
|
gap: var(--spacing-sm);
|
|
6388
6561
|
justify-content: center;
|
|
6389
6562
|
`;
|
|
6390
|
-
var ObjectListItemControlledContent =
|
|
6563
|
+
var ObjectListItemControlledContent = import_react68.css`
|
|
6391
6564
|
display: flex;
|
|
6392
6565
|
gap: var(--spacing-sm);
|
|
6393
6566
|
`;
|
|
6394
|
-
var ObjectListItemUnControlledContent =
|
|
6567
|
+
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6395
6568
|
margin-top: var(--spacing-sm);
|
|
6396
6569
|
grid-column: 1 / -1;
|
|
6397
6570
|
`;
|
|
@@ -6461,9 +6634,9 @@ var import_design_system37 = require("@uniformdev/design-system");
|
|
|
6461
6634
|
var import_timeago3 = require("timeago.js");
|
|
6462
6635
|
|
|
6463
6636
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6464
|
-
var
|
|
6637
|
+
var import_react69 = require("@emotion/react");
|
|
6465
6638
|
var import_design_system36 = require("@uniformdev/design-system");
|
|
6466
|
-
var ButtonStyles =
|
|
6639
|
+
var ButtonStyles = import_react69.css`
|
|
6467
6640
|
${import_design_system36.button}
|
|
6468
6641
|
background: transparent;
|
|
6469
6642
|
border: 1px solid var(--brand-secondary-1);
|
|
@@ -6490,7 +6663,7 @@ var ButtonStyles = import_react66.css`
|
|
|
6490
6663
|
text-decoration: none;
|
|
6491
6664
|
}
|
|
6492
6665
|
`;
|
|
6493
|
-
var ButtonIcon =
|
|
6666
|
+
var ButtonIcon = import_react69.css`
|
|
6494
6667
|
width: 1rem;
|
|
6495
6668
|
height: 1rem;
|
|
6496
6669
|
`;
|
|
@@ -6519,8 +6692,8 @@ var LinkButton = ({
|
|
|
6519
6692
|
};
|
|
6520
6693
|
|
|
6521
6694
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6522
|
-
var
|
|
6523
|
-
var ObjectSearchResultItemContainer =
|
|
6695
|
+
var import_react70 = require("@emotion/react");
|
|
6696
|
+
var ObjectSearchResultItemContainer = import_react70.css`
|
|
6524
6697
|
align-items: center;
|
|
6525
6698
|
border: 1px solid var(--gray-300);
|
|
6526
6699
|
border-radius: var(--rounded-base);
|
|
@@ -6536,7 +6709,7 @@ var ObjectSearchResultItemContainer = import_react67.css`
|
|
|
6536
6709
|
}
|
|
6537
6710
|
}
|
|
6538
6711
|
`;
|
|
6539
|
-
var ObjectSearchDragHandle =
|
|
6712
|
+
var ObjectSearchDragHandle = import_react70.css`
|
|
6540
6713
|
border-left: 2px dotted var(--gray-300);
|
|
6541
6714
|
border-right: 2px dotted var(--gray-300);
|
|
6542
6715
|
position: absolute;
|
|
@@ -6545,35 +6718,35 @@ var ObjectSearchDragHandle = import_react67.css`
|
|
|
6545
6718
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6546
6719
|
opacity: 0;
|
|
6547
6720
|
`;
|
|
6548
|
-
var ObjectSearchResultItemSubtitle =
|
|
6721
|
+
var ObjectSearchResultItemSubtitle = import_react70.css`
|
|
6549
6722
|
color: var(--gray-500);
|
|
6550
6723
|
display: block;
|
|
6551
6724
|
font-size: var(--fs-xs);
|
|
6552
6725
|
line-height: 1;
|
|
6553
6726
|
`;
|
|
6554
|
-
var ObjectSearchResultItemTitle =
|
|
6727
|
+
var ObjectSearchResultItemTitle = import_react70.css`
|
|
6555
6728
|
align-items: center;
|
|
6556
6729
|
color: var(--brand-secondary-1);
|
|
6557
6730
|
display: flex;
|
|
6558
6731
|
gap: var(--spacing-xs);
|
|
6559
6732
|
`;
|
|
6560
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6733
|
+
var ObjectSearchResultItemTimeStamp = import_react70.css`
|
|
6561
6734
|
color: var(--gray-500);
|
|
6562
6735
|
font-size: var(--fs-xs);
|
|
6563
6736
|
`;
|
|
6564
|
-
var ObjectSearchAuthorStateGroup =
|
|
6737
|
+
var ObjectSearchAuthorStateGroup = import_react70.css`
|
|
6565
6738
|
align-items: center;
|
|
6566
6739
|
display: flex;
|
|
6567
6740
|
gap: var(--spacing-sm);
|
|
6568
6741
|
`;
|
|
6569
|
-
var ObjectSearchUpdateGroup =
|
|
6742
|
+
var ObjectSearchUpdateGroup = import_react70.css`
|
|
6570
6743
|
display: grid;
|
|
6571
6744
|
`;
|
|
6572
|
-
var ObjectSearchContentContainer =
|
|
6745
|
+
var ObjectSearchContentContainer = import_react70.css`
|
|
6573
6746
|
display: flex;
|
|
6574
6747
|
gap: var(--spacing-base);
|
|
6575
6748
|
`;
|
|
6576
|
-
var ObjectSearchImage =
|
|
6749
|
+
var ObjectSearchImage = import_react70.css`
|
|
6577
6750
|
width: 56px;
|
|
6578
6751
|
object-fit: contain;
|
|
6579
6752
|
`;
|
|
@@ -6641,26 +6814,26 @@ var import_design_system38 = require("@uniformdev/design-system");
|
|
|
6641
6814
|
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
6642
6815
|
|
|
6643
6816
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6644
|
-
var
|
|
6645
|
-
var ObjectSearchResultListContainer =
|
|
6817
|
+
var import_react71 = require("@emotion/react");
|
|
6818
|
+
var ObjectSearchResultListContainer = import_react71.css`
|
|
6646
6819
|
align-items: center;
|
|
6647
6820
|
display: flex;
|
|
6648
6821
|
gap: var(--spacing-sm);
|
|
6649
6822
|
justify-content: space-between;
|
|
6650
6823
|
`;
|
|
6651
|
-
var ObjectSearchDragContainer =
|
|
6824
|
+
var ObjectSearchDragContainer = import_react71.css`
|
|
6652
6825
|
margin: 0 0 var(--spacing-sm);
|
|
6653
6826
|
`;
|
|
6654
|
-
var ObjectSearchContainerDragging =
|
|
6827
|
+
var ObjectSearchContainerDragging = import_react71.css`
|
|
6655
6828
|
box-shadow: var(--shadow-base);
|
|
6656
6829
|
opacity: var(--opacity-50);
|
|
6657
6830
|
`;
|
|
6658
|
-
var ObjectSearchResultListCounterContainer =
|
|
6831
|
+
var ObjectSearchResultListCounterContainer = import_react71.css`
|
|
6659
6832
|
align-items: center;
|
|
6660
6833
|
display: flex;
|
|
6661
6834
|
gap: var(--spacing-sm);
|
|
6662
6835
|
`;
|
|
6663
|
-
var ObjectSearchResultListTitle =
|
|
6836
|
+
var ObjectSearchResultListTitle = import_react71.css`
|
|
6664
6837
|
font-weight: var(--fw-bold);
|
|
6665
6838
|
line-height: 1;
|
|
6666
6839
|
`;
|
|
@@ -6749,7 +6922,7 @@ function ObjectSearchResultList({
|
|
|
6749
6922
|
|
|
6750
6923
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
6751
6924
|
var import_design_system39 = require("@uniformdev/design-system");
|
|
6752
|
-
var
|
|
6925
|
+
var import_react72 = require("react");
|
|
6753
6926
|
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
6754
6927
|
var QueryFilter = ({
|
|
6755
6928
|
requireContentType,
|
|
@@ -6781,7 +6954,7 @@ var QueryFilter = ({
|
|
|
6781
6954
|
}) => {
|
|
6782
6955
|
var _a, _b, _c, _d;
|
|
6783
6956
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6784
|
-
const [queryState, setQueryState] = (0,
|
|
6957
|
+
const [queryState, setQueryState] = (0, import_react72.useState)({
|
|
6785
6958
|
contentType: "",
|
|
6786
6959
|
keyword: "",
|
|
6787
6960
|
count: countValue != null ? countValue : 5,
|
|
@@ -6792,7 +6965,7 @@ var QueryFilter = ({
|
|
|
6792
6965
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
6793
6966
|
onSetQuery({ ...query, ...value });
|
|
6794
6967
|
};
|
|
6795
|
-
(0,
|
|
6968
|
+
(0, import_react72.useEffect)(() => {
|
|
6796
6969
|
onSetQuery(queryState);
|
|
6797
6970
|
}, [onSetQuery, queryState]);
|
|
6798
6971
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("fieldset", { children: [
|
|
@@ -6935,7 +7108,7 @@ var QueryFilter = ({
|
|
|
6935
7108
|
};
|
|
6936
7109
|
|
|
6937
7110
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
6938
|
-
var
|
|
7111
|
+
var import_react73 = require("react");
|
|
6939
7112
|
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
6940
7113
|
function ParamTypeDynamicDataProvider(props) {
|
|
6941
7114
|
const { children } = props;
|
|
@@ -6944,7 +7117,7 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
6944
7117
|
} = useMeshLocation("paramType");
|
|
6945
7118
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
6946
7119
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
6947
|
-
const variables = (0,
|
|
7120
|
+
const variables = (0, import_react73.useMemo)(
|
|
6948
7121
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
6949
7122
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
6950
7123
|
);
|
|
@@ -6957,9 +7130,9 @@ var JsonMeshVariableEditor = ({
|
|
|
6957
7130
|
variable,
|
|
6958
7131
|
context
|
|
6959
7132
|
}) => {
|
|
6960
|
-
const sillyRef = (0,
|
|
7133
|
+
const sillyRef = (0, import_react73.useRef)(false);
|
|
6961
7134
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
6962
|
-
(0,
|
|
7135
|
+
(0, import_react73.useEffect)(() => {
|
|
6963
7136
|
if (sillyRef.current) {
|
|
6964
7137
|
return;
|
|
6965
7138
|
}
|
|
@@ -6977,10 +7150,10 @@ var JsonMeshVariableEditor = ({
|
|
|
6977
7150
|
existingConnectedData: variable
|
|
6978
7151
|
});
|
|
6979
7152
|
if (result.canceled) {
|
|
6980
|
-
onCancel();
|
|
7153
|
+
onCancel(result.editorCancelledContext);
|
|
6981
7154
|
return;
|
|
6982
7155
|
}
|
|
6983
|
-
onSubmit(result.connectedData);
|
|
7156
|
+
onSubmit(result.connectedData, null);
|
|
6984
7157
|
};
|
|
6985
7158
|
effect();
|
|
6986
7159
|
}, [context == null ? void 0 : context.connectsTo, editConnectedData, onCancel, onSubmit, variable]);
|
|
@@ -7006,6 +7179,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7006
7179
|
Button,
|
|
7007
7180
|
Callout,
|
|
7008
7181
|
ControlledValuePlugin,
|
|
7182
|
+
DISCONNECT_VARIABLE_COMMAND,
|
|
7009
7183
|
DamSelectedItem,
|
|
7010
7184
|
DataRefreshButton,
|
|
7011
7185
|
DataResourceDynamicInputProvider,
|
|
@@ -7166,7 +7340,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7166
7340
|
useDynamicInputsAsVariables,
|
|
7167
7341
|
useMeshLocation,
|
|
7168
7342
|
useObjectSearchContext,
|
|
7169
|
-
useOnVariableUpdated,
|
|
7170
7343
|
useParameterShell,
|
|
7171
7344
|
useProductQueryContext,
|
|
7172
7345
|
useProductSearchContext,
|
|
@@ -7174,6 +7347,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7174
7347
|
useRequestHeader,
|
|
7175
7348
|
useRequestParameter,
|
|
7176
7349
|
useUniformMeshSdk,
|
|
7350
|
+
useVariableEditor,
|
|
7177
7351
|
useVariables,
|
|
7178
7352
|
useVariablesMenu,
|
|
7179
7353
|
variableDefaultTextValue,
|