@levo-so/studio 0.1.83 → 0.1.85

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
1
  "use client";
2
- import { t as e } from "./Button-Ct2fjM5v.js";
2
+ import { t as e } from "./Button-C8Q7VDMX.js";
3
3
  import { useState as t } from "react";
4
4
  import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/components/bookingCard/BillingStep.tsx
@@ -10,6 +10,8 @@ import * as _ from "motion/react-m";
10
10
  import { BiLoaderAlt as v } from "react-icons/bi";
11
11
  //#region src/providers/BlockContext.tsx
12
12
  var y = r({
13
+ isBuilder: !1,
14
+ renderMode: "live",
13
15
  workspace_id: "",
14
16
  pageSource: []
15
17
  }), b = ({ children: e, value: t }) => {
@@ -23,7 +25,8 @@ var y = r({
23
25
  blockData: t.blockData,
24
26
  pageContext: t.pageContext,
25
27
  blockContext: t.blockContext,
26
- isBuilder: t.isBuilder,
28
+ isBuilder: t.renderMode?.startsWith("studio.") ?? !1,
29
+ renderMode: t.renderMode,
27
30
  workspace_id: t.workspace_id,
28
31
  pageSource: t.pageSource
29
32
  }), [
@@ -32,7 +35,7 @@ var y = r({
32
35
  t.blockData,
33
36
  t.pageContext,
34
37
  t.blockContext,
35
- t.isBuilder,
38
+ t.renderMode,
36
39
  t.workspace_id,
37
40
  t.pageSource
38
41
  ]);
@@ -911,16 +914,26 @@ var y = r({
911
914
  if (s(() => {
912
915
  if (!r) return;
913
916
  let e = c.current;
914
- if (!e) return;
917
+ if (!e || !(e instanceof Element)) return;
915
918
  let { from: t, to: n, offset: i } = r, a = {}, o = Array.from(new Set([...Object.keys(t), ...Object.keys(n)]));
916
919
  for (let e of o) {
917
920
  let r = t[e] ?? n[e], i = n[e] ?? t[e];
918
921
  r !== i && typeof r == "number" && typeof i == "number" && (a[e] = [r, i]);
919
922
  }
920
- if (Object.keys(a).length !== 0) return f(d(e, a, { ease: "linear" }), {
921
- target: e,
922
- offset: [i.start, i.end]
923
- });
923
+ if (Object.keys(a).length === 0) return;
924
+ let s = d(e, a, { ease: "linear" });
925
+ try {
926
+ return f(s, {
927
+ target: e,
928
+ offset: [i.start, i.end]
929
+ });
930
+ } catch (e) {
931
+ console.error("[AnimatedBlock] Failed to initialise scroll-linked animation", {
932
+ error: e,
933
+ offset: i
934
+ });
935
+ return;
936
+ }
924
937
  }, [r]), r) {
925
938
  let i = {};
926
939
  for (let [e, t] of Object.entries(r.from)) t !== void 0 && (i[e] = t);
@@ -956,46 +969,46 @@ var y = r({
956
969
  });
957
970
  }, z = (e) => {
958
971
  let t = _.create(e), n = ({ elementKey: n, children: r, ...i }) => {
959
- let { parsedBlockData: a } = x(), { config: o, styles: s, content: l, id: u } = a || {}, d = o ? D(o, n) : void 0, f = N(i, n, d, s ? D(s, n) : void 0, l ? D(l, n) : void 0, M(n, u || "", d)), p = d?.animation, h = c(() => p?.scroll ? {
972
+ let { parsedBlockData: a, renderMode: o } = x(), { config: s, styles: l, content: u, id: d } = a || {}, f = s ? D(s, n) : void 0, p = N(i, n, f, l ? D(l, n) : void 0, u ? D(u, n) : void 0, M(n, d || "", f)), h = f?.animation, g = c(() => h?.scroll ? {
960
973
  from: {
961
974
  ...C,
962
- ...p.scroll.from
975
+ ...h.scroll.from
963
976
  },
964
977
  to: {
965
978
  ...S,
966
- ...p.scroll.to
979
+ ...h.scroll.to
967
980
  },
968
- offset: p.scroll.offset ?? {
981
+ offset: h.scroll.offset ?? {
969
982
  start: "start end",
970
983
  end: "end center"
971
984
  }
972
- } : void 0, [p?.scroll]), g = c(() => p?.entry ? {
985
+ } : void 0, [h?.scroll]), _ = c(() => h?.entry ? {
973
986
  from: {
974
987
  ...C,
975
- ...p.entry.from
988
+ ...h.entry.from
976
989
  },
977
990
  to: {
978
991
  ...S,
979
- ...p.entry.to
992
+ ...h.entry.to
980
993
  },
981
- transition: p.entry.transition,
982
- viewport: p.entry.viewport
983
- } : void 0, [p?.entry]);
984
- return !a || d?.enabled === !1 ? null : p && Object.keys(p).length > 0 ? /* @__PURE__ */ m(I, {
985
- config: d || {},
994
+ transition: h.entry.transition,
995
+ viewport: h.entry.viewport
996
+ } : void 0, [h?.entry]);
997
+ return !a || f?.enabled === !1 ? null : h && Object.keys(h).length > 0 && o !== "studio.block" ? /* @__PURE__ */ m(I, {
998
+ config: f || {},
986
999
  children: /* @__PURE__ */ m(R, {
987
1000
  MotionComponent: t,
988
- motionProps: f,
989
- scroll: h,
990
- entry: g,
991
- whileHover: p.whileHover,
992
- exit: p.exit,
1001
+ motionProps: p,
1002
+ scroll: g,
1003
+ entry: _,
1004
+ whileHover: h.whileHover,
1005
+ exit: h.exit,
993
1006
  children: r
994
1007
  })
995
1008
  }) : /* @__PURE__ */ m(I, {
996
- config: d || {},
1009
+ config: f || {},
997
1010
  children: /* @__PURE__ */ m(e, {
998
- ...f,
1011
+ ...p,
999
1012
  children: r
1000
1013
  })
1001
1014
  });
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { n as e } from "./AuthProvider-Ch5Ny0il.js";
3
- import { t } from "./Button-Ct2fjM5v.js";
3
+ import { t } from "./Button-C8Q7VDMX.js";
4
4
  import { n, t as r } from "./StripePaymentModal-Kk0GUsIU.js";
5
- import { BillingStep as ee } from "./BillingStep-DifEK8oa.js";
5
+ import { BillingStep as ee } from "./BillingStep-BXqAkFFY.js";
6
6
  import { useRef as i, useState as a } from "react";
7
7
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
8
  import { cn as te, errorHandler as l, useLevo as u } from "@levo-so/react";
package/dist/index.d.ts CHANGED
@@ -257,22 +257,29 @@ declare type BlockChildren = ReactNode;
257
257
 
258
258
  export declare type BlockComponent = ComponentType<ILevoBlockBaseProps<any>> | LazyExoticComponent<ComponentType<ILevoBlockBaseProps<any>>>;
259
259
 
260
- declare type BlockContextType = {
261
- parsedBlockData?: IBlockInstance;
260
+ /** Full context value exposed via useBlockContext — includes derived fields */
261
+ declare type BlockContextType = BlockProviderInput & {
262
262
  setParsedBlockData?: React.Dispatch<React.SetStateAction<IBlockInstance | undefined>>;
263
+ /** @deprecated Use `renderMode` for precise context checks. Derived from `renderMode` for backwards compatibility. */
264
+ isBuilder: boolean;
265
+ };
266
+
267
+ export declare const BlockProvider: React.FC<{
268
+ children: React.ReactNode;
269
+ value: BlockProviderInput;
270
+ }>;
271
+
272
+ /** Input props for BlockProvider — what LevoBlock passes in */
273
+ declare type BlockProviderInput = {
274
+ parsedBlockData?: IBlockInstance;
263
275
  blockData?: IBlockInstance;
264
276
  pageContext?: IPageContext;
265
277
  blockContext?: IBlockContext;
266
- isBuilder?: boolean;
278
+ renderMode: IRenderMode;
267
279
  workspace_id: string;
268
280
  pageSource: IPage["source"];
269
281
  };
270
282
 
271
- export declare const BlockProvider: React.FC<{
272
- children: React.ReactNode;
273
- value: BlockContextType;
274
- }>;
275
-
276
283
  export declare const BlockSourceModuleList: readonly ["collection", "event", "blog", "community", "context", "form"];
277
284
 
278
285
  export declare class BlocksRegistry {
@@ -1249,13 +1256,13 @@ export declare type ILevoPageData = Pick<IPageExpanded, "id" | "workspace_id" |
1249
1256
  export declare interface ILevoPageProps {
1250
1257
  pageData: ILevoPageData;
1251
1258
  parsedPageData: ILevoPageData;
1252
- isBuilder?: boolean;
1259
+ renderMode?: IRenderMode;
1253
1260
  context?: IPageDataContext;
1254
1261
  blocks: Record<string, BlockComponent>;
1255
1262
  workspace: IWorkspace;
1256
1263
  site: ISite;
1257
1264
  authOverride?: IAuthOverride | null;
1258
- /** Wrap page content in a Suspense boundary (needed for React.lazy blocks). Auto-enabled when isBuilder is true. */
1265
+ /** Wrap page content in a Suspense boundary (needed for React.lazy blocks). Auto-enabled in studio modes. */
1259
1266
  enableSuspense?: boolean;
1260
1267
  }
1261
1268
 
@@ -1503,6 +1510,17 @@ declare interface IPostsRestrictionOverlayProps {
1503
1510
 
1504
1511
  declare type IPreviewDevice = "desktop" | "tablet" | "mobile";
1505
1512
 
1513
+ /**
1514
+ * Controls rendering behavior across live sites, studio page preview, and studio block preview.
1515
+ *
1516
+ * - `"live"` — live site, no restrictions
1517
+ * - `"studio.page"` — page preview in the editor (disables links, insights, fixed navbars)
1518
+ * - `"studio.block"` — block preview in the add-block panel (same as studio.page + no animations)
1519
+ *
1520
+ * Use `renderMode?.startsWith("studio.")` to check for any studio context (replaces old `isBuilder`).
1521
+ */
1522
+ export declare type IRenderMode = "live" | "studio.page" | "studio.block";
1523
+
1506
1524
  /**
1507
1525
  * Type guard to check if a method is alternate (OAuth)
1508
1526
  */
@@ -1900,11 +1918,11 @@ export declare const KindList: readonly ["element", "group"];
1900
1918
  */
1901
1919
  export declare const LazyMotionProvider: React.FC<ILazyMotionProviderProps>;
1902
1920
 
1903
- export declare const LevoBlock: default_2.MemoExoticComponent<({ html_id, isBuilder, blocks, parsedBlockData, blockData, pageContext, blockContext, workspace_id, pageSource, }: LevoBlockProps) => JSX.Element>;
1921
+ export declare const LevoBlock: default_2.MemoExoticComponent<({ html_id, renderMode, blocks, parsedBlockData, blockData, pageContext, blockContext, workspace_id, pageSource, }: LevoBlockProps) => JSX.Element>;
1904
1922
 
1905
1923
  declare interface LevoBlockProps {
1906
1924
  html_id?: string;
1907
- isBuilder?: boolean;
1925
+ renderMode?: IRenderMode;
1908
1926
  blocks: Record<string, BlockComponent>;
1909
1927
  parsedBlockData: IBlockInstance;
1910
1928
  workspace_id: string;