artifactuse 0.1.28 → 0.1.30
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/README.md +24 -3
- package/dist/{index-D56xsAnF.js → index-BH35XKmt.js} +387 -375
- package/dist/index.js +1 -1
- package/dist/react/index.js +44 -43
- package/dist/styles/components/inline-preview.css +9 -0
- package/dist/svelte/index.js +72 -71
- package/dist/vue/index.js +84 -83
- package/dist/vue2/index.js +46 -6
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as M, computed as b, createElementBlock as s, openBlock as a, normalizeClass as J, createElementVNode as e, toDisplayString as o, withModifiers as ye, onMounted as xe, watch as pe, Fragment as
|
|
2
|
-
import { g as Se, f as it, a as Oe, b as Ue, n as qt, i as at, c as Ot, D as Ut, d as lt } from "../index-
|
|
1
|
+
import { ref as M, computed as b, createElementBlock as s, openBlock as a, normalizeClass as J, createElementVNode as e, toDisplayString as o, withModifiers as ye, onMounted as xe, watch as pe, Fragment as V, createCommentVNode as d, renderList as de, createTextVNode as G, h as le, normalizeStyle as Ae, createStaticVNode as Bt, createBlock as be, resolveDynamicComponent as Et, nextTick as Ce, onUnmounted as De, Teleport as zt, createVNode as Be, Transition as Pe, withCtx as He, withKeys as It, onBeforeUnmount as Ft, unref as k, withDirectives as et, vShow as tt, reactive as st, provide as Vt, inject as Rt } from "vue";
|
|
2
|
+
import { g as Se, f as it, a as Oe, b as Ue, n as qt, i as at, c as Ot, D as Ut, d as lt } from "../index-BH35XKmt.js";
|
|
3
3
|
import { J as Dt } from "../jszip.min-CdmYyw5L.js";
|
|
4
4
|
const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class: "artifactuse-card__content" }, Xt = { class: "artifactuse-card__title" }, Zt = { class: "artifactuse-card__meta" }, Wt = { class: "artifactuse-card__type" }, Kt = { class: "artifactuse-card__size" }, Yt = { class: "artifactuse-card__actions" }, Qt = ["title"], Gt = {
|
|
5
5
|
key: 0,
|
|
@@ -45,8 +45,8 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
45
45
|
}
|
|
46
46
|
function y() {
|
|
47
47
|
var I;
|
|
48
|
-
const x = new Blob([h.artifact.code], { type: "text/plain" }), $ = URL.createObjectURL(x),
|
|
49
|
-
|
|
48
|
+
const x = new Blob([h.artifact.code], { type: "text/plain" }), $ = URL.createObjectURL(x), R = document.createElement("a"), q = Ue(h.artifact.language), X = ((I = h.artifact.title) == null ? void 0 : I.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
49
|
+
R.href = $, R.download = `${X}.${q}`, document.body.appendChild(R), R.click(), document.body.removeChild(R), URL.revokeObjectURL($), m("download", h.artifact);
|
|
50
50
|
}
|
|
51
51
|
return (x, $) => (a(), s("div", {
|
|
52
52
|
class: J(["artifactuse-card", { "artifactuse-card--active": A.isActive }]),
|
|
@@ -231,7 +231,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
231
231
|
} catch {
|
|
232
232
|
return { title: "Invalid Form", variant: "fields", data: { fields: [] } };
|
|
233
233
|
}
|
|
234
|
-
}), n = M(null), y = b(() => h.artifact.id || w.value.id || `form-${Date.now()}`), x = b(() => `artifactuse-form-${w.value.variant || "fields"}`), $ = b(() => w.value.title || "Form"),
|
|
234
|
+
}), n = M(null), y = b(() => h.artifact.id || w.value.id || `form-${Date.now()}`), x = b(() => `artifactuse-form-${w.value.variant || "fields"}`), $ = b(() => w.value.title || "Form"), R = M({}), q = M({}), X = M(!1), I = b(() => {
|
|
235
235
|
var p;
|
|
236
236
|
return ((p = w.value.data) == null ? void 0 : p.fields) || [];
|
|
237
237
|
}), te = b(() => {
|
|
@@ -269,7 +269,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
269
269
|
const p = {};
|
|
270
270
|
I.value.forEach((B) => {
|
|
271
271
|
["buttons", "divider", "heading"].includes(B.type) || (B.defaultValue !== void 0 ? p[B.name] = B.defaultValue : B.type === "checkbox" ? p[B.name] = !1 : p[B.name] = "");
|
|
272
|
-
}), (r = w.value.data) != null && r.defaults && Object.assign(p, w.value.data.defaults),
|
|
272
|
+
}), (r = w.value.data) != null && r.defaults && Object.assign(p, w.value.data.defaults), R.value = p;
|
|
273
273
|
}
|
|
274
274
|
W(), pe(() => h.artifact.code, W);
|
|
275
275
|
function ve(p) {
|
|
@@ -279,14 +279,14 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
279
279
|
return p ? p.map((T) => typeof T == "string" ? { label: T, value: T } : T) : [];
|
|
280
280
|
}
|
|
281
281
|
function _(p, T) {
|
|
282
|
-
|
|
282
|
+
R.value[p] = T, q.value[p] && delete q.value[p];
|
|
283
283
|
}
|
|
284
284
|
function ie() {
|
|
285
285
|
var B;
|
|
286
286
|
const p = {};
|
|
287
287
|
I.value.forEach((c) => {
|
|
288
288
|
if (["buttons", "divider", "heading"].includes(c.type)) return;
|
|
289
|
-
const S =
|
|
289
|
+
const S = R.value[c.name];
|
|
290
290
|
if (c.required && !S && S !== 0 && S !== !1) {
|
|
291
291
|
p[c.name] = `${c.label || "This field"} is required`;
|
|
292
292
|
return;
|
|
@@ -311,18 +311,18 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
311
311
|
const r = (B = w.value.data) == null ? void 0 : B.validation;
|
|
312
312
|
return r && Object.entries(r).forEach(([c, S]) => {
|
|
313
313
|
if (p[c]) return;
|
|
314
|
-
const ne =
|
|
314
|
+
const ne = R.value[c];
|
|
315
315
|
S.pattern && ne && (new RegExp(S.pattern).test(ne) || (p[c] = S.message || `${c} is invalid`));
|
|
316
|
-
}),
|
|
316
|
+
}), q.value = p, Object.keys(p).length === 0;
|
|
317
317
|
}
|
|
318
318
|
function H() {
|
|
319
|
-
W(),
|
|
319
|
+
W(), q.value = {};
|
|
320
320
|
}
|
|
321
321
|
function K() {
|
|
322
322
|
ie() && (X.value = !0, m("submit", {
|
|
323
323
|
formId: y.value,
|
|
324
324
|
action: "submit",
|
|
325
|
-
values: { ...
|
|
325
|
+
values: { ...R.value },
|
|
326
326
|
timestamp: Date.now()
|
|
327
327
|
}), setTimeout(() => {
|
|
328
328
|
X.value = !1, L("submitted");
|
|
@@ -359,7 +359,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
359
359
|
action: T,
|
|
360
360
|
buttonName: p.name || p.label,
|
|
361
361
|
buttonLabel: p.label,
|
|
362
|
-
values: { ...
|
|
362
|
+
values: { ...R.value },
|
|
363
363
|
timestamp: Date.now()
|
|
364
364
|
}), setTimeout(() => {
|
|
365
365
|
L("submitted");
|
|
@@ -404,13 +404,13 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
404
404
|
])]))
|
|
405
405
|
]),
|
|
406
406
|
e("span", ra, o($.value), 1)
|
|
407
|
-
])) : (a(), s(
|
|
407
|
+
])) : (a(), s(V, { key: 1 }, [
|
|
408
408
|
w.value.title || w.value.description ? (a(), s("div", ca, [
|
|
409
409
|
w.value.title ? (a(), s("div", ua, o(w.value.title), 1)) : d("", !0),
|
|
410
410
|
w.value.description ? (a(), s("p", da, o(w.value.description), 1)) : d("", !0)
|
|
411
411
|
])) : d("", !0),
|
|
412
412
|
w.value.variant === "buttons" ? (a(), s("div", va, [
|
|
413
|
-
(a(!0), s(
|
|
413
|
+
(a(!0), s(V, null, de(te.value, (r) => (a(), s("button", {
|
|
414
414
|
key: r.name || r.label,
|
|
415
415
|
type: "button",
|
|
416
416
|
class: J(["artifactuse-form-btn", `artifactuse-form-btn-${r.variant || "secondary"}`]),
|
|
@@ -430,11 +430,11 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
430
430
|
onSubmit: ye(K, ["prevent"])
|
|
431
431
|
}, [
|
|
432
432
|
e("div", _a, [
|
|
433
|
-
(a(!0), s(
|
|
433
|
+
(a(!0), s(V, null, de(I.value, (r, B) => (a(), s(V, {
|
|
434
434
|
key: r.name || B
|
|
435
435
|
}, [
|
|
436
436
|
r.type === "buttons" ? (a(), s("div", ha, [
|
|
437
|
-
(a(!0), s(
|
|
437
|
+
(a(!0), s(V, null, de(r.fields || [], (c) => (a(), s("button", {
|
|
438
438
|
key: c.name || c.label,
|
|
439
439
|
type: c.action === "submit" ? "submit" : "button",
|
|
440
440
|
class: J(["artifactuse-form-btn", `artifactuse-form-btn-${c.variant || "secondary"}`]),
|
|
@@ -452,7 +452,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
452
452
|
e("label", ba, [
|
|
453
453
|
e("input", {
|
|
454
454
|
type: "checkbox",
|
|
455
|
-
checked:
|
|
455
|
+
checked: R.value[r.name],
|
|
456
456
|
disabled: r.disabled,
|
|
457
457
|
class: "artifactuse-checkbox",
|
|
458
458
|
onChange: (c) => _(r.name, c.target.checked)
|
|
@@ -463,7 +463,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
463
463
|
])
|
|
464
464
|
]),
|
|
465
465
|
r.helpText ? (a(), s("span", La, o(r.helpText), 1)) : d("", !0),
|
|
466
|
-
|
|
466
|
+
q.value[r.name] ? (a(), s("span", Ta, o(q.value[r.name]), 1)) : d("", !0)
|
|
467
467
|
])) : (a(), s("div", Aa, [
|
|
468
468
|
e("label", {
|
|
469
469
|
for: `${y.value}-${r.name}`,
|
|
@@ -476,7 +476,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
476
476
|
key: 0,
|
|
477
477
|
id: `${y.value}-${r.name}`,
|
|
478
478
|
type: r.type,
|
|
479
|
-
value:
|
|
479
|
+
value: R.value[r.name],
|
|
480
480
|
placeholder: r.placeholder,
|
|
481
481
|
disabled: r.disabled,
|
|
482
482
|
required: r.required,
|
|
@@ -485,7 +485,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
485
485
|
}, null, 40, Sa)) : r.type === "textarea" ? (a(), s("textarea", {
|
|
486
486
|
key: 1,
|
|
487
487
|
id: `${y.value}-${r.name}`,
|
|
488
|
-
value:
|
|
488
|
+
value: R.value[r.name],
|
|
489
489
|
placeholder: r.placeholder,
|
|
490
490
|
disabled: r.disabled,
|
|
491
491
|
required: r.required,
|
|
@@ -495,20 +495,20 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
495
495
|
}, null, 40, Ba)) : r.type === "select" ? (a(), s("select", {
|
|
496
496
|
key: 2,
|
|
497
497
|
id: `${y.value}-${r.name}`,
|
|
498
|
-
value:
|
|
498
|
+
value: R.value[r.name],
|
|
499
499
|
disabled: r.disabled,
|
|
500
500
|
required: r.required,
|
|
501
501
|
class: "artifactuse-select",
|
|
502
502
|
onChange: (c) => _(r.name, c.target.value)
|
|
503
503
|
}, [
|
|
504
504
|
e("option", za, o(r.placeholder || "Select..."), 1),
|
|
505
|
-
(a(!0), s(
|
|
505
|
+
(a(!0), s(V, null, de(f(r.options), (c) => (a(), s("option", {
|
|
506
506
|
key: c.value,
|
|
507
507
|
value: c.value,
|
|
508
508
|
disabled: c.disabled
|
|
509
509
|
}, o(c.label), 9, Ia))), 128))
|
|
510
510
|
], 40, Ea)) : r.type === "radio" ? (a(), s("div", Fa, [
|
|
511
|
-
(a(!0), s(
|
|
511
|
+
(a(!0), s(V, null, de(f(r.options), (c) => (a(), s("label", {
|
|
512
512
|
key: c.value,
|
|
513
513
|
class: "artifactuse-radio-label"
|
|
514
514
|
}, [
|
|
@@ -516,7 +516,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
516
516
|
type: "radio",
|
|
517
517
|
name: r.name,
|
|
518
518
|
value: c.value,
|
|
519
|
-
checked:
|
|
519
|
+
checked: R.value[r.name] === c.value,
|
|
520
520
|
disabled: c.disabled || r.disabled,
|
|
521
521
|
class: "artifactuse-radio",
|
|
522
522
|
onChange: (S) => _(r.name, c.value)
|
|
@@ -525,7 +525,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
525
525
|
]))), 128))
|
|
526
526
|
])) : d("", !0),
|
|
527
527
|
r.helpText ? (a(), s("span", Ra, o(r.helpText), 1)) : d("", !0),
|
|
528
|
-
|
|
528
|
+
q.value[r.name] ? (a(), s("span", qa, o(q.value[r.name]), 1)) : d("", !0)
|
|
529
529
|
]))
|
|
530
530
|
], 64))), 128))
|
|
531
531
|
]),
|
|
@@ -655,7 +655,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
655
655
|
}), $ = b(() => {
|
|
656
656
|
const f = y.value;
|
|
657
657
|
return f.likes || f.comments || f.shares || f.retweets || f.replies || f.views;
|
|
658
|
-
}),
|
|
658
|
+
}), R = b(() => `artifactuse-social-verified-${w.value.verifiedType || "blue"}`), q = b(() => ({
|
|
659
659
|
twitter: "X",
|
|
660
660
|
linkedin: "LinkedIn",
|
|
661
661
|
instagram: "Instagram",
|
|
@@ -730,7 +730,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
730
730
|
class: J(["artifactuse-social", [`artifactuse-social-${L.value}`]]),
|
|
731
731
|
"data-artifactuse-theme": A.theme
|
|
732
732
|
}, [
|
|
733
|
-
L.value === "twitter" ? (a(), s(
|
|
733
|
+
L.value === "twitter" ? (a(), s(V, { key: 0 }, [
|
|
734
734
|
e("div", Ja, [
|
|
735
735
|
e("img", {
|
|
736
736
|
src: w.value.avatar || _e,
|
|
@@ -743,7 +743,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
743
743
|
e("span", null, o(w.value.name), 1),
|
|
744
744
|
w.value.verified ? (a(), s("svg", {
|
|
745
745
|
key: 0,
|
|
746
|
-
class: J(["artifactuse-social-verified",
|
|
746
|
+
class: J(["artifactuse-social-verified", R.value]),
|
|
747
747
|
viewBox: "0 0 24 24",
|
|
748
748
|
fill: "currentColor"
|
|
749
749
|
}, [..._[0] || (_[0] = [
|
|
@@ -766,7 +766,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
766
766
|
class: J(["artifactuse-social-media-grid", { "artifactuse-social-media-single": n.value.media.length === 1 }]),
|
|
767
767
|
"data-count": n.value.media.length
|
|
768
768
|
}, [
|
|
769
|
-
(a(!0), s(
|
|
769
|
+
(a(!0), s(V, null, de(n.value.media.slice(0, 4), (r, B) => (a(), s("img", {
|
|
770
770
|
key: B,
|
|
771
771
|
src: r.url,
|
|
772
772
|
alt: r.alt || "",
|
|
@@ -803,7 +803,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
803
803
|
])
|
|
804
804
|
])) : d("", !0),
|
|
805
805
|
n.value.poll ? (a(), s("div", us, [
|
|
806
|
-
(a(!0), s(
|
|
806
|
+
(a(!0), s(V, null, de(n.value.poll.options, (r, B) => {
|
|
807
807
|
var c, S;
|
|
808
808
|
return a(), s("div", {
|
|
809
809
|
key: B,
|
|
@@ -879,7 +879,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
879
879
|
e("span", null, o(z(y.value.views || 0)), 1)
|
|
880
880
|
])
|
|
881
881
|
])) : d("", !0)
|
|
882
|
-
], 64)) : L.value === "linkedin" ? (a(), s(
|
|
882
|
+
], 64)) : L.value === "linkedin" ? (a(), s(V, { key: 1 }, [
|
|
883
883
|
e("div", $s, [
|
|
884
884
|
e("img", {
|
|
885
885
|
src: w.value.avatar || _e,
|
|
@@ -934,7 +934,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
934
934
|
]),
|
|
935
935
|
e("span", null, o(z(y.value.comments || 0)) + " comments · " + o(z(y.value.shares || 0)) + " shares", 1)
|
|
936
936
|
])) : d("", !0)
|
|
937
|
-
], 64)) : L.value === "instagram" ? (a(), s(
|
|
937
|
+
], 64)) : L.value === "instagram" ? (a(), s(V, { key: 2 }, [
|
|
938
938
|
e("div", Os, [
|
|
939
939
|
e("img", {
|
|
940
940
|
src: w.value.avatar || _e,
|
|
@@ -966,7 +966,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
966
966
|
}, null, 8, Ks)
|
|
967
967
|
]),
|
|
968
968
|
e("div", Ys, o(x.value.timestamp || "Just now"), 1)
|
|
969
|
-
], 64)) : L.value === "facebook" ? (a(), s(
|
|
969
|
+
], 64)) : L.value === "facebook" ? (a(), s(V, { key: 3 }, [
|
|
970
970
|
e("div", Qs, [
|
|
971
971
|
e("img", {
|
|
972
972
|
src: w.value.avatar || _e,
|
|
@@ -1018,7 +1018,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1018
1018
|
]),
|
|
1019
1019
|
e("span", pi, o(z(y.value.comments || 0)) + " comments · " + o(z(y.value.shares || 0)) + " shares", 1)
|
|
1020
1020
|
])) : d("", !0)
|
|
1021
|
-
], 64)) : L.value === "threads" ? (a(), s(
|
|
1021
|
+
], 64)) : L.value === "threads" ? (a(), s(V, { key: 4 }, [
|
|
1022
1022
|
e("div", _i, [
|
|
1023
1023
|
e("img", {
|
|
1024
1024
|
src: w.value.avatar || _e,
|
|
@@ -1077,7 +1077,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1077
1077
|
e("span", null, o(z(y.value.shares || 0)), 1)
|
|
1078
1078
|
])
|
|
1079
1079
|
])) : d("", !0)
|
|
1080
|
-
], 64)) : L.value === "tiktok" ? (a(), s(
|
|
1080
|
+
], 64)) : L.value === "tiktok" ? (a(), s(V, { key: 5 }, [
|
|
1081
1081
|
e("div", Li, [
|
|
1082
1082
|
n.value.thumbnail ? (a(), s("img", {
|
|
1083
1083
|
key: 0,
|
|
@@ -1126,7 +1126,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1126
1126
|
e("span", null, o(z(y.value.shares || 0)) + " shares", 1)
|
|
1127
1127
|
])) : d("", !0)
|
|
1128
1128
|
])
|
|
1129
|
-
], 64)) : L.value === "youtube" ? (a(), s(
|
|
1129
|
+
], 64)) : L.value === "youtube" ? (a(), s(V, { key: 6 }, [
|
|
1130
1130
|
e("div", Fi, [
|
|
1131
1131
|
n.value.thumbnail ? (a(), s("img", {
|
|
1132
1132
|
key: 0,
|
|
@@ -1153,7 +1153,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1153
1153
|
e("div", Ni, [
|
|
1154
1154
|
e("div", Ji, [
|
|
1155
1155
|
(a(), be(Et(X.value))),
|
|
1156
|
-
e("span", null, o(
|
|
1156
|
+
e("span", null, o(q.value), 1)
|
|
1157
1157
|
]),
|
|
1158
1158
|
e("button", {
|
|
1159
1159
|
class: "artifactuse-social-copy-btn",
|
|
@@ -1454,8 +1454,8 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1454
1454
|
state: L,
|
|
1455
1455
|
getTheme: w,
|
|
1456
1456
|
instance: n
|
|
1457
|
-
} = Ee(), y = M(null), x = M(null), $ = M(""),
|
|
1458
|
-
let
|
|
1457
|
+
} = Ee(), y = M(null), x = M(null), $ = M(""), R = M([]);
|
|
1458
|
+
let q = null;
|
|
1459
1459
|
const X = M(!1), I = M("image"), te = M(""), z = M(""), ae = M(""), Z = b(() => (w == null ? void 0 : w()) || "dark"), W = b(() => L.activeArtifactId), ve = b(() => {
|
|
1460
1460
|
var C;
|
|
1461
1461
|
return m.inlineCards ?? ((C = n == null ? void 0 : n.config) == null ? void 0 : C.inlineCards) ?? !0;
|
|
@@ -1469,8 +1469,8 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1469
1469
|
function ie(C) {
|
|
1470
1470
|
if (!C) return null;
|
|
1471
1471
|
try {
|
|
1472
|
-
const
|
|
1473
|
-
return JSON.parse(
|
|
1472
|
+
const F = decodeURIComponent(escape(atob(C)));
|
|
1473
|
+
return JSON.parse(F);
|
|
1474
1474
|
} catch {
|
|
1475
1475
|
try {
|
|
1476
1476
|
const D = C.replace(/ /g, `
|
|
@@ -1482,23 +1482,23 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
1484
1484
|
const H = b(() => {
|
|
1485
|
-
const C = [],
|
|
1486
|
-
if (!
|
|
1485
|
+
const C = [], F = $.value;
|
|
1486
|
+
if (!F) return C;
|
|
1487
1487
|
const D = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
|
|
1488
1488
|
let Y = 0, P;
|
|
1489
|
-
for (; (P = D.exec(
|
|
1489
|
+
for (; (P = D.exec(F)) !== null; ) {
|
|
1490
1490
|
if (P.index > Y) {
|
|
1491
|
-
const j =
|
|
1491
|
+
const j = F.slice(Y, P.index);
|
|
1492
1492
|
j.trim() && C.push({ type: "html", content: j });
|
|
1493
1493
|
}
|
|
1494
1494
|
const N = ie(P[3]), v = P[2];
|
|
1495
1495
|
N && (v === "form" && N.isInline ? C.push({ type: "form", artifact: N }) : v === "social" ? C.push({ type: "social", artifact: N }) : C.push({ type: "panel", artifact: N })), Y = P.index + P[0].length;
|
|
1496
1496
|
}
|
|
1497
|
-
if (Y <
|
|
1498
|
-
const N =
|
|
1497
|
+
if (Y < F.length) {
|
|
1498
|
+
const N = F.slice(Y);
|
|
1499
1499
|
N.trim() && C.push({ type: "html", content: N });
|
|
1500
1500
|
}
|
|
1501
|
-
return C.length === 0 &&
|
|
1501
|
+
return C.length === 0 && F.trim() && C.push({ type: "html", content: F }), C;
|
|
1502
1502
|
});
|
|
1503
1503
|
function K(C) {
|
|
1504
1504
|
I.value = C.type || "image", te.value = C.src || "", z.value = C.alt || "", ae.value = C.caption || "", X.value = !0, l("media-open", C);
|
|
@@ -1581,7 +1581,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1581
1581
|
});
|
|
1582
1582
|
}
|
|
1583
1583
|
function r() {
|
|
1584
|
-
|
|
1584
|
+
q && clearTimeout(q), q = setTimeout(async () => {
|
|
1585
1585
|
if (await Ce(), n != null && n.initializeContent && x.value)
|
|
1586
1586
|
try {
|
|
1587
1587
|
await n.initializeContent(x.value);
|
|
@@ -1595,30 +1595,31 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1595
1595
|
() => m.content,
|
|
1596
1596
|
(C) => {
|
|
1597
1597
|
if (C) {
|
|
1598
|
-
const
|
|
1598
|
+
const F = U(C, m.messageId, {
|
|
1599
1599
|
inlinePreview: m.inlinePreview,
|
|
1600
1600
|
inlineCode: m.inlineCode,
|
|
1601
1601
|
tabs: m.tabs,
|
|
1602
1602
|
viewMode: m.viewMode
|
|
1603
1603
|
});
|
|
1604
|
-
$.value =
|
|
1604
|
+
$.value = F.html, R.value = F.artifacts, F.artifacts.length > 0 && l("artifact-detected", F.artifacts), m.typing || r();
|
|
1605
1605
|
}
|
|
1606
1606
|
},
|
|
1607
1607
|
{ immediate: !0 }
|
|
1608
1608
|
), pe(
|
|
1609
1609
|
() => m.typing,
|
|
1610
|
-
(C,
|
|
1611
|
-
|
|
1610
|
+
(C, F) => {
|
|
1611
|
+
F === !0 && C === !1 && r();
|
|
1612
1612
|
}
|
|
1613
1613
|
), xe(() => {
|
|
1614
1614
|
m.typing || r();
|
|
1615
1615
|
}), Ft(() => {
|
|
1616
|
-
|
|
1616
|
+
q && clearTimeout(q), T();
|
|
1617
1617
|
});
|
|
1618
1618
|
function B(C) {
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1619
|
+
const F = C.target.closest(".artifactuse-inline-preview");
|
|
1620
|
+
if (F) {
|
|
1621
|
+
if (F.dataset.nonClickable) return;
|
|
1622
|
+
const D = F.dataset.artifactId;
|
|
1622
1623
|
if (D) {
|
|
1623
1624
|
const Y = L.artifacts.find((P) => P.id === D);
|
|
1624
1625
|
Y && c(Y);
|
|
@@ -1650,7 +1651,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1650
1651
|
openViewer: K,
|
|
1651
1652
|
closeViewer: ee,
|
|
1652
1653
|
attachMediaListeners: p
|
|
1653
|
-
}), (C,
|
|
1654
|
+
}), (C, F) => (a(), s("div", {
|
|
1654
1655
|
class: "artifactuse-agent-message",
|
|
1655
1656
|
ref_key: "messageRef",
|
|
1656
1657
|
ref: y
|
|
@@ -1661,7 +1662,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1661
1662
|
ref: x,
|
|
1662
1663
|
onClick: B
|
|
1663
1664
|
}, [
|
|
1664
|
-
(a(!0), s(
|
|
1665
|
+
(a(!0), s(V, null, de(H.value, (D, Y) => (a(), s(V, { key: Y }, [
|
|
1665
1666
|
D.type === "html" ? (a(), s("div", {
|
|
1666
1667
|
key: 0,
|
|
1667
1668
|
innerHTML: D.content
|
|
@@ -1816,12 +1817,12 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1816
1817
|
getPanelUrl: y,
|
|
1817
1818
|
openArtifact: x,
|
|
1818
1819
|
instance: $
|
|
1819
|
-
} = Ee(),
|
|
1820
|
+
} = Ee(), R = M(null), q = M(null), X = M(null), I = M(null), te = M(null), z = M(null), ae = M(!1), Z = M(!1), W = M(!0), ve = M(!1), f = M(!1), _ = M(!1), ie = M(!1), H = M("options"), K = M(""), ee = M(null), p = M(""), T = M(!1), r = M(!1), B = M([]), c = M(!1), S = M("");
|
|
1820
1821
|
let ne = null, ue = null, fe = null;
|
|
1821
1822
|
const Le = b(() => {
|
|
1822
1823
|
var i;
|
|
1823
1824
|
return ((i = $.editor) == null ? void 0 : i.isAvailable()) || !1;
|
|
1824
|
-
}), he = M(65), C = M(50),
|
|
1825
|
+
}), he = M(65), C = M(50), F = b(() => l.value ? Se(l.value.language) : ""), D = b(() => l.value ? `<svg viewBox="0 0 24 24" fill="currentColor">${Oe(l.value.language)}</svg>` : ""), Y = b(() => {
|
|
1825
1826
|
if (!l.value) return null;
|
|
1826
1827
|
let i = y(l.value);
|
|
1827
1828
|
return i && l.value._refreshToken && (i += (i.includes("?") ? "&" : "?") + "_t=" + l.value._refreshToken), i;
|
|
@@ -1869,26 +1870,26 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1869
1870
|
}
|
|
1870
1871
|
function ut() {
|
|
1871
1872
|
var i;
|
|
1872
|
-
if (
|
|
1873
|
+
if (q.value && at() && ((i = l.value) != null && i.code)) {
|
|
1873
1874
|
const t = Ne(l.value);
|
|
1874
1875
|
if (t)
|
|
1875
|
-
|
|
1876
|
+
q.value.innerHTML = t.html;
|
|
1876
1877
|
else {
|
|
1877
1878
|
const g = window.Prism.languages[P.value];
|
|
1878
|
-
g ?
|
|
1879
|
+
g ? q.value.innerHTML = window.Prism.highlight(
|
|
1879
1880
|
l.value.code,
|
|
1880
1881
|
g,
|
|
1881
1882
|
P.value
|
|
1882
|
-
) :
|
|
1883
|
+
) : q.value.textContent = l.value.code;
|
|
1883
1884
|
}
|
|
1884
|
-
|
|
1885
|
+
q.value.dataset.highlighted = "true", Ce(() => {
|
|
1885
1886
|
dt();
|
|
1886
1887
|
});
|
|
1887
1888
|
}
|
|
1888
1889
|
}
|
|
1889
1890
|
function dt() {
|
|
1890
1891
|
var t;
|
|
1891
|
-
const i = (t =
|
|
1892
|
+
const i = (t = q.value) == null ? void 0 : t.closest("pre");
|
|
1892
1893
|
if (i && te.value && I.value) {
|
|
1893
1894
|
const O = window.getComputedStyle(i).backgroundColor;
|
|
1894
1895
|
O && O !== "rgba(0, 0, 0, 0)" && O !== "transparent" && (te.value.style.backgroundColor = O, I.value.style.backgroundColor = O);
|
|
@@ -1922,7 +1923,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
1922
1923
|
});
|
|
1923
1924
|
}
|
|
1924
1925
|
function pt() {
|
|
1925
|
-
clearTimeout(ue), W.value = !1,
|
|
1926
|
+
clearTimeout(ue), W.value = !1, R.value && l.value && ($.bridge.setIframe(R.value), $.bridge.loadArtifact(l.value));
|
|
1926
1927
|
}
|
|
1927
1928
|
function _t() {
|
|
1928
1929
|
clearTimeout(ue), W.value = !1;
|
|
@@ -2128,7 +2129,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2128
2129
|
i && (t && t.isPreviewable !== i.isPreviewable && (ve.value = !0, setTimeout(() => {
|
|
2129
2130
|
ve.value = !1;
|
|
2130
2131
|
}, 150)), (!t || i.id !== t.id) && (vt(), W.value = !0, ht()), (!t || i.id !== t.id || i.code !== t.code) && (Te(), m.viewMode === "edit" && (!t || i.id !== t.id ? Ce(() => Je()) : fe && fe.setCode(i.code || "")), clearTimeout(ne), ne = setTimeout(() => {
|
|
2131
|
-
|
|
2132
|
+
R.value && i.isPreviewable && $.bridge.loadArtifact(i);
|
|
2132
2133
|
}, 500)));
|
|
2133
2134
|
}, { deep: !0 }), pe(() => m.viewMode, (i) => {
|
|
2134
2135
|
(i === "code" || i === "split") && Te(), i === "edit" && Ce(() => Je());
|
|
@@ -2156,7 +2157,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2156
2157
|
}, [...t[12] || (t[12] = [
|
|
2157
2158
|
e("div", { class: "artifactuse-panel__resize-handle-line" }, null, -1)
|
|
2158
2159
|
])], 32)),
|
|
2159
|
-
k(E) ? k(l) ? (a(), s(
|
|
2160
|
+
k(E) ? k(l) ? (a(), s(V, { key: 3 }, [
|
|
2160
2161
|
e("header", xl, [
|
|
2161
2162
|
f.value ? (a(), s("button", {
|
|
2162
2163
|
key: 0,
|
|
@@ -2181,8 +2182,8 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2181
2182
|
e("div", Ll, [
|
|
2182
2183
|
e("span", Tl, o(k(l).title || "Untitled"), 1),
|
|
2183
2184
|
e("span", Al, [
|
|
2184
|
-
G(o(
|
|
2185
|
-
k(l).lineCount ? (a(), s(
|
|
2185
|
+
G(o(F.value) + " ", 1),
|
|
2186
|
+
k(l).lineCount ? (a(), s(V, { key: 0 }, [
|
|
2186
2187
|
G(" • " + o(k(l).lineCount) + " lines ", 1)
|
|
2187
2188
|
], 64)) : d("", !0)
|
|
2188
2189
|
])
|
|
@@ -2376,7 +2377,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2376
2377
|
Y.value ? (a(), s("iframe", {
|
|
2377
2378
|
key: 1,
|
|
2378
2379
|
ref_key: "iframeRef",
|
|
2379
|
-
ref:
|
|
2380
|
+
ref: R,
|
|
2380
2381
|
src: Y.value,
|
|
2381
2382
|
class: J(["artifactuse-panel__iframe", { "artifactuse-panel__iframe--loading": W.value }]),
|
|
2382
2383
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
|
|
@@ -2399,7 +2400,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2399
2400
|
y2: "12"
|
|
2400
2401
|
})
|
|
2401
2402
|
], -1)),
|
|
2402
|
-
e("p", null, "Preview not available for " + o(
|
|
2403
|
+
e("p", null, "Preview not available for " + o(F.value), 1)
|
|
2403
2404
|
]))
|
|
2404
2405
|
], 4)) : d("", !0),
|
|
2405
2406
|
et(e("div", {
|
|
@@ -2429,7 +2430,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2429
2430
|
}, [
|
|
2430
2431
|
(a(), s("code", {
|
|
2431
2432
|
ref_key: "codeRef",
|
|
2432
|
-
ref:
|
|
2433
|
+
ref: q,
|
|
2433
2434
|
key: k(l).id,
|
|
2434
2435
|
class: J(`language-${P.value}`)
|
|
2435
2436
|
}, null, 2))
|
|
@@ -2669,7 +2670,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2669
2670
|
e("div", { class: "artifactuse-share-popup__spinner" }, null, -1),
|
|
2670
2671
|
e("p", { class: "artifactuse-share-popup__loading-text" }, "Loading artifacts...", -1)
|
|
2671
2672
|
])])) : B.value.length === 0 ? (a(), s("div", un, " No saved artifacts of this type ")) : (a(), s("div", dn, [
|
|
2672
|
-
(a(!0), s(
|
|
2673
|
+
(a(!0), s(V, null, de(B.value, (g) => {
|
|
2673
2674
|
var O, Q, me;
|
|
2674
2675
|
return a(), s("button", {
|
|
2675
2676
|
key: ((O = g.project) == null ? void 0 : O.uuid) || g.id,
|
|
@@ -2877,7 +2878,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2877
2878
|
])])
|
|
2878
2879
|
]),
|
|
2879
2880
|
e("div", Mn, [
|
|
2880
|
-
(a(!0), s(
|
|
2881
|
+
(a(!0), s(V, null, de(N.value, (g, O) => (a(), s("button", {
|
|
2881
2882
|
key: g.id,
|
|
2882
2883
|
class: J(["artifactuse-panel__artifact-item", { "artifactuse-panel__artifact-item--active": g.id === k(l).id }]),
|
|
2883
2884
|
onClick: (Q) => Ke(g)
|
|
@@ -2890,7 +2891,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2890
2891
|
e("span", Pn, o(g.title || "Untitled"), 1),
|
|
2891
2892
|
e("span", Hn, [
|
|
2892
2893
|
G(o(k(Se)(g.language)) + " ", 1),
|
|
2893
|
-
g.lineCount ? (a(), s(
|
|
2894
|
+
g.lineCount ? (a(), s(V, { key: 0 }, [
|
|
2894
2895
|
G(" • " + o(g.lineCount) + " lines ", 1)
|
|
2895
2896
|
], 64)) : d("", !0)
|
|
2896
2897
|
])
|
|
@@ -2905,7 +2906,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2905
2906
|
])) : d("", !0)
|
|
2906
2907
|
])
|
|
2907
2908
|
])
|
|
2908
|
-
], 64)) : (a(), s(
|
|
2909
|
+
], 64)) : (a(), s(V, { key: 2 }, [
|
|
2909
2910
|
e("header", ol, [
|
|
2910
2911
|
e("div", rl, [
|
|
2911
2912
|
t[18] || (t[18] = e("span", { class: "artifactuse-panel__icon" }, [
|
|
@@ -2979,7 +2980,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2979
2980
|
]),
|
|
2980
2981
|
e("div", _l, [
|
|
2981
2982
|
e("div", hl, [
|
|
2982
|
-
(a(!0), s(
|
|
2983
|
+
(a(!0), s(V, null, de(N.value, (g, O) => (a(), s("button", {
|
|
2983
2984
|
key: g.id,
|
|
2984
2985
|
class: "artifactuse-panel__list-item",
|
|
2985
2986
|
onClick: (Q) => Ke(g)
|
|
@@ -2992,7 +2993,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
2992
2993
|
e("span", kl, o(g.title || "Untitled"), 1),
|
|
2993
2994
|
e("span", wl, [
|
|
2994
2995
|
G(o(k(Se)(g.language)) + " ", 1),
|
|
2995
|
-
g.lineCount ? (a(), s(
|
|
2996
|
+
g.lineCount ? (a(), s(V, { key: 0 }, [
|
|
2996
2997
|
G(" • " + o(g.lineCount) + " lines ", 1)
|
|
2997
2998
|
], 64)) : d("", !0)
|
|
2998
2999
|
])
|
|
@@ -3031,7 +3032,7 @@ const jt = { class: "artifactuse-card__icon" }, Nt = ["innerHTML"], Jt = { class
|
|
|
3031
3032
|
e("span", null, "Artifactuse", -1)
|
|
3032
3033
|
])])) : d("", !0)
|
|
3033
3034
|
])
|
|
3034
|
-
], 64)) : (a(), s(
|
|
3035
|
+
], 64)) : (a(), s(V, { key: 1 }, [
|
|
3035
3036
|
e("header", sl, [
|
|
3036
3037
|
t[14] || (t[14] = e("div", { class: "artifactuse-panel__title" }, [
|
|
3037
3038
|
e("span", { class: "artifactuse-panel__icon" }, [
|