@tightknitai/block-kitchen 0.9.5 → 0.9.7

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.
@@ -1,5 +1,5 @@
1
- import { T as SupportedBlock } from './palette-inX8F01o.cjs';
2
- export { U as SupportedBlockType } from './palette-inX8F01o.cjs';
1
+ import { T as SupportedBlock } from './palette-CKP8CK5Z.cjs';
2
+ export { U as SupportedBlockType } from './palette-CKP8CK5Z.cjs';
3
3
  import 'react';
4
4
  import 'slack-web-api-client';
5
5
 
package/dist/helpers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as SupportedBlock } from './palette-inX8F01o.js';
2
- export { U as SupportedBlockType } from './palette-inX8F01o.js';
1
+ import { T as SupportedBlock } from './palette-CKP8CK5Z.js';
2
+ export { U as SupportedBlockType } from './palette-CKP8CK5Z.js';
3
3
  import 'react';
4
4
  import 'slack-web-api-client';
5
5
 
package/dist/index.cjs CHANGED
@@ -9801,7 +9801,15 @@ function BlockKitchen(props) {
9801
9801
  }, [palette, disabledBlockTypes]);
9802
9802
  const variantById = React.useMemo(() => buildVariantById(paletteSections), [paletteSections]);
9803
9803
  const allowedSurfaces = allowedSurfacesProp && allowedSurfacesProp.length > 0 ? allowedSurfacesProp : ["message"];
9804
- const { blocks, addBlock, addChild, updateBlock, removeBlock, duplicateBlock, reorderBlock, moveBlock, replaceAll } = useBlockKitchenState({ initialBlocks, onChange });
9804
+ const seededBlocks = editing?.initialTarget?.blocks ?? initialBlocks;
9805
+ React.useEffect(() => {
9806
+ if (editing?.initialTarget && initialBlocks) {
9807
+ console.warn(
9808
+ "[BlockKitchen] Both `initialBlocks` and `editing.initialTarget` were provided; using the target\u2019s blocks and ignoring `initialBlocks`."
9809
+ );
9810
+ }
9811
+ }, []);
9812
+ const { blocks, addBlock, addChild, updateBlock, removeBlock, duplicateBlock, reorderBlock, moveBlock, replaceAll } = useBlockKitchenState({ initialBlocks: seededBlocks, onChange });
9805
9813
  const childParentById = React.useMemo(() => {
9806
9814
  const map = /* @__PURE__ */ new Map();
9807
9815
  for (const top of blocks) {
@@ -9817,7 +9825,7 @@ function BlockKitchen(props) {
9817
9825
  const [sendOpen, setSendOpen] = React.useState(false);
9818
9826
  const [updateOpen, setUpdateOpen] = React.useState(false);
9819
9827
  const [loadOpen, setLoadOpen] = React.useState(false);
9820
- const [editTarget, setEditTarget] = React.useState(null);
9828
+ const [editTarget, setEditTarget] = React.useState(() => editing?.initialTarget ?? null);
9821
9829
  const activeEditTarget = editing ? editTarget : null;
9822
9830
  const [issuesOpen, setIssuesOpen] = React.useState(false);
9823
9831
  const [paletteOpen, setPaletteOpen] = React.useState(false);