@levo-so/studio 0.1.84 → 0.1.86

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-BxZPZfsv.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
  ]);
@@ -966,46 +969,46 @@ var y = r({
966
969
  });
967
970
  }, z = (e) => {
968
971
  let t = _.create(e), n = ({ elementKey: n, children: r, ...i }) => {
969
- 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 ? {
970
973
  from: {
971
974
  ...C,
972
- ...p.scroll.from
975
+ ...h.scroll.from
973
976
  },
974
977
  to: {
975
978
  ...S,
976
- ...p.scroll.to
979
+ ...h.scroll.to
977
980
  },
978
- offset: p.scroll.offset ?? {
981
+ offset: h.scroll.offset ?? {
979
982
  start: "start end",
980
983
  end: "end center"
981
984
  }
982
- } : void 0, [p?.scroll]), g = c(() => p?.entry ? {
985
+ } : void 0, [h?.scroll]), _ = c(() => h?.entry ? {
983
986
  from: {
984
987
  ...C,
985
- ...p.entry.from
988
+ ...h.entry.from
986
989
  },
987
990
  to: {
988
991
  ...S,
989
- ...p.entry.to
992
+ ...h.entry.to
990
993
  },
991
- transition: p.entry.transition,
992
- viewport: p.entry.viewport
993
- } : void 0, [p?.entry]);
994
- return !a || d?.enabled === !1 ? null : p && Object.keys(p).length > 0 ? /* @__PURE__ */ m(I, {
995
- 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 || {},
996
999
  children: /* @__PURE__ */ m(R, {
997
1000
  MotionComponent: t,
998
- motionProps: f,
999
- scroll: h,
1000
- entry: g,
1001
- whileHover: p.whileHover,
1002
- exit: p.exit,
1001
+ motionProps: p,
1002
+ scroll: g,
1003
+ entry: _,
1004
+ whileHover: h.whileHover,
1005
+ exit: h.exit,
1003
1006
  children: r
1004
1007
  })
1005
1008
  }) : /* @__PURE__ */ m(I, {
1006
- config: d || {},
1009
+ config: f || {},
1007
1010
  children: /* @__PURE__ */ m(e, {
1008
- ...f,
1011
+ ...p,
1009
1012
  children: r
1010
1013
  })
1011
1014
  });
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { n as e } from "./AuthProvider-Ch5Ny0il.js";
3
- import { t } from "./Button-BxZPZfsv.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-BgxKFmgZ.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;