pptx-svelte-viewer 0.1.3 → 0.2.0
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 +6 -0
- package/dist/awareness-CkFlr7xx.js +166 -0
- package/dist/{component-DxQFSCeR.js → component-Bvs5zPMN.js} +17484 -14089
- package/dist/index.d.ts +304 -1
- package/dist/index.js +14 -11
- package/dist/viewer/index.d.ts +248 -1
- package/dist/viewer/index.js +1 -1
- package/dist/y-webrtc-BdH40MC6.js +3388 -0
- package/dist/y-websocket-C6aE1Dkp.js +115 -0
- package/dist/yjs-CE9F053g.js +3473 -0
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [0.1.3](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-svelte-viewer@0.1.3) - 2026-07-11
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
|
|
11
|
+
- **svelte:** Restyle readme to match the established binding readmes (by @ChristopherVR) ([5328bc8](https://github.com/ChristopherVR/pptx-viewer/commit/5328bc808b20b782c8234b9c859d3932fb41cfe4))
|
|
12
|
+
|
|
7
13
|
## [0.1.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-svelte-viewer@0.1.2) - 2026-07-10
|
|
8
14
|
|
|
9
15
|
### Features
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { A as m, B as C, C as A, F as f, H as M, I as V, O as B, S as U, T as _, U as w, _ as E, applyUpdate as j, b as x, c as T, encodeStateAsUpdate as Y, encodeStateVector as F, f as b, g as O, h as J, k as d, l as N, m as q, u as z, x as g } from "./yjs-CE9F053g.js";
|
|
2
|
+
var I = /* @__PURE__ */ new Map(), P = class {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
this.room = t, this.onmessage = null, this._onChange = (e) => e.key === t && this.onmessage !== null && this.onmessage({ data: N(e.newValue || "") }), J(this._onChange);
|
|
5
|
+
}
|
|
6
|
+
postMessage(t) {
|
|
7
|
+
O.setItem(this.room, z(T(t)));
|
|
8
|
+
}
|
|
9
|
+
close() {
|
|
10
|
+
q(this._onChange);
|
|
11
|
+
}
|
|
12
|
+
}, G = typeof BroadcastChannel > "u" ? P : BroadcastChannel, v = (t) => w(I, t, () => {
|
|
13
|
+
const e = M(), s = new G(t);
|
|
14
|
+
return s.onmessage = (a) => e.forEach((n) => n(a.data, "broadcastchannel")), {
|
|
15
|
+
bc: s,
|
|
16
|
+
subs: e
|
|
17
|
+
};
|
|
18
|
+
}), $ = (t, e) => (v(t).subs.add(e), e), H = (t, e) => {
|
|
19
|
+
const s = v(t), a = s.subs.delete(e);
|
|
20
|
+
return a && s.subs.size === 0 && (s.bc.close(), I.delete(t)), a;
|
|
21
|
+
}, tt = (t, e, s = null) => {
|
|
22
|
+
const a = v(t);
|
|
23
|
+
a.bc.postMessage(e), a.subs.forEach((n) => n(e, s));
|
|
24
|
+
};
|
|
25
|
+
var et = (t, e) => {
|
|
26
|
+
d(t, 0);
|
|
27
|
+
const s = F(e);
|
|
28
|
+
m(t, s);
|
|
29
|
+
}, K = (t, e, s) => {
|
|
30
|
+
d(t, 1), m(t, Y(e, s));
|
|
31
|
+
}, Q = (t, e, s) => K(e, s, U(t)), k = (t, e, s, a) => {
|
|
32
|
+
try {
|
|
33
|
+
j(e, U(t), s);
|
|
34
|
+
} catch (n) {
|
|
35
|
+
a?.(n), console.error("Caught error while handling a Yjs update", n);
|
|
36
|
+
}
|
|
37
|
+
}, st = (t, e) => {
|
|
38
|
+
d(t, 2), m(t, e);
|
|
39
|
+
}, R = k, at = (t, e, s, a, n) => {
|
|
40
|
+
const l = g(t);
|
|
41
|
+
switch (l) {
|
|
42
|
+
case 0:
|
|
43
|
+
Q(t, e, s);
|
|
44
|
+
break;
|
|
45
|
+
case 1:
|
|
46
|
+
k(t, s, a, n);
|
|
47
|
+
break;
|
|
48
|
+
case 2:
|
|
49
|
+
R(t, s, a, n);
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
throw new Error("Unknown message type");
|
|
53
|
+
}
|
|
54
|
+
return l;
|
|
55
|
+
}, W = 3e4, nt = class extends C {
|
|
56
|
+
constructor(t) {
|
|
57
|
+
super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => {
|
|
58
|
+
const e = f();
|
|
59
|
+
this.getLocalState() !== null && 3e4 / 2 <= e - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
60
|
+
const s = [];
|
|
61
|
+
this.meta.forEach((a, n) => {
|
|
62
|
+
n !== this.clientID && 3e4 <= e - a.lastUpdated && this.states.has(n) && s.push(n);
|
|
63
|
+
}), s.length > 0 && X(this, s, "timeout");
|
|
64
|
+
}, V(W / 10)), t.on("destroy", () => {
|
|
65
|
+
this.destroy();
|
|
66
|
+
}), this.setLocalState({});
|
|
67
|
+
}
|
|
68
|
+
destroy() {
|
|
69
|
+
this.emit("destroy", [this]), this.setLocalState(null), super.destroy(), clearInterval(this._checkInterval);
|
|
70
|
+
}
|
|
71
|
+
getLocalState() {
|
|
72
|
+
return this.states.get(this.clientID) || null;
|
|
73
|
+
}
|
|
74
|
+
setLocalState(t) {
|
|
75
|
+
const e = this.clientID, s = this.meta.get(e), a = s === void 0 ? 0 : s.clock + 1, n = this.states.get(e);
|
|
76
|
+
t === null ? this.states.delete(e) : this.states.set(e, t), this.meta.set(e, {
|
|
77
|
+
clock: a,
|
|
78
|
+
lastUpdated: f()
|
|
79
|
+
});
|
|
80
|
+
const l = [], c = [], i = [], o = [];
|
|
81
|
+
t === null ? o.push(e) : n == null ? t != null && l.push(e) : (c.push(e), b(n, t) || i.push(e)), (l.length > 0 || i.length > 0 || o.length > 0) && this.emit("change", [{
|
|
82
|
+
added: l,
|
|
83
|
+
updated: i,
|
|
84
|
+
removed: o
|
|
85
|
+
}, "local"]), this.emit("update", [{
|
|
86
|
+
added: l,
|
|
87
|
+
updated: c,
|
|
88
|
+
removed: o
|
|
89
|
+
}, "local"]);
|
|
90
|
+
}
|
|
91
|
+
setLocalStateField(t, e) {
|
|
92
|
+
const s = this.getLocalState();
|
|
93
|
+
s !== null && this.setLocalState({
|
|
94
|
+
...s,
|
|
95
|
+
[t]: e
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getStates() {
|
|
99
|
+
return this.states;
|
|
100
|
+
}
|
|
101
|
+
}, X = (t, e, s) => {
|
|
102
|
+
const a = [];
|
|
103
|
+
for (let n = 0; n < e.length; n++) {
|
|
104
|
+
const l = e[n];
|
|
105
|
+
if (t.states.has(l)) {
|
|
106
|
+
if (t.states.delete(l), l === t.clientID) {
|
|
107
|
+
const c = t.meta.get(l);
|
|
108
|
+
t.meta.set(l, {
|
|
109
|
+
clock: c.clock + 1,
|
|
110
|
+
lastUpdated: f()
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
a.push(l);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
a.length > 0 && (t.emit("change", [{
|
|
117
|
+
added: [],
|
|
118
|
+
updated: [],
|
|
119
|
+
removed: a
|
|
120
|
+
}, s]), t.emit("update", [{
|
|
121
|
+
added: [],
|
|
122
|
+
updated: [],
|
|
123
|
+
removed: a
|
|
124
|
+
}, s]));
|
|
125
|
+
}, lt = (t, e, s = t.states) => {
|
|
126
|
+
const a = e.length, n = A();
|
|
127
|
+
d(n, a);
|
|
128
|
+
for (let l = 0; l < a; l++) {
|
|
129
|
+
const c = e[l], i = s.get(c) || null, o = t.meta.get(c).clock;
|
|
130
|
+
d(n, c), d(n, o), B(n, JSON.stringify(i));
|
|
131
|
+
}
|
|
132
|
+
return _(n);
|
|
133
|
+
}, ct = (t, e, s) => {
|
|
134
|
+
const a = E(e), n = f(), l = [], c = [], i = [], o = [], D = g(a);
|
|
135
|
+
for (let S = 0; S < D; S++) {
|
|
136
|
+
const r = g(a);
|
|
137
|
+
let u = g(a);
|
|
138
|
+
const h = JSON.parse(x(a)), p = t.meta.get(r), L = t.states.get(r), y = p === void 0 ? 0 : p.clock;
|
|
139
|
+
(y < u || y === u && h === null && t.states.has(r)) && (h === null ? r === t.clientID && t.getLocalState() != null ? u++ : t.states.delete(r) : t.states.set(r, h), t.meta.set(r, {
|
|
140
|
+
clock: u,
|
|
141
|
+
lastUpdated: n
|
|
142
|
+
}), p === void 0 && h !== null ? l.push(r) : p !== void 0 && h === null ? o.push(r) : h !== null && (b(h, L) || i.push(r), c.push(r)));
|
|
143
|
+
}
|
|
144
|
+
(l.length > 0 || i.length > 0 || o.length > 0) && t.emit("change", [{
|
|
145
|
+
added: l,
|
|
146
|
+
updated: i,
|
|
147
|
+
removed: o
|
|
148
|
+
}, s]), (l.length > 0 || c.length > 0 || o.length > 0) && t.emit("update", [{
|
|
149
|
+
added: l,
|
|
150
|
+
updated: c,
|
|
151
|
+
removed: o
|
|
152
|
+
}, s]);
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
at as a,
|
|
156
|
+
st as c,
|
|
157
|
+
H as d,
|
|
158
|
+
X as i,
|
|
159
|
+
tt as l,
|
|
160
|
+
ct as n,
|
|
161
|
+
et as o,
|
|
162
|
+
lt as r,
|
|
163
|
+
K as s,
|
|
164
|
+
nt as t,
|
|
165
|
+
$ as u
|
|
166
|
+
};
|