@june-ai/june-ui 0.2.8 → 0.2.9
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/CHANGELOG.md +5 -0
- package/dist/{chunk-3NVO336D.cjs → chunk-GFCROSGQ.cjs} +268 -183
- package/dist/{chunk-H26BMR5S.js → chunk-JSRO5CRO.js} +138 -53
- package/dist/entry-core.cjs +2 -2
- package/dist/entry-core.js +1 -1
- package/dist/index.cjs +24 -7
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +20 -3
- package/docs/troubleshooting.md +1 -1
- package/package.json +1 -1
|
@@ -22,55 +22,126 @@
|
|
|
22
22
|
var _chunkG6YPSE6Jcjs = require('./chunk-G6YPSE6J.cjs');
|
|
23
23
|
|
|
24
24
|
// src/engine/openui-devtools.tsx
|
|
25
|
+
var _react = require('react');
|
|
25
26
|
var _devtools = require('@openuidev/devtools');
|
|
26
27
|
var _jsxruntime = require('react/jsx-runtime');
|
|
27
28
|
var AUTO_MOUNT_FLAG = /* @__PURE__ */ Symbol.for("openui.devtools.autoMount");
|
|
28
29
|
var BLOCKED_BY_JUNE = /* @__PURE__ */ Symbol.for("openui.devtools.blockedByJune");
|
|
30
|
+
var AUTO_MOUNT_HOST = "data-openui-devtools-auto-mount";
|
|
29
31
|
var flags = globalThis;
|
|
30
|
-
var scheduledByOpenUI = flags[AUTO_MOUNT_FLAG] === true && flags[BLOCKED_BY_JUNE] !== true;
|
|
31
32
|
flags[AUTO_MOUNT_FLAG] = true;
|
|
32
33
|
flags[BLOCKED_BY_JUNE] = true;
|
|
33
34
|
var DEVTOOLS_BUNDLE = "https://cdn.jsdelivr.net/npm/@openuidev/devtools@0/dist/devtools.browser.js";
|
|
34
35
|
var ALIAS_CACHE_MS = 5 * 60 * 1e3;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
36
|
+
var LOCAL_WIDGET = "../../node_modules/@openuidev/devtools/dist/devtools.browser.js";
|
|
37
|
+
var loadFromCdn = () => {
|
|
38
38
|
const url = `${DEVTOOLS_BUNDLE}?t=${Math.floor(Date.now() / ALIAS_CACHE_MS)}`;
|
|
39
|
-
|
|
40
|
-
let unmount = () => {
|
|
41
|
-
cancelled = true;
|
|
42
|
-
};
|
|
43
|
-
void Promise.all([
|
|
39
|
+
return Promise.all([
|
|
44
40
|
Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
41
|
+
/* webpackIgnore: true */
|
|
45
42
|
/* @vite-ignore */
|
|
46
43
|
url
|
|
47
44
|
))),
|
|
48
45
|
Promise.resolve().then(() => _interopRequireWildcard(require("react"))),
|
|
49
46
|
Promise.resolve().then(() => _interopRequireWildcard(require("react-dom"))),
|
|
50
47
|
Promise.resolve().then(() => _interopRequireWildcard(require("react-dom/client")))
|
|
51
|
-
])
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
50
|
+
var loadInstalledOrCdn = async () => {
|
|
51
|
+
const [react, reactDom, reactDomClient] = await Promise.all([
|
|
52
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("react"))),
|
|
53
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("react-dom"))),
|
|
54
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("react-dom/client")))
|
|
55
|
+
]);
|
|
56
|
+
try {
|
|
57
|
+
const devtools = await Promise.resolve().then(() => _interopRequireWildcard(require(LOCAL_WIDGET)));
|
|
58
|
+
return [devtools, react, reactDom, reactDomClient];
|
|
59
|
+
} catch (e2) {
|
|
60
|
+
const [devtools] = await loadFromCdn();
|
|
61
|
+
return [devtools, react, reactDom, reactDomClient];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function nodeEnv() {
|
|
65
|
+
try {
|
|
66
|
+
return process.env.NODE_ENV;
|
|
67
|
+
} catch (e3) {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
var isAutoMountHost = (node) => node instanceof Element && node.hasAttribute(AUTO_MOUNT_HOST);
|
|
72
|
+
function createDevtoolsGuard(load = loadInstalledOrCdn) {
|
|
73
|
+
let started = false;
|
|
74
|
+
let claimed = false;
|
|
75
|
+
let observer = null;
|
|
76
|
+
let unmount = null;
|
|
77
|
+
let stopped = false;
|
|
78
|
+
const claim = () => {
|
|
79
|
+
if (claimed) return;
|
|
80
|
+
claimed = true;
|
|
81
|
+
_optionalChain([observer, 'optionalAccess', _2 => _2.disconnect, 'call', _3 => _3()]);
|
|
82
|
+
observer = null;
|
|
83
|
+
load().then(([devtools, react, reactDom, reactDomClient]) => {
|
|
84
|
+
if (stopped) return;
|
|
85
|
+
unmount = devtools.mountOpenUIDevtools({
|
|
86
|
+
React: react,
|
|
87
|
+
ReactDOM: reactDom,
|
|
88
|
+
ReactDOMClient: reactDomClient,
|
|
89
|
+
loadReactLang: () => Promise.resolve().then(() => _interopRequireWildcard(require("@openuidev/react-lang"))),
|
|
90
|
+
props: { enabled: false }
|
|
91
|
+
});
|
|
92
|
+
}).catch(() => {
|
|
59
93
|
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
94
|
+
};
|
|
95
|
+
const watch = () => {
|
|
96
|
+
const body = document.body;
|
|
97
|
+
if (!body) return;
|
|
98
|
+
if (Array.from(body.children).some(isAutoMountHost)) {
|
|
99
|
+
claim();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (typeof MutationObserver === "undefined") return;
|
|
103
|
+
observer = new MutationObserver((records) => {
|
|
104
|
+
if (records.some((r) => Array.from(r.addedNodes).some(isAutoMountHost))) claim();
|
|
105
|
+
});
|
|
106
|
+
observer.observe(body, { childList: true });
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
/** Starts watching (browser only). Safe to call many times. */
|
|
110
|
+
start() {
|
|
111
|
+
if (started || typeof document === "undefined") return;
|
|
112
|
+
started = true;
|
|
113
|
+
if (document.body) watch();
|
|
114
|
+
else document.addEventListener("DOMContentLoaded", watch, { once: true });
|
|
115
|
+
},
|
|
116
|
+
/** True once the disabled widget has been requested. */
|
|
117
|
+
get claimed() {
|
|
118
|
+
return claimed;
|
|
119
|
+
},
|
|
120
|
+
/** Stops watching and removes the disabled widget (tests, teardown). */
|
|
121
|
+
stop() {
|
|
122
|
+
stopped = true;
|
|
123
|
+
_optionalChain([observer, 'optionalAccess', _4 => _4.disconnect, 'call', _5 => _5()]);
|
|
124
|
+
observer = null;
|
|
125
|
+
_optionalChain([unmount, 'optionalCall', _6 => _6()]);
|
|
126
|
+
unmount = null;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
63
129
|
}
|
|
64
|
-
|
|
65
|
-
|
|
130
|
+
var guard = createDevtoolsGuard();
|
|
131
|
+
function hideOpenUIDevtools() {
|
|
132
|
+
if (nodeEnv() === "development") guard.start();
|
|
66
133
|
}
|
|
134
|
+
hideOpenUIDevtools();
|
|
67
135
|
function OpenUIDevtoolsGate() {
|
|
136
|
+
_react.useEffect.call(void 0, () => {
|
|
137
|
+
hideOpenUIDevtools();
|
|
138
|
+
}, []);
|
|
68
139
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _devtools.OpenUIDevtools, { enabled: false });
|
|
69
140
|
}
|
|
70
141
|
|
|
71
142
|
// src/engine/renderer/june-renderer.tsx
|
|
72
143
|
var _reactlang = require('@openuidev/react-lang');
|
|
73
|
-
|
|
144
|
+
|
|
74
145
|
|
|
75
146
|
// src/core/context.ts
|
|
76
147
|
|
|
@@ -108,7 +179,7 @@ async function runAction(event, options) {
|
|
|
108
179
|
const parsed = parseEvent(event);
|
|
109
180
|
const action = parsed && Object.prototype.hasOwnProperty.call(actions, parsed.name) ? actions[parsed.name] : void 0;
|
|
110
181
|
if (!parsed || !action) {
|
|
111
|
-
_optionalChain([onUnhandled, 'optionalCall',
|
|
182
|
+
_optionalChain([onUnhandled, 'optionalCall', _7 => _7(event)]);
|
|
112
183
|
return "unhandled";
|
|
113
184
|
}
|
|
114
185
|
const { name } = parsed;
|
|
@@ -116,7 +187,7 @@ async function runAction(event, options) {
|
|
|
116
187
|
if (action.schema) {
|
|
117
188
|
const result = action.schema.safeParse(payload);
|
|
118
189
|
if (!result.success) {
|
|
119
|
-
_optionalChain([onError, 'optionalCall',
|
|
190
|
+
_optionalChain([onError, 'optionalCall', _8 => _8(
|
|
120
191
|
new (0, _chunkG6YPSE6Jcjs.JuneError)("ACTION_VALIDATION_ERROR", `Invalid payload for action "${name}"`, {
|
|
121
192
|
details: result.error
|
|
122
193
|
})
|
|
@@ -129,7 +200,7 @@ async function runAction(event, options) {
|
|
|
129
200
|
if (action.sensitive || action.confirm) {
|
|
130
201
|
const ask = _nullishCoalesce(action.confirm, () => ( confirm));
|
|
131
202
|
if (!ask) {
|
|
132
|
-
_optionalChain([onError, 'optionalCall',
|
|
203
|
+
_optionalChain([onError, 'optionalCall', _9 => _9(
|
|
133
204
|
new (0, _chunkG6YPSE6Jcjs.JuneError)(
|
|
134
205
|
"ACTION_REJECTED",
|
|
135
206
|
`Action "${name}" requires confirmation but no confirm handler was provided`
|
|
@@ -143,7 +214,7 @@ async function runAction(event, options) {
|
|
|
143
214
|
await action.handler(payload, { name, event });
|
|
144
215
|
return "handled";
|
|
145
216
|
} catch (error) {
|
|
146
|
-
_optionalChain([onError, 'optionalCall',
|
|
217
|
+
_optionalChain([onError, 'optionalCall', _10 => _10(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "ACTION_ERROR"))]);
|
|
147
218
|
return "failed";
|
|
148
219
|
}
|
|
149
220
|
}
|
|
@@ -351,7 +422,7 @@ function createDocumentStore() {
|
|
|
351
422
|
},
|
|
352
423
|
resolve(id, choice) {
|
|
353
424
|
const current = records.get(id);
|
|
354
|
-
const pending = _optionalChain([current, 'optionalAccess',
|
|
425
|
+
const pending = _optionalChain([current, 'optionalAccess', _11 => _11.pending]);
|
|
355
426
|
if (!current || !pending) return;
|
|
356
427
|
if (choice === "keep") {
|
|
357
428
|
put({ ...current, baseJson: pending.json, baseTitle: pending.title, pending: null });
|
|
@@ -387,7 +458,7 @@ function rememberDocumentEcho(store, id, content) {
|
|
|
387
458
|
byId.set(id, list2);
|
|
388
459
|
}
|
|
389
460
|
function isDocumentEcho(store, id, content) {
|
|
390
|
-
return !!content && !!_optionalChain([echoes, 'access',
|
|
461
|
+
return !!content && !!_optionalChain([echoes, 'access', _12 => _12.get, 'call', _13 => _13(store), 'optionalAccess', _14 => _14.get, 'call', _15 => _15(id), 'optionalAccess', _16 => _16.includes, 'call', _17 => _17(content)]);
|
|
391
462
|
}
|
|
392
463
|
var defaultStore = null;
|
|
393
464
|
function getDefaultDocumentStore() {
|
|
@@ -440,7 +511,7 @@ function updateDocumentInProgram(program, documentId, update, componentName = "D
|
|
|
440
511
|
if (program[i] === ",") i++;
|
|
441
512
|
else break;
|
|
442
513
|
}
|
|
443
|
-
if (_optionalChain([args, 'access',
|
|
514
|
+
if (_optionalChain([args, 'access', _18 => _18[0], 'optionalAccess', _19 => _19.value]) !== documentId) continue;
|
|
444
515
|
const edits = [];
|
|
445
516
|
if (update.title !== void 0 && args[1] && args[1].value !== update.title) {
|
|
446
517
|
edits.push({ start: args[1].start, end: args[1].end, text: toLangString(update.title) });
|
|
@@ -472,7 +543,7 @@ function readDocumentFromProgram(program, documentId, componentName = "DocumentE
|
|
|
472
543
|
if (program[i] === ",") i++;
|
|
473
544
|
else break;
|
|
474
545
|
}
|
|
475
|
-
if (_optionalChain([args, 'access',
|
|
546
|
+
if (_optionalChain([args, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.value]) === documentId && args[1] && args[2]) return { title: args[1].value, content: args[2].value };
|
|
476
547
|
}
|
|
477
548
|
return null;
|
|
478
549
|
}
|
|
@@ -493,8 +564,8 @@ function useDocumentBridge(options) {
|
|
|
493
564
|
const syncProgram = _react.useCallback.call(void 0, async (change, store) => {
|
|
494
565
|
if (!latest.current.onResponseChange || typeof latest.current.response !== "string") return;
|
|
495
566
|
const record = store.get(change.documentId);
|
|
496
|
-
const title = _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
497
|
-
const json = _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
567
|
+
const title = _nullishCoalesce(_optionalChain([record, 'optionalAccess', _22 => _22.title]), () => ( change.title));
|
|
568
|
+
const json = _nullishCoalesce(_optionalChain([record, 'optionalAccess', _23 => _23.json]), () => ( change.json));
|
|
498
569
|
try {
|
|
499
570
|
const { docToMarkdown: docToMarkdown2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./document-engine-GXZH2LNW.cjs")));
|
|
500
571
|
const markdown = docToMarkdown2(json);
|
|
@@ -503,18 +574,18 @@ function useDocumentBridge(options) {
|
|
|
503
574
|
const next = updateDocumentInProgram(program, change.documentId, { title, content: markdown });
|
|
504
575
|
if (next === null || next === program) return;
|
|
505
576
|
rememberDocumentEcho(store, change.documentId, markdown);
|
|
506
|
-
_optionalChain([latest, 'access',
|
|
577
|
+
_optionalChain([latest, 'access', _24 => _24.current, 'access', _25 => _25.onResponseChange, 'optionalCall', _26 => _26(next, { documentId: change.documentId, title, markdown, source: change.source })]);
|
|
507
578
|
} catch (error) {
|
|
508
|
-
_optionalChain([latest, 'access',
|
|
579
|
+
_optionalChain([latest, 'access', _27 => _27.current, 'access', _28 => _28.onJuneError, 'optionalCall', _29 => _29(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "DOCUMENT_ERROR", "Updating the program failed"))]);
|
|
509
580
|
}
|
|
510
581
|
}, []);
|
|
511
582
|
return _react.useMemo.call(void 0,
|
|
512
583
|
() => ({
|
|
513
584
|
...documents,
|
|
514
585
|
onDocumentChange: (change) => {
|
|
515
|
-
_optionalChain([documents, 'optionalAccess',
|
|
586
|
+
_optionalChain([documents, 'optionalAccess', _30 => _30.onDocumentChange, 'optionalCall', _31 => _31(change)]);
|
|
516
587
|
if (!latest.current.onResponseChange || change.source === "ai") return;
|
|
517
|
-
const store = _nullishCoalesce(_optionalChain([documents, 'optionalAccess',
|
|
588
|
+
const store = _nullishCoalesce(_optionalChain([documents, 'optionalAccess', _32 => _32.store]), () => ( getDefaultDocumentStore()));
|
|
518
589
|
const timers = timersRef.current;
|
|
519
590
|
const prev = timers.get(change.documentId);
|
|
520
591
|
if (prev) clearTimeout(prev);
|
|
@@ -527,8 +598,8 @@ function useDocumentBridge(options) {
|
|
|
527
598
|
);
|
|
528
599
|
},
|
|
529
600
|
onError: (error) => {
|
|
530
|
-
_optionalChain([documents, 'optionalAccess',
|
|
531
|
-
_optionalChain([latest, 'access',
|
|
601
|
+
_optionalChain([documents, 'optionalAccess', _33 => _33.onError, 'optionalCall', _34 => _34(error)]);
|
|
602
|
+
_optionalChain([latest, 'access', _35 => _35.current, 'access', _36 => _36.onJuneError, 'optionalCall', _37 => _37(error)]);
|
|
532
603
|
}
|
|
533
604
|
}),
|
|
534
605
|
[documents, syncProgram]
|
|
@@ -592,7 +663,7 @@ function subscribe(onChange) {
|
|
|
592
663
|
}
|
|
593
664
|
function getSnapshot() {
|
|
594
665
|
if (typeof window === "undefined") return "light";
|
|
595
|
-
return _optionalChain([window, 'access',
|
|
666
|
+
return _optionalChain([window, 'access', _38 => _38.matchMedia, 'optionalCall', _39 => _39(QUERY), 'optionalAccess', _40 => _40.matches]) ? "dark" : "light";
|
|
596
667
|
}
|
|
597
668
|
function getServerSnapshot() {
|
|
598
669
|
return "light";
|
|
@@ -652,8 +723,10 @@ var ATTACHABLE = /* @__PURE__ */ new Set([
|
|
|
652
723
|
"ImageGallery",
|
|
653
724
|
"InlineHeader",
|
|
654
725
|
"LineChart",
|
|
726
|
+
"FollowUpBlock",
|
|
655
727
|
"ListBlock",
|
|
656
728
|
"MarkDownRenderer",
|
|
729
|
+
"SectionBlock",
|
|
657
730
|
"Modal",
|
|
658
731
|
"OverviewCardBlock",
|
|
659
732
|
"PieChart",
|
|
@@ -674,7 +747,7 @@ var ATTACHABLE = /* @__PURE__ */ new Set([
|
|
|
674
747
|
]);
|
|
675
748
|
function normalizeProgram(source) {
|
|
676
749
|
const rewritten = rewriteCalls(source);
|
|
677
|
-
return attachOrphans(rewritten);
|
|
750
|
+
return liftStackRoot(attachOrphans(rewritten));
|
|
678
751
|
}
|
|
679
752
|
function rewriteCalls(source) {
|
|
680
753
|
let out = "";
|
|
@@ -818,19 +891,31 @@ function attachOrphans(source) {
|
|
|
818
891
|
if (orphans.length === 0) return source;
|
|
819
892
|
const names = orphans.map((stmt) => stmt.name);
|
|
820
893
|
const root = stmts.find((stmt) => stmt.name === "root");
|
|
821
|
-
if (!root) return `root =
|
|
894
|
+
if (!root) return `root = Card([${names.join(", ")}])
|
|
822
895
|
${text}`;
|
|
823
896
|
const rawRhs = text.slice(root.rhsStart, root.end);
|
|
824
|
-
const lead = _nullishCoalesce(_optionalChain([/^\s*/, 'access',
|
|
897
|
+
const lead = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _41 => _41.exec, 'call', _42 => _42(rawRhs), 'optionalAccess', _43 => _43[0]]), () => ( ""));
|
|
825
898
|
const spliced = spliceFirstArray(rawRhs.trim(), names);
|
|
826
899
|
if (spliced !== null) {
|
|
827
900
|
return text.slice(0, root.rhsStart) + lead + spliced + text.slice(root.end);
|
|
828
901
|
}
|
|
829
902
|
const body = fresh(new Set(stmts.map((stmt) => stmt.name)), "rootBody");
|
|
830
|
-
const wrapped = `root =
|
|
903
|
+
const wrapped = `root = Card([${body}, ${names.join(", ")}])
|
|
831
904
|
${body} = ${rawRhs.trim()}`;
|
|
832
905
|
return text.slice(0, root.start) + wrapped + text.slice(root.end);
|
|
833
906
|
}
|
|
907
|
+
function liftStackRoot(source) {
|
|
908
|
+
const stmts = parseStatements(source);
|
|
909
|
+
if (!stmts) return source;
|
|
910
|
+
const root = stmts.find((stmt) => stmt.name === "root");
|
|
911
|
+
if (!root) return source;
|
|
912
|
+
const rhs = source.slice(root.rhsStart, root.end).trim();
|
|
913
|
+
if (!/^Stack\s*\(/.test(rhs)) return source;
|
|
914
|
+
const body = fresh(new Set(stmts.map((stmt) => stmt.name)), "rootLayout");
|
|
915
|
+
const wrapped = `root = Card([${body}])
|
|
916
|
+
${body} = ${rhs}`;
|
|
917
|
+
return source.slice(0, root.start) + wrapped + source.slice(root.end);
|
|
918
|
+
}
|
|
834
919
|
function spliceFirstArray(rhs, names) {
|
|
835
920
|
const match = /^([A-Za-z_]\w*)\s*\(/.exec(rhs);
|
|
836
921
|
if (!match || match[1] !== "Stack" && match[1] !== "Card") return null;
|
|
@@ -1061,8 +1146,8 @@ function resolveMixedContent(response, options = {}) {
|
|
|
1061
1146
|
const parts = mixedContent && response ? splitResponse(response, { streaming: isStreaming, markdown }) : null;
|
|
1062
1147
|
const raw = parts && !parts.pure ? parts.ui : response;
|
|
1063
1148
|
const ui = !repair || !mixedContent || isStreaming || typeof raw !== "string" || raw.length === 0 ? raw : normalizeProgram(raw);
|
|
1064
|
-
const before = _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
1065
|
-
const after = _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
1149
|
+
const before = _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _44 => _44.before]), () => ( []));
|
|
1150
|
+
const after = _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _45 => _45.after]), () => ( []));
|
|
1066
1151
|
return {
|
|
1067
1152
|
before,
|
|
1068
1153
|
ui,
|
|
@@ -1090,7 +1175,7 @@ var JuneErrorBoundary = class extends _react.Component {
|
|
|
1090
1175
|
return { error };
|
|
1091
1176
|
}
|
|
1092
1177
|
componentDidCatch(error, info) {
|
|
1093
|
-
_optionalChain([this, 'access',
|
|
1178
|
+
_optionalChain([this, 'access', _46 => _46.props, 'access', _47 => _47.onError, 'optionalCall', _48 => _48(error, info)]);
|
|
1094
1179
|
}
|
|
1095
1180
|
componentDidUpdate(prev) {
|
|
1096
1181
|
if (this.state.error && keysChanged(prev.resetKeys, this.props.resetKeys)) {
|
|
@@ -1151,37 +1236,37 @@ function JuneRenderer(props) {
|
|
|
1151
1236
|
latest.current = { actions, confirmAction, parseActionEvent, onAction, onError, onJuneError };
|
|
1152
1237
|
const handleAction = _react.useCallback.call(void 0, (event) => {
|
|
1153
1238
|
const l = latest.current;
|
|
1154
|
-
_optionalChain([l, 'access',
|
|
1239
|
+
_optionalChain([l, 'access', _49 => _49.onAction, 'optionalCall', _50 => _50(event)]);
|
|
1155
1240
|
if (l.actions) {
|
|
1156
1241
|
void runAction(event, {
|
|
1157
1242
|
actions: l.actions,
|
|
1158
1243
|
parseEvent: l.parseActionEvent,
|
|
1159
1244
|
confirm: l.confirmAction,
|
|
1160
|
-
onError: (e) => _optionalChain([l, 'access',
|
|
1245
|
+
onError: (e) => _optionalChain([l, 'access', _51 => _51.onJuneError, 'optionalCall', _52 => _52(e)])
|
|
1161
1246
|
});
|
|
1162
1247
|
}
|
|
1163
1248
|
}, []);
|
|
1164
1249
|
const handleParserErrors = _react.useCallback.call(void 0, (errors) => {
|
|
1165
1250
|
const list2 = Array.isArray(errors) ? errors : [];
|
|
1166
1251
|
const l = latest.current;
|
|
1167
|
-
_optionalChain([l, 'access',
|
|
1168
|
-
const real = list2.filter((e) => _optionalChain([e, 'optionalAccess',
|
|
1252
|
+
_optionalChain([l, 'access', _53 => _53.onError, 'optionalCall', _54 => _54(list2)]);
|
|
1253
|
+
const real = list2.filter((e) => _optionalChain([e, 'optionalAccess', _55 => _55.severity]) !== "warning");
|
|
1169
1254
|
if (real.length > 0) {
|
|
1170
|
-
_optionalChain([l, 'access',
|
|
1255
|
+
_optionalChain([l, 'access', _56 => _56.onJuneError, 'optionalCall', _57 => _57(new (0, _chunkG6YPSE6Jcjs.JuneError)("PARSE_ERROR", `OpenUI reported ${real.length} error(s)`, { details: real }))]);
|
|
1171
1256
|
}
|
|
1172
1257
|
if (list2.length > 0 && !l.onError && !l.onJuneError) {
|
|
1173
1258
|
console.warn("[june-ui] OpenUI reported errors:", list2);
|
|
1174
1259
|
}
|
|
1175
1260
|
}, []);
|
|
1176
1261
|
const handleBoundaryError = _react.useCallback.call(void 0, (error, info) => {
|
|
1177
|
-
_optionalChain([latest, 'access',
|
|
1262
|
+
_optionalChain([latest, 'access', _58 => _58.current, 'access', _59 => _59.onJuneError, 'optionalCall', _60 => _60(
|
|
1178
1263
|
new (0, _chunkG6YPSE6Jcjs.JuneError)("RENDER_ERROR", error.message, {
|
|
1179
1264
|
cause: error,
|
|
1180
1265
|
details: { componentStack: info.componentStack }
|
|
1181
1266
|
})
|
|
1182
1267
|
)]);
|
|
1183
1268
|
}, []);
|
|
1184
|
-
const handleDocumentError = _react.useCallback.call(void 0, (error) => _optionalChain([latest, 'access',
|
|
1269
|
+
const handleDocumentError = _react.useCallback.call(void 0, (error) => _optionalChain([latest, 'access', _61 => _61.current, 'access', _62 => _62.onJuneError, 'optionalCall', _63 => _63(error)]), []);
|
|
1185
1270
|
const runtime = _react.useMemo.call(void 0, () => ({ isStreaming }), [isStreaming]);
|
|
1186
1271
|
const content = _react.useMemo.call(void 0,
|
|
1187
1272
|
() => resolveMixedContent(response, { mixedContent, isStreaming, repair, markdown: textFormat === "markdown" }),
|
|
@@ -1227,8 +1312,8 @@ function JuneRenderer(props) {
|
|
|
1227
1312
|
|
|
1228
1313
|
var NAME = /^[A-Z][A-Za-z0-9_]*$/;
|
|
1229
1314
|
function isZodObject(value) {
|
|
1230
|
-
const def = _optionalChain([value, 'optionalAccess',
|
|
1231
|
-
return _optionalChain([def, 'optionalAccess',
|
|
1315
|
+
const def = _optionalChain([value, 'optionalAccess', _64 => _64._zod, 'optionalAccess', _65 => _65.def]);
|
|
1316
|
+
return _optionalChain([def, 'optionalAccess', _66 => _66.type]) === "object";
|
|
1232
1317
|
}
|
|
1233
1318
|
function validateComponentDefinition(definition) {
|
|
1234
1319
|
const { name } = definition;
|
|
@@ -1291,7 +1376,7 @@ function isJuneComponent(value) {
|
|
|
1291
1376
|
// src/engine/registry/component-registry.ts
|
|
1292
1377
|
|
|
1293
1378
|
function nameOf(component) {
|
|
1294
|
-
const name = _optionalChain([component, 'optionalAccess',
|
|
1379
|
+
const name = _optionalChain([component, 'optionalAccess', _67 => _67.name]);
|
|
1295
1380
|
if (typeof name !== "string" || name.length === 0) {
|
|
1296
1381
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", "Every component needs a non-empty string name");
|
|
1297
1382
|
}
|
|
@@ -1300,7 +1385,7 @@ function nameOf(component) {
|
|
|
1300
1385
|
function slotsOf(component) {
|
|
1301
1386
|
return isJuneComponent(component) ? component.june.slots : void 0;
|
|
1302
1387
|
}
|
|
1303
|
-
var isDev = () => typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1388
|
+
var isDev = () => typeof process !== "undefined" && _optionalChain([process, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.NODE_ENV]) === "development";
|
|
1304
1389
|
var ComponentRegistry = class {
|
|
1305
1390
|
constructor(options = {}) {
|
|
1306
1391
|
this.added = /* @__PURE__ */ new Map();
|
|
@@ -1413,7 +1498,7 @@ var ComponentRegistry = class {
|
|
|
1413
1498
|
if (!inBase || this.removed.has(name)) {
|
|
1414
1499
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", `Cannot remove "${name}": no component with that name.`);
|
|
1415
1500
|
}
|
|
1416
|
-
if (_optionalChain([this, 'access',
|
|
1501
|
+
if (_optionalChain([this, 'access', _70 => _70.base, 'optionalAccess', _71 => _71.root]) === name) {
|
|
1417
1502
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", `Cannot remove "${name}": it is the root component.`);
|
|
1418
1503
|
}
|
|
1419
1504
|
this.removed.add(name);
|
|
@@ -1467,17 +1552,17 @@ var ComponentRegistry = class {
|
|
|
1467
1552
|
try {
|
|
1468
1553
|
return base.extend(extension(true));
|
|
1469
1554
|
} catch (first) {
|
|
1470
|
-
if (added.some((c) => _optionalChain([slotsOf, 'call',
|
|
1555
|
+
if (added.some((c) => _optionalChain([slotsOf, 'call', _72 => _72(c), 'optionalAccess', _73 => _73.length]))) {
|
|
1471
1556
|
try {
|
|
1472
1557
|
const library = base.extend(extension(false));
|
|
1473
1558
|
if (isDev()) console.warn("[june-ui] Component slots were skipped (they need Zod 4.1+):", first);
|
|
1474
1559
|
return library;
|
|
1475
|
-
} catch (
|
|
1560
|
+
} catch (e4) {
|
|
1476
1561
|
}
|
|
1477
1562
|
}
|
|
1478
1563
|
try {
|
|
1479
1564
|
return this.rebuild(added, overrides);
|
|
1480
|
-
} catch (
|
|
1565
|
+
} catch (e5) {
|
|
1481
1566
|
throw first;
|
|
1482
1567
|
}
|
|
1483
1568
|
}
|
|
@@ -1486,7 +1571,7 @@ var ComponentRegistry = class {
|
|
|
1486
1571
|
const base = this.base;
|
|
1487
1572
|
const replace = new Map(overrides.map((c) => [nameOf(c), c]));
|
|
1488
1573
|
const components = Object.values(base.components).filter((c) => !this.removed.has(c.name)).map((c) => _nullishCoalesce(replace.get(c.name), () => ( c))).concat(added);
|
|
1489
|
-
const componentGroups = _optionalChain([base, 'access',
|
|
1574
|
+
const componentGroups = _optionalChain([base, 'access', _74 => _74.componentGroups, 'optionalAccess', _75 => _75.map, 'call', _76 => _76((g) => ({ ...g, components: g.components.filter((n) => !this.removed.has(n)) })), 'access', _77 => _77.filter, 'call', _78 => _78((g) => g.components.length > 0)]);
|
|
1490
1575
|
return _reactlang.createLibrary.call(void 0, {
|
|
1491
1576
|
components,
|
|
1492
1577
|
componentGroups,
|
|
@@ -1517,7 +1602,7 @@ function createJuneLibrary(options) {
|
|
|
1517
1602
|
const components = _nullishCoalesce(raw.components, () => ( []));
|
|
1518
1603
|
const names = /* @__PURE__ */ new Set();
|
|
1519
1604
|
for (const component of components) {
|
|
1520
|
-
if (typeof _optionalChain([component, 'optionalAccess',
|
|
1605
|
+
if (typeof _optionalChain([component, 'optionalAccess', _79 => _79.name]) !== "string" || component.name.length === 0) {
|
|
1521
1606
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("LIBRARY_ERROR", "Every component needs a non-empty string name");
|
|
1522
1607
|
}
|
|
1523
1608
|
if (names.has(component.name)) {
|
|
@@ -1570,7 +1655,7 @@ async function* iterateReadable(stream, signal) {
|
|
|
1570
1655
|
void reader.cancel().catch(() => {
|
|
1571
1656
|
});
|
|
1572
1657
|
};
|
|
1573
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1658
|
+
_optionalChain([signal, 'optionalAccess', _80 => _80.addEventListener, 'call', _81 => _81("abort", onAbort, { once: true })]);
|
|
1574
1659
|
try {
|
|
1575
1660
|
while (true) {
|
|
1576
1661
|
const { done, value } = await reader.read();
|
|
@@ -1578,10 +1663,10 @@ async function* iterateReadable(stream, signal) {
|
|
|
1578
1663
|
yield value;
|
|
1579
1664
|
}
|
|
1580
1665
|
} finally {
|
|
1581
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1666
|
+
_optionalChain([signal, 'optionalAccess', _82 => _82.removeEventListener, 'call', _83 => _83("abort", onAbort)]);
|
|
1582
1667
|
try {
|
|
1583
1668
|
reader.releaseLock();
|
|
1584
|
-
} catch (
|
|
1669
|
+
} catch (e6) {
|
|
1585
1670
|
}
|
|
1586
1671
|
}
|
|
1587
1672
|
}
|
|
@@ -1593,7 +1678,7 @@ function abortedError(partial) {
|
|
|
1593
1678
|
}
|
|
1594
1679
|
async function consumeStream(source, options = {}) {
|
|
1595
1680
|
const { signal, onText, allowEmpty = false } = options;
|
|
1596
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1681
|
+
if (_optionalChain([signal, 'optionalAccess', _84 => _84.aborted])) throw abortedError("");
|
|
1597
1682
|
const decoder = new TextDecoder();
|
|
1598
1683
|
let text = "";
|
|
1599
1684
|
let received = false;
|
|
@@ -1601,23 +1686,23 @@ async function consumeStream(source, options = {}) {
|
|
|
1601
1686
|
if (!delta) return;
|
|
1602
1687
|
received = true;
|
|
1603
1688
|
text += delta;
|
|
1604
|
-
_optionalChain([onText, 'optionalCall',
|
|
1689
|
+
_optionalChain([onText, 'optionalCall', _85 => _85(delta, text)]);
|
|
1605
1690
|
};
|
|
1606
1691
|
try {
|
|
1607
1692
|
for await (const chunk of toAsyncIterable(source, signal)) {
|
|
1608
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1693
|
+
if (_optionalChain([signal, 'optionalAccess', _86 => _86.aborted])) break;
|
|
1609
1694
|
push(typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }));
|
|
1610
1695
|
}
|
|
1611
1696
|
push(decoder.decode());
|
|
1612
1697
|
} catch (error) {
|
|
1613
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1698
|
+
if (_optionalChain([signal, 'optionalAccess', _87 => _87.aborted])) throw abortedError(text);
|
|
1614
1699
|
if (error instanceof _chunkG6YPSE6Jcjs.JuneError) throw error;
|
|
1615
1700
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_ERROR", "Stream was interrupted", {
|
|
1616
1701
|
cause: error,
|
|
1617
1702
|
details: { partial: text }
|
|
1618
1703
|
});
|
|
1619
1704
|
}
|
|
1620
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1705
|
+
if (_optionalChain([signal, 'optionalAccess', _88 => _88.aborted])) throw abortedError(text);
|
|
1621
1706
|
if (!received && !allowEmpty) {
|
|
1622
1707
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_EMPTY", "Stream completed without any content");
|
|
1623
1708
|
}
|
|
@@ -1686,7 +1771,7 @@ function jsonFieldExtractor(path) {
|
|
|
1686
1771
|
current = current[key];
|
|
1687
1772
|
}
|
|
1688
1773
|
return typeof current === "string" ? current : null;
|
|
1689
|
-
} catch (
|
|
1774
|
+
} catch (e7) {
|
|
1690
1775
|
return null;
|
|
1691
1776
|
}
|
|
1692
1777
|
};
|
|
@@ -1699,7 +1784,7 @@ async function fetchStream(input, options = {}) {
|
|
|
1699
1784
|
try {
|
|
1700
1785
|
response = await fetch(input, init);
|
|
1701
1786
|
} catch (error) {
|
|
1702
|
-
if (_optionalChain([init, 'access',
|
|
1787
|
+
if (_optionalChain([init, 'access', _89 => _89.signal, 'optionalAccess', _90 => _90.aborted])) {
|
|
1703
1788
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("STREAM_ABORTED", "Request was aborted", { cause: error });
|
|
1704
1789
|
}
|
|
1705
1790
|
throw new (0, _chunkG6YPSE6Jcjs.JuneError)("NETWORK_ERROR", "Network request failed", { cause: error });
|
|
@@ -1756,7 +1841,7 @@ function useJuneStream(options = {}) {
|
|
|
1756
1841
|
}, []);
|
|
1757
1842
|
const start = _react.useCallback.call(void 0,
|
|
1758
1843
|
async (input) => {
|
|
1759
|
-
_optionalChain([controllerRef, 'access',
|
|
1844
|
+
_optionalChain([controllerRef, 'access', _91 => _91.current, 'optionalAccess', _92 => _92.abort, 'call', _93 => _93()]);
|
|
1760
1845
|
const controller = new AbortController();
|
|
1761
1846
|
controllerRef.current = controller;
|
|
1762
1847
|
const runId = ++runIdRef.current;
|
|
@@ -1779,7 +1864,7 @@ function useJuneStream(options = {}) {
|
|
|
1779
1864
|
if (stale()) return null;
|
|
1780
1865
|
clearTimer();
|
|
1781
1866
|
setState({ response: text, isStreaming: false, status: "done", error: null });
|
|
1782
|
-
_optionalChain([optionsRef, 'access',
|
|
1867
|
+
_optionalChain([optionsRef, 'access', _94 => _94.current, 'access', _95 => _95.onComplete, 'optionalCall', _96 => _96(text)]);
|
|
1783
1868
|
return text;
|
|
1784
1869
|
} catch (caught) {
|
|
1785
1870
|
if (stale()) return null;
|
|
@@ -1793,7 +1878,7 @@ function useJuneStream(options = {}) {
|
|
|
1793
1878
|
status: aborted ? "aborted" : "error",
|
|
1794
1879
|
error: aborted ? null : error
|
|
1795
1880
|
});
|
|
1796
|
-
if (!aborted) _optionalChain([optionsRef, 'access',
|
|
1881
|
+
if (!aborted) _optionalChain([optionsRef, 'access', _97 => _97.current, 'access', _98 => _98.onError, 'optionalCall', _99 => _99(error)]);
|
|
1797
1882
|
return null;
|
|
1798
1883
|
}
|
|
1799
1884
|
},
|
|
@@ -1804,10 +1889,10 @@ function useJuneStream(options = {}) {
|
|
|
1804
1889
|
[start]
|
|
1805
1890
|
);
|
|
1806
1891
|
const abort = _react.useCallback.call(void 0, () => {
|
|
1807
|
-
_optionalChain([controllerRef, 'access',
|
|
1892
|
+
_optionalChain([controllerRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.abort, 'call', _102 => _102()]);
|
|
1808
1893
|
}, []);
|
|
1809
1894
|
const reset = _react.useCallback.call(void 0, () => {
|
|
1810
|
-
_optionalChain([controllerRef, 'access',
|
|
1895
|
+
_optionalChain([controllerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.abort, 'call', _105 => _105()]);
|
|
1811
1896
|
runIdRef.current++;
|
|
1812
1897
|
textRef.current = "";
|
|
1813
1898
|
clearTimer();
|
|
@@ -1816,7 +1901,7 @@ function useJuneStream(options = {}) {
|
|
|
1816
1901
|
_react.useEffect.call(void 0,
|
|
1817
1902
|
() => () => {
|
|
1818
1903
|
runIdRef.current++;
|
|
1819
|
-
_optionalChain([controllerRef, 'access',
|
|
1904
|
+
_optionalChain([controllerRef, 'access', _106 => _106.current, 'optionalAccess', _107 => _107.abort, 'call', _108 => _108()]);
|
|
1820
1905
|
clearTimer();
|
|
1821
1906
|
},
|
|
1822
1907
|
[clearTimer]
|
|
@@ -2096,7 +2181,7 @@ function Dropdown({ trigger, children, align = "start", className, onOpen }) {
|
|
|
2096
2181
|
return () => document.removeEventListener("mousedown", onDown);
|
|
2097
2182
|
}, [open]);
|
|
2098
2183
|
const toggle = () => setOpen((v) => {
|
|
2099
|
-
if (!v) _optionalChain([onOpen, 'optionalCall',
|
|
2184
|
+
if (!v) _optionalChain([onOpen, 'optionalCall', _109 => _109()]);
|
|
2100
2185
|
return !v;
|
|
2101
2186
|
});
|
|
2102
2187
|
const close = () => setOpen(false);
|
|
@@ -2230,7 +2315,7 @@ function ColorPicker({ label, icon, colors, current, disabled, resetLabel, onPic
|
|
|
2230
2315
|
style: { background: c },
|
|
2231
2316
|
"aria-label": c,
|
|
2232
2317
|
title: c,
|
|
2233
|
-
"data-active": _optionalChain([current, 'optionalAccess',
|
|
2318
|
+
"data-active": _optionalChain([current, 'optionalAccess', _110 => _110.toLowerCase, 'call', _111 => _111()]) === c ? true : void 0,
|
|
2234
2319
|
onMouseDown: (e) => e.preventDefault(),
|
|
2235
2320
|
onClick: () => {
|
|
2236
2321
|
onPick(c);
|
|
@@ -2344,7 +2429,7 @@ function ImagePanel({ editor, close, onNotice }) {
|
|
|
2344
2429
|
{
|
|
2345
2430
|
type: "button",
|
|
2346
2431
|
className: "june-doc__dropzone",
|
|
2347
|
-
onClick: () => _optionalChain([file, 'access',
|
|
2432
|
+
onClick: () => _optionalChain([file, 'access', _112 => _112.current, 'optionalAccess', _113 => _113.click, 'call', _114 => _114()]),
|
|
2348
2433
|
onDragOver: (e) => e.preventDefault(),
|
|
2349
2434
|
onDrop: (e) => {
|
|
2350
2435
|
e.preventDefault();
|
|
@@ -2363,7 +2448,7 @@ function ImagePanel({ editor, close, onNotice }) {
|
|
|
2363
2448
|
type: "file",
|
|
2364
2449
|
accept: "image/*",
|
|
2365
2450
|
hidden: true,
|
|
2366
|
-
onChange: (e) => fromFile(_optionalChain([e, 'access',
|
|
2451
|
+
onChange: (e) => fromFile(_optionalChain([e, 'access', _115 => _115.target, 'access', _116 => _116.files, 'optionalAccess', _117 => _117[0]]))
|
|
2367
2452
|
}
|
|
2368
2453
|
),
|
|
2369
2454
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "june-doc__or", children: "or" }),
|
|
@@ -2468,9 +2553,9 @@ function DocumentToolbar(props) {
|
|
|
2468
2553
|
};
|
|
2469
2554
|
}
|
|
2470
2555
|
});
|
|
2471
|
-
const run = () => _optionalChain([editor, 'optionalAccess',
|
|
2556
|
+
const run = () => _optionalChain([editor, 'optionalAccess', _118 => _118.chain, 'call', _119 => _119(), 'access', _120 => _120.focus, 'call', _121 => _121()]);
|
|
2472
2557
|
const off = !editor || !editable;
|
|
2473
|
-
const style = _optionalChain([s, 'optionalAccess',
|
|
2558
|
+
const style = _optionalChain([s, 'optionalAccess', _122 => _122.codeBlock]) ? "code" : _optionalChain([s, 'optionalAccess', _123 => _123.h1]) ? "1" : _optionalChain([s, 'optionalAccess', _124 => _124.h2]) ? "2" : _optionalChain([s, 'optionalAccess', _125 => _125.h3]) ? "3" : _optionalChain([s, 'optionalAccess', _126 => _126.quote]) ? "quote" : "p";
|
|
2474
2559
|
const setStyle = (v) => {
|
|
2475
2560
|
if (!editor || !s) return;
|
|
2476
2561
|
let c = editor.chain().focus();
|
|
@@ -2484,35 +2569,35 @@ function DocumentToolbar(props) {
|
|
|
2484
2569
|
}
|
|
2485
2570
|
c.run();
|
|
2486
2571
|
};
|
|
2487
|
-
const fontKnown = FONT_FAMILIES.some((f) => f.value === _optionalChain([s, 'optionalAccess',
|
|
2488
|
-
const sizes = _optionalChain([s, 'optionalAccess',
|
|
2572
|
+
const fontKnown = FONT_FAMILIES.some((f) => f.value === _optionalChain([s, 'optionalAccess', _127 => _127.fontFamily]));
|
|
2573
|
+
const sizes = _optionalChain([s, 'optionalAccess', _128 => _128.fontSize]) && !FONT_SIZES.includes(Number(s.fontSize)) ? [...FONT_SIZES, Number(s.fontSize)].sort((a, b) => a - b) : FONT_SIZES;
|
|
2489
2574
|
if (!editable) return null;
|
|
2490
2575
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc__ribbon", role: "toolbar", "aria-label": "Document formatting", children: [
|
|
2491
2576
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "june-doc__row", children: [
|
|
2492
2577
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "History", children: [
|
|
2493
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Undo", icon: "undo", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2494
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Redo", icon: "redo", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Undo", icon: "undo", disabled: off || !_optionalChain([s, 'optionalAccess', _129 => _129.canUndo]), onClick: () => _optionalChain([run, 'call', _130 => _130(), 'optionalAccess', _131 => _131.undo, 'call', _132 => _132(), 'access', _133 => _133.run, 'call', _134 => _134()]) }),
|
|
2579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Redo", icon: "redo", disabled: off || !_optionalChain([s, 'optionalAccess', _135 => _135.canRedo]), onClick: () => _optionalChain([run, 'call', _136 => _136(), 'optionalAccess', _137 => _137.redo, 'call', _138 => _138(), 'access', _139 => _139.run, 'call', _140 => _140()]) })
|
|
2495
2580
|
] }),
|
|
2496
2581
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Format", children: [
|
|
2497
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bold", icon: "bold", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2498
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Italic", icon: "italic", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2499
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Underline", icon: "underline", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2500
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Strikethrough", icon: "strike", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2501
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Inline code", icon: "code", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2502
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Superscript", icon: "superscript", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2503
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Subscript", icon: "subscript", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bold", icon: "bold", toggle: true, active: _optionalChain([s, 'optionalAccess', _141 => _141.bold]), disabled: off, onClick: () => _optionalChain([run, 'call', _142 => _142(), 'optionalAccess', _143 => _143.toggleBold, 'call', _144 => _144(), 'access', _145 => _145.run, 'call', _146 => _146()]) }),
|
|
2583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Italic", icon: "italic", toggle: true, active: _optionalChain([s, 'optionalAccess', _147 => _147.italic]), disabled: off, onClick: () => _optionalChain([run, 'call', _148 => _148(), 'optionalAccess', _149 => _149.toggleItalic, 'call', _150 => _150(), 'access', _151 => _151.run, 'call', _152 => _152()]) }),
|
|
2584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Underline", icon: "underline", toggle: true, active: _optionalChain([s, 'optionalAccess', _153 => _153.underline]), disabled: off, onClick: () => _optionalChain([run, 'call', _154 => _154(), 'optionalAccess', _155 => _155.toggleUnderline, 'call', _156 => _156(), 'access', _157 => _157.run, 'call', _158 => _158()]) }),
|
|
2585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Strikethrough", icon: "strike", toggle: true, active: _optionalChain([s, 'optionalAccess', _159 => _159.strike]), disabled: off, onClick: () => _optionalChain([run, 'call', _160 => _160(), 'optionalAccess', _161 => _161.toggleStrike, 'call', _162 => _162(), 'access', _163 => _163.run, 'call', _164 => _164()]) }),
|
|
2586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Inline code", icon: "code", toggle: true, active: _optionalChain([s, 'optionalAccess', _165 => _165.code]), disabled: off, onClick: () => _optionalChain([run, 'call', _166 => _166(), 'optionalAccess', _167 => _167.toggleCode, 'call', _168 => _168(), 'access', _169 => _169.run, 'call', _170 => _170()]) }),
|
|
2587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Superscript", icon: "superscript", toggle: true, active: _optionalChain([s, 'optionalAccess', _171 => _171.sup]), disabled: off, onClick: () => _optionalChain([run, 'call', _172 => _172(), 'optionalAccess', _173 => _173.toggleSuperscript, 'call', _174 => _174(), 'access', _175 => _175.run, 'call', _176 => _176()]) }),
|
|
2588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Subscript", icon: "subscript", toggle: true, active: _optionalChain([s, 'optionalAccess', _177 => _177.sub]), disabled: off, onClick: () => _optionalChain([run, 'call', _178 => _178(), 'optionalAccess', _179 => _179.toggleSubscript, 'call', _180 => _180(), 'access', _181 => _181.run, 'call', _182 => _182()]) })
|
|
2504
2589
|
] }),
|
|
2505
2590
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Align", children: [
|
|
2506
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align left", icon: "alignLeft", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2507
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align center", icon: "alignCenter", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align right", icon: "alignRight", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Justify", icon: "alignJustify", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align left", icon: "alignLeft", toggle: true, active: _optionalChain([s, 'optionalAccess', _183 => _183.left]), disabled: off, onClick: () => _optionalChain([run, 'call', _184 => _184(), 'optionalAccess', _185 => _185.setTextAlign, 'call', _186 => _186("left"), 'access', _187 => _187.run, 'call', _188 => _188()]) }),
|
|
2592
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align center", icon: "alignCenter", toggle: true, active: _optionalChain([s, 'optionalAccess', _189 => _189.center]), disabled: off, onClick: () => _optionalChain([run, 'call', _190 => _190(), 'optionalAccess', _191 => _191.setTextAlign, 'call', _192 => _192("center"), 'access', _193 => _193.run, 'call', _194 => _194()]) }),
|
|
2593
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Align right", icon: "alignRight", toggle: true, active: _optionalChain([s, 'optionalAccess', _195 => _195.right]), disabled: off, onClick: () => _optionalChain([run, 'call', _196 => _196(), 'optionalAccess', _197 => _197.setTextAlign, 'call', _198 => _198("right"), 'access', _199 => _199.run, 'call', _200 => _200()]) }),
|
|
2594
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Justify", icon: "alignJustify", toggle: true, active: _optionalChain([s, 'optionalAccess', _201 => _201.justify]), disabled: off, onClick: () => _optionalChain([run, 'call', _202 => _202(), 'optionalAccess', _203 => _203.setTextAlign, 'call', _204 => _204("justify"), 'access', _205 => _205.run, 'call', _206 => _206()]) })
|
|
2510
2595
|
] }),
|
|
2511
2596
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Lists", children: [
|
|
2512
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bullet list", icon: "list", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Numbered list", icon: "listOrdered", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2514
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Decrease indent", icon: "outdent", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2515
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Increase indent", icon: "indent", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2597
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Bullet list", icon: "list", toggle: true, active: _optionalChain([s, 'optionalAccess', _207 => _207.bullet]), disabled: off, onClick: () => _optionalChain([run, 'call', _208 => _208(), 'optionalAccess', _209 => _209.toggleBulletList, 'call', _210 => _210(), 'access', _211 => _211.run, 'call', _212 => _212()]) }),
|
|
2598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Numbered list", icon: "listOrdered", toggle: true, active: _optionalChain([s, 'optionalAccess', _213 => _213.ordered]), disabled: off, onClick: () => _optionalChain([run, 'call', _214 => _214(), 'optionalAccess', _215 => _215.toggleOrderedList, 'call', _216 => _216(), 'access', _217 => _217.run, 'call', _218 => _218()]) }),
|
|
2599
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Decrease indent", icon: "outdent", disabled: off || !_optionalChain([s, 'optionalAccess', _219 => _219.canLift]), onClick: () => _optionalChain([run, 'call', _220 => _220(), 'optionalAccess', _221 => _221.liftListItem, 'call', _222 => _222("listItem"), 'access', _223 => _223.run, 'call', _224 => _224()]) }),
|
|
2600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Increase indent", icon: "indent", disabled: off || !_optionalChain([s, 'optionalAccess', _225 => _225.canSink]), onClick: () => _optionalChain([run, 'call', _226 => _226(), 'optionalAccess', _227 => _227.sinkListItem, 'call', _228 => _228("listItem"), 'access', _229 => _229.run, 'call', _230 => _230()]) })
|
|
2516
2601
|
] }),
|
|
2517
2602
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2518
2603
|
"button",
|
|
@@ -2546,15 +2631,15 @@ function DocumentToolbar(props) {
|
|
|
2546
2631
|
className: "june-doc__select june-doc__select--font",
|
|
2547
2632
|
"aria-label": "Font family",
|
|
2548
2633
|
disabled: off,
|
|
2549
|
-
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2634
|
+
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _231 => _231.fontFamily]), () => ( "")),
|
|
2550
2635
|
onChange: (e) => {
|
|
2551
2636
|
const v = e.target.value;
|
|
2552
|
-
if (v) _optionalChain([run, 'call',
|
|
2553
|
-
else _optionalChain([run, 'call',
|
|
2637
|
+
if (v) _optionalChain([run, 'call', _232 => _232(), 'optionalAccess', _233 => _233.setFontFamily, 'call', _234 => _234(v), 'access', _235 => _235.run, 'call', _236 => _236()]);
|
|
2638
|
+
else _optionalChain([run, 'call', _237 => _237(), 'optionalAccess', _238 => _238.unsetFontFamily, 'call', _239 => _239(), 'access', _240 => _240.run, 'call', _241 => _241()]);
|
|
2554
2639
|
},
|
|
2555
2640
|
children: [
|
|
2556
2641
|
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)),
|
|
2557
|
-
!fontKnown && _optionalChain([s, 'optionalAccess',
|
|
2642
|
+
!fontKnown && _optionalChain([s, 'optionalAccess', _242 => _242.fontFamily]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: s.fontFamily, children: s.fontFamily.split(",")[0].replace(/['"]/g, "") }) : null
|
|
2558
2643
|
]
|
|
2559
2644
|
}
|
|
2560
2645
|
) }),
|
|
@@ -2564,11 +2649,11 @@ function DocumentToolbar(props) {
|
|
|
2564
2649
|
className: "june-doc__select june-doc__select--size",
|
|
2565
2650
|
"aria-label": "Font size",
|
|
2566
2651
|
disabled: off,
|
|
2567
|
-
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2652
|
+
value: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _243 => _243.fontSize]), () => ( "")),
|
|
2568
2653
|
onChange: (e) => {
|
|
2569
2654
|
const v = e.target.value;
|
|
2570
|
-
if (v) _optionalChain([run, 'call',
|
|
2571
|
-
else _optionalChain([run, 'call',
|
|
2655
|
+
if (v) _optionalChain([run, 'call', _244 => _244(), 'optionalAccess', _245 => _245.setFontSize, 'call', _246 => _246(`${v}px`), 'access', _247 => _247.run, 'call', _248 => _248()]);
|
|
2656
|
+
else _optionalChain([run, 'call', _249 => _249(), 'optionalAccess', _250 => _250.unsetFontSize, 'call', _251 => _251(), 'access', _252 => _252.run, 'call', _253 => _253()]);
|
|
2572
2657
|
},
|
|
2573
2658
|
children: [
|
|
2574
2659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "", children: "Auto" }),
|
|
@@ -2579,8 +2664,8 @@ function DocumentToolbar(props) {
|
|
|
2579
2664
|
] }),
|
|
2580
2665
|
/* @__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" }) }),
|
|
2581
2666
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Group, { label: "Document", children: [
|
|
2582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert page break", icon: "pageBreak", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert divider", icon: "divider", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert page break", icon: "pageBreak", disabled: off, onClick: () => _optionalChain([run, 'call', _254 => _254(), 'optionalAccess', _255 => _255.setPageBreak, 'call', _256 => _256(), 'access', _257 => _257.run, 'call', _258 => _258()]) }),
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Insert divider", icon: "divider", disabled: off, onClick: () => _optionalChain([run, 'call', _259 => _259(), 'optionalAccess', _260 => _260.setHorizontalRule, 'call', _261 => _261(), 'access', _262 => _262.run, 'call', _263 => _263()]) }),
|
|
2584
2669
|
/* @__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 }),
|
|
2585
2670
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Find and replace", icon: "search", toggle: true, active: findOpen, onClick: onToggleFind })
|
|
2586
2671
|
] }),
|
|
@@ -2591,11 +2676,11 @@ function DocumentToolbar(props) {
|
|
|
2591
2676
|
label: "Text color",
|
|
2592
2677
|
icon: "palette",
|
|
2593
2678
|
colors: TEXT_COLORS,
|
|
2594
|
-
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2679
|
+
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _264 => _264.color]), () => ( null)),
|
|
2595
2680
|
disabled: off,
|
|
2596
2681
|
resetLabel: "Default color",
|
|
2597
|
-
onPick: (c) => _optionalChain([run, 'call',
|
|
2598
|
-
onReset: () => _optionalChain([run, 'call',
|
|
2682
|
+
onPick: (c) => _optionalChain([run, 'call', _265 => _265(), 'optionalAccess', _266 => _266.setColor, 'call', _267 => _267(c), 'access', _268 => _268.run, 'call', _269 => _269()]),
|
|
2683
|
+
onReset: () => _optionalChain([run, 'call', _270 => _270(), 'optionalAccess', _271 => _271.unsetColor, 'call', _272 => _272(), 'access', _273 => _273.run, 'call', _274 => _274()])
|
|
2599
2684
|
}
|
|
2600
2685
|
),
|
|
2601
2686
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2604,11 +2689,11 @@ function DocumentToolbar(props) {
|
|
|
2604
2689
|
label: "Highlight",
|
|
2605
2690
|
icon: "highlighter",
|
|
2606
2691
|
colors: HIGHLIGHT_COLORS,
|
|
2607
|
-
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2692
|
+
current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _275 => _275.highlight]), () => ( null)),
|
|
2608
2693
|
disabled: off,
|
|
2609
2694
|
resetLabel: "No highlight",
|
|
2610
|
-
onPick: (c) => _optionalChain([run, 'call',
|
|
2611
|
-
onReset: () => _optionalChain([run, 'call',
|
|
2695
|
+
onPick: (c) => _optionalChain([run, 'call', _276 => _276(), 'optionalAccess', _277 => _277.setHighlight, 'call', _278 => _278({ color: c }), 'access', _279 => _279.run, 'call', _280 => _280()]),
|
|
2696
|
+
onReset: () => _optionalChain([run, 'call', _281 => _281(), 'optionalAccess', _282 => _282.unsetHighlight, 'call', _283 => _283(), 'access', _284 => _284.run, 'call', _285 => _285()])
|
|
2612
2697
|
}
|
|
2613
2698
|
)
|
|
2614
2699
|
] }),
|
|
@@ -2616,24 +2701,24 @@ function DocumentToolbar(props) {
|
|
|
2616
2701
|
editor ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2617
2702
|
Dropdown,
|
|
2618
2703
|
{
|
|
2619
|
-
trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Link", icon: "link", toggle: true, active: _optionalChain([s, 'optionalAccess',
|
|
2620
|
-
children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkPanel, { editor, href: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2704
|
+
trigger: ({ open, toggle }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Link", icon: "link", toggle: true, active: _optionalChain([s, 'optionalAccess', _286 => _286.link]) || open, disabled: off, onClick: toggle }),
|
|
2705
|
+
children: (close) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkPanel, { editor, href: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _287 => _287.linkHref]), () => ( "")), isLink: !!_optionalChain([s, 'optionalAccess', _288 => _288.link]), close })
|
|
2621
2706
|
}
|
|
2622
2707
|
) : null,
|
|
2623
2708
|
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,
|
|
2624
2709
|
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
|
|
2625
2710
|
] }),
|
|
2626
|
-
/* @__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',
|
|
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', _289 => _289(), 'optionalAccess', _290 => _290.unsetAllMarks, 'call', _291 => _291(), 'access', _292 => _292.clearNodes, 'call', _293 => _293(), 'access', _294 => _294.run, 'call', _295 => _295()]) }) })
|
|
2627
2712
|
] }) : null,
|
|
2628
|
-
_optionalChain([s, 'optionalAccess',
|
|
2629
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add row below", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add column right", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete row", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete column", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2633
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Merge cells", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Split cell", disabled: off || !_optionalChain([s, 'optionalAccess',
|
|
2635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Toggle header row", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete table", disabled: off, onClick: () => _optionalChain([run, 'call',
|
|
2713
|
+
_optionalChain([s, 'optionalAccess', _296 => _296.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: [
|
|
2714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add row below", disabled: off, onClick: () => _optionalChain([run, 'call', _297 => _297(), 'optionalAccess', _298 => _298.addRowAfter, 'call', _299 => _299(), 'access', _300 => _300.run, 'call', _301 => _301()]), children: "+ Row" }),
|
|
2715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Add column right", disabled: off, onClick: () => _optionalChain([run, 'call', _302 => _302(), 'optionalAccess', _303 => _303.addColumnAfter, 'call', _304 => _304(), 'access', _305 => _305.run, 'call', _306 => _306()]), children: "+ Column" }),
|
|
2716
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete row", disabled: off, onClick: () => _optionalChain([run, 'call', _307 => _307(), 'optionalAccess', _308 => _308.deleteRow, 'call', _309 => _309(), 'access', _310 => _310.run, 'call', _311 => _311()]), children: "\u2212 Row" }),
|
|
2717
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete column", disabled: off, onClick: () => _optionalChain([run, 'call', _312 => _312(), 'optionalAccess', _313 => _313.deleteColumn, 'call', _314 => _314(), 'access', _315 => _315.run, 'call', _316 => _316()]), children: "\u2212 Column" }),
|
|
2718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Merge cells", disabled: off || !_optionalChain([s, 'optionalAccess', _317 => _317.canMerge]), onClick: () => _optionalChain([run, 'call', _318 => _318(), 'optionalAccess', _319 => _319.mergeCells, 'call', _320 => _320(), 'access', _321 => _321.run, 'call', _322 => _322()]), children: "Merge" }),
|
|
2719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Split cell", disabled: off || !_optionalChain([s, 'optionalAccess', _323 => _323.canSplit]), onClick: () => _optionalChain([run, 'call', _324 => _324(), 'optionalAccess', _325 => _325.splitCell, 'call', _326 => _326(), 'access', _327 => _327.run, 'call', _328 => _328()]), children: "Split" }),
|
|
2720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Toggle header row", disabled: off, onClick: () => _optionalChain([run, 'call', _329 => _329(), 'optionalAccess', _330 => _330.toggleHeaderRow, 'call', _331 => _331(), 'access', _332 => _332.run, 'call', _333 => _333()]), children: "Header row" }),
|
|
2721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Btn, { label: "Delete table", disabled: off, onClick: () => _optionalChain([run, 'call', _334 => _334(), 'optionalAccess', _335 => _335.deleteTable, 'call', _336 => _336(), 'access', _337 => _337.run, 'call', _338 => _338()]), className: "june-doc__btn--danger", children: "Delete table" })
|
|
2637
2722
|
] }) }) : null
|
|
2638
2723
|
] });
|
|
2639
2724
|
}
|
|
@@ -2774,7 +2859,7 @@ function DocumentContent({ editor, layout = "page", zoom = 1, showMarks = false,
|
|
|
2774
2859
|
const page = paged ? Math.min(total, Math.max(1, Math.floor(y / stride) + 1)) : 1;
|
|
2775
2860
|
if (last.current.page !== page || last.current.pages !== total) {
|
|
2776
2861
|
last.current = { page, pages: total };
|
|
2777
|
-
_optionalChain([metricsRef, 'access',
|
|
2862
|
+
_optionalChain([metricsRef, 'access', _339 => _339.current, 'optionalCall', _340 => _340({ page, pages: total })]);
|
|
2778
2863
|
}
|
|
2779
2864
|
};
|
|
2780
2865
|
report();
|
|
@@ -2783,12 +2868,12 @@ function DocumentContent({ editor, layout = "page", zoom = 1, showMarks = false,
|
|
|
2783
2868
|
const onLoad = () => _chunkG6YPSE6Jcjs.remeasurePagination.call(void 0, editor);
|
|
2784
2869
|
prose.addEventListener("load", onLoad, true);
|
|
2785
2870
|
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(report) : null;
|
|
2786
|
-
_optionalChain([ro, 'optionalAccess',
|
|
2871
|
+
_optionalChain([ro, 'optionalAccess', _341 => _341.observe, 'call', _342 => _342(s)]);
|
|
2787
2872
|
return () => {
|
|
2788
2873
|
editor.off("transaction", report);
|
|
2789
2874
|
c.removeEventListener("scroll", report);
|
|
2790
2875
|
prose.removeEventListener("load", onLoad, true);
|
|
2791
|
-
_optionalChain([ro, 'optionalAccess',
|
|
2876
|
+
_optionalChain([ro, 'optionalAccess', _343 => _343.disconnect, 'call', _344 => _344()]);
|
|
2792
2877
|
};
|
|
2793
2878
|
}, [editor, paged, zoom, stride]);
|
|
2794
2879
|
const minHeight = paged ? pages * g.height + (pages - 1) * PAGE_GAP : void 0;
|
|
@@ -2829,12 +2914,12 @@ function DocumentFindBar({ editor, editable, onClose, onNotice }) {
|
|
|
2829
2914
|
editor,
|
|
2830
2915
|
selector: ({ editor: ed }) => {
|
|
2831
2916
|
const s = _chunkG6YPSE6Jcjs.getSearchState.call(void 0, ed);
|
|
2832
|
-
return { count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
2917
|
+
return { count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _345 => _345.matches, 'access', _346 => _346.length]), () => ( 0)), current: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _347 => _347.current]), () => ( -1)) };
|
|
2833
2918
|
}
|
|
2834
2919
|
});
|
|
2835
2920
|
_react.useEffect.call(void 0, () => {
|
|
2836
|
-
_optionalChain([input, 'access',
|
|
2837
|
-
_optionalChain([input, 'access',
|
|
2921
|
+
_optionalChain([input, 'access', _348 => _348.current, 'optionalAccess', _349 => _349.focus, 'call', _350 => _350()]);
|
|
2922
|
+
_optionalChain([input, 'access', _351 => _351.current, 'optionalAccess', _352 => _352.select, 'call', _353 => _353()]);
|
|
2838
2923
|
}, []);
|
|
2839
2924
|
_react.useEffect.call(void 0, () => {
|
|
2840
2925
|
_chunkG6YPSE6Jcjs.setSearch.call(void 0, editor, { term, caseSensitive, current: 0 });
|
|
@@ -2842,8 +2927,8 @@ function DocumentFindBar({ editor, editable, onClose, onNotice }) {
|
|
|
2842
2927
|
_react.useEffect.call(void 0, () => () => {
|
|
2843
2928
|
if (!editor.isDestroyed) _chunkG6YPSE6Jcjs.setSearch.call(void 0, editor, { term: "" });
|
|
2844
2929
|
}, [editor]);
|
|
2845
|
-
const count = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
2846
|
-
const current = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
2930
|
+
const count = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _354 => _354.count]), () => ( 0));
|
|
2931
|
+
const current = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _355 => _355.current]), () => ( -1));
|
|
2847
2932
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2848
2933
|
"div",
|
|
2849
2934
|
{
|
|
@@ -3121,12 +3206,12 @@ function toHalfPoints(value) {
|
|
|
3121
3206
|
if (!m) return void 0;
|
|
3122
3207
|
const n = Number(m[1]);
|
|
3123
3208
|
if (!Number.isFinite(n) || n <= 0) return void 0;
|
|
3124
|
-
const pt = _optionalChain([m, 'access',
|
|
3209
|
+
const pt = _optionalChain([m, 'access', _356 => _356[2], 'optionalAccess', _357 => _357.toLowerCase, 'call', _358 => _358()]) === "pt" ? n : n * 0.75;
|
|
3125
3210
|
return Math.round(pt * 2);
|
|
3126
3211
|
}
|
|
3127
3212
|
function firstFontFamily(value) {
|
|
3128
3213
|
if (typeof value !== "string") return void 0;
|
|
3129
|
-
const first = _optionalChain([value, 'access',
|
|
3214
|
+
const first = _optionalChain([value, 'access', _359 => _359.split, 'call', _360 => _360(","), 'access', _361 => _361[0], 'optionalAccess', _362 => _362.trim, 'call', _363 => _363(), 'access', _364 => _364.replace, 'call', _365 => _365(/^['"]|['"]$/g, "")]);
|
|
3130
3215
|
return first || void 0;
|
|
3131
3216
|
}
|
|
3132
3217
|
var ORDERED_REF = "june-ordered";
|
|
@@ -3142,9 +3227,9 @@ function runs(d, node, fmt) {
|
|
|
3142
3227
|
const marks = _nullishCoalesce(child.marks, () => ( []));
|
|
3143
3228
|
const has = (type) => marks.some((m) => m.type === type);
|
|
3144
3229
|
const link = marks.find((m) => m.type === "link");
|
|
3145
|
-
const style = _nullishCoalesce(_optionalChain([marks, 'access',
|
|
3230
|
+
const style = _nullishCoalesce(_optionalChain([marks, 'access', _366 => _366.find, 'call', _367 => _367((m) => m.type === "textStyle"), 'optionalAccess', _368 => _368.attrs]), () => ( {}));
|
|
3146
3231
|
const highlight = marks.find((m) => m.type === "highlight");
|
|
3147
|
-
const fill = highlight ? _nullishCoalesce(toDocxColor(_optionalChain([highlight, 'access',
|
|
3232
|
+
const fill = highlight ? _nullishCoalesce(toDocxColor(_optionalChain([highlight, 'access', _369 => _369.attrs, 'optionalAccess', _370 => _370.color])), () => ( "FFF59D")) : void 0;
|
|
3148
3233
|
const run = new d.TextRun({
|
|
3149
3234
|
text: child.text,
|
|
3150
3235
|
bold: fmt.bold || has("bold") || void 0,
|
|
@@ -3158,13 +3243,13 @@ function runs(d, node, fmt) {
|
|
|
3158
3243
|
color: _nullishCoalesce(toDocxColor(style.color), () => ( (link ? "0563C1" : void 0))),
|
|
3159
3244
|
shading: fill ? { type: d.ShadingType.CLEAR, fill, color: "auto" } : void 0
|
|
3160
3245
|
});
|
|
3161
|
-
const href = typeof _optionalChain([link, 'optionalAccess',
|
|
3246
|
+
const href = typeof _optionalChain([link, 'optionalAccess', _371 => _371.attrs, 'optionalAccess', _372 => _372.href]) === "string" ? _chunkG6YPSE6Jcjs.sanitizeHref.call(void 0, link.attrs.href) : null;
|
|
3162
3247
|
out.push(href ? new d.ExternalHyperlink({ link: href, children: [run] }) : run);
|
|
3163
3248
|
}
|
|
3164
3249
|
return out;
|
|
3165
3250
|
}
|
|
3166
3251
|
function paragraph(d, node, fmt, extra = {}) {
|
|
3167
|
-
const align = _optionalChain([node, 'access',
|
|
3252
|
+
const align = _optionalChain([node, 'access', _373 => _373.attrs, 'optionalAccess', _374 => _374.textAlign]);
|
|
3168
3253
|
return new d.Paragraph({
|
|
3169
3254
|
children: runs(d, node, fmt),
|
|
3170
3255
|
alignment: align === "center" ? d.AlignmentType.CENTER : align === "right" ? d.AlignmentType.RIGHT : align === "justify" ? d.AlignmentType.JUSTIFIED : void 0,
|
|
@@ -3226,8 +3311,8 @@ function table(d, node, state) {
|
|
|
3226
3311
|
return new d.Table({ rows, width: { size: 100, type: d.WidthType.PERCENTAGE } });
|
|
3227
3312
|
}
|
|
3228
3313
|
function image(d, node, state) {
|
|
3229
|
-
const src = typeof _optionalChain([node, 'access',
|
|
3230
|
-
const alt = typeof _optionalChain([node, 'access',
|
|
3314
|
+
const src = typeof _optionalChain([node, 'access', _375 => _375.attrs, 'optionalAccess', _376 => _376.src]) === "string" ? node.attrs.src : "";
|
|
3315
|
+
const alt = typeof _optionalChain([node, 'access', _377 => _377.attrs, 'optionalAccess', _378 => _378.alt]) === "string" ? node.attrs.alt : "";
|
|
3231
3316
|
const img = state.images.get(src);
|
|
3232
3317
|
if (img) {
|
|
3233
3318
|
return [
|
|
@@ -3259,7 +3344,7 @@ function image(d, node, state) {
|
|
|
3259
3344
|
}
|
|
3260
3345
|
function collectImages(nodes, out) {
|
|
3261
3346
|
for (const node of _nullishCoalesce(nodes, () => ( []))) {
|
|
3262
|
-
const src = _optionalChain([node, 'access',
|
|
3347
|
+
const src = _optionalChain([node, 'access', _379 => _379.attrs, 'optionalAccess', _380 => _380.src]);
|
|
3263
3348
|
if (node.type === "image" && typeof src === "string" && src && !out.has(src)) out.set(src, node.attrs);
|
|
3264
3349
|
if (node.content) collectImages(node.content, out);
|
|
3265
3350
|
}
|
|
@@ -3296,14 +3381,14 @@ async function loadImage(src, attrs) {
|
|
|
3296
3381
|
const type = IMAGE_TYPES[blob.type.toLowerCase()];
|
|
3297
3382
|
if (!type) return null;
|
|
3298
3383
|
const natural = await naturalSize(blob);
|
|
3299
|
-
let width = Number(_optionalChain([attrs, 'optionalAccess',
|
|
3300
|
-
let height = Number(_optionalChain([attrs, 'optionalAccess',
|
|
3384
|
+
let width = Number(_optionalChain([attrs, 'optionalAccess', _381 => _381.width])) || natural.width;
|
|
3385
|
+
let height = Number(_optionalChain([attrs, 'optionalAccess', _382 => _382.height])) || natural.height * width / natural.width;
|
|
3301
3386
|
if (width > MAX_IMAGE_WIDTH) {
|
|
3302
3387
|
height = height * MAX_IMAGE_WIDTH / width;
|
|
3303
3388
|
width = MAX_IMAGE_WIDTH;
|
|
3304
3389
|
}
|
|
3305
3390
|
return { data: new Uint8Array(await blob.arrayBuffer()), type, width: Math.round(width), height: Math.round(height) };
|
|
3306
|
-
} catch (
|
|
3391
|
+
} catch (e8) {
|
|
3307
3392
|
return null;
|
|
3308
3393
|
}
|
|
3309
3394
|
}
|
|
@@ -3328,7 +3413,7 @@ function blocks(d, nodes, fmt, state) {
|
|
|
3328
3413
|
out.push(paragraph(d, node, fmt));
|
|
3329
3414
|
break;
|
|
3330
3415
|
case "heading": {
|
|
3331
|
-
const level = Math.min(Math.max(Number(_optionalChain([node, 'access',
|
|
3416
|
+
const level = Math.min(Math.max(Number(_optionalChain([node, 'access', _383 => _383.attrs, 'optionalAccess', _384 => _384.level])) || 1, 1), 3);
|
|
3332
3417
|
out.push(paragraph(d, node, fmt, { heading: headings[level - 1] }));
|
|
3333
3418
|
break;
|
|
3334
3419
|
}
|
|
@@ -3462,7 +3547,7 @@ async function copyDocumentToClipboard(doc) {
|
|
|
3462
3547
|
|
|
3463
3548
|
${docToText(doc.json)}`;
|
|
3464
3549
|
try {
|
|
3465
|
-
if (typeof ClipboardItem !== "undefined" && _optionalChain([navigator, 'access',
|
|
3550
|
+
if (typeof ClipboardItem !== "undefined" && _optionalChain([navigator, 'access', _385 => _385.clipboard, 'optionalAccess', _386 => _386.write])) {
|
|
3466
3551
|
await navigator.clipboard.write([
|
|
3467
3552
|
new ClipboardItem({
|
|
3468
3553
|
"text/html": new Blob([html], { type: "text/html" }),
|
|
@@ -3473,7 +3558,7 @@ ${docToText(doc.json)}`;
|
|
|
3473
3558
|
}
|
|
3474
3559
|
await navigator.clipboard.writeText(text);
|
|
3475
3560
|
return true;
|
|
3476
|
-
} catch (
|
|
3561
|
+
} catch (e9) {
|
|
3477
3562
|
return false;
|
|
3478
3563
|
}
|
|
3479
3564
|
}
|
|
@@ -3535,12 +3620,12 @@ function DocumentEditorImpl(props) {
|
|
|
3535
3620
|
}
|
|
3536
3621
|
}, [contentKey]);
|
|
3537
3622
|
_react.useEffect.call(void 0, () => {
|
|
3538
|
-
if (parsed.error) _optionalChain([optionsRef, 'access',
|
|
3623
|
+
if (parsed.error) _optionalChain([optionsRef, 'access', _387 => _387.current, 'access', _388 => _388.onError, 'optionalCall', _389 => _389(parsed.error)]);
|
|
3539
3624
|
}, [parsed.error]);
|
|
3540
|
-
const title = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3541
|
-
const pending = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3625
|
+
const title = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _390 => _390.title]), () => ( titleProp)));
|
|
3626
|
+
const pending = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _391 => _391.pending]), () => ( null)));
|
|
3542
3627
|
const words = useDocumentValue(store, documentId, (r) => r ? _chunkG6YPSE6Jcjs.wordCountOf.call(void 0, r.json) : 0);
|
|
3543
|
-
const recordStatus = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
3628
|
+
const recordStatus = useDocumentValue(store, documentId, (r) => _nullishCoalesce(_optionalChain([r, 'optionalAccess', _392 => _392.status]), () => ( status)));
|
|
3544
3629
|
const [saveState, setSaveState] = _react.useState.call(void 0, "idle");
|
|
3545
3630
|
const [notice, setNotice] = _react.useState.call(void 0, null);
|
|
3546
3631
|
const [fullscreen, setFullscreen] = _react.useState.call(void 0, false);
|
|
@@ -3559,7 +3644,7 @@ function DocumentEditorImpl(props) {
|
|
|
3559
3644
|
};
|
|
3560
3645
|
}, [fullscreen]);
|
|
3561
3646
|
const lastSavedKey = _react.useRef.call(void 0, "");
|
|
3562
|
-
const seenRevision = _react.useRef.call(void 0, _nullishCoalesce(_optionalChain([store, 'access',
|
|
3647
|
+
const seenRevision = _react.useRef.call(void 0, _nullishCoalesce(_optionalChain([store, 'access', _393 => _393.get, 'call', _394 => _394(documentId), 'optionalAccess', _395 => _395.revision]), () => ( 0)));
|
|
3563
3648
|
const readyRef = _react.useRef.call(void 0, false);
|
|
3564
3649
|
const flash = _react.useCallback.call(void 0, (message) => {
|
|
3565
3650
|
setNotice(message);
|
|
@@ -3572,7 +3657,7 @@ function DocumentEditorImpl(props) {
|
|
|
3572
3657
|
const emitChange = _react.useCallback.call(void 0,
|
|
3573
3658
|
(source) => {
|
|
3574
3659
|
const record = store.get(documentId);
|
|
3575
|
-
if (record) _optionalChain([optionsRef, 'access',
|
|
3660
|
+
if (record) _optionalChain([optionsRef, 'access', _396 => _396.current, 'access', _397 => _397.onDocumentChange, 'optionalCall', _398 => _398({ ...snapshotOf(record), source })]);
|
|
3576
3661
|
},
|
|
3577
3662
|
[store, documentId]
|
|
3578
3663
|
);
|
|
@@ -3582,7 +3667,7 @@ function DocumentEditorImpl(props) {
|
|
|
3582
3667
|
const delay = _nullishCoalesce(options.autosaveDelay, () => ( 1500));
|
|
3583
3668
|
return delay > 0 ? _chunkG6YPSE6Jcjs.debounce.call(void 0, () => void saveRef.current(), delay) : null;
|
|
3584
3669
|
}, [options.autosaveDelay]);
|
|
3585
|
-
_react.useEffect.call(void 0, () => () => _optionalChain([autosave, 'optionalAccess',
|
|
3670
|
+
_react.useEffect.call(void 0, () => () => _optionalChain([autosave, 'optionalAccess', _399 => _399.flush, 'call', _400 => _400()]), [autosave]);
|
|
3586
3671
|
saveRef.current = async () => {
|
|
3587
3672
|
const record = store.get(documentId);
|
|
3588
3673
|
const onSave = optionsRef.current.onSave;
|
|
@@ -3610,7 +3695,7 @@ function DocumentEditorImpl(props) {
|
|
|
3610
3695
|
setSaveState(latestKey === key ? "saved" : "dirty");
|
|
3611
3696
|
} catch (error) {
|
|
3612
3697
|
setSaveState("error");
|
|
3613
|
-
_optionalChain([optionsRef, 'access',
|
|
3698
|
+
_optionalChain([optionsRef, 'access', _401 => _401.current, 'access', _402 => _402.onError, 'optionalCall', _403 => _403(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "DOCUMENT_ERROR", "Saving the document failed"))]);
|
|
3614
3699
|
}
|
|
3615
3700
|
};
|
|
3616
3701
|
const markDirty = _react.useCallback.call(void 0,
|
|
@@ -3620,7 +3705,7 @@ function DocumentEditorImpl(props) {
|
|
|
3620
3705
|
return;
|
|
3621
3706
|
}
|
|
3622
3707
|
setSaveState("dirty");
|
|
3623
|
-
_optionalChain([autosave, 'optionalCall',
|
|
3708
|
+
_optionalChain([autosave, 'optionalCall', _404 => _404()]);
|
|
3624
3709
|
},
|
|
3625
3710
|
[autosave]
|
|
3626
3711
|
);
|
|
@@ -3629,7 +3714,7 @@ function DocumentEditorImpl(props) {
|
|
|
3629
3714
|
const t = setTimeout(() => setSaveState((s) => s === "saved" ? "idle" : s), 2500);
|
|
3630
3715
|
return () => clearTimeout(t);
|
|
3631
3716
|
}, [saveState, options.onSave]);
|
|
3632
|
-
const [initialJson] = _react.useState.call(void 0, () => _nullishCoalesce(_nullishCoalesce(_optionalChain([store, 'access',
|
|
3717
|
+
const [initialJson] = _react.useState.call(void 0, () => _nullishCoalesce(_nullishCoalesce(_optionalChain([store, 'access', _405 => _405.get, 'call', _406 => _406(documentId), 'optionalAccess', _407 => _407.json]), () => ( parsed.json)), () => ( _chunkG6YPSE6Jcjs.emptyDoc.call(void 0, ))));
|
|
3633
3718
|
const extensions = _react.useMemo.call(void 0, () => _chunkG6YPSE6Jcjs.createDocumentExtensions.call(void 0, ), []);
|
|
3634
3719
|
const onUpdateRef = _react.useRef.call(void 0, () => {
|
|
3635
3720
|
});
|
|
@@ -3672,10 +3757,10 @@ function DocumentEditorImpl(props) {
|
|
|
3672
3757
|
markDirty(false);
|
|
3673
3758
|
} else if (outcome === "conflict") {
|
|
3674
3759
|
const record = store.get(documentId);
|
|
3675
|
-
_optionalChain([optionsRef, 'access',
|
|
3760
|
+
_optionalChain([optionsRef, 'access', _408 => _408.current, 'access', _409 => _409.onConflict, 'optionalCall', _410 => _410({
|
|
3676
3761
|
documentId,
|
|
3677
|
-
title: _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
3678
|
-
conflicts: _nullishCoalesce(_optionalChain([record, 'optionalAccess',
|
|
3762
|
+
title: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _411 => _411.title]), () => ( titleProp)),
|
|
3763
|
+
conflicts: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _412 => _412.pending, 'optionalAccess', _413 => _413.conflicts]), () => ( 1))
|
|
3679
3764
|
})]);
|
|
3680
3765
|
}
|
|
3681
3766
|
}, [store, documentId, titleProp, parsed.json, documentType, status, emitChange, markDirty]);
|
|
@@ -3702,7 +3787,7 @@ function DocumentEditorImpl(props) {
|
|
|
3702
3787
|
if (!record) return;
|
|
3703
3788
|
readyRef.current = true;
|
|
3704
3789
|
lastSavedKey.current = JSON.stringify([record.title, _chunkG6YPSE6Jcjs.docKey.call(void 0, record.json)]);
|
|
3705
|
-
_optionalChain([optionsRef, 'access',
|
|
3790
|
+
_optionalChain([optionsRef, 'access', _414 => _414.current, 'access', _415 => _415.onDocumentReady, 'optionalCall', _416 => _416(snapshotOf(record))]);
|
|
3706
3791
|
}, [editor, store, documentId, title]);
|
|
3707
3792
|
const handleTitle = (value) => {
|
|
3708
3793
|
store.setTitle(documentId, value);
|
|
@@ -3727,9 +3812,9 @@ function DocumentEditorImpl(props) {
|
|
|
3727
3812
|
// always the latest editor content
|
|
3728
3813
|
});
|
|
3729
3814
|
if (result.blob) downloadResult(result);
|
|
3730
|
-
_optionalChain([optionsRef, 'access',
|
|
3815
|
+
_optionalChain([optionsRef, 'access', _417 => _417.current, 'access', _418 => _418.onExport, 'optionalCall', _419 => _419({ documentId, format: format2, ...result })]);
|
|
3731
3816
|
} catch (error) {
|
|
3732
|
-
_optionalChain([optionsRef, 'access',
|
|
3817
|
+
_optionalChain([optionsRef, 'access', _420 => _420.current, 'access', _421 => _421.onError, 'optionalCall', _422 => _422(_chunkG6YPSE6Jcjs.toJuneError.call(void 0, error, "EXPORT_ERROR"))]);
|
|
3733
3818
|
flash("Export failed");
|
|
3734
3819
|
}
|
|
3735
3820
|
};
|
|
@@ -3901,7 +3986,7 @@ function withDocumentEditor(library) {
|
|
|
3901
3986
|
add: [{ component: JuneDocumentEditorComponent, slots: ["Card"] }]
|
|
3902
3987
|
}
|
|
3903
3988
|
});
|
|
3904
|
-
} catch (
|
|
3989
|
+
} catch (e10) {
|
|
3905
3990
|
return library.extend({ components: { add: [JuneDocumentEditorComponent] } });
|
|
3906
3991
|
}
|
|
3907
3992
|
}
|
|
@@ -3937,8 +4022,8 @@ function getDocumentEditorInstructions(options = {}) {
|
|
|
3937
4022
|
const rules = getDocumentEditorRules(options);
|
|
3938
4023
|
return ["Document drafting:", ...rules.map((rule, i) => `${i + 1}. ${rule}`)].join("\n");
|
|
3939
4024
|
}
|
|
3940
|
-
var EXAMPLE_NEW = 'root =
|
|
3941
|
-
var EXAMPLE_EDIT = 'root =
|
|
4025
|
+
var EXAMPLE_NEW = 'root = Card([doc])\ndoc = DocumentEditor("business-proposal", "Business Proposal", "## Executive Summary\\n\\nThis proposal outlines [SERVICE] for [CLIENT NAME].\\n\\n## Scope of Work\\n\\n- Discovery\\n- Delivery\\n\\n## Pricing\\n\\n| Item | Cost |\\n| --- | --- |\\n| Discovery | [AMOUNT] |", "proposal", "draft")';
|
|
4026
|
+
var EXAMPLE_EDIT = 'root = Card([doc])\ndoc = DocumentEditor("business-proposal", "Business Proposal", "## Executive Summary\\n\\nThis proposal outlines [SERVICE] for [CLIENT NAME].\\n\\n## Scope of Work\\n\\n- Discovery\\n- Delivery\\n\\n## Pricing\\n\\n| Item | Cost |\\n| --- | --- |\\n| Discovery | [AMOUNT] |\\n| Delivery | [AMOUNT] |", "proposal", "draft")';
|
|
3942
4027
|
function documentPromptOptions(options = {}) {
|
|
3943
4028
|
return {
|
|
3944
4029
|
additionalRules: getDocumentEditorRules(options),
|
|
@@ -3981,7 +4066,7 @@ var defaultToolApprovalLabels = {
|
|
|
3981
4066
|
var format = (value) => {
|
|
3982
4067
|
try {
|
|
3983
4068
|
return _nullishCoalesce(JSON.stringify(value, null, 2), () => ( String(value)));
|
|
3984
|
-
} catch (
|
|
4069
|
+
} catch (e11) {
|
|
3985
4070
|
return String(value);
|
|
3986
4071
|
}
|
|
3987
4072
|
};
|
|
@@ -3997,19 +4082,19 @@ function ToolApproval({
|
|
|
3997
4082
|
className
|
|
3998
4083
|
}) {
|
|
3999
4084
|
const labels = { ...defaultToolApprovalLabels, ...labelOverrides };
|
|
4000
|
-
const options = _optionalChain([request, 'access',
|
|
4085
|
+
const options = _optionalChain([request, 'access', _423 => _423.options, 'optionalAccess', _424 => _424.length]) ? request.options : ["approve", "reject"];
|
|
4001
4086
|
const [draft, setDraft] = _react.useState.call(void 0, null);
|
|
4002
4087
|
const [draftError, setDraftError] = _react.useState.call(void 0, null);
|
|
4003
4088
|
const titleId = _react.useId.call(void 0, );
|
|
4004
4089
|
const pending = status === "pending";
|
|
4005
4090
|
const decide = (decision) => {
|
|
4006
|
-
if (!disabled && pending) _optionalChain([onDecide, 'optionalCall',
|
|
4091
|
+
if (!disabled && pending) _optionalChain([onDecide, 'optionalCall', _425 => _425(decision)]);
|
|
4007
4092
|
};
|
|
4008
4093
|
const saveEdit = () => {
|
|
4009
4094
|
let editedArguments;
|
|
4010
4095
|
try {
|
|
4011
4096
|
editedArguments = JSON.parse(_nullishCoalesce(draft, () => ( "null")));
|
|
4012
|
-
} catch (
|
|
4097
|
+
} catch (e12) {
|
|
4013
4098
|
setDraftError(labels.invalidJson);
|
|
4014
4099
|
return;
|
|
4015
4100
|
}
|
|
@@ -4098,7 +4183,7 @@ function useToolApproval() {
|
|
|
4098
4183
|
const settle = _react.useCallback.call(void 0, (id, decision) => {
|
|
4099
4184
|
const resolve = waiters.current.get(id);
|
|
4100
4185
|
waiters.current.delete(id);
|
|
4101
|
-
_optionalChain([resolve, 'optionalCall',
|
|
4186
|
+
_optionalChain([resolve, 'optionalCall', _426 => _426(decision)]);
|
|
4102
4187
|
}, []);
|
|
4103
4188
|
const request = _react.useCallback.call(void 0, (input) => {
|
|
4104
4189
|
const id = _nullishCoalesce(input.id, () => ( nextId()));
|
|
@@ -4173,7 +4258,7 @@ function messageContentToText(content) {
|
|
|
4173
4258
|
function parse(data) {
|
|
4174
4259
|
try {
|
|
4175
4260
|
return JSON.parse(data);
|
|
4176
|
-
} catch (
|
|
4261
|
+
} catch (e13) {
|
|
4177
4262
|
return void 0;
|
|
4178
4263
|
}
|
|
4179
4264
|
}
|
|
@@ -4187,7 +4272,7 @@ function createLangGraphExtractor(options = {}) {
|
|
|
4187
4272
|
if (!Array.isArray(parsed)) return null;
|
|
4188
4273
|
const [chunk, metadata] = parsed;
|
|
4189
4274
|
if (!chunk || typeof chunk !== "object" || !isAiMessage(chunk)) return null;
|
|
4190
|
-
if (nodes && !(typeof _optionalChain([metadata, 'optionalAccess',
|
|
4275
|
+
if (nodes && !(typeof _optionalChain([metadata, 'optionalAccess', _427 => _427.langgraph_node]) === "string" && nodes.has(metadata.langgraph_node))) return null;
|
|
4191
4276
|
return messageContentToText(chunk.content) || null;
|
|
4192
4277
|
}
|
|
4193
4278
|
if (base === "messages/partial" || base === "messages/complete") {
|
|
@@ -4226,8 +4311,8 @@ function interruptToApprovalRequests(value, idPrefix = "interrupt") {
|
|
|
4226
4311
|
const configs = Array.isArray(hitl.review_configs) ? hitl.review_configs : [];
|
|
4227
4312
|
return hitl.action_requests.flatMap((action, index) => {
|
|
4228
4313
|
if (!action || typeof action.name !== "string") return [];
|
|
4229
|
-
const config = configs.find((c) => _optionalChain([c, 'optionalAccess',
|
|
4230
|
-
const allowed = Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
4314
|
+
const config = configs.find((c) => _optionalChain([c, 'optionalAccess', _428 => _428.action_name]) === action.name);
|
|
4315
|
+
const allowed = Array.isArray(_optionalChain([config, 'optionalAccess', _429 => _429.allowed_decisions])) ? config.allowed_decisions.filter(
|
|
4231
4316
|
(d) => d === "approve" || d === "reject" || d === "edit"
|
|
4232
4317
|
) : void 0;
|
|
4233
4318
|
return [
|