@chaibuilder/sdk 2.0.0-beta.95 → 2.0.0-beta.96

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/core.cjs CHANGED
@@ -840,7 +840,7 @@ const StoreContext = React.createContext(
840
840
  );
841
841
  const useStore = (options) => {
842
842
  const store = React.useContext(StoreContext);
843
- return store || getDefaultStore();
843
+ return (options == null ? void 0 : options.store) || store || getDefaultStore();
844
844
  };
845
845
  const isPromiseLike = (x) => typeof (x == null ? void 0 : x.then) === "function";
846
846
  const attachPromiseMeta = (promise) => {
@@ -906,7 +906,7 @@ const createContinuablePromise = (promise) => {
906
906
  return continuablePromise;
907
907
  };
908
908
  function useAtomValue(atom2, options) {
909
- const store = useStore();
909
+ const store = useStore(options);
910
910
  const [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = React.useReducer(
911
911
  (prev) => {
912
912
  const nextValue = store.get(atom2);
@@ -939,7 +939,7 @@ function useAtomValue(atom2, options) {
939
939
  return value;
940
940
  }
941
941
  function useSetAtom(atom2, options) {
942
- const store = useStore();
942
+ const store = useStore(options);
943
943
  const setAtom = React.useCallback(
944
944
  (...args) => {
945
945
  return store.set(atom2, ...args);
@@ -950,9 +950,9 @@ function useSetAtom(atom2, options) {
950
950
  }
951
951
  function useAtom(atom2, options) {
952
952
  return [
953
- useAtomValue(atom2),
953
+ useAtomValue(atom2, options),
954
954
  // We do wrong type assertion here, which results in throwing an error.
955
- useSetAtom(atom2)
955
+ useSetAtom(atom2, options)
956
956
  ];
957
957
  }
958
958
  function useAtomCallback(callback, options) {
@@ -960,7 +960,7 @@ function useAtomCallback(callback, options) {
960
960
  () => atom(null, (get, set, ...args) => callback(get, set, ...args)),
961
961
  [callback]
962
962
  );
963
- return useSetAtom(anAtom);
963
+ return useSetAtom(anAtom, options);
964
964
  }
965
965
  const readOnlyModeAtom = jotai.atom(false);
966
966
  readOnlyModeAtom.debugLabel = "readOnlyModeAtom";
@@ -1822,6 +1822,7 @@ const useRemoveBlocks = () => {
1822
1822
  [presentBlocks, setSelectedIds, ids2]
1823
1823
  );
1824
1824
  };
1825
+ const builderStore = jotai.getDefaultStore();
1825
1826
  const writeAtomValue = jotai.atom(
1826
1827
  null,
1827
1828
  // it's a convention to pass `null` for the first argument
@@ -1855,7 +1856,8 @@ const useGetBlockAtomValue = (splitAtoms) => {
1855
1856
  return get(blockAtom);
1856
1857
  },
1857
1858
  [splitAtoms]
1858
- )
1859
+ ),
1860
+ { store: builderStore }
1859
1861
  );
1860
1862
  };
1861
1863
  const useGetBlockAtom = (splitAtoms) => {
@@ -1878,7 +1880,8 @@ const useGetBlockAtom = (splitAtoms) => {
1878
1880
  return blockAtom;
1879
1881
  },
1880
1882
  [splitAtoms]
1881
- )
1883
+ ),
1884
+ { store: builderStore }
1882
1885
  );
1883
1886
  };
1884
1887
  function insertBlocksAtPosition(allBlocks, newBlocks, parentId, position) {
@@ -11048,7 +11051,6 @@ function getFromQueryParams(key) {
11048
11051
  const FEATURE_TOGGLES = {
11049
11052
  dnd: getFromQueryParams("dnd")
11050
11053
  };
11051
- const builderStore = jotai.getDefaultStore();
11052
11054
  const setDebugLogs = (value) => {
11053
11055
  };
11054
11056
  const getParentNodeIds = (blocks, id) => {
package/dist/core.js CHANGED
@@ -5,7 +5,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, Component, Children, useState, useRef, Suspense, createElement, memo, lazy } from "react";
7
7
  import { ag as useToast, S as Skeleton, B as Button, L as Label, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, T as Textarea, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, C as Card, x as CardHeader, E as CardDescription, F as CardContent, y as CardFooter, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, j as AlertDialog, k as AlertDialogTrigger, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, b as Switch, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-DHla8ofZ.js";
8
- import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
8
+ import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1 } from "jotai";
9
9
  import { has, get, find, filter, flatten, map, omit, isString, includes, without, compact, each, set, first, isObject, memoize, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, forEach, unset, chunk, cloneDeep, pick, throttle, isFunction as isFunction$1, reverse, startCase, debounce, capitalize, split, findIndex, take, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, uniq, flatMapDeep, some, reject, sortBy, toUpper, round } from "lodash-es";
10
10
  import { Provider } from "react-wrap-balancer";
11
11
  import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-CWgVxu0A.js";
@@ -825,7 +825,7 @@ const StoreContext = createContext(
825
825
  );
826
826
  const useStore = (options) => {
827
827
  const store = useContext(StoreContext);
828
- return store || getDefaultStore();
828
+ return (options == null ? void 0 : options.store) || store || getDefaultStore();
829
829
  };
830
830
  const isPromiseLike = (x) => typeof (x == null ? void 0 : x.then) === "function";
831
831
  const attachPromiseMeta = (promise) => {
@@ -891,7 +891,7 @@ const createContinuablePromise = (promise) => {
891
891
  return continuablePromise;
892
892
  };
893
893
  function useAtomValue(atom2, options) {
894
- const store = useStore();
894
+ const store = useStore(options);
895
895
  const [[valueFromReducer, storeFromReducer, atomFromReducer], rerender] = useReducer(
896
896
  (prev) => {
897
897
  const nextValue = store.get(atom2);
@@ -924,7 +924,7 @@ function useAtomValue(atom2, options) {
924
924
  return value;
925
925
  }
926
926
  function useSetAtom(atom2, options) {
927
- const store = useStore();
927
+ const store = useStore(options);
928
928
  const setAtom = useCallback(
929
929
  (...args) => {
930
930
  return store.set(atom2, ...args);
@@ -935,9 +935,9 @@ function useSetAtom(atom2, options) {
935
935
  }
936
936
  function useAtom(atom2, options) {
937
937
  return [
938
- useAtomValue(atom2),
938
+ useAtomValue(atom2, options),
939
939
  // We do wrong type assertion here, which results in throwing an error.
940
- useSetAtom(atom2)
940
+ useSetAtom(atom2, options)
941
941
  ];
942
942
  }
943
943
  function useAtomCallback(callback, options) {
@@ -945,7 +945,7 @@ function useAtomCallback(callback, options) {
945
945
  () => atom(null, (get2, set2, ...args) => callback(get2, set2, ...args)),
946
946
  [callback]
947
947
  );
948
- return useSetAtom(anAtom);
948
+ return useSetAtom(anAtom, options);
949
949
  }
950
950
  const readOnlyModeAtom = atom$1(false);
951
951
  readOnlyModeAtom.debugLabel = "readOnlyModeAtom";
@@ -1807,6 +1807,7 @@ const useRemoveBlocks = () => {
1807
1807
  [presentBlocks, setSelectedIds, ids2]
1808
1808
  );
1809
1809
  };
1810
+ const builderStore = getDefaultStore$1();
1810
1811
  const writeAtomValue = atom$1(
1811
1812
  null,
1812
1813
  // it's a convention to pass `null` for the first argument
@@ -1840,7 +1841,8 @@ const useGetBlockAtomValue = (splitAtoms) => {
1840
1841
  return get2(blockAtom);
1841
1842
  },
1842
1843
  [splitAtoms]
1843
- )
1844
+ ),
1845
+ { store: builderStore }
1844
1846
  );
1845
1847
  };
1846
1848
  const useGetBlockAtom = (splitAtoms) => {
@@ -1863,7 +1865,8 @@ const useGetBlockAtom = (splitAtoms) => {
1863
1865
  return blockAtom;
1864
1866
  },
1865
1867
  [splitAtoms]
1866
- )
1868
+ ),
1869
+ { store: builderStore }
1867
1870
  );
1868
1871
  };
1869
1872
  function insertBlocksAtPosition(allBlocks, newBlocks, parentId, position) {
@@ -11033,7 +11036,6 @@ function getFromQueryParams(key) {
11033
11036
  const FEATURE_TOGGLES = {
11034
11037
  dnd: getFromQueryParams("dnd")
11035
11038
  };
11036
- const builderStore = getDefaultStore$1();
11037
11039
  const setDebugLogs = (value) => {
11038
11040
  };
11039
11041
  const getParentNodeIds = (blocks, id) => {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "2.0.0-beta.95",
8
+ "version": "2.0.0-beta.96",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",