@graffiti-garden/wrapper-vue 1.0.3 → 1.0.4
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/browser/plugin.mjs +83 -79
- package/dist/browser/plugin.mjs.map +1 -1
- package/dist/node/components/GetMedia.vue.d.ts +2 -2
- package/dist/node/components/GetMedia.vue.d.ts.map +1 -1
- package/dist/node/composables/get-media.d.ts +2 -2
- package/dist/node/composables/get-media.d.ts.map +1 -1
- package/dist/node/plugin.d.ts +3 -3
- package/dist/node/plugin.js +1 -1
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/plugin.mjs +87 -87
- package/dist/node/plugin.mjs.map +1 -1
- package/package.json +9 -9
- package/src/components/GetMedia.vue +3 -3
- package/src/composables/get-media.ts +3 -3
package/dist/node/plugin.mjs
CHANGED
|
@@ -14,7 +14,7 @@ function te(e) {
|
|
|
14
14
|
"Graffiti session already set - plugin installed multiple times?"
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function oe(e) {
|
|
18
18
|
if (!k.graffitiSynchronize)
|
|
19
19
|
k.graffitiSynchronize = e;
|
|
20
20
|
else
|
|
@@ -41,8 +41,8 @@ function Pe() {
|
|
|
41
41
|
);
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const l = H(), t = /* @__PURE__ */ new Map(),
|
|
44
|
+
function ne(e, i, o, a = !1) {
|
|
45
|
+
const l = H(), t = /* @__PURE__ */ new Map(), n = w([]);
|
|
46
46
|
let f = async () => {
|
|
47
47
|
};
|
|
48
48
|
const p = async () => f(), m = w(!0);
|
|
@@ -61,11 +61,11 @@ function oe(e, i, n, a = !1) {
|
|
|
61
61
|
}
|
|
62
62
|
return P(
|
|
63
63
|
() => ({
|
|
64
|
-
args: [b(e), b(i), b(
|
|
64
|
+
args: [b(e), b(i), b(o)],
|
|
65
65
|
refresh: j.value
|
|
66
66
|
}),
|
|
67
67
|
({ args: d }, x, z) => {
|
|
68
|
-
t.clear(),
|
|
68
|
+
t.clear(), n.value = [], m.value = !0;
|
|
69
69
|
const I = l.synchronizeDiscover(...d);
|
|
70
70
|
S = I;
|
|
71
71
|
let E, $ = !0;
|
|
@@ -81,7 +81,7 @@ function oe(e, i, n, a = !1) {
|
|
|
81
81
|
if (!$) break;
|
|
82
82
|
y.tombstone ? t.delete(y.object.url) : t.set(y.object.url, y.object), U || (U = new Promise((N) => {
|
|
83
83
|
setTimeout(() => {
|
|
84
|
-
$ && (
|
|
84
|
+
$ && (n.value = Array.from(t.values())), U = void 0, N();
|
|
85
85
|
}, 50);
|
|
86
86
|
}));
|
|
87
87
|
}
|
|
@@ -119,42 +119,42 @@ function oe(e, i, n, a = !1) {
|
|
|
119
119
|
() => b(a),
|
|
120
120
|
(d) => d && p()
|
|
121
121
|
), {
|
|
122
|
-
objects:
|
|
122
|
+
objects: n,
|
|
123
123
|
poll: p,
|
|
124
124
|
isFirstPoll: m
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
function J(e, i) {
|
|
128
|
-
const
|
|
128
|
+
const o = w(void 0);
|
|
129
129
|
return P(
|
|
130
130
|
() => b(e),
|
|
131
131
|
async (a, l, t) => {
|
|
132
|
-
let
|
|
132
|
+
let n = !0;
|
|
133
133
|
t(() => {
|
|
134
|
-
|
|
135
|
-
}),
|
|
134
|
+
n = !1;
|
|
135
|
+
}), o.value = void 0;
|
|
136
136
|
try {
|
|
137
137
|
const f = await i(a);
|
|
138
|
-
|
|
138
|
+
n && (o.value = f);
|
|
139
139
|
} catch (f) {
|
|
140
|
-
if (!
|
|
141
|
-
f instanceof D ?
|
|
140
|
+
if (!n) return;
|
|
141
|
+
f instanceof D ? o.value = null : console.error(f);
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
{ immediate: !0 }
|
|
145
145
|
), {
|
|
146
|
-
output:
|
|
146
|
+
output: o
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
function K(e) {
|
|
150
150
|
return e === void 0 ? "Loading..." : e === null ? "Not found" : e;
|
|
151
151
|
}
|
|
152
152
|
function re(e) {
|
|
153
|
-
const i = W(), { output:
|
|
153
|
+
const i = W(), { output: o } = J(
|
|
154
154
|
e,
|
|
155
155
|
i.actorToHandle.bind(i)
|
|
156
156
|
);
|
|
157
|
-
return { handle:
|
|
157
|
+
return { handle: o };
|
|
158
158
|
}
|
|
159
159
|
const O = /* @__PURE__ */ A({
|
|
160
160
|
__name: "ActorToHandle",
|
|
@@ -162,7 +162,7 @@ const O = /* @__PURE__ */ A({
|
|
|
162
162
|
actor: {}
|
|
163
163
|
},
|
|
164
164
|
setup(e) {
|
|
165
|
-
const
|
|
165
|
+
const o = h(e, "actor"), { handle: a } = re(o);
|
|
166
166
|
return (l, t) => L(l.$slots, "default", { handle: s(a) }, () => [
|
|
167
167
|
r("span", null, G(s(K)(s(a))), 1)
|
|
168
168
|
]);
|
|
@@ -173,11 +173,11 @@ const O = /* @__PURE__ */ A({
|
|
|
173
173
|
object: {}
|
|
174
174
|
},
|
|
175
175
|
setup(e) {
|
|
176
|
-
const i = W(),
|
|
176
|
+
const i = W(), o = w(!1);
|
|
177
177
|
async function a(l, t) {
|
|
178
|
-
|
|
178
|
+
o.value = !0, await new Promise((n) => setTimeout(n, 0)), confirm(
|
|
179
179
|
"Are you sure you want to delete this object? It cannot be undone."
|
|
180
|
-
) && await i.delete(l, t),
|
|
180
|
+
) && await i.delete(l, t), o.value = !1;
|
|
181
181
|
}
|
|
182
182
|
return (l, t) => e.object ? (c(), u("article", {
|
|
183
183
|
key: 0,
|
|
@@ -214,15 +214,15 @@ const O = /* @__PURE__ */ A({
|
|
|
214
214
|
r("em", null, "Public", -1)
|
|
215
215
|
])])),
|
|
216
216
|
r("ul", null, [
|
|
217
|
-
(c(!0), u(C, null, F(e.object.allowed, (
|
|
217
|
+
(c(!0), u(C, null, F(e.object.allowed, (n) => (c(), u("li", { key: n }, [
|
|
218
218
|
r("dl", null, [
|
|
219
219
|
t[8] || (t[8] = r("dt", null, "Actor", -1)),
|
|
220
220
|
r("dd", null, [
|
|
221
|
-
r("code", null, G(
|
|
221
|
+
r("code", null, G(n), 1)
|
|
222
222
|
]),
|
|
223
223
|
t[9] || (t[9] = r("dt", null, "Handle", -1)),
|
|
224
224
|
r("dd", null, [
|
|
225
|
-
T(O, { actor:
|
|
225
|
+
T(O, { actor: n }, null, 8, ["actor"])
|
|
226
226
|
])
|
|
227
227
|
])
|
|
228
228
|
]))), 128))
|
|
@@ -231,8 +231,8 @@ const O = /* @__PURE__ */ A({
|
|
|
231
231
|
r("section", null, [
|
|
232
232
|
t[12] || (t[12] = r("h3", null, "Channels", -1)),
|
|
233
233
|
e.object.channels?.length ? (c(), u("ul", ae, [
|
|
234
|
-
(c(!0), u(C, null, F(e.object.channels, (
|
|
235
|
-
r("code", null, G(
|
|
234
|
+
(c(!0), u(C, null, F(e.object.channels, (n) => (c(), u("li", { key: n }, [
|
|
235
|
+
r("code", null, G(n), 1)
|
|
236
236
|
]))), 128))
|
|
237
237
|
])) : (c(), u("p", ue, [...t[11] || (t[11] = [
|
|
238
238
|
r("em", null, "No channels", -1)
|
|
@@ -243,9 +243,9 @@ const O = /* @__PURE__ */ A({
|
|
|
243
243
|
r("ul", null, [
|
|
244
244
|
l.$graffitiSession.value?.actor === e.object.actor ? (c(), u("li", ce, [
|
|
245
245
|
r("button", {
|
|
246
|
-
disabled:
|
|
247
|
-
onClick: t[0] || (t[0] = (
|
|
248
|
-
}, G(
|
|
246
|
+
disabled: o.value,
|
|
247
|
+
onClick: t[0] || (t[0] = (n) => a(e.object, l.$graffitiSession.value))
|
|
248
|
+
}, G(o.value ? "Deleting..." : "Delete"), 9, fe)
|
|
249
249
|
])) : V("", !0)
|
|
250
250
|
])
|
|
251
251
|
])
|
|
@@ -275,21 +275,21 @@ const O = /* @__PURE__ */ A({
|
|
|
275
275
|
autopoll: { type: Boolean }
|
|
276
276
|
},
|
|
277
277
|
setup(e) {
|
|
278
|
-
const i = e, { objects:
|
|
278
|
+
const i = e, { objects: o, poll: a, isFirstPoll: l } = ne(
|
|
279
279
|
h(i, "channels"),
|
|
280
280
|
h(i, "schema"),
|
|
281
281
|
h(i, "session"),
|
|
282
282
|
h(i, "autopoll")
|
|
283
283
|
);
|
|
284
|
-
return (t,
|
|
285
|
-
objects: s(
|
|
284
|
+
return (t, n) => L(t.$slots, "default", {
|
|
285
|
+
objects: s(o),
|
|
286
286
|
poll: s(a),
|
|
287
287
|
isFirstPoll: s(l)
|
|
288
288
|
}, () => [
|
|
289
|
-
s(l) ? (c(), u("p", ye, [...
|
|
289
|
+
s(l) ? (c(), u("p", ye, [...n[0] || (n[0] = [
|
|
290
290
|
r("em", null, " Loading... ", -1)
|
|
291
291
|
])])) : (c(), u("ul", ve, [
|
|
292
|
-
(c(!0), u(C, null, F(s(
|
|
292
|
+
(c(!0), u(C, null, F(s(o), (f) => (c(), u("li", {
|
|
293
293
|
key: f.url
|
|
294
294
|
}, [
|
|
295
295
|
T(R, { object: f }, null, 8, ["object"])
|
|
@@ -298,16 +298,16 @@ const O = /* @__PURE__ */ A({
|
|
|
298
298
|
]);
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
|
-
function pe(e, i,
|
|
301
|
+
function pe(e, i, o) {
|
|
302
302
|
const a = H(), l = w(void 0);
|
|
303
303
|
let t = async () => {
|
|
304
304
|
};
|
|
305
|
-
const
|
|
305
|
+
const n = async () => t();
|
|
306
306
|
let f;
|
|
307
307
|
return _(() => {
|
|
308
308
|
f?.return(null);
|
|
309
309
|
}), P(
|
|
310
|
-
() => [b(e), b(i), b(
|
|
310
|
+
() => [b(e), b(i), b(o)],
|
|
311
311
|
(p, m, S) => {
|
|
312
312
|
l.value = void 0;
|
|
313
313
|
const g = a.synchronizeGet(...p);
|
|
@@ -332,12 +332,12 @@ function pe(e, i, n) {
|
|
|
332
332
|
}
|
|
333
333
|
await new Promise((d) => setTimeout(d, 0)), v = !1;
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, n();
|
|
336
336
|
},
|
|
337
337
|
{ immediate: !0 }
|
|
338
338
|
), {
|
|
339
339
|
object: l,
|
|
340
|
-
poll:
|
|
340
|
+
poll: n
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
343
|
const X = /* @__PURE__ */ A({
|
|
@@ -348,35 +348,35 @@ const X = /* @__PURE__ */ A({
|
|
|
348
348
|
session: {}
|
|
349
349
|
},
|
|
350
350
|
setup(e) {
|
|
351
|
-
const i = e, { object:
|
|
351
|
+
const i = e, { object: o, poll: a } = pe(
|
|
352
352
|
h(i, "url"),
|
|
353
353
|
h(i, "schema"),
|
|
354
354
|
h(i, "session")
|
|
355
355
|
);
|
|
356
356
|
return (l, t) => L(l.$slots, "default", {
|
|
357
|
-
object: s(
|
|
357
|
+
object: s(o),
|
|
358
358
|
poll: s(a)
|
|
359
359
|
}, () => [
|
|
360
|
-
T(R, { object: s(
|
|
360
|
+
T(R, { object: s(o) }, null, 8, ["object"])
|
|
361
361
|
]);
|
|
362
362
|
}
|
|
363
363
|
});
|
|
364
|
-
function be(e, i,
|
|
364
|
+
function be(e, i, o) {
|
|
365
365
|
const a = H(), l = w(
|
|
366
366
|
void 0
|
|
367
367
|
), t = w(0);
|
|
368
|
-
let
|
|
368
|
+
let n = null, f = () => {
|
|
369
369
|
};
|
|
370
370
|
function p() {
|
|
371
|
-
return
|
|
371
|
+
return n || (t.value++, n = new Promise((m) => {
|
|
372
372
|
f = () => {
|
|
373
|
-
|
|
373
|
+
n = null, m();
|
|
374
374
|
};
|
|
375
|
-
}),
|
|
375
|
+
}), n);
|
|
376
376
|
}
|
|
377
377
|
return P(
|
|
378
378
|
() => ({
|
|
379
|
-
args: [b(e), b(i), b(
|
|
379
|
+
args: [b(e), b(i), b(o)],
|
|
380
380
|
pollCounter: t.value
|
|
381
381
|
}),
|
|
382
382
|
async ({ args: m }, S, g) => {
|
|
@@ -414,63 +414,63 @@ const he = ["src", "alt"], ge = ["src", "alt"], je = ["src", "alt"], we = ["src"
|
|
|
414
414
|
__name: "GetMedia",
|
|
415
415
|
props: {
|
|
416
416
|
url: {},
|
|
417
|
-
|
|
417
|
+
accept: {},
|
|
418
418
|
session: {}
|
|
419
419
|
},
|
|
420
420
|
setup(e) {
|
|
421
|
-
const i = e, { media:
|
|
421
|
+
const i = e, { media: o, poll: a } = be(
|
|
422
422
|
h(i, "url"),
|
|
423
|
-
h(i, "
|
|
423
|
+
h(i, "accept"),
|
|
424
424
|
h(i, "session")
|
|
425
425
|
);
|
|
426
426
|
function l() {
|
|
427
|
-
|
|
427
|
+
o.value && (window.location.href = o.value.dataUrl);
|
|
428
428
|
}
|
|
429
|
-
return (t,
|
|
430
|
-
media: s(
|
|
429
|
+
return (t, n) => L(t.$slots, "default", {
|
|
430
|
+
media: s(o),
|
|
431
431
|
poll: s(a)
|
|
432
432
|
}, () => [
|
|
433
|
-
s(
|
|
433
|
+
s(o)?.data.type.startsWith("image/") ? (c(), u("img", {
|
|
434
434
|
key: 0,
|
|
435
|
-
src: s(
|
|
436
|
-
alt: `An image by ${s(
|
|
437
|
-
}, null, 8, he)) : s(
|
|
435
|
+
src: s(o).dataUrl,
|
|
436
|
+
alt: `An image by ${s(o).actor}`
|
|
437
|
+
}, null, 8, he)) : s(o)?.data.type.startsWith("video/") ? (c(), u("video", {
|
|
438
438
|
key: 1,
|
|
439
439
|
controls: "",
|
|
440
|
-
src: s(
|
|
441
|
-
alt: `A video by ${s(
|
|
442
|
-
}, null, 8, ge)) : s(
|
|
440
|
+
src: s(o).dataUrl,
|
|
441
|
+
alt: `A video by ${s(o).actor}`
|
|
442
|
+
}, null, 8, ge)) : s(o)?.data.type.startsWith("audio/") ? (c(), u("audio", {
|
|
443
443
|
key: 2,
|
|
444
444
|
controls: "",
|
|
445
|
-
src: s(
|
|
446
|
-
alt: `Audio by ${s(
|
|
447
|
-
}, null, 8, je)) : s(
|
|
445
|
+
src: s(o).dataUrl,
|
|
446
|
+
alt: `Audio by ${s(o).actor}`
|
|
447
|
+
}, null, 8, je)) : s(o)?.data.type === "text/html" ? (c(), u("iframe", {
|
|
448
448
|
key: 3,
|
|
449
|
-
src: s(
|
|
450
|
-
alt: `HTML by ${s(
|
|
449
|
+
src: s(o).dataUrl,
|
|
450
|
+
alt: `HTML by ${s(o).actor}`,
|
|
451
451
|
sandbox: ""
|
|
452
|
-
}, null, 8, we)) : s(
|
|
452
|
+
}, null, 8, we)) : s(o)?.data.type.startsWith("application/pdf") ? (c(), u("object", {
|
|
453
453
|
key: 4,
|
|
454
|
-
data: s(
|
|
454
|
+
data: s(o).dataUrl,
|
|
455
455
|
type: "application/pdf",
|
|
456
|
-
alt: `PDF by ${s(
|
|
457
|
-
}, null, 8, Ge)) : s(
|
|
456
|
+
alt: `PDF by ${s(o).actor}`
|
|
457
|
+
}, null, 8, Ge)) : s(o) ? (c(), u("button", {
|
|
458
458
|
key: 5,
|
|
459
459
|
onClick: l
|
|
460
|
-
}, "Download")) : s(
|
|
460
|
+
}, "Download")) : s(o) === null ? (c(), u("p", $e, [...n[0] || (n[0] = [
|
|
461
461
|
r("em", null, "Media not found", -1)
|
|
462
|
-
])])) : (c(), u("p", ke, [...
|
|
462
|
+
])])) : (c(), u("p", ke, [...n[1] || (n[1] = [
|
|
463
463
|
r("em", null, " Loading... ", -1)
|
|
464
464
|
])]))
|
|
465
465
|
]);
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
468
|
function Ae(e) {
|
|
469
|
-
const i = W(), { output:
|
|
469
|
+
const i = W(), { output: o } = J(
|
|
470
470
|
e,
|
|
471
471
|
i.handleToActor.bind(i)
|
|
472
472
|
);
|
|
473
|
-
return { actor:
|
|
473
|
+
return { actor: o };
|
|
474
474
|
}
|
|
475
475
|
const Z = /* @__PURE__ */ A({
|
|
476
476
|
__name: "HandleToActor",
|
|
@@ -478,35 +478,35 @@ const Z = /* @__PURE__ */ A({
|
|
|
478
478
|
handle: {}
|
|
479
479
|
},
|
|
480
480
|
setup(e) {
|
|
481
|
-
const
|
|
481
|
+
const o = h(e, "handle"), { actor: a } = Ae(o);
|
|
482
482
|
return (l, t) => L(l.$slots, "default", { actor: s(a) }, () => [
|
|
483
483
|
r("span", null, G(s(K)(s(a))), 1)
|
|
484
484
|
]);
|
|
485
485
|
}
|
|
486
486
|
}), Le = {
|
|
487
487
|
install(e, i) {
|
|
488
|
-
const
|
|
488
|
+
const o = i.graffiti, a = new ee(o), l = w(void 0);
|
|
489
489
|
a.sessionEvents.addEventListener("initialized", async (t) => {
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
490
|
+
const n = t.detail;
|
|
491
|
+
if (n && n.error && console.error(n.error), n && n.href) {
|
|
492
492
|
const f = e.config.globalProperties.$router;
|
|
493
493
|
if (f) {
|
|
494
|
-
const p = f.options.history.base, m = new URL(
|
|
494
|
+
const p = f.options.history.base, m = new URL(n.href);
|
|
495
495
|
m.pathname.startsWith(p) && (m.pathname = m.pathname.slice(p.length)), await f.replace(m.pathname + m.search + m.hash);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
l.value || (l.value = null);
|
|
499
499
|
}), a.sessionEvents.addEventListener("login", (t) => {
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
console.error("Error logging in:"), console.error(
|
|
500
|
+
const n = t.detail;
|
|
501
|
+
if (n.error) {
|
|
502
|
+
console.error("Error logging in:"), console.error(n.error);
|
|
503
503
|
return;
|
|
504
504
|
} else
|
|
505
|
-
l.value =
|
|
505
|
+
l.value = n.session;
|
|
506
506
|
}), a.sessionEvents.addEventListener("logout", (t) => {
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
}),
|
|
507
|
+
const n = t.detail;
|
|
508
|
+
n.error ? (console.error("Error logging out:"), console.error(n.error)) : l.value = null;
|
|
509
|
+
}), oe(a), te(l), e.component("GraffitiDiscover", Q), e.component("GraffitiGet", X), e.component("GraffitiGetMedia", Y), e.component("GraffitiActorToHandle", O), e.component("GraffitiHandleToActor", Z), e.component("GraffitiObjectInfo", R), e.config.globalProperties.$graffiti = a, e.config.globalProperties.$graffitiSession = l;
|
|
510
510
|
}
|
|
511
511
|
}, Ee = Q, Te = X, Oe = Y, De = O, He = Z, Re = R;
|
|
512
512
|
export {
|
|
@@ -519,7 +519,7 @@ export {
|
|
|
519
519
|
Le as GraffitiPlugin,
|
|
520
520
|
W as useGraffiti,
|
|
521
521
|
re as useGraffitiActorToHandle,
|
|
522
|
-
|
|
522
|
+
ne as useGraffitiDiscover,
|
|
523
523
|
pe as useGraffitiGet,
|
|
524
524
|
be as useGraffitiGetMedia,
|
|
525
525
|
Ae as useGraffitiHandleToActor,
|