@floegence/floe-webapp-core 0.86.43 → 0.86.45
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/licenses/pptx/ECMA-text-copyright-notice.txt +48 -0
- package/dist/licenses/pptx/LICENSE +201 -0
- package/dist/licenses/pptx/THIRD_PARTY_NOTICES.md +40 -0
- package/dist/licenses/pptx/bundled-dependencies.txt +1378 -0
- package/dist/licenses/pptx/mtx-decompressor-MPL-2.0.txt +373 -0
- package/dist/licenses/pptx/mtx-decompressor-v1.4.2.tar.gz +0 -0
- package/dist/licenses/pptx/source-manifest.json +28 -0
- package/dist/node_modules/.pnpm/@aiden0z_pptx-renderer@1.3.0_pdfjs-dist@6.3.289/node_modules/@aiden0z/pptx-renderer/dist/aiden0z-pptx-renderer.browser.es.js +50485 -0
- package/dist/pptx.d.ts +24 -0
- package/dist/pptx.js +100 -0
- package/package.json +7 -2
package/dist/pptx.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface PptxSurfaceOptions {
|
|
2
|
+
signal?: AbortSignal;
|
|
3
|
+
onNodeError?: (nodeId: string, error: unknown) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface PptxPageHandle {
|
|
6
|
+
readonly element: HTMLElement;
|
|
7
|
+
readonly ready: Promise<void>;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
}
|
|
11
|
+
/** A read-only presentation. External relationships never acquire network authority. */
|
|
12
|
+
export declare class PptxDocumentSurface {
|
|
13
|
+
private readonly viewer;
|
|
14
|
+
readonly hasExternalLinks: boolean;
|
|
15
|
+
private readonly handles;
|
|
16
|
+
private disposed;
|
|
17
|
+
private constructor();
|
|
18
|
+
get pageCount(): number;
|
|
19
|
+
get pageWidth(): number;
|
|
20
|
+
get pageHeight(): number;
|
|
21
|
+
static open(bytes: Uint8Array<ArrayBuffer>, options?: PptxSurfaceOptions): Promise<PptxDocumentSurface>;
|
|
22
|
+
renderPage(index: number, container: HTMLElement): PptxPageHandle;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
}
|
package/dist/pptx.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import g from "./node_modules/.pnpm/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.js";
|
|
2
|
+
import { parseZip as p, buildPresentation as m, PptxViewer as v, RECOMMENDED_ZIP_LIMITS as E } from "./node_modules/.pnpm/@aiden0z_pptx-renderer@1.3.0_pdfjs-dist@6.3.289/node_modules/@aiden0z/pptx-renderer/dist/aiden0z-pptx-renderer.browser.es.js";
|
|
3
|
+
class f {
|
|
4
|
+
constructor(r, s) {
|
|
5
|
+
this.viewer = r, this.hasExternalLinks = s;
|
|
6
|
+
}
|
|
7
|
+
viewer;
|
|
8
|
+
hasExternalLinks;
|
|
9
|
+
handles = /* @__PURE__ */ new Set();
|
|
10
|
+
disposed = !1;
|
|
11
|
+
get pageCount() {
|
|
12
|
+
return this.viewer.slideCount;
|
|
13
|
+
}
|
|
14
|
+
get pageWidth() {
|
|
15
|
+
return this.viewer.slideWidth;
|
|
16
|
+
}
|
|
17
|
+
get pageHeight() {
|
|
18
|
+
return this.viewer.slideHeight;
|
|
19
|
+
}
|
|
20
|
+
static async open(r, s = {}) {
|
|
21
|
+
if (s.signal?.throwIfAborted(), r.byteLength > 20 * 1024 * 1024)
|
|
22
|
+
throw new Error("Presentation exceeds the 20 MiB preview limit.");
|
|
23
|
+
const e = await p(r.slice().buffer, E);
|
|
24
|
+
s.signal?.throwIfAborted();
|
|
25
|
+
let a = !1;
|
|
26
|
+
const l = (i) => {
|
|
27
|
+
const n = new DOMParser().parseFromString(i, "application/xml");
|
|
28
|
+
if (n.doctype || n.querySelector("parsererror"))
|
|
29
|
+
throw new Error("Invalid presentation relationships.");
|
|
30
|
+
for (const o of [...n.getElementsByTagNameNS("*", "Relationship")]) {
|
|
31
|
+
const d = o.getAttribute("Target") ?? "";
|
|
32
|
+
((o.getAttribute("TargetMode") ?? "").toLowerCase() === "external" || /^(?:[a-z][a-z0-9+.-]*:|[/\\]{2})/i.test(d.trim())) && (o.remove(), a = !0);
|
|
33
|
+
}
|
|
34
|
+
return new XMLSerializer().serializeToString(n);
|
|
35
|
+
};
|
|
36
|
+
e.presentationRels = l(e.presentationRels);
|
|
37
|
+
for (const i of [
|
|
38
|
+
e.slideRels,
|
|
39
|
+
e.slideLayoutRels,
|
|
40
|
+
e.slideMasterRels,
|
|
41
|
+
e.chartRels
|
|
42
|
+
])
|
|
43
|
+
if (i) for (const [n, o] of i) i.set(n, l(o));
|
|
44
|
+
for (const [i, n] of e.media) {
|
|
45
|
+
if (!i.toLowerCase().endsWith(".svg")) continue;
|
|
46
|
+
const o = g.sanitize(new TextDecoder().decode(n), {
|
|
47
|
+
USE_PROFILES: { svg: !0, svgFilters: !0 },
|
|
48
|
+
ADD_TAGS: ["use"],
|
|
49
|
+
FORBID_TAGS: ["style", "foreignObject"],
|
|
50
|
+
FORBID_ATTR: ["style"]
|
|
51
|
+
}), d = new DOMParser().parseFromString(o, "image/svg+xml");
|
|
52
|
+
if (d.querySelector("parsererror")) throw new Error("Invalid SVG in presentation.");
|
|
53
|
+
for (const u of [...d.querySelectorAll("*")])
|
|
54
|
+
for (const h of [...u.attributes])
|
|
55
|
+
(h.localName === "href" && !h.value.startsWith("#") || [...h.value.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/gi)].some(
|
|
56
|
+
(w) => !w[2].startsWith("#")
|
|
57
|
+
)) && u.removeAttributeNode(h);
|
|
58
|
+
e.media.set(
|
|
59
|
+
i,
|
|
60
|
+
new TextEncoder().encode(new XMLSerializer().serializeToString(d))
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const t = m(e, { lazySlides: !0 });
|
|
64
|
+
if (!t.slides.length || t.slides.length > 1e3 || !Number.isFinite(t.width) || !Number.isFinite(t.height) || t.width <= 0 || t.height <= 0 || t.width > 2e4 || t.height > 2e4)
|
|
65
|
+
throw new Error("Invalid presentation dimensions or page count.");
|
|
66
|
+
s.signal?.throwIfAborted();
|
|
67
|
+
const c = new v(document.createElement("div"), {
|
|
68
|
+
pdfjs: !1,
|
|
69
|
+
onNodeError: s.onNodeError
|
|
70
|
+
});
|
|
71
|
+
return c.load(t), new f(c, a);
|
|
72
|
+
}
|
|
73
|
+
renderPage(r, s) {
|
|
74
|
+
if (this.disposed) throw new Error("Presentation is closed.");
|
|
75
|
+
if (!Number.isInteger(r) || r < 0 || r >= this.pageCount)
|
|
76
|
+
throw new RangeError("Invalid presentation page.");
|
|
77
|
+
const e = this.viewer.renderSlideToContainer(r, s, 1);
|
|
78
|
+
if (!e) throw new Error("Presentation page could not be rendered.");
|
|
79
|
+
let a = !1;
|
|
80
|
+
const l = () => {
|
|
81
|
+
a || (a = !0, this.handles.delete(t), e.dispose());
|
|
82
|
+
}, t = {
|
|
83
|
+
element: e.element,
|
|
84
|
+
ready: e.ready,
|
|
85
|
+
dispose: l,
|
|
86
|
+
[Symbol.dispose]: l
|
|
87
|
+
};
|
|
88
|
+
return this.handles.add(t), t;
|
|
89
|
+
}
|
|
90
|
+
dispose() {
|
|
91
|
+
if (!this.disposed) {
|
|
92
|
+
this.disposed = !0;
|
|
93
|
+
for (const r of this.handles) r.dispose();
|
|
94
|
+
this.handles.clear(), this.viewer.destroy();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
f as PptxDocumentSurface
|
|
100
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/floe-webapp-core",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -151,6 +151,10 @@
|
|
|
151
151
|
"./graph-assets": {
|
|
152
152
|
"types": "./scripts/graph-assets.d.mts",
|
|
153
153
|
"import": "./scripts/graph-assets.mjs"
|
|
154
|
+
},
|
|
155
|
+
"./pptx": {
|
|
156
|
+
"types": "./dist/pptx.d.ts",
|
|
157
|
+
"import": "./dist/pptx.js"
|
|
154
158
|
}
|
|
155
159
|
},
|
|
156
160
|
"files": [
|
|
@@ -193,6 +197,7 @@
|
|
|
193
197
|
"tailwindcss": "^4.3.3",
|
|
194
198
|
"typescript": "^5.9.3",
|
|
195
199
|
"vite": "^7.3.6",
|
|
196
|
-
"vite-plugin-solid": "^2.11.14"
|
|
200
|
+
"vite-plugin-solid": "^2.11.14",
|
|
201
|
+
"@aiden0z/pptx-renderer": "1.3.0"
|
|
197
202
|
}
|
|
198
203
|
}
|