@ixo/editor 6.24.0 → 6.25.0

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.
@@ -1521,8 +1521,13 @@ var AuthorizationTab = ({ editor, block: initialBlock, flowUri = "", entityDid:
1521
1521
  // src/mantine/flow/runSessionContext.tsx
1522
1522
  import React5, { createContext as createContext2, useContext as useContext2 } from "react";
1523
1523
  var RunSessionContext = createContext2({});
1524
- function RunSessionProvider({ sessionRunId, runEventLog, children }) {
1525
- return /* @__PURE__ */ React5.createElement(RunSessionContext.Provider, { value: { sessionRunId, runEventLog } }, children);
1524
+ function RunSessionProvider({
1525
+ sessionRunId,
1526
+ runEventLog,
1527
+ sessionPreview,
1528
+ children
1529
+ }) {
1530
+ return /* @__PURE__ */ React5.createElement(RunSessionContext.Provider, { value: { sessionRunId, runEventLog, sessionPreview } }, children);
1526
1531
  }
1527
1532
  function useRunSessionId() {
1528
1533
  return useContext2(RunSessionContext).sessionRunId;
@@ -1530,6 +1535,9 @@ function useRunSessionId() {
1530
1535
  function useRunEventLog() {
1531
1536
  return useContext2(RunSessionContext).runEventLog;
1532
1537
  }
1538
+ function useRunSessionPreview() {
1539
+ return useContext2(RunSessionContext).sessionPreview === true;
1540
+ }
1533
1541
 
1534
1542
  // src/mantine/hooks/useNodeRuntime.ts
1535
1543
  import { useState as useState7, useEffect as useEffect9, useCallback as useCallback8, useRef as useRef4 } from "react";
@@ -1545,9 +1553,10 @@ function shallowEqual(a, b) {
1545
1553
  function useNodeRuntime(editor, nodeId, runId) {
1546
1554
  const contextRunId = useRunSessionId();
1547
1555
  const contextEventLog = useRunEventLog();
1556
+ const sessionPreview = useRunSessionPreview();
1548
1557
  const yDoc = resolveEditorYDoc(editor);
1549
1558
  const legacyMap = yDoc ? void 0 : editor?._yRuntime;
1550
- const readRunId = yDoc ? resolveRunIdForRead(yDoc, runId || contextRunId) : void 0;
1559
+ const readRunId = yDoc && !sessionPreview ? resolveRunIdForRead(yDoc, runId || contextRunId) : void 0;
1551
1560
  const read = useCallback8(() => {
1552
1561
  if (yDoc) return readRunId ? readActionState(yDoc, readRunId, nodeId) : {};
1553
1562
  if (!legacyMap) return {};
@@ -1581,6 +1590,9 @@ function useNodeRuntime(editor, nodeId, runId) {
1581
1590
  }, [yDoc, legacyMap, read]);
1582
1591
  const updateRuntime = useCallback8(
1583
1592
  async (updates) => {
1593
+ if (sessionPreview) {
1594
+ throw new Error("This flow is rendered as a pre-session preview. Start or select a session to run actions.");
1595
+ }
1584
1596
  let prev;
1585
1597
  let next;
1586
1598
  const eventLog = contextEventLog || editor._runEventLog;
@@ -1786,7 +1798,7 @@ function useNodeRuntime(editor, nodeId, runId) {
1786
1798
  throw new Error("The action effect completed, but canonical run history is pending replay.");
1787
1799
  }
1788
1800
  },
1789
- [yDoc, legacyMap, runId, contextRunId, nodeId, editor, contextEventLog, read]
1801
+ [yDoc, legacyMap, runId, contextRunId, sessionPreview, nodeId, editor, contextEventLog, read]
1790
1802
  );
1791
1803
  return [state, updateRuntime];
1792
1804
  }
@@ -3586,13 +3598,14 @@ function evaluateBlockConditions2(conditionConfig, editorDocument, _currentUser,
3586
3598
  // src/mantine/blocks/hooks/useBlockConditions.ts
3587
3599
  function useBlockConditions(block, editor, currentUser, sessionRunId) {
3588
3600
  const contextRunId = useRunSessionId();
3601
+ const sessionPreview = useRunSessionPreview();
3589
3602
  const editorDocument = editor?.document;
3590
3603
  const conditionConfig = useMemo12(() => {
3591
3604
  return parseConditionConfig(block?.props?.conditions);
3592
3605
  }, [block?.props?.conditions]);
3593
3606
  const [sourceBlockVersion, setSourceBlockVersion] = useState11(0);
3594
3607
  const yDoc = editor?._yDoc;
3595
- const resolvedRunId = sessionRunId || contextRunId || (yDoc ? resolveActiveRunId(yDoc) : void 0);
3608
+ const resolvedRunId = sessionPreview ? void 0 : sessionRunId || contextRunId || (yDoc ? resolveActiveRunId(yDoc) : void 0);
3596
3609
  useEffect13(() => {
3597
3610
  if (!editor) {
3598
3611
  return;
@@ -24180,6 +24193,7 @@ function mergeActionHandlers(contextHandlers, executionHandlers) {
24180
24193
  function useExecuteActionBlock({ editor, block }) {
24181
24194
  const handlers = useBlocknoteHandlers();
24182
24195
  const sessionRunId = useRunSessionId();
24196
+ const sessionPreview = useRunSessionPreview();
24183
24197
  const runEventLog = useRunEventLog();
24184
24198
  const services = useMemo91(() => buildServicesFromHandlers(handlers), [handlers]);
24185
24199
  const [isExecuting, setIsExecuting] = useState96(false);
@@ -24187,6 +24201,9 @@ function useExecuteActionBlock({ editor, block }) {
24187
24201
  const [result, setResult] = useState96(null);
24188
24202
  const executeAction = useCallback73(
24189
24203
  async ({ runtimeInputs, pendingInvocationId, pin, handlers: executionHandlers } = {}) => {
24204
+ if (sessionPreview) {
24205
+ throw new Error("This flow is rendered as a pre-session preview. Start or select a session to run actions.");
24206
+ }
24190
24207
  setIsExecuting(true);
24191
24208
  setError(null);
24192
24209
  try {
@@ -24240,7 +24257,7 @@ function useExecuteActionBlock({ editor, block }) {
24240
24257
  setIsExecuting(false);
24241
24258
  }
24242
24259
  },
24243
- [block, editor, handlers, runEventLog, services, sessionRunId]
24260
+ [block, editor, handlers, runEventLog, services, sessionRunId, sessionPreview]
24244
24261
  );
24245
24262
  return {
24246
24263
  executeAction,
@@ -26304,8 +26321,9 @@ var UserSearch = ({ onPick, isPicked, isDisabled, placeholder }) => {
26304
26321
  import { useEffect as useEffect91, useMemo as useMemo97, useState as useState113 } from "react";
26305
26322
  function useRunRuntimeReader(editor, runId) {
26306
26323
  const contextRunId = useRunSessionId();
26324
+ const sessionPreview = useRunSessionPreview();
26307
26325
  const yDoc = editor?._yDoc ?? editor?._yRuntime?.doc;
26308
- const resolvedRunId = runId ?? contextRunId ?? (yDoc ? resolveActiveRunId(yDoc) : void 0);
26326
+ const resolvedRunId = sessionPreview ? void 0 : runId ?? contextRunId ?? (yDoc ? resolveActiveRunId(yDoc) : void 0);
26309
26327
  const [revision, setRevision] = useState113(0);
26310
26328
  useEffect91(() => {
26311
26329
  if (!yDoc) return;
@@ -50904,7 +50922,8 @@ function IxoEditorContent({
50904
50922
  dropIndicator,
50905
50923
  isPlacementMode,
50906
50924
  onPlacementCancel,
50907
- belowTitleSlot
50925
+ belowTitleSlot,
50926
+ sessionPreview
50908
50927
  }) {
50909
50928
  const { activePanel } = usePanelStore();
50910
50929
  const isPanelOpen = activePanel !== null;
@@ -50996,12 +51015,14 @@ function IxoEditorContent({
50996
51015
  return /* @__PURE__ */ React443.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React443.createElement(
50997
51016
  "div",
50998
51017
  {
50999
- className: `ixo-editor ixo-editor--theme-${config.theme}${isEditable ? "" : " ixo-editor--readonly"} ${className}`,
51018
+ className: `ixo-editor ixo-editor--theme-${config.theme}${isEditable ? "" : " ixo-editor--readonly"}${sessionPreview ? " ixo-editor--session-preview" : ""} ${className}`,
51000
51019
  style: {
51001
51020
  width: isPanelVisible && isPanelOpen ? "50%" : "100%",
51002
51021
  transition: "width 0.2s ease",
51003
- ...isEditable ? {} : { caretColor: "transparent" }
51004
- }
51022
+ ...isEditable ? {} : { caretColor: "transparent" },
51023
+ ...sessionPreview ? { pointerEvents: "none" } : {}
51024
+ },
51025
+ ...sessionPreview ? { inert: "" } : {}
51005
51026
  },
51006
51027
  /* @__PURE__ */ React443.createElement(CoverImage, { coverImageUrl, logoUrl }),
51007
51028
  /* @__PURE__ */ React443.createElement(PageTitle, { editor, editable: isEditable }),
@@ -51049,6 +51070,7 @@ function IxoEditor({
51049
51070
  awarenessInstance,
51050
51071
  belowTitleSlot,
51051
51072
  sessionRunId,
51073
+ sessionPreview,
51052
51074
  runEventLog,
51053
51075
  translate
51054
51076
  }) {
@@ -51065,7 +51087,7 @@ function IxoEditor({
51065
51087
  tableHandles: true
51066
51088
  };
51067
51089
  const isEditable = editable;
51068
- const editorContent = /* @__PURE__ */ React443.createElement(RunSessionProvider, { sessionRunId, runEventLog: runEventLog || editor._runEventLog }, /* @__PURE__ */ React443.createElement(SanitizedThemeBoundary, null, /* @__PURE__ */ React443.createElement(
51090
+ const editorContent = /* @__PURE__ */ React443.createElement(RunSessionProvider, { sessionRunId, runEventLog: runEventLog || editor._runEventLog, sessionPreview }, /* @__PURE__ */ React443.createElement(SanitizedThemeBoundary, null, /* @__PURE__ */ React443.createElement(
51069
51091
  BlocknoteProvider,
51070
51092
  {
51071
51093
  editor,
@@ -51099,7 +51121,8 @@ function IxoEditor({
51099
51121
  dropIndicator,
51100
51122
  isPlacementMode,
51101
51123
  onPlacementCancel,
51102
- belowTitleSlot
51124
+ belowTitleSlot,
51125
+ sessionPreview
51103
51126
  },
51104
51127
  children
51105
51128
  )
@@ -51815,6 +51838,7 @@ export {
51815
51838
  RunSessionProvider,
51816
51839
  useRunSessionId,
51817
51840
  useRunEventLog,
51841
+ useRunSessionPreview,
51818
51842
  useNodeRuntime,
51819
51843
  CheckboxFlowView,
51820
51844
  CheckboxBlockSpec,
@@ -51875,4 +51899,4 @@ export {
51875
51899
  ixoGraphQLClient,
51876
51900
  getEntity
51877
51901
  };
51878
- //# sourceMappingURL=chunk-DBH72SPW.js.map
51902
+ //# sourceMappingURL=chunk-2OASS6D4.js.map