artifactuse 0.4.0 → 0.4.2
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/{index-N70SEeFL.js → index-CBGheZYZ.js} +7 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +3 -3
- package/dist/svelte/index.js +197 -197
- package/dist/vue/index.js +4 -4
- package/dist/vue2/index.js +20 -4
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as M, computed as k, createElementBlock as l, openBlock as s, normalizeClass as R, createElementVNode as e, toDisplayString as i, withModifiers as me, onMounted as Ee, watch as ne, Fragment as V, createCommentVNode as v, renderList as fe, createTextVNode as G, h as re, normalizeStyle as Le, createStaticVNode as ua, createBlock as Pe, resolveDynamicComponent as da, nextTick as xe, onUnmounted as st, Teleport as va, createVNode as De, Transition as qe, withCtx as Oe, withKeys as fa, onBeforeUnmount as pa, unref as p, withDirectives as Ct, vShow as xt, reactive as Tt, provide as _a, inject as ha } from "vue";
|
|
2
|
-
import { g as Ue, f as Lt, a as tt, b as at, n as ma, i as $t, c as ya, D as ga, d as Pt } from "../index-
|
|
2
|
+
import { g as Ue, f as Lt, a as tt, b as at, n as ma, i as $t, c as ya, D as ga, d as Pt } from "../index-CBGheZYZ.js";
|
|
3
3
|
import { g as Mt, r as ka, J as wa, b as ba } from "../jszip.min-BdBnWAEK.js";
|
|
4
4
|
const Ca = { class: "artifactuse-card__icon" }, xa = ["innerHTML"], $a = { class: "artifactuse-card__content" }, Ma = { class: "artifactuse-card__title" }, Ta = { class: "artifactuse-card__meta" }, La = { class: "artifactuse-card__type" }, Pa = { class: "artifactuse-card__size" }, Ea = { class: "artifactuse-card__actions" }, Aa = ["title"], Ha = {
|
|
5
5
|
key: 0,
|
|
@@ -1878,8 +1878,8 @@ const Ca = { class: "artifactuse-card__icon" }, xa = ["innerHTML"], $a = { class
|
|
|
1878
1878
|
var a;
|
|
1879
1879
|
return ((a = x.config) == null ? void 0 : a.branding) !== !1;
|
|
1880
1880
|
}), lt = ["image", "audio", "video", "pdf", "font", "binary"], Be = k(() => {
|
|
1881
|
-
var a;
|
|
1882
|
-
return lt.includes((a = n.value) == null ? void 0 : a.language);
|
|
1881
|
+
var a, t;
|
|
1882
|
+
return lt.includes((a = n.value) == null ? void 0 : a.language) && !!((t = n.value) != null && t.fileExtension);
|
|
1883
1883
|
}), we = k(() => Be.value ? n.value.language : null), We = k(() => we.value !== "font" || !n.value ? "" : `apfont_${n.value.id.replace(/[^a-zA-Z0-9]/g, "_")}`), Ht = k(() => {
|
|
1884
1884
|
var a;
|
|
1885
1885
|
if (we.value !== "binary" || !((a = n.value) != null && a.code)) return "";
|
|
@@ -2223,7 +2223,7 @@ const Ca = { class: "artifactuse-card__icon" }, xa = ["innerHTML"], $a = { class
|
|
|
2223
2223
|
return ne(n, (a, t) => {
|
|
2224
2224
|
a && (t && t.isPreviewable !== a.isPreviewable && (m.value = !0, setTimeout(() => {
|
|
2225
2225
|
m.value = !1;
|
|
2226
|
-
}, 150)), (!t || a.id !== t.id) && (jt(), pe.value = !0, Xt(), lt.includes(a.language) && f.viewMode !== "preview" && h("preview")), (!t || a.id !== t.id || a.code !== t.code) && (Re(), f.viewMode === "edit" && (!t || a.id !== t.id ? xe(() => vt()) : Q && Q.setCode(a.code || "")), clearTimeout(le), le = setTimeout(() => {
|
|
2226
|
+
}, 150)), (!t || a.id !== t.id) && (jt(), pe.value = !0, Xt(), lt.includes(a.language) && a.fileExtension && f.viewMode !== "preview" && h("preview")), (!t || a.id !== t.id || a.code !== t.code) && (Re(), f.viewMode === "edit" && (!t || a.id !== t.id ? xe(() => vt()) : Q && Q.setCode(a.code || "")), clearTimeout(le), le = setTimeout(() => {
|
|
2227
2227
|
N.value && a.isPreviewable && x.bridge.loadArtifact(a);
|
|
2228
2228
|
}, 500)));
|
|
2229
2229
|
}, { deep: !0 }), ne(() => f.viewMode, (a) => {
|
package/dist/vue2/index.js
CHANGED
|
@@ -2993,12 +2993,27 @@ function processImages(html) {
|
|
|
2993
2993
|
'gi'
|
|
2994
2994
|
);
|
|
2995
2995
|
html = html.replace(imageLinkRegex, (match, imageUrl, linkText) => {
|
|
2996
|
-
const meaningfulText = linkText &&
|
|
2997
|
-
|
|
2996
|
+
const meaningfulText = linkText &&
|
|
2997
|
+
!linkText.match(/^(view|see|open|click|image|photo|picture)$/i) &&
|
|
2998
|
+
!linkText.match(/^https?:\/\//i)
|
|
2999
|
+
? linkText
|
|
2998
3000
|
: '';
|
|
2999
3001
|
return renderImageHtml(imageUrl, meaningfulText, meaningfulText);
|
|
3000
3002
|
});
|
|
3001
3003
|
|
|
3004
|
+
// Re-protect any new <img> tags and containers created by the linkified URL step above,
|
|
3005
|
+
// so the raw URL regex below cannot double-process URLs inside caption divs.
|
|
3006
|
+
html = html.replace(/<img[^>]*>/gi, (match) => {
|
|
3007
|
+
const placeholder = `__IMG_PROTECTED_${protectedContent.length}__`;
|
|
3008
|
+
protectedContent.push(match);
|
|
3009
|
+
return placeholder;
|
|
3010
|
+
});
|
|
3011
|
+
html = html.replace(/<div class="artifactuse-image-container">[\s\S]*?<\/div>\s*<\/div>/gi, (match) => {
|
|
3012
|
+
const placeholder = `__IMG_PROTECTED_${protectedContent.length}__`;
|
|
3013
|
+
protectedContent.push(match);
|
|
3014
|
+
return placeholder;
|
|
3015
|
+
});
|
|
3016
|
+
|
|
3002
3017
|
// Process raw image URLs (not already in tags)
|
|
3003
3018
|
const rawImageRegex = new RegExp(
|
|
3004
3019
|
`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(?:${extPattern})(\\?[^\\s<>"]*)?)(?!["'])`,
|
|
@@ -27940,7 +27955,8 @@ var script$1 = defineComponent({
|
|
|
27940
27955
|
});
|
|
27941
27956
|
|
|
27942
27957
|
const isBinaryArtifact = computed(() => {
|
|
27943
|
-
return BINARY_CATEGORIES.includes(activeArtifact.value && activeArtifact.value.language)
|
|
27958
|
+
return BINARY_CATEGORIES.includes(activeArtifact.value && activeArtifact.value.language)
|
|
27959
|
+
&& !!(activeArtifact.value && activeArtifact.value.fileExtension);
|
|
27944
27960
|
});
|
|
27945
27961
|
|
|
27946
27962
|
const binaryCategory = computed(() => {
|
|
@@ -28582,7 +28598,7 @@ var script$1 = defineComponent({
|
|
|
28582
28598
|
resetCodeContainerStyles();
|
|
28583
28599
|
iframeLoading.value = true;
|
|
28584
28600
|
startIframeLoadTimeout();
|
|
28585
|
-
if (BINARY_CATEGORIES.indexOf(newArtifact.language) !== -1 && state.viewMode !== 'preview') {
|
|
28601
|
+
if (BINARY_CATEGORIES.indexOf(newArtifact.language) !== -1 && newArtifact.fileExtension && state.viewMode !== 'preview') {
|
|
28586
28602
|
setViewMode('preview');
|
|
28587
28603
|
}
|
|
28588
28604
|
}
|