@chaibuilder/pages 0.13.4 → 0.14.1

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.
Files changed (78) hide show
  1. package/dist/{2AITGKQY-Dx_Cte-P.js → 2AITGKQY-Cti4x7QE.js} +5 -5
  2. package/dist/{2AITGKQY-DpAgk_u8.cjs → 2AITGKQY-PHs1xUsz.cjs} +1 -1
  3. package/dist/{NCMVHL6D-B6lv7Umq.cjs → NCMVHL6D-BChQ0wDN.cjs} +1 -1
  4. package/dist/{NCMVHL6D-CT2qHOTS.js → NCMVHL6D-fAWarBw8.js} +4 -4
  5. package/dist/{ZDWCUMSJ-C1vrgsti.cjs → ZDWCUMSJ-CwWfQqyn.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-W9xywtZH.js → ZDWCUMSJ-DRWuu_nE.js} +1 -1
  7. package/dist/add-new-language-page-CcBqDtYv.js +390 -0
  8. package/dist/add-new-language-page-Dt9DWunK.cjs +1 -0
  9. package/dist/add-new-page-BN3z9rSq.cjs +1 -0
  10. package/dist/add-new-page-CTUiEKzv.js +30 -0
  11. package/dist/confetti.module-BuUnQuWk.cjs +2 -0
  12. package/dist/confetti.module-DCmCkDyV.js +409 -0
  13. package/dist/delete-page-8MnGZ_mz.js +38 -0
  14. package/dist/delete-page-jELwTpGY.cjs +1 -0
  15. package/dist/digital-asset-manager-BJhwyEdT.js +976 -0
  16. package/dist/digital-asset-manager-ZyQJP6AO.cjs +1 -0
  17. package/dist/duplicate-page-BGYZLkco.js +120 -0
  18. package/dist/duplicate-page-BRjKFpBP.cjs +1 -0
  19. package/dist/dynamic-page-selector-CR-ZpSJ8.cjs +1 -0
  20. package/dist/dynamic-page-selector-CrbujoYg.js +86 -0
  21. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  22. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  23. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  24. package/dist/image-compression-DsZ1oqpb.js +37 -0
  25. package/dist/index-Byi6-4u1.js +5164 -0
  26. package/dist/index-DSUpSpeI.cjs +5 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.ts +4 -22
  29. package/dist/index.js +18 -19
  30. package/dist/json-diff-viewer-DKlC7yl6.cjs +8 -0
  31. package/dist/json-diff-viewer-De2bStRw.js +258 -0
  32. package/dist/lang-panel-B3bC1gKq.cjs +1 -0
  33. package/dist/lang-panel-G7RoMOP7.js +218 -0
  34. package/dist/mark-as-template-B1TpGPms.js +146 -0
  35. package/dist/mark-as-template-OgR8I38n.cjs +1 -0
  36. package/dist/nested-path-selector-content-D_iF9Sm3.cjs +1 -0
  37. package/dist/nested-path-selector-content-DvIL_EoN.js +87 -0
  38. package/dist/no-language-page-content-CqH4FMNy.js +35 -0
  39. package/dist/no-language-page-content-iZo2ztXp.cjs +1 -0
  40. package/dist/page-creator-Chnj3W4j.js +796 -0
  41. package/dist/page-creator-DUXzx-zg.cjs +1 -0
  42. package/dist/page-lock-request-D3gmV8Yq.cjs +1 -0
  43. package/dist/page-lock-request-Dc-JkLEZ.js +64 -0
  44. package/dist/page-locked-by-dialog-B9pGi6zb.cjs +1 -0
  45. package/dist/page-locked-by-dialog-DC8UKy9e.js +63 -0
  46. package/dist/page-manager-new-CFtYUNbS.cjs +1 -0
  47. package/dist/page-manager-new-DYYWpxWy.js +354 -0
  48. package/dist/page-manager-search-and-filter-B4xo9IJO.js +197 -0
  49. package/dist/page-manager-search-and-filter-DT9V9AoS.cjs +1 -0
  50. package/dist/page-revisions-content-BjIECUPY.cjs +1 -0
  51. package/dist/page-revisions-content-KJGhm9Pl.js +446 -0
  52. package/dist/publish-pages-content-BWLQZGjd.js +178 -0
  53. package/dist/publish-pages-content-CTduLNtg.cjs +1 -0
  54. package/dist/save-to-lib-B07GbG4I.js +476 -0
  55. package/dist/save-to-lib-CsrSeusU.cjs +1 -0
  56. package/dist/seo-panel-B20DCgo0.js +667 -0
  57. package/dist/seo-panel-QphuqXT2.cjs +1 -0
  58. package/dist/shared-json-ld-C_vIO-Qk.cjs +1 -0
  59. package/dist/shared-json-ld-CkOQRUEw.js +337 -0
  60. package/dist/slug-input-71BuN79c.cjs +1 -0
  61. package/dist/slug-input-rAe3mMkd.js +87 -0
  62. package/dist/theme-panel-footer-DFUfCqKP.js +25 -0
  63. package/dist/theme-panel-footer-DHRs6ag2.cjs +1 -0
  64. package/dist/translation-warning-modal-DalBhNQy.js +26 -0
  65. package/dist/translation-warning-modal-Kctu12rQ.cjs +1 -0
  66. package/dist/unmark-as-template-Cx0CqrpM.cjs +1 -0
  67. package/dist/unmark-as-template-_VyWoVNk.js +38 -0
  68. package/dist/unpublish-page-CuSJRr5c.js +26 -0
  69. package/dist/unpublish-page-D3NM8b3u.cjs +1 -0
  70. package/dist/use-page-expand-manager-MjYZ3CDZ.cjs +1 -0
  71. package/dist/use-page-expand-manager-_msrWd0a.js +85 -0
  72. package/dist/web-preview-BL-vsgoa.js +73 -0
  73. package/dist/web-preview-CI3Vz7Yp.cjs +1 -0
  74. package/package.json +1 -1
  75. package/dist/index-C4j31Yhz.js +0 -11471
  76. package/dist/index-DnjETHks.cjs +0 -6
  77. package/dist/page-revisions-content-Gx-Qf_91.cjs +0 -8
  78. package/dist/page-revisions-content-_-Nd4U11.js +0 -712
