@uniformdev/mesh-sdk-react 19.22.1-alpha.8 → 19.23.1-alpha.12

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.esm.js CHANGED
@@ -2921,42 +2921,206 @@ function useMeshLocation(expectedLocation) {
2921
2921
 
2922
2922
  // src/components/Variables/InputVariables.tsx
2923
2923
  init_emotion_jsx_shim();
2924
- import { Caption, ErrorMessage, InfoMessage, Input as Input3, WarningMessage } from "@uniformdev/design-system";
2924
+ import { Caption as Caption2, ErrorMessage, InfoMessage, WarningMessage } from "@uniformdev/design-system";
2925
2925
  import * as React11 from "react";
2926
- import { v4 as v42 } from "uuid";
2926
+ import { useMemo as useMemo8 } from "react";
2927
+ import { v4 as v43 } from "uuid";
2927
2928
 
2928
- // src/components/Variables/SelectVariableMenu.tsx
2929
+ // src/components/Variables/composer/PasteTransformerPlugin.tsx
2929
2930
  init_emotion_jsx_shim();
2930
- import { Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
2931
- import { useEffect as useEffect6, useRef as useRef8, useState as useState8 } from "react";
2932
- import { CgUsbC } from "react-icons/cg";
2931
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
2932
+ import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
2933
+ import { useEffect as useEffect5 } from "react";
2934
+ function PasteTransformerPlugin({ transformPaste }) {
2935
+ const [editor] = useLexicalComposerContext();
2936
+ useEffect5(() => {
2937
+ editor.registerCommand(
2938
+ PASTE_COMMAND,
2939
+ (event) => {
2940
+ var _a;
2941
+ const selection = $getSelection();
2942
+ const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
2943
+ if (pastedText && transformPaste && $isRangeSelection(selection)) {
2944
+ const result = transformPaste(pastedText);
2945
+ if (result !== void 0) {
2946
+ selection.insertText(result);
2947
+ return true;
2948
+ }
2949
+ }
2950
+ return false;
2951
+ },
2952
+ COMMAND_PRIORITY_HIGH
2953
+ );
2954
+ }, [editor, transformPaste]);
2955
+ return null;
2956
+ }
2933
2957
 
2934
- // src/components/Variables/styles/InsertVariableMenu.styles.ts
2958
+ // src/components/Variables/styles/InputVariables.styles.ts
2935
2959
  init_emotion_jsx_shim();
2936
2960
  import { css as css18 } from "@emotion/react";
2961
+ var menuContainer = css18`
2962
+ position: relative;
2963
+ `;
2937
2964
  var menuBtn = css18`
2938
- background: none;
2939
- border: none;
2940
- color: var(--gray-500);
2941
- padding: 0;
2965
+ position: absolute;
2966
+ top: 50%;
2967
+ right: var(--spacing-sm);
2968
+ transform: translateY(-50%);
2942
2969
  `;
2943
- var menuItemTextGroup = css18`
2944
- align-items: flex-start;
2945
- display: flex;
2946
- flex-direction: column;
2970
+ var input = css18`
2971
+ appearance: none;
2972
+ background-color: var(--white);
2973
+ border: 1px solid var(--gray-400);
2974
+ border-radius: var(--rounded-md);
2975
+ color: var(--gray-700);
2976
+ padding-block: var(--spacing-sm);
2977
+ padding-left: var(--spacing-base);
2978
+ padding-right: var(--spacing-lg);
2979
+ line-height: 2.5;
2980
+ width: 100%;
2981
+ position: relative;
2982
+ transition: background var(--duration-fast) var(--timing-ease-out),
2983
+ border-color var(--duration-fast) var(--timing-ease-out),
2984
+ color var(--duration-fast) var(--timing-ease-out);
2985
+
2986
+ &:focus,
2987
+ &:focus-within {
2988
+ border-color: var(--brand-secondary-1);
2989
+ box-shadow: none;
2990
+ outline: none;
2991
+ }
2992
+
2993
+ &:disabled,
2994
+ &:disabled::placeholder {
2995
+ cursor: not-allowed;
2996
+ color: var(--gray-300);
2997
+ border-color: var(--gray-300);
2998
+ }
2999
+
3000
+ > p {
3001
+ margin: 0;
3002
+ }
2947
3003
  `;
2948
- var smallText = css18`
2949
- font-size: var(--fs-xs);
3004
+
3005
+ // src/components/Variables/util/getReferencedVariables.ts
3006
+ init_emotion_jsx_shim();
3007
+
3008
+ // src/components/Variables/util/parseVariableExpression.ts
3009
+ init_emotion_jsx_shim();
3010
+
3011
+ // src/components/Variables/util/variableExpression.ts
3012
+ init_emotion_jsx_shim();
3013
+ var variablePrefix = "${";
3014
+ var variableSuffix = "}";
3015
+
3016
+ // src/components/Variables/util/parseVariableExpression.ts
3017
+ function parseVariableExpression(serialized, onToken) {
3018
+ let buf = [];
3019
+ let state = "text";
3020
+ for (let index = 0; index < serialized.length; index++) {
3021
+ const char = serialized[index];
3022
+ if (char === "$" && serialized.at(index + 1) === "{") {
3023
+ if (serialized.at(index - 1) === "\\") {
3024
+ buf.pop();
3025
+ buf.push(char);
3026
+ continue;
3027
+ }
3028
+ state = "variable";
3029
+ if (buf.length) {
3030
+ onToken(buf.join(""), "text");
3031
+ buf = [];
3032
+ }
3033
+ index++;
3034
+ continue;
3035
+ }
3036
+ if (char === "}" && state === "variable") {
3037
+ state = "text";
3038
+ if (buf.length) {
3039
+ onToken(buf.join(""), "variable");
3040
+ buf = [];
3041
+ }
3042
+ continue;
3043
+ }
3044
+ buf.push(char);
3045
+ }
3046
+ if (buf.length) {
3047
+ if (state === "variable") {
3048
+ state = "text";
3049
+ buf.unshift(variablePrefix);
3050
+ }
3051
+ onToken(buf.join(""), state);
3052
+ }
3053
+ }
3054
+
3055
+ // src/components/Variables/util/getReferencedVariables.ts
3056
+ function getReferencedVariables(value) {
3057
+ const result = [];
3058
+ parseVariableExpression(value, (token, type) => {
3059
+ if (type === "variable") {
3060
+ result.push(token);
3061
+ }
3062
+ });
3063
+ return result;
3064
+ }
3065
+
3066
+ // src/components/Variables/VariableField.tsx
3067
+ init_emotion_jsx_shim();
3068
+
3069
+ // src/components/Variables/styles/VariableField.styles.ts
3070
+ init_emotion_jsx_shim();
3071
+ import { css as css19 } from "@emotion/react";
3072
+ var labelText = css19`
3073
+ align-items: center;
3074
+ display: flex;
3075
+ gap: var(--spacing-xs);
3076
+ font-weight: var(--fw-regular);
3077
+ margin: 0 0 var(--spacing-xs);
2950
3078
  `;
2951
- var variablesTipText = css18`
2952
- ${smallText}
2953
- color: var(--gray-500);
2954
- padding: 0 var(--spacing-sm);
3079
+ var variableBindButton = css19`
3080
+ align-items: center;
3081
+ border: none;
3082
+ border-radius: var(--rounded-base);
3083
+ background: none;
3084
+ display: flex;
3085
+ height: 1.2rem;
3086
+ padding: var(--spacing-2xs);
3087
+ transition: background var(--duration-fast) var(--timing-ease-out),
3088
+ color var(--duration-fast) var(--timing-ease-out);
3089
+ width: 1.2rem;
3090
+
3091
+ &:hover,
3092
+ &[aria-pressed='true']:not(:disabled) {
3093
+ background: var(--brand-secondary-3);
3094
+ color: var(--white);
3095
+ }
3096
+
3097
+ &[aria-disabled='true'] {
3098
+ background: none;
3099
+ color: currentColor;
3100
+ }
2955
3101
  `;
2956
3102
 
3103
+ // src/components/Variables/VariablesComposerVariableMenu.tsx
3104
+ init_emotion_jsx_shim();
3105
+ import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
3106
+ import { CLEAR_EDITOR_COMMAND } from "lexical";
3107
+
3108
+ // src/components/Variables/composer/VariablesPlugin.tsx
3109
+ init_emotion_jsx_shim();
3110
+ import { css as css21 } from "@emotion/react";
3111
+ import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
3112
+ import {
3113
+ LexicalTypeaheadMenuPlugin,
3114
+ MenuOption
3115
+ } from "@lexical/react/LexicalTypeaheadMenuPlugin";
3116
+ import { Caption, MenuGroup, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
3117
+ import { $insertNodes, $nodesOfType, COMMAND_PRIORITY_NORMAL, createCommand } from "lexical";
3118
+ import { useCallback, useEffect as useEffect7, useMemo as useMemo6, useState as useState8 } from "react";
3119
+ import { createPortal } from "react-dom";
3120
+
2957
3121
  // src/components/Variables/useOnVariableUpdated.ts
2958
3122
  init_emotion_jsx_shim();
2959
- import { useEffect as useEffect5 } from "react";
3123
+ import { useEffect as useEffect6 } from "react";
2960
3124
 
2961
3125
  // src/components/Variables/VariablesProvider.tsx
2962
3126
  init_emotion_jsx_shim();
@@ -2972,13 +3136,13 @@ import { z } from "zod";
2972
3136
 
2973
3137
  // src/components/Variables/styles/VariableEditor.styles.ts
2974
3138
  init_emotion_jsx_shim();
2975
- import { css as css19 } from "@emotion/react";
2976
- var variablesFormContainer = css19`
3139
+ import { css as css20 } from "@emotion/react";
3140
+ var variablesFormContainer = css20`
2977
3141
  > * {
2978
3142
  margin: var(--spacing-base) 0 0;
2979
3143
  }
2980
3144
  `;
2981
- var variablesFormBtnGroup = css19`
3145
+ var variablesFormBtnGroup = css20`
2982
3146
  display: flex;
2983
3147
  gap: var(--spacing-sm);
2984
3148
  `;
@@ -3079,17 +3243,27 @@ function VariablesProvider({
3079
3243
  value,
3080
3244
  onChange,
3081
3245
  editVariableComponent,
3246
+ readOnly,
3082
3247
  children
3083
3248
  }) {
3084
3249
  const [editing, setEditing] = React10.useState();
3085
3250
  const events = React10.useMemo(() => mitt(), []);
3251
+ if (!readOnly && !onChange) {
3252
+ throw new Error("onChange must be provided when readOnly is false");
3253
+ }
3086
3254
  const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
3087
3255
  const contextValue = {
3088
3256
  flatVariables: flattenVariables(value),
3089
3257
  dispatch: (event) => {
3258
+ if (readOnly) {
3259
+ console.warn(
3260
+ `Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
3261
+ );
3262
+ return;
3263
+ }
3090
3264
  if (event.type === "set") {
3091
3265
  const { name, ...varValue } = event.variable;
3092
- onChange({ ...contextValue.variables, [event.variable.name]: varValue });
3266
+ onChange == null ? void 0 : onChange({ ...contextValue.variables, [event.variable.name]: varValue });
3093
3267
  if (event.openEditor) {
3094
3268
  setEditing(event.variable.name);
3095
3269
  }
@@ -3098,9 +3272,9 @@ function VariablesProvider({
3098
3272
  } else if (event.type === "remove") {
3099
3273
  const newValue = { ...value };
3100
3274
  delete newValue[event.variable];
3101
- onChange(newValue);
3275
+ onChange == null ? void 0 : onChange(newValue);
3102
3276
  } else if (event.type === "reorder") {
3103
- onChange(event.result);
3277
+ onChange == null ? void 0 : onChange(event.result);
3104
3278
  } else {
3105
3279
  throw new Error(`Unknown event ${JSON.stringify(event)}`);
3106
3280
  }
@@ -3118,7 +3292,7 @@ function VariablesProvider({
3118
3292
  onSubmit: (val) => {
3119
3293
  setEditing(void 0);
3120
3294
  const { name, ...varValue } = val;
3121
- onChange({ ...value, [name]: varValue });
3295
+ onChange == null ? void 0 : onChange({ ...value, [name]: varValue });
3122
3296
  events.emit("update", name);
3123
3297
  },
3124
3298
  onCancel: () => setEditing(void 0),
@@ -3157,7 +3331,7 @@ function flattenVariables(variables) {
3157
3331
  // src/components/Variables/useOnVariableUpdated.ts
3158
3332
  function useOnVariableUpdated(fn2, disabled) {
3159
3333
  const { variables, events } = useVariables();
3160
- useEffect5(() => {
3334
+ useEffect6(() => {
3161
3335
  if (disabled) {
3162
3336
  return;
3163
3337
  }
@@ -3166,6 +3340,9 @@ function useOnVariableUpdated(fn2, disabled) {
3166
3340
  }, [disabled, events, fn2, variables]);
3167
3341
  }
3168
3342
 
3343
+ // src/components/Variables/variablesToGroupedList.ts
3344
+ init_emotion_jsx_shim();
3345
+
3169
3346
  // src/components/Variables/variablesToList.ts
3170
3347
  init_emotion_jsx_shim();
3171
3348
  function variablesToList(variables) {
@@ -3185,8 +3362,392 @@ function variablesToList(variables) {
3185
3362
  }));
3186
3363
  }
3187
3364
 
3365
+ // src/components/Variables/variablesToGroupedList.ts
3366
+ function variablesToGroupedList(variables) {
3367
+ const groups = {};
3368
+ Object.entries(variables || {}).forEach(([name, definition]) => {
3369
+ var _a;
3370
+ const group = (_a = definition.source) != null ? _a : "";
3371
+ if (!groups[group]) {
3372
+ groups[group] = {};
3373
+ }
3374
+ groups[group][name] = definition;
3375
+ });
3376
+ return Object.entries(groups).map(([group, variables2]) => ({
3377
+ name: group,
3378
+ variables: variablesToList(variables2)
3379
+ })).sort((a2, b2) => {
3380
+ var _a, _b;
3381
+ return ((_a = a2.name) != null ? _a : "").localeCompare((_b = b2.name) != null ? _b : "");
3382
+ });
3383
+ }
3384
+
3385
+ // src/components/Variables/composer/VariableNode.tsx
3386
+ init_emotion_jsx_shim();
3387
+ import { Chip } from "@uniformdev/design-system";
3388
+ import { DecoratorNode } from "lexical";
3389
+ import { Fragment as Fragment4 } from "react";
3390
+ import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
3391
+ var VariableNode = class extends DecoratorNode {
3392
+ constructor(reference, state, key) {
3393
+ super(key);
3394
+ this.reference = reference;
3395
+ this.__state = state;
3396
+ }
3397
+ static getType() {
3398
+ return "variable";
3399
+ }
3400
+ static clone(node) {
3401
+ return new VariableNode(node.reference, { ...node.__state }, node.__key);
3402
+ }
3403
+ /** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
3404
+ static importJSON(serializedNode) {
3405
+ return $createVariableNode(serializedNode.reference, {
3406
+ displayName: serializedNode.reference,
3407
+ referenceIsValid: true,
3408
+ hasClickEvent: void 0
3409
+ });
3410
+ }
3411
+ /**
3412
+ * Updates the node's variables state so it knows its current validity, display name, etc
3413
+ * The plugin updates this whenever the variables prop changes.
3414
+ */
3415
+ setState(state) {
3416
+ this.getWritable().__state = state;
3417
+ }
3418
+ /**
3419
+ * Serializes the node to JSON for editor initial state
3420
+ */
3421
+ exportJSON() {
3422
+ return {
3423
+ reference: this.reference,
3424
+ type: VariableNode.getType(),
3425
+ version: 1
3426
+ };
3427
+ }
3428
+ /**
3429
+ * Copy variable to clipboard in a format we will read back if pasted
3430
+ * (albeit it won't get the fancy chip-node)
3431
+ */
3432
+ getTextContent() {
3433
+ return `\${${this.reference}}`;
3434
+ }
3435
+ /** Creates the DOM wrapper that hosts the node */
3436
+ createDOM() {
3437
+ return document.createElement("span");
3438
+ }
3439
+ updateDOM() {
3440
+ return false;
3441
+ }
3442
+ /**
3443
+ * Render the variable node using React.
3444
+ * NOTE: this is effectively an island of React, and you may not call hooks,
3445
+ * rely on Context, etc in this renderer.
3446
+ */
3447
+ decorate(editor) {
3448
+ const { displayName, hasClickEvent, referenceIsValid } = this.__state;
3449
+ const Wrapper = referenceIsValid ? Fragment4 : UndefinedVariableReference;
3450
+ return /* @__PURE__ */ jsx30(
3451
+ Chip,
3452
+ {
3453
+ text: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || this.reference }),
3454
+ title: !referenceIsValid ? `${this.reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0,
3455
+ onClick: () => {
3456
+ editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
3457
+ reference: this.reference
3458
+ });
3459
+ }
3460
+ }
3461
+ );
3462
+ }
3463
+ /** Enables keyboard navigation to hop over the node to previous text */
3464
+ isIsolated() {
3465
+ return true;
3466
+ }
3467
+ };
3468
+ function $createVariableNode(variableReference, state) {
3469
+ return new VariableNode(variableReference, state);
3470
+ }
3471
+ function UndefinedVariableReference({ children }) {
3472
+ return /* @__PURE__ */ jsx30(
3473
+ "span",
3474
+ {
3475
+ style: {
3476
+ textDecoration: "underline",
3477
+ textDecorationStyle: "wavy",
3478
+ textDecorationColor: "red"
3479
+ },
3480
+ children
3481
+ }
3482
+ );
3483
+ }
3484
+
3485
+ // src/components/Variables/composer/VariablesPlugin.tsx
3486
+ import { jsx as jsx31, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
3487
+ var EDIT_VARIABLE_COMMAND = createCommand("uniform:edit-variable");
3488
+ var INSERT_VARIABLE_COMMAND = createCommand("uniform:insert-variable");
3489
+ var PUNCTUATION = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
3490
+ var NAME = "\\b[A-Z][^\\s" + PUNCTUATION + "]";
3491
+ var DocumentVariablesRegex = {
3492
+ NAME,
3493
+ PUNCTUATION
3494
+ };
3495
+ var PUNC = DocumentVariablesRegex.PUNCTUATION;
3496
+ var TRIGGERS = ["$"].join("");
3497
+ var VALID_CHARS = "[^" + TRIGGERS + PUNC + "\\s]";
3498
+ var VALID_JOINS = "(?:\\.[ |$]| |[" + PUNC + "]|)";
3499
+ var LENGTH_LIMIT = 75;
3500
+ var DollarSignVariablesRegex = new RegExp(
3501
+ "(^.*)([" + TRIGGERS + "]((?:" + VALID_CHARS + VALID_JOINS + "){0," + LENGTH_LIMIT + "}))$"
3502
+ );
3503
+ function getPossibleQueryMatch(text) {
3504
+ const match = DollarSignVariablesRegex.exec(text);
3505
+ if (match !== null) {
3506
+ const maybeLeadingWhitespace = match[1];
3507
+ const matchingString = match[3];
3508
+ return {
3509
+ leadOffset: match.index + maybeLeadingWhitespace.length,
3510
+ matchingString,
3511
+ replaceableString: match[2]
3512
+ };
3513
+ }
3514
+ return null;
3515
+ }
3516
+ var ADD_VARIABLE_OPTION = "$$add-variable$$";
3517
+ var SOURCE_SEPARATOR = "--";
3518
+ function VariablesPlugin({
3519
+ disableVariables,
3520
+ showAddVariableMenuOption,
3521
+ enableEditingVariables
3522
+ }) {
3523
+ const [editor] = useLexicalComposerContext2();
3524
+ const { variables, dispatch, isEditing, canDispatch, readOnly } = useVariables();
3525
+ const canEditVariable = canDispatch && enableEditingVariables && !readOnly;
3526
+ const [openedAdd, setOpenedAdd] = useState8(false);
3527
+ useOnVariableUpdated((varName) => {
3528
+ editor.update(() => {
3529
+ editor.dispatchCommand(INSERT_VARIABLE_COMMAND, { reference: varName });
3530
+ });
3531
+ }, !openedAdd);
3532
+ useEffect7(() => {
3533
+ if (openedAdd && !isEditing) {
3534
+ setOpenedAdd(false);
3535
+ }
3536
+ }, [isEditing, openedAdd]);
3537
+ const [queryString, setQueryString] = useState8(null);
3538
+ const { groupedVariables, menuOptions } = useMemo6(() => {
3539
+ const groupedVariables2 = variablesToGroupedList(variables);
3540
+ if (showAddVariableMenuOption) {
3541
+ groupedVariables2.push({
3542
+ name: SOURCE_SEPARATOR,
3543
+ variables: [{ name: ADD_VARIABLE_OPTION, displayName: "Add\u2026", default: "" }]
3544
+ });
3545
+ }
3546
+ const menuOptions2 = [];
3547
+ groupedVariables2.forEach(
3548
+ (group) => group.variables.forEach((variable) => {
3549
+ menuOptions2.push(new MenuOption(variable.name));
3550
+ })
3551
+ );
3552
+ return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
3553
+ }, [variables, showAddVariableMenuOption]);
3554
+ const { filteredGroupedVariables, filteredMenuOptions } = useMemo6(() => {
3555
+ if (!queryString) {
3556
+ return {
3557
+ filteredGroupedVariables: groupedVariables,
3558
+ filteredMenuOptions: menuOptions
3559
+ };
3560
+ }
3561
+ const query = queryString.toLowerCase();
3562
+ return {
3563
+ filteredGroupedVariables: groupedVariables.map((group) => ({
3564
+ name: group.name,
3565
+ variables: group.variables.filter(
3566
+ (option) => option.name.toLowerCase().includes(query) || option.name === ADD_VARIABLE_OPTION
3567
+ )
3568
+ })).filter((group) => group.variables.length > 0),
3569
+ filteredMenuOptions: menuOptions.filter(
3570
+ (option) => option.key.includes(query) || option.key === ADD_VARIABLE_OPTION
3571
+ )
3572
+ };
3573
+ }, [queryString, groupedVariables, menuOptions]);
3574
+ const onSelectOption = useCallback(
3575
+ (selectedOption, nodeToReplace, closeMenu) => {
3576
+ if (selectedOption.key === ADD_VARIABLE_OPTION) {
3577
+ setOpenedAdd(true);
3578
+ editor.update(() => {
3579
+ nodeToReplace == null ? void 0 : nodeToReplace.remove();
3580
+ });
3581
+ editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
3582
+ reference: queryString != null ? queryString : ""
3583
+ });
3584
+ } else {
3585
+ editor.update(() => {
3586
+ var _a;
3587
+ const variableNode = $createVariableNode(selectedOption.key, {
3588
+ displayName: ((_a = variables[selectedOption.key]) == null ? void 0 : _a.displayName) || selectedOption.key,
3589
+ hasClickEvent: canEditVariable,
3590
+ referenceIsValid: Boolean(variables[selectedOption.key])
3591
+ });
3592
+ if (nodeToReplace) {
3593
+ nodeToReplace.replace(variableNode);
3594
+ }
3595
+ });
3596
+ }
3597
+ closeMenu();
3598
+ },
3599
+ [editor, queryString, variables, canEditVariable]
3600
+ );
3601
+ useEffect7(() => {
3602
+ editor.registerCommand(
3603
+ EDIT_VARIABLE_COMMAND,
3604
+ ({ reference }) => {
3605
+ if (!disableVariables && canEditVariable) {
3606
+ dispatch({ type: "edit", variable: reference });
3607
+ }
3608
+ return true;
3609
+ },
3610
+ COMMAND_PRIORITY_NORMAL
3611
+ );
3612
+ editor.registerCommand(
3613
+ INSERT_VARIABLE_COMMAND,
3614
+ ({ reference }) => {
3615
+ var _a;
3616
+ if (!disableVariables) {
3617
+ const variableNode = $createVariableNode(reference, {
3618
+ displayName: ((_a = variables[reference]) == null ? void 0 : _a.displayName) || reference,
3619
+ hasClickEvent: canEditVariable,
3620
+ referenceIsValid: Boolean(variables[reference])
3621
+ });
3622
+ $insertNodes([variableNode]);
3623
+ }
3624
+ return true;
3625
+ },
3626
+ COMMAND_PRIORITY_NORMAL
3627
+ );
3628
+ }, [editor, disableVariables, variables, canDispatch, dispatch, canEditVariable, readOnly]);
3629
+ useEffect7(() => {
3630
+ editor.update(() => {
3631
+ $nodesOfType(VariableNode).forEach((variableNode) => {
3632
+ const targetVar = variables[variableNode.reference];
3633
+ variableNode.setState({
3634
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || variableNode.reference,
3635
+ hasClickEvent: canEditVariable,
3636
+ referenceIsValid: Boolean(targetVar)
3637
+ });
3638
+ });
3639
+ });
3640
+ }, [editor, variables, canEditVariable]);
3641
+ if (disableVariables) {
3642
+ return null;
3643
+ }
3644
+ return /* @__PURE__ */ jsx31(
3645
+ LexicalTypeaheadMenuPlugin,
3646
+ {
3647
+ onQueryChange: setQueryString,
3648
+ onSelectOption,
3649
+ triggerFn: getPossibleQueryMatch,
3650
+ options: filteredMenuOptions,
3651
+ menuRenderFn: (anchorElementRef, { selectOptionAndCleanUp, setHighlightedIndex, selectedIndex }) => {
3652
+ if (!anchorElementRef.current || groupedVariables.length === 0 || openedAdd) {
3653
+ return null;
3654
+ }
3655
+ let currentCumulativeMenuIndex = -1;
3656
+ return createPortal(
3657
+ /* @__PURE__ */ jsx31(
3658
+ "div",
3659
+ {
3660
+ css: css21`
3661
+ box-shadow: var(--shadow-base);
3662
+ border-radius: var(--rounded-base);
3663
+ background: var(--gray-50);
3664
+ display: flex;
3665
+ flex-direction: column;
3666
+ min-width: 250px;
3667
+ padding: var(--spacing-sm);
3668
+ outline: none;
3669
+ overflow: hidden;
3670
+ position: relative;
3671
+ z-index: var(--z-50);
3672
+ `,
3673
+ children: /* @__PURE__ */ jsx31("div", { children: filteredGroupedVariables.map((group, index) => {
3674
+ var _a, _b;
3675
+ return /* @__PURE__ */ jsxs18(
3676
+ MenuGroup,
3677
+ {
3678
+ title: group.name === SOURCE_SEPARATOR ? "" : (_a = group.name) != null ? _a : "",
3679
+ children: [
3680
+ group.name === SOURCE_SEPARATOR ? /* @__PURE__ */ jsx31(MenuItemSeparator, {}) : null,
3681
+ group.variables.map((variable) => {
3682
+ var _a2;
3683
+ currentCumulativeMenuIndex++;
3684
+ return /* @__PURE__ */ jsxs18(
3685
+ MenuItem2,
3686
+ {
3687
+ active: selectedIndex === currentCumulativeMenuIndex,
3688
+ onClick: () => {
3689
+ setHighlightedIndex(currentCumulativeMenuIndex);
3690
+ selectOptionAndCleanUp(new MenuOption(variable.name));
3691
+ },
3692
+ onMouseEnter: () => {
3693
+ setHighlightedIndex(currentCumulativeMenuIndex);
3694
+ },
3695
+ children: [
3696
+ /* @__PURE__ */ jsx31("div", { children: (_a2 = variable.displayName) != null ? _a2 : variable.name }),
3697
+ variable.helpText ? /* @__PURE__ */ jsx31(Caption, { children: variable.helpText }) : null
3698
+ ]
3699
+ },
3700
+ variable.name
3701
+ );
3702
+ })
3703
+ ]
3704
+ },
3705
+ (_b = group.name) != null ? _b : `none${index}`
3706
+ );
3707
+ }) })
3708
+ }
3709
+ ),
3710
+ anchorElementRef.current
3711
+ );
3712
+ }
3713
+ }
3714
+ );
3715
+ }
3716
+
3717
+ // src/components/Variables/SelectVariableMenu.tsx
3718
+ init_emotion_jsx_shim();
3719
+ import { Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem3, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
3720
+ import { useEffect as useEffect8, useRef as useRef8, useState as useState9 } from "react";
3721
+ import { CgUsbC } from "react-icons/cg";
3722
+
3723
+ // src/components/Variables/styles/InsertVariableMenu.styles.ts
3724
+ init_emotion_jsx_shim();
3725
+ import { css as css22 } from "@emotion/react";
3726
+ var menuBtn2 = css22`
3727
+ background: none;
3728
+ border: none;
3729
+ color: var(--gray-500);
3730
+ padding: 0;
3731
+ `;
3732
+ var menuItemTextGroup = css22`
3733
+ align-items: flex-start;
3734
+ display: flex;
3735
+ flex-direction: column;
3736
+ gap: 0;
3737
+ line-height: 1em;
3738
+ `;
3739
+ var smallText = css22`
3740
+ font-size: var(--fs-xs);
3741
+ color: var(--gray-500);
3742
+ `;
3743
+ var variablesTipText = css22`
3744
+ ${smallText}
3745
+ color: var(--gray-500);
3746
+ padding: 0 var(--spacing-sm);
3747
+ `;
3748
+
3188
3749
  // src/components/Variables/SelectVariableMenu.tsx
3189
- import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
3750
+ import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
3190
3751
  var SelectVariableMenu = ({
3191
3752
  onSelectVariable,
3192
3753
  onResetVariables,
@@ -3198,167 +3759,102 @@ var SelectVariableMenu = ({
3198
3759
  }) => {
3199
3760
  const { variables, dispatch, isEditing, canDispatch } = useVariables();
3200
3761
  const btnRef = useRef8(null);
3201
- const [openedAdd, setOpenedAdd] = useState8(false);
3762
+ const [openedAdd, setOpenedAdd] = useState9(false);
3202
3763
  useOnVariableUpdated((varName) => {
3203
3764
  onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
3204
3765
  }, !openedAdd);
3205
- useEffect6(() => {
3766
+ useEffect8(() => {
3206
3767
  if (openedAdd && !isEditing) {
3207
3768
  setOpenedAdd(false);
3208
3769
  }
3209
3770
  }, [isEditing, openedAdd]);
3210
- const variablesList = variablesToList(variables);
3771
+ const variablesGroups = variablesToGroupedList(variables);
3211
3772
  const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
3212
- return /* @__PURE__ */ jsxs18(
3773
+ return /* @__PURE__ */ jsxs19(
3213
3774
  Menu2,
3214
3775
  {
3215
3776
  placement: "bottom-start",
3216
3777
  forceVisible,
3217
- menuTrigger: /* @__PURE__ */ jsx30(
3778
+ menuTrigger: /* @__PURE__ */ jsx32(
3218
3779
  "button",
3219
3780
  {
3220
3781
  title: "Insert variable",
3221
3782
  ...buttonProps,
3222
3783
  ref: btnRef,
3223
- css: [menuBtn, buttonCss],
3784
+ css: [menuBtn2, buttonCss],
3224
3785
  type: "button",
3225
- children: /* @__PURE__ */ jsx30(CgUsbC, { size: "1.4rem" })
3786
+ children: /* @__PURE__ */ jsx32(CgUsbC, { size: "1.4rem" })
3226
3787
  }
3227
3788
  ),
3228
3789
  menuLabel: "Insert variable",
3229
3790
  children: [
3230
- variablesList.map((variable) => {
3231
- const { name, helpText } = variable;
3232
- return /* @__PURE__ */ jsxs18(
3233
- MenuItem2,
3234
- {
3235
- id: name,
3236
- css: menuItemTextGroup,
3237
- onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
3238
- children: [
3239
- /* @__PURE__ */ jsx30("span", { children: name }),
3240
- helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
3241
- ]
3242
- },
3243
- name
3244
- );
3791
+ variablesGroups.map((group) => {
3792
+ var _a;
3793
+ return /* @__PURE__ */ jsx32(MenuGroup2, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
3794
+ const { name, helpText } = variable;
3795
+ return /* @__PURE__ */ jsxs19(
3796
+ MenuItem3,
3797
+ {
3798
+ id: name,
3799
+ css: menuItemTextGroup,
3800
+ onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
3801
+ children: [
3802
+ /* @__PURE__ */ jsx32("span", { children: name }),
3803
+ helpText ? /* @__PURE__ */ jsx32("small", { css: smallText, children: helpText }) : null
3804
+ ]
3805
+ },
3806
+ name
3807
+ );
3808
+ }) }, group.name);
3245
3809
  }),
3246
- showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
3247
- variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3248
- /* @__PURE__ */ jsx30(
3249
- MenuItem2,
3810
+ showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
3811
+ variablesGroups.length ? /* @__PURE__ */ jsx32(MenuItemSeparator2, {}) : null,
3812
+ /* @__PURE__ */ jsx32(
3813
+ MenuItem3,
3250
3814
  {
3251
3815
  onClick: () => {
3252
3816
  setOpenedAdd(true);
3253
3817
  dispatch({ type: "edit", variable: "" });
3254
3818
  },
3255
- children: "Add Variable"
3819
+ children: "Add\u2026"
3256
3820
  }
3257
3821
  )
3258
3822
  ] }) : null,
3259
- menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3260
- onResetVariables ? /* @__PURE__ */ jsx30(MenuItem2, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
3261
- tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3262
- tip ? /* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip }) : null
3823
+ menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ jsx32(MenuItemSeparator2, {}) : null,
3824
+ onResetVariables ? /* @__PURE__ */ jsx32(MenuItem3, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
3825
+ tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ jsx32(MenuItemSeparator2, {}) : null,
3826
+ tip ? /* @__PURE__ */ jsx32("i", { css: variablesTipText, children: tip }) : null
3263
3827
  ]
3264
3828
  }
3265
3829
  );
3266
3830
  };
3267
3831
 
3268
- // src/components/Variables/styles/InputVariables.styles.ts
3269
- init_emotion_jsx_shim();
3270
- import { css as css20 } from "@emotion/react";
3271
- var menuContainer = css20`
3272
- position: relative;
3273
- `;
3274
- var menuBtn2 = css20`
3275
- position: absolute;
3276
- bottom: 25%;
3277
- right: var(--spacing-sm);
3278
- `;
3279
-
3280
- // src/components/Variables/util/getReferencedVariables.ts
3281
- init_emotion_jsx_shim();
3282
-
3283
- // src/components/Variables/util/variableExpression.ts
3284
- init_emotion_jsx_shim();
3285
- var variableExpression = /(?<!\\)\${([^}]+)}/g;
3286
- var variablePrefix = "${";
3287
- var variableSuffix = "}";
3288
-
3289
- // src/components/Variables/util/getReferencedVariables.ts
3290
- function getReferencedVariables(value) {
3291
- const result = [];
3292
- for (const match of value.matchAll(variableExpression)) {
3293
- result.push(match[1]);
3294
- }
3295
- return result;
3296
- }
3297
-
3298
- // src/components/Variables/util/insertVariableIntoText.ts
3299
- init_emotion_jsx_shim();
3300
- function insertVariableIntoText({
3301
- variableName: variableName2,
3302
- value,
3303
- selectionStart = null,
3304
- selectionEnd = null
3305
- }) {
3306
- const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
3307
- if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
3308
- return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
3309
- }
3310
- const hasCursorPosition = selectionStart !== null;
3311
- let startOffset = 0;
3312
- if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
3313
- startOffset = variablePrefix.length;
3314
- }
3315
- if (hasCursorPosition) {
3316
- return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
3317
- selectionStart
3318
- )}`;
3319
- }
3320
- return `${value}${variableExpression2}`;
3321
- }
3322
-
3323
- // src/components/Variables/VariableField.tsx
3324
- init_emotion_jsx_shim();
3325
-
3326
- // src/components/Variables/styles/VariableField.styles.ts
3327
- init_emotion_jsx_shim();
3328
- import { css as css21 } from "@emotion/react";
3329
- var labelText = css21`
3330
- align-items: center;
3331
- display: flex;
3332
- gap: var(--spacing-xs);
3333
- font-weight: var(--fw-regular);
3334
- margin: 0 0 var(--spacing-xs);
3335
- `;
3336
- var variableBindButton = css21`
3337
- align-items: center;
3338
- border: none;
3339
- border-radius: var(--rounded-base);
3340
- background: none;
3341
- display: flex;
3342
- height: 1.2rem;
3343
- padding: var(--spacing-2xs);
3344
- transition: background var(--duration-fast) var(--timing-ease-out),
3345
- color var(--duration-fast) var(--timing-ease-out);
3346
- width: 1.2rem;
3347
-
3348
- &:hover,
3349
- &[aria-pressed='true']:not(:disabled) {
3350
- background: var(--brand-secondary-3);
3351
- color: var(--white);
3352
- }
3353
-
3354
- &[aria-disabled='true'] {
3355
- background: none;
3356
- color: currentColor;
3357
- }
3358
- `;
3832
+ // src/components/Variables/VariablesComposerVariableMenu.tsx
3833
+ import { jsx as jsx33 } from "@emotion/react/jsx-runtime";
3834
+ var VariablesComposerVariableMenu = (props) => {
3835
+ const [editor] = useLexicalComposerContext3();
3836
+ const onSelectVariable = (selectedVariable) => {
3837
+ editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
3838
+ reference: selectedVariable.name
3839
+ });
3840
+ };
3841
+ const onResetVariable = () => {
3842
+ var _a;
3843
+ editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
3844
+ (_a = props.onResetVariables) == null ? void 0 : _a.call(props);
3845
+ };
3846
+ return /* @__PURE__ */ jsx33(
3847
+ SelectVariableMenu,
3848
+ {
3849
+ ...props,
3850
+ onSelectVariable,
3851
+ onResetVariables: props.onResetVariables ? onResetVariable : void 0
3852
+ }
3853
+ );
3854
+ };
3359
3855
 
3360
3856
  // src/components/Variables/VariableField.tsx
3361
- import { jsx as jsx31, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
3857
+ import { jsx as jsx34, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
3362
3858
  function VariableField({
3363
3859
  label,
3364
3860
  selectVariableMenuOptions,
@@ -3369,25 +3865,194 @@ function VariableField({
3369
3865
  }) {
3370
3866
  const { variables } = useVariables(true);
3371
3867
  const varCount = Object.keys(variables).length;
3372
- const variableSelector = varCount > 0 && (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.onSelectVariable) && !disableVariables ? /* @__PURE__ */ jsx31(
3373
- SelectVariableMenu,
3868
+ const variableSelector = varCount > 0 && !disableVariables ? /* @__PURE__ */ jsx34(
3869
+ VariablesComposerVariableMenu,
3374
3870
  {
3375
3871
  ...selectVariableMenuOptions,
3376
3872
  buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
3377
3873
  buttonProps: isActive ? { "aria-pressed": "true" } : void 0
3378
3874
  }
3379
3875
  ) : null;
3380
- return /* @__PURE__ */ jsxs19("div", { children: [
3381
- /* @__PURE__ */ jsxs19("label", { htmlFor: id, css: labelText, children: [
3876
+ return /* @__PURE__ */ jsxs20("div", { children: [
3877
+ /* @__PURE__ */ jsxs20("label", { htmlFor: id, css: labelText, children: [
3382
3878
  variableSelector,
3383
- /* @__PURE__ */ jsx31("span", { children: label })
3879
+ /* @__PURE__ */ jsx34("span", { children: label })
3384
3880
  ] }),
3385
3881
  children
3386
3882
  ] });
3387
3883
  }
3388
3884
 
3885
+ // src/components/Variables/VariablesComposer.tsx
3886
+ init_emotion_jsx_shim();
3887
+ import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
3888
+ import { LexicalComposer } from "@lexical/react/LexicalComposer";
3889
+ import { ContentEditable } from "@lexical/react/LexicalContentEditable";
3890
+ import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
3891
+ import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
3892
+ import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
3893
+ import {
3894
+ LineBreakNode as LineBreakNode2,
3895
+ TextNode as TextNode2
3896
+ } from "lexical";
3897
+ import { useMemo as useMemo7, useRef as useRef9, useState as useState10 } from "react";
3898
+ import { v4 as v42 } from "uuid";
3899
+
3900
+ // src/components/Variables/composer/DisablePlugin.tsx
3901
+ init_emotion_jsx_shim();
3902
+ import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
3903
+ import { useEffect as useEffect9 } from "react";
3904
+ function DisablePlugin({ disabled }) {
3905
+ const [editor] = useLexicalComposerContext4();
3906
+ useEffect9(() => {
3907
+ editor.setEditable(!disabled);
3908
+ }, [editor, disabled]);
3909
+ return null;
3910
+ }
3911
+
3912
+ // src/components/Variables/composer/SingleLineTextPlugin.tsx
3913
+ init_emotion_jsx_shim();
3914
+ import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
3915
+ import { LineBreakNode } from "lexical";
3916
+ import { useEffect as useEffect10 } from "react";
3917
+ function SingleLineTextPlugin() {
3918
+ const [editor] = useLexicalComposerContext5();
3919
+ useEffect10(() => {
3920
+ editor.registerNodeTransform(LineBreakNode, (node) => {
3921
+ node.remove();
3922
+ });
3923
+ }, [editor]);
3924
+ return null;
3925
+ }
3926
+
3927
+ // src/components/Variables/VariablesComposer.tsx
3928
+ import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
3929
+ function VariablesComposer(props) {
3930
+ const { value, children, onChange, disabled, disableVariables, ...variablesPluginProps } = props;
3931
+ const [namespace] = useState10(v42());
3932
+ const [lastEmittedValue, setLastEmittedValue] = useState10(value);
3933
+ const editorConfig = useMemo7(
3934
+ () => ({
3935
+ namespace,
3936
+ onError(error) {
3937
+ throw error;
3938
+ },
3939
+ nodes: [VariableNode],
3940
+ editorState: deserializeEditorState(props.value)
3941
+ }),
3942
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3943
+ [namespace]
3944
+ );
3945
+ const editorState = useRef9();
3946
+ const updateTimeout = useRef9();
3947
+ if (typeof document === "undefined")
3948
+ return null;
3949
+ return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
3950
+ /* @__PURE__ */ jsx35(
3951
+ OnChangePlugin,
3952
+ {
3953
+ onChange: (state) => {
3954
+ editorState.current = state;
3955
+ if (updateTimeout.current) {
3956
+ clearTimeout(updateTimeout.current);
3957
+ }
3958
+ setTimeout(() => {
3959
+ if (editorState.current) {
3960
+ const valueToEmit = serializeEditorState(editorState.current);
3961
+ if (valueToEmit !== lastEmittedValue) {
3962
+ setLastEmittedValue(valueToEmit);
3963
+ onChange(valueToEmit);
3964
+ }
3965
+ }
3966
+ }, 400);
3967
+ }
3968
+ }
3969
+ ),
3970
+ /* @__PURE__ */ jsx35(SingleLineTextPlugin, {}),
3971
+ /* @__PURE__ */ jsx35(ClearEditorPlugin, {}),
3972
+ /* @__PURE__ */ jsx35(VariablesPlugin, { ...variablesPluginProps }),
3973
+ /* @__PURE__ */ jsx35(DisablePlugin, { disabled }),
3974
+ /* @__PURE__ */ jsx35(Fragment6, { children })
3975
+ ] });
3976
+ }
3977
+ function VariablesComposerInput(props) {
3978
+ return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
3979
+ PlainTextPlugin,
3980
+ {
3981
+ contentEditable: /* @__PURE__ */ jsx35(ContentEditable, { css: input, ...props }),
3982
+ placeholder: null,
3983
+ ErrorBoundary: LexicalErrorBoundary
3984
+ }
3985
+ ) });
3986
+ }
3987
+ function deserializeEditorState(serialized) {
3988
+ const result = [];
3989
+ parseVariableExpression(serialized, (token, type) => {
3990
+ if (type === "text") {
3991
+ const node = {
3992
+ type: TextNode2.getType(),
3993
+ text: token,
3994
+ mode: "normal",
3995
+ version: 1,
3996
+ detail: 0,
3997
+ format: 0,
3998
+ style: ""
3999
+ };
4000
+ result.push(node);
4001
+ }
4002
+ if (type === "variable") {
4003
+ const node = {
4004
+ type: "variable",
4005
+ reference: token,
4006
+ version: 1
4007
+ };
4008
+ result.push(node);
4009
+ }
4010
+ });
4011
+ const rez = JSON.stringify({
4012
+ root: {
4013
+ children: [
4014
+ {
4015
+ children: result,
4016
+ direction: "ltr",
4017
+ format: "",
4018
+ indent: 0,
4019
+ type: "paragraph",
4020
+ version: 1
4021
+ }
4022
+ ],
4023
+ direction: "ltr",
4024
+ format: "",
4025
+ indent: 0,
4026
+ type: "root",
4027
+ version: 1
4028
+ }
4029
+ });
4030
+ return rez;
4031
+ }
4032
+ function serializeEditorState(editorState) {
4033
+ const buf = [];
4034
+ serializeRecursive(editorState.toJSON().root, buf);
4035
+ return buf.join("");
4036
+ }
4037
+ function serializeRecursive(node, buffer) {
4038
+ if (node.type === TextNode2.getType()) {
4039
+ buffer.push(node.text);
4040
+ }
4041
+ if (node.type === VariableNode.getType()) {
4042
+ buffer.push(`\${${node.reference}}`);
4043
+ }
4044
+ if (node.type === LineBreakNode2.getType()) {
4045
+ buffer.push("\n");
4046
+ }
4047
+ if ("children" in node && node.children) {
4048
+ for (const child of node.children) {
4049
+ serializeRecursive(child, buffer);
4050
+ }
4051
+ }
4052
+ }
4053
+
3389
4054
  // src/components/Variables/InputVariables.tsx
3390
- import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
4055
+ import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
3391
4056
  function InputVariables({
3392
4057
  id,
3393
4058
  "aria-label": ariaLabel,
@@ -3395,38 +4060,20 @@ function InputVariables({
3395
4060
  value,
3396
4061
  disableVariables,
3397
4062
  disableReset,
4063
+ enableEditingVariables,
3398
4064
  disableInlineMenu,
3399
4065
  onChange,
3400
- onPaste,
4066
+ transformPaste,
3401
4067
  showAddVariableMenuOption,
3402
4068
  inputWhenNoVariables,
3403
4069
  caption,
3404
4070
  errorMessage,
3405
4071
  warningMessage,
3406
4072
  infoMessage,
3407
- ...inputProps
4073
+ "data-test-id": dataTestId
3408
4074
  }) {
3409
- var _a, _b;
3410
- const { variables } = useVariables(true);
3411
- const inputRef = React11.useRef(null);
3412
- const [finalId] = React11.useState(id != null ? id : () => v42());
3413
- const onPasteHandler = (e) => {
3414
- var _a2, _b2, _c;
3415
- if (!onPaste) {
3416
- return;
3417
- }
3418
- const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
3419
- if (!pastedValue || !e.currentTarget) {
3420
- return;
3421
- }
3422
- const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
3423
- const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
3424
- const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
3425
- onPaste(newValue);
3426
- e.preventDefault();
3427
- };
3428
- const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
3429
- const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
4075
+ const { variables, readOnly } = useVariables(true);
4076
+ const [finalId] = React11.useState(id != null ? id : () => v43());
3430
4077
  const hasVariablesInValue = getReferencedVariables(value).length > 0;
3431
4078
  const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
3432
4079
  React11.useEffect(() => {
@@ -3434,60 +4081,35 @@ function InputVariables({
3434
4081
  setHadVariablesInValue(true);
3435
4082
  }
3436
4083
  }, [hasVariablesInValue]);
3437
- const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4084
+ const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption || readOnly;
3438
4085
  const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
3439
- const handleInsertVariable = (variable) => {
3440
- var _a2, _b2;
3441
- const baseValue = inputWhenNoVariables && !hasVariablesInValue ? "" : value;
3442
- handleSetValue(
3443
- insertVariableIntoText({
3444
- variableName: variable.name,
3445
- value: baseValue,
3446
- selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
3447
- selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
3448
- })
3449
- );
3450
- };
3451
- const handleSetValue = (rawValue) => {
3452
- onChange(rawValue);
3453
- };
3454
- const sharedMenuProps = {
3455
- onSelectVariable: handleInsertVariable,
3456
- showAddVariableMenuOption,
3457
- onResetVariables: hadVariablesInValue && !disableReset ? () => {
3458
- handleSetValue("");
3459
- setHadVariablesInValue(false);
3460
- } : void 0
3461
- };
3462
- const input = /* @__PURE__ */ jsxs20("div", { children: [
3463
- inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx32(
3464
- InputVariablesShell,
4086
+ const sharedMenuProps = useMemo8(
4087
+ () => ({
4088
+ showAddVariableMenuOption,
4089
+ onResetVariables: disableReset ? void 0 : () => {
4090
+ setHadVariablesInValue(false);
4091
+ }
4092
+ }),
4093
+ [disableReset, showAddVariableMenuOption]
4094
+ );
4095
+ const input2 = /* @__PURE__ */ jsxs22("div", { children: [
4096
+ inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx36(InputVariablesMenu, { ...sharedMenuProps, disabled: disableInlineVariablesForReals, children: /* @__PURE__ */ jsx36(
4097
+ VariablesComposerInput,
3465
4098
  {
3466
- ...sharedMenuProps,
3467
- disabled: disableInlineVariablesForReals,
3468
- forceVisible: forceMenu || void 0,
3469
- children: /* @__PURE__ */ jsx32(
3470
- Input3,
3471
- {
3472
- id: finalId,
3473
- ref: inputRef,
3474
- label: ariaLabel,
3475
- showLabel: false,
3476
- value,
3477
- onChange: (e) => handleSetValue(e.currentTarget.value),
3478
- onPaste: onPasteHandler,
3479
- ...inputProps
3480
- }
3481
- )
4099
+ id: finalId,
4100
+ "aria-label": ariaLabel,
4101
+ "data-testid": dataTestId,
4102
+ "data-text-value": value
3482
4103
  }
3483
- ),
3484
- caption ? /* @__PURE__ */ jsx32(Caption, { children: caption }) : null,
3485
- errorMessage ? /* @__PURE__ */ jsx32(ErrorMessage, { message: errorMessage }) : null,
3486
- warningMessage ? /* @__PURE__ */ jsx32(WarningMessage, { message: warningMessage }) : null,
3487
- infoMessage ? /* @__PURE__ */ jsx32(InfoMessage, { message: infoMessage }) : null
4104
+ ) }),
4105
+ caption ? /* @__PURE__ */ jsx36(Caption2, { children: caption }) : null,
4106
+ errorMessage ? /* @__PURE__ */ jsx36(ErrorMessage, { message: errorMessage }) : null,
4107
+ warningMessage ? /* @__PURE__ */ jsx36(WarningMessage, { message: warningMessage }) : null,
4108
+ infoMessage ? /* @__PURE__ */ jsx36(InfoMessage, { message: infoMessage }) : null
3488
4109
  ] });
4110
+ let body = input2;
3489
4111
  if (label) {
3490
- return /* @__PURE__ */ jsx32(
4112
+ body = /* @__PURE__ */ jsx36(
3491
4113
  VariableField,
3492
4114
  {
3493
4115
  label,
@@ -3495,29 +4117,49 @@ function InputVariables({
3495
4117
  id: finalId,
3496
4118
  isActive: hadVariablesInValue,
3497
4119
  disableVariables: disableVariablesForReals,
3498
- children: input
4120
+ children: input2
3499
4121
  }
3500
4122
  );
3501
4123
  }
3502
- return input;
4124
+ return /* @__PURE__ */ jsxs22(
4125
+ VariablesComposer,
4126
+ {
4127
+ onChange,
4128
+ value,
4129
+ disableVariables: disableVariablesForReals,
4130
+ showAddVariableMenuOption,
4131
+ enableEditingVariables,
4132
+ children: [
4133
+ /* @__PURE__ */ jsx36(PasteTransformerPlugin, { transformPaste }),
4134
+ body
4135
+ ]
4136
+ }
4137
+ );
3503
4138
  }
3504
- function InputVariablesShell({
4139
+ function InputVariablesMenu({
3505
4140
  children,
3506
4141
  disabled,
3507
4142
  ...props
3508
4143
  }) {
3509
4144
  if (disabled) {
3510
- return /* @__PURE__ */ jsx32(Fragment5, { children });
4145
+ return /* @__PURE__ */ jsx36(Fragment7, { children });
3511
4146
  }
3512
- return /* @__PURE__ */ jsxs20("div", { css: menuContainer, children: [
4147
+ return /* @__PURE__ */ jsxs22("div", { css: menuContainer, children: [
3513
4148
  children,
3514
- /* @__PURE__ */ jsx32(SelectVariableMenu, { ...props, tip: "Tip: access this list by typing ${", buttonCss: menuBtn2 })
4149
+ /* @__PURE__ */ jsx36(
4150
+ VariablesComposerVariableMenu,
4151
+ {
4152
+ ...props,
4153
+ tip: "Tip: access this list by typing $",
4154
+ buttonCss: menuBtn
4155
+ }
4156
+ )
3515
4157
  ] });
3516
4158
  }
3517
4159
 
3518
4160
  // src/components/Variables/VariablesList.tsx
3519
4161
  init_emotion_jsx_shim();
3520
- import { css as css23 } from "@emotion/react";
4162
+ import { css as css24 } from "@emotion/react";
3521
4163
  import {
3522
4164
  AddListButton,
3523
4165
  button,
@@ -3533,8 +4175,8 @@ import { DragDropContext as DragDropContext2, Draggable as Draggable2, Droppable
3533
4175
 
3534
4176
  // src/components/Variables/styles/VariablesList.styles.ts
3535
4177
  init_emotion_jsx_shim();
3536
- import { css as css22 } from "@emotion/react";
3537
- var tableRow = (isDragging) => css22`
4178
+ import { css as css23 } from "@emotion/react";
4179
+ var tableRow = (isDragging) => css23`
3538
4180
  position: relative;
3539
4181
  ${isDragging ? `
3540
4182
  display: table;
@@ -3542,7 +4184,7 @@ var tableRow = (isDragging) => css22`
3542
4184
  top: auto !important;
3543
4185
  ` : void 0}
3544
4186
  `;
3545
- var tableCellDragIcon = css22`
4187
+ var tableCellDragIcon = css23`
3546
4188
  &::after {
3547
4189
  content: '';
3548
4190
  display: block;
@@ -3560,7 +4202,7 @@ var tableCellDragIcon = css22`
3560
4202
  opacity: 1;
3561
4203
  }
3562
4204
  `;
3563
- var variableName = css22`
4205
+ var variableName = css23`
3564
4206
  border: none;
3565
4207
  color: var(--brand-secondary-5);
3566
4208
  font-weight: var(--fw-medium);
@@ -3571,7 +4213,7 @@ var variableName = css22`
3571
4213
  white-space: nowrap;
3572
4214
  max-width: 20ch;
3573
4215
  `;
3574
- var variableValue = css22`
4216
+ var variableValue = css23`
3575
4217
  overflow: hidden;
3576
4218
  text-overflow: ellipsis;
3577
4219
  white-space: nowrap;
@@ -3579,7 +4221,7 @@ var variableValue = css22`
3579
4221
  `;
3580
4222
 
3581
4223
  // src/components/Variables/VariablesList.tsx
3582
- import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
4224
+ import { Fragment as Fragment8, jsx as jsx37, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
3583
4225
  function VariablesList() {
3584
4226
  const { variables, dispatch } = useVariables();
3585
4227
  const sorted = variablesToList(variables);
@@ -3600,23 +4242,23 @@ function VariablesList() {
3600
4242
  return result;
3601
4243
  }
3602
4244
  };
3603
- return /* @__PURE__ */ jsxs21(Fragment6, { children: [
3604
- /* @__PURE__ */ jsx33(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs21(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
3605
- /* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs21(TableRow, { children: [
3606
- /* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
3607
- /* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
3608
- /* @__PURE__ */ jsx33(TableCellHead, {})
4245
+ return /* @__PURE__ */ jsxs23(Fragment8, { children: [
4246
+ /* @__PURE__ */ jsx37(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx37(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs23(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
4247
+ /* @__PURE__ */ jsx37(TableHead, { children: /* @__PURE__ */ jsxs23(TableRow, { children: [
4248
+ /* @__PURE__ */ jsx37(TableCellHead, { children: "Name" }),
4249
+ /* @__PURE__ */ jsx37(TableCellHead, { children: "Default Value" }),
4250
+ /* @__PURE__ */ jsx37(TableCellHead, {})
3609
4251
  ] }) }),
3610
- /* @__PURE__ */ jsxs21(TableBody, { children: [
4252
+ /* @__PURE__ */ jsxs23(TableBody, { children: [
3611
4253
  sorted.map(({ name, displayName, default: defaultValue }, index) => {
3612
4254
  const text = displayName != null ? displayName : name;
3613
- return /* @__PURE__ */ jsx33(
4255
+ return /* @__PURE__ */ jsx37(
3614
4256
  Draggable2,
3615
4257
  {
3616
4258
  draggableId: name,
3617
4259
  index,
3618
4260
  isDragDisabled: sorted.length === 1,
3619
- children: (provided2, snapshot) => /* @__PURE__ */ jsxs21(
4261
+ children: (provided2, snapshot) => /* @__PURE__ */ jsxs23(
3620
4262
  TableRow,
3621
4263
  {
3622
4264
  ref: provided2.innerRef,
@@ -3626,7 +4268,7 @@ function VariablesList() {
3626
4268
  css: tableRow(snapshot.isDragging),
3627
4269
  "data-dragging": snapshot.isDragging,
3628
4270
  children: [
3629
- /* @__PURE__ */ jsx33(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx33(
4271
+ /* @__PURE__ */ jsx37(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx37(
3630
4272
  "button",
3631
4273
  {
3632
4274
  css: variableName,
@@ -3639,21 +4281,21 @@ function VariablesList() {
3639
4281
  children: text
3640
4282
  }
3641
4283
  ) }),
3642
- /* @__PURE__ */ jsx33(TableCellData, { children: /* @__PURE__ */ jsx33("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
3643
- /* @__PURE__ */ jsx33(TableCellData, { align: "right", children: /* @__PURE__ */ jsx33(
4284
+ /* @__PURE__ */ jsx37(TableCellData, { children: /* @__PURE__ */ jsx37("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
4285
+ /* @__PURE__ */ jsx37(TableCellData, { align: "right", children: /* @__PURE__ */ jsx37(
3644
4286
  "button",
3645
4287
  {
3646
4288
  type: "button",
3647
4289
  title: `delete ${text}`,
3648
4290
  css: [
3649
4291
  button,
3650
- css23`
4292
+ css24`
3651
4293
  background: transparent;
3652
4294
  `
3653
4295
  ],
3654
4296
  "aria-controls": text,
3655
4297
  onClick: () => dispatch({ type: "remove", variable: name }),
3656
- children: /* @__PURE__ */ jsx33(Icon5, { icon: "trash", iconColor: "red" })
4298
+ children: /* @__PURE__ */ jsx37(Icon5, { icon: "trash", iconColor: "red" })
3657
4299
  }
3658
4300
  ) })
3659
4301
  ]
@@ -3666,7 +4308,7 @@ function VariablesList() {
3666
4308
  provided.placeholder
3667
4309
  ] })
3668
4310
  ] }) }) }),
3669
- /* @__PURE__ */ jsx33(
4311
+ /* @__PURE__ */ jsx37(
3670
4312
  AddListButton,
3671
4313
  {
3672
4314
  onButtonClick: () => dispatch({ type: "edit", variable: "" }),
@@ -3680,49 +4322,36 @@ function VariablesList() {
3680
4322
  }
3681
4323
 
3682
4324
  // src/components/DataResourceDynamicInputProvider.tsx
3683
- import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
4325
+ import { Fragment as Fragment9, jsx as jsx38 } from "@emotion/react/jsx-runtime";
3684
4326
  function DataResourceDynamicInputProvider({
3685
4327
  children,
3686
4328
  dynamicInputs
3687
4329
  }) {
3688
4330
  if (dynamicInputs) {
3689
- return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
4331
+ return /* @__PURE__ */ jsx38(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
3690
4332
  }
3691
- return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderContextShim, { children });
4333
+ return /* @__PURE__ */ jsx38(DataResourceDynamicInputProviderContextShim, { children });
3692
4334
  }
3693
4335
  function DataResourceDynamicInputProviderContextShim(props) {
3694
4336
  const {
3695
4337
  metadata: { dynamicInputs }
3696
4338
  } = useMeshLocation("dataResource");
3697
- return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
4339
+ return /* @__PURE__ */ jsx38(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
3698
4340
  }
3699
4341
  function DataResourceDynamicInputProviderRenderer({
3700
4342
  children,
3701
4343
  dynamicInputs
3702
4344
  }) {
3703
- return /* @__PURE__ */ jsx34(
3704
- VariablesProvider,
3705
- {
3706
- value: convertDynamicInputsToVariables(dynamicInputs),
3707
- onChange: () => {
3708
- throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
3709
- },
3710
- editVariableComponent: () => /* @__PURE__ */ jsx34("span", { children: "Cannot edit dynamic inputs." }),
3711
- children
3712
- }
3713
- );
4345
+ return /* @__PURE__ */ jsx38(VariablesProvider, { value: convertDynamicInputsToVariables(dynamicInputs), readOnly: true, children });
3714
4346
  }
3715
4347
  function convertDynamicInputsToVariables(dynamicInputs) {
3716
4348
  return Object.entries(dynamicInputs).reduce(
3717
- (acc, [name, input]) => {
4349
+ (acc, [name, input2]) => {
3718
4350
  acc[name] = {
3719
- type: input.type,
3720
- default: input.value,
3721
- helpText: /* @__PURE__ */ jsxs22(Fragment7, { children: [
3722
- input.value || /* @__PURE__ */ jsx34("em", { children: "not provided" }),
3723
- ", from ",
3724
- input.type === "path" ? "URL path" : "query string"
3725
- ] })
4351
+ type: input2.type,
4352
+ default: input2.value,
4353
+ source: `from ${input2.type === "path" ? "URL path" : "query string"}`,
4354
+ helpText: /* @__PURE__ */ jsx38(Fragment9, { children: input2.value || /* @__PURE__ */ jsx38("em", { children: "not provided" }) })
3726
4355
  // type abuse! 💚
3727
4356
  };
3728
4357
  return acc;
@@ -3734,13 +4363,13 @@ function convertDynamicInputsToVariables(dynamicInputs) {
3734
4363
  // src/components/DataResourceVariablesList.tsx
3735
4364
  init_emotion_jsx_shim();
3736
4365
  import { Callout as Callout4 } from "@uniformdev/design-system";
3737
- import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
4366
+ import { jsx as jsx39 } from "@emotion/react/jsx-runtime";
3738
4367
  function DataResourceVariablesList(props) {
3739
4368
  const {
3740
4369
  value,
3741
4370
  metadata: { dataType, dynamicInputs }
3742
4371
  } = useMeshLocation("dataResource");
3743
- return /* @__PURE__ */ jsx35(
4372
+ return /* @__PURE__ */ jsx39(
3744
4373
  DataResourceVariablesListExplicit,
3745
4374
  {
3746
4375
  ...props,
@@ -3761,14 +4390,14 @@ function DataResourceVariablesListExplicit({
3761
4390
  const variableDefinitions = variablesToList(dataType.variables);
3762
4391
  if (variableDefinitions.length === 0) {
3763
4392
  if (NoVariablesComponent) {
3764
- return /* @__PURE__ */ jsx35(NoVariablesComponent, {});
4393
+ return /* @__PURE__ */ jsx39(NoVariablesComponent, {});
3765
4394
  }
3766
- return /* @__PURE__ */ jsx35(Callout4, { type: "note", children: "No settings are required." });
4395
+ return /* @__PURE__ */ jsx39(Callout4, { type: "note", children: "No settings are required." });
3767
4396
  }
3768
- return /* @__PURE__ */ jsx35(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx35("div", { children: variableDefinitions.map((variableDefinition) => {
4397
+ return /* @__PURE__ */ jsx39(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx39("div", { children: variableDefinitions.map((variableDefinition) => {
3769
4398
  var _a, _b, _c;
3770
4399
  const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
3771
- return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
4400
+ return /* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(
3772
4401
  VariableRenderer,
3773
4402
  {
3774
4403
  definition: variableDefinition,
@@ -3791,7 +4420,7 @@ function DataResourceVariablesListExplicit({
3791
4420
  }
3792
4421
  function TextVariableRenderer({ definition, value, setValue }) {
3793
4422
  var _a;
3794
- return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
4423
+ return /* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(
3795
4424
  InputVariables,
3796
4425
  {
3797
4426
  label: definition.displayName || definition.name,
@@ -3807,14 +4436,14 @@ init_emotion_jsx_shim();
3807
4436
 
3808
4437
  // src/components/Request/RequestBody.tsx
3809
4438
  init_emotion_jsx_shim();
3810
- import { css as css25 } from "@emotion/react";
4439
+ import { css as css26 } from "@emotion/react";
3811
4440
  import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
3812
- import { useState as useState10 } from "react";
4441
+ import { useState as useState12 } from "react";
3813
4442
 
3814
4443
  // src/components/Request/RequestProvider.tsx
3815
4444
  init_emotion_jsx_shim();
3816
4445
  import * as React12 from "react";
3817
- import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
4446
+ import { jsx as jsx40 } from "@emotion/react/jsx-runtime";
3818
4447
  var RequestContext = React12.createContext(null);
3819
4448
  function RequestProvider({ value, onChange, children }) {
3820
4449
  const contextValue = React12.useMemo(() => {
@@ -3883,7 +4512,7 @@ function RequestProvider({ value, onChange, children }) {
3883
4512
  request: value
3884
4513
  };
3885
4514
  }, [onChange, value]);
3886
- return /* @__PURE__ */ jsx36(RequestContext.Provider, { value: contextValue, children });
4515
+ return /* @__PURE__ */ jsx40(RequestContext.Provider, { value: contextValue, children });
3887
4516
  }
3888
4517
  function useRequest() {
3889
4518
  const context = React12.useContext(RequestContext);
@@ -3898,11 +4527,11 @@ init_emotion_jsx_shim();
3898
4527
 
3899
4528
  // src/components/Request/styles/Request.styles.ts
3900
4529
  init_emotion_jsx_shim();
3901
- import { css as css24 } from "@emotion/react";
3902
- var innerContentStyles = css24`
4530
+ import { css as css25 } from "@emotion/react";
4531
+ var innerContentStyles = css25`
3903
4532
  background: var(--white);
3904
4533
  `;
3905
- var requestTypeContainer = (bgColor) => css24`
4534
+ var requestTypeContainer = (bgColor) => css25`
3906
4535
  align-items: start;
3907
4536
  background: ${bgColor};
3908
4537
  display: grid;
@@ -3911,17 +4540,17 @@ var requestTypeContainer = (bgColor) => css24`
3911
4540
  `;
3912
4541
 
3913
4542
  // src/components/Request/RequestTypeContainer.tsx
3914
- import { jsx as jsx37 } from "@emotion/react/jsx-runtime";
4543
+ import { jsx as jsx41 } from "@emotion/react/jsx-runtime";
3915
4544
  var RequestTypeContainer = ({
3916
4545
  bgColor = "transparent",
3917
4546
  children,
3918
4547
  ...props
3919
4548
  }) => {
3920
- return /* @__PURE__ */ jsx37("div", { css: requestTypeContainer(bgColor), ...props, children });
4549
+ return /* @__PURE__ */ jsx41("div", { css: requestTypeContainer(bgColor), ...props, children });
3921
4550
  };
3922
4551
 
3923
4552
  // src/components/Request/RequestBody.tsx
3924
- import { jsx as jsx38, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
4553
+ import { jsx as jsx42, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
3925
4554
  var LANGUAGE_OPTIONS = [
3926
4555
  { label: "Text", value: "plaintext" },
3927
4556
  { label: "JSON", value: "json" },
@@ -3940,22 +4569,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
3940
4569
  };
3941
4570
  function RequestBody() {
3942
4571
  const { request, dispatch } = useRequest();
3943
- const [language, setLanguage] = useState10("json");
3944
- return /* @__PURE__ */ jsxs23(
4572
+ const [language, setLanguage] = useState12("json");
4573
+ return /* @__PURE__ */ jsxs24(
3945
4574
  "div",
3946
4575
  {
3947
- css: css25`
4576
+ css: css26`
3948
4577
  background: var(--white);
3949
4578
  `,
3950
4579
  children: [
3951
- /* @__PURE__ */ jsx38(
4580
+ /* @__PURE__ */ jsx42(
3952
4581
  RequestTypeContainer,
3953
4582
  {
3954
4583
  bgColor: "var(--gray-100)",
3955
- css: css25`
4584
+ css: css26`
3956
4585
  padding: var(--spacing-sm) var(--spacing-base);
3957
4586
  `,
3958
- children: /* @__PURE__ */ jsx38(
4587
+ children: /* @__PURE__ */ jsx42(
3959
4588
  InputSelect4,
3960
4589
  {
3961
4590
  label: "Language",
@@ -3978,7 +4607,7 @@ function RequestBody() {
3978
4607
  )
3979
4608
  }
3980
4609
  ),
3981
- /* @__PURE__ */ jsx38(
4610
+ /* @__PURE__ */ jsx42(
3982
4611
  JsonEditor,
3983
4612
  {
3984
4613
  height: 200,
@@ -3998,7 +4627,7 @@ function RequestBody() {
3998
4627
  // src/components/Request/RequestHeaders.tsx
3999
4628
  init_emotion_jsx_shim();
4000
4629
  import {
4001
- Input as Input4,
4630
+ Input as Input3,
4002
4631
  Table as Table2,
4003
4632
  TableBody as TableBody2,
4004
4633
  TableCellData as TableCellData2,
@@ -4007,7 +4636,7 @@ import {
4007
4636
  TableRow as TableRow2,
4008
4637
  WarningMessage as WarningMessage2
4009
4638
  } from "@uniformdev/design-system";
4010
- import { jsx as jsx39, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
4639
+ import { jsx as jsx43, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
4011
4640
  function RequestHeaders({ disableVariables }) {
4012
4641
  var _a, _b;
4013
4642
  const { dispatch, request } = useRequest();
@@ -4023,29 +4652,29 @@ function RequestHeaders({ disableVariables }) {
4023
4652
  index
4024
4653
  });
4025
4654
  };
4026
- return /* @__PURE__ */ jsx39("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs24(Table2, { children: [
4027
- /* @__PURE__ */ jsx39(TableHead2, { children: /* @__PURE__ */ jsxs24(TableRow2, { children: [
4028
- /* @__PURE__ */ jsx39(TableCellHead2, { children: "Name" }),
4029
- /* @__PURE__ */ jsx39(TableCellHead2, { children: "Value" })
4655
+ return /* @__PURE__ */ jsx43("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs25(Table2, { children: [
4656
+ /* @__PURE__ */ jsx43(TableHead2, { children: /* @__PURE__ */ jsxs25(TableRow2, { children: [
4657
+ /* @__PURE__ */ jsx43(TableCellHead2, { children: "Name" }),
4658
+ /* @__PURE__ */ jsx43(TableCellHead2, { children: "Value" })
4030
4659
  ] }) }),
4031
- /* @__PURE__ */ jsxs24(TableBody2, { children: [
4660
+ /* @__PURE__ */ jsxs25(TableBody2, { children: [
4032
4661
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
4033
- return /* @__PURE__ */ jsxs24(TableRow2, { children: [
4034
- /* @__PURE__ */ jsxs24(TableCellData2, { width: "50%", children: [
4662
+ return /* @__PURE__ */ jsxs25(TableRow2, { children: [
4663
+ /* @__PURE__ */ jsxs25(TableCellData2, { width: "50%", children: [
4035
4664
  baseHeader.key,
4036
- /* @__PURE__ */ jsx39("br", {}),
4037
- /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx39("small", { children: "from data source" }) })
4665
+ /* @__PURE__ */ jsx43("br", {}),
4666
+ /* @__PURE__ */ jsx43("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx43("small", { children: "from data source" }) })
4038
4667
  ] }),
4039
- /* @__PURE__ */ jsxs24(TableCellData2, { width: "50%", children: [
4040
- /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
4041
- request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ jsx39(WarningMessage2, { message: "overridden below" }) : null
4668
+ /* @__PURE__ */ jsxs25(TableCellData2, { width: "50%", children: [
4669
+ /* @__PURE__ */ jsx43("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
4670
+ request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ jsx43(WarningMessage2, { message: "overridden below" }) : null
4042
4671
  ] })
4043
4672
  ] }, baseHeader.key);
4044
4673
  }),
4045
4674
  deezHeaders.map((header, index) => {
4046
- return /* @__PURE__ */ jsxs24(TableRow2, { children: [
4047
- /* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx39(
4048
- Input4,
4675
+ return /* @__PURE__ */ jsxs25(TableRow2, { children: [
4676
+ /* @__PURE__ */ jsx43(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx43(
4677
+ Input3,
4049
4678
  {
4050
4679
  label: header.key,
4051
4680
  value: header.key,
@@ -4064,13 +4693,15 @@ function RequestHeaders({ disableVariables }) {
4064
4693
  "data-test-id": "header-key"
4065
4694
  }
4066
4695
  ) }),
4067
- /* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx39(
4696
+ /* @__PURE__ */ jsx43(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx43(
4068
4697
  InputVariables,
4069
4698
  {
4070
4699
  value: header.value,
4071
4700
  onChange: (value) => handleUpdateParamFromMenu({ key: header.key, value, index }),
4072
4701
  disableVariables,
4073
4702
  showAddVariableMenuOption: true,
4703
+ enableEditingVariables: true,
4704
+ disableReset: true,
4074
4705
  "data-test-id": "header-value"
4075
4706
  }
4076
4707
  ) : null })
@@ -4083,11 +4714,11 @@ function RequestHeaders({ disableVariables }) {
4083
4714
  // src/components/Request/RequestMethodSelect.tsx
4084
4715
  init_emotion_jsx_shim();
4085
4716
  import { InputSelect as InputSelect5 } from "@uniformdev/design-system";
4086
- import { jsx as jsx40 } from "@emotion/react/jsx-runtime";
4717
+ import { jsx as jsx44 } from "@emotion/react/jsx-runtime";
4087
4718
  function RequestMethodSelect(props) {
4088
4719
  var _a;
4089
4720
  const { request, dispatch } = useRequest();
4090
- return /* @__PURE__ */ jsx40(
4721
+ return /* @__PURE__ */ jsx44(
4091
4722
  InputSelect5,
4092
4723
  {
4093
4724
  ...props,
@@ -4105,7 +4736,7 @@ function RequestMethodSelect(props) {
4105
4736
  // src/components/Request/RequestParameters.tsx
4106
4737
  init_emotion_jsx_shim();
4107
4738
  import {
4108
- Input as Input5,
4739
+ Input as Input4,
4109
4740
  Table as Table3,
4110
4741
  TableBody as TableBody3,
4111
4742
  TableCellData as TableCellData3,
@@ -4114,7 +4745,7 @@ import {
4114
4745
  TableRow as TableRow3,
4115
4746
  WarningMessage as WarningMessage3
4116
4747
  } from "@uniformdev/design-system";
4117
- import { jsx as jsx41, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
4748
+ import { jsx as jsx45, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
4118
4749
  function RequestParameters({ disableVariables }) {
4119
4750
  var _a, _b;
4120
4751
  const { dispatch, request } = useRequest();
@@ -4130,29 +4761,29 @@ function RequestParameters({ disableVariables }) {
4130
4761
  index
4131
4762
  });
4132
4763
  };
4133
- return /* @__PURE__ */ jsx41("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs25(Table3, { children: [
4134
- /* @__PURE__ */ jsx41(TableHead3, { children: /* @__PURE__ */ jsxs25(TableRow3, { children: [
4135
- /* @__PURE__ */ jsx41(TableCellHead3, { children: "Name" }),
4136
- /* @__PURE__ */ jsx41(TableCellHead3, { children: "Value" })
4764
+ return /* @__PURE__ */ jsx45("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs26(Table3, { children: [
4765
+ /* @__PURE__ */ jsx45(TableHead3, { children: /* @__PURE__ */ jsxs26(TableRow3, { children: [
4766
+ /* @__PURE__ */ jsx45(TableCellHead3, { children: "Name" }),
4767
+ /* @__PURE__ */ jsx45(TableCellHead3, { children: "Value" })
4137
4768
  ] }) }),
4138
- /* @__PURE__ */ jsxs25(TableBody3, { children: [
4769
+ /* @__PURE__ */ jsxs26(TableBody3, { children: [
4139
4770
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
4140
- return /* @__PURE__ */ jsxs25(TableRow3, { children: [
4141
- /* @__PURE__ */ jsxs25(TableCellData3, { width: "50%", children: [
4771
+ return /* @__PURE__ */ jsxs26(TableRow3, { children: [
4772
+ /* @__PURE__ */ jsxs26(TableCellData3, { width: "50%", children: [
4142
4773
  baseParameter.key,
4143
- /* @__PURE__ */ jsx41("br", {}),
4144
- /* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx41("small", { children: "from data source" }) })
4774
+ /* @__PURE__ */ jsx45("br", {}),
4775
+ /* @__PURE__ */ jsx45("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx45("small", { children: "from data source" }) })
4145
4776
  ] }),
4146
- /* @__PURE__ */ jsxs25(TableCellData3, { width: "50%", children: [
4147
- /* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
4148
- request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ jsx41(WarningMessage3, { message: "overridden below" }) : null
4777
+ /* @__PURE__ */ jsxs26(TableCellData3, { width: "50%", children: [
4778
+ /* @__PURE__ */ jsx45("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
4779
+ request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ jsx45(WarningMessage3, { message: "overridden below" }) : null
4149
4780
  ] })
4150
4781
  ] }, baseParameter.key);
4151
4782
  }),
4152
4783
  deezParameters.map((parameter, index) => {
4153
- return /* @__PURE__ */ jsxs25(TableRow3, { children: [
4154
- /* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx41(
4155
- Input5,
4784
+ return /* @__PURE__ */ jsxs26(TableRow3, { children: [
4785
+ /* @__PURE__ */ jsx45(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx45(
4786
+ Input4,
4156
4787
  {
4157
4788
  label: parameter.key,
4158
4789
  value: parameter.key,
@@ -4171,7 +4802,7 @@ function RequestParameters({ disableVariables }) {
4171
4802
  "data-test-id": "parameter-key"
4172
4803
  }
4173
4804
  ) }),
4174
- /* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx41(
4805
+ /* @__PURE__ */ jsx45(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx45(
4175
4806
  InputVariables,
4176
4807
  {
4177
4808
  value: parameter.value,
@@ -4182,7 +4813,9 @@ function RequestParameters({ disableVariables }) {
4182
4813
  }),
4183
4814
  disableVariables,
4184
4815
  "data-test-id": "parameter-value",
4185
- showAddVariableMenuOption: true
4816
+ showAddVariableMenuOption: true,
4817
+ enableEditingVariables: true,
4818
+ disableReset: true
4186
4819
  }
4187
4820
  ) : null })
4188
4821
  ] }, index);
@@ -4193,8 +4826,8 @@ function RequestParameters({ disableVariables }) {
4193
4826
 
4194
4827
  // src/components/Request/RequestUrl.tsx
4195
4828
  init_emotion_jsx_shim();
4196
- import { css as css26 } from "@emotion/react";
4197
- import { useMemo as useMemo7 } from "react";
4829
+ import { css as css27 } from "@emotion/react";
4830
+ import { useMemo as useMemo10 } from "react";
4198
4831
 
4199
4832
  // src/components/Request/urlEncodeRequestParameter.ts
4200
4833
  init_emotion_jsx_shim();
@@ -4216,35 +4849,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
4216
4849
  }
4217
4850
 
4218
4851
  // src/components/Request/RequestUrl.tsx
4219
- import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
4852
+ import { Fragment as Fragment10, jsx as jsx46, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
4220
4853
  function RequestUrl() {
4221
4854
  var _a, _b;
4222
4855
  const { variables } = useVariables();
4223
4856
  const { request } = useRequest();
4224
- const mergedParameters = useMemo7(() => {
4857
+ const mergedParameters = useMemo10(() => {
4225
4858
  var _a2;
4226
4859
  if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
4227
4860
  return request.parameters;
4228
4861
  }
4229
4862
  return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
4230
4863
  }, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
4231
- return /* @__PURE__ */ jsxs26(
4864
+ return /* @__PURE__ */ jsxs27(
4232
4865
  "small",
4233
4866
  {
4234
- css: css26`
4867
+ css: css27`
4235
4868
  display: inline-block;
4236
4869
  margin-bottom: var(--spacing-xs);
4237
4870
  word-break: break-word;
4238
4871
  `,
4239
4872
  children: [
4240
- request.baseRequest ? /* @__PURE__ */ jsx42("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
4241
- /* @__PURE__ */ jsxs26("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
4873
+ request.baseRequest ? /* @__PURE__ */ jsx46("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
4874
+ /* @__PURE__ */ jsxs27("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
4242
4875
  urlEncodeRequestUrl(request.relativeUrl, variables),
4243
- mergedParameters.length > 0 ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
4876
+ mergedParameters.length > 0 ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
4244
4877
  "?",
4245
4878
  mergedParameters.map((param, index) => {
4246
4879
  const encoded = urlEncodeRequestParameter(param, variables);
4247
- return /* @__PURE__ */ jsxs26("span", { children: [
4880
+ return /* @__PURE__ */ jsxs27("span", { children: [
4248
4881
  index > 0 ? "&" : null,
4249
4882
  encoded.key,
4250
4883
  "=",
@@ -4261,9 +4894,9 @@ function RequestUrl() {
4261
4894
  // src/components/Request/RequestUrlInput.tsx
4262
4895
  init_emotion_jsx_shim();
4263
4896
 
4264
- // src/components/Request/util/handlePastedUrl.ts
4897
+ // src/components/Request/util/transformPastedUrl.ts
4265
4898
  init_emotion_jsx_shim();
4266
- function handlePastedUrl(value, currentRequest, dispatch) {
4899
+ function transformPastedUrl(value, currentRequest, dispatch) {
4267
4900
  var _a, _b, _c;
4268
4901
  const indexOfQueryString = value.indexOf("?");
4269
4902
  const hasQueryString = indexOfQueryString >= 0;
@@ -4271,7 +4904,6 @@ function handlePastedUrl(value, currentRequest, dispatch) {
4271
4904
  if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
4272
4905
  relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
4273
4906
  }
4274
- dispatch({ type: "setRelativeUrl", relativeUrl });
4275
4907
  if (hasQueryString) {
4276
4908
  for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
4277
4909
  dispatch({ type: "removeParameter", index });
@@ -4284,25 +4916,25 @@ function handlePastedUrl(value, currentRequest, dispatch) {
4284
4916
  } catch (e) {
4285
4917
  }
4286
4918
  }
4919
+ return relativeUrl;
4287
4920
  }
4288
4921
 
4289
4922
  // src/components/Request/RequestUrlInput.tsx
4290
- import { jsx as jsx43 } from "@emotion/react/jsx-runtime";
4923
+ import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
4291
4924
  function RequestUrlInput(props) {
4292
4925
  const { request, dispatch } = useRequest();
4293
- return /* @__PURE__ */ jsx43(
4926
+ return /* @__PURE__ */ jsx47(
4294
4927
  InputVariables,
4295
4928
  {
4296
4929
  disableReset: true,
4297
4930
  ...props,
4298
4931
  value: request.relativeUrl,
4299
- onPaste: (value) => {
4300
- handlePastedUrl(value, request, dispatch);
4301
- },
4932
+ transformPaste: (value) => transformPastedUrl(value, request, dispatch),
4302
4933
  onChange: (value) => {
4303
4934
  dispatch({ type: "setRelativeUrl", relativeUrl: value });
4304
4935
  },
4305
4936
  showAddVariableMenuOption: true,
4937
+ enableEditingVariables: true,
4306
4938
  "data-test-id": "field-url"
4307
4939
  }
4308
4940
  );
@@ -4345,18 +4977,19 @@ function useRequestParameter(paramName) {
4345
4977
  }
4346
4978
 
4347
4979
  // src/components/DataSourceEditor.tsx
4348
- import { jsx as jsx44 } from "@emotion/react/jsx-runtime";
4980
+ import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
4349
4981
  function DataSourceEditor({ onChange, children, editVariableComponent }) {
4350
4982
  var _a;
4351
4983
  const { value } = useMeshLocation("dataSource");
4352
4984
  const currentRequestValue = convertDataSourceToRequestData(value);
4353
- return /* @__PURE__ */ jsx44(
4985
+ return /* @__PURE__ */ jsx48(
4354
4986
  VariablesProvider,
4355
4987
  {
4356
4988
  value: (_a = value.variables) != null ? _a : {},
4357
4989
  onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
4358
4990
  editVariableComponent,
4359
- children: /* @__PURE__ */ jsx44(
4991
+ readOnly: true,
4992
+ children: /* @__PURE__ */ jsx48(
4360
4993
  RequestProvider,
4361
4994
  {
4362
4995
  value: currentRequestValue,
@@ -4394,21 +5027,23 @@ function convertRequestDataToDataSource(dataSource, requestData) {
4394
5027
 
4395
5028
  // src/components/DataTypeEditor.tsx
4396
5029
  init_emotion_jsx_shim();
4397
- import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
5030
+ import { jsx as jsx49 } from "@emotion/react/jsx-runtime";
4398
5031
  function DataTypeEditor({ onChange, children, editVariableComponent }) {
4399
5032
  var _a;
4400
5033
  const {
4401
5034
  value,
4402
- metadata: { dataSource }
5035
+ metadata: { dataSource },
5036
+ isReadOnly
4403
5037
  } = useMeshLocation("dataType");
4404
5038
  const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
4405
- return /* @__PURE__ */ jsx45(
5039
+ return /* @__PURE__ */ jsx49(
4406
5040
  VariablesProvider,
4407
5041
  {
4408
5042
  value: (_a = value.variables) != null ? _a : {},
4409
5043
  onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
4410
5044
  editVariableComponent,
4411
- children: /* @__PURE__ */ jsx45(
5045
+ readOnly: isReadOnly,
5046
+ children: /* @__PURE__ */ jsx49(
4412
5047
  RequestProvider,
4413
5048
  {
4414
5049
  value: currentRequestValue,
@@ -4460,12 +5095,12 @@ import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniform
4460
5095
  // src/hooks/useInitializeUniformMeshSdk.ts
4461
5096
  init_emotion_jsx_shim();
4462
5097
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
4463
- import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
5098
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState13 } from "react";
4464
5099
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
4465
- const [error, setError] = useState11();
4466
- const [sdk, setSdk] = useState11();
5100
+ const [error, setError] = useState13();
5101
+ const [sdk, setSdk] = useState13();
4467
5102
  const initializationInProgress = useRef10(false);
4468
- useEffect8(
5103
+ useEffect12(
4469
5104
  () => {
4470
5105
  if (typeof window === "undefined" || sdk) {
4471
5106
  return;
@@ -4498,7 +5133,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
4498
5133
  };
4499
5134
 
4500
5135
  // src/components/MeshApp.tsx
4501
- import { jsx as jsx46, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
5136
+ import { jsx as jsx50, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
4502
5137
  var MeshApp = ({
4503
5138
  children,
4504
5139
  loadingComponent,
@@ -4507,37 +5142,37 @@ var MeshApp = ({
4507
5142
  const { initializing, error, sdk } = useInitializeUniformMeshSdk();
4508
5143
  if (initializing || !sdk) {
4509
5144
  const LoadingComponent = loadingComponent;
4510
- return LoadingComponent ? /* @__PURE__ */ jsx46(LoadingComponent, {}) : /* @__PURE__ */ jsx46(LoadingIndicator2, {});
5145
+ return LoadingComponent ? /* @__PURE__ */ jsx50(LoadingComponent, {}) : /* @__PURE__ */ jsx50(LoadingIndicator2, {});
4511
5146
  }
4512
5147
  if (error) {
4513
5148
  const ErrorComponent = errorComponent;
4514
5149
  if (ErrorComponent) {
4515
- return /* @__PURE__ */ jsx46(ErrorComponent, { error });
5150
+ return /* @__PURE__ */ jsx50(ErrorComponent, { error });
4516
5151
  }
4517
5152
  throw error;
4518
5153
  }
4519
- return /* @__PURE__ */ jsxs27(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
4520
- /* @__PURE__ */ jsx46(Theme2, {}),
4521
- /* @__PURE__ */ jsx46(UniformMeshLocationContextProvider, { children })
5154
+ return /* @__PURE__ */ jsxs28(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
5155
+ /* @__PURE__ */ jsx50(Theme2, {}),
5156
+ /* @__PURE__ */ jsx50(UniformMeshLocationContextProvider, { children })
4522
5157
  ] });
4523
5158
  };
4524
5159
 
4525
5160
  // src/components/ObjectSearch/DataRefreshButton.tsx
4526
5161
  init_emotion_jsx_shim();
4527
- import { css as css27 } from "@emotion/react";
5162
+ import { css as css28 } from "@emotion/react";
4528
5163
  import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
4529
- import { jsx as jsx47, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
5164
+ import { jsx as jsx51, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
4530
5165
  var DataRefreshButton = ({
4531
5166
  buttonText,
4532
5167
  isLoading,
4533
5168
  onRefreshData,
4534
5169
  ...props
4535
5170
  }) => {
4536
- return /* @__PURE__ */ jsxs28(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4537
- !isLoading ? null : /* @__PURE__ */ jsx47(
5171
+ return /* @__PURE__ */ jsxs29(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
5172
+ !isLoading ? null : /* @__PURE__ */ jsx51(
4538
5173
  LoadingIndicator3,
4539
5174
  {
4540
- css: css27`
5175
+ css: css28`
4541
5176
  ${isLoading ? "opacity: 0.2;" : void 0}
4542
5177
  `
4543
5178
  }
@@ -4548,7 +5183,6 @@ var DataRefreshButton = ({
4548
5183
 
4549
5184
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
4550
5185
  init_emotion_jsx_shim();
4551
- import { css as css28 } from "@emotion/react";
4552
5186
 
4553
5187
  // ../canvas/dist/index.mjs
4554
5188
  init_emotion_jsx_shim();
@@ -5716,13 +6350,13 @@ import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@unifo
5716
6350
  init_emotion_jsx_shim();
5717
6351
  import {
5718
6352
  createContext as createContext5,
5719
- useCallback,
6353
+ useCallback as useCallback2,
5720
6354
  useContext as useContext7,
5721
6355
  useDeferredValue,
5722
- useMemo as useMemo8,
5723
- useState as useState12
6356
+ useMemo as useMemo11,
6357
+ useState as useState14
5724
6358
  } from "react";
5725
- import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
6359
+ import { jsx as jsx52 } from "@emotion/react/jsx-runtime";
5726
6360
  var ObjectSearchContext = createContext5({
5727
6361
  onSetQuery: () => {
5728
6362
  },
@@ -5738,15 +6372,15 @@ var ObjectSearchContext = createContext5({
5738
6372
  }
5739
6373
  });
5740
6374
  var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
5741
- const [query, setQuery] = useState12({
6375
+ const [query, setQuery] = useState14({
5742
6376
  contentType: "",
5743
6377
  keyword: ""
5744
6378
  });
5745
6379
  const { flatVariables } = useVariables(true);
5746
6380
  const querySearchDeferred = useDeferredValue(query);
5747
- const [selectedItems, setSelectedItems] = useState12(currentlySelectedItems != null ? currentlySelectedItems : []);
5748
- const [list, setList] = useState12({});
5749
- const onSetQuery = useCallback(
6381
+ const [selectedItems, setSelectedItems] = useState14(currentlySelectedItems != null ? currentlySelectedItems : []);
6382
+ const [list, setList] = useState14({});
6383
+ const onSetQuery = useCallback2(
5750
6384
  (value2) => {
5751
6385
  if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
5752
6386
  return setQuery({
@@ -5758,7 +6392,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
5758
6392
  },
5759
6393
  [setQuery]
5760
6394
  );
5761
- const onSelectItem = useCallback(
6395
+ const onSelectItem = useCallback2(
5762
6396
  (selectedResult) => {
5763
6397
  if (Array.isArray(selectedResult)) {
5764
6398
  setSelectedItems(selectedResult);
@@ -5772,17 +6406,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
5772
6406
  },
5773
6407
  [setSelectedItems, selectedItems]
5774
6408
  );
5775
- const onRemoveAllSelectedItems = useCallback(() => {
6409
+ const onRemoveAllSelectedItems = useCallback2(() => {
5776
6410
  setSelectedItems([]);
5777
6411
  }, [setSelectedItems]);
5778
- const onSetList = useCallback(
6412
+ const onSetList = useCallback2(
5779
6413
  (value2) => {
5780
6414
  setList(value2);
5781
6415
  },
5782
6416
  [setList]
5783
6417
  );
5784
- const boundQuery = useMemo8(() => bindQuery(query, flatVariables), [query, flatVariables]);
5785
- const value = useMemo8(
6418
+ const boundQuery = useMemo11(() => bindQuery(query, flatVariables), [query, flatVariables]);
6419
+ const value = useMemo11(
5786
6420
  () => ({
5787
6421
  boundQuery,
5788
6422
  onSetQuery,
@@ -5804,7 +6438,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
5804
6438
  onSetList
5805
6439
  ]
5806
6440
  );
5807
- return /* @__PURE__ */ jsx48(ObjectSearchContext.Provider, { value, children });
6441
+ return /* @__PURE__ */ jsx52(ObjectSearchContext.Provider, { value, children });
5808
6442
  };
5809
6443
  function useObjectSearchContext() {
5810
6444
  return useContext7(ObjectSearchContext);
@@ -5822,7 +6456,7 @@ function bindQuery(query, inputs) {
5822
6456
  }
5823
6457
 
5824
6458
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
5825
- import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
6459
+ import { jsx as jsx53, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
5826
6460
  var ObjectSearchContainer = ({
5827
6461
  label,
5828
6462
  enableDynamicInputToResultId,
@@ -5833,21 +6467,9 @@ var ObjectSearchContainer = ({
5833
6467
  var _a, _b;
5834
6468
  const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
5835
6469
  const { flatVariables } = useVariables(true);
5836
- const body = /* @__PURE__ */ jsxs29(VerticalRhythm, { children: [
6470
+ const body = /* @__PURE__ */ jsxs30(VerticalRhythm, { children: [
5837
6471
  searchFilters,
5838
- !resultList ? null : /* @__PURE__ */ jsx49(
5839
- ScrollableList,
5840
- {
5841
- role: "list",
5842
- css: css28`
5843
- > div {
5844
- transition: max-height var(--duration-slow) var(--timing-ease-out);
5845
- max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
5846
- }
5847
- `,
5848
- children: resultList
5849
- }
5850
- )
6472
+ !resultList ? null : /* @__PURE__ */ jsx53(ScrollableList, { role: "list", children: resultList })
5851
6473
  ] });
5852
6474
  const handleSelectedVariableChange = (selectedValue) => {
5853
6475
  var _a2;
@@ -5876,8 +6498,8 @@ var ObjectSearchContainer = ({
5876
6498
  }
5877
6499
  ]);
5878
6500
  };
5879
- return /* @__PURE__ */ jsx49(IconsProvider, { children: /* @__PURE__ */ jsxs29(VerticalRhythm, { children: [
5880
- /* @__PURE__ */ jsx49(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx49(
6501
+ return /* @__PURE__ */ jsx53(IconsProvider, { children: /* @__PURE__ */ jsxs30(VerticalRhythm, { children: [
6502
+ /* @__PURE__ */ jsx53(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx53(
5881
6503
  InputVariables,
5882
6504
  {
5883
6505
  label,
@@ -5894,7 +6516,7 @@ var ObjectSearchContainer = ({
5894
6516
  // src/components/ObjectSearch/ObjectSearchFilter.tsx
5895
6517
  init_emotion_jsx_shim();
5896
6518
  import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
5897
- import { useState as useState13 } from "react";
6519
+ import { useState as useState15 } from "react";
5898
6520
 
5899
6521
  // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
5900
6522
  init_emotion_jsx_shim();
@@ -5921,7 +6543,7 @@ var ObjectSearchFilterGrid = (gridColumns) => css29`
5921
6543
  `;
5922
6544
 
5923
6545
  // src/components/ObjectSearch/ObjectSearchFilter.tsx
5924
- import { jsx as jsx50, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
6546
+ import { jsx as jsx54, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
5925
6547
  var ObjectSearchFilter = ({
5926
6548
  requireContentType,
5927
6549
  typeSelectorAllTypesOptionText = "All content types",
@@ -5931,7 +6553,7 @@ var ObjectSearchFilter = ({
5931
6553
  selectOptions
5932
6554
  }) => {
5933
6555
  const { query, onSetQuery } = useObjectSearchContext();
5934
- const [searchState, setSearchState] = useState13({
6556
+ const [searchState, setSearchState] = useState15({
5935
6557
  contentType: "",
5936
6558
  keyword: ""
5937
6559
  });
@@ -5941,8 +6563,8 @@ var ObjectSearchFilter = ({
5941
6563
  });
5942
6564
  onSetQuery({ ...query, ...value });
5943
6565
  };
5944
- return /* @__PURE__ */ jsxs30("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
5945
- /* @__PURE__ */ jsx50(
6566
+ return /* @__PURE__ */ jsxs31("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
6567
+ /* @__PURE__ */ jsx54(
5946
6568
  InputSelect6,
5947
6569
  {
5948
6570
  label: selectLabel,
@@ -5958,7 +6580,7 @@ var ObjectSearchFilter = ({
5958
6580
  value: query.contentType
5959
6581
  }
5960
6582
  ),
5961
- /* @__PURE__ */ jsx50(
6583
+ /* @__PURE__ */ jsx54(
5962
6584
  InputKeywordSearch2,
5963
6585
  {
5964
6586
  inputFieldName: searchInputName,
@@ -5974,17 +6596,17 @@ var ObjectSearchFilter = ({
5974
6596
 
5975
6597
  // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
5976
6598
  init_emotion_jsx_shim();
5977
- import { jsx as jsx51, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
6599
+ import { jsx as jsx55, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
5978
6600
  var ObjectSearchFilterContainer2 = ({ label, children }) => {
5979
- return /* @__PURE__ */ jsxs31("div", { children: [
5980
- label ? /* @__PURE__ */ jsx51("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
5981
- /* @__PURE__ */ jsx51("div", { css: ObjectSearchFilterContainer, children })
6601
+ return /* @__PURE__ */ jsxs32("div", { children: [
6602
+ label ? /* @__PURE__ */ jsx55("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
6603
+ /* @__PURE__ */ jsx55("div", { css: ObjectSearchFilterContainer, children })
5982
6604
  ] });
5983
6605
  };
5984
6606
 
5985
6607
  // src/components/ObjectSearch/ObjectSearchListItem.tsx
5986
6608
  init_emotion_jsx_shim();
5987
- import { Chip, Popover } from "@uniformdev/design-system";
6609
+ import { Popover } from "@uniformdev/design-system";
5988
6610
 
5989
6611
  // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
5990
6612
  init_emotion_jsx_shim();
@@ -5996,8 +6618,12 @@ var ObjectListItemContainer = css30`
5996
6618
  border-radius: var(--rounded-base);
5997
6619
  background: var(--white);
5998
6620
  display: grid;
5999
- grid-template-columns: 1fr auto;
6621
+ grid-template-columns: 1fr 32px;
6000
6622
  padding: var(--spacing-sm);
6623
+
6624
+ &[hidden] {
6625
+ display: none;
6626
+ }
6001
6627
  `;
6002
6628
  var ObjectListItemLoading = css30`
6003
6629
  animation: ${skeletonLoading} 1s linear infinite alternate;
@@ -6041,7 +6667,6 @@ var ObjectListItemSubtitle = css30`
6041
6667
  var ObjectListItemInfoContainer = css30`
6042
6668
  align-items: center;
6043
6669
  display: flex;
6044
- gap: var(--spacing-sm);
6045
6670
  justify-content: center;
6046
6671
  `;
6047
6672
  var ObjectListItemControlledContent = css30`
@@ -6054,7 +6679,7 @@ var ObjectListItemUnControlledContent = css30`
6054
6679
  `;
6055
6680
 
6056
6681
  // src/components/ObjectSearch/ObjectSearchListItem.tsx
6057
- import { jsx as jsx52, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
6682
+ import { jsx as jsx56, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
6058
6683
  var ObjectSearchListItem = ({
6059
6684
  id,
6060
6685
  title,
@@ -6076,24 +6701,21 @@ var ObjectSearchListItem = ({
6076
6701
  }
6077
6702
  return onSelectItem([selectedItem]);
6078
6703
  };
6079
- const selected = selectedListItems.some((item) => item.id === id);
6080
- return /* @__PURE__ */ jsxs32("div", { role: "listitem", css: ObjectListItemContainer, children: [
6081
- /* @__PURE__ */ jsxs32("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
6082
- !image ? null : /* @__PURE__ */ jsx52("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
6083
- /* @__PURE__ */ jsxs32("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
6084
- !contentType ? null : /* @__PURE__ */ jsx52("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
6085
- /* @__PURE__ */ jsx52("span", { css: ObjectListItemTitle, children: title })
6704
+ const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
6705
+ return /* @__PURE__ */ jsxs33("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
6706
+ /* @__PURE__ */ jsxs33("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
6707
+ !image ? null : /* @__PURE__ */ jsx56("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
6708
+ /* @__PURE__ */ jsxs33("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
6709
+ !contentType ? null : /* @__PURE__ */ jsx56("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
6710
+ /* @__PURE__ */ jsx56("span", { css: ObjectListItemTitle, children: title })
6086
6711
  ] })
6087
6712
  ] }),
6088
- !popoverData ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectListItemInfoContainer, children: [
6089
- selected ? /* @__PURE__ */ jsx52(Chip, { text: "selected", size: "xs" }) : null,
6090
- /* @__PURE__ */ jsx52(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
6091
- ] }),
6092
- !children ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemUnControlledContent, children })
6713
+ !popoverData ? null : /* @__PURE__ */ jsx56("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx56(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
6714
+ !children ? null : /* @__PURE__ */ jsx56("div", { css: ObjectListItemUnControlledContent, children })
6093
6715
  ] });
6094
6716
  };
6095
6717
  var ObjectSearchListItemLoadingSkeleton = () => {
6096
- return /* @__PURE__ */ jsx52("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
6718
+ return /* @__PURE__ */ jsx56("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
6097
6719
  };
6098
6720
 
6099
6721
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
@@ -6141,14 +6763,14 @@ var ButtonIcon = css31`
6141
6763
  `;
6142
6764
 
6143
6765
  // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
6144
- import { jsx as jsx53, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
6766
+ import { jsx as jsx57, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
6145
6767
  var ObjectSearchResultItemButton = ({
6146
6768
  text,
6147
6769
  icon,
6148
6770
  ...props
6149
6771
  }) => {
6150
- return /* @__PURE__ */ jsxs33("button", { type: "button", css: ButtonStyles, ...props, children: [
6151
- !icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
6772
+ return /* @__PURE__ */ jsxs34("button", { type: "button", css: ButtonStyles, ...props, children: [
6773
+ !icon ? null : /* @__PURE__ */ jsx57(Image, { src: icon, css: ButtonIcon }),
6152
6774
  text
6153
6775
  ] });
6154
6776
  };
@@ -6157,8 +6779,8 @@ var LinkButton = ({
6157
6779
  icon,
6158
6780
  ...props
6159
6781
  }) => {
6160
- return /* @__PURE__ */ jsxs33("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6161
- !icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
6782
+ return /* @__PURE__ */ jsxs34("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6783
+ !icon ? null : /* @__PURE__ */ jsx57(Image, { src: icon, css: ButtonIcon }),
6162
6784
  text
6163
6785
  ] });
6164
6786
  };
@@ -6225,7 +6847,7 @@ var ObjectSearchImage = css32`
6225
6847
  `;
6226
6848
 
6227
6849
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6228
- import { jsx as jsx54, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
6850
+ import { jsx as jsx58, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6229
6851
  var ObjectSearchResultItem = ({
6230
6852
  id,
6231
6853
  title,
@@ -6249,35 +6871,35 @@ var ObjectSearchResultItem = ({
6249
6871
  onSelectItem({ id, title: id });
6250
6872
  onRemove == null ? void 0 : onRemove();
6251
6873
  };
6252
- return /* @__PURE__ */ jsxs34("div", { css: ObjectSearchResultItemContainer, children: [
6253
- disableDnD ? null : /* @__PURE__ */ jsx54("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6254
- /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsxs34("div", { css: ObjectSearchContentContainer, children: [
6255
- !imageUrl ? null : /* @__PURE__ */ jsx54("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6256
- /* @__PURE__ */ jsxs34("div", { children: [
6257
- /* @__PURE__ */ jsx54("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
6258
- /* @__PURE__ */ jsxs34("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
6874
+ return /* @__PURE__ */ jsxs35("div", { css: ObjectSearchResultItemContainer, children: [
6875
+ disableDnD ? null : /* @__PURE__ */ jsx58("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6876
+ /* @__PURE__ */ jsx58("div", { children: /* @__PURE__ */ jsxs35("div", { css: ObjectSearchContentContainer, children: [
6877
+ !imageUrl ? null : /* @__PURE__ */ jsx58("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6878
+ /* @__PURE__ */ jsxs35("div", { children: [
6879
+ /* @__PURE__ */ jsx58("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
6880
+ /* @__PURE__ */ jsxs35("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
6259
6881
  title != null ? title : name,
6260
- !popoverData ? null : /* @__PURE__ */ jsx54(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6882
+ !popoverData ? null : /* @__PURE__ */ jsx58(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6261
6883
  ] }),
6262
- !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchAuthorStateGroup, children: [
6263
- !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx54(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6264
- !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchUpdateGroup, children: [
6265
- !createdAt ? null : /* @__PURE__ */ jsxs34("small", { css: ObjectSearchResultItemTimeStamp, children: [
6266
- /* @__PURE__ */ jsx54("strong", { children: "Last updated: " }),
6884
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs35("div", { css: ObjectSearchAuthorStateGroup, children: [
6885
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx58(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6886
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs35("div", { css: ObjectSearchUpdateGroup, children: [
6887
+ !createdAt ? null : /* @__PURE__ */ jsxs35("small", { css: ObjectSearchResultItemTimeStamp, children: [
6888
+ /* @__PURE__ */ jsx58("strong", { children: "Last updated: " }),
6267
6889
  timeagoFormat(createdAt)
6268
6890
  ] }),
6269
- !publishedAt ? null : /* @__PURE__ */ jsxs34("small", { css: ObjectSearchResultItemTimeStamp, children: [
6270
- /* @__PURE__ */ jsx54("strong", { children: "Last published: " }),
6891
+ !publishedAt ? null : /* @__PURE__ */ jsxs35("small", { css: ObjectSearchResultItemTimeStamp, children: [
6892
+ /* @__PURE__ */ jsx58("strong", { children: "Last published: " }),
6271
6893
  timeagoFormat(publishedAt)
6272
6894
  ] })
6273
6895
  ] })
6274
6896
  ] }),
6275
- /* @__PURE__ */ jsx54("div", { children })
6897
+ /* @__PURE__ */ jsx58("div", { children })
6276
6898
  ] })
6277
6899
  ] }) }),
6278
- !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchAuthorStateGroup, children: [
6279
- !editLink ? null : /* @__PURE__ */ jsx54(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6280
- hideRemoveButton ? null : /* @__PURE__ */ jsx54(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6900
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs35("div", { css: ObjectSearchAuthorStateGroup, children: [
6901
+ !editLink ? null : /* @__PURE__ */ jsx58(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6902
+ hideRemoveButton ? null : /* @__PURE__ */ jsx58(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6281
6903
  ] })
6282
6904
  ] });
6283
6905
  };
@@ -6299,10 +6921,6 @@ var ObjectSearchResultListContainer = css33`
6299
6921
  var ObjectSearchDragContainer = css33`
6300
6922
  margin: 0 0 var(--spacing-sm);
6301
6923
  `;
6302
- var ObjectSearchContainerDragging = css33`
6303
- box-shadow: var(--shadow-base);
6304
- opacity: var(--opacity-50);
6305
- `;
6306
6924
  var ObjectSearchResultListCounterContainer = css33`
6307
6925
  align-items: center;
6308
6926
  display: flex;
@@ -6314,14 +6932,14 @@ var ObjectSearchResultListTitle = css33`
6314
6932
  `;
6315
6933
 
6316
6934
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
6317
- import { Fragment as Fragment9, jsx as jsx55, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6935
+ import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
6318
6936
  function ObjectSearchResultList({
6319
6937
  resultLabelText = "Selected",
6320
6938
  removeButtonText = "Remove all",
6321
6939
  onRemoveAllSelected,
6322
6940
  hideRemoveButton = false,
6323
6941
  additionalButtons,
6324
- renderResultComponent = (value) => /* @__PURE__ */ jsx55(ObjectSearchResultItem, { ...value }),
6942
+ renderResultComponent = (value) => /* @__PURE__ */ jsx59(ObjectSearchResultItem, { ...value, disableDnD }),
6325
6943
  multiSelectId,
6326
6944
  disableDnD = false,
6327
6945
  whenNothingSelected = null
@@ -6341,16 +6959,16 @@ function ObjectSearchResultList({
6341
6959
  return result;
6342
6960
  }
6343
6961
  };
6344
- return /* @__PURE__ */ jsxs35(Fragment9, { children: [
6345
- /* @__PURE__ */ jsxs35("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6346
- /* @__PURE__ */ jsxs35("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6347
- /* @__PURE__ */ jsx55("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6962
+ return /* @__PURE__ */ jsxs36(Fragment11, { children: [
6963
+ /* @__PURE__ */ jsxs36("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6964
+ /* @__PURE__ */ jsxs36("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6965
+ /* @__PURE__ */ jsx59("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6348
6966
  " ",
6349
- !selectedListItems.length ? null : /* @__PURE__ */ jsx55(Counter, { count: selectedListItems.length })
6967
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx59(Counter, { count: selectedListItems.length })
6350
6968
  ] }),
6351
- /* @__PURE__ */ jsxs35("div", { css: ObjectSearchResultListCounterContainer, children: [
6969
+ /* @__PURE__ */ jsxs36("div", { css: ObjectSearchResultListCounterContainer, children: [
6352
6970
  additionalButtons,
6353
- hideRemoveButton ? null : /* @__PURE__ */ jsx55(
6971
+ hideRemoveButton ? null : /* @__PURE__ */ jsx59(
6354
6972
  Button5,
6355
6973
  {
6356
6974
  buttonType: "ghostDestructive",
@@ -6362,33 +6980,20 @@ function ObjectSearchResultList({
6362
6980
  )
6363
6981
  ] })
6364
6982
  ] }),
6365
- !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx55(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx55(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs35("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6983
+ !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx59(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx59(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs36("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6366
6984
  selectedListItems.map((item, i2) => {
6367
- const itemValues = selectedListItems.length === 1 ? { ...item, disableDnD: true } : { ...item, disableDnD };
6368
- const renderListItem = renderResultComponent(itemValues);
6369
- return /* @__PURE__ */ jsx55(
6370
- Draggable3,
6985
+ const renderListItem = renderResultComponent(item);
6986
+ return /* @__PURE__ */ jsx59(Draggable3, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx59(
6987
+ "div",
6371
6988
  {
6372
- draggableId: item.id,
6373
- index: i2,
6374
- isDragDisabled: selectedListItems.length === 1 || disableDnD,
6375
- children: (provided2, snapshot) => /* @__PURE__ */ jsx55(
6376
- "div",
6377
- {
6378
- css: [
6379
- ObjectSearchDragContainer,
6380
- snapshot.isDragging ? ObjectSearchContainerDragging : void 0
6381
- ],
6382
- ref: provided2.innerRef,
6383
- "data-dragging": snapshot.isDragging,
6384
- ...provided2.draggableProps,
6385
- ...provided2.dragHandleProps,
6386
- children: renderListItem
6387
- }
6388
- )
6389
- },
6390
- item.id
6391
- );
6989
+ css: ObjectSearchDragContainer,
6990
+ ref: provided2.innerRef,
6991
+ "data-dragging": snapshot.isDragging,
6992
+ ...provided2.draggableProps,
6993
+ ...provided2.dragHandleProps,
6994
+ children: renderListItem
6995
+ }
6996
+ ) }, item.id);
6392
6997
  }),
6393
6998
  provided.placeholder
6394
6999
  ] }) }) })
@@ -6397,9 +7002,9 @@ function ObjectSearchResultList({
6397
7002
 
6398
7003
  // src/components/ObjectSearch/QueryFilter.tsx
6399
7004
  init_emotion_jsx_shim();
6400
- import { Input as Input6, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
6401
- import { useEffect as useEffect9, useState as useState14 } from "react";
6402
- import { jsx as jsx56, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
7005
+ import { Input as Input5, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
7006
+ import { useEffect as useEffect13, useState as useState16 } from "react";
7007
+ import { jsx as jsx60, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
6403
7008
  var QueryFilter = ({
6404
7009
  requireContentType,
6405
7010
  queryFilterTitle = "Configure Query",
@@ -6430,7 +7035,7 @@ var QueryFilter = ({
6430
7035
  }) => {
6431
7036
  var _a, _b, _c, _d;
6432
7037
  const { query, onSetQuery } = useObjectSearchContext();
6433
- const [queryState, setQueryState] = useState14({
7038
+ const [queryState, setQueryState] = useState16({
6434
7039
  contentType: "",
6435
7040
  keyword: "",
6436
7041
  count: countValue != null ? countValue : 5,
@@ -6441,13 +7046,13 @@ var QueryFilter = ({
6441
7046
  setQueryState((prev) => ({ ...prev, ...value }));
6442
7047
  onSetQuery({ ...query, ...value });
6443
7048
  };
6444
- useEffect9(() => {
7049
+ useEffect13(() => {
6445
7050
  onSetQuery(queryState);
6446
7051
  }, [onSetQuery, queryState]);
6447
- return /* @__PURE__ */ jsxs36("fieldset", { children: [
6448
- /* @__PURE__ */ jsx56("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
6449
- /* @__PURE__ */ jsx56("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs36(VerticalRhythm2, { children: [
6450
- /* @__PURE__ */ jsx56(
7052
+ return /* @__PURE__ */ jsxs37("fieldset", { children: [
7053
+ /* @__PURE__ */ jsx60("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
7054
+ /* @__PURE__ */ jsx60("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs37(VerticalRhythm2, { children: [
7055
+ /* @__PURE__ */ jsx60(
6451
7056
  InputVariables,
6452
7057
  {
6453
7058
  label: searchInputLabel,
@@ -6455,7 +7060,7 @@ var QueryFilter = ({
6455
7060
  onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
6456
7061
  disableInlineMenu: true,
6457
7062
  id: "qf_searchText",
6458
- inputWhenNoVariables: /* @__PURE__ */ jsx56(
7063
+ inputWhenNoVariables: /* @__PURE__ */ jsx60(
6459
7064
  InputKeywordSearch3,
6460
7065
  {
6461
7066
  id: "qf_searchText",
@@ -6469,8 +7074,8 @@ var QueryFilter = ({
6469
7074
  )
6470
7075
  }
6471
7076
  ),
6472
- /* @__PURE__ */ jsxs36("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
6473
- /* @__PURE__ */ jsx56(
7077
+ /* @__PURE__ */ jsxs37("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
7078
+ /* @__PURE__ */ jsx60(
6474
7079
  InputVariables,
6475
7080
  {
6476
7081
  label: contentTypeLabel,
@@ -6478,7 +7083,7 @@ var QueryFilter = ({
6478
7083
  value: (_d = queryState.contentType) != null ? _d : "",
6479
7084
  onChange: (newType) => handleFilterChange({ contentType: newType }),
6480
7085
  disableInlineMenu: true,
6481
- inputWhenNoVariables: /* @__PURE__ */ jsx56(
7086
+ inputWhenNoVariables: /* @__PURE__ */ jsx60(
6482
7087
  InputSelect7,
6483
7088
  {
6484
7089
  id: "qf_contentType",
@@ -6497,7 +7102,7 @@ var QueryFilter = ({
6497
7102
  )
6498
7103
  }
6499
7104
  ),
6500
- /* @__PURE__ */ jsx56(
7105
+ /* @__PURE__ */ jsx60(
6501
7106
  InputVariables,
6502
7107
  {
6503
7108
  label: countLabel,
@@ -6505,8 +7110,8 @@ var QueryFilter = ({
6505
7110
  value: queryState.count.toString(10),
6506
7111
  onChange: (newCount) => handleFilterChange({ count: newCount }),
6507
7112
  disableInlineMenu: true,
6508
- inputWhenNoVariables: /* @__PURE__ */ jsx56(
6509
- Input6,
7113
+ inputWhenNoVariables: /* @__PURE__ */ jsx60(
7114
+ Input5,
6510
7115
  {
6511
7116
  id: "qf_count",
6512
7117
  label: countLabel,
@@ -6520,8 +7125,8 @@ var QueryFilter = ({
6520
7125
  }
6521
7126
  )
6522
7127
  ] }),
6523
- /* @__PURE__ */ jsxs36("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
6524
- /* @__PURE__ */ jsx56(
7128
+ /* @__PURE__ */ jsxs37("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
7129
+ /* @__PURE__ */ jsx60(
6525
7130
  InputVariables,
6526
7131
  {
6527
7132
  id: "qf_sortBy",
@@ -6529,7 +7134,7 @@ var QueryFilter = ({
6529
7134
  value: queryState.sortBy,
6530
7135
  onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
6531
7136
  disableInlineMenu: true,
6532
- inputWhenNoVariables: /* @__PURE__ */ jsx56(
7137
+ inputWhenNoVariables: /* @__PURE__ */ jsx60(
6533
7138
  InputSelect7,
6534
7139
  {
6535
7140
  label: sortLabel,
@@ -6551,7 +7156,7 @@ var QueryFilter = ({
6551
7156
  )
6552
7157
  }
6553
7158
  ),
6554
- /* @__PURE__ */ jsx56(
7159
+ /* @__PURE__ */ jsx60(
6555
7160
  InputVariables,
6556
7161
  {
6557
7162
  label: sortOrderLabel,
@@ -6559,7 +7164,7 @@ var QueryFilter = ({
6559
7164
  value: queryState.sortOrder,
6560
7165
  onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
6561
7166
  disableInlineMenu: true,
6562
- inputWhenNoVariables: /* @__PURE__ */ jsx56(
7167
+ inputWhenNoVariables: /* @__PURE__ */ jsx60(
6563
7168
  InputSelect7,
6564
7169
  {
6565
7170
  label: sortOrderLabel,
@@ -6602,7 +7207,7 @@ import {
6602
7207
  Button as Button6,
6603
7208
  Callout as Callout5,
6604
7209
  Heading,
6605
- Input as Input7,
7210
+ Input as Input6,
6606
7211
  InputComboBox,
6607
7212
  InputKeywordSearch as InputKeywordSearch4,
6608
7213
  InputSelect as InputSelect8,
@@ -6611,7 +7216,7 @@ import {
6611
7216
  LoadingIndicator as LoadingIndicator4,
6612
7217
  LoadingOverlay as LoadingOverlay2,
6613
7218
  Menu as Menu3,
6614
- MenuItem as MenuItem3,
7219
+ MenuItem as MenuItem4,
6615
7220
  ParameterGroup,
6616
7221
  ParameterImage,
6617
7222
  ParameterImageInner,
@@ -6649,7 +7254,7 @@ export {
6649
7254
  EntrySearch,
6650
7255
  Heading,
6651
7256
  icons_exports as Icons,
6652
- Input7 as Input,
7257
+ Input6 as Input,
6653
7258
  InputComboBox,
6654
7259
  InputKeywordSearch4 as InputKeywordSearch,
6655
7260
  InputSelect8 as InputSelect,
@@ -6660,7 +7265,7 @@ export {
6660
7265
  LoadingIndicator4 as LoadingIndicator,
6661
7266
  LoadingOverlay2 as LoadingOverlay,
6662
7267
  Menu3 as Menu,
6663
- MenuItem3 as MenuItem,
7268
+ MenuItem4 as MenuItem,
6664
7269
  MeshApp,
6665
7270
  ObjectSearchContainer,
6666
7271
  ObjectSearchFilter,
@@ -6788,7 +7393,6 @@ export {
6788
7393
  useRequestParameter,
6789
7394
  useUniformMeshSdk,
6790
7395
  useVariables,
6791
- variableExpression,
6792
7396
  variablePrefix,
6793
7397
  variableSuffix,
6794
7398
  variablesToList