@chaibuilder/sdk 2.2.27 → 2.2.28
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 +1 -1
- package/dist/core.d.ts +10 -5
- package/dist/core.js +128 -129
- package/package.json +1 -2
package/dist/core.d.ts
CHANGED
|
@@ -308,13 +308,16 @@ export declare type ChaiLibraryBlock<T = Record<string, any>> = {
|
|
|
308
308
|
description?: string;
|
|
309
309
|
} & T;
|
|
310
310
|
|
|
311
|
-
declare
|
|
311
|
+
declare type ChaiLibraryConfig<T> = {
|
|
312
312
|
id: string;
|
|
313
313
|
name: string;
|
|
314
314
|
description: string;
|
|
315
|
-
getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock[]>;
|
|
316
|
-
getBlock: (library
|
|
317
|
-
|
|
315
|
+
getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock<T>[]>;
|
|
316
|
+
getBlock: ({ library, block, }: {
|
|
317
|
+
library: ChaiLibrary;
|
|
318
|
+
block: ChaiLibraryBlock<T>;
|
|
319
|
+
}) => Promise<HTMLString | ChaiBlock_2[]>;
|
|
320
|
+
};
|
|
318
321
|
|
|
319
322
|
export declare const ChaiOutline: () => JSX_2.Element;
|
|
320
323
|
|
|
@@ -426,6 +429,8 @@ declare type HexColor = string;
|
|
|
426
429
|
|
|
427
430
|
declare type HSLColor = string;
|
|
428
431
|
|
|
432
|
+
declare type HTMLString = string;
|
|
433
|
+
|
|
429
434
|
export { i18n }
|
|
430
435
|
|
|
431
436
|
declare type MediaManagerProps = {
|
|
@@ -479,7 +484,7 @@ export declare const registerBlockSettingWidget: (id: string, component: React.C
|
|
|
479
484
|
|
|
480
485
|
export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
|
|
481
486
|
|
|
482
|
-
export declare const registerChaiLibrary: (id: string, library: Omit<ChaiLibraryConfig
|
|
487
|
+
export declare const registerChaiLibrary: <T extends Record<string, any> = Record<string, any>>(id: string, library: Omit<ChaiLibraryConfig<T>, "id">) => void;
|
|
483
488
|
|
|
484
489
|
export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
|
|
485
490
|
|
package/dist/core.js
CHANGED
|
@@ -5229,8 +5229,8 @@ const BlockStylingProps = () => {
|
|
|
5229
5229
|
}
|
|
5230
5230
|
if (get(k, "value") === "")
|
|
5231
5231
|
return;
|
|
5232
|
-
const
|
|
5233
|
-
C ? S(
|
|
5232
|
+
const L = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5233
|
+
C ? S(L) : _(L);
|
|
5234
5234
|
},
|
|
5235
5235
|
[_, S, a, h, d, u]
|
|
5236
5236
|
), N = useCallback(
|
|
@@ -5246,8 +5246,8 @@ const BlockStylingProps = () => {
|
|
|
5246
5246
|
}
|
|
5247
5247
|
if (get(k, "value") === "")
|
|
5248
5248
|
return;
|
|
5249
|
-
const j = get(k, "unit") !== "" ? get(k, "unit") : C,
|
|
5250
|
-
_(
|
|
5249
|
+
const j = get(k, "unit") !== "" ? get(k, "unit") : C, L = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5250
|
+
_(L);
|
|
5251
5251
|
},
|
|
5252
5252
|
[_, a, d, u]
|
|
5253
5253
|
);
|
|
@@ -5280,8 +5280,8 @@ const BlockStylingProps = () => {
|
|
|
5280
5280
|
const k = parseInt$1(C.target.value);
|
|
5281
5281
|
let j = isNaN$1(k) ? 0 : k;
|
|
5282
5282
|
C.keyCode === 38 && (j += 1), C.keyCode === 40 && (j -= 1);
|
|
5283
|
-
const T = `${j}`,
|
|
5284
|
-
S(
|
|
5283
|
+
const T = `${j}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5284
|
+
S(R);
|
|
5285
5285
|
},
|
|
5286
5286
|
onKeyUp: (C) => {
|
|
5287
5287
|
w && (C.preventDefault(), E(!1));
|
|
@@ -6252,24 +6252,24 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6252
6252
|
};
|
|
6253
6253
|
function ManualClasses() {
|
|
6254
6254
|
var T;
|
|
6255
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((
|
|
6256
|
-
const
|
|
6257
|
-
u(h,
|
|
6258
|
-
}, [w, E] = useState([]), _ = ({ value:
|
|
6259
|
-
const
|
|
6255
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
|
|
6256
|
+
const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6257
|
+
u(h, L, !0), x("");
|
|
6258
|
+
}, [w, E] = useState([]), _ = ({ value: L }) => {
|
|
6259
|
+
const R = L.trim().toLowerCase(), I = R.match(/.+:/g);
|
|
6260
6260
|
let D = [];
|
|
6261
|
-
if (
|
|
6262
|
-
const [O] =
|
|
6263
|
-
D = i.search(
|
|
6261
|
+
if (I && I.length > 0) {
|
|
6262
|
+
const [O] = I, P = R.replace(O, "");
|
|
6263
|
+
D = i.search(P).map((M) => ({
|
|
6264
6264
|
...M,
|
|
6265
6265
|
item: { ...M.item, name: O + M.item.name }
|
|
6266
6266
|
}));
|
|
6267
6267
|
} else
|
|
6268
|
-
D = i.search(
|
|
6268
|
+
D = i.search(R);
|
|
6269
6269
|
return E(map(D, "item"));
|
|
6270
6270
|
}, S = () => {
|
|
6271
6271
|
E([]);
|
|
6272
|
-
}, A = (
|
|
6272
|
+
}, A = (L) => L.name, N = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), C = useMemo(
|
|
6273
6273
|
() => ({
|
|
6274
6274
|
ref: o,
|
|
6275
6275
|
autoComplete: "off",
|
|
@@ -6278,22 +6278,22 @@ function ManualClasses() {
|
|
|
6278
6278
|
spellCheck: !1,
|
|
6279
6279
|
placeholder: c("Enter classes separated by space"),
|
|
6280
6280
|
value: f,
|
|
6281
|
-
onFocus: (
|
|
6281
|
+
onFocus: (L) => {
|
|
6282
6282
|
setTimeout(() => {
|
|
6283
|
-
|
|
6283
|
+
L.target && L.target.select();
|
|
6284
6284
|
}, 0);
|
|
6285
6285
|
},
|
|
6286
|
-
onKeyDown: (
|
|
6287
|
-
|
|
6286
|
+
onKeyDown: (L) => {
|
|
6287
|
+
L.key === "Enter" && f.trim() !== "" && B();
|
|
6288
6288
|
},
|
|
6289
|
-
onChange: (
|
|
6289
|
+
onChange: (L, { newValue: R }) => x(R),
|
|
6290
6290
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6291
6291
|
}),
|
|
6292
6292
|
[f, c, o]
|
|
6293
|
-
), k = (
|
|
6293
|
+
), k = (L) => {
|
|
6294
6294
|
debugger;
|
|
6295
|
-
const
|
|
6296
|
-
g(h, [
|
|
6295
|
+
const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6296
|
+
g(h, [L]), u(h, R, !0), r(""), l(-1);
|
|
6297
6297
|
}, j = () => {
|
|
6298
6298
|
if (navigator.clipboard === void 0) {
|
|
6299
6299
|
toast.error(c("Clipboard not supported"));
|
|
@@ -6351,47 +6351,47 @@ function ManualClasses() {
|
|
|
6351
6351
|
)
|
|
6352
6352
|
] }),
|
|
6353
6353
|
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: v.map(
|
|
6354
|
-
(
|
|
6354
|
+
(L, R) => a === R ? /* @__PURE__ */ jsx(
|
|
6355
6355
|
"input",
|
|
6356
6356
|
{
|
|
6357
6357
|
ref: o,
|
|
6358
6358
|
value: n,
|
|
6359
|
-
onChange: (
|
|
6359
|
+
onChange: (I) => r(I.target.value),
|
|
6360
6360
|
onBlur: () => {
|
|
6361
|
-
k(
|
|
6361
|
+
k(L);
|
|
6362
6362
|
},
|
|
6363
|
-
onKeyDown: (
|
|
6364
|
-
|
|
6363
|
+
onKeyDown: (I) => {
|
|
6364
|
+
I.key === "Enter" && k(L);
|
|
6365
6365
|
},
|
|
6366
|
-
onFocus: (
|
|
6366
|
+
onFocus: (I) => {
|
|
6367
6367
|
setTimeout(() => {
|
|
6368
|
-
|
|
6368
|
+
I.target.select();
|
|
6369
6369
|
}, 0);
|
|
6370
6370
|
},
|
|
6371
6371
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
|
|
6372
6372
|
},
|
|
6373
|
-
|
|
6373
|
+
L
|
|
6374
6374
|
) : /* @__PURE__ */ jsxs(
|
|
6375
6375
|
"button",
|
|
6376
6376
|
{
|
|
6377
6377
|
onDoubleClick: () => {
|
|
6378
|
-
x(
|
|
6378
|
+
x(L), g(h, [L]), setTimeout(() => {
|
|
6379
6379
|
o.current && o.current.focus();
|
|
6380
6380
|
}, 10);
|
|
6381
6381
|
},
|
|
6382
6382
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
6383
6383
|
children: [
|
|
6384
|
-
|
|
6385
|
-
n !==
|
|
6384
|
+
L,
|
|
6385
|
+
n !== L && /* @__PURE__ */ jsx(
|
|
6386
6386
|
Cross2Icon,
|
|
6387
6387
|
{
|
|
6388
|
-
onClick: () => g(h, [
|
|
6388
|
+
onClick: () => g(h, [L], !0),
|
|
6389
6389
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
6390
6390
|
}
|
|
6391
6391
|
)
|
|
6392
6392
|
]
|
|
6393
6393
|
},
|
|
6394
|
-
|
|
6394
|
+
L
|
|
6395
6395
|
)
|
|
6396
6396
|
) })
|
|
6397
6397
|
] });
|
|
@@ -6770,7 +6770,6 @@ const CoreBlock = ({
|
|
|
6770
6770
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
6771
6771
|
var h, m, f, x, y, b, v, B;
|
|
6772
6772
|
if (r.type === "comment") return [];
|
|
6773
|
-
console.log("node ===>", r);
|
|
6774
6773
|
let a = { _id: generateUUID() };
|
|
6775
6774
|
if (n && (a._parent = n.block._id), r.type === "text")
|
|
6776
6775
|
return isEmpty(get(r, "content", "")) ? [] : n && shouldAddText(n.node, n.block) ? (set(n, "block.content", get(r, "content", "")), []) : { ...a, _type: "Text", content: get(r, "content", "") };
|
|
@@ -6944,10 +6943,10 @@ function UILibrariesSelect({
|
|
|
6944
6943
|
)
|
|
6945
6944
|
] }) : null;
|
|
6946
6945
|
}
|
|
6947
|
-
let
|
|
6946
|
+
let LIBRARIES_REGISTRY = {};
|
|
6948
6947
|
const registerChaiLibrary = (o, n) => {
|
|
6949
|
-
|
|
6950
|
-
}, useChaiLibraries = () => values(
|
|
6948
|
+
LIBRARIES_REGISTRY[o] = { ...n, id: o };
|
|
6949
|
+
}, useChaiLibraries = () => values(LIBRARIES_REGISTRY), BlockCard = ({
|
|
6951
6950
|
block: o,
|
|
6952
6951
|
library: n,
|
|
6953
6952
|
parentId: r = void 0,
|
|
@@ -6963,7 +6962,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6963
6962
|
return;
|
|
6964
6963
|
}
|
|
6965
6964
|
i(!0);
|
|
6966
|
-
let w = await c(n, o);
|
|
6965
|
+
let w = await c({ library: n, block: o });
|
|
6967
6966
|
typeof w == "string" && (w = getBlocksFromHTML(w)), isEmpty(w) || p(syncBlocksWithDefaults(w), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6968
6967
|
},
|
|
6969
6968
|
[d, p, o, c, n, r, a]
|
|
@@ -6976,7 +6975,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6976
6975
|
} : b,
|
|
6977
6976
|
draggable: f ? "true" : "false",
|
|
6978
6977
|
onDragStart: async (B) => {
|
|
6979
|
-
const w = await c(n, o);
|
|
6978
|
+
const w = await c({ library: n, block: o });
|
|
6980
6979
|
let E = r;
|
|
6981
6980
|
if (y(first(w)) && (E = null), !isEmpty(w)) {
|
|
6982
6981
|
const _ = { blocks: w, uiLibrary: !0, parent: E };
|
|
@@ -7673,38 +7672,38 @@ const Input = ({ node: o }) => {
|
|
|
7673
7672
|
}
|
|
7674
7673
|
);
|
|
7675
7674
|
}, currentAddSelection = atom(null), Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7676
|
-
var
|
|
7675
|
+
var R;
|
|
7677
7676
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7678
7677
|
let p = null;
|
|
7679
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (
|
|
7680
|
-
|
|
7681
|
-
}, E = (
|
|
7682
|
-
|
|
7683
|
-
}, _ = (
|
|
7684
|
-
|
|
7678
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (I) => {
|
|
7679
|
+
I.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7680
|
+
}, E = (I) => {
|
|
7681
|
+
I.isInternal && (p = I.isOpen, I.isOpen && I.close());
|
|
7682
|
+
}, _ = (I) => {
|
|
7683
|
+
I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
|
|
7685
7684
|
}, [S, A] = useAtom$1(currentAddSelection), N = () => {
|
|
7686
|
-
var
|
|
7687
|
-
C(), o.parent.isSelected || A((
|
|
7685
|
+
var I;
|
|
7686
|
+
C(), o.parent.isSelected || A((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id);
|
|
7688
7687
|
}, C = () => {
|
|
7689
7688
|
A(null);
|
|
7690
|
-
}, k = (
|
|
7691
|
-
C(),
|
|
7689
|
+
}, k = (I) => {
|
|
7690
|
+
C(), I.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(I);
|
|
7692
7691
|
};
|
|
7693
7692
|
useEffect(() => {
|
|
7694
|
-
const
|
|
7693
|
+
const I = setTimeout(() => {
|
|
7695
7694
|
y && !o.isOpen && !b && !l.includes(m) && o.toggle();
|
|
7696
7695
|
}, 500);
|
|
7697
|
-
return () => clearTimeout(
|
|
7696
|
+
return () => clearTimeout(I);
|
|
7698
7697
|
}, [y, o, b]);
|
|
7699
|
-
const j = (
|
|
7700
|
-
const O = c.contentDocument || c.contentWindow.document,
|
|
7701
|
-
|
|
7702
|
-
const $ =
|
|
7703
|
-
$.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop =
|
|
7704
|
-
}, T = (
|
|
7698
|
+
const j = (I, D) => {
|
|
7699
|
+
const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${I}]`);
|
|
7700
|
+
P && P.setAttribute("data-drop", D);
|
|
7701
|
+
const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
|
|
7702
|
+
$.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
|
|
7703
|
+
}, T = (I) => {
|
|
7705
7704
|
C();
|
|
7706
7705
|
const D = get(o, "parent.id");
|
|
7707
|
-
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position:
|
|
7706
|
+
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: I }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: I });
|
|
7708
7707
|
};
|
|
7709
7708
|
if (m === ROOT_TEMP_KEY)
|
|
7710
7709
|
return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
@@ -7724,7 +7723,7 @@ const Input = ({ node: o }) => {
|
|
|
7724
7723
|
),
|
|
7725
7724
|
/* @__PURE__ */ jsx("br", {})
|
|
7726
7725
|
] });
|
|
7727
|
-
const
|
|
7726
|
+
const L = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
|
|
7728
7727
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
7729
7728
|
"div",
|
|
7730
7729
|
{
|
|
@@ -7736,21 +7735,21 @@ const Input = ({ node: o }) => {
|
|
|
7736
7735
|
ref: l.includes(m) ? null : r,
|
|
7737
7736
|
onDragStart: () => E(o),
|
|
7738
7737
|
onDragEnd: () => _(o),
|
|
7739
|
-
onDragOver: (
|
|
7740
|
-
|
|
7738
|
+
onDragOver: (I) => {
|
|
7739
|
+
I.preventDefault(), j(m, "yes");
|
|
7741
7740
|
},
|
|
7742
|
-
onDragLeave: (
|
|
7743
|
-
|
|
7741
|
+
onDragLeave: (I) => {
|
|
7742
|
+
I.preventDefault(), j(m, "no");
|
|
7744
7743
|
},
|
|
7745
|
-
onDrop: (
|
|
7746
|
-
|
|
7744
|
+
onDrop: (I) => {
|
|
7745
|
+
I.preventDefault(), j(m, "no");
|
|
7747
7746
|
},
|
|
7748
7747
|
children: [
|
|
7749
|
-
d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((
|
|
7748
|
+
d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
7750
7749
|
"div",
|
|
7751
7750
|
{
|
|
7752
|
-
onClick: (
|
|
7753
|
-
|
|
7751
|
+
onClick: (I) => {
|
|
7752
|
+
I.stopPropagation(), T(o.childIndex);
|
|
7754
7753
|
},
|
|
7755
7754
|
onMouseEnter: N,
|
|
7756
7755
|
onMouseLeave: C,
|
|
@@ -7768,7 +7767,7 @@ const Input = ({ node: o }) => {
|
|
|
7768
7767
|
(o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
|
|
7769
7768
|
b && "opacity-20",
|
|
7770
7769
|
l.includes(m) ? "opacity-50" : "",
|
|
7771
|
-
|
|
7770
|
+
L && x && "bg-primary/20 text-primary"
|
|
7772
7771
|
),
|
|
7773
7772
|
children: [
|
|
7774
7773
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -7784,8 +7783,8 @@ const Input = ({ node: o }) => {
|
|
|
7784
7783
|
{
|
|
7785
7784
|
className: cn(
|
|
7786
7785
|
"leading-1 flex items-center",
|
|
7787
|
-
|
|
7788
|
-
|
|
7786
|
+
L && "text-primary/60",
|
|
7787
|
+
L && x && "text-primary/80"
|
|
7789
7788
|
),
|
|
7790
7789
|
children: [
|
|
7791
7790
|
/* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
|
|
@@ -7793,8 +7792,8 @@ const Input = ({ node: o }) => {
|
|
|
7793
7792
|
"div",
|
|
7794
7793
|
{
|
|
7795
7794
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
7796
|
-
onDoubleClick: (
|
|
7797
|
-
|
|
7795
|
+
onDoubleClick: (I) => {
|
|
7796
|
+
I.stopPropagation(), o.edit(), o.deselect();
|
|
7798
7797
|
},
|
|
7799
7798
|
children: /* @__PURE__ */ jsx("span", { children: (f == null ? void 0 : f._name) || (f == null ? void 0 : f._type.split("/").pop()) })
|
|
7800
7799
|
}
|
|
@@ -7820,8 +7819,8 @@ const Input = ({ node: o }) => {
|
|
|
7820
7819
|
/* @__PURE__ */ jsx(
|
|
7821
7820
|
TooltipTrigger,
|
|
7822
7821
|
{
|
|
7823
|
-
onClick: (
|
|
7824
|
-
|
|
7822
|
+
onClick: (I) => {
|
|
7823
|
+
I.stopPropagation(), i(m), o.isOpen && o.toggle();
|
|
7825
7824
|
},
|
|
7826
7825
|
className: "cursor-pointer rounded bg-transparent",
|
|
7827
7826
|
asChild: !0,
|
|
@@ -9144,22 +9143,22 @@ const AiAssistant = () => {
|
|
|
9144
9143
|
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
|
|
9145
9144
|
}, _ = useCallback((S) => {
|
|
9146
9145
|
const A = (k) => /[.,!?;:]/.test(k), N = (k, j, T) => {
|
|
9147
|
-
let
|
|
9148
|
-
const
|
|
9149
|
-
return j > 0 && (
|
|
9150
|
-
text:
|
|
9151
|
-
prefixLength:
|
|
9152
|
-
suffixLength:
|
|
9146
|
+
let L = "", R = "";
|
|
9147
|
+
const I = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
|
|
9148
|
+
return j > 0 && (I === "." || !A(I) && I !== " ") && (L = " "), j < k.length && !A(D) && D !== " " && (R = " "), {
|
|
9149
|
+
text: L + T + R,
|
|
9150
|
+
prefixLength: L.length,
|
|
9151
|
+
suffixLength: R.length
|
|
9153
9152
|
};
|
|
9154
9153
|
}, C = x.current;
|
|
9155
9154
|
if (C) {
|
|
9156
9155
|
const k = C.selectionStart || 0, j = C.value || "", T = C.selectionEnd || k;
|
|
9157
9156
|
if (T > k) {
|
|
9158
|
-
const O = `{{${S}}}`, { text:
|
|
9157
|
+
const O = `{{${S}}}`, { text: P } = N(j, k, O), $ = j.slice(0, k) + P + j.slice(T);
|
|
9159
9158
|
p($);
|
|
9160
9159
|
return;
|
|
9161
9160
|
}
|
|
9162
|
-
const
|
|
9161
|
+
const R = `{{${S}}}`, { text: I } = N(j, k, R), D = j.slice(0, k) + I + j.slice(k);
|
|
9163
9162
|
p(D);
|
|
9164
9163
|
}
|
|
9165
9164
|
}, []);
|
|
@@ -9636,8 +9635,8 @@ const FEATURE_TOGGLES = {
|
|
|
9636
9635
|
c.f && C(c.f);
|
|
9637
9636
|
const k = /* @__PURE__ */ new Set(), j = k.add.bind(k);
|
|
9638
9637
|
a.forEach((T) => {
|
|
9639
|
-
var
|
|
9640
|
-
return (
|
|
9638
|
+
var L;
|
|
9639
|
+
return (L = n.get(T)) == null ? void 0 : L.l.forEach(j);
|
|
9641
9640
|
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
|
|
9642
9641
|
} while (a.size || i.size || l.size);
|
|
9643
9642
|
if (A)
|
|
@@ -9655,27 +9654,27 @@ const FEATURE_TOGGLES = {
|
|
|
9655
9654
|
continue;
|
|
9656
9655
|
}
|
|
9657
9656
|
N.add(j);
|
|
9658
|
-
for (const
|
|
9659
|
-
N.has(
|
|
9657
|
+
for (const L of getMountedOrPendingDependents(j, T, n))
|
|
9658
|
+
N.has(L) || k.push(L);
|
|
9660
9659
|
}
|
|
9661
9660
|
for (let j = A.length - 1; j >= 0; --j) {
|
|
9662
|
-
const [T,
|
|
9663
|
-
let
|
|
9664
|
-
for (const
|
|
9665
|
-
if (
|
|
9666
|
-
|
|
9661
|
+
const [T, L] = A[j];
|
|
9662
|
+
let R = !1;
|
|
9663
|
+
for (const I of L.d.keys())
|
|
9664
|
+
if (I !== T && a.has(I)) {
|
|
9665
|
+
R = !0;
|
|
9667
9666
|
break;
|
|
9668
9667
|
}
|
|
9669
|
-
|
|
9668
|
+
R && (y(T), B(T)), r.delete(T);
|
|
9670
9669
|
}
|
|
9671
9670
|
}), y = h[3] || ((A) => {
|
|
9672
9671
|
var N, C;
|
|
9673
9672
|
const k = m(A);
|
|
9674
9673
|
if (isAtomStateInitialized(k) && (n.has(A) && r.get(A) !== k.n || Array.from(k.d).every(
|
|
9675
|
-
([
|
|
9674
|
+
([P, $]) => (
|
|
9676
9675
|
// Recursively, read the atom state of the dependency, and
|
|
9677
9676
|
// check if the atom epoch number is unchanged
|
|
9678
|
-
y(
|
|
9677
|
+
y(P).n === $
|
|
9679
9678
|
)
|
|
9680
9679
|
)))
|
|
9681
9680
|
return k;
|
|
@@ -9683,48 +9682,48 @@ const FEATURE_TOGGLES = {
|
|
|
9683
9682
|
let j = !0;
|
|
9684
9683
|
const T = () => {
|
|
9685
9684
|
n.has(A) && (B(A), x(), f());
|
|
9686
|
-
},
|
|
9685
|
+
}, L = (P) => {
|
|
9687
9686
|
var $;
|
|
9688
|
-
if (isSelfAtom(A,
|
|
9689
|
-
const U = m(
|
|
9687
|
+
if (isSelfAtom(A, P)) {
|
|
9688
|
+
const U = m(P);
|
|
9690
9689
|
if (!isAtomStateInitialized(U))
|
|
9691
|
-
if (hasInitialValue(
|
|
9692
|
-
setAtomStateValueOrPromise(
|
|
9690
|
+
if (hasInitialValue(P))
|
|
9691
|
+
setAtomStateValueOrPromise(P, P.init, m);
|
|
9693
9692
|
else
|
|
9694
9693
|
throw new Error("no atom init");
|
|
9695
9694
|
return returnAtomValue(U);
|
|
9696
9695
|
}
|
|
9697
|
-
const M = y(
|
|
9696
|
+
const M = y(P);
|
|
9698
9697
|
try {
|
|
9699
9698
|
return returnAtomValue(M);
|
|
9700
9699
|
} finally {
|
|
9701
|
-
k.d.set(
|
|
9700
|
+
k.d.set(P, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(A, k.v, M), ($ = n.get(P)) == null || $.t.add(A), j || T();
|
|
9702
9701
|
}
|
|
9703
9702
|
};
|
|
9704
|
-
let
|
|
9703
|
+
let R, I;
|
|
9705
9704
|
const D = {
|
|
9706
9705
|
get signal() {
|
|
9707
|
-
return
|
|
9706
|
+
return R || (R = new AbortController()), R.signal;
|
|
9708
9707
|
},
|
|
9709
9708
|
get setSelf() {
|
|
9710
|
-
return !
|
|
9709
|
+
return !I && isActuallyWritableAtom(A) && (I = (...P) => {
|
|
9711
9710
|
if (!j)
|
|
9712
9711
|
try {
|
|
9713
|
-
return v(A, ...
|
|
9712
|
+
return v(A, ...P);
|
|
9714
9713
|
} finally {
|
|
9715
9714
|
x(), f();
|
|
9716
9715
|
}
|
|
9717
|
-
}),
|
|
9716
|
+
}), I;
|
|
9718
9717
|
}
|
|
9719
9718
|
}, O = k.n;
|
|
9720
9719
|
try {
|
|
9721
|
-
const
|
|
9722
|
-
return setAtomStateValueOrPromise(A,
|
|
9720
|
+
const P = d(A, L, D);
|
|
9721
|
+
return setAtomStateValueOrPromise(A, P, m), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
|
|
9723
9722
|
T,
|
|
9724
9723
|
T
|
|
9725
9724
|
)), k;
|
|
9726
|
-
} catch (
|
|
9727
|
-
return delete k.v, k.e =
|
|
9725
|
+
} catch (P) {
|
|
9726
|
+
return delete k.v, k.e = P, ++k.n, k;
|
|
9728
9727
|
} finally {
|
|
9729
9728
|
j = !1, O !== k.n && r.get(A) === O && (r.set(A, k.n), a.add(A), (C = c.c) == null || C.call(c, A));
|
|
9730
9729
|
}
|
|
@@ -9739,18 +9738,18 @@ const FEATURE_TOGGLES = {
|
|
|
9739
9738
|
}
|
|
9740
9739
|
}), v = h[5] || ((A, ...N) => {
|
|
9741
9740
|
let C = !0;
|
|
9742
|
-
const k = (T) => returnAtomValue(y(T)), j = (T, ...
|
|
9743
|
-
var
|
|
9744
|
-
const
|
|
9741
|
+
const k = (T) => returnAtomValue(y(T)), j = (T, ...L) => {
|
|
9742
|
+
var R;
|
|
9743
|
+
const I = m(T);
|
|
9745
9744
|
try {
|
|
9746
9745
|
if (isSelfAtom(A, T)) {
|
|
9747
9746
|
if (!hasInitialValue(T))
|
|
9748
9747
|
throw new Error("atom not writable");
|
|
9749
|
-
const D =
|
|
9750
|
-
setAtomStateValueOrPromise(T, O, m), B(T), D !==
|
|
9748
|
+
const D = I.n, O = L[0];
|
|
9749
|
+
setAtomStateValueOrPromise(T, O, m), B(T), D !== I.n && (a.add(T), (R = c.c) == null || R.call(c, T), b(T));
|
|
9751
9750
|
return;
|
|
9752
9751
|
} else
|
|
9753
|
-
return v(T, ...
|
|
9752
|
+
return v(T, ...L);
|
|
9754
9753
|
} finally {
|
|
9755
9754
|
C || (x(), f());
|
|
9756
9755
|
}
|
|
@@ -9766,8 +9765,8 @@ const FEATURE_TOGGLES = {
|
|
|
9766
9765
|
if (k && !isPendingPromise(C.v)) {
|
|
9767
9766
|
for (const [j, T] of C.d)
|
|
9768
9767
|
if (!k.d.has(j)) {
|
|
9769
|
-
const
|
|
9770
|
-
w(j).t.add(A), k.d.add(j), T !==
|
|
9768
|
+
const L = m(j);
|
|
9769
|
+
w(j).t.add(A), k.d.add(j), T !== L.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
|
|
9771
9770
|
}
|
|
9772
9771
|
for (const j of k.d || [])
|
|
9773
9772
|
if (!C.d.has(j)) {
|
|
@@ -9791,19 +9790,19 @@ const FEATURE_TOGGLES = {
|
|
|
9791
9790
|
}, n.set(A, k), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
|
|
9792
9791
|
const j = () => {
|
|
9793
9792
|
let T = !0;
|
|
9794
|
-
const
|
|
9793
|
+
const L = (...R) => {
|
|
9795
9794
|
try {
|
|
9796
|
-
return v(A, ...
|
|
9795
|
+
return v(A, ...R);
|
|
9797
9796
|
} finally {
|
|
9798
9797
|
T || (x(), f());
|
|
9799
9798
|
}
|
|
9800
9799
|
};
|
|
9801
9800
|
try {
|
|
9802
|
-
const
|
|
9803
|
-
|
|
9801
|
+
const R = g(A, L);
|
|
9802
|
+
R && (k.u = () => {
|
|
9804
9803
|
T = !0;
|
|
9805
9804
|
try {
|
|
9806
|
-
|
|
9805
|
+
R();
|
|
9807
9806
|
} finally {
|
|
9808
9807
|
T = !1;
|
|
9809
9808
|
}
|
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.2.
|
|
8
|
+
"version": "2.2.28",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -160,7 +160,6 @@
|
|
|
160
160
|
"@typescript-eslint/parser": "^8.21.0",
|
|
161
161
|
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
162
162
|
"autoprefixer": "^10.4.20",
|
|
163
|
-
"axios": "^1.7.9",
|
|
164
163
|
"cheerio": "1.0.0-rc.12",
|
|
165
164
|
"dotenv": "^16.4.7",
|
|
166
165
|
"eslint": "^9.18.0",
|