@@ -0,0 +1 @@
1
+ "use strict";const m=require("jotai"),p=require("react"),n=require("lodash-es"),y=require("./index-DSUpSpeI.cjs"),A=y.atomWithStorage("expandedPagesState",[]),E=s=>n.flatMap(s,e=>[e,...e.children?E(e.children):[]]),S=(s,e)=>{const t=(a,i=[])=>{for(const r of a){const o=[...i,r.id];if(r.id===e)return o;if(r.children&&r.children.length>0){const d=t(r.children,o);if(d)return d}}return null};return t(s)||[]},P=(s,e)=>{if(!e)return[];const t=E(s),a=n.find(t,i=>i.id===e);if(a){if(a.parent)return[...P(s,a.parent),e];const i=S(s,e);if(!n.isEmpty(i))return i}return[e]},C=s=>{const e=new Set,t=(a,i=[])=>{a.forEach(r=>{const o=[...i,r.id];r.shouldExpandOnSearch&&o.forEach(d=>e.add(d)),r.children&&!n.isEmpty(r.children)&&t(r.children,o)})};return t(s),Array.from(e)},b=s=>{const[e,t]=m.useAtom(A),a=s?n.includes(e,s):!1,i=p.useCallback(()=>{t(c=>a?n.filter(c,l=>l!==s):[...c,s])},[t,a,s]),r=p.useCallback((c,l)=>{if(!l||n.isEmpty(c))return;const h=E(c),u=P(h,l);if(!Array.isArray(u)||n.isEmpty(u))return;const f=u.slice(0,-1);n.isEmpty(f)||t(g=>n.uniq([...g,...f]))},[t]),o=p.useCallback(c=>{if(n.isEmpty(c))return;const l=C(c);n.isEmpty(l)||t(h=>n.union(h,l))},[t]),d=p.useCallback(c=>{if(n.isEmpty(c))return;const l=n.flatMap(c,h=>{const u=f=>[f.id,...f.children?n.flatMap(f.children,u):[]];return u(h)});t(l)},[t]),x=p.useCallback(()=>{t([])},[t]);return{isExpanded:a,toggleExpanded:i,updateForSelectedPage:r,expandedPages:e,expandPagesOnSearch:o,setExpandedPages:t,expandAll:d,collapseAll:x}};exports.usePageExpandManager=b;
@@ -0,0 +1,85 @@
1
+ import { useAtom as A } from "jotai";
2
+ import { useCallback as p } from "react";
3
+ import { isEmpty as i, uniq as S, union as y, flatMap as P, find as O, includes as q, filter as C } from "lodash-es";
4
+ import { q as F } from "./index-Byi6-4u1.js";
5
+ const M = F("expandedPagesState", []), m = (e) => P(e, (n) => [
6
+ n,
7
+ ...n.children ? m(n.children) : []
8
+ ]), T = (e, n) => {
9
+ const t = (s, o = []) => {
10
+ for (const r of s) {
11
+ const d = [...o, r.id];
12
+ if (r.id === n)
13
+ return d;
14
+ if (r.children && r.children.length > 0) {
15
+ const l = t(r.children, d);
16
+ if (l) return l;
17
+ }
18
+ }
19
+ return null;
20
+ };
21
+ return t(e) || [];
22
+ }, x = (e, n) => {
23
+ if (!n) return [];
24
+ const t = m(e), s = O(t, (o) => o.id === n);
25
+ if (s) {
26
+ if (s.parent)
27
+ return [...x(e, s.parent), n];
28
+ const o = T(e, n);
29
+ if (!i(o))
30
+ return o;
31
+ }
32
+ return [n];
33
+ }, b = (e) => {
34
+ const n = /* @__PURE__ */ new Set(), t = (s, o = []) => {
35
+ s.forEach((r) => {
36
+ const d = [...o, r.id];
37
+ r.shouldExpandOnSearch && d.forEach((l) => n.add(l)), r.children && !i(r.children) && t(r.children, d);
38
+ });
39
+ };
40
+ return t(e), Array.from(n);
41
+ }, W = (e) => {
42
+ const [n, t] = A(M), s = e ? q(n, e) : !1, o = p(() => {
43
+ t(
44
+ (a) => s ? C(a, (c) => c !== e) : [...a, e]
45
+ );
46
+ }, [t, s, e]), r = p(
47
+ (a, c) => {
48
+ if (!c || i(a)) return;
49
+ const h = m(a), f = x(h, c);
50
+ if (!Array.isArray(f) || i(f)) return;
51
+ const u = f.slice(0, -1);
52
+ i(u) || t((E) => S([...E, ...u]));
53
+ },
54
+ [t]
55
+ ), d = p(
56
+ (a) => {
57
+ if (i(a)) return;
58
+ const c = b(a);
59
+ i(c) || t((h) => y(h, c));
60
+ },
61
+ [t]
62
+ ), l = p((a) => {
63
+ if (i(a)) return;
64
+ const c = P(a, (h) => {
65
+ const f = (u) => [u.id, ...u.children ? P(u.children, f) : []];
66
+ return f(h);
67
+ });
68
+ t(c);
69
+ }, [t]), g = p(() => {
70
+ t([]);
71
+ }, [t]);
72
+ return {
73
+ isExpanded: s,
74
+ toggleExpanded: o,
75
+ updateForSelectedPage: r,
76
+ expandedPages: n,
77
+ expandPagesOnSearch: d,
78
+ setExpandedPages: t,
79
+ expandAll: l,
80
+ collapseAll: g
81
+ };
82
+ };
83
+ export {
84
+ W as u
85
+ };
@@ -0,0 +1,73 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { useState as d, createElement as m } from "react";
3
+ import { Button as s } from "@chaibuilder/sdk/ui";
4
+ import { useAtom as h } from "jotai";
5
+ import { map as p } from "lodash-es";
6
+ import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
7
+ import { p as v, T as _ } from "./index-Byi6-4u1.js";
8
+ const b = [
9
+ {
10
+ title: "mobile_xs_title",
11
+ content: "mobile_xs_content",
12
+ icon: /* @__PURE__ */ e(w, { className: "h-4 w-4" }),
13
+ width: 400
14
+ },
15
+ {
16
+ title: "tablet_md_title",
17
+ content: "tablet_md_content",
18
+ icon: /* @__PURE__ */ e(f, { className: "h-4 w-4" }),
19
+ width: 800
20
+ },
21
+ {
22
+ title: "desktop_xl_title",
23
+ content: "desktop_xl_content",
24
+ icon: /* @__PURE__ */ e(u, { className: "h-4 w-4" }),
25
+ width: 1200
26
+ },
27
+ {
28
+ title: "large_desktop_2xl_title",
29
+ content: "large_desktop_2xl_content",
30
+ icon: /* @__PURE__ */ e(x, { className: "h-4 w-4" }),
31
+ width: 1600
32
+ }
33
+ ], g = ({ currentWidth: t, width: r, icon: l, setIframeWidth: o }) => /* @__PURE__ */ e(
34
+ s,
35
+ {
36
+ className: "px-3 py-3",
37
+ onClick: () => o(r),
38
+ variant: r === t ? "default" : "ghost",
39
+ children: l
40
+ }
41
+ ), j = () => {
42
+ const [t, r] = d(1200), l = (i) => r(i), [o, a] = h(v);
43
+ if (!o) return null;
44
+ const c = () => {
45
+ a("");
46
+ };
47
+ return /* @__PURE__ */ n("div", { className: "absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100", children: [
48
+ /* @__PURE__ */ n("div", { className: "flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm", children: [
49
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-center rounded-md border border-gray-300", children: p(b, (i) => /* @__PURE__ */ m(g, { ...i, setIframeWidth: l, key: i.title, currentWidth: t })) }),
50
+ " ",
51
+ /* @__PURE__ */ e(_, { content: "Exit Preview", delayDuration: 0, children: /* @__PURE__ */ e(s, { variant: "destructive", size: "sm", onClick: c, children: /* @__PURE__ */ e("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e(
52
+ "path",
53
+ {
54
+ d: "M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",
55
+ fill: "currentColor",
56
+ "fill-rule": "evenodd",
57
+ "clip-rule": "evenodd"
58
+ }
59
+ ) }) }) })
60
+ ] }),
61
+ /* @__PURE__ */ e(
62
+ "iframe",
63
+ {
64
+ style: { width: `${t}px`, transition: "width 0.3s ease-in-out" },
65
+ className: "no-scrollbar mx-auto h-full overflow-y-auto border bg-white",
66
+ src: o
67
+ }
68
+ )
69
+ ] });
70
+ };
71
+ export {
72
+ j as default
73
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-DSUpSpeI.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Suraj Air",
4
4
  "license": "Private",
5
5
  "homepage": "https://chaibuilder.com",
6
- "version": "0.13.4",
6
+ "version": "0.14.1",
7
7
  "type": "module",
8
8
  "files": [
9
9
  "dist"