Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/pptx-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"dependencies": {
"@arcships/office-interaction": "^0.6.0",
"echarts": "^6.0.0",
"fflate": "^0.8.2",
"jszip": "^3.10.1"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/pptx-core/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default defineConfig({
noExternal: [
/^@arcships\/office-runtime/u,
/^@aiden0z\/pptx-renderer$/u,
/^fflate$/u,
],
skipNodeModulesBundle: true,
})
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions scripts/ci/pack-consumer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ try {
path.join(consumerDir, "public", "fixtures", file),
);
}
cpSync(
path.join(root, "tests", "fixtures", "pptx", "playback-controlled.pptx"),
path.join(consumerDir, "public", "fixtures", "playback-controlled.pptx"),
);

const packageJson = {
name: "agentic-office-tgz-consumer",
Expand Down
10 changes: 9 additions & 1 deletion scripts/ci/verify-pptx-consumer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { fileURLToPath } from "node:url"
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..")
const coreVersion = JSON.parse(readFileSync(path.join(root, "packages/pptx-core/package.json"), "utf8")).version
const vueVersion = JSON.parse(readFileSync(path.join(root, "packages/vue-pptx/package.json"), "utf8")).version
const interactionVersion = JSON.parse(readFileSync(path.join(root, "packages/office-interaction/package.json"), "utf8")).version
const temporary = mkdtempSync(path.join(tmpdir(), "pptx-consumer-"))
const packages = path.join(temporary, "packages")
const consumer = path.join(temporary, "consumer")
Expand Down Expand Up @@ -57,8 +58,10 @@ async function waitForServer(url) {
try {
run("pnpm", ["pack", "--pack-destination", packages], path.join(root, "packages/pptx-core"))
run("pnpm", ["pack", "--pack-destination", packages], path.join(root, "packages/vue-pptx"))
run("pnpm", ["pack", "--pack-destination", packages], path.join(root, "packages/office-interaction"))
const core = path.join(packages, `arcships-pptx-core-${coreVersion}.tgz`)
const vuePptx = path.join(packages, `arcships-vue-pptx-${vueVersion}.tgz`)
const interaction = path.join(packages, `arcships-office-interaction-${interactionVersion}.tgz`)
const coreManifest = JSON.parse(run("tar", ["-xOf", core, "package/package.json"], root))
const browserBundle = run("tar", ["-xOf", core, "package/dist/browser.js"], root)
if (coreManifest.dependencies?.["@aiden0z/pptx-renderer"]) {
Expand All @@ -82,7 +85,12 @@ try {
vue: "^3.5.0",
},
devDependencies: { typescript: "^5.0.0", vite: "^6.0.0" },
pnpm: { overrides: { "@arcships/pptx-core": `file:${core}` } },
pnpm: {
overrides: {
"@arcships/pptx-core": `file:${core}`,
"@arcships/office-interaction": `file:${interaction}`,
},
},
}, null, 2))
writeFileSync(path.join(consumer, "tsconfig.json"), JSON.stringify({
compilerOptions: {
Expand Down
38 changes: 38 additions & 0 deletions tests/consumer/template/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
<p data-testid="consumer-xlsx-value">{{ xlsxSelectedValue }}</p>
<XlsxViewer v-model:read-only="xlsxReadOnly" :controller="xlsxController" height="480px" />
</section>
<section data-testid="consumer-pptx">
<h2>PPTX</h2>
<p data-testid="consumer-pptx-state" :data-state="pptxState">{{ pptxState }}</p>
<p v-if="pptxError" data-testid="consumer-pptx-error">{{ pptxError }}</p>
<PptxViewer
v-if="pptxFile"
:source="pptxFile"
:autoplay="false"
height="480px"
@load-success="onPptxSuccess"
@load-error="onPptxError"
/>
</section>
<section data-testid="consumer-pdf">
<h2>PDF</h2>
<p data-testid="consumer-pdf-state" :data-state="pdfState">{{ pdfState }}</p>
Expand Down Expand Up @@ -71,6 +84,8 @@ import xlsxWorkerUrl from "@arcships/xlsx-core/worker?worker&url";
import xlsxWasmUrl from "@arcships/xlsx-core/assets/duke_sheets_wasm_bg.wasm?url";
import { DocxEditor, DocxViewer } from "@arcships/vue-docx";
import { XlsxViewer, useXlsxViewerController, type XlsxDiagnostic } from "@arcships/vue-xlsx";
import { PptxViewer } from "@arcships/vue-pptx";
import type { PptxPreviewError } from "@arcships/pptx-core";
import {
DEFAULT_PDF_MAX_FILE_SIZE,
PdfViewer,
Expand All @@ -88,6 +103,9 @@ const docxState = ref<LoadState>("loading");
const docxSource = ref("pending");
const pdfState = ref<LoadState>("loading");
const pdfError = ref("");
const pptxFile = shallowRef<ArrayBuffer>();
const pptxState = ref<LoadState>("loading");
const pptxError = ref("");
const origin = globalThis.location.origin;

function addDiagnostic(event: unknown) {
Expand Down Expand Up @@ -151,12 +169,14 @@ const overallState = computed<LoadState>(() => {
docxState.value === "error" ||
xlsxController.sourceState === "error" ||
xlsxWorkerController.sourceState === "error" ||
pptxState.value === "error" ||
pdfState.value === "error"
) return "error";
if (
docxState.value === "ready" &&
xlsxController.sourceState === "ready" &&
xlsxWorkerController.sourceState === "ready" &&
pptxState.value === "ready" &&
pdfState.value === "ready"
) return "ready";
return "loading";
Expand All @@ -171,6 +191,14 @@ onMounted(async () => {
docxState.value = "error";
addDiagnostic({ package: "docx", type: "fixture-error", message: String(error) });
}
try {
const response = await fetch("/fixtures/playback-controlled.pptx");
if (!response.ok) throw new Error(`fixture request failed: ${response.status}`);
pptxFile.value = await response.arrayBuffer();
} catch (error) {
pptxState.value = "error";
addDiagnostic({ package: "pptx", type: "fixture-error", message: String(error) });
}
});

function onDocxSuccess(result: DocxImportResult) {
Expand All @@ -184,6 +212,16 @@ function onDocxError(error: Error) {
addDiagnostic({ package: "docx", type: "load-error", message: error.message });
}

function onPptxSuccess() {
pptxState.value = "ready";
}

function onPptxError(error: PptxPreviewError) {
pptxState.value = "error";
pptxError.value = `${error.code}: ${error.message}`;
addDiagnostic({ package: "pptx", type: "load-error", message: error.message });
}

function onPdfSuccess() {
pdfState.value = "ready";
}
Expand Down
1 change: 1 addition & 0 deletions tests/consumer/template/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createApp } from "vue";
import "@arcships/vue-docx/style.css";
import "@arcships/vue-xlsx/style.css";
import "@arcships/vue-pdf/style.css";
import "@arcships/vue-pptx/style.css";
import App from "./App.vue";
import "./package-contract";

Expand Down
46 changes: 46 additions & 0 deletions tests/consumer/template/src/package-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ import {
type PptxOfficeReferenceDraft,
type PptxReferenceContext,
} from "@arcships/pptx-core";
import {
createPptxDocumentSession,
createPptxPreviewSession,
type PptxDocumentSession,
type PptxDocumentSessionOptions,
type PptxPreviewSession,
type PptxPreviewSessionOptions,
type PptxPreviewSource,
} from "@arcships/pptx-core/browser";
import {
DocxContextMenu,
DocxDragOverlay,
Expand Down Expand Up @@ -124,6 +133,12 @@ import {
type LegendItem,
type XlsxDiagnostic,
} from "@arcships/vue-xlsx";
import { MemoChartSvg as MemoChartSvgFromSubpath } from "@arcships/vue-xlsx/chart";
import {
buildRegionMapLegendItems,
normalizeRegionMapKey,
} from "@arcships/vue-xlsx/map";
import { MemoSurfaceChartComposite as MemoSurfaceChartCompositeFromSubpath } from "@arcships/vue-xlsx/webgl";
import {
DEFAULT_PDF_MAX_FILE_SIZE,
PdfViewer,
Expand All @@ -144,6 +159,17 @@ import {
type PdfRenderRuntimeConfig,
type PdfSource,
} from "@arcships/vue-pdf";
import {
PptxStage,
PptxThumbnail,
PptxViewer,
usePptxDocument,
usePptxPlayback,
type PptxPreviewDocument,
type PptxStageExpose,
type UsePptxDocumentReturn,
type UsePptxPlaybackReturn,
} from "@arcships/vue-pptx";
import {
FileUpload,
OfficeObjectOutlineLayer,
Expand Down Expand Up @@ -230,6 +256,17 @@ export const publicRuntimeExports = {
describePptxReference,
pptxReferenceKindForObject,
resolvePptxReference,
createPptxDocumentSession,
createPptxPreviewSession,
PptxStage,
PptxThumbnail,
PptxViewer,
usePptxDocument,
usePptxPlayback,
MemoChartSvgFromSubpath,
buildRegionMapLegendItems,
normalizeRegionMapKey,
MemoSurfaceChartCompositeFromSubpath,
FileUpload,
};

Expand Down Expand Up @@ -297,6 +334,15 @@ export type PublicTypeExports = {
pptxOfficeReferenceDraft: PptxOfficeReferenceDraft;
pptxObjectReferenceOptions: PptxObjectReferenceOptions;
pptxReferenceContext: PptxReferenceContext;
pptxDocumentSession: PptxDocumentSession;
pptxDocumentSessionOptions: PptxDocumentSessionOptions;
pptxPreviewSession: PptxPreviewSession;
pptxPreviewSessionOptions: PptxPreviewSessionOptions;
pptxPreviewSource: PptxPreviewSource;
pptxPreviewDocument: PptxPreviewDocument;
pptxStageExpose: PptxStageExpose;
pptxDocumentComposable: UsePptxDocumentReturn;
pptxPlaybackComposable: UsePptxPlaybackReturn;
docxEditorOptions: UseDocxEditorOptions;
xlsxDiagnostic: XlsxDiagnostic;
pdfSource: PdfSource;
Expand Down
Loading