@uniformdev/mesh-sdk-react 20.46.1-alpha.9 → 20.47.1-alpha.3

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.js CHANGED
@@ -646,14 +646,14 @@ function deserializeVariablesEditorState(serialized) {
646
646
  children: [
647
647
  {
648
648
  children: result,
649
- direction: "ltr",
649
+ direction: null,
650
650
  format: "",
651
651
  indent: 0,
652
652
  type: "paragraph",
653
653
  version: 1
654
654
  }
655
655
  ],
656
- direction: "ltr",
656
+ direction: null,
657
657
  format: "",
658
658
  indent: 0,
659
659
  type: "root",
@@ -920,7 +920,7 @@ var import_zod = require("@hookform/resolvers/zod");
920
920
  var import_design_system4 = require("@uniformdev/design-system");
921
921
  var import_react12 = require("react");
922
922
  var import_react_hook_form = require("react-hook-form");
923
- var z = __toESM(require("zod"));
923
+ var z = __toESM(require("zod/v3"));
924
924
 
925
925
  // src/components/Variables/styles/VariableEditor.styles.ts
926
926
  var import_react11 = require("@emotion/react");
@@ -1292,18 +1292,17 @@ var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)(
1292
1292
  "uniform:disconnect-variable"
1293
1293
  );
1294
1294
  var INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:insert-variable");
