@june-ai/june-ui 0.2.9 → 0.2.11
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/README.md +1 -0
- package/dist/{chunk-JSRO5CRO.js → chunk-2TBT4VRQ.js} +366 -67
- package/dist/{chunk-GFCROSGQ.cjs → chunk-TD6GKOUR.cjs} +456 -157
- package/dist/entry-core.cjs +10 -2
- package/dist/entry-core.d.cts +44 -3
- package/dist/entry-core.d.ts +44 -3
- package/dist/entry-core.js +9 -1
- package/dist/index.cjs +15 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -1
- package/dist/june.css +52 -0
- package/package.json +1 -1
|
@@ -224,9 +224,16 @@ function createActionHandler(options) {
|
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
// src/features/document-editor/document-bridge.tsx
|
|
228
|
+
|
|
229
|
+
|
|
227
230
|
// src/features/document-editor/document-context.ts
|
|
228
231
|
|
|
229
232
|
var JuneDocumentContext = _react.createContext.call(void 0, {});
|
|
233
|
+
var DocumentEditorConfigContext = _react.createContext.call(void 0, {});
|
|
234
|
+
function useDocumentEditorConfig() {
|
|
235
|
+
return _react.useContext.call(void 0, DocumentEditorConfigContext);
|
|
236
|
+
}
|
|
230
237
|
function useDocumentOptions() {
|
|
231
238
|
return _react.useContext.call(void 0, JuneDocumentContext);
|
|
232
239
|
}
|
|
@@ -608,9 +615,16 @@ function useDocumentBridge(options) {
|
|
|
608
615
|
|
|
609
616
|
// src/features/document-editor/document-bridge.tsx
|
|
610
617
|
|
|
611
|
-
function DocumentBridge({
|
|
618
|
+
function DocumentBridge({
|
|
619
|
+
children,
|
|
620
|
+
documentEditor,
|
|
621
|
+
...options
|
|
622
|
+
}) {
|
|
612
623
|
const value = useDocumentBridge(options);
|
|
613
|
-
|
|
624
|
+
const presentation = _optionalChain([documentEditor, 'optionalAccess', _38 => _38.presentation]);
|
|
625
|
+
const width = _optionalChain([documentEditor, 'optionalAccess', _39 => _39.width]);
|
|
626
|
+
const config = _react.useMemo.call(void 0, () => ({ presentation, width }), [presentation, width]);
|
|
627
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, JuneDocumentContext.Provider, { value, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocumentEditorConfigContext.Provider, { value: config, children }) });
|
|
614
628
|
}
|
|
615
629
|
|
|
616
630
|
// src/themes/theme-provider.tsx
|
|
@@ -663,7 +677,7 @@ function subscribe(onChange) {
|
|
|
663
677
|
}
|
|
664
678
|
function getSnapshot() {
|
|
665
679
|
if (typeof window === "undefined") return "light";
|
|
666
|
-
return _optionalChain([window, 'access',
|
|
680
|
+
return _optionalChain([window, 'access', _40 => _40.matchMedia, 'optionalCall', _41 => _41(QUERY), 'optionalAccess', _42 => _42.matches]) ? "dark" : "light";
|
|
667
681
|
}
|
|
668
682
|
function getServerSnapshot() {
|
|
669
683
|
return "light";
|
|
@@ -894,7 +908,7 @@ function attachOrphans(source) {
|
|
|
894
908
|
if (!root) return `root = Card([${names.join(", ")}])
|
|
895
909
|
${text}`;
|
|
896
910
|
const rawRhs = text.slice(root.rhsStart, root.end);
|
|
897
|
-
const lead = _nullishCoalesce(_optionalChain([/^\s*/, 'access',
|
|
911
|
+
const lead = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _43 => _43.exec, 'call', _44 => _44(rawRhs), 'optionalAccess', _45 => _45[0]]), () => ( ""));
|
|
898
912
|
const spliced = spliceFirstArray(rawRhs.trim(), names);
|
|
899
913
|
if (spliced !== null) {
|
|
900
914
|
return text.slice(0, root.rhsStart) + lead + spliced + text.slice(root.end);
|
|
@@ -1056,7 +1070,7 @@ var STATEMENT_START = /^\$?[A-Za-z_]\w*\s*=/;
|
|
|
1056
1070
|
var PENDING_IDENTIFIER = /^\s*\$?[A-Za-z_]\w*\s*$/;
|
|
1057
1071
|
var FENCE = /^(`{3,})\s*([\w-]*)/;
|
|
1058
1072
|
var OPENUI_FENCE_LANGS = /* @__PURE__ */ new Set(["", "openui", "openui-lang", "openuilang"]);
|
|
1059
|
-
function scan(line, state) {
|
|
1073
|
+
function scan(line, state, preserveQuote = false) {
|
|
1060
1074
|
for (let i = 0; i < line.length; i++) {
|
|
1061
1075
|
const ch = line[i];
|
|
1062
1076
|
if (state.quote) {
|
|
@@ -1070,7 +1084,95 @@ function scan(line, state) {
|
|
|
1070
1084
|
state.depth = Math.max(0, state.depth - 1);
|
|
1071
1085
|
}
|
|
1072
1086
|
}
|
|
1073
|
-
state.quote = null;
|
|
1087
|
+
if (!preserveQuote) state.quote = null;
|
|
1088
|
+
}
|
|
1089
|
+
function quoteClosesLater(lines, from, state) {
|
|
1090
|
+
const probe = { depth: state.depth, quote: state.quote };
|
|
1091
|
+
for (let i = from; i < lines.length; i++) {
|
|
1092
|
+
const line = lines[i];
|
|
1093
|
+
if (probe.depth === 0 && STATEMENT_START.test(line.trim())) return false;
|
|
1094
|
+
scan(line, probe, true);
|
|
1095
|
+
if (!probe.quote) return true;
|
|
1096
|
+
}
|
|
1097
|
+
return false;
|
|
1098
|
+
}
|
|
1099
|
+
function decodeLangString(raw) {
|
|
1100
|
+
let out = "";
|
|
1101
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1102
|
+
const ch = raw[i];
|
|
1103
|
+
if (ch === "\\" && i + 1 < raw.length) {
|
|
1104
|
+
const next = raw[i + 1];
|
|
1105
|
+
out += next === "n" ? "\n" : next === "t" ? " " : next === "r" ? "\r" : next === "b" ? "\b" : next === "f" ? "\f" : next;
|
|
1106
|
+
i++;
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
out += ch;
|
|
1110
|
+
}
|
|
1111
|
+
return out.replace(/\r/g, "");
|
|
1112
|
+
}
|
|
1113
|
+
function foldMultilineStrings(source) {
|
|
1114
|
+
let out = "";
|
|
1115
|
+
let i = 0;
|
|
1116
|
+
while (i < source.length) {
|
|
1117
|
+
if (source.startsWith('"""', i)) {
|
|
1118
|
+
const end = source.indexOf('"""', i + 3);
|
|
1119
|
+
if (end < 0) {
|
|
1120
|
+
const nl = source.indexOf("\n", i);
|
|
1121
|
+
if (nl < 0) {
|
|
1122
|
+
out += source.slice(i);
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
out += source.slice(i, nl + 1);
|
|
1126
|
+
i = nl + 1;
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
out += JSON.stringify(source.slice(i + 3, end).replace(/\r/g, ""));
|
|
1130
|
+
i = end + 3;
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
if (source[i] !== '"') {
|
|
1134
|
+
out += source[i];
|
|
1135
|
+
i++;
|
|
1136
|
+
continue;
|
|
1137
|
+
}
|
|
1138
|
+
let j = i + 1;
|
|
1139
|
+
let closed = false;
|
|
1140
|
+
let hasNewline = false;
|
|
1141
|
+
while (j < source.length) {
|
|
1142
|
+
const ch = source[j];
|
|
1143
|
+
if (ch === "\\") {
|
|
1144
|
+
j += 2;
|
|
1145
|
+
continue;
|
|
1146
|
+
}
|
|
1147
|
+
if (ch === "\n") {
|
|
1148
|
+
if (STATEMENT_START.test(source.slice(j + 1))) break;
|
|
1149
|
+
hasNewline = true;
|
|
1150
|
+
}
|
|
1151
|
+
if (ch === '"') {
|
|
1152
|
+
closed = true;
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
j++;
|
|
1156
|
+
}
|
|
1157
|
+
if (!closed) {
|
|
1158
|
+
const nl = source.indexOf("\n", i);
|
|
1159
|
+
if (nl < 0) {
|
|
1160
|
+
out += source.slice(i);
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
out += source.slice(i, nl + 1);
|
|
1164
|
+
i = nl + 1;
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (!hasNewline) {
|
|
1168
|
+
out += source.slice(i, j + 1);
|
|
1169
|
+
i = j + 1;
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
out += JSON.stringify(decodeLangString(source.slice(i + 1, j)));
|
|
1173
|
+
i = j + 1;
|
|
1174
|
+
}
|
|
1175
|
+
return out;
|
|
1074
1176
|
}
|
|
1075
1177
|
function splitResponse(source, options = {}) {
|
|
1076
1178
|
const markdown = options.markdown === true;
|
|
@@ -1092,8 +1194,15 @@ function splitResponse(source, options = {}) {
|
|
|
1092
1194
|
text = [];
|
|
1093
1195
|
if (joined) (seenUi ? after : before).push(joined);
|
|
1094
1196
|
};
|
|
1095
|
-
|
|
1197
|
+
const lines = input.split(/\r?\n/);
|
|
1198
|
+
for (let index = 0; index < lines.length; index++) {
|
|
1199
|
+
const line = lines[index];
|
|
1096
1200
|
const trimmed = line.trim();
|
|
1201
|
+
if (state.quote) {
|
|
1202
|
+
ui.push(line);
|
|
1203
|
+
scan(line, state, true);
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1097
1206
|
if (codeFence !== null) {
|
|
1098
1207
|
text.push(line);
|
|
1099
1208
|
if (trimmed.startsWith(codeFence)) {
|
|
@@ -1122,7 +1231,8 @@ function splitResponse(source, options = {}) {
|
|
|
1122
1231
|
flushText();
|
|
1123
1232
|
seenUi = true;
|
|
1124
1233
|
ui.push(line);
|
|
1125
|
-
scan(line, state);
|
|
1234
|
+
scan(line, state, true);
|
|
1235
|
+
if (state.quote && !quoteClosesLater(lines, index + 1, state)) state.quote = null;
|
|
1126
1236
|
continue;
|
|
1127
1237
|
}
|
|
1128
1238
|
if (trimmed === "") {
|
|
@@ -1134,7 +1244,7 @@ function splitResponse(source, options = {}) {
|
|
|
1134
1244
|
flushText();
|
|
1135
1245
|
return {
|
|
1136
1246
|
before,
|
|
1137
|
-
ui: ui.join("\n"),
|
|
1247
|
+
ui: foldMultilineStrings(ui.join("\n")),
|
|
1138
1248
|
after,
|
|
1139
1249
|
pure: !sawFence && before.length === 0 && after.length === 0
|
|
1140
1250
|
};
|
|
@@ -1144,10 +1254,10 @@ function splitResponse(source, options = {}) {
|
|
|
1144
1254
|
function resolveMixedContent(response, options = {}) {
|
|
1145
1255
|
const { mixedContent = true, isStreaming = false, repair = true, markdown = false } = options;
|
|
1146
1256
|
const parts = mixedContent && response ? splitResponse(response, { streaming: isStreaming, markdown }) : null;
|
|
1147
|
-
const raw = parts && !parts.pure ? parts.ui : response;
|
|
1257
|
+
const raw = parts && !parts.pure ? parts.ui : typeof response === "string" ? foldMultilineStrings(response) : response;
|
|
1148
1258
|
const ui = !repair || !mixedContent || isStreaming || typeof raw !== "string" || raw.length === 0 ? raw : normalizeProgram(raw);
|
|
1149
|
-
const before = _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
1150
|
-
const after = _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
1259
|
+
const before = _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _46 => _46.before]), () => ( []));
|
|
1260
|
+
const after = _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _47 => _47.after]), () => ( []));
|
|
1151
1261
|
return {
|
|
1152
1262
|
before,
|
|
1153
1263
|
ui,
|
|
@@ -1175,7 +1285,7 @@ var JuneErrorBoundary = class extends _react.Component {
|
|
|
1175
1285
|
return { error };
|
|
1176
1286
|
}
|
|
1177
1287
|
componentDidCatch(error, info) {
|
|
1178
|
-
_optionalChain([this, 'access',
|
|
1288
|
+
_optionalChain([this, 'access', _48 => _48.props, 'access', _49 => _49.onError, 'optionalCall', _50 => _50(error, info)]);
|
|
1179
1289
|
}
|
|
1180
1290
|
componentDidUpdate(prev) {
|
|
1181
1291
|
if (this.state.error && keysChanged(prev.resetKeys, this.props.resetKeys)) {
|
|
@@ -1224,6 +1334,7 @@ function JuneRenderer(props) {
|
|
|
1224
1334
|
onError,
|
|
1225
1335
|
onJuneError,
|
|
1226
1336
|
documents,
|
|
1337
|
+
documentEditor,
|
|
1227
1338
|
onResponseChange,
|
|
1228
1339
|
responseChangeDelay,
|
|
1229
1340
|
loadingFallback = null,
|
|
@@ -1236,37 +1347,37 @@ function JuneRenderer(props) {
|
|
|
1236
1347
|
latest.current = { actions, confirmAction, parseActionEvent, onAction, onError, onJuneError };
|
|
1237
1348
|
const handleAction = _react.useCallback.call(void 0, (event) => {
|
|
1238
1349
|
const l = latest.current;
|
|
1239
|
-
_optionalChain([l, 'access',
|
|
1350
|
+
_optionalChain([l, 'access', _51 => _51.onAction, 'optionalCall', _52 => _52(event)]);
|
|
1240
1351
|
if (l.actions) {
|
|
1241
1352
|
void runAction(event, {
|
|
1242
1353
|
actions: l.actions,
|
|
1243
1354
|
parseEvent: l.parseActionEvent,
|
|
1244
1355
|
confirm: l.confirmAction,
|
|
1245
|
-
onError: (e) => _optionalChain([l, 'access',
|
|
1356
|
+
onError: (e) => _optionalChain([l, 'access', _53 => _53.onJuneError, 'optionalCall', _54 => _54(e)])
|
|
1246
1357
|
});
|
|
1247
1358
|
}
|
|
1248
1359
|
}, []);
|
|
1249
1360
|
const handleParserErrors = _react.useCallback.call(void 0, (errors) => {
|
|
1250
1361
|
const list2 = Array.isArray(errors) ? errors : [];
|
|
1251
1362
|
const l = latest.current;
|
|
1252
|
-
_optionalChain([l, 'access',
|
|
1253
|
-
const real = list2.filter((e) => _optionalChain([e, 'optionalAccess',
|
|
1363
|
+
_optionalChain([l, 'access', _55 => _55.onError, 'optionalCall', _56 => _56(list2)]);
|
|
1364
|
+
const real = list2.filter((e) => _optionalChain([e, 'optionalAccess', _57 => _57.severity]) !== "warning");
|
|
1254
1365
|
if (real.length > 0) {
|
|
1255
|
-
_optionalChain([l, 'access',
|
|
1366
|
+
_optionalChain([l, 'access', _58 => _58.onJuneError, 'optionalCall', _59 => _59(new (0, _chunkG6YPSE6Jcjs.JuneError)("PARSE_ERROR", `OpenUI reported ${real.length} error(s)`, { details: real }))]);
|
|
1256
1367
|
}
|
|
1257
1368
|
if (list2.length > 0 && !l.onError && !l.onJuneError) {
|
|
1258
1369
|
console.warn("[june-ui] OpenUI reported errors:", list2);
|
|
1259
1370
|
}
|
|
1260
1371
|
}, []);
|
|
1261
1372
|
const handleBoundaryError = _react.useCallback.call(void 0, (error, info) => {
|
|
1262
|
-
_optionalChain([latest, 'access',
|
|
1373
|
+
_optionalChain([latest, 'access', _60 => _60.current, 'access', _61 => _61.onJuneError, 'optionalCall', _62 => _62(
|
|
1263
1374
|
new (0, _chunkG6YPSE6Jcjs.JuneError)("RENDER_ERROR", error.message, {
|
|
1264
1375
|
cause: error,
|
|
1265
1376
|
details: { componentStack: info.componentStack }
|
|
1266
1377
|
})
|
|
1267
1378
|
)]);
|
|
1268
1379
|
}, []);
|
|
1269
|
-
const handleDocumentError = _react.useCallback.call(void 0, (error) => _optionalChain([latest, 'access',
|
|
1380
|
+
const handleDocumentError = _react.useCallback.call(void 0, (error) => _optionalChain([latest, 'access', _63 => _63.current, 'access', _64 => _64.onJuneError, 'optionalCall', _65 => _65(error)]), []);
|
|
1270
1381
|
const runtime = _react.useMemo.call(void 0, () => ({ isStreaming }), [isStreaming]);
|
|
1271
1382
|
const content = _react.useMemo.call(void 0,
|
|
1272
1383
|
() => resolveMixedContent(response, { mixedContent, isStreaming, repair, markdown: textFormat === "markdown" }),
|
|
@@ -1280,6 +1391,7 @@ function JuneRenderer(props) {
|
|
|
1280
1391
|
DocumentBridge,
|
|
1281
1392
|
{
|
|
1282
1393
|
documents,
|
|
1394
|
+
documentEditor,
|
|
1283
1395
|
response,
|
|
1284
1396
|
onResponseChange,
|
|
1285
1397
|
responseChangeDelay,
|
|
@@ -1312,8 +1424,8 @@ function JuneRenderer(props) {
|
|
|
1312
1424
|
|
|
1313
1425
|
var NAME = /^[A-Z][A-Za-z0-9_]*$/;
|
|
1314
1426
|
function isZodObject(value) {
|
|
1315
|
-
const def = _optionalChain([value, 'optionalAccess',
|
|
1316
|
-
return _optionalChain([def, 'optionalAccess',
|
|
1427
|
+
const def = _optionalChain([value, 'optionalAccess', _66 => _66._zod, 'optionalAccess', _67 => _67.def]);
|
|
1428
|
+
return _optionalChain([def, 'optionalAccess', _68 => _68.type]) === "object";
|
|
1317
1429
|
}
|
|
1318
1430
|
function validateComponentDefinition(definition) {
|
|
1319
1431
|
const { name } = definition;
|
|
@@ -1376,7 +1488,7 @@ function isJuneComponent(value) {
|
|
|
1376
1488
|
// src/engine/registry/component-registry.ts
|
|
1377
1489
|
|
|
1378
1490
|
function nameOf(component) {
|
|
1379
|
-
const name = _optionalChain([component, 'optionalAccess',
|
|
1491
|
+
const name = _optionalChain([component, 'optionalAccess', _69 => _69.name]);
|
|
1380
1492
|
if (typeof name !== "string" || name.length === 0) {
|
|
1381
1493
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", "Every component needs a non-empty string name");
|
|
1382
1494
|
}
|
|
@@ -1385,7 +1497,7 @@ function nameOf(component) {
|
|
|
1385
1497
|
function slotsOf(component) {
|
|
1386
1498
|
return isJuneComponent(component) ? component.june.slots : void 0;
|
|
1387
1499
|
}
|
|
1388
|
-
var isDev = () => typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1500
|
+
var isDev = () => typeof process !== "undefined" && _optionalChain([process, 'access', _70 => _70.env, 'optionalAccess', _71 => _71.NODE_ENV]) === "development";
|
|
1389
1501
|
var ComponentRegistry = class {
|
|
1390
1502
|
constructor(options = {}) {
|
|
1391
1503
|
this.added = /* @__PURE__ */ new Map();
|
|
@@ -1498,7 +1610,7 @@ var ComponentRegistry = class {
|
|
|
1498
1610
|
if (!inBase || this.removed.has(name)) {
|
|
1499
1611
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", `Cannot remove "${name}": no component with that name.`);
|
|
1500
1612
|
}
|
|
1501
|
-
if (_optionalChain([this, 'access',
|
|
1613
|
+
if (_optionalChain([this, 'access', _72 => _72.base, 'optionalAccess', _73 => _73.root]) === name) {
|
|
1502
1614
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", `Cannot remove "${name}": it is the root component.`);
|
|
1503
1615
|
}
|
|
1504
1616
|
this.removed.add(name);
|
|
@@ -1552,7 +1664,7 @@ var ComponentRegistry = class {
|
|
|
1552
1664
|
try {
|
|
1553
1665
|
return base.extend(extension(true));
|
|
1554
1666
|
} catch (first) {
|
|
1555
|
-
if (added.some((c) => _optionalChain([slotsOf, 'call',
|
|
1667
|
+
if (added.some((c) => _optionalChain([slotsOf, 'call', _74 => _74(c), 'optionalAccess', _75 => _75.length]))) {
|
|
1556
1668
|
try {
|
|
1557
1669
|
const library = base.extend(extension(false));
|
|
1558
1670
|
if (isDev()) console.warn("[june-ui] Component slots were skipped (they need Zod 4.1+):", first);
|
|
@@ -1571,7 +1683,7 @@ var ComponentRegistry = class {
|
|
|
1571
1683
|
const base = this.base;
|
|
1572
1684
|
const replace = new Map(overrides.map((c) => [nameOf(c), c]));
|
|
1573
1685
|
const components = Object.values(base.components).filter((c) => !this.removed.has(c.name)).map((c) => _nullishCoalesce(replace.get(c.name), () => ( c))).concat(added);
|
|
1574
|
-
const componentGroups = _optionalChain([base, 'access',
|
|
1686
|
+
const componentGroups = _optionalChain([base, 'access', _76 => _76.componentGroups, 'optionalAccess', _77 => _77.map, 'call', _78 => _78((g) => ({ ...g, components: g.components.filter((n) => !this.removed.has(n)) })), 'access', _79 => _79.filter, 'call', _80 => _80((g) => g.components.length > 0)]);
|
|
1575
1687
|
return _reactlang.createLibrary.call(void 0, {
|
|
1576
1688
|
components,
|
|
1577
1689
|
componentGroups,
|
|
@@ -1602,7 +1714,7 @@ function createJuneLibrary(options) {
|
|
|
1602
1714
|
const components = _nullishCoalesce(raw.components, () => ( []));
|
|
1603
1715
|
const names = /* @__PURE__ */ new Set();
|
|
1604
1716
|
for (const component of components) {
|
|
1605
|
-
if (typeof _optionalChain([component, 'optionalAccess',
|
|
1717
|
+
if (typeof _optionalChain([component, 'optionalAccess', _81 => _81.name]) !== "string" || component.name.length === 0) {
|
|
1606
1718
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", "Every component needs a non-empty string name");
|
|
1607
1719
|
}
|
|
1608
1720
|
if (names.has(component.name)) {
|
|
@@ -1655,7 +1767,7 @@ async function* iterateReadable(stream, signal) {
|
|
|
1655
1767
|
void reader.cancel().catch(() => {
|
|
1656
1768
|
});
|
|
1657
1769
|
};
|
|
1658
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1770
|
+
_optionalChain([signal, 'optionalAccess', _82 => _82.addEventListener, 'call', _83 => _83("abort", onAbort, { once: true })]);
|
|
1659
1771
|
try {
|
|
1660
1772
|
while (true) {
|
|
1661
1773
|
const { done, value } = await reader.read();
|
|
@@ -1663,7 +1775,7 @@ async function* iterateReadable(stream, signal) {
|
|
|
1663
1775
|
yield value;
|
|
1664
1776
|
}
|
|
1665
1777
|
} finally {
|
|
1666
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1778
|
+
_optionalChain([signal, 'optionalAccess', _84 => _84.removeEventListener, 'call', _85 => _85("abort", onAbort)]);
|
|
1667
1779
|
try {
|
|
1668
1780
|
reader.releaseLock();
|
|
1669
1781
|
} catch (e6) {
|
|
@@ -1678,7 +1790,7 @@ function abortedError(partial) {
|
|
|
1678
1790
|
}
|
|
1679
1791
|
async function consumeStream(source, options = {}) {
|
|
1680
1792
|
const { signal, onText, allowEmpty = false } = options;
|
|
1681
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1793
|
+
if (_optionalChain([signal, 'optionalAccess', _86 => _86.aborted])) throw abortedError("");
|
|
1682
1794
|
const decoder = new TextDecoder();
|
|
1683
1795
|
let text = "";
|
|
1684
1796
|
let received = false;
|
|
@@ -1686,23 +1798,23 @@ async function consumeStream(source, options = {}) {
|
|
|
1686
1798
|
if (!delta) return;
|
|
1687
1799
|
received = true;
|
|
1688
1800
|
text += delta;
|
|
1689
|
-
_optionalChain([onText, 'optionalCall',
|
|
1801
|
+
_optionalChain([onText, 'optionalCall', _87 => _87(delta, text)]);
|
|
1690
1802
|
};
|
|
1691
1803
|
try {
|
|
1692
1804
|
for await (const chunk of toAsyncIterable(source, signal)) {
|
|
1693
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1805
|
+
if (_optionalChain([signal, 'optionalAccess', _88 => _88.aborted])) break;
|
|
1694
1806
|
push(typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }));
|
|
1695
1807
|
}
|
|
1696
1808
|
push(decoder.decode());
|
|
1697
1809
|
} catch (error) {
|
|
1698
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1810
|
+
if (_optionalChain([signal, 'optionalAccess', _89 => _89.aborted])) throw abortedError(text);
|
|
1699
1811
|
if (error instanceof _chunkG6YPSE6Jcjs.JuneError) throw error;
|
|
1700
1812
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_ERROR", "Stream was interrupted", {
|
|
1701
1813
|
cause: error,
|
|
1702
1814
|
details: { partial: text }
|
|
1703
1815
|
});
|
|
1704
1816
|
}
|
|
1705
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1817
|
+
if (_optionalChain([signal, 'optionalAccess', _90 => _90.aborted])) throw abortedError(text);
|
|
1706
1818
|
if (!received && !allowEmpty) {
|
|
1707
1819
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_EMPTY", "Stream completed without any content");
|
|
1708
1820
|
}
|
|
@@ -1784,7 +1896,7 @@ async function fetchStream(input, options = {}) {
|
|
|
1784
1896
|
try {
|
|
1785
1897
|
response = await fetch(input, init);
|
|
1786
1898
|
} catch (error) {
|
|
1787
|
-
if (_optionalChain([init, 'access',
|
|
1899
|
+
if (_optionalChain([init, 'access', _91 => _91.signal, 'optionalAccess', _92 => _92.aborted])) {
|
|
1788
1900
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_ABORTED", "Request was aborted", { cause: error });
|
|
1789
1901
|
}
|
|
1790
1902
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("NETWORK_ERROR", "Network request failed", { cause: error });
|
|
@@ -1841,7 +1953,7 @@ function useJuneStream(options = {}) {
|
|
|
1841
1953
|
}, []);
|
|
1842
1954
|
const start = _react.useCallback.call(void 0,
|
|
1843
1955
|
async (input) => {
|
|
1844
|
-
_optionalChain([controllerRef, 'access',
|
|
1956
|
+
_optionalChain([controllerRef, 'access', _93 => _93.current, 'optionalAccess', _94 => _94.abort, 'call', _95 => _95()]);
|
|
1845
1957
|
const controller = new AbortController();
|
|
1846
1958
|
controllerRef.current = controller;
|
|
1847
1959
|
const runId = ++runIdRef.current;
|
|
@@ -1864,7 +1976,7 @@ function useJuneStream(options = {}) {
|
|
|
1864
1976
|
if (stale()) return null;
|
|
1865
1977
|
clearTimer();
|
|
1866
1978
|
setState({ response: text, isStreaming: false, status: "done", error: null });
|
|
1867
|
-
_optionalChain([optionsRef, 'access',
|
|
1979
|
+
_optionalChain([optionsRef, 'access', _96 => _96.current, 'access', _97 => _97.onComplete, 'optionalCall', _98 => _98(text)]);
|
|
1868
1980
|
return text;
|
|
1869
1981
|
} catch (caught) {
|
|
1870
1982
|
if (stale()) return null;
|
|
@@ -1878,7 +1990,7 @@ function useJuneStream(options = {}) {
|
|
|
1878
1990
|
status: aborted ? "aborted" : "error",
|
|
1879
1991
|
error: aborted ? null : error
|
|
1880
1992
|
});
|
|
1881
|
-
if (!aborted) _optionalChain([optionsRef, 'access',
|
|
1993
|
+
if (!aborted) _optionalChain([optionsRef, 'access', _99 => _99.current, 'access', _100 => _100.onError, 'optionalCall', _101 => _101(error)]);
|
|
1882
1994
|
return null;
|
|
1883
1995
|
}
|
|
1884
1996
|
},
|
|
@@ -1889,10 +2001,10 @@ function useJuneStream(options = {}) {
|
|
|
1889
2001
|
[start]
|
|
1890
2002
|
);
|
|
1891
2003
|
const abort = _react.useCallback.call(void 0, () => {
|
|
1892
|
-
_optionalChain([controllerRef, 'access',
|
|
2004
|
+
_optionalChain([controllerRef, 'access', _102 => _102.current, 'optionalAccess', _103 => _103.abort, 'call', _104 => _104()]);
|
|
1893
2005
|
}, []);
|
|
1894
2006
|
const reset = _react.useCallback.call(void 0, () => {
|
|
1895
|
-
_optionalChain([controllerRef, 'access',
|
|
2007
|
+
_optionalChain([controllerRef, 'access', _105 => _105.current, 'optionalAccess', _106 => _106.abort, 'call', _107 => _107()]);
|
|
1896
2008
|
runIdRef.current++;
|
|
1897
2009
|
textRef.current = "";
|
|
1898
2010
|
clearTimer();
|
|
@@ -1901,7 +2013,7 @@ function useJuneStream(options = {}) {
|
|
|
1901
2013
|
_react.useEffect.call(void 0,
|
|
1902
2014
|
() => () => {
|
|
1903
2015
|
runIdRef.current++;
|
|
1904
|
-
_optionalChain([controllerRef, 'access',
|
|
2016
|
+
_optionalChain([controllerRef, 'access', _108 => _108.current, 'optionalAccess', _109 => _109.abort, 'call', _110 => _110()]);
|
|
1905
2017
|
clearTimer();
|
|
1906
2018
|
},
|
|
1907
2019
|
[clearTimer]
|
|
@@ -2115,6 +2227,10 @@ var PATHS = {
|
|
|
2115
2227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M18 6 6 18" }),
|
|
2116
2228
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "m6 6 12 12" })
|
|
2117
2229
|
] }),
|
|
2230
|
+
pencil: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
|
|
2232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "m15 5 4 4" })
|
|
2233
|
+
] }),
|
|
2118
2234
|
maximize: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2119
2235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }),
|
|
2120
2236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }),
|
|
@@ -2181,7 +2297,7 @@ function Dropdown({ trigger, children, align = "start", className, onOpen }) {
|
|
|
2181
2297
|
return () => document.removeEventListener("mousedown", onDown);
|
|
2182
2298
|
}, [open]);
|
|
2183
2299
|
const toggle = () => setOpen((v) => {
|
|
2184
|
-
if (!v) _optionalChain([onOpen, 'optionalCall',
|
|
2300
|
+
if (!v) _optionalChain([onOpen, 'optionalCall', _111 => _111()]);
|
|
2185
2301
|
return !v;
|
|
2186
2302
|
});
|
|
2187
2303
|
const close = () => setOpen(false);
|
|
@@ -2315,7 +2431,7 @@ function ColorPicker({ label, icon, colors, current, disabled, resetLabel, onPic
|
|
|
2315
2431
|
style: { background: c },
|
|
2316
2432
|
"aria-label": c,
|
|
2317
2433
|
title: c,
|
|
2318
|
-
"data-active": _optionalChain([current, 'optionalAccess',
|
|
2434
|
+
"data-active": _optionalChain([current, 'optionalAccess', _112 => _112.toLowerCase, 'call', _113 => _113()]) === c ? true : void 0,
|
|
2319
2435
|
onMouseDown: (e) => e.preventDefault(),
|
|
2320
2436
|
onClick: () => {
|
|
2321
2437
|
onPick(c);
|
|
@@ -2429,7 +2545,7 @@ function ImagePanel({ editor, close, onNotice }) {
|
|
|
2429
2545
|
{
|
|
2430
2546
|
type: "button",
|
|
2431
2547
|
className: "june-doc__dropzone",
|
|
2432
|
-
onClick: () => _optionalChain([file, 'access',
|
|
2548
|
+
onClick: () => _optionalChain([file, 'access', _114 => _114.current, 'optionalAccess', _115 => _115.click, 'call', _116 => _116()]),
|
|
2433
2549
|
onDragOver: (e) => e.preventDefault(),
|
|
2434
2550
|
onDrop: (e) => {
|
|
2435
2551
|
e.preventDefault();
|
|
@@ -2448,7 +2564,7 @@ function ImagePanel({ editor, close, onNotice }) {
|
|
|
2448
2564
|
type: "file",
|
|
2449
2565
|
accept: "image/*",
|
|
2450
2566
|
hidden: true,
|
|
2451
|
-
onChange: (e) => fromFile(_optionalChain([e, 'access',
|
|
2567
|
+
onChange: (e) => fromFile(_optionalChain([e, 'access', _117 => _117.target, 'access', _118 => _118.files, 'optionalAccess', _119 => _119[0]]))
|
|
2452
2568
|
}
|
|
2453
2569
|
),
|
|
2454
2570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc__or", children: "or" }),
|
|
@@ -2553,9 +2669,9 @@ function DocumentToolbar(props) {
|
|
|
2553
2669
|
};
|
|
2554
2670
|
}
|
|
2555
2671
|
});
|
|
2556
|
-
const run = () => _optionalChain([editor, 'optionalAccess',
|
|
2672
|
+
const run = () => _optionalChain([editor, 'optionalAccess', _120 => _120.chain, 'call', _121 => _121(), 'access', _122 => _122.focus, 'call', _123 => _123()]);
|
|
2557
2673
|
const off = !editor || !editable;
|
|
2558
|
-
const style = _optionalChain([s, 'optionalAccess',
|
|
2674
|
+
const style = _optionalChain([s, 'optionalAccess', _124 => _124.codeBlock]) ? "code" : _optionalChain([s, 'optionalAccess', _125 => _125.h1]) ? "1" : _optionalChain([s, 'optionalAccess', _126 => _126.h2]) ? "2" : _optionalChain([s, 'optionalAccess', _127 => _127.h3]) ? "3" : _optionalChain([s, 'optionalAccess', _128 => _128.quote]) ? "quote" : "p";
|
|
2559
2675
|
const setStyle = (v) => {
|
|
2560
2676
|
if (!editor || !s) return;
|
|
2561
2677
|
let c = editor.chain().focus();
|
|
@@ -2569,35 +2685,35 @@ function DocumentToolbar(props) {
|
|
|
2569
2685
|
}
|
|
2570
2686
|
c.run();
|
|
2571
2687
|
};
|
|
2572
|
-
const fontKnown = FONT_FAMILIES.some((f) => f.value === _optionalChain([s, 'optionalAccess',
|
|
2573
|
-
const sizes = _optionalChain([s, 'optionalAccess',
|
|
2688
|
+
const fontKnown = FONT_FAMILIES.some((f) => f.value === _optionalChain([s, 'optionalAccess', _129 => _129.fontFamily]));
|
|
2689
|
+
const sizes = _optionalChain([s, 'optionalAccess', _130 => _130.fontSize]) && !FONT_SIZES.includes(Number(s.fontSize)) ? [...FONT_SIZES, Number(s.fontSize)].sort((a, b) => a - b) : FONT_SIZES;
|
|
2574
2690
|
if (!editable) return null;
|
|
2575
2691
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc__ribbon", role: "toolbar", "aria-label": "Document formatting", children: [
|
|
2576
2692
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc__row", children: [
|
|
2577
2693
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "History", children: [
|
|
2578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Undo", icon: "undo", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Redo", icon: "redo", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Undo", icon: "undo", disabled: off || !_optionalChain([s, 'optionalAccess', _131 => _131.canUndo]), onClick: () => _optionalChain([run, 'call', _132 => _132(), 'optionalAccess', _133 => _133.undo, 'call', _134 => _134(), 'access', _135 => _135.run, 'call', _136 => _136()]) }),
|
|
2695
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Redo", icon: "redo", disabled: off || !_optionalChain([s, 'optionalAccess', _137 => _137.canRedo]), onClick: () => _optionalChain([run, 'call', _138 => _138(), 'optionalAccess', _139 => _139.redo, 'call', _140 => _140(), 'access', _141 => _141.run, 'call', _142 => _142()]) })
|
|
2580
2696
|
] }),
|
|
2581
2697
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Format", children: [
|
|
2582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bold", icon: "bold", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Italic", icon: "italic", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2584
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Underline", icon: "underline", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Strikethrough", icon: "strike", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Inline code", icon: "code", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Superscript", icon: "superscript", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Subscript", icon: "subscript", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bold", icon: "bold", toggle: true, active: _optionalChain([s, 'optionalAccess', _143 => _143.bold]), disabled: off, onClick: () => _optionalChain([run, 'call', _144 => _144(), 'optionalAccess', _145 => _145.toggleBold, 'call', _146 => _146(), 'access', _147 => _147.run, 'call', _148 => _148()]) }),
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Italic", icon: "italic", toggle: true, active: _optionalChain([s, 'optionalAccess', _149 => _149.italic]), disabled: off, onClick: () => _optionalChain([run, 'call', _150 => _150(), 'optionalAccess', _151 => _151.toggleItalic, 'call', _152 => _152(), 'access', _153 => _153.run, 'call', _154 => _154()]) }),
|
|
2700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Underline", icon: "underline", toggle: true, active: _optionalChain([s, 'optionalAccess', _155 => _155.underline]), disabled: off, onClick: () => _optionalChain([run, 'call', _156 => _156(), 'optionalAccess', _157 => _157.toggleUnderline, 'call', _158 => _158(), 'access', _159 => _159.run, 'call', _160 => _160()]) }),
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Strikethrough", icon: "strike", toggle: true, active: _optionalChain([s, 'optionalAccess', _161 => _161.strike]), disabled: off, onClick: () => _optionalChain([run, 'call', _162 => _162(), 'optionalAccess', _163 => _163.toggleStrike, 'call', _164 => _164(), 'access', _165 => _165.run, 'call', _166 => _166()]) }),
|
|
2702
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Inline code", icon: "code", toggle: true, active: _optionalChain([s, 'optionalAccess', _167 => _167.code]), disabled: off, onClick: () => _optionalChain([run, 'call', _168 => _168(), 'optionalAccess', _169 => _169.toggleCode, 'call', _170 => _170(), 'access', _171 => _171.run, 'call', _172 => _172()]) }),
|
|
2703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Superscript", icon: "superscript", toggle: true, active: _optionalChain([s, 'optionalAccess', _173 => _173.sup]), disabled: off, onClick: () => _optionalChain([run, 'call', _174 => _174(), 'optionalAccess', _175 => _175.toggleSuperscript, 'call', _176 => _176(), 'access', _177 => _177.run, 'call', _178 => _178()]) }),
|
|
2704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Subscript", icon: "subscript", toggle: true, active: _optionalChain([s, 'optionalAccess', _179 => _179.sub]), disabled: off, onClick: () => _optionalChain([run, 'call', _180 => _180(), 'optionalAccess', _181 => _181.toggleSubscript, 'call', _182 => _182(), 'access', _183 => _183.run, 'call', _184 => _184()]) })
|
|
2589
2705
|
] }),
|
|
2590
2706
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Align", children: [
|
|
2591
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align left", icon: "alignLeft", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2592
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align center", icon: "alignCenter", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2593
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align right", icon: "alignRight", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2594
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Justify", icon: "alignJustify", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2707
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align left", icon: "alignLeft", toggle: true, active: _optionalChain([s, 'optionalAccess', _185 => _185.left]), disabled: off, onClick: () => _optionalChain([run, 'call', _186 => _186(), 'optionalAccess', _187 => _187.setTextAlign, 'call', _188 => _188("left"), 'access', _189 => _189.run, 'call', _190 => _190()]) }),
|
|
2708
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align center", icon: "alignCenter", toggle: true, active: _optionalChain([s, 'optionalAccess', _191 => _191.center]), disabled: off, onClick: () => _optionalChain([run, 'call', _192 => _192(), 'optionalAccess', _193 => _193.setTextAlign, 'call', _194 => _194("center"), 'access', _195 => _195.run, 'call', _196 => _196()]) }),
|
|
2709
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align right", icon: "alignRight", toggle: true, active: _optionalChain([s, 'optionalAccess', _197 => _197.right]), disabled: off, onClick: () => _optionalChain([run, 'call', _198 => _198(), 'optionalAccess', _199 => _199.setTextAlign, 'call', _200 => _200("right"), 'access', _201 => _201.run, 'call', _202 => _202()]) }),
|
|
2710
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Justify", icon: "alignJustify", toggle: true, active: _optionalChain([s, 'optionalAccess', _203 => _203.justify]), disabled: off, onClick: () => _optionalChain([run, 'call', _204 => _204(), 'optionalAccess', _205 => _205.setTextAlign, 'call', _206 => _206("justify"), 'access', _207 => _207.run, 'call', _208 => _208()]) })
|
|
2595
2711
|
] }),
|
|
2596
2712
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Lists", children: [
|
|
2597
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bullet list", icon: "list", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Numbered list", icon: "listOrdered", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Decrease indent", icon: "outdent", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Increase indent", icon: "indent", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bullet list", icon: "list", toggle: true, active: _optionalChain([s, 'optionalAccess', _209 => _209.bullet]), disabled: off, onClick: () => _optionalChain([run, 'call', _210 => _210(), 'optionalAccess', _211 => _211.toggleBulletList, 'call', _212 => _212(), 'access', _213 => _213.run, 'call', _214 => _214()]) }),
|
|
2714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Numbered list", icon: "listOrdered", toggle: true, active: _optionalChain([s, 'optionalAccess', _215 => _215.ordered]), disabled: off, onClick: () => _optionalChain([run, 'call', _216 => _216(), 'optionalAccess', _217 => _217.toggleOrderedList, 'call', _218 => _218(), 'access', _219 => _219.run, 'call', _220 => _220()]) }),
|
|
2715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Decrease indent", icon: "outdent", disabled: off || !_optionalChain([s, 'optionalAccess', _221 => _221.canLift]), onClick: () => _optionalChain([run, 'call', _222 => _222(), 'optionalAccess', _223 => _223.liftListItem, 'call', _224 => _224("listItem"), 'access', _225 => _225.run, 'call', _226 => _226()]) }),
|
|
2716
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Increase indent", icon: "indent", disabled: off || !_optionalChain([s, 'optionalAccess', _227 => _227.canSink]), onClick: () => _optionalChain([run, 'call', _228 => _228(), 'optionalAccess', _229 => _229.sinkListItem, 'call', _230 => _230("listItem"), 'access', _231 => _231.run, 'call', _232 => _232()]) })
|
|
2601
2717
|
] }),
|
|
2602
2718
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2603
2719
|
"button",
|
|
@@ -2631,15 +2747,15 @@ function DocumentToolbar(props) {
|
|
|
2631
2747
|
className: "june-doc__select june-doc__select--font",
|
|
2632
2748
|
"aria-label": "Font family",
|
|
2633
2749
|
disabled: off,
|
|
2634
|
-
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2750
|
+
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _233 => _233.fontFamily]), () => ( "")),
|
|
2635
2751
|
onChange: (e) => {
|
|
2636
2752
|
const v = e.target.value;
|
|
2637
|
-
if (v) _optionalChain([run, 'call',
|
|
2638
|
-
else _optionalChain([run, 'call',
|
|
2753
|
+
if (v) _optionalChain([run, 'call', _234 => _234(), 'optionalAccess', _235 => _235.setFontFamily, 'call', _236 => _236(v), 'access', _237 => _237.run, 'call', _238 => _238()]);
|
|
2754
|
+
else _optionalChain([run, 'call', _239 => _239(), 'optionalAccess', _240 => _240.unsetFontFamily, 'call', _241 => _241(), 'access', _242 => _242.run, 'call', _243 => _243()]);
|
|
2639
2755
|
},
|
|
2640
2756
|
children: [
|
|
2641
2757
|
FONT_FAMILIES.map((f) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: f.value, style: { fontFamily: f.value || void 0 }, children: f.label }, f.label)),
|
|
2642
|
-
!fontKnown && _optionalChain([s, 'optionalAccess',
|
|
2758
|
+
!fontKnown && _optionalChain([s, 'optionalAccess', _244 => _244.fontFamily]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: s.fontFamily, children: s.fontFamily.split(",")[0].replace(/['"]/g, "") }) : null
|
|
2643
2759
|
]
|
|
2644
2760
|
}
|
|
2645
2761
|
) }),
|
|
@@ -2649,11 +2765,11 @@ function DocumentToolbar(props) {
|
|
|
2649
2765
|
className: "june-doc__select june-doc__select--size",
|
|
2650
2766
|
"aria-label": "Font size",
|
|
2651
2767
|
disabled: off,
|
|
2652
|
-
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2768
|
+
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _245 => _245.fontSize]), () => ( "")),
|
|
2653
2769
|
onChange: (e) => {
|
|
2654
2770
|
const v = e.target.value;
|
|
2655
|
-
if (v) _optionalChain([run, 'call',
|
|
2656
|
-
else _optionalChain([run, 'call',
|
|
2771
|
+
if (v) _optionalChain([run, 'call', _246 => _246(), 'optionalAccess', _247 => _247.setFontSize, 'call', _248 => _248(`${v}px`), 'access', _249 => _249.run, 'call', _250 => _250()]);
|
|
2772
|
+
else _optionalChain([run, 'call', _251 => _251(), 'optionalAccess', _252 => _252.unsetFontSize, 'call', _253 => _253(), 'access', _254 => _254.run, 'call', _255 => _255()]);
|
|
2657
2773
|
},
|
|
2658
2774
|
children: [
|
|
2659
2775
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "", children: "Auto" }),
|
|
@@ -2664,8 +2780,8 @@ function DocumentToolbar(props) {
|
|
|
2664
2780
|
] }),
|
|
2665
2781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Show formatting marks", icon: "pilcrow", toggle: true, active: showMarks, onClick: onToggleMarks, text: true, className: "june-doc__btn--marks", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Paragraph" }) }),
|
|
2666
2782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Document", children: [
|
|
2667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert page break", icon: "pageBreak", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert divider", icon: "divider", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert page break", icon: "pageBreak", disabled: off, onClick: () => _optionalChain([run, 'call', _256 => _256(), 'optionalAccess', _257 => _257.setPageBreak, 'call', _258 => _258(), 'access', _259 => _259.run, 'call', _260 => _260()]) }),
|
|
2784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert divider", icon: "divider", disabled: off, onClick: () => _optionalChain([run, 'call', _261 => _261(), 'optionalAccess', _262 => _262.setHorizontalRule, 'call', _263 => _263(), 'access', _264 => _264.run, 'call', _265 => _265()]) }),
|
|
2669
2785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: layout === "page" ? "Switch to full-width layout" : "Switch to page layout", icon: "layout", toggle: true, active: layout === "fluid", onClick: onToggleLayout }),
|
|
2670
2786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Find and replace", icon: "search", toggle: true, active: findOpen, onClick: onToggleFind })
|
|
2671
2787
|
] }),
|
|
@@ -2676,11 +2792,11 @@ function DocumentToolbar(props) {
|
|
|
2676
2792
|
label: "Text color",
|
|
2677
2793
|
icon: "palette",
|
|
2678
2794
|
colors: TEXT_COLORS,
|
|
2679
|
-
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2795
|
+
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _266 => _266.color]), () => ( null)),
|
|
2680
2796
|
disabled: off,
|
|
2681
2797
|
resetLabel: "Default color",
|
|
2682
|
-
onPick: (c) => _optionalChain([run, 'call',
|
|
2683
|
-
onReset: () => _optionalChain([run, 'call',
|
|
2798
|
+
onPick: (c) => _optionalChain([run, 'call', _267 => _267(), 'optionalAccess', _268 => _268.setColor, 'call', _269 => _269(c), 'access', _270 => _270.run, 'call', _271 => _271()]),
|
|
2799
|
+
onReset: () => _optionalChain([run, 'call', _272 => _272(), 'optionalAccess', _273 => _273.unsetColor, 'call', _274 => _274(), 'access', _275 => _275.run, 'call', _276 => _276()])
|
|
2684
2800
|
}
|
|
2685
2801
|
),
|
|
2686
2802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2689,11 +2805,11 @@ function DocumentToolbar(props) {
|
|
|
2689
2805
|
label: "Highlight",
|
|
2690
2806
|
icon: "highlighter",
|
|
2691
2807
|
colors: HIGHLIGHT_COLORS,
|
|
2692
|
-
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2808
|
+
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _277 => _277.highlight]), () => ( null)),
|
|
2693
2809
|
disabled: off,
|
|
2694
2810
|
resetLabel: "No highlight",
|
|
2695
|
-
onPick: (c) => _optionalChain([run, 'call',
|
|
2696
|
-
onReset: () => _optionalChain([run, 'call',
|
|
2811
|
+
onPick: (c) => _optionalChain([run, 'call', _278 => _278(), 'optionalAccess', _279 => _279.setHighlight, 'call', _280 => _280({ color: c }), 'access', _281 => _281.run, 'call', _282 => _282()]),
|
|
2812
|
+
onReset: () => _optionalChain([run, 'call', _283 => _283(), 'optionalAccess', _284 => _284.unsetHighlight, 'call', _285 => _285(), 'access', _286 => _286.run, 'call', _287 => _287()])
|
|
2697
2813
|
}
|
|
2698
2814
|
)
|
|
2699
2815
|
] }),
|
|
@@ -2701,24 +2817,24 @@ function DocumentToolbar(props) {
|
|
|
2701
2817
|
editor ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2702
2818
|
Dropdown,
|
|
2703
2819
|
{
|
|
2704
|
-
trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Link", icon: "link", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2705
|
-
children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkPanel, { editor, href: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2820
|
+
trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Link", icon: "link", toggle: true, active: _optionalChain([s, 'optionalAccess', _288 => _288.link]) || open, disabled: off, onClick: toggle }),
|
|
2821
|
+
children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkPanel, { editor, href: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _289 => _289.linkHref]), () => ( "")), isLink: !!_optionalChain([s, 'optionalAccess', _290 => _290.link]), close })
|
|
2706
2822
|
}
|
|
2707
2823
|
) : null,
|
|
2708
2824
|
editor ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dropdown, { trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert image", icon: "image", active: open, disabled: off, onClick: toggle }), children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ImagePanel, { editor, close, onNotice }) }) : null,
|
|
2709
2825
|
editor ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dropdown, { trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert table", icon: "table", active: open, disabled: off, onClick: toggle }), children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TablePanel, { editor, close }) }) : null
|
|
2710
2826
|
] }),
|
|
2711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Group, { label: "Actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Clear formatting", icon: "eraser", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Group, { label: "Actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Clear formatting", icon: "eraser", disabled: off, onClick: () => _optionalChain([run, 'call', _291 => _291(), 'optionalAccess', _292 => _292.unsetAllMarks, 'call', _293 => _293(), 'access', _294 => _294.clearNodes, 'call', _295 => _295(), 'access', _296 => _296.run, 'call', _297 => _297()]) }) })
|
|
2712
2828
|
] }) : null,
|
|
2713
|
-
_optionalChain([s, 'optionalAccess',
|
|
2714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add row below", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2715
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add column right", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2716
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete row", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2717
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete column", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Merge cells", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2719
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Split cell", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2720
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Toggle header row", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2721
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete table", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2829
|
+
_optionalChain([s, 'optionalAccess', _298 => _298.inTable]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc__row june-doc__row--context", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Table", children: [
|
|
2830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add row below", disabled: off, onClick: () => _optionalChain([run, 'call', _299 => _299(), 'optionalAccess', _300 => _300.addRowAfter, 'call', _301 => _301(), 'access', _302 => _302.run, 'call', _303 => _303()]), children: "+ Row" }),
|
|
2831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add column right", disabled: off, onClick: () => _optionalChain([run, 'call', _304 => _304(), 'optionalAccess', _305 => _305.addColumnAfter, 'call', _306 => _306(), 'access', _307 => _307.run, 'call', _308 => _308()]), children: "+ Column" }),
|
|
2832
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete row", disabled: off, onClick: () => _optionalChain([run, 'call', _309 => _309(), 'optionalAccess', _310 => _310.deleteRow, 'call', _311 => _311(), 'access', _312 => _312.run, 'call', _313 => _313()]), children: "\u2212 Row" }),
|
|
2833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete column", disabled: off, onClick: () => _optionalChain([run, 'call', _314 => _314(), 'optionalAccess', _315 => _315.deleteColumn, 'call', _316 => _316(), 'access', _317 => _317.run, 'call', _318 => _318()]), children: "\u2212 Column" }),
|
|
2834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Merge cells", disabled: off || !_optionalChain([s, 'optionalAccess', _319 => _319.canMerge]), onClick: () => _optionalChain([run, 'call', _320 => _320(), 'optionalAccess', _321 => _321.mergeCells, 'call', _322 => _322(), 'access', _323 => _323.run, 'call', _324 => _324()]), children: "Merge" }),
|
|
2835
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Split cell", disabled: off || !_optionalChain([s, 'optionalAccess', _325 => _325.canSplit]), onClick: () => _optionalChain([run, 'call', _326 => _326(), 'optionalAccess', _327 => _327.splitCell, 'call', _328 => _328(), 'access', _329 => _329.run, 'call', _330 => _330()]), children: "Split" }),
|
|
2836
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Toggle header row", disabled: off, onClick: () => _optionalChain([run, 'call', _331 => _331(), 'optionalAccess', _332 => _332.toggleHeaderRow, 'call', _333 => _333(), 'access', _334 => _334.run, 'call', _335 => _335()]), children: "Header row" }),
|
|
2837
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete table", disabled: off, onClick: () => _optionalChain([run, 'call', _336 => _336(), 'optionalAccess', _337 => _337.deleteTable, 'call', _338 => _338(), 'access', _339 => _339.run, 'call', _340 => _340()]), className: "june-doc__btn--danger", children: "Delete table" })
|
|
2722
2838
|
] }) }) : null
|
|
2723
2839
|
] });
|
|
2724
2840
|
}
|
|
@@ -2859,7 +2975,7 @@ function DocumentContent({ editor, layout = "page", zoom = 1, showMarks = false,
|
|
|
2859
2975
|
const page = paged ? Math.min(total, Math.max(1, Math.floor(y / stride) + 1)) : 1;
|
|
2860
2976
|
if (last.current.page !== page || last.current.pages !== total) {
|
|
2861
2977
|
last.current = { page, pages: total };
|
|
2862
|
-
_optionalChain([metricsRef, 'access',
|
|
2978
|
+
_optionalChain([metricsRef, 'access', _341 => _341.current, 'optionalCall', _342 => _342({ page, pages: total })]);
|
|
2863
2979
|
}
|
|
2864
2980
|
};
|
|
2865
2981
|
report();
|
|
@@ -2868,12 +2984,12 @@ function DocumentContent({ editor, layout = "page", zoom = 1, showMarks = false,
|
|
|
2868
2984
|
const onLoad = () => _chunkG6YPSE6Jcjs.remeasurePagination.call(void 0, editor);
|
|
2869
2985
|
prose.addEventListener("load", onLoad, true);
|
|
2870
2986
|
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(report) : null;
|
|
2871
|
-
_optionalChain([ro, 'optionalAccess',
|
|
2987
|
+
_optionalChain([ro, 'optionalAccess', _343 => _343.observe, 'call', _344 => _344(s)]);
|
|
2872
2988
|
return () => {
|
|
2873
2989
|
editor.off("transaction", report);
|
|
2874
2990
|
c.removeEventListener("scroll", report);
|
|
2875
2991
|
prose.removeEventListener("load", onLoad, true);
|
|
2876
|
-
_optionalChain([ro, 'optionalAccess',
|
|
2992
|
+
_optionalChain([ro, 'optionalAccess', _345 => _345.disconnect, 'call', _346 => _346()]);
|
|
2877
2993
|
};
|
|
2878
2994
|
}, [editor, paged, zoom, stride]);
|
|
2879
2995
|
const minHeight = paged ? pages * g.height + (pages - 1) * PAGE_GAP : void 0;
|
|
@@ -2914,12 +3030,12 @@ function DocumentFindBar({ editor, editable, onClose, onNotice }) {
|
|
|
2914
3030
|
editor,
|
|
2915
3031
|
selector: ({ editor: ed }) => {
|
|
2916
3032
|
const s = _chunkG6YPSE6Jcjs.getSearchState.call(void 0, ed);
|
|
2917
|
-
return { count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
3033
|
+
return { count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _347 => _347.matches, 'access', _348 => _348.length]), () => ( 0)), current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _349 => _349.current]), () => ( -1)) };
|
|
2918
3034
|
}
|
|
2919
3035
|
});
|
|
2920
3036
|
_react.useEffect.call(void 0, () => {
|
|
2921
|
-
_optionalChain([input, 'access',
|
|
2922
|
-
_optionalChain([input, 'access',
|
|
3037
|
+
_optionalChain([input, 'access', _350 => _350.current, 'optionalAccess', _351 => _351.focus, 'call', _352 => _352()]);
|
|
3038
|
+
_optionalChain([input, 'access', _353 => _353.current, 'optionalAccess', _354 => _354.select, 'call', _355 => _355()]);
|
|
2923
3039
|
}, []);
|
|
2924
3040
|
_react.useEffect.call(void 0, () => {
|
|
2925
3041
|
_chunkG6YPSE6Jcjs.setSearch.call(void 0, editor, { term, caseSensitive, current: 0 });
|
|
@@ -2927,8 +3043,8 @@ function DocumentFindBar({ editor, editable, onClose, onNotice }) {
|
|
|
2927
3043
|
_react.useEffect.call(void 0, () => () => {
|
|
2928
3044
|
if (!editor.isDestroyed) _chunkG6YPSE6Jcjs.setSearch.call(void 0, editor, { term: "" });
|
|
2929
3045
|
}, [editor]);
|
|
2930
|
-
const count = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
2931
|
-
const current = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
3046
|
+
const count = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _356 => _356.count]), () => ( 0));
|
|
3047
|
+
const current = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _357 => _357.current]), () => ( -1));
|
|
2932
3048
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2933
3049
|
"div",
|
|
2934
3050
|
{
|
|
@@ -3206,12 +3322,12 @@ function toHalfPoints(value) {
|
|
|
3206
3322
|
if (!m) return void 0;
|
|
3207
3323
|
const n = Number(m[1]);
|
|
3208
3324
|
if (!Number.isFinite(n) || n <= 0) return void 0;
|
|
3209
|
-
const pt = _optionalChain([m, 'access',
|
|
3325
|
+
const pt = _optionalChain([m, 'access', _358 => _358[2], 'optionalAccess', _359 => _359.toLowerCase, 'call', _360 => _360()]) === "pt" ? n : n * 0.75;
|
|
3210
3326
|
return Math.round(pt * 2);
|
|
3211
3327
|
}
|
|
3212
3328
|
function firstFontFamily(value) {
|
|
3213
3329
|
if (typeof value !== "string") return void 0;
|
|
3214
|
-
const first = _optionalChain([value, 'access',
|
|
3330
|
+
const first = _optionalChain([value, 'access', _361 => _361.split, 'call', _362 => _362(","), 'access', _363 => _363[0], 'optionalAccess', _364 => _364.trim, 'call', _365 => _365(), 'access', _366 => _366.replace, 'call', _367 => _367(/^['"]|['"]$/g, "")]);
|
|
3215
3331
|
return first || void 0;
|
|
3216
3332
|
}
|
|
3217
3333
|
var ORDERED_REF = "june-ordered";
|
|
@@ -3227,9 +3343,9 @@ function runs(d, node, fmt) {
|
|
|
3227
3343
|
const marks = _nullishCoalesce(child.marks, () => ( []));
|
|
3228
3344
|
const has = (type) => marks.some((m) => m.type === type);
|
|
3229
3345
|
const link = marks.find((m) => m.type === "link");
|
|
3230
|
-
const style = _nullishCoalesce(_optionalChain([marks, 'access',
|
|
3346
|
+
const style = _nullishCoalesce(_optionalChain([marks, 'access', _368 => _368.find, 'call', _369 => _369((m) => m.type === "textStyle"), 'optionalAccess', _370 => _370.attrs]), () => ( {}));
|
|
3231
3347
|
const highlight = marks.find((m) => m.type === "highlight");
|
|
3232
|
-
const fill = highlight ? _nullishCoalesce(toDocxColor(_optionalChain([highlight, 'access',
|
|
3348
|
+
const fill = highlight ? _nullishCoalesce(toDocxColor(_optionalChain([highlight, 'access', _371 => _371.attrs, 'optionalAccess', _372 => _372.color])), () => ( "FFF59D")) : void 0;
|
|
3233
3349
|
const run = new d.TextRun({
|
|
3234
3350
|
text: child.text,
|
|
3235
3351
|
bold: fmt.bold || has("bold") || void 0,
|
|
@@ -3243,13 +3359,13 @@ function runs(d, node, fmt) {
|
|
|
3243
3359
|
color: _nullishCoalesce(toDocxColor(style.color), () => ( (link ? "0563C1" : void 0))),
|
|
3244
3360
|
shading: fill ? { type: d.ShadingType.CLEAR, fill, color: "auto" } : void 0
|
|
3245
3361
|
});
|
|
3246
|
-
const href = typeof _optionalChain([link, 'optionalAccess',
|
|
3362
|
+
const href = typeof _optionalChain([link, 'optionalAccess', _373 => _373.attrs, 'optionalAccess', _374 => _374.href]) === "string" ? _chunkG6YPSE6Jcjs.sanitizeHref.call(void 0, link.attrs.href) : null;
|
|
3247
3363
|
out.push(href ? new d.ExternalHyperlink({ link: href, children: [run] }) : run);
|
|
3248
3364
|
}
|
|
3249
3365
|
return out;
|
|
3250
3366
|
}
|
|
3251
3367
|
function paragraph(d, node, fmt, extra = {}) {
|
|
3252
|
-
const align = _optionalChain([node, 'access',
|
|
3368
|
+
const align = _optionalChain([node, 'access', _375 => _375.attrs, 'optionalAccess', _376 => _376.textAlign]);
|
|
3253
3369
|
return new d.Paragraph({
|
|
3254
3370
|
children: runs(d, node, fmt),
|
|
3255
3371
|
alignment: align === "center" ? d.AlignmentType.CENTER : align === "right" ? d.AlignmentType.RIGHT : align === "justify" ? d.AlignmentType.JUSTIFIED : void 0,
|
|
@@ -3311,8 +3427,8 @@ function table(d, node, state) {
|
|
|
3311
3427
|
return new d.Table({ rows, width: { size: 100, type: d.WidthType.PERCENTAGE } });
|
|
3312
3428
|
}
|
|
3313
3429
|
function image(d, node, state) {
|
|
3314
|
-
const src = typeof _optionalChain([node, 'access',
|
|
3315
|
-
const alt = typeof _optionalChain([node, 'access',
|
|
3430
|
+
const src = typeof _optionalChain([node, 'access', _377 => _377.attrs, 'optionalAccess', _378 => _378.src]) === "string" ? node.attrs.src : "";
|
|
3431
|
+
const alt = typeof _optionalChain([node, 'access', _379 => _379.attrs, 'optionalAccess', _380 => _380.alt]) === "string" ? node.attrs.alt : "";
|
|
3316
3432
|
const img = state.images.get(src);
|
|
3317
3433
|
if (img) {
|
|
3318
3434
|
return [
|
|
@@ -3344,7 +3460,7 @@ function image(d, node, state) {
|
|
|
3344
3460
|
}
|
|
3345
3461
|
function collectImages(nodes, out) {
|
|
3346
3462
|
for (const node of _nullishCoalesce(nodes, () => ( []))) {
|
|
3347
|
-
const src = _optionalChain([node, 'access',
|
|
3463
|
+
const src = _optionalChain([node, 'access', _381 => _381.attrs, 'optionalAccess', _382 => _382.src]);
|
|
3348
3464
|
if (node.type === "image" && typeof src === "string" && src && !out.has(src)) out.set(src, node.attrs);
|
|
3349
3465
|
if (node.content) collectImages(node.content, out);
|
|
3350
3466
|
}
|
|
@@ -3381,8 +3497,8 @@ async function loadImage(src, attrs) {
|
|
|
3381
3497
|
const type = IMAGE_TYPES[blob.type.toLowerCase()];
|
|
3382
3498
|
if (!type) return null;
|
|
3383
3499
|
const natural = await naturalSize(blob);
|
|
3384
|
-
let width = Number(_optionalChain([attrs, 'optionalAccess',
|
|
3385
|
-
let height = Number(_optionalChain([attrs, 'optionalAccess',
|
|
3500
|
+
let width = Number(_optionalChain([attrs, 'optionalAccess', _383 => _383.width])) || natural.width;
|
|
3501
|
+
let height = Number(_optionalChain([attrs, 'optionalAccess', _384 => _384.height])) || natural.height * width / natural.width;
|
|
3386
3502
|
if (width > MAX_IMAGE_WIDTH) {
|
|
3387
3503
|
height = height * MAX_IMAGE_WIDTH / width;
|
|
3388
3504
|
width = MAX_IMAGE_WIDTH;
|
|
@@ -3413,7 +3529,7 @@ function blocks(d, nodes, fmt, state) {
|
|
|
3413
3529
|
out.push(paragraph(d, node, fmt));
|
|
3414
3530
|
break;
|
|
3415
3531
|
case "heading": {
|
|
3416
|
-
const level = Math.min(Math.max(Number(_optionalChain([node, 'access',
|
|
3532
|
+
const level = Math.min(Math.max(Number(_optionalChain([node, 'access', _385 => _385.attrs, 'optionalAccess', _386 => _386.level])) || 1, 1), 3);
|
|
3417
3533
|
out.push(paragraph(d, node, fmt, { heading: headings[level - 1] }));
|
|
3418
3534
|
break;
|
|
3419
3535
|
}
|
|
@@ -3547,7 +3663,7 @@ async function copyDocumentToClipboard(doc) {
|
|
|
3547
3663
|
|
|
3548
3664
|
${docToText(doc.json)}`;
|
|
3549
3665
|
try {
|
|
3550
|
-
if (typeof ClipboardItem !== "undefined" && _optionalChain([navigator, 'access',
|
|
3666
|
+
if (typeof ClipboardItem !== "undefined" && _optionalChain([navigator, 'access', _387 => _387.clipboard, 'optionalAccess', _388 => _388.write])) {
|
|
3551
3667
|
await navigator.clipboard.write([
|
|
3552
3668
|
new ClipboardItem({
|
|
3553
3669
|
"text/html": new Blob([html], { type: "text/html" }),
|
|
@@ -3620,12 +3736,12 @@ function DocumentEditorImpl(props) {
|
|
|
3620
3736
|
}
|
|
3621
3737
|
}, [contentKey]);
|
|
3622
3738
|
_react.useEffect.call(void 0, () => {
|
|
3623
|
-
if (parsed.error) _optionalChain([optionsRef, 'access',
|
|
3739
|
+
if (parsed.error) _optionalChain([optionsRef, 'access', _389 => _389.current, 'access', _390 => _390.onError, 'optionalCall', _391 => _391(parsed.error)]);
|
|
3624
3740
|
}, [parsed.error]);
|
|
3625
|
-
const title = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3626
|
-
const pending = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3741
|
+
const title = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _392 => _392.title]), () => ( titleProp)));
|
|
3742
|
+
const pending = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _393 => _393.pending]), () => ( null)));
|
|
3627
3743
|
const words = useDocumentValue(store, documentId, (r) => r ? _chunkG6YPSE6Jcjs.wordCountOf.call(void 0, r.json) : 0);
|
|
3628
|
-
const recordStatus = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3744
|
+
const recordStatus = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _394 => _394.status]), () => ( status)));
|
|
3629
3745
|
const [saveState, setSaveState] = _react.useState.call(void 0, "idle");
|
|
3630
3746
|
const [notice, setNotice] = _react.useState.call(void 0, null);
|
|
3631
3747
|
const [fullscreen, setFullscreen] = _react.useState.call(void 0, false);
|
|
@@ -3644,7 +3760,7 @@ function DocumentEditorImpl(props) {
|
|
|
3644
3760
|
};
|
|
3645
3761
|
}, [fullscreen]);
|
|
3646
3762
|
const lastSavedKey = _react.useRef.call(void 0, "");
|
|
3647
|
-
const seenRevision = _react.useRef.call(void 0, _nullishCoalesce(_optionalChain([store, 'access',
|
|
3763
|
+
const seenRevision = _react.useRef.call(void 0, _nullishCoalesce(_optionalChain([store, 'access', _395 => _395.get, 'call', _396 => _396(documentId), 'optionalAccess', _397 => _397.revision]), () => ( 0)));
|
|
3648
3764
|
const readyRef = _react.useRef.call(void 0, false);
|
|
3649
3765
|
const flash = _react.useCallback.call(void 0, (message) => {
|
|
3650
3766
|
setNotice(message);
|
|
@@ -3657,7 +3773,7 @@ function DocumentEditorImpl(props) {
|
|
|
3657
3773
|
const emitChange = _react.useCallback.call(void 0,
|
|
3658
3774
|
(source) => {
|
|
3659
3775
|
const record = store.get(documentId);
|
|
3660
|
-
if (record) _optionalChain([optionsRef, 'access',
|
|
3776
|
+
if (record) _optionalChain([optionsRef, 'access', _398 => _398.current, 'access', _399 => _399.onDocumentChange, 'optionalCall', _400 => _400({ ...snapshotOf(record), source })]);
|
|
3661
3777
|
},
|
|
3662
3778
|
[store, documentId]
|
|
3663
3779
|
);
|
|
@@ -3667,7 +3783,7 @@ function DocumentEditorImpl(props) {
|
|
|
3667
3783
|
const delay = _nullishCoalesce(options.autosaveDelay, () => ( 1500));
|
|
3668
3784
|
return delay > 0 ? _chunkG6YPSE6Jcjs.debounce.call(void 0, () => void saveRef.current(), delay) : null;
|
|
3669
3785
|
}, [options.autosaveDelay]);
|
|
3670
|
-
_react.useEffect.call(void 0, () => () => _optionalChain([autosave, 'optionalAccess',
|
|
3786
|
+
_react.useEffect.call(void 0, () => () => _optionalChain([autosave, 'optionalAccess', _401 => _401.flush, 'call', _402 => _402()]), [autosave]);
|
|
3671
3787
|
saveRef.current = async () => {
|
|
3672
3788
|
const record = store.get(documentId);
|
|
3673
3789
|
const onSave = optionsRef.current.onSave;
|
|
@@ -3695,7 +3811,7 @@ function DocumentEditorImpl(props) {
|
|
|
3695
3811
|
setSaveState(latestKey === key ? "saved" : "dirty");
|
|
3696
3812
|
} catch (error) {
|
|
3697
3813
|
setSaveState("error");
|
|
3698
|
-
_optionalChain([optionsRef, 'access',
|
|
3814
|
+
_optionalChain([optionsRef, 'access', _403 => _403.current, 'access', _404 => _404.onError, 'optionalCall', _405 => _405(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "DOCUMENT_ERROR", "Saving the document failed"))]);
|
|
3699
3815
|
}
|
|
3700
3816
|
};
|
|
3701
3817
|
const markDirty = _react.useCallback.call(void 0,
|
|
@@ -3705,7 +3821,7 @@ function DocumentEditorImpl(props) {
|
|
|
3705
3821
|
return;
|
|
3706
3822
|
}
|
|
3707
3823
|
setSaveState("dirty");
|
|
3708
|
-
_optionalChain([autosave, 'optionalCall',
|
|
3824
|
+
_optionalChain([autosave, 'optionalCall', _406 => _406()]);
|
|
3709
3825
|
},
|
|
3710
3826
|
[autosave]
|
|
3711
3827
|
);
|
|
@@ -3714,7 +3830,7 @@ function DocumentEditorImpl(props) {
|
|
|
3714
3830
|
const t = setTimeout(() => setSaveState((s) => s === "saved" ? "idle" : s), 2500);
|
|
3715
3831
|
return () => clearTimeout(t);
|
|
3716
3832
|
}, [saveState, options.onSave]);
|
|
3717
|
-
const [initialJson] = _react.useState.call(void 0, () => _nullishCoalesce(_nullishCoalesce(_optionalChain([store, 'access',
|
|
3833
|
+
const [initialJson] = _react.useState.call(void 0, () => _nullishCoalesce(_nullishCoalesce(_optionalChain([store, 'access', _407 => _407.get, 'call', _408 => _408(documentId), 'optionalAccess', _409 => _409.json]), () => ( parsed.json)), () => ( _chunkG6YPSE6Jcjs.emptyDoc.call(void 0, ))));
|
|
3718
3834
|
const extensions = _react.useMemo.call(void 0, () => _chunkG6YPSE6Jcjs.createDocumentExtensions.call(void 0, ), []);
|
|
3719
3835
|
const onUpdateRef = _react.useRef.call(void 0, () => {
|
|
3720
3836
|
});
|
|
@@ -3757,10 +3873,10 @@ function DocumentEditorImpl(props) {
|
|
|
3757
3873
|
markDirty(false);
|
|
3758
3874
|
} else if (outcome === "conflict") {
|
|
3759
3875
|
const record = store.get(documentId);
|
|
3760
|
-
_optionalChain([optionsRef, 'access',
|
|
3876
|
+
_optionalChain([optionsRef, 'access', _410 => _410.current, 'access', _411 => _411.onConflict, 'optionalCall', _412 => _412({
|
|
3761
3877
|
documentId,
|
|
3762
|
-
title: _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
3763
|
-
conflicts: _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
3878
|
+
title: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _413 => _413.title]), () => ( titleProp)),
|
|
3879
|
+
conflicts: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _414 => _414.pending, 'optionalAccess', _415 => _415.conflicts]), () => ( 1))
|
|
3764
3880
|
})]);
|
|
3765
3881
|
}
|
|
3766
3882
|
}, [store, documentId, titleProp, parsed.json, documentType, status, emitChange, markDirty]);
|
|
@@ -3787,7 +3903,7 @@ function DocumentEditorImpl(props) {
|
|
|
3787
3903
|
if (!record) return;
|
|
3788
3904
|
readyRef.current = true;
|
|
3789
3905
|
lastSavedKey.current = JSON.stringify([record.title, _chunkG6YPSE6Jcjs.docKey.call(void 0, record.json)]);
|
|
3790
|
-
_optionalChain([optionsRef, 'access',
|
|
3906
|
+
_optionalChain([optionsRef, 'access', _416 => _416.current, 'access', _417 => _417.onDocumentReady, 'optionalCall', _418 => _418(snapshotOf(record))]);
|
|
3791
3907
|
}, [editor, store, documentId, title]);
|
|
3792
3908
|
const handleTitle = (value) => {
|
|
3793
3909
|
store.setTitle(documentId, value);
|
|
@@ -3812,9 +3928,9 @@ function DocumentEditorImpl(props) {
|
|
|
3812
3928
|
// always the latest editor content
|
|
3813
3929
|
});
|
|
3814
3930
|
if (result.blob) downloadResult(result);
|
|
3815
|
-
_optionalChain([optionsRef, 'access',
|
|
3931
|
+
_optionalChain([optionsRef, 'access', _419 => _419.current, 'access', _420 => _420.onExport, 'optionalCall', _421 => _421({ documentId, format: format2, ...result })]);
|
|
3816
3932
|
} catch (error) {
|
|
3817
|
-
_optionalChain([optionsRef, 'access',
|
|
3933
|
+
_optionalChain([optionsRef, 'access', _422 => _422.current, 'access', _423 => _423.onError, 'optionalCall', _424 => _424(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "EXPORT_ERROR"))]);
|
|
3818
3934
|
flash("Export failed");
|
|
3819
3935
|
}
|
|
3820
3936
|
};
|
|
@@ -3940,9 +4056,186 @@ function DocumentEditorImpl(props) {
|
|
|
3940
4056
|
);
|
|
3941
4057
|
}
|
|
3942
4058
|
|
|
4059
|
+
// src/features/document-editor/document-preview.tsx
|
|
4060
|
+
|
|
4061
|
+
var _reactdom = require('react-dom');
|
|
4062
|
+
|
|
4063
|
+
// src/features/document-editor/document-presentation.ts
|
|
4064
|
+
function resolveDocumentPresentation(documentPresentation, configured) {
|
|
4065
|
+
if (documentPresentation === "inline" || documentPresentation === "side-panel") return documentPresentation;
|
|
4066
|
+
if (configured === "inline" || configured === "side-panel") return configured;
|
|
4067
|
+
return "inline";
|
|
4068
|
+
}
|
|
4069
|
+
function documentPanelWidth(width) {
|
|
4070
|
+
if (typeof width === "number" && Number.isFinite(width)) return `${width}px`;
|
|
4071
|
+
if (typeof width === "string" && width.trim()) return width.trim();
|
|
4072
|
+
return void 0;
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
// src/features/document-editor/document-preview.tsx
|
|
4076
|
+
|
|
4077
|
+
var FORMAT_LABEL = {
|
|
4078
|
+
docx: "Word document",
|
|
4079
|
+
pdf: "PDF",
|
|
4080
|
+
html: "Web page",
|
|
4081
|
+
markdown: "Markdown",
|
|
4082
|
+
txt: "Plain text"
|
|
4083
|
+
};
|
|
4084
|
+
function DocumentPreview(props) {
|
|
4085
|
+
const { documentId, title = "Untitled document", content, editable = true, exportFormats } = props;
|
|
4086
|
+
const { theme: contextTheme } = useJuneTheme();
|
|
4087
|
+
const resolvedTheme = props.theme && props.theme !== "auto" ? props.theme : contextTheme;
|
|
4088
|
+
const ctxOptions = useDocumentOptions();
|
|
4089
|
+
const editorConfig = useDocumentEditorConfig();
|
|
4090
|
+
const presentation = resolveDocumentPresentation(props.presentation, editorConfig.presentation);
|
|
4091
|
+
const panelWidth = documentPanelWidth(editorConfig.width);
|
|
4092
|
+
const store = _react.useMemo.call(void 0, () => _nullishCoalesce(_nullishCoalesce(_optionalChain([props, 'access', _425 => _425.options, 'optionalAccess', _426 => _426.store]), () => ( ctxOptions.store)), () => ( getDefaultDocumentStore())), [_optionalChain([props, 'access', _427 => _427.options, 'optionalAccess', _428 => _428.store]), ctxOptions.store]);
|
|
4093
|
+
const storedJson = useDocumentValue(store, documentId, (record) => _optionalChain([record, 'optionalAccess', _429 => _429.json]));
|
|
4094
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
4095
|
+
const [preferStore, setPreferStore] = _react.useState.call(void 0, false);
|
|
4096
|
+
const [notice, setNotice] = _react.useState.call(void 0, null);
|
|
4097
|
+
const contentKey = typeof content === "string" ? content : content ? JSON.stringify(content) : "";
|
|
4098
|
+
const options = _nullishCoalesce(props.options, () => ( ctxOptions));
|
|
4099
|
+
_react.useEffect.call(void 0, () => {
|
|
4100
|
+
setPreferStore(false);
|
|
4101
|
+
}, [contentKey]);
|
|
4102
|
+
const doc = _react.useMemo.call(void 0, () => {
|
|
4103
|
+
try {
|
|
4104
|
+
const fromContent = contentKey ? _chunkG6YPSE6Jcjs.parseDocumentContent.call(void 0, contentKey) : null;
|
|
4105
|
+
return preferStore && storedJson ? storedJson : fromContent;
|
|
4106
|
+
} catch (e10) {
|
|
4107
|
+
return null;
|
|
4108
|
+
}
|
|
4109
|
+
}, [contentKey, preferStore, storedJson]);
|
|
4110
|
+
const html = _react.useMemo.call(void 0, () => doc ? _chunkG6YPSE6Jcjs.docToHtml.call(void 0, doc) : "", [doc]);
|
|
4111
|
+
const formats = (_nullishCoalesce(exportFormats, () => ( [...ALL_EXPORT_FORMATS]))).filter((format2) => listDocumentExporters().includes(format2));
|
|
4112
|
+
_react.useEffect.call(void 0, () => {
|
|
4113
|
+
if (!notice) return;
|
|
4114
|
+
const timer = setTimeout(() => setNotice(null), 2e3);
|
|
4115
|
+
return () => clearTimeout(timer);
|
|
4116
|
+
}, [notice]);
|
|
4117
|
+
_react.useEffect.call(void 0, () => {
|
|
4118
|
+
if (!open || presentation !== "side-panel" || typeof document === "undefined") return;
|
|
4119
|
+
const prev = document.body.style.overflow;
|
|
4120
|
+
document.body.style.overflow = "hidden";
|
|
4121
|
+
return () => {
|
|
4122
|
+
document.body.style.overflow = prev;
|
|
4123
|
+
};
|
|
4124
|
+
}, [open, presentation]);
|
|
4125
|
+
const close = () => {
|
|
4126
|
+
setPreferStore(true);
|
|
4127
|
+
setOpen(false);
|
|
4128
|
+
};
|
|
4129
|
+
const handleExport = async (format2) => {
|
|
4130
|
+
if (!doc) return;
|
|
4131
|
+
try {
|
|
4132
|
+
const result = await exportDocument(format2, { documentId, title, json: doc });
|
|
4133
|
+
if (result.blob) downloadResult(result);
|
|
4134
|
+
_optionalChain([options, 'access', _430 => _430.onExport, 'optionalCall', _431 => _431({ documentId, format: format2, ...result })]);
|
|
4135
|
+
} catch (error) {
|
|
4136
|
+
_optionalChain([options, 'access', _432 => _432.onError, 'optionalCall', _433 => _433(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "EXPORT_ERROR"))]);
|
|
4137
|
+
setNotice("Export failed");
|
|
4138
|
+
}
|
|
4139
|
+
};
|
|
4140
|
+
const handleCopy = async () => {
|
|
4141
|
+
if (!doc) return;
|
|
4142
|
+
setNotice(await copyDocumentToClipboard({ title, json: doc }) ? "Copied" : "Copy failed");
|
|
4143
|
+
};
|
|
4144
|
+
const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4145
|
+
DocumentEditorImpl,
|
|
4146
|
+
{
|
|
4147
|
+
documentId: props.documentId,
|
|
4148
|
+
title: props.title,
|
|
4149
|
+
content: props.content,
|
|
4150
|
+
documentType: props.documentType,
|
|
4151
|
+
status: props.status,
|
|
4152
|
+
editable: props.editable,
|
|
4153
|
+
exportFormats: props.exportFormats,
|
|
4154
|
+
theme: props.theme,
|
|
4155
|
+
generating: props.generating,
|
|
4156
|
+
options: props.options
|
|
4157
|
+
}
|
|
4158
|
+
);
|
|
4159
|
+
const closeBar = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc-editor__bar", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "june-doc__btn june-doc__btn--ghost", "aria-label": "Close document", onClick: close, children: [
|
|
4160
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { name: "close", size: 16 }),
|
|
4161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Close" })
|
|
4162
|
+
] }) });
|
|
4163
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4164
|
+
!open ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "june-doc june-doc-card", "data-theme": resolvedTheme, "aria-label": title, children: [
|
|
4165
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc-card__bar", children: [
|
|
4166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "june-doc-card__title", children: title }),
|
|
4167
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc-card__actions", children: [
|
|
4168
|
+
notice ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "june-doc-card__notice", children: notice }) : null,
|
|
4169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4170
|
+
Dropdown,
|
|
4171
|
+
{
|
|
4172
|
+
align: "end",
|
|
4173
|
+
className: "june-doc__menu",
|
|
4174
|
+
trigger: ({ open: menuOpen, toggle }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "june-doc__btn june-doc__btn--ghost", "aria-label": "Download", "aria-haspopup": "menu", "aria-expanded": menuOpen, onClick: toggle, children: [
|
|
4175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { name: "download", size: 16 }),
|
|
4176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Download" })
|
|
4177
|
+
] }),
|
|
4178
|
+
children: (dismiss) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { role: "menu", "aria-label": "Download options", children: formats.map((format2) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4179
|
+
"button",
|
|
4180
|
+
{
|
|
4181
|
+
type: "button",
|
|
4182
|
+
role: "menuitem",
|
|
4183
|
+
className: "june-doc__menu-item",
|
|
4184
|
+
onClick: () => {
|
|
4185
|
+
dismiss();
|
|
4186
|
+
void handleExport(format2);
|
|
4187
|
+
},
|
|
4188
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "june-doc__menu-label", children: _nullishCoalesce(FORMAT_LABEL[format2], () => ( format2.toUpperCase())) })
|
|
4189
|
+
},
|
|
4190
|
+
format2
|
|
4191
|
+
)) })
|
|
4192
|
+
}
|
|
4193
|
+
),
|
|
4194
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "june-doc__btn june-doc__btn--icon june-doc__btn--ghost", "aria-label": "Copy document", title: "Copy", onClick: () => void handleCopy(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { name: "copy", size: 16 }) }),
|
|
4195
|
+
editable ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "june-doc__btn june-doc__btn--icon june-doc__btn--ghost", "aria-label": "Edit document", title: "Edit", onClick: () => setOpen(true), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { name: "pencil", size: 16 }) }) : null
|
|
4196
|
+
] })
|
|
4197
|
+
] }),
|
|
4198
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc-card__canvas", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc-card__sheet", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc__prose", dangerouslySetInnerHTML: { __html: html } }) }) })
|
|
4199
|
+
] }) : null,
|
|
4200
|
+
open && presentation === "inline" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "june-doc june-doc-inline", "data-theme": resolvedTheme, "aria-label": title, onKeyDown: (event) => {
|
|
4201
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
4202
|
+
if (event.currentTarget.querySelector(".june-doc--fullscreen")) return;
|
|
4203
|
+
close();
|
|
4204
|
+
}, children: [
|
|
4205
|
+
closeBar,
|
|
4206
|
+
editor
|
|
4207
|
+
] }) : null,
|
|
4208
|
+
open && presentation === "side-panel" && typeof document !== "undefined" ? _reactdom.createPortal.call(void 0,
|
|
4209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc-modal", "data-theme": resolvedTheme, onMouseDown: close, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4210
|
+
"div",
|
|
4211
|
+
{
|
|
4212
|
+
className: "june-doc june-doc-modal__panel",
|
|
4213
|
+
role: "dialog",
|
|
4214
|
+
"aria-modal": "true",
|
|
4215
|
+
"aria-label": title,
|
|
4216
|
+
tabIndex: -1,
|
|
4217
|
+
"data-theme": resolvedTheme,
|
|
4218
|
+
style: panelWidth ? { width: panelWidth, maxWidth: "100vw" } : void 0,
|
|
4219
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
4220
|
+
onKeyDown: (event) => {
|
|
4221
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
4222
|
+
if (event.currentTarget.querySelector(".june-doc--fullscreen")) return;
|
|
4223
|
+
close();
|
|
4224
|
+
},
|
|
4225
|
+
children: [
|
|
4226
|
+
closeBar,
|
|
4227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc-modal__body", children: editor })
|
|
4228
|
+
]
|
|
4229
|
+
}
|
|
4230
|
+
) }),
|
|
4231
|
+
document.body
|
|
4232
|
+
) : null
|
|
4233
|
+
] });
|
|
4234
|
+
}
|
|
4235
|
+
|
|
3943
4236
|
// src/features/document-editor/document-component.tsx
|
|
3944
4237
|
|
|
3945
|
-
var DOCUMENT_COMPONENT_DESCRIPTION = 'Custom component. An editable document. DocumentEditor(documentId, title, content, documentType?, status?, editable?, exportFormats?). Place it in the root container (Card or Stack). "content" is the full document body as one Markdown string. Reuse documentId when revising the same document. Use it only when the user asks to create or revise a document.';
|
|
4238
|
+
var DOCUMENT_COMPONENT_DESCRIPTION = 'Custom component. An editable document. DocumentEditor(documentId, title, content, documentType?, status?, editable?, exportFormats?, presentation?). Place it in the root container (Card or Stack). "content" is the full document body as one Markdown string. Reuse documentId when revising the same document. Use it only when the user asks to create or revise a document. presentation is "inline" or "side-panel"; omit it to use the app default.';
|
|
3946
4239
|
var documentProps = _v4.z.object({
|
|
3947
4240
|
documentId: _v4.z.string().describe("Stable id. Reuse it when revising the same document."),
|
|
3948
4241
|
title: _v4.z.string().describe("Document title. Do not repeat it as a heading in content."),
|
|
@@ -3950,7 +4243,8 @@ var documentProps = _v4.z.object({
|
|
|
3950
4243
|
documentType: _v4.z.string().optional().describe("Kind of document, such as proposal, contract or invoice."),
|
|
3951
4244
|
status: _v4.z.string().optional().describe('Use "draft" for generated documents.'),
|
|
3952
4245
|
editable: _v4.z.boolean().optional().describe("Whether the user can edit. Defaults to true."),
|
|
3953
|
-
exportFormats: _v4.z.array(_v4.z.string()).optional().describe("Export formats to offer, such as html, markdown, docx.")
|
|
4246
|
+
exportFormats: _v4.z.array(_v4.z.string()).optional().describe("Export formats to offer, such as html, markdown, docx."),
|
|
4247
|
+
presentation: _v4.z.enum(["inline", "side-panel"]).optional().describe('Where Edit opens the editor: "inline" in the chat, or "side-panel". Omit to use the app default.')
|
|
3954
4248
|
});
|
|
3955
4249
|
function DocumentEditor(props) {
|
|
3956
4250
|
const { isStreaming } = useJuneRuntime();
|
|
@@ -3960,18 +4254,19 @@ function DocumentEditor(props) {
|
|
|
3960
4254
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocumentEditorImpl, { ...props });
|
|
3961
4255
|
}
|
|
3962
4256
|
function OpenUIDocument({ props }) {
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
);
|
|
4257
|
+
const { isStreaming } = useJuneRuntime();
|
|
4258
|
+
const shared = {
|
|
4259
|
+
documentId: props.documentId,
|
|
4260
|
+
title: props.title,
|
|
4261
|
+
content: props.content,
|
|
4262
|
+
documentType: props.documentType,
|
|
4263
|
+
status: props.status,
|
|
4264
|
+
editable: props.editable,
|
|
4265
|
+
exportFormats: props.exportFormats,
|
|
4266
|
+
presentation: props.presentation
|
|
4267
|
+
};
|
|
4268
|
+
if (isStreaming) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocumentDraft, { title: props.title, state: "drafting" });
|
|
4269
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocumentPreview, { ...shared });
|
|
3975
4270
|
}
|
|
3976
4271
|
var JuneDocumentEditorComponent = _reactlang.defineComponent.call(void 0, {
|
|
3977
4272
|
name: "DocumentEditor",
|
|
@@ -3986,7 +4281,7 @@ function withDocumentEditor(library) {
|
|
|
3986
4281
|
add: [{ component: JuneDocumentEditorComponent, slots: ["Card"] }]
|
|
3987
4282
|
}
|
|
3988
4283
|
});
|
|
3989
|
-
} catch (
|
|
4284
|
+
} catch (e11) {
|
|
3990
4285
|
return library.extend({ components: { add: [JuneDocumentEditorComponent] } });
|
|
3991
4286
|
}
|
|
3992
4287
|
}
|
|
@@ -4009,7 +4304,7 @@ function getDocumentEditorRules(options = {}) {
|
|
|
4009
4304
|
return [
|
|
4010
4305
|
`WHEN TO USE ${name}: use it only when the user asks you to create, draft, write, prepare, generate or revise an editable document (${types}, or similar). Put the finished document inside ${name}.`,
|
|
4011
4306
|
`WHEN NOT TO USE ${name}: for explanations ("explain what an NDA is"), factual answers, comparisons, brainstorming and general questions, answer with normal text and the other components. Never open ${name} for those.`,
|
|
4012
|
-
`${name}(documentId, title, content, documentType?, status?, editable?, exportFormats?): "content" is the whole document body as Markdown inside ONE double-quoted string. Write line breaks as \\n and escape double quotes as \\". Supported Markdown: headings (#, ##, ###), paragraphs, **bold**, *italic*, lists, > quotes, [links](https://...), and tables.`,
|
|
4307
|
+
`${name}(documentId, title, content, documentType?, status?, editable?, exportFormats?, presentation?): "content" is the whole document body as Markdown inside ONE double-quoted string. Write line breaks as \\n and escape double quotes as \\". Supported Markdown: headings (#, ##, ###), paragraphs, **bold**, *italic*, lists, > quotes, [links](https://...), and tables. presentation is optional: "inline" or "side-panel". Omit it to use the app default.`,
|
|
4013
4308
|
`Do not repeat the title as a heading inside "content"; the title is shown separately. Structure the document with headings, short paragraphs and tables where useful. Keep a professional tone.`,
|
|
4014
4309
|
`EDITING: when the user asks to change an existing document (add a section, rewrite a part, change the title), write ${name} again with the SAME documentId and the COMPLETE updated content, starting from the current document text you were given. Copy every unchanged section exactly as it was. Change only what was requested. The app merges your version with the user's own edits.`,
|
|
4015
4310
|
`If the user asks for a document but leaves out details, write the document anyway and use clear placeholders such as [CLIENT NAME], [DATE], [AMOUNT]. Do not stop to ask unless the request is impossible to interpret.`,
|
|
@@ -4066,7 +4361,7 @@ var defaultToolApprovalLabels = {
|
|
|
4066
4361
|
var format = (value) => {
|
|
4067
4362
|
try {
|
|
4068
4363
|
return _nullishCoalesce(JSON.stringify(value, null, 2), () => ( String(value)));
|
|
4069
|
-
} catch (
|
|
4364
|
+
} catch (e12) {
|
|
4070
4365
|
return String(value);
|
|
4071
4366
|
}
|
|
4072
4367
|
};
|
|
@@ -4082,19 +4377,19 @@ function ToolApproval({
|
|
|
4082
4377
|
className
|
|
4083
4378
|
}) {
|
|
4084
4379
|
const labels = { ...defaultToolApprovalLabels, ...labelOverrides };
|
|
4085
|
-
const options = _optionalChain([request, 'access',
|
|
4380
|
+
const options = _optionalChain([request, 'access', _434 => _434.options, 'optionalAccess', _435 => _435.length]) ? request.options : ["approve", "reject"];
|
|
4086
4381
|
const [draft, setDraft] = _react.useState.call(void 0, null);
|
|
4087
4382
|
const [draftError, setDraftError] = _react.useState.call(void 0, null);
|
|
4088
4383
|
const titleId = _react.useId.call(void 0, );
|
|
4089
4384
|
const pending = status === "pending";
|
|
4090
4385
|
const decide = (decision) => {
|
|
4091
|
-
if (!disabled && pending) _optionalChain([onDecide, 'optionalCall',
|
|
4386
|
+
if (!disabled && pending) _optionalChain([onDecide, 'optionalCall', _436 => _436(decision)]);
|
|
4092
4387
|
};
|
|
4093
4388
|
const saveEdit = () => {
|
|
4094
4389
|
let editedArguments;
|
|
4095
4390
|
try {
|
|
4096
4391
|
editedArguments = JSON.parse(_nullishCoalesce(draft, () => ( "null")));
|
|
4097
|
-
} catch (
|
|
4392
|
+
} catch (e13) {
|
|
4098
4393
|
setDraftError(labels.invalidJson);
|
|
4099
4394
|
return;
|
|
4100
4395
|
}
|
|
@@ -4183,7 +4478,7 @@ function useToolApproval() {
|
|
|
4183
4478
|
const settle = _react.useCallback.call(void 0, (id, decision) => {
|
|
4184
4479
|
const resolve = waiters.current.get(id);
|
|
4185
4480
|
waiters.current.delete(id);
|
|
4186
|
-
_optionalChain([resolve, 'optionalCall',
|
|
4481
|
+
_optionalChain([resolve, 'optionalCall', _437 => _437(decision)]);
|
|
4187
4482
|
}, []);
|
|
4188
4483
|
const request = _react.useCallback.call(void 0, (input) => {
|
|
4189
4484
|
const id = _nullishCoalesce(input.id, () => ( nextId()));
|
|
@@ -4258,7 +4553,7 @@ function messageContentToText(content) {
|
|
|
4258
4553
|
function parse(data) {
|
|
4259
4554
|
try {
|
|
4260
4555
|
return JSON.parse(data);
|
|
4261
|
-
} catch (
|
|
4556
|
+
} catch (e14) {
|
|
4262
4557
|
return void 0;
|
|
4263
4558
|
}
|
|
4264
4559
|
}
|
|
@@ -4272,7 +4567,7 @@ function createLangGraphExtractor(options = {}) {
|
|
|
4272
4567
|
if (!Array.isArray(parsed)) return null;
|
|
4273
4568
|
const [chunk, metadata] = parsed;
|
|
4274
4569
|
if (!chunk || typeof chunk !== "object" || !isAiMessage(chunk)) return null;
|
|
4275
|
-
if (nodes && !(typeof _optionalChain([metadata, 'optionalAccess',
|
|
4570
|
+
if (nodes && !(typeof _optionalChain([metadata, 'optionalAccess', _438 => _438.langgraph_node]) === "string" && nodes.has(metadata.langgraph_node))) return null;
|
|
4276
4571
|
return messageContentToText(chunk.content) || null;
|
|
4277
4572
|
}
|
|
4278
4573
|
if (base === "messages/partial" || base === "messages/complete") {
|
|
@@ -4311,8 +4606,8 @@ function interruptToApprovalRequests(value, idPrefix = "interrupt") {
|
|
|
4311
4606
|
const configs = Array.isArray(hitl.review_configs) ? hitl.review_configs : [];
|
|
4312
4607
|
return hitl.action_requests.flatMap((action, index) => {
|
|
4313
4608
|
if (!action || typeof action.name !== "string") return [];
|
|
4314
|
-
const config = configs.find((c) => _optionalChain([c, 'optionalAccess',
|
|
4315
|
-
const allowed = Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
4609
|
+
const config = configs.find((c) => _optionalChain([c, 'optionalAccess', _439 => _439.action_name]) === action.name);
|
|
4610
|
+
const allowed = Array.isArray(_optionalChain([config, 'optionalAccess', _440 => _440.allowed_decisions])) ? config.allowed_decisions.filter(
|
|
4316
4611
|
(d) => d === "approve" || d === "reject" || d === "edit"
|
|
4317
4612
|
) : void 0;
|
|
4318
4613
|
return [
|
|
@@ -4396,4 +4691,8 @@ function interruptToApprovalRequests(value, idPrefix = "interrupt") {
|
|
|
4396
4691
|
|
|
4397
4692
|
|
|
4398
4693
|
|
|
4399
|
-
|
|
4694
|
+
|
|
4695
|
+
|
|
4696
|
+
|
|
4697
|
+
|
|
4698
|
+
exports.useJuneTheme = useJuneTheme; exports.JuneRuntimeContext = JuneRuntimeContext; exports.useJuneRuntime = useJuneRuntime; exports.defaultParseActionEvent = defaultParseActionEvent; exports.runAction = runAction; exports.createActionHandler = createActionHandler; exports.JuneDocumentContext = JuneDocumentContext; exports.DocumentEditorConfigContext = DocumentEditorConfigContext; exports.useDocumentEditorConfig = useDocumentEditorConfig; exports.useDocumentOptions = useDocumentOptions; exports.mergeDocuments = mergeDocuments; exports.createDocumentStore = createDocumentStore; exports.rememberDocumentEcho = rememberDocumentEcho; exports.isDocumentEcho = isDocumentEcho; exports.getDefaultDocumentStore = getDefaultDocumentStore; exports.updateDocumentInProgram = updateDocumentInProgram; exports.readDocumentFromProgram = readDocumentFromProgram; exports.useDocumentBridge = useDocumentBridge; exports.DocumentBridge = DocumentBridge; exports.darkTheme = darkTheme; exports.lightTheme = lightTheme; exports.isThemeSet = isThemeSet; exports.resolveThemeVars = resolveThemeVars; exports.createTheme = createTheme; exports.useResolvedTheme = useResolvedTheme; exports.JuneThemeProvider = JuneThemeProvider; exports.normalizeProgram = normalizeProgram; exports.splitResponse = splitResponse; exports.resolveMixedContent = resolveMixedContent; exports.JuneErrorBoundary = JuneErrorBoundary; exports.MarkdownText = MarkdownText; exports.JuneRenderer = JuneRenderer; exports.validateComponentDefinition = validateComponentDefinition; exports.defineComponent = defineComponent; exports.isJuneComponent = isJuneComponent; exports.ComponentRegistry = ComponentRegistry; exports.createComponentRegistry = createComponentRegistry; exports.useRegistryLibrary = useRegistryLibrary; exports.defineJuneComponent = defineJuneComponent; exports.createJuneLibrary = createJuneLibrary; exports.defineJuneAction = defineJuneAction; exports.toAsyncIterable = toAsyncIterable; exports.consumeStream = consumeStream; exports.sseToText = sseToText; exports.jsonFieldExtractor = jsonFieldExtractor; exports.fetchStream = fetchStream; exports.useJuneStream = useJuneStream; exports.registerDocumentExporter = registerDocumentExporter; exports.listDocumentExporters = listDocumentExporters; exports.exportDocument = exportDocument; exports.downloadResult = downloadResult; exports.copyDocumentToClipboard = copyDocumentToClipboard; exports.ALL_EXPORT_FORMATS = ALL_EXPORT_FORMATS; exports.resolveDocumentPresentation = resolveDocumentPresentation; exports.documentPanelWidth = documentPanelWidth; exports.DOCUMENT_COMPONENT_DESCRIPTION = DOCUMENT_COMPONENT_DESCRIPTION; exports.DocumentEditor = DocumentEditor; exports.JuneDocumentEditorComponent = JuneDocumentEditorComponent; exports.withDocumentEditor = withDocumentEditor; exports.getDocumentEditorRules = getDocumentEditorRules; exports.getDocumentEditorInstructions = getDocumentEditorInstructions; exports.documentPromptOptions = documentPromptOptions; exports.serializeDocumentsForAgent = serializeDocumentsForAgent; exports.defaultToolApprovalLabels = defaultToolApprovalLabels; exports.ToolApproval = ToolApproval; exports.ToolApprovalList = ToolApprovalList; exports.useToolApproval = useToolApproval; exports.messageContentToText = messageContentToText; exports.createLangGraphExtractor = createLangGraphExtractor; exports.langGraphStreamOptions = langGraphStreamOptions; exports.readLangGraphInterrupts = readLangGraphInterrupts; exports.interruptToApprovalRequests = interruptToApprovalRequests;
|