@agimon-ai/po-author 0.0.0-alpha.45 → 0.0.0-alpha.46
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/dist/extensions/native.mjs +71 -22
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +5 -2
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +5 -2
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +3 -2
- package/dist/extensions/web.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -486,7 +486,7 @@ var AuthorBrowserBridge = class {
|
|
|
486
486
|
service: "author.bridge",
|
|
487
487
|
method: "send",
|
|
488
488
|
input: {
|
|
489
|
-
sessionId: canvas.sessionId,
|
|
489
|
+
sessionId: canvas.sessionId.slice(canvas.sessionId.indexOf("/") + 1),
|
|
490
490
|
message: payload
|
|
491
491
|
}
|
|
492
492
|
}).catch((error) => console.warn(`Author canvas '${canvas.alias}' could not send '${payload.kind}': ${error instanceof Error ? error.message : String(error)}`));
|
|
@@ -1651,7 +1651,7 @@ function AuthorDocumentView(props) {
|
|
|
1651
1651
|
const drawing = !inspectingSource && !draft && !sending && props.onDraw !== void 0 && tool !== "pin";
|
|
1652
1652
|
const annotation = /* @__PURE__ */ jsx(AnnotationSurface, {
|
|
1653
1653
|
accessibilityLabel: props.name,
|
|
1654
|
-
zoomable: body.kind === "image",
|
|
1654
|
+
zoomable: body.kind === "image" || body.kind === "pdf" || body.kind === "video" && !!props.onResumeVideo,
|
|
1655
1655
|
onViewportChange: props.onViewportChange,
|
|
1656
1656
|
marks: inspectingSource ? [] : marks,
|
|
1657
1657
|
selectedId: inspectingSource ? void 0 : draft ? DRAFT_ID : props.selectedId,
|
|
@@ -1850,11 +1850,15 @@ function AuthorDocumentView(props) {
|
|
|
1850
1850
|
keyboardShouldPersistTaps: "handled",
|
|
1851
1851
|
scrollEnabled: !drawing,
|
|
1852
1852
|
children: [
|
|
1853
|
-
props.edit?.image ? /* @__PURE__ */ jsx(
|
|
1853
|
+
props.edit?.image ? /* @__PURE__ */ jsx(AnnotationSurface, {
|
|
1854
1854
|
accessibilityLabel: "Crop preview",
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1855
|
+
zoomable: true,
|
|
1856
|
+
marks: [],
|
|
1857
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
1858
|
+
source: { uri: props.edit.image.uri },
|
|
1859
|
+
style: [s.image, { aspectRatio: props.edit.image.aspectRatio }],
|
|
1860
|
+
resizeMode: "contain"
|
|
1861
|
+
})
|
|
1858
1862
|
}) : props.edit?.fragments !== void 0 ? /* @__PURE__ */ jsx(View, {
|
|
1859
1863
|
style: s.notes,
|
|
1860
1864
|
children: props.edit.fragments.map((fragment) => /* @__PURE__ */ jsxs(View, {
|
|
@@ -2141,6 +2145,44 @@ const s = StyleSheet.create((theme) => ({
|
|
|
2141
2145
|
grow: { flex: 1 }
|
|
2142
2146
|
}));
|
|
2143
2147
|
//#endregion
|
|
2148
|
+
//#region src/extensions/workspaces/sessions/(frontend)/_components/AuthorImageMeasure.native.tsx
|
|
2149
|
+
/** Reports a data-URI image's natural size. Android's Image.getSize cannot fetch data URIs, so a hidden drawn copy reports it instead. */
|
|
2150
|
+
function AuthorImageMeasure({ uri, onMeasured }) {
|
|
2151
|
+
const report = useRef(onMeasured);
|
|
2152
|
+
report.current = onMeasured;
|
|
2153
|
+
const [probe, setProbe] = useState(false);
|
|
2154
|
+
useEffect(() => {
|
|
2155
|
+
let live = true;
|
|
2156
|
+
setProbe(false);
|
|
2157
|
+
Image.getSize(uri, (width, height) => {
|
|
2158
|
+
if (live) report.current({
|
|
2159
|
+
width,
|
|
2160
|
+
height
|
|
2161
|
+
});
|
|
2162
|
+
}, () => {
|
|
2163
|
+
if (live) setProbe(true);
|
|
2164
|
+
});
|
|
2165
|
+
return () => {
|
|
2166
|
+
live = false;
|
|
2167
|
+
};
|
|
2168
|
+
}, [uri]);
|
|
2169
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spinner, { label: "Opening" }), probe && /* @__PURE__ */ jsx(Image, {
|
|
2170
|
+
source: { uri },
|
|
2171
|
+
resizeMethod: "scale",
|
|
2172
|
+
style: {
|
|
2173
|
+
position: "absolute",
|
|
2174
|
+
width: 1,
|
|
2175
|
+
height: 1,
|
|
2176
|
+
opacity: 0
|
|
2177
|
+
},
|
|
2178
|
+
onLoad: ({ nativeEvent: { source } }) => report.current({
|
|
2179
|
+
width: source.width,
|
|
2180
|
+
height: source.height
|
|
2181
|
+
}),
|
|
2182
|
+
onError: ({ nativeEvent }) => report.current({ error: String(nativeEvent.error) })
|
|
2183
|
+
})] });
|
|
2184
|
+
}
|
|
2185
|
+
//#endregion
|
|
2144
2186
|
//#region src/extensions/workspaces/sessions/(frontend)/_components/AuthorDocumentPanel.native.tsx
|
|
2145
2187
|
const notesStore = defineGlobalStore({});
|
|
2146
2188
|
const noteKey = (sessionId, path) => `${sessionId}\n${path}`;
|
|
@@ -2308,6 +2350,7 @@ function AuthorDocumentPanel({ path, ...props }) {
|
|
|
2308
2350
|
const alias = useSyncExternalStore(subscribeAliases, () => aliasStore.store.state[key]);
|
|
2309
2351
|
const ownedElsewhere = useSyncExternalStore(subscribeAuthorCanvasRejections, () => alias !== void 0 && sessionId !== null && authorCanvasRejection(sessionId, alias) !== void 0);
|
|
2310
2352
|
const [loaded, setLoaded] = useState();
|
|
2353
|
+
const [measuring, setMeasuring] = useState();
|
|
2311
2354
|
const draft = useSyncExternalStore(subscribeForms, () => formsStore.store.state[key]);
|
|
2312
2355
|
const setDraft = (value) => setForm(key, value);
|
|
2313
2356
|
const [storageState, setStorageState] = useState();
|
|
@@ -2440,22 +2483,11 @@ function AuthorDocumentPanel({ path, ...props }) {
|
|
|
2440
2483
|
setSeekSeconds(void 0);
|
|
2441
2484
|
setVideoFrame(void 0);
|
|
2442
2485
|
mediaTime.current = 0;
|
|
2443
|
-
} else {
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
file,
|
|
2449
|
-
body: {
|
|
2450
|
-
kind: "image",
|
|
2451
|
-
uri,
|
|
2452
|
-
aspectRatio: height > 0 ? width / height : 1,
|
|
2453
|
-
naturalWidth: width,
|
|
2454
|
-
naturalHeight: height
|
|
2455
|
-
}
|
|
2456
|
-
});
|
|
2457
|
-
}, fail);
|
|
2458
|
-
}
|
|
2486
|
+
} else setMeasuring({
|
|
2487
|
+
key,
|
|
2488
|
+
file,
|
|
2489
|
+
uri: `data:${file.mimeType};base64,${file.data}`
|
|
2490
|
+
});
|
|
2459
2491
|
})().catch(fail);
|
|
2460
2492
|
return () => controller.abort();
|
|
2461
2493
|
}, [
|
|
@@ -2503,6 +2535,23 @@ function AuthorDocumentPanel({ path, ...props }) {
|
|
|
2503
2535
|
}, [key, path]);
|
|
2504
2536
|
if (sessionId === null) return /* @__PURE__ */ jsx(EmptyState, { title: "This session is unavailable." });
|
|
2505
2537
|
const current = loaded?.key === key ? loaded : void 0;
|
|
2538
|
+
if (current === void 0 && measuring?.key === key) return /* @__PURE__ */ jsx(AuthorImageMeasure, {
|
|
2539
|
+
uri: measuring.uri,
|
|
2540
|
+
onMeasured: (size) => setLoaded("error" in size ? {
|
|
2541
|
+
key,
|
|
2542
|
+
error: size.error
|
|
2543
|
+
} : {
|
|
2544
|
+
key,
|
|
2545
|
+
file: measuring.file,
|
|
2546
|
+
body: {
|
|
2547
|
+
kind: "image",
|
|
2548
|
+
uri: measuring.uri,
|
|
2549
|
+
aspectRatio: size.height > 0 ? size.width / size.height : 1,
|
|
2550
|
+
naturalWidth: size.width,
|
|
2551
|
+
naturalHeight: size.height
|
|
2552
|
+
}
|
|
2553
|
+
})
|
|
2554
|
+
});
|
|
2506
2555
|
if (current === void 0) return /* @__PURE__ */ jsx(Spinner, { label: "Opening" });
|
|
2507
2556
|
if ("error" in current) return /* @__PURE__ */ jsx(EmptyState, {
|
|
2508
2557
|
title: "Couldn't open this file",
|