@agimon-ai/doompi-author 0.0.1-alpha.52 → 0.0.1-alpha.54
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/pi.d.mts +1 -1
- package/dist/extensions/web.mjs +67 -5
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{index-DV9A7iXB.d.mts → index-66TDWZtO.d.mts} +17 -2
- package/dist/{index-DV9A7iXB.d.mts.map → index-66TDWZtO.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/package.json +11 -11
- package/src/types/authorPreview.ts +20 -0
package/dist/extensions/pi.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as AuthorExtensionDependencies } from "../index-66TDWZtO.mjs";
|
|
2
2
|
//#region generated/pi.d.ts
|
|
3
3
|
export declare const extension: import("@agimon-ai/doompi-core/runtimePiExtension").DefinedPiExtension<Partial<AuthorExtensionDependencies>>;
|
|
4
4
|
//#endregion
|
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { apiResponse, createApiClient, defineApiRoutes, defineChannelFile, defineDockFace, defineFileLinks, defineGlobalStore, defineLeaderBinding, defineMinorModeFile, defineSessionStore, defineSlotFile, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress, toolResultTextLines } from "@agimon-ai/doompi-core/web";
|
|
1
|
+
import { apiResponse, createApiClient, defineApiRoutes, defineChannelFile, defineDockFace, defineFileLinks, defineFill, defineGlobalStore, defineLeaderBinding, defineMinorModeFile, defineSessionStore, defineSlotFile, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress, toolResultTextLines } from "@agimon-ai/doompi-core/web";
|
|
2
2
|
import { Store } from "@tanstack/store";
|
|
3
3
|
import { useStore } from "@tanstack/react-store";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -704,6 +704,18 @@ function seekAuthorVideo(sessionId, path, timeSeconds) {
|
|
|
704
704
|
}));
|
|
705
705
|
return true;
|
|
706
706
|
}
|
|
707
|
+
function setAuthorPreviewSelection(sessionId, path, preview) {
|
|
708
|
+
const normalized = normalizeAuthorPath(path);
|
|
709
|
+
updateSession(sessionId, (session) => {
|
|
710
|
+
const selections = { ...session.previewSelections };
|
|
711
|
+
if (preview === void 0) delete selections[normalized];
|
|
712
|
+
else selections[normalized] = { ...preview };
|
|
713
|
+
return {
|
|
714
|
+
...session,
|
|
715
|
+
previewSelections: selections
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
}
|
|
707
719
|
function setAuthorToolMode(sessionId, path, tool) {
|
|
708
720
|
const normalized = normalizeAuthorPath(path);
|
|
709
721
|
updateSession(sessionId, (session) => ({
|
|
@@ -2212,6 +2224,11 @@ const api = createApiClient(apiRoutes_default, {
|
|
|
2212
2224
|
});
|
|
2213
2225
|
//#endregion
|
|
2214
2226
|
//#region src/types/authorPreview.ts
|
|
2227
|
+
function parseAuthorOpenSourceAction(input) {
|
|
2228
|
+
if (typeof input !== "object" || input === null) return null;
|
|
2229
|
+
const candidate = input;
|
|
2230
|
+
return candidate.version === 1 && typeof candidate.createTab === "function" ? candidate : null;
|
|
2231
|
+
}
|
|
2215
2232
|
function parseAuthorPreviewAction(input) {
|
|
2216
2233
|
if (typeof input !== "object" || input === null) return null;
|
|
2217
2234
|
const candidate = input;
|
|
@@ -3821,14 +3838,19 @@ function ActiveAuthorDocumentPanel(props) {
|
|
|
3821
3838
|
const activeTool = workspace?.toolsByDocument[normalizeAuthorPath(path)] ?? "select";
|
|
3822
3839
|
const [markdownPreview, setMarkdownPreview] = useState(true);
|
|
3823
3840
|
const [status, setStatus] = useState();
|
|
3824
|
-
const [
|
|
3841
|
+
const previewSelection = workspace?.previewSelections?.[normalizeAuthorPath(props.path)] ?? workspace?.previewSelections?.[normalizeAuthorPath(path)];
|
|
3842
|
+
const [previewOpen, setPreviewOpen] = useState(previewSelection !== void 0);
|
|
3843
|
+
useEffect(() => {
|
|
3844
|
+
if (previewSelection !== void 0) setPreviewOpen(true);
|
|
3845
|
+
}, [previewSelection]);
|
|
3825
3846
|
const kind = document?.kind;
|
|
3826
3847
|
const previewSource = document === void 0 ? void 0 : {
|
|
3827
3848
|
path: document.path,
|
|
3828
3849
|
kind: document.kind,
|
|
3829
3850
|
hasUnsavedChanges: document.version !== document.savedVersion,
|
|
3830
3851
|
revision: document.savedVersion,
|
|
3831
|
-
sourceSha256: document.sourceSha256
|
|
3852
|
+
sourceSha256: document.sourceSha256,
|
|
3853
|
+
...previewSelection === void 0 ? {} : { preview: previewSelection }
|
|
3832
3854
|
};
|
|
3833
3855
|
const PreviewPanel = (previewSource === void 0 ? void 0 : (props.slotData?.(authorPreviewActionSlot) ?? []).find(({ data }) => data.embeddedPanel !== void 0 && (data.supportsSource === void 0 || data.supportsSource(previewSource))))?.data.embeddedPanel;
|
|
3834
3856
|
useEffect(() => {
|
|
@@ -4030,6 +4052,20 @@ function ActiveAuthorDocumentPanel(props) {
|
|
|
4030
4052
|
]
|
|
4031
4053
|
});
|
|
4032
4054
|
}
|
|
4055
|
+
const authorOpenSourceAction = {
|
|
4056
|
+
version: 1,
|
|
4057
|
+
createTab({ sessionId, path, preview }) {
|
|
4058
|
+
const normalized = normalizeAuthorPath(path);
|
|
4059
|
+
if (sessionId.trim() === "" || normalized === "" || path.startsWith("/") || /^[A-Za-z]:/.test(path) || path.replaceAll("\\", "/").split("/").includes("..")) throw new Error("Author source opening requires a session and a repository-relative path.");
|
|
4060
|
+
if (preview !== void 0 && (typeof preview.appPath !== "string" || preview.appPath.trim() === "" || typeof preview.storyExport !== "string" || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(preview.storyExport) || preview.snapshot !== void 0 && typeof preview.snapshot !== "boolean")) throw new Error("Author preview requires a project and an exact story export.");
|
|
4061
|
+
const canonical = canvasPaths.state[authorDocumentKey(sessionId, normalized)] ?? normalized;
|
|
4062
|
+
const prefix = `${sessionId}\n`;
|
|
4063
|
+
const tabPath = (Object.entries(canvasPaths.state).find(([key, path]) => key.startsWith(prefix) && path === canonical)?.[0])?.slice(prefix.length) ?? normalized;
|
|
4064
|
+
setAuthorPreviewSelection(sessionId, tabPath, preview);
|
|
4065
|
+
if (canonical !== tabPath) setAuthorPreviewSelection(sessionId, canonical, preview);
|
|
4066
|
+
return authorFileTab(tabPath, canvasAliases.state[authorDocumentKey(sessionId, tabPath)]);
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4033
4069
|
function authorFileTab(path, preferredAlias) {
|
|
4034
4070
|
const normalized = normalizeAuthorPath(path);
|
|
4035
4071
|
return {
|
|
@@ -4107,7 +4143,10 @@ function authorFileTab(path, preferredAlias) {
|
|
|
4107
4143
|
},
|
|
4108
4144
|
onClose(sessionId) {
|
|
4109
4145
|
const key = authorDocumentKey(sessionId, normalized);
|
|
4110
|
-
|
|
4146
|
+
const canonical = canvasPaths.state[key] ?? normalized;
|
|
4147
|
+
setAuthorToolMode(sessionId, canonical, "select");
|
|
4148
|
+
setAuthorPreviewSelection(sessionId, normalized, void 0);
|
|
4149
|
+
if (canonical !== normalized) setAuthorPreviewSelection(sessionId, canonical, void 0);
|
|
4111
4150
|
pendingCanvases.get(key)?.abort();
|
|
4112
4151
|
pendingCanvases.delete(key);
|
|
4113
4152
|
const alias = canvasAliases.state[key] ?? preferredAlias;
|
|
@@ -4175,6 +4214,13 @@ var author_document_web_default = defineFileLinks({
|
|
|
4175
4214
|
}
|
|
4176
4215
|
});
|
|
4177
4216
|
//#endregion
|
|
4217
|
+
//#region src/extensions/workspaces/sessions/(frontend)/fill/Author.author.open-source.web.ts
|
|
4218
|
+
var Author_author_open_source_web_default = defineFill({
|
|
4219
|
+
slot: "author.open-source",
|
|
4220
|
+
id: "author",
|
|
4221
|
+
data: authorOpenSourceAction
|
|
4222
|
+
});
|
|
4223
|
+
//#endregion
|
|
4178
4224
|
//#region src/extensions/workspaces/sessions/(frontend)/leader/author-toggle.web.ts
|
|
4179
4225
|
var author_toggle_web_default = defineLeaderBinding({
|
|
4180
4226
|
id: "author.toggle",
|
|
@@ -4434,6 +4480,12 @@ var mode_web_default = defineMinorModeFile({
|
|
|
4434
4480
|
order: 45
|
|
4435
4481
|
});
|
|
4436
4482
|
//#endregion
|
|
4483
|
+
//#region src/extensions/workspaces/sessions/(frontend)/slot/open-source.web.ts
|
|
4484
|
+
var open_source_web_default = defineSlotFile({
|
|
4485
|
+
slot: "author.open-source",
|
|
4486
|
+
parse: parseAuthorOpenSourceAction
|
|
4487
|
+
});
|
|
4488
|
+
//#endregion
|
|
4437
4489
|
//#region src/extensions/workspaces/sessions/(frontend)/slot/preview-action.web.ts
|
|
4438
4490
|
/** Typed data slot for preview launchers that need Author's focused source. */
|
|
4439
4491
|
var preview_action_web_default = defineSlotFile({
|
|
@@ -4669,6 +4721,12 @@ const webPlugin = defineWebPlugin({
|
|
|
4669
4721
|
get fileLinks() {
|
|
4670
4722
|
return author_document_web_default;
|
|
4671
4723
|
},
|
|
4724
|
+
get fills() {
|
|
4725
|
+
return [via({
|
|
4726
|
+
slot: "author.open-source",
|
|
4727
|
+
id: "author"
|
|
4728
|
+
}, Author_author_open_source_web_default)];
|
|
4729
|
+
},
|
|
4672
4730
|
get leaderBindings() {
|
|
4673
4731
|
return [via({ id: "author.author-toggle" }, author_toggle_web_default)];
|
|
4674
4732
|
},
|
|
@@ -4676,7 +4734,11 @@ const webPlugin = defineWebPlugin({
|
|
|
4676
4734
|
return [via({ name: "author" }, mode_web_default)];
|
|
4677
4735
|
},
|
|
4678
4736
|
get slots() {
|
|
4679
|
-
return [
|
|
4737
|
+
return [
|
|
4738
|
+
via({ slot: "author.open-source" }, open_source_web_default),
|
|
4739
|
+
via({ slot: "author.preview-action" }, preview_action_web_default),
|
|
4740
|
+
via({ slot: "author.preview-provider" }, preview_provider_web_default)
|
|
4741
|
+
];
|
|
4680
4742
|
},
|
|
4681
4743
|
get start() {
|
|
4682
4744
|
return start_web_default;
|