@chaibuilder/sdk 2.0.0-beta.93 → 2.0.0-beta.94

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
@@ -1841,14 +1841,13 @@ const useGetBlockAtomValue = (splitAtoms) => {
1841
1841
  return useAtomCallback(
1842
1842
  React.useCallback(
1843
1843
  (get, _set, idOrAtom) => {
1844
- const blockAsAtoms = get(pageBlocksAtomsAtom);
1844
+ const blockAsAtoms = get(splitAtoms);
1845
1845
  const blockAtom = lodashEs.find(
1846
1846
  blockAsAtoms,
1847
1847
  (b) => get(b)._id === (lodashEs.isString(idOrAtom) ? idOrAtom : get(idOrAtom)._id)
1848
1848
  );
1849
1849
  if (!blockAtom) {
1850
- console.warn(`Block with id ${idOrAtom} not found`);
1851
- return;
1850
+ throw new Error(`Block with id ${idOrAtom} not found`);
1852
1851
  }
1853
1852
  return get(blockAtom);
1854
1853
  },
@@ -1860,14 +1859,13 @@ const useGetBlockAtom = (splitAtoms) => {
1860
1859
  return useAtomCallback(
1861
1860
  React.useCallback(
1862
1861
  (get, _set, idOrAtom) => {
1863
- const blockAsAtoms = get(splitAtoms ?? pageBlocksAtomsAtom);
1862
+ const blockAsAtoms = get(splitAtoms);
1864
1863
  const blockAtom = lodashEs.find(
1865
1864
  blockAsAtoms,
1866
1865
  (b) => get(b)._id === (lodashEs.isString(idOrAtom) ? idOrAtom : get(idOrAtom)._id)
1867
1866
  );
1868
1867
  if (!blockAtom) {
1869
- console.warn(`Block with id ${idOrAtom} not found`);
1870
- return;
1868
+ throw new Error(`Block with id ${idOrAtom} not found`);
1871
1869
  }
1872
1870
  return blockAtom;
1873
1871
  },
@@ -4715,7 +4713,7 @@ const useHandleCanvasDblClick = () => {
4715
4713
  const updateContent = useUpdateBlocksProps();
4716
4714
  const [editingBlockId, setEditingBlockId] = jotai.useAtom(inlineEditingActiveAtom);
4717
4715
  const { clearHighlight } = useBlockHighlight();
4718
- const getBlockAtomValue = useGetBlockAtomValue();
4716
+ const getBlockAtomValue = useGetBlockAtomValue(pageBlocksAtomsAtom);
4719
4717
  return React.useCallback(
4720
4718
  (e2) => {
4721
4719
  var _a;
@@ -5117,7 +5115,7 @@ const BlocksRenderer = ({
5117
5115
  };
5118
5116
  const PageBlocksRenderer = () => {
5119
5117
  const [blocks] = useBlocksStore();
5120
- return /* @__PURE__ */ jsxRuntime.jsx(BlocksRenderer, { blocks });
5118
+ return /* @__PURE__ */ jsxRuntime.jsx(BlocksRenderer, { splitAtoms: pageBlocksAtomsAtom, blocks });
5121
5119
  };
5122
5120
  const StaticBlocksRenderer = () => {
5123
5121
  const [blocks] = useBlocksStore();
@@ -9102,7 +9100,8 @@ const ChaiBuilderBlocks = ({ groups, blocks, parentId, position, gridCols = "gri
9102
9100
  position,
9103
9101
  block,
9104
9102
  disabled: !canAcceptChildBlock(parentType, block.type) || !canBeNestedInside(parentType, block.type)
9105
- }
9103
+ },
9104
+ block.type
9106
9105
  ))
9107
9106
  ) })
9108
9107
  ] }, group)) }) })
package/dist/core.js CHANGED
@@ -1826,14 +1826,13 @@ const useGetBlockAtomValue = (splitAtoms) => {
1826
1826
  return useAtomCallback(
1827
1827
  useCallback(
1828
1828
  (get2, _set, idOrAtom) => {
1829
- const blockAsAtoms = get2(pageBlocksAtomsAtom);
1829
+ const blockAsAtoms = get2(splitAtoms);
1830
1830
  const blockAtom = find(
1831
1831
  blockAsAtoms,
1832
1832
  (b) => get2(b)._id === (isString(idOrAtom) ? idOrAtom : get2(idOrAtom)._id)
1833
1833
  );
1834
1834
  if (!blockAtom) {
1835
- console.warn(`Block with id ${idOrAtom} not found`);
1836
- return;
1835
+ throw new Error(`Block with id ${idOrAtom} not found`);
1837
1836
  }
1838
1837
  return get2(blockAtom);
1839
1838
  },
@@ -1845,14 +1844,13 @@ const useGetBlockAtom = (splitAtoms) => {
1845
1844
  return useAtomCallback(
1846
1845
  useCallback(
1847
1846
  (get2, _set, idOrAtom) => {
1848
- const blockAsAtoms = get2(splitAtoms ?? pageBlocksAtomsAtom);
1847
+ const blockAsAtoms = get2(splitAtoms);
1849
1848
  const blockAtom = find(
1850
1849
  blockAsAtoms,
1851
1850
  (b) => get2(b)._id === (isString(idOrAtom) ? idOrAtom : get2(idOrAtom)._id)
1852
1851
  );
1853
1852
  if (!blockAtom) {
1854
- console.warn(`Block with id ${idOrAtom} not found`);
1855
- return;
1853
+ throw new Error(`Block with id ${idOrAtom} not found`);
1856
1854
  }
1857
1855
  return blockAtom;
1858
1856
  },
@@ -4700,7 +4698,7 @@ const useHandleCanvasDblClick = () => {
4700
4698
  const updateContent = useUpdateBlocksProps();
4701
4699
  const [editingBlockId, setEditingBlockId] = useAtom$1(inlineEditingActiveAtom);
4702
4700
  const { clearHighlight } = useBlockHighlight();
4703
- const getBlockAtomValue = useGetBlockAtomValue();
4701
+ const getBlockAtomValue = useGetBlockAtomValue(pageBlocksAtomsAtom);
4704
4702
  return useCallback(
4705
4703
  (e2) => {
4706
4704
  var _a;
@@ -5102,7 +5100,7 @@ const BlocksRenderer = ({
5102
5100
  };
5103
5101
  const PageBlocksRenderer = () => {
5104
5102
  const [blocks] = useBlocksStore();
5105
- return /* @__PURE__ */ jsx(BlocksRenderer, { blocks });
5103
+ return /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: pageBlocksAtomsAtom, blocks });
5106
5104
  };
5107
5105
  const StaticBlocksRenderer = () => {
5108
5106
  const [blocks] = useBlocksStore();
@@ -9087,7 +9085,8 @@ const ChaiBuilderBlocks = ({ groups, blocks, parentId, position, gridCols = "gri
9087
9085
  position,
9088
9086
  block,
9089
9087
  disabled: !canAcceptChildBlock(parentType, block.type) || !canBeNestedInside(parentType, block.type)
9090
- }
9088
+ },
9089
+ block.type
9091
9090
  ))
9092
9091
  ) })
9093
9092
  ] }, group)) }) })
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.93",
8
+ "version": "2.0.0-beta.94",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",