appscms-tools-theme 3.1.8 → 3.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/head/index.html +3 -1
- data/assets/js/partytown/debug/partytown-atomics.js +572 -0
- data/assets/js/partytown/debug/partytown-media.js +374 -0
- data/assets/js/partytown/debug/partytown-sandbox-sw.js +559 -0
- data/assets/js/partytown/debug/partytown-sw.js +59 -0
- data/assets/js/partytown/debug/partytown-ww-atomics.js +1876 -0
- data/assets/js/partytown/debug/partytown-ww-sw.js +1868 -0
- data/assets/js/partytown/debug/partytown.js +75 -0
- data/assets/js/partytown/partytown-atomics.js +2 -0
- data/assets/js/partytown/partytown-media.js +2 -0
- data/assets/js/partytown/partytown-sw.js +2 -0
- metadata +12 -2
@@ -0,0 +1,374 @@
|
|
1
|
+
/* Partytown 0.7.5 - MIT builder.io */
|
2
|
+
(self => {
|
3
|
+
const [getter, setter, callMethod, constructGlobal, definePrototypePropertyDescriptor, randomId, WinIdKey, InstanceIdKey, ApplyPathKey] = self.$bridgeToMedia$;
|
4
|
+
delete self.$bridgeToMedia$;
|
5
|
+
const ContextKey = Symbol();
|
6
|
+
const MediaSourceKey = Symbol();
|
7
|
+
const ReadyStateKey = Symbol();
|
8
|
+
const SourceBuffersKey = Symbol();
|
9
|
+
const SourceBufferTasksKey = Symbol();
|
10
|
+
const TimeRangesKey = Symbol();
|
11
|
+
const EMPTY_ARRAY = [];
|
12
|
+
const defineCstr = (win, cstrName, Cstr) => win[cstrName] = defineCstrName(cstrName, Cstr);
|
13
|
+
const defineCstrName = (cstrName, Cstr) => Object.defineProperty(Cstr, "name", {
|
14
|
+
value: cstrName
|
15
|
+
});
|
16
|
+
const initCanvas = (WorkerBase, win) => {
|
17
|
+
const HTMLCanvasDescriptorMap = {
|
18
|
+
getContext: {
|
19
|
+
value(contextType, contextAttributes) {
|
20
|
+
this[ContextKey] || (this[ContextKey] = (contextType.includes("webgl") ? createContextWebGL : createContext2D)(this, contextType, contextAttributes));
|
21
|
+
return this[ContextKey];
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
const WorkerCanvasGradient = defineCstr(win, "CanvasGradient", class extends WorkerBase {
|
26
|
+
addColorStop(...args) {
|
27
|
+
callMethod(this, [ "addColorStop" ], args, 2);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
const WorkerCanvasPattern = defineCstr(win, "CanvasPattern", class extends WorkerBase {
|
31
|
+
setTransform(...args) {
|
32
|
+
callMethod(this, [ "setTransform" ], args, 2);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
const createContext2D = (canvasInstance, contextType, contextAttributes) => {
|
36
|
+
const winId = canvasInstance[WinIdKey];
|
37
|
+
const ctxInstanceId = randomId();
|
38
|
+
const ctxInstance = {
|
39
|
+
[WinIdKey]: winId,
|
40
|
+
[InstanceIdKey]: ctxInstanceId,
|
41
|
+
[ApplyPathKey]: []
|
42
|
+
};
|
43
|
+
const ctx = callMethod(canvasInstance, [ "getContext" ], [ contextType, contextAttributes ], 1, ctxInstanceId);
|
44
|
+
const ctx2dGetterMethods = "getContextAttributes,getImageData,getLineDash,getTransform,isPointInPath,isPointInStroke,measureText".split(",");
|
45
|
+
const CanvasRenderingContext2D = {
|
46
|
+
get: (target, propName) => "string" == typeof propName && propName in ctx ? "function" == typeof ctx[propName] ? (...args) => {
|
47
|
+
if (propName.startsWith("create")) {
|
48
|
+
const instanceId = randomId();
|
49
|
+
callMethod(ctxInstance, [ propName ], args, 2, instanceId);
|
50
|
+
if ("createImageData" === propName || "createPattern" === propName) {
|
51
|
+
(api => {
|
52
|
+
console.warn(`${api} not implemented`);
|
53
|
+
})(`${propName}()`);
|
54
|
+
return {
|
55
|
+
setTransform: () => {}
|
56
|
+
};
|
57
|
+
}
|
58
|
+
return new WorkerCanvasGradient(winId, instanceId);
|
59
|
+
}
|
60
|
+
const methodCallType = ctx2dGetterMethods.includes(propName) ? 1 : 2;
|
61
|
+
return callMethod(ctxInstance, [ propName ], args, methodCallType);
|
62
|
+
} : ctx[propName] : target[propName],
|
63
|
+
set(target, propName, value) {
|
64
|
+
if ("string" == typeof propName && propName in ctx) {
|
65
|
+
ctx[propName] !== value && "function" != typeof value && setter(ctxInstance, [ propName ], value);
|
66
|
+
ctx[propName] = value;
|
67
|
+
} else {
|
68
|
+
target[propName] = value;
|
69
|
+
}
|
70
|
+
return true;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
return new Proxy(ctx, CanvasRenderingContext2D);
|
74
|
+
};
|
75
|
+
const createContextWebGL = (canvasInstance, contextType, contextAttributes) => {
|
76
|
+
const winId = canvasInstance[WinIdKey];
|
77
|
+
const ctxInstanceId = randomId();
|
78
|
+
const ctxInstance = {
|
79
|
+
[WinIdKey]: winId,
|
80
|
+
[InstanceIdKey]: ctxInstanceId,
|
81
|
+
[ApplyPathKey]: []
|
82
|
+
};
|
83
|
+
const ctx = callMethod(canvasInstance, [ "getContext" ], [ contextType, contextAttributes ], 1, ctxInstanceId);
|
84
|
+
const WebGLRenderingContextHandler = {
|
85
|
+
get: (target, propName) => "string" == typeof propName ? "function" != typeof ctx[propName] ? ctx[propName] : (...args) => callMethod(ctxInstance, [ propName ], args, getWebGlMethodCallType(propName)) : target[propName],
|
86
|
+
set(target, propName, value) {
|
87
|
+
if ("string" == typeof propName && propName in ctx) {
|
88
|
+
ctx[propName] !== value && "function" != typeof value && setter(ctxInstance, [ propName ], value);
|
89
|
+
ctx[propName] = value;
|
90
|
+
} else {
|
91
|
+
target[propName] = value;
|
92
|
+
}
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
};
|
96
|
+
return new Proxy(ctx, WebGLRenderingContextHandler);
|
97
|
+
};
|
98
|
+
const ctxWebGLGetterMethods = "checkFramebufferStatus,makeXRCompatible".split(",");
|
99
|
+
const getWebGlMethodCallType = methodName => methodName.startsWith("create") || methodName.startsWith("get") || methodName.startsWith("is") || ctxWebGLGetterMethods.includes(methodName) ? 1 : 2;
|
100
|
+
defineCstr(win, "CanvasGradient", WorkerCanvasGradient);
|
101
|
+
defineCstr(win, "CanvasPattern", WorkerCanvasPattern);
|
102
|
+
definePrototypePropertyDescriptor(win.HTMLCanvasElement, HTMLCanvasDescriptorMap);
|
103
|
+
};
|
104
|
+
const initMedia = (WorkerBase, WorkerEventTargetProxy, env, win) => {
|
105
|
+
var _a, _b;
|
106
|
+
win.Audio = defineCstrName("HTMLAudioElement", class {
|
107
|
+
constructor(src) {
|
108
|
+
const audio = env.$createNode$("audio", randomId());
|
109
|
+
audio.src = src;
|
110
|
+
return audio;
|
111
|
+
}
|
112
|
+
});
|
113
|
+
const WorkerAudioTrack = class extends WorkerBase {
|
114
|
+
get enabled() {
|
115
|
+
return getter(this, [ "enabled" ]);
|
116
|
+
}
|
117
|
+
set enabled(value) {
|
118
|
+
setter(this, [ "enabled" ], value);
|
119
|
+
}
|
120
|
+
get id() {
|
121
|
+
return getter(this, [ "id" ]);
|
122
|
+
}
|
123
|
+
get kind() {
|
124
|
+
return getter(this, [ "kind" ]);
|
125
|
+
}
|
126
|
+
get label() {
|
127
|
+
return getter(this, [ "label" ]);
|
128
|
+
}
|
129
|
+
get language() {
|
130
|
+
return getter(this, [ "language" ]);
|
131
|
+
}
|
132
|
+
get sourceBuffer() {
|
133
|
+
return new WorkerSourceBuffer(this);
|
134
|
+
}
|
135
|
+
};
|
136
|
+
const WorkerAudioTrackList = class {
|
137
|
+
constructor(mediaElm) {
|
138
|
+
const winId = mediaElm[WinIdKey];
|
139
|
+
const instanceId = mediaElm[InstanceIdKey];
|
140
|
+
const instance = {
|
141
|
+
addEventListener(...args) {
|
142
|
+
callMethod(mediaElm, [ "audioTracks", "addEventListener" ], args, 3);
|
143
|
+
},
|
144
|
+
getTrackById: (...args) => callMethod(mediaElm, [ "audioTracks", "getTrackById" ], args),
|
145
|
+
get length() {
|
146
|
+
return getter(mediaElm, [ "audioTracks", "length" ]);
|
147
|
+
},
|
148
|
+
removeEventListener(...args) {
|
149
|
+
callMethod(mediaElm, [ "audioTracks", "removeEventListener" ], args, 3);
|
150
|
+
}
|
151
|
+
};
|
152
|
+
return new Proxy(instance, {
|
153
|
+
get: (target, propName) => "number" == typeof propName ? new WorkerAudioTrack(winId, instanceId, [ "audioTracks", propName ]) : target[propName]
|
154
|
+
});
|
155
|
+
}
|
156
|
+
};
|
157
|
+
const WorkerSourceBufferList = defineCstr(win, "SourceBufferList", class extends Array {
|
158
|
+
constructor(mediaSource) {
|
159
|
+
super();
|
160
|
+
this[MediaSourceKey] = mediaSource;
|
161
|
+
}
|
162
|
+
addEventListener(...args) {
|
163
|
+
callMethod(this[MediaSourceKey], [ "sourceBuffers", "addEventListener" ], args, 3);
|
164
|
+
}
|
165
|
+
removeEventListener(...args) {
|
166
|
+
callMethod(this[MediaSourceKey], [ "sourceBuffers", "removeEventListener" ], args, 3);
|
167
|
+
}
|
168
|
+
});
|
169
|
+
const WorkerSourceBuffer = defineCstr(win, "SourceBuffer", (_b = class extends WorkerEventTargetProxy {
|
170
|
+
constructor(mediaSource) {
|
171
|
+
super(mediaSource[WinIdKey], mediaSource[InstanceIdKey], [ "sourceBuffers" ]);
|
172
|
+
this[_a] = [];
|
173
|
+
this[MediaSourceKey] = mediaSource;
|
174
|
+
}
|
175
|
+
abort() {
|
176
|
+
const sbIndex = getSourceBufferIndex(this);
|
177
|
+
callMethod(this, [ sbIndex, "appendWindowStart" ], EMPTY_ARRAY, 1);
|
178
|
+
}
|
179
|
+
addEventListener(...args) {
|
180
|
+
const sbIndex = getSourceBufferIndex(this);
|
181
|
+
callMethod(this, [ sbIndex, "addEventListener" ], args, 3);
|
182
|
+
}
|
183
|
+
appendBuffer(buf) {
|
184
|
+
this[SourceBufferTasksKey].push([ "appendBuffer", [ buf ], buf ]);
|
185
|
+
drainSourceBufferQueue(this);
|
186
|
+
}
|
187
|
+
get appendWindowStart() {
|
188
|
+
const sbIndex = getSourceBufferIndex(this);
|
189
|
+
return getter(this, [ sbIndex, "appendWindowStart" ]);
|
190
|
+
}
|
191
|
+
set appendWindowStart(value) {
|
192
|
+
const sbIndex = getSourceBufferIndex(this);
|
193
|
+
setter(this, [ sbIndex, "appendWindowStart" ], value);
|
194
|
+
}
|
195
|
+
get appendWindowEnd() {
|
196
|
+
const sbIndex = getSourceBufferIndex(this);
|
197
|
+
return getter(this, [ sbIndex, "appendWindowEnd" ]);
|
198
|
+
}
|
199
|
+
set appendWindowEnd(value) {
|
200
|
+
const sbIndex = getSourceBufferIndex(this);
|
201
|
+
setter(this, [ sbIndex, "appendWindowEnd" ], value);
|
202
|
+
}
|
203
|
+
get buffered() {
|
204
|
+
const mediaSource = this[MediaSourceKey];
|
205
|
+
const sbIndex = getSourceBufferIndex(this);
|
206
|
+
const timeRanges = new WorkerTimeRanges(mediaSource[WinIdKey], mediaSource[InstanceIdKey], [ "sourceBuffers", sbIndex, "buffered" ]);
|
207
|
+
return timeRanges;
|
208
|
+
}
|
209
|
+
changeType(mimeType) {
|
210
|
+
const sbIndex = getSourceBufferIndex(this);
|
211
|
+
callMethod(this, [ sbIndex, "changeType" ], [ mimeType ], 2);
|
212
|
+
}
|
213
|
+
get mode() {
|
214
|
+
const sbIndex = getSourceBufferIndex(this);
|
215
|
+
return getter(this, [ sbIndex, "mode" ]);
|
216
|
+
}
|
217
|
+
set mode(value) {
|
218
|
+
const sbIndex = getSourceBufferIndex(this);
|
219
|
+
setter(this, [ sbIndex, "mode" ], value);
|
220
|
+
}
|
221
|
+
remove(start, end) {
|
222
|
+
this[SourceBufferTasksKey].push([ "remove", [ start, end ] ]);
|
223
|
+
drainSourceBufferQueue(this);
|
224
|
+
}
|
225
|
+
removeEventListener(...args) {
|
226
|
+
const sbIndex = getSourceBufferIndex(this);
|
227
|
+
callMethod(this, [ sbIndex, "removeEventListener" ], args, 3);
|
228
|
+
}
|
229
|
+
get timestampOffset() {
|
230
|
+
const sbIndex = getSourceBufferIndex(this);
|
231
|
+
return getter(this, [ sbIndex, "timestampOffset" ]);
|
232
|
+
}
|
233
|
+
set timestampOffset(value) {
|
234
|
+
const sbIndex = getSourceBufferIndex(this);
|
235
|
+
setter(this, [ sbIndex, "timestampOffset" ], value);
|
236
|
+
}
|
237
|
+
get updating() {
|
238
|
+
const sbIndex = getSourceBufferIndex(this);
|
239
|
+
return getter(this, [ sbIndex, "updating" ]);
|
240
|
+
}
|
241
|
+
}, _a = SourceBufferTasksKey, _b));
|
242
|
+
const WorkerTimeRanges = defineCstr(win, "TimeRanges", class extends WorkerBase {
|
243
|
+
start(...args) {
|
244
|
+
return callMethod(this, [ "start" ], args);
|
245
|
+
}
|
246
|
+
end(...args) {
|
247
|
+
return callMethod(this, [ "end" ], args);
|
248
|
+
}
|
249
|
+
get length() {
|
250
|
+
return getter(this, [ "length" ]);
|
251
|
+
}
|
252
|
+
});
|
253
|
+
const getSourceBufferIndex = sourceBuffer => {
|
254
|
+
if (sourceBuffer) {
|
255
|
+
const mediaSource = sourceBuffer[MediaSourceKey];
|
256
|
+
const sourceBufferList = mediaSource[SourceBuffersKey];
|
257
|
+
return sourceBufferList.indexOf(sourceBuffer);
|
258
|
+
}
|
259
|
+
return -1;
|
260
|
+
};
|
261
|
+
const drainSourceBufferQueue = sourceBuffer => {
|
262
|
+
if (sourceBuffer[SourceBufferTasksKey].length) {
|
263
|
+
if (!sourceBuffer.updating) {
|
264
|
+
const task = sourceBuffer[SourceBufferTasksKey].shift();
|
265
|
+
if (task) {
|
266
|
+
const sbIndex = getSourceBufferIndex(sourceBuffer);
|
267
|
+
callMethod(sourceBuffer, [ sbIndex, task[0] ], task[1], 3, void 0, task[2]);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
setTimeout((() => drainSourceBufferQueue(sourceBuffer)), 50);
|
271
|
+
}
|
272
|
+
};
|
273
|
+
const HTMLMediaDescriptorMap = {
|
274
|
+
buffered: {
|
275
|
+
get() {
|
276
|
+
if (!this[TimeRangesKey]) {
|
277
|
+
this[TimeRangesKey] = new WorkerTimeRanges(this[WinIdKey], this[InstanceIdKey], [ "buffered" ]);
|
278
|
+
setTimeout((() => {
|
279
|
+
this[TimeRangesKey] = void 0;
|
280
|
+
}), 5e3);
|
281
|
+
}
|
282
|
+
return this[TimeRangesKey];
|
283
|
+
}
|
284
|
+
},
|
285
|
+
readyState: {
|
286
|
+
get() {
|
287
|
+
if (4 === this[ReadyStateKey]) {
|
288
|
+
return 4;
|
289
|
+
}
|
290
|
+
if ("number" != typeof this[ReadyStateKey]) {
|
291
|
+
this[ReadyStateKey] = getter(this, [ "readyState" ]);
|
292
|
+
setTimeout((() => {
|
293
|
+
this[ReadyStateKey] = void 0;
|
294
|
+
}), 1e3);
|
295
|
+
}
|
296
|
+
return this[ReadyStateKey];
|
297
|
+
}
|
298
|
+
}
|
299
|
+
};
|
300
|
+
defineCstr(win, "MediaSource", class extends WorkerEventTargetProxy {
|
301
|
+
constructor() {
|
302
|
+
super(env.$winId$);
|
303
|
+
this[SourceBuffersKey] = new WorkerSourceBufferList(this);
|
304
|
+
constructGlobal(this, "MediaSource", EMPTY_ARRAY);
|
305
|
+
}
|
306
|
+
get activeSourceBuffers() {
|
307
|
+
return [];
|
308
|
+
}
|
309
|
+
addSourceBuffer(mimeType) {
|
310
|
+
const sourceBuffer = new WorkerSourceBuffer(this);
|
311
|
+
this[SourceBuffersKey].push(sourceBuffer);
|
312
|
+
callMethod(this, [ "addSourceBuffer" ], [ mimeType ]);
|
313
|
+
return sourceBuffer;
|
314
|
+
}
|
315
|
+
clearLiveSeekableRange() {
|
316
|
+
callMethod(this, [ "clearLiveSeekableRange" ], EMPTY_ARRAY, 2);
|
317
|
+
}
|
318
|
+
get duration() {
|
319
|
+
return getter(this, [ "duration" ]);
|
320
|
+
}
|
321
|
+
set duration(value) {
|
322
|
+
setter(this, [ "duration" ], value);
|
323
|
+
}
|
324
|
+
endOfStream(endOfStreamError) {
|
325
|
+
callMethod(this, [ "endOfStream" ], [ endOfStreamError ], 3);
|
326
|
+
}
|
327
|
+
get readyState() {
|
328
|
+
return getter(this, [ "readyState" ]);
|
329
|
+
}
|
330
|
+
removeSourceBuffer(sourceBuffer) {
|
331
|
+
const index = getSourceBufferIndex(sourceBuffer);
|
332
|
+
if (index > -1) {
|
333
|
+
this[SourceBuffersKey].splice(index, 1);
|
334
|
+
callMethod(this, [ "removeSourceBuffer" ], [ index ], 1);
|
335
|
+
}
|
336
|
+
}
|
337
|
+
setLiveSeekableRange(start, end) {
|
338
|
+
callMethod(this, [ "setLiveSeekableRange" ], [ start, end ], 2);
|
339
|
+
}
|
340
|
+
get sourceBuffers() {
|
341
|
+
return this[SourceBuffersKey];
|
342
|
+
}
|
343
|
+
static isTypeSupported(mimeType) {
|
344
|
+
if (!isStaticTypeSupported.has(mimeType)) {
|
345
|
+
const isSupported = callMethod(win, [ "MediaSource", "isTypeSupported" ], [ mimeType ]);
|
346
|
+
isStaticTypeSupported.set(mimeType, isSupported);
|
347
|
+
}
|
348
|
+
return isStaticTypeSupported.get(mimeType);
|
349
|
+
}
|
350
|
+
});
|
351
|
+
const winURL = win.URL = defineCstrName("URL", class extends URL {});
|
352
|
+
const hasAudioTracks = "audioTracks" in win.HTMLMediaElement.prototype;
|
353
|
+
if (hasAudioTracks) {
|
354
|
+
defineCstr(win, "AudioTrackList", WorkerAudioTrackList);
|
355
|
+
defineCstr(win, "AudioTrack", WorkerAudioTrack);
|
356
|
+
HTMLMediaDescriptorMap.audioTracks = {
|
357
|
+
get() {
|
358
|
+
return new WorkerAudioTrackList(this);
|
359
|
+
}
|
360
|
+
};
|
361
|
+
}
|
362
|
+
definePrototypePropertyDescriptor(win.HTMLMediaElement, HTMLMediaDescriptorMap);
|
363
|
+
winURL.createObjectURL = obj => callMethod(win, [ "URL", "createObjectURL" ], [ obj ]);
|
364
|
+
winURL.revokeObjectURL = obj => callMethod(win, [ "URL", "revokeObjectURL" ], [ obj ]);
|
365
|
+
};
|
366
|
+
const isStaticTypeSupported = new Map;
|
367
|
+
self.$bridgeFromMedia$ = (WorkerBase, WorkerEventTargetProxy, env, win, windowMediaConstructors) => {
|
368
|
+
windowMediaConstructors.map((mediaCstrName => {
|
369
|
+
delete win[mediaCstrName];
|
370
|
+
}));
|
371
|
+
initCanvas(WorkerBase, win);
|
372
|
+
initMedia(WorkerBase, WorkerEventTargetProxy, env, win);
|
373
|
+
};
|
374
|
+
})(self);
|