1295
- var TRIGGER = "\\$\\$";
1296
- var LENGTH_LIMIT = 20;
1297
- var DollarSignVariablesRegex = new RegExp(`(^.*)(${TRIGGER}(.{0,${LENGTH_LIMIT}}))$`);
1295
+ var DollarSignVariablesRegex = /(^.*)(\$\$(.{0,20}))$/;
1298
1296
  function getPossibleQueryMatch(text) {
1299
1297
  const match = DollarSignVariablesRegex.exec(text);
1300
1298
  if (match !== null) {
1301
1299
  const maybeLeadingWhitespace = match[1];
1302
1300
  const matchingString = match[3];
1301
+ const replaceableString = match[2];
1303
1302
  return {
1304
1303
  leadOffset: match.index + maybeLeadingWhitespace.length,
1305
1304
  matchingString,
1306
- replaceableString: match[2]
1305
+ replaceableString
1307
1306
  };
1308
1307
  }
1309
1308
  return null;
@@ -1423,7 +1422,10 @@ function VariablesPlugin({
1423
1422
  filteredGroupedVariables: groupedVariables.map((group) => ({
1424
1423
  name: group.name,
1425
1424
  variables: group.variables.filter(
1426
- (option) => option.name.toLowerCase().includes(query) || option.name === ADD_VARIABLE_OPTION
1425
+ (option) => {
1426
+ var _a;
1427
+ return option.name === ADD_VARIABLE_OPTION || option.name.toLowerCase().includes(query) || ((_a = option.displayName) == null ? void 0 : _a.toLowerCase().includes(query));
1428
+ }
1427
1429
  )
1428
1430
  })).filter((group) => group.variables.length > 0),
1429
1431
  filteredMenuOptions: menuOptions.filter(
@@ -1714,13 +1716,13 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1714
1716
  constructor(reference, state, key) {
1715
1717
  super(key);
1716
1718
  this.reference = reference;
1717
- this.__state = state;
1719
+ this.__variableState = state;
1718
1720
  }
1719
1721
  static getType() {
1720
1722
  return "variable";
1721
1723
  }
1722
1724
  static clone(node) {
1723
- return new _VariableNode(node.reference, { ...node.__state }, node.__key);
1725
+ return new _VariableNode(node.reference, { ...node.__variableState }, node.__key);
1724
1726
  }
1725
1727
  /** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
1726
1728
  static importJSON(serializedNode) {
@@ -1735,14 +1737,14 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1735
1737
  }
1736
1738
  /** Gets the node's current state */
1737
1739
  getState() {
1738
- return this.getLatest().__state;
1740
+ return this.getLatest().__variableState;
1739
1741
  }
1740
1742
  /**
1741
1743
  * Updates the node's variables state so it knows its current validity, display name, etc
1742
1744
  * The plugin updates this whenever the variables prop changes.
1743
1745
  */
1744
1746
  setState(state) {
1745
- this.getWritable().__state = state;
1747
+ this.getWritable().__variableState = state;
1746
1748
  }
1747
1749
  /**
1748
1750
  * Serializes the node to JSON for editor initial state
@@ -1782,7 +1784,7 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1782
1784
  * rely on Context, etc in this renderer.
1783
1785
  */
1784
1786
  decorate() {
1785
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1787
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__variableState, reference: this.reference, nodeKey: this.__key });
1786
1788
  }
1787
1789
  };
1788
1790
  function $convertBindingElement(domNode) {
@@ -2048,27 +2050,40 @@ var placeholderCompact = import_react18.css`
2048
2050
  var import_react19 = require("@emotion/react");
2049
2051
  var import_design_system7 = require("@uniformdev/design-system");
2050
2052
  var variableBindButton = import_react19.css`
2051
- align-items: center;
2052
- border: none;
2053
+ --hover-color: var(--accent-dark-hover);
2054
+ --active-color: var(--accent-dark-active);
2055
+ border: 1px solid transparent;
2053
2056
  border-radius: var(--rounded-base);
2054
2057
  background: none;
2058
+ color: var(--gray-300);
2055
2059
  display: flex;
2056
- height: 1.2rem;
2057
- padding: var(--spacing-2xs);
2060
+ align-items: center;
2061
+ justify-content: center;
2062
+ max-width: fit-content;
2063
+ padding: 0.125rem;
2058
2064
  transition:
2065
+ border-color var(--duration-fast) var(--timing-ease-out),
2059
2066
  background var(--duration-fast) var(--timing-ease-out),
2060
- color var(--duration-fast) var(--timing-ease-out);
2061
- width: 1.2rem;
2067
+ color var(--duration-fast) var(--timing-ease-out),
2068
+ box-shadow var(--duration-fast) var(--timing-ease-out);
2062
2069
 
2063
- &:hover,
2064
- &[aria-pressed='true']:not(:disabled) {
2065
- background: var(--brand-secondary-3);
2066
- color: var(--white);
2070
+ &:hover:not([aria-disabled='true']),
2071
+ &:focus:not([aria-disabled='true']),
2072
+ &:focus-within:not([aria-disabled='true']) {
2073
+ color: var(--gray-500);
2074
+ border-color: var(--hover-color);
2075
+ }
2076
+
2077
+ &:active:not([aria-disabled='true']),
2078
+ &[aria-pressed='true']:not([aria-disabled='true']) {
2079
+ color: var(--active-color);
2067
2080
  }
2068
2081
 
2069
2082
  &[aria-disabled='true'] {
2070
2083
  background: none;
2071
2084
  color: currentColor;
2085
+ opacity: var(--opacity-50);
2086
+ cursor: default;
2072
2087
  }
2073
2088
 
2074
2089
  // fixes menu resizing issue within iframes
@@ -2142,7 +2157,6 @@ var inputMultiLine = (lines) => import_react19.css`
2142
2157
 
2143
2158
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
2144
2159
  var import_canvas6 = require("@uniformdev/canvas");
2145
- var React4 = __toESM(require("react"));
2146
2160
  var import_react20 = require("react");
2147
2161
  function useInputVariablesState({
2148
2162
  value,
@@ -2159,14 +2173,14 @@ function useInputVariablesState({
2159
2173
  }) {
2160
2174
  const { variables } = useVariables(true);
2161
2175
  const variableReferenceCountInValue = (0, import_canvas6.hasReferencedVariables)(value != null ? value : "");
2162
- const [lastKnownId, setLastKnownId] = React4.useState(id);
2163
- const [hadVariablesInValue, setHadVariablesInValue] = React4.useState(variableReferenceCountInValue > 0);
2164
- React4.useEffect(() => {
2176
+ const [lastKnownId, setLastKnownId] = (0, import_react20.useState)(id);
2177
+ const [hadVariablesInValue, setHadVariablesInValue] = (0, import_react20.useState)(variableReferenceCountInValue > 0);
2178
+ (0, import_react20.useEffect)(() => {
2165
2179
  if (variableReferenceCountInValue) {
2166
2180
  setHadVariablesInValue(true);
2167
2181
  }
2168
2182
  }, [variableReferenceCountInValue]);
2169
- React4.useEffect(() => {
2183
+ (0, import_react20.useEffect)(() => {
2170
2184
  if (id !== lastKnownId) {
2171
2185
  setLastKnownId(id);
2172
2186
  setHadVariablesInValue(variableReferenceCountInValue > 0);
@@ -2216,30 +2230,6 @@ var labelText = import_react21.css`
2216
2230
  font-weight: var(--fw-regular);
2217
2231
  margin: 0 0 var(--spacing-xs);
2218
2232
  `;
2219
- var variableBindButton2 = import_react21.css`
2220
- align-items: center;
2221
- border: none;
2222
- border-radius: var(--rounded-base);
2223
- background: none;
2224
- display: flex;
2225
- height: 1.2rem;
2226
- padding: var(--spacing-2xs);
2227
- transition:
2228
- background var(--duration-fast) var(--timing-ease-out),
2229
- color var(--duration-fast) var(--timing-ease-out);
2230
- width: 1.2rem;
2231
-
2232
- &:hover,
2233
- &[aria-pressed='true']:not(:disabled) {
2234
- background: var(--brand-secondary-3);
2235
- color: var(--white);
2236
- }
2237
-
2238
- &[aria-disabled='true'] {
2239
- background: none;
2240
- color: currentColor;
2241
- }
2242
- `;
2243
2233
 
2244
2234
  // src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
2245
2235
  var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
@@ -2286,7 +2276,7 @@ function SelectVariableMenu({
2286
2276
  css: [menuBtn, buttonCss],
2287
2277
  type: "button",
2288
2278
  "data-testid": "insert-variable",
2289
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_CgUsbC.CgUsbC, { size: "1.4rem" })
2279
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_CgUsbC.CgUsbC, { size: "1rem" })
2290
2280
  }
2291
2281
  ),
2292
2282
  children: [
@@ -2379,7 +2369,7 @@ function VariableField({
2379
2369
  VariablesComposerVariableMenu,
2380
2370
  {
2381
2371
  ...selectVariableMenuOptions,
2382
- buttonCss: [variableBindButton2, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
2372
+ buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
2383
2373
  buttonProps: isActive ? { "aria-pressed": "true" } : void 0
2384
2374
  }
2385
2375
  ) }) : null;
@@ -2450,8 +2440,8 @@ function VariablesComposer(props) {
2450
2440
  // eslint-disable-next-line react-hooks/exhaustive-deps
2451
2441
  []
2452
2442
  );
2453
- const editorState = (0, import_react25.useRef)();
2454
- const updateTimeout = (0, import_react25.useRef)();
2443
+ const editorState = (0, import_react25.useRef)(void 0);
2444
+ const updateTimeout = (0, import_react25.useRef)(void 0);
2455
2445
  if (typeof document === "undefined") return null;
2456
2446
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
2457
2447
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -2488,7 +2478,7 @@ function VariablesComposer(props) {
2488
2478
  var import_clipboard = require("@lexical/clipboard");
2489
2479
  var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
2490
2480
  var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
2491
- var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
2481
+ var import_LexicalErrorBoundary = require("@lexical/react/LexicalErrorBoundary");
2492
2482
  var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
2493
2483
  var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
2494
2484
  var import_utils4 = require("@lexical/utils");
@@ -2506,7 +2496,7 @@ function VariablesComposerInput({
2506
2496
  {
2507
2497
  contentEditable: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_LexicalContentEditable.ContentEditable, { ...contentEditableProps, placeholder: null, "aria-placeholder": void 0 }),
2508
2498
  placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: placeholder }) : null,
2509
- ErrorBoundary: import_LexicalErrorBoundary.default
2499
+ ErrorBoundary: import_LexicalErrorBoundary.LexicalErrorBoundary
2510
2500
  }
2511
2501
  ),
2512
2502
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RichishCopyAndPastePlugin, {}),
@@ -2656,6 +2646,7 @@ function InputVariables(props) {
2656
2646
  portal: renderMenuInPortal,
2657
2647
  replaceValueOnVariableInsert: useInputWithNoVariables,
2658
2648
  useInputWhenNoVariables: useInputWithNoVariables,
2649
+ isActive: hadVariablesInValue,
2659
2650
  children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2660
2651
  VariablesComposerInput,
2661
2652
  {
@@ -2744,6 +2735,7 @@ function InputVariablesOverlayMenu({
2744
2735
  disabled,
2745
2736
  useInputWhenNoVariables,
2746
2737
  portal,
2738
+ isActive,
2747
2739
  ...props
2748
2740
  }) {
2749
2741
  if (disabled) {
@@ -2757,7 +2749,8 @@ function InputVariablesOverlayMenu({
2757
2749
  ...props,
2758
2750
  portal,
2759
2751
  tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
2760
- buttonCss: menuBtn2
2752
+ buttonCss: [menuBtn2, variableBindButton],
2753
+ buttonProps: isActive ? { "aria-pressed": "true" } : void 0
2761
2754
  }
2762
2755
  )
2763
2756
  ] });
@@ -2810,7 +2803,7 @@ function ParameterConnectionIndicator({
2810
2803
  css: [menuBtn, variableBindButton],
2811
2804
  type: "button",
2812
2805
  "data-testid": "insert-variable",
2813
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
2806
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_CgUsbC2.CgUsbC, { size: "1rem" })
2814
2807
  }
2815
2808
  )
2816
2809
  }
@@ -3030,13 +3023,13 @@ ${prettifyBindExpression(bindExpression)}`
3030
3023
 
3031
3024
  // src/components/Variables/VariablesList.tsx
3032
3025
  var import_react35 = require("@emotion/react");
3026
+ var import_dnd2 = require("@hello-pangea/dnd");
3033
3027
  var import_CgTrash = require("@react-icons/all-files/cg/CgTrash");
3034
3028
  var import_design_system13 = require("@uniformdev/design-system");
3035
- var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
3036
3029
 
3037
3030
  // src/components/DragDropContext.tsx
3031
+ var import_dnd = require("@hello-pangea/dnd");
3038
3032
  var import_react33 = require("react");
3039
- var import_react_beautiful_dnd = require("react-beautiful-dnd");
3040
3033
  var import_react_use = require("react-use");
3041
3034
  var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
3042
3035
  function DragDropContext({ children, ...props }) {
@@ -3048,7 +3041,7 @@ function DragDropContext({ children, ...props }) {
3048
3041
  300,
3049
3042
  []
3050
3043
  );
3051
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_beautiful_dnd.DragDropContext, { ...props, children: isReady ? children : null });
3044
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_dnd.DragDropContext, { ...props, children: isReady ? children : null });
3052
3045
  }
3053
3046
 
3054
3047
  // src/components/Variables/styles/VariablesList.styles.ts
@@ -3098,8 +3091,8 @@ var variableValue = import_react34.css`
3098
3091
 
3099
3092
  // src/components/Variables/VariablesList.tsx
3100
3093
  var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
3101
- var DroppableHack = import_react_beautiful_dnd2.Droppable;
3102
- var DraggableHack = import_react_beautiful_dnd2.Draggable;
3094
+ var DroppableHack = import_dnd2.Droppable;
3095
+ var DraggableHack = import_dnd2.Draggable;
3103
3096
  function VariablesList() {
3104
3097
  const { variables, dispatch, readOnly } = useVariables();
3105
3098
  const sorted = variablesToList(variables).filter((variable) => !variable.system);
@@ -3291,7 +3284,8 @@ function TextVariableRenderer({ definition, value, setValue }) {
3291
3284
  value: value != null ? value : "",
3292
3285
  caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
3293
3286
  onChange: setValue,
3294
- "data-testid": "variable-input"
3287
+ "data-testid": "variable-input",
3288
+ disableInlineMenu: "by-label"
3295
3289
  }
3296
3290
  ) });
3297
3291
  }
@@ -3302,11 +3296,12 @@ var import_design_system15 = require("@uniformdev/design-system");
3302
3296
  var import_react38 = require("react");
3303
3297
 
3304
3298
  // src/components/Request/RequestProvider.tsx
3305
- var React5 = __toESM(require("react"));
3299
+ var React4 = __toESM(require("react"));
3306
3300
  var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
3307
- var RequestContext = React5.createContext(null);
3301
+ var RequestContext = React4.createContext(null);
3308
3302
  function RequestProvider({ value, onChange, children }) {
3309
- const contextValue = React5.useMemo(() => {
3303
+ const [listVersion, setListVersion] = React4.useState(0);
3304
+ const contextValue = React4.useMemo(() => {
3310
3305
  return {
3311
3306
  dispatch: (event) => {
3312
3307
  if (event.type === "setRelativeUrl") {
@@ -3325,6 +3320,7 @@ function RequestProvider({ value, onChange, children }) {
3325
3320
  return { ...old, parameters: newParameters };
3326
3321
  });
3327
3322
  } else if (event.type === "removeParameter") {
3323
+ setListVersion((v) => v + 1);
3328
3324
  onChange((old) => {
3329
3325
  const newParameters = [...old.parameters];
3330
3326
  newParameters.splice(event.index, 1);
@@ -3341,6 +3337,7 @@ function RequestProvider({ value, onChange, children }) {
3341
3337
  return { ...old, headers: newHeaders };
3342
3338
  });
3343
3339
  } else if (event.type === "removeHeader") {
3340
+ setListVersion((v) => v + 1);
3344
3341
  onChange((old) => {
3345
3342
  const newHeaders = [...old.headers];
3346
3343
  newHeaders.splice(event.index, 1);
@@ -3369,13 +3366,14 @@ function RequestProvider({ value, onChange, children }) {
3369
3366
  throw new Error(`Unknown event ${JSON.stringify(event)}`);
3370
3367
  }
3371
3368
  },
3372
- request: value
3369
+ request: value,
3370
+ listVersion
3373
3371
  };
3374
- }, [onChange, value]);
3372
+ }, [onChange, value, listVersion]);
3375
3373
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RequestContext.Provider, { value: contextValue, children });
3376
3374
  }
3377
3375
  function useRequest() {
3378
- const context = React5.useContext(RequestContext);
3376
+ const context = React4.useContext(RequestContext);
3379
3377
  if (!context) {
3380
3378
  throw new Error("No RequestProvider present");
3381
3379
  }
@@ -3488,7 +3486,7 @@ function RequestHeaders({
3488
3486
  addOmitIfEmpty
3489
3487
  }) {
3490
3488
  var _a, _b;
3491
- const { dispatch, request } = useRequest();
3489
+ const { dispatch, request, listVersion } = useRequest();
3492
3490
  const deezHeaders = [...request.headers, { key: "", value: "" }];
3493
3491
  const handleUpdateParamFromMenu = ({
3494
3492
  key,
@@ -3574,7 +3572,7 @@ function RequestHeaders({
3574
3572
  })
3575
3573
  }
3576
3574
  ) : null }) : null
3577
- ] }, index);
3575
+ ] }, `${index}-${listVersion}`);
3578
3576
  })
3579
3577
  ] })
3580
3578
  ] }) });
@@ -3609,7 +3607,7 @@ function RequestParameters({
3609
3607
  addOmitIfEmpty
3610
3608
  }) {
3611
3609
  var _a, _b;
3612
- const { dispatch, request } = useRequest();
3610
+ const { dispatch, request, listVersion } = useRequest();
3613
3611
  const deezParameters = [...request.parameters, { key: "", value: "" }];
3614
3612
  const handleUpdateParamFromMenu = ({
3615
3613
  key,
@@ -3707,7 +3705,7 @@ function RequestParameters({
3707
3705
  }
3708
3706
  }
3709
3707
  ) : null }) : null
3710
- ] }, index);
3708
+ ] }, `${index}-${listVersion}`);
3711
3709
  })
3712
3710
  ] })
3713
3711
  ] }) });
@@ -4751,8 +4749,8 @@ function legacyThemeMapper(theme) {
4751
4749
  }
4752
4750
 
4753
4751
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
4752
+ var import_dnd3 = require("@hello-pangea/dnd");
4754
4753
  var import_design_system27 = require("@uniformdev/design-system");
4755
- var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
4756
4754
 
4757
4755
  // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
4758
4756
  var import_react50 = require("@emotion/react");
@@ -4781,8 +4779,8 @@ var ObjectSearchResultListTitle = import_react50.css`
4781
4779
 
4782
4780
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
4783
4781
  var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
4784
- var DroppableHack2 = import_react_beautiful_dnd3.Droppable;
4785
- var DraggableHack2 = import_react_beautiful_dnd3.Draggable;
4782
+ var DroppableHack2 = import_dnd3.Droppable;
4783
+ var DraggableHack2 = import_dnd3.Draggable;
4786
4784
  function ObjectSearchResultList({
4787
4785
  resultLabelText = "Selected",
4788
4786
  removeButtonText = "Remove all",