@deot/docs-playground 1.1.1 → 1.1.3
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 +62 -0
- package/dist/cdn-Czve5_9b.cjs +94 -0
- package/dist/cdn-DEvdGJu2.js +53 -0
- package/dist/compile-Bw7v7QE-.js +333 -0
- package/dist/compile-DSMuM8zl.cjs +333 -0
- package/dist/files-C5UMzYxA.js +178 -0
- package/dist/files-D5LNOtjp.cjs +192 -0
- package/dist/index.cjs +272 -795
- package/dist/index.d.ts +40 -2
- package/dist/index.js +231 -734
- package/dist/index.style.css +1 -1
- package/dist/linker-B--sjERT.cjs +167 -0
- package/dist/linker-JHdz37DK.js +166 -0
- package/dist/local-sandbox-B8IJ5jWb.js +431 -0
- package/dist/local-sandbox-DnkKrBhf.cjs +428 -0
- package/dist/modules-CInmL-8h.cjs +217 -0
- package/dist/modules-DlLJF_vd.js +211 -0
- package/dist/remote-CKMzn1J3.cjs +106 -0
- package/dist/remote-DfXAsO9n.js +106 -0
- package/dist/rolldown-runtime-C0BPl7ul.cjs +43 -0
- package/dist/script-5Xzzx7u5.cjs +57 -0
- package/dist/script-xKUjE8pf.js +46 -0
- package/dist/scss-Co2it4vB.js +215 -0
- package/dist/scss-DaIqB_qT.cjs +233 -0
- package/dist/store-BF7z-oaO.cjs +964 -0
- package/dist/store-D8vwi-HV.js +767 -0
- package/package.json +20 -9
package/dist/index.cjs
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
3
|
+
const require_cdn = require("./cdn-Czve5_9b.cjs");
|
|
4
|
+
const require_store = require("./store-BF7z-oaO.cjs");
|
|
5
|
+
const require_scss = require("./scss-DaIqB_qT.cjs");
|
|
24
6
|
let vue = require("vue");
|
|
25
7
|
let _deot_vc = require("@deot/vc");
|
|
26
8
|
let _deot_docs_locale = require("@deot/docs-locale");
|
|
27
9
|
let highlight_js = require("highlight.js");
|
|
28
|
-
highlight_js = __toESM(highlight_js);
|
|
10
|
+
highlight_js = require_rolldown_runtime.__toESM(highlight_js);
|
|
29
11
|
let _vue_repl = require("@vue/repl");
|
|
30
12
|
let codemirror = require("codemirror");
|
|
31
13
|
let _codemirror_lang_css = require("@codemirror/lang-css");
|
|
@@ -334,12 +316,6 @@ var files_preview_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
334
316
|
}
|
|
335
317
|
});
|
|
336
318
|
//#endregion
|
|
337
|
-
//#region packages/playground/src/constants.ts
|
|
338
|
-
var DEFAULT_ENTRY = "App.vue";
|
|
339
|
-
/** 预览样式和默认 import map 共用的 npm CDN 前缀。 */
|
|
340
|
-
var DEFAULT_CDN_URL = "https://cdn.jsdelivr.net/npm";
|
|
341
|
-
var NEW_SFC_CODE = `<script setup lang="ts"><\/script>\n\n<template>\n <div>\n <slot />\n <\/div>\n<\/template>\n`;
|
|
342
|
-
//#endregion
|
|
343
319
|
//#region packages/playground/src/editor/drag.ts
|
|
344
320
|
var events = typeof document !== "undefined" && "ontouchstart" in document ? {
|
|
345
321
|
start: "touchstart",
|
|
@@ -595,7 +571,7 @@ var editor_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
595
571
|
const filename = nextFilename();
|
|
596
572
|
editorFiles.value = {
|
|
597
573
|
...editorFiles.value,
|
|
598
|
-
[filename]: NEW_SFC_CODE
|
|
574
|
+
[filename]: require_cdn.NEW_SFC_CODE
|
|
599
575
|
};
|
|
600
576
|
activeFilename.value = filename;
|
|
601
577
|
notifyFilesChange({
|
|
@@ -860,220 +836,6 @@ var resolvePlaygroundTitleId = (title, explicitId = "", isOccupied) => {
|
|
|
860
836
|
while (isOccupied(`${base}-${index}`)) index += 1;
|
|
861
837
|
return `${base}-${index}`;
|
|
862
838
|
};
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region packages/playground/src/core/preview-scroll.ts
|
|
865
|
-
/** iframe 包装成功后挂在 `html` 上,供样式与 auto-height 识别。 */
|
|
866
|
-
var PREVIEW_SCROLL_HTML_CLASS = "docs-playground-preview-scroll";
|
|
867
|
-
/** Scroller 内容节点 class,auto-height 优先测量该节点。 */
|
|
868
|
-
var PREVIEW_SCROLL_CONTENT_CLASS = "docs-playground-preview-scroll__content";
|
|
869
|
-
/** 重评时先清掉 html class,避免 `await import` 期间仍套用 `height:100%`。 */
|
|
870
|
-
var PREVIEW_SCROLL_RESET_CODE = `document.documentElement.classList.remove("${PREVIEW_SCROLL_HTML_CLASS}");`;
|
|
871
|
-
/** 动态探测 `@deot/vc`;失败时为空对象,不阻断 DocsLink / 预览挂载。 */
|
|
872
|
-
var PREVIEW_SCROLLER_IMPORT_CODE = "const __docsVc=await import(\"@deot/vc\").catch(()=>({}))";
|
|
873
|
-
/**
|
|
874
|
-
* Vue 的 `mount` 闭包的是 `createApp(root)` 时的根组件,改 `app._component` 不会生效。
|
|
875
|
-
* 因此劫持 `app.mount`:等全部 useCode 注册完后,再 `createApp` 包一层 Scroller。
|
|
876
|
-
* 前导分号避免接在 `app.component(...)` 后被 ASI 解析成调用返回值。
|
|
877
|
-
*/
|
|
878
|
-
var PREVIEW_SCROLLER_USE_CODE = [
|
|
879
|
-
";(()=>{",
|
|
880
|
-
PREVIEW_SCROLL_RESET_CODE,
|
|
881
|
-
"const __DocsScroller=__docsVc&&__docsVc.Scroller;",
|
|
882
|
-
"if(!__DocsScroller)return;",
|
|
883
|
-
"const UserApp=app._component;",
|
|
884
|
-
"app.mount=(container,...rest)=>{",
|
|
885
|
-
"const next=_createApp({",
|
|
886
|
-
"name:\"DocsPreviewRoot\",",
|
|
887
|
-
"setup(){return()=>__docsH(__DocsScroller,{",
|
|
888
|
-
"height:\"100%\",",
|
|
889
|
-
"native:false,",
|
|
890
|
-
"autoResize:true,",
|
|
891
|
-
"showBar:true,",
|
|
892
|
-
`contentClass:"${PREVIEW_SCROLL_CONTENT_CLASS}"`,
|
|
893
|
-
"},{default:()=>__docsH(UserApp)})}",
|
|
894
|
-
"});",
|
|
895
|
-
"next.config.errorHandler=app.config.errorHandler;",
|
|
896
|
-
"if(app._context&&next._context){",
|
|
897
|
-
"if(app._context.components)Object.assign(next._context.components,app._context.components);",
|
|
898
|
-
"if(app._context.directives)Object.assign(next._context.directives,app._context.directives);",
|
|
899
|
-
"}",
|
|
900
|
-
"window.__app__=next;",
|
|
901
|
-
`document.documentElement.classList.add("${PREVIEW_SCROLL_HTML_CLASS}");`,
|
|
902
|
-
"return next.mount(container,...rest)",
|
|
903
|
-
"}",
|
|
904
|
-
"})()"
|
|
905
|
-
].join("");
|
|
906
|
-
var PREVIEW_SCROLLER_STYLE = [
|
|
907
|
-
`html.${PREVIEW_SCROLL_HTML_CLASS},`,
|
|
908
|
-
`html.${PREVIEW_SCROLL_HTML_CLASS} body,`,
|
|
909
|
-
`html.${PREVIEW_SCROLL_HTML_CLASS} #app{`,
|
|
910
|
-
"height:100%;min-height:100%;margin:0;overflow:hidden",
|
|
911
|
-
"}",
|
|
912
|
-
`html.${PREVIEW_SCROLL_HTML_CLASS} #app>.vc-scroller,`,
|
|
913
|
-
`html.${PREVIEW_SCROLL_HTML_CLASS} #app>.vc-scroller>.vc-scroller__wrapper{`,
|
|
914
|
-
"height:100%;max-height:100%;box-sizing:border-box",
|
|
915
|
-
"}"
|
|
916
|
-
].join("");
|
|
917
|
-
var resolveSandboxContainer = (sandbox) => sandbox?.container ? (0, vue.unref)(sandbox.container) : null;
|
|
918
|
-
var resolveScrollContent = (iframeDocument) => {
|
|
919
|
-
if (!iframeDocument.documentElement.classList.contains("docs-playground-preview-scroll")) return null;
|
|
920
|
-
return iframeDocument.querySelector(`.${PREVIEW_SCROLL_CONTENT_CLASS}`);
|
|
921
|
-
};
|
|
922
|
-
var useSandboxAutoHeight = (sandboxRef) => {
|
|
923
|
-
const height = (0, vue.ref)(24);
|
|
924
|
-
let container = null;
|
|
925
|
-
let iframe = null;
|
|
926
|
-
let containerObserver = null;
|
|
927
|
-
let contentObserver = null;
|
|
928
|
-
let scrollMountObserver = null;
|
|
929
|
-
let observedScrollNode = null;
|
|
930
|
-
let frameId = 0;
|
|
931
|
-
const cancelMeasure = () => {
|
|
932
|
-
if (!frameId) return;
|
|
933
|
-
cancelAnimationFrame(frameId);
|
|
934
|
-
frameId = 0;
|
|
935
|
-
};
|
|
936
|
-
const measureDocumentContent = (iframeWindow, iframeDocument) => {
|
|
937
|
-
const { body, documentElement } = iframeDocument;
|
|
938
|
-
const bodyStyle = iframeWindow.getComputedStyle(body);
|
|
939
|
-
const bodyMargins = (Number.parseFloat(bodyStyle.marginTop) || 0) + (Number.parseFloat(bodyStyle.marginBottom) || 0);
|
|
940
|
-
const rootTop = documentElement.getBoundingClientRect().top;
|
|
941
|
-
const bodyRect = body.getBoundingClientRect();
|
|
942
|
-
const collapsedTop = Math.max(0, bodyRect.top - rootTop);
|
|
943
|
-
let childrenBottom = 0;
|
|
944
|
-
for (const child of body.children) {
|
|
945
|
-
const rect = child.getBoundingClientRect();
|
|
946
|
-
const marginBottom = Number.parseFloat(iframeWindow.getComputedStyle(child).marginBottom) || 0;
|
|
947
|
-
childrenBottom = Math.max(childrenBottom, rect.bottom + marginBottom - rootTop);
|
|
948
|
-
}
|
|
949
|
-
const scrollHeight = Math.max(body.scrollHeight, documentElement.scrollHeight);
|
|
950
|
-
const overflowingHeight = scrollHeight > (iframe?.clientHeight || 0) + 1 ? scrollHeight : 0;
|
|
951
|
-
return Math.ceil(Math.max(body.offsetHeight + bodyMargins + collapsedTop, bodyRect.height + bodyMargins + collapsedTop, childrenBottom, overflowingHeight));
|
|
952
|
-
};
|
|
953
|
-
const measureScrollContent = (scrollContent) => {
|
|
954
|
-
const contentStyle = scrollContent.ownerDocument.defaultView?.getComputedStyle(scrollContent);
|
|
955
|
-
const margins = contentStyle ? (Number.parseFloat(contentStyle.marginTop) || 0) + (Number.parseFloat(contentStyle.marginBottom) || 0) : 0;
|
|
956
|
-
let childrenBottom = 0;
|
|
957
|
-
const rootTop = scrollContent.getBoundingClientRect().top;
|
|
958
|
-
for (const child of scrollContent.children) {
|
|
959
|
-
const rect = child.getBoundingClientRect();
|
|
960
|
-
const marginBottom = Number.parseFloat(scrollContent.ownerDocument.defaultView?.getComputedStyle(child).marginBottom || "0") || 0;
|
|
961
|
-
childrenBottom = Math.max(childrenBottom, rect.bottom + marginBottom - rootTop);
|
|
962
|
-
}
|
|
963
|
-
return Math.ceil(Math.max(scrollContent.scrollHeight + margins, scrollContent.offsetHeight + margins, childrenBottom + margins));
|
|
964
|
-
};
|
|
965
|
-
const isEmptyPreviewApp = (iframeDocument) => {
|
|
966
|
-
const app = iframeDocument.getElementById("app");
|
|
967
|
-
return !!app && app.childElementCount === 0;
|
|
968
|
-
};
|
|
969
|
-
const measure = () => {
|
|
970
|
-
frameId = 0;
|
|
971
|
-
if (!iframe) return;
|
|
972
|
-
try {
|
|
973
|
-
const iframeWindow = iframe.contentWindow;
|
|
974
|
-
const iframeDocument = iframe.contentDocument;
|
|
975
|
-
if (!iframeWindow || !iframeDocument?.body) return;
|
|
976
|
-
const scrollContent = resolveScrollContent(iframeDocument);
|
|
977
|
-
if (!scrollContent && isEmptyPreviewApp(iframeDocument)) return;
|
|
978
|
-
const contentHeight = scrollContent ? measureScrollContent(scrollContent) : measureDocumentContent(iframeWindow, iframeDocument);
|
|
979
|
-
const nextHeight = Math.max(contentHeight, 24);
|
|
980
|
-
if (height.value !== nextHeight) height.value = nextHeight;
|
|
981
|
-
} catch {
|
|
982
|
-
if (height.value !== 24) height.value = 24;
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
const scheduleMeasure = () => {
|
|
986
|
-
if (frameId) return;
|
|
987
|
-
frameId = requestAnimationFrame(measure);
|
|
988
|
-
};
|
|
989
|
-
const disconnectContent = () => {
|
|
990
|
-
contentObserver?.disconnect();
|
|
991
|
-
contentObserver = null;
|
|
992
|
-
scrollMountObserver?.disconnect();
|
|
993
|
-
scrollMountObserver = null;
|
|
994
|
-
observedScrollNode = null;
|
|
995
|
-
cancelMeasure();
|
|
996
|
-
};
|
|
997
|
-
const observeContent = () => {
|
|
998
|
-
disconnectContent();
|
|
999
|
-
if (!iframe) return;
|
|
1000
|
-
try {
|
|
1001
|
-
const iframeWindow = iframe.contentWindow;
|
|
1002
|
-
const iframeDocument = iframe.contentDocument;
|
|
1003
|
-
const Observer = iframeWindow?.ResizeObserver;
|
|
1004
|
-
if (!iframeWindow || !iframeDocument?.body || !Observer) {
|
|
1005
|
-
scheduleMeasure();
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
const observer = new Observer(scheduleMeasure);
|
|
1009
|
-
observer.observe(iframeDocument.documentElement);
|
|
1010
|
-
observer.observe(iframeDocument.body);
|
|
1011
|
-
contentObserver = observer;
|
|
1012
|
-
const attachScrollContent = (node) => {
|
|
1013
|
-
if (!node || !contentObserver) return false;
|
|
1014
|
-
if (observedScrollNode === node) return true;
|
|
1015
|
-
if (observedScrollNode) contentObserver.unobserve(observedScrollNode);
|
|
1016
|
-
observedScrollNode = node;
|
|
1017
|
-
contentObserver.observe(node);
|
|
1018
|
-
return true;
|
|
1019
|
-
};
|
|
1020
|
-
const syncScrollContent = () => {
|
|
1021
|
-
attachScrollContent(resolveScrollContent(iframeDocument));
|
|
1022
|
-
scheduleMeasure();
|
|
1023
|
-
};
|
|
1024
|
-
scrollMountObserver = new MutationObserver(syncScrollContent);
|
|
1025
|
-
scrollMountObserver.observe(iframeDocument.documentElement, {
|
|
1026
|
-
attributes: true,
|
|
1027
|
-
attributeFilter: ["class"]
|
|
1028
|
-
});
|
|
1029
|
-
scrollMountObserver.observe(iframeDocument.body, {
|
|
1030
|
-
childList: true,
|
|
1031
|
-
subtree: true
|
|
1032
|
-
});
|
|
1033
|
-
syncScrollContent();
|
|
1034
|
-
} catch {
|
|
1035
|
-
if (height.value !== 24) height.value = 24;
|
|
1036
|
-
}
|
|
1037
|
-
};
|
|
1038
|
-
const handleIframeLoad = () => observeContent();
|
|
1039
|
-
const setIframe = (nextIframe) => {
|
|
1040
|
-
if (iframe === nextIframe) return;
|
|
1041
|
-
iframe?.removeEventListener("load", handleIframeLoad);
|
|
1042
|
-
disconnectContent();
|
|
1043
|
-
iframe = nextIframe;
|
|
1044
|
-
if (!iframe) {
|
|
1045
|
-
height.value = 24;
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
iframe.addEventListener("load", handleIframeLoad);
|
|
1049
|
-
iframe.style.height = "100%";
|
|
1050
|
-
observeContent();
|
|
1051
|
-
};
|
|
1052
|
-
const syncIframe = () => setIframe(container?.querySelector("iframe") || null);
|
|
1053
|
-
const setContainer = (nextContainer) => {
|
|
1054
|
-
if (container === nextContainer) return;
|
|
1055
|
-
containerObserver?.disconnect();
|
|
1056
|
-
containerObserver = null;
|
|
1057
|
-
container = nextContainer;
|
|
1058
|
-
setIframe(null);
|
|
1059
|
-
if (!container) return;
|
|
1060
|
-
containerObserver = new MutationObserver(syncIframe);
|
|
1061
|
-
containerObserver.observe(container, {
|
|
1062
|
-
childList: true,
|
|
1063
|
-
subtree: true
|
|
1064
|
-
});
|
|
1065
|
-
syncIframe();
|
|
1066
|
-
};
|
|
1067
|
-
(0, vue.watch)(() => resolveSandboxContainer(sandboxRef.value), setContainer, {
|
|
1068
|
-
flush: "post",
|
|
1069
|
-
immediate: true
|
|
1070
|
-
});
|
|
1071
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
1072
|
-
setContainer(null);
|
|
1073
|
-
cancelMeasure();
|
|
1074
|
-
});
|
|
1075
|
-
return height;
|
|
1076
|
-
};
|
|
1077
839
|
var resolvePreviewBoxHeight = (contentHeight, verticalInset = 0, borderWidth = 1) => {
|
|
1078
840
|
const content = Number.isFinite(contentHeight) ? Math.max(0, contentHeight) : 0;
|
|
1079
841
|
const inset = Number.isFinite(verticalInset) ? Math.max(0, verticalInset) : 0;
|
|
@@ -1152,68 +914,6 @@ var scrollPlaygroundToViewportStart = (el) => {
|
|
|
1152
914
|
});
|
|
1153
915
|
};
|
|
1154
916
|
//#endregion
|
|
1155
|
-
//#region packages/playground/src/core/runtime/error-guard.ts
|
|
1156
|
-
var UNKNOWN_RUNTIME_ERROR = "运行时发生未知错误";
|
|
1157
|
-
var MODULE_SPECIFIER_RE = /Failed to resolve module specifier|Error resolving module specifier/u;
|
|
1158
|
-
var forwardSandboxRuntimeError = (event) => {
|
|
1159
|
-
if (!(event instanceof ErrorEvent) || event.error != null || !event.message) return;
|
|
1160
|
-
event.stopImmediatePropagation();
|
|
1161
|
-
if (event.message === "ResizeObserver loop limit exceeded" || event.message === "ResizeObserver loop completed with undelivered notifications.") return;
|
|
1162
|
-
window.parent.postMessage({
|
|
1163
|
-
action: "error",
|
|
1164
|
-
value: event.message
|
|
1165
|
-
}, "*");
|
|
1166
|
-
};
|
|
1167
|
-
var SANDBOX_RUNTIME_ERROR_CAPTURE_HTML = [
|
|
1168
|
-
"<script>",
|
|
1169
|
-
`window.addEventListener('error', ${forwardSandboxRuntimeError.toString()}, true);`,
|
|
1170
|
-
"<\/script>"
|
|
1171
|
-
].join("\n");
|
|
1172
|
-
var toRuntimeErrorMessage = (value, message) => {
|
|
1173
|
-
if (typeof value === "string" && value) return value;
|
|
1174
|
-
if (value instanceof Error && value.message) return value.message;
|
|
1175
|
-
if (value && typeof value === "object" && "message" in value) {
|
|
1176
|
-
const valueMessage = value.message;
|
|
1177
|
-
if (typeof valueMessage === "string" && valueMessage) return valueMessage;
|
|
1178
|
-
}
|
|
1179
|
-
if (typeof message === "string" && message) return message;
|
|
1180
|
-
if (value !== null && value !== void 0) try {
|
|
1181
|
-
return String(value);
|
|
1182
|
-
} catch {
|
|
1183
|
-
return UNKNOWN_RUNTIME_ERROR;
|
|
1184
|
-
}
|
|
1185
|
-
return UNKNOWN_RUNTIME_ERROR;
|
|
1186
|
-
};
|
|
1187
|
-
var normalizeRuntimeErrorMessage = (data) => {
|
|
1188
|
-
if (!data || typeof data !== "object") return false;
|
|
1189
|
-
const message = data;
|
|
1190
|
-
if (message.action !== "error") return false;
|
|
1191
|
-
message.value = toRuntimeErrorMessage(message.value, message.message);
|
|
1192
|
-
return true;
|
|
1193
|
-
};
|
|
1194
|
-
var toErrorText = (value) => {
|
|
1195
|
-
if (typeof value === "string" && value) return value;
|
|
1196
|
-
if (value instanceof Error && value.message) return value.message;
|
|
1197
|
-
return "";
|
|
1198
|
-
};
|
|
1199
|
-
var formatSandboxRuntimeError = (message, importMapTip) => {
|
|
1200
|
-
if (!MODULE_SPECIFIER_RE.test(message)) return message;
|
|
1201
|
-
return `${message.replace(/\. Relative references must.*$/u, "").replace(/\.$/u, "")}.\n${importMapTip}`;
|
|
1202
|
-
};
|
|
1203
|
-
var useSandboxRuntimeErrorGuard = (sandboxRef) => {
|
|
1204
|
-
const error = (0, vue.ref)("");
|
|
1205
|
-
if (typeof window === "undefined") return error;
|
|
1206
|
-
const handleMessage = (event) => {
|
|
1207
|
-
const iframe = resolveSandboxContainer(sandboxRef.value)?.querySelector("iframe");
|
|
1208
|
-
if (!iframe || event.source !== iframe.contentWindow) return;
|
|
1209
|
-
if (!normalizeRuntimeErrorMessage(event.data)) return;
|
|
1210
|
-
error.value = event.data.value;
|
|
1211
|
-
};
|
|
1212
|
-
window.addEventListener("message", handleMessage, true);
|
|
1213
|
-
(0, vue.onBeforeUnmount)(() => window.removeEventListener("message", handleMessage, true));
|
|
1214
|
-
return error;
|
|
1215
|
-
};
|
|
1216
|
-
//#endregion
|
|
1217
917
|
//#region packages/playground/src/core/runtime/viewport.ts
|
|
1218
918
|
var DEFAULT_VIEWPORT_OPTIONS = ["auto", 375];
|
|
1219
919
|
var isValidViewport = (viewport) => {
|
|
@@ -1377,7 +1077,7 @@ var useSandboxTheme = (sandboxRef) => {
|
|
|
1377
1077
|
}
|
|
1378
1078
|
syncIframe();
|
|
1379
1079
|
};
|
|
1380
|
-
(0, vue.watch)(() => resolveSandboxContainer(sandboxRef.value), setContainer, {
|
|
1080
|
+
(0, vue.watch)(() => require_store.resolveSandboxContainer(sandboxRef.value), setContainer, {
|
|
1381
1081
|
flush: "post",
|
|
1382
1082
|
immediate: true
|
|
1383
1083
|
});
|
|
@@ -1396,6 +1096,73 @@ var useSandboxTheme = (sandboxRef) => {
|
|
|
1396
1096
|
});
|
|
1397
1097
|
};
|
|
1398
1098
|
//#endregion
|
|
1099
|
+
//#region packages/playground/src/core/runtime/height-bridge.ts
|
|
1100
|
+
/**
|
|
1101
|
+
* 只接收本宿主当前 iframe 的高度请求,应用重评时切换会话。
|
|
1102
|
+
* @param sandbox 预览容器。
|
|
1103
|
+
* @param maxHeight 当前可用高度,普通预览默认不限制。
|
|
1104
|
+
* @returns 所有有效请求的最大高度。
|
|
1105
|
+
*/
|
|
1106
|
+
function usePreviewHeightBridge(sandbox, maxHeight = () => Infinity) {
|
|
1107
|
+
const height = (0, vue.ref)(0);
|
|
1108
|
+
const requests = /* @__PURE__ */ new Map();
|
|
1109
|
+
let source = null;
|
|
1110
|
+
let session = "";
|
|
1111
|
+
let disposed = false;
|
|
1112
|
+
const sync = () => {
|
|
1113
|
+
height.value = Math.max(0, ...requests.values());
|
|
1114
|
+
};
|
|
1115
|
+
const reset = () => {
|
|
1116
|
+
requests.clear();
|
|
1117
|
+
session = "";
|
|
1118
|
+
source = null;
|
|
1119
|
+
sync();
|
|
1120
|
+
};
|
|
1121
|
+
const handleMessage = async (event) => {
|
|
1122
|
+
const current = require_store.resolveSandboxMessageSource(sandbox.value);
|
|
1123
|
+
const data = event.data;
|
|
1124
|
+
if (!current || event.source !== current || data?.action !== "docs:height" || typeof data.session !== "string") return;
|
|
1125
|
+
if (data.operation === "start") {
|
|
1126
|
+
reset();
|
|
1127
|
+
source = current;
|
|
1128
|
+
session = data.session;
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (source !== current || session !== data.session) return;
|
|
1132
|
+
if (data.operation === "stop") {
|
|
1133
|
+
reset();
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (!Number.isSafeInteger(data.id) || data.id <= 0) return;
|
|
1137
|
+
if (data.operation === "release") {
|
|
1138
|
+
requests.delete(data.id);
|
|
1139
|
+
sync();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (data.operation !== "enable" || !Number.isFinite(data.height) || data.height <= 0) return;
|
|
1143
|
+
const accepted = data.height <= maxHeight();
|
|
1144
|
+
if (accepted) requests.set(data.id, data.height);
|
|
1145
|
+
sync();
|
|
1146
|
+
const receiver = source;
|
|
1147
|
+
await (0, vue.nextTick)();
|
|
1148
|
+
if (disposed || source !== receiver || session !== data.session) return;
|
|
1149
|
+
receiver?.postMessage({
|
|
1150
|
+
action: "docs:height:applied",
|
|
1151
|
+
session,
|
|
1152
|
+
id: data.id,
|
|
1153
|
+
accepted
|
|
1154
|
+
}, "*");
|
|
1155
|
+
};
|
|
1156
|
+
(0, vue.watch)(() => require_store.resolveSandboxMessageSource(sandbox.value), reset, { flush: "sync" });
|
|
1157
|
+
if (typeof window !== "undefined") window.addEventListener("message", handleMessage);
|
|
1158
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
1159
|
+
disposed = true;
|
|
1160
|
+
if (typeof window !== "undefined") window.removeEventListener("message", handleMessage);
|
|
1161
|
+
reset();
|
|
1162
|
+
});
|
|
1163
|
+
return height;
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1399
1166
|
//#region packages/playground/src/core/runtime/toolbar.vue?vue&type=script&setup=true&lang.ts
|
|
1400
1167
|
var _hoisted_1$3 = { class: "docs-playground__tools" };
|
|
1401
1168
|
var _hoisted_2$3 = {
|
|
@@ -1612,426 +1379,6 @@ var toolbar_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
1612
1379
|
}
|
|
1613
1380
|
});
|
|
1614
1381
|
//#endregion
|
|
1615
|
-
//#region packages/playground/src/cdn.ts
|
|
1616
|
-
var PREVIEW_STYLE_ASSETS = [
|
|
1617
|
-
"@deot/style/dist/index.normalize-only.css",
|
|
1618
|
-
"@deot/vc-components/dist/index.style.css",
|
|
1619
|
-
"@deot/style/dist/index.css"
|
|
1620
|
-
];
|
|
1621
|
-
var BUILTIN_IMPORT_ASSETS = {
|
|
1622
|
-
"@deot/vc": "@deot/vc/dist/index.js",
|
|
1623
|
-
"@deot/vc-shared": "@deot/vc-shared/dist/index.js",
|
|
1624
|
-
"@deot/vc-hooks": "@deot/vc-hooks/dist/index.js",
|
|
1625
|
-
"@deot/vc-components": "@deot/vc-components/dist/index.js",
|
|
1626
|
-
"@deot/helper-resize": "@deot/helper-resize/dist/index.js",
|
|
1627
|
-
"@deot/helper-utils": "@deot/helper-utils/dist/index.js",
|
|
1628
|
-
"@deot/helper-cache": "@deot/helper-cache/dist/index.js",
|
|
1629
|
-
"@deot/helper-fp": "@deot/helper-fp/dist/index.js",
|
|
1630
|
-
"@deot/helper-dom": "@deot/helper-dom/dist/index.js",
|
|
1631
|
-
"@deot/helper-wheel": "@deot/helper-wheel/dist/index.js",
|
|
1632
|
-
"@deot/helper-validator": "@deot/helper-validator/dist/index.js",
|
|
1633
|
-
"@deot/helper-load": "@deot/helper-load/dist/index.js",
|
|
1634
|
-
"@deot/helper-scheduler": "@deot/helper-scheduler/dist/index.js",
|
|
1635
|
-
"@deot/helper-emitter": "@deot/helper-emitter/dist/index.js",
|
|
1636
|
-
"@deot/helper-is": "@deot/helper-is/dist/index.js",
|
|
1637
|
-
"@deot/helper-device": "@deot/helper-device/dist/index.js",
|
|
1638
|
-
"@deot/helper-route": "@deot/helper-route/dist/index.js",
|
|
1639
|
-
"@deot/helper-unicode": "@deot/helper-unicode/dist/index.js",
|
|
1640
|
-
"@deot/helper": "@deot/helper/dist/index.js",
|
|
1641
|
-
"normalize-wheel": "normalize-wheel-es/dist/index.mjs",
|
|
1642
|
-
"photoswipe": "photoswipe/dist/photoswipe.esm.js",
|
|
1643
|
-
"photoswipe/lightbox": "photoswipe/dist/photoswipe-lightbox.esm.js"
|
|
1644
|
-
};
|
|
1645
|
-
var normalizeCdnURL = (cdnURL = DEFAULT_CDN_URL) => {
|
|
1646
|
-
return cdnURL.trim().replace(/\/+$/u, "") || "https://cdn.jsdelivr.net/npm";
|
|
1647
|
-
};
|
|
1648
|
-
var cdnJoin = (origin, asset) => `${origin}/${asset.replace(/^\/+/u, "")}`;
|
|
1649
|
-
var jsdelivrEsmURL = (asset) => cdnJoin(DEFAULT_CDN_URL, asset);
|
|
1650
|
-
var SASS_CDN_URL = jsdelivrEsmURL("sass/+esm");
|
|
1651
|
-
var cdnAsset = (cdnURL, asset) => cdnJoin(normalizeCdnURL(cdnURL), asset);
|
|
1652
|
-
var createBuiltinImports = (cdnURL = DEFAULT_CDN_URL) => ({
|
|
1653
|
-
...Object.fromEntries(Object.entries(BUILTIN_IMPORT_ASSETS).map(([specifier, asset]) => [specifier, cdnAsset(cdnURL, asset)])),
|
|
1654
|
-
"lodash-es": jsdelivrEsmURL("lodash-es/+esm"),
|
|
1655
|
-
"vue": "https://play.vuejs.org/vue.runtime.esm-browser.js",
|
|
1656
|
-
"vue/server-renderer": "https://play.vuejs.org/server-renderer.esm-browser.js"
|
|
1657
|
-
});
|
|
1658
|
-
var createBuiltinStyles = (cdnURL = DEFAULT_CDN_URL) => Object.fromEntries(PREVIEW_STYLE_ASSETS.map((asset) => [asset, cdnAsset(cdnURL, asset)]));
|
|
1659
|
-
//#endregion
|
|
1660
|
-
//#region packages/playground/src/import-map.ts
|
|
1661
|
-
/**
|
|
1662
|
-
* 站点级同步内存:`$docs.modules` / `$docs.styles` 与管理页 import、CSS 覆盖。
|
|
1663
|
-
*/
|
|
1664
|
-
var normalize = (value) => value.trim();
|
|
1665
|
-
var isSafePlaygroundHref = (href) => {
|
|
1666
|
-
const next = href.trim();
|
|
1667
|
-
if (!next) return false;
|
|
1668
|
-
if (/^https?:\/\//iu.test(next)) return true;
|
|
1669
|
-
return next.startsWith("/") && !next.startsWith("//");
|
|
1670
|
-
};
|
|
1671
|
-
var filterSafeHrefs = (value = {}) => Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string" && isSafePlaygroundHref(entry[1])));
|
|
1672
|
-
var sanitizeMap = (value = {}) => filterSafeHrefs(Object.fromEntries(Object.entries(value).map(([alias, url]) => [normalize(alias), normalize(url)]).filter(([alias]) => Boolean(alias))));
|
|
1673
|
-
var createMapStore = () => {
|
|
1674
|
-
let data = {};
|
|
1675
|
-
const snapshot = () => ({ ...data });
|
|
1676
|
-
const drop = (alias) => {
|
|
1677
|
-
if (data[alias] === void 0) return snapshot();
|
|
1678
|
-
const next = { ...data };
|
|
1679
|
-
delete next[alias];
|
|
1680
|
-
data = next;
|
|
1681
|
-
return snapshot();
|
|
1682
|
-
};
|
|
1683
|
-
return {
|
|
1684
|
-
get: snapshot,
|
|
1685
|
-
set: (value = {}) => {
|
|
1686
|
-
data = sanitizeMap(value);
|
|
1687
|
-
},
|
|
1688
|
-
apply: (alias, url) => {
|
|
1689
|
-
const nextAlias = normalize(alias);
|
|
1690
|
-
const nextUrl = normalize(url);
|
|
1691
|
-
if (!nextAlias) return snapshot();
|
|
1692
|
-
if (!isSafePlaygroundHref(nextUrl)) return drop(nextAlias);
|
|
1693
|
-
data = {
|
|
1694
|
-
...data,
|
|
1695
|
-
[nextAlias]: nextUrl
|
|
1696
|
-
};
|
|
1697
|
-
return snapshot();
|
|
1698
|
-
},
|
|
1699
|
-
remove: (alias) => {
|
|
1700
|
-
const nextAlias = normalize(alias);
|
|
1701
|
-
return nextAlias ? drop(nextAlias) : snapshot();
|
|
1702
|
-
}
|
|
1703
|
-
};
|
|
1704
|
-
};
|
|
1705
|
-
var siteModules = createMapStore();
|
|
1706
|
-
var siteStyles = createMapStore();
|
|
1707
|
-
var importOverrides = createMapStore();
|
|
1708
|
-
var styleOverrides = createMapStore();
|
|
1709
|
-
/**
|
|
1710
|
-
* 站点默认 import。合并时夹在内置 CDN 与实例 `builtinImportMap` 之间。
|
|
1711
|
-
*/
|
|
1712
|
-
var getPlaygroundSiteModules = siteModules.get;
|
|
1713
|
-
var setPlaygroundSiteModules = siteModules.set;
|
|
1714
|
-
/**
|
|
1715
|
-
* 站点默认预览 CSS。合并时夹在内置样式表与管理页覆盖之间。
|
|
1716
|
-
*/
|
|
1717
|
-
var getPlaygroundSiteStyles = siteStyles.get;
|
|
1718
|
-
var setPlaygroundSiteStyles = siteStyles.set;
|
|
1719
|
-
var getPlaygroundImportMapOverrides = importOverrides.get;
|
|
1720
|
-
var setPlaygroundImportMapOverrides = importOverrides.set;
|
|
1721
|
-
var applyPlaygroundImportMapOverride = importOverrides.apply;
|
|
1722
|
-
var removePlaygroundImportMapOverride = importOverrides.remove;
|
|
1723
|
-
var getPlaygroundStyleOverrides = styleOverrides.get;
|
|
1724
|
-
var setPlaygroundStyleOverrides = styleOverrides.set;
|
|
1725
|
-
var applyPlaygroundStyleOverride = styleOverrides.apply;
|
|
1726
|
-
var removePlaygroundStyleOverride = styleOverrides.remove;
|
|
1727
|
-
var clearPlaygroundMaps = () => {
|
|
1728
|
-
[
|
|
1729
|
-
siteModules,
|
|
1730
|
-
siteStyles,
|
|
1731
|
-
importOverrides,
|
|
1732
|
-
styleOverrides
|
|
1733
|
-
].forEach((store) => store.set());
|
|
1734
|
-
};
|
|
1735
|
-
//#endregion
|
|
1736
|
-
//#region packages/playground/src/core/scss.ts
|
|
1737
|
-
var SCHEME = "docs-playground";
|
|
1738
|
-
var STYLE_EXTS = [".scss", ".sass"];
|
|
1739
|
-
var VUE_SCSS_STYLE_RE = /<style\b[^>]*\blang\s*=\s*(['"]?)s[ac]ss\1/i;
|
|
1740
|
-
var LANG_ATTR_RE = /\s*lang\s*=\s*(['"]?)s[ac]ss\1/i;
|
|
1741
|
-
var SCSS_ERROR_MARK = "[playground-sass]";
|
|
1742
|
-
var INJECT_START = "/* docs-playground-scss-start */";
|
|
1743
|
-
var INJECT_END = "/* docs-playground-scss-end */";
|
|
1744
|
-
var EMPTY_JS = "export default {}\n";
|
|
1745
|
-
var boundStores = /* @__PURE__ */ new WeakSet();
|
|
1746
|
-
var wrappedCompilers = /* @__PURE__ */ new WeakSet();
|
|
1747
|
-
var testLoader;
|
|
1748
|
-
var loadedSass;
|
|
1749
|
-
var loadPromise;
|
|
1750
|
-
var fileCode = (value) => typeof value === "string" ? value : value.code;
|
|
1751
|
-
var playgroundPath = (url) => decodeURIComponent(url.pathname.replace(/^\/+/u, ""));
|
|
1752
|
-
var toPlaygroundUrl = (filename) => new URL(`${SCHEME}:///${filename.replace(/^\/+/u, "")}`);
|
|
1753
|
-
var basename = (path) => path.split("/").pop() || path;
|
|
1754
|
-
var scssSyntax = (filename, lang) => lang === "sass" || /\.sass$/i.test(filename) ? "indented" : "scss";
|
|
1755
|
-
var errorText = (item) => item instanceof Error ? item.message : String(item);
|
|
1756
|
-
var isScssFile = (filename) => /\.s[ac]ss$/i.test(filename);
|
|
1757
|
-
var vueSourceNeedsScss = (source) => VUE_SCSS_STYLE_RE.test(source);
|
|
1758
|
-
var resolveSassModule = async (url) => {
|
|
1759
|
-
const mod = await import(
|
|
1760
|
-
/* @vite-ignore */
|
|
1761
|
-
url
|
|
1762
|
-
);
|
|
1763
|
-
const sass = typeof mod.compileString === "function" ? mod : mod.default;
|
|
1764
|
-
if (typeof sass?.compileString !== "function") throw new Error(`Sass module at ${url} does not export compileString`);
|
|
1765
|
-
return sass;
|
|
1766
|
-
};
|
|
1767
|
-
var loadSass = () => {
|
|
1768
|
-
loadPromise ??= (testLoader ?? (() => resolveSassModule(SASS_CDN_URL)))().then((sass) => {
|
|
1769
|
-
loadedSass = sass;
|
|
1770
|
-
return sass;
|
|
1771
|
-
});
|
|
1772
|
-
return loadPromise;
|
|
1773
|
-
};
|
|
1774
|
-
var isScssPartial = (filename) => isScssFile(filename) && basename(filename).startsWith("_");
|
|
1775
|
-
var filesNeedScss = (files) => Object.entries(files).some(([filename, value]) => isScssFile(filename) || /\.vue$/i.test(filename) && vueSourceNeedsScss(fileCode(value)));
|
|
1776
|
-
var whenSassReady = (files, run) => {
|
|
1777
|
-
if (!filesNeedScss(files) || loadedSass) run();
|
|
1778
|
-
else loadSass().then(run);
|
|
1779
|
-
};
|
|
1780
|
-
var toPlaygroundFileMap = (files) => Object.fromEntries(Object.entries(files).map(([filename, value]) => [filename, fileCode(value)]));
|
|
1781
|
-
var formatScssError = (filename, message) => `${SCSS_ERROR_MARK} ${filename}: ${message}`;
|
|
1782
|
-
var scssFail = (filename, error) => formatScssError(filename, errorText(error));
|
|
1783
|
-
var withUnderscore = (path) => {
|
|
1784
|
-
const base = basename(path);
|
|
1785
|
-
if (base.startsWith("_")) return path;
|
|
1786
|
-
return `${path.slice(0, -base.length)}_${base}`;
|
|
1787
|
-
};
|
|
1788
|
-
var matchFileKey = (files, path) => [
|
|
1789
|
-
path,
|
|
1790
|
-
path.startsWith("src/") ? path : `src/${path}`,
|
|
1791
|
-
path.replace(/^src\//u, "")
|
|
1792
|
-
].find((key) => files[key] !== void 0);
|
|
1793
|
-
var stylesheetCandidates = (requestPath) => {
|
|
1794
|
-
if (isScssFile(requestPath)) return [requestPath, withUnderscore(requestPath)];
|
|
1795
|
-
return STYLE_EXTS.flatMap((ext) => [
|
|
1796
|
-
`${requestPath}${ext}`,
|
|
1797
|
-
withUnderscore(`${requestPath}${ext}`),
|
|
1798
|
-
`${requestPath}/index${ext}`,
|
|
1799
|
-
withUnderscore(`${requestPath}/index${ext}`)
|
|
1800
|
-
]);
|
|
1801
|
-
};
|
|
1802
|
-
var resolvePlaygroundStylesheet = (files, requestPath) => {
|
|
1803
|
-
const found = [...new Set(stylesheetCandidates(requestPath).map((path) => matchFileKey(files, path)).filter((key) => Boolean(key)))];
|
|
1804
|
-
if (found.length > 1) throw new Error(`Ambiguous Sass import "${requestPath}": ${found.join(", ")}`);
|
|
1805
|
-
return found[0] ?? null;
|
|
1806
|
-
};
|
|
1807
|
-
var createPlaygroundImporter = (getFiles) => ({
|
|
1808
|
-
canonicalize(url, context) {
|
|
1809
|
-
if (/^[a-zA-Z][\w+.-]*:/u.test(url) && !url.startsWith(`${SCHEME}:`)) return null;
|
|
1810
|
-
try {
|
|
1811
|
-
const resolved = resolvePlaygroundStylesheet(getFiles(), playgroundPath(new URL(url, context.containingUrl ?? toPlaygroundUrl(""))));
|
|
1812
|
-
return resolved ? toPlaygroundUrl(resolved) : null;
|
|
1813
|
-
} catch {
|
|
1814
|
-
return null;
|
|
1815
|
-
}
|
|
1816
|
-
},
|
|
1817
|
-
load(canonicalUrl) {
|
|
1818
|
-
const files = getFiles();
|
|
1819
|
-
const key = playgroundPath(canonicalUrl);
|
|
1820
|
-
return files[key] === void 0 ? null : {
|
|
1821
|
-
contents: files[key],
|
|
1822
|
-
syntax: scssSyntax(key)
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
});
|
|
1826
|
-
var compileScssSource = (source, filename, sass, files, lang) => {
|
|
1827
|
-
const importer = createPlaygroundImporter(() => files);
|
|
1828
|
-
return sass.compileString(source, {
|
|
1829
|
-
syntax: scssSyntax(filename, lang),
|
|
1830
|
-
url: toPlaygroundUrl(filename),
|
|
1831
|
-
importer,
|
|
1832
|
-
importers: [importer]
|
|
1833
|
-
}).css;
|
|
1834
|
-
};
|
|
1835
|
-
var rewriteVueSfcStyles = (source, filename, parse, sass, files) => {
|
|
1836
|
-
const scssStyles = parse(source, { filename }).descriptor.styles.filter((style) => style.lang === "scss" || style.lang === "sass");
|
|
1837
|
-
if (!scssStyles.length) return {
|
|
1838
|
-
code: source,
|
|
1839
|
-
errors: []
|
|
1840
|
-
};
|
|
1841
|
-
const errors = [];
|
|
1842
|
-
let code = source;
|
|
1843
|
-
for (const style of [...scssStyles].sort((left, right) => right.loc.start.offset - left.loc.start.offset)) {
|
|
1844
|
-
const before = code.slice(0, style.loc.start.offset);
|
|
1845
|
-
const after = code.slice(style.loc.end.offset);
|
|
1846
|
-
const openStart = before.lastIndexOf("<style");
|
|
1847
|
-
if (openStart < 0) {
|
|
1848
|
-
errors.push(formatScssError(filename, "unable to locate <style> opening tag"));
|
|
1849
|
-
continue;
|
|
1850
|
-
}
|
|
1851
|
-
try {
|
|
1852
|
-
const css = compileScssSource(style.content, filename, sass, files, style.lang);
|
|
1853
|
-
code = `${before.slice(0, openStart)}${before.slice(openStart).replace(LANG_ATTR_RE, "")}${css}${after}`;
|
|
1854
|
-
} catch (error) {
|
|
1855
|
-
errors.push(scssFail(filename, error));
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
return {
|
|
1859
|
-
code,
|
|
1860
|
-
errors
|
|
1861
|
-
};
|
|
1862
|
-
};
|
|
1863
|
-
var appendParseErrors = (result, errors) => errors.length ? {
|
|
1864
|
-
...result,
|
|
1865
|
-
errors: [...result.errors, ...errors.map((item) => new Error(item))]
|
|
1866
|
-
} : result;
|
|
1867
|
-
var wrapCompiler = (compiler, getFiles) => {
|
|
1868
|
-
if (wrappedCompilers.has(compiler)) return compiler;
|
|
1869
|
-
const originalParse = compiler.parse.bind(compiler);
|
|
1870
|
-
const wrapped = { ...compiler };
|
|
1871
|
-
wrapped.parse = ((source, options) => {
|
|
1872
|
-
const filename = options?.filename || "anonymous.vue";
|
|
1873
|
-
if (!vueSourceNeedsScss(source)) return originalParse(source, options);
|
|
1874
|
-
const rewritten = loadedSass ? rewriteVueSfcStyles(source, filename, originalParse, loadedSass, getFiles()) : {
|
|
1875
|
-
code: source,
|
|
1876
|
-
errors: [formatScssError(filename, "compiler is not loaded")]
|
|
1877
|
-
};
|
|
1878
|
-
return appendParseErrors(originalParse(rewritten.errors.length ? source : rewritten.code, options), rewritten.errors);
|
|
1879
|
-
});
|
|
1880
|
-
wrappedCompilers.add(wrapped);
|
|
1881
|
-
return wrapped;
|
|
1882
|
-
};
|
|
1883
|
-
var withInjectedCss = (css, extra) => {
|
|
1884
|
-
const start = css.indexOf(INJECT_START);
|
|
1885
|
-
const end = start < 0 ? -1 : css.indexOf(INJECT_END, start);
|
|
1886
|
-
const base = (start < 0 ? css : `${css.slice(0, start)}${end >= 0 ? css.slice(end + 30) : ""}`).trimEnd();
|
|
1887
|
-
if (!extra.trim()) return base;
|
|
1888
|
-
const block = `${INJECT_START}\n${extra.trim()}\n${INJECT_END}`;
|
|
1889
|
-
return base ? `${base}\n${block}` : block;
|
|
1890
|
-
};
|
|
1891
|
-
var isStandaloneScssError = (item) => {
|
|
1892
|
-
const text = errorText(item);
|
|
1893
|
-
return text.startsWith(SCSS_ERROR_MARK) && /\.s[ac]ss:/i.test(text);
|
|
1894
|
-
};
|
|
1895
|
-
var syncScssErrors = (store, scssErrors) => {
|
|
1896
|
-
const next = [...scssErrors, ...store.errors.filter((item) => !isStandaloneScssError(item))];
|
|
1897
|
-
if (next.map(String).join("\0") === store.errors.map(String).join("\0")) return;
|
|
1898
|
-
store.errors = next;
|
|
1899
|
-
};
|
|
1900
|
-
var applyStandaloneScss = (store, sass = loadedSass) => {
|
|
1901
|
-
if (!sass) return [];
|
|
1902
|
-
const fileMap = toPlaygroundFileMap(store.files);
|
|
1903
|
-
const errors = [];
|
|
1904
|
-
const injected = [];
|
|
1905
|
-
for (const [filename, file] of Object.entries(store.files)) {
|
|
1906
|
-
if (!isScssFile(filename) || !file.compiled) continue;
|
|
1907
|
-
try {
|
|
1908
|
-
const css = compileScssSource(file.code, filename, sass, fileMap);
|
|
1909
|
-
file.compiled.css = css;
|
|
1910
|
-
file.compiled.js = EMPTY_JS;
|
|
1911
|
-
file.compiled.ssr = EMPTY_JS;
|
|
1912
|
-
if (!isScssPartial(filename) && css.trim()) injected.push(css);
|
|
1913
|
-
} catch (error) {
|
|
1914
|
-
errors.push(scssFail(filename, error));
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
const main = store.files[store.mainFile];
|
|
1918
|
-
if (main?.compiled) {
|
|
1919
|
-
const next = withInjectedCss(main.compiled.css || "", injected.join("\n"));
|
|
1920
|
-
if (next !== (main.compiled.css || "")) main.compiled.css = next;
|
|
1921
|
-
}
|
|
1922
|
-
syncScssErrors(store, errors);
|
|
1923
|
-
return errors;
|
|
1924
|
-
};
|
|
1925
|
-
var bindPlaygroundScss = (store) => {
|
|
1926
|
-
if (boundStores.has(store)) return;
|
|
1927
|
-
boundStores.add(store);
|
|
1928
|
-
const getFiles = () => toPlaygroundFileMap(store.files);
|
|
1929
|
-
const installCompiler = () => {
|
|
1930
|
-
if (typeof store.compiler?.parse === "function") store.compiler = wrapCompiler(store.compiler, getFiles);
|
|
1931
|
-
};
|
|
1932
|
-
installCompiler();
|
|
1933
|
-
(0, vue.watch)(() => store.compiler, installCompiler);
|
|
1934
|
-
(0, vue.watch)(() => [
|
|
1935
|
-
store.mainFile,
|
|
1936
|
-
store.files[store.mainFile]?.compiled?.css,
|
|
1937
|
-
store.errors.map(String).join("\0"),
|
|
1938
|
-
Object.entries(store.files).filter(([filename]) => isScssFile(filename)).map(([filename, file]) => `${filename}:${file.code}`).join("\n")
|
|
1939
|
-
].join("\0"), () => {
|
|
1940
|
-
if (loadedSass) applyStandaloneScss(store);
|
|
1941
|
-
});
|
|
1942
|
-
const originalSetFiles = store.setFiles.bind(store);
|
|
1943
|
-
store.setFiles = async (newFiles, mainFile) => {
|
|
1944
|
-
if (filesNeedScss(newFiles) && !loadedSass) await loadSass();
|
|
1945
|
-
return originalSetFiles(newFiles, mainFile);
|
|
1946
|
-
};
|
|
1947
|
-
};
|
|
1948
|
-
//#endregion
|
|
1949
|
-
//#region packages/playground/src/core/store.ts
|
|
1950
|
-
var DOCS_LINK_IMPORT_CODE = "import { h as __docsH } from \"vue\"";
|
|
1951
|
-
var DOCS_LINK_USE_CODE = [
|
|
1952
|
-
PREVIEW_SCROLL_RESET_CODE,
|
|
1953
|
-
"app.component(\"DocsLink\",{",
|
|
1954
|
-
"props:{to:{type:String,default:\"\"}},",
|
|
1955
|
-
"setup(props,{slots}){return()=>__docsH(\"a\",{",
|
|
1956
|
-
"href:props.to,",
|
|
1957
|
-
"style:{color:\"inherit\",textDecoration:\"none\"},",
|
|
1958
|
-
"onClick(event){event.preventDefault();window.parent.postMessage({action:\"docs:navigate\",to:props.to},\"*\")}",
|
|
1959
|
-
"},slots.default?.())}",
|
|
1960
|
-
"})"
|
|
1961
|
-
].join("");
|
|
1962
|
-
var escapeHtmlAttr = (value) => value.replace(/&/gu, "&").replace(/"/gu, """).replace(/'/gu, "'").replace(/</gu, "<").replace(/>/gu, ">");
|
|
1963
|
-
/**
|
|
1964
|
-
* runtime 画布色。`previewInset` 露出的 padding、iframe chrome 和 sandbox
|
|
1965
|
-
* `html`/`body` 必须共用这一变量,暗色下 `--docs-background-color` 与
|
|
1966
|
-
* `--vc-background-color-light` 不同,否则会出现色带割裂。
|
|
1967
|
-
*/
|
|
1968
|
-
var PLAYGROUND_RUNTIME_CANVAS_BACKGROUND = "var(--vc-background-color-light, var(--docs-background-color, #fff))";
|
|
1969
|
-
var createRuntimePreviewOptions = (cdnURL = DEFAULT_CDN_URL, options = {}) => {
|
|
1970
|
-
const previewScroller = options.previewScroller === true;
|
|
1971
|
-
const hrefs = Object.values({
|
|
1972
|
-
...createBuiltinStyles(cdnURL),
|
|
1973
|
-
...getPlaygroundSiteStyles(),
|
|
1974
|
-
...getPlaygroundStyleOverrides()
|
|
1975
|
-
});
|
|
1976
|
-
const styleBlocks = [
|
|
1977
|
-
`html,body{height:auto;min-height:0;background:${PLAYGROUND_RUNTIME_CANVAS_BACKGROUND}}`,
|
|
1978
|
-
"body{color:var(--vc-foreground-color,#080f20)}",
|
|
1979
|
-
...previewScroller ? [PREVIEW_SCROLLER_STYLE] : []
|
|
1980
|
-
];
|
|
1981
|
-
return {
|
|
1982
|
-
showRuntimeError: false,
|
|
1983
|
-
showRuntimeWarning: false,
|
|
1984
|
-
headHTML: [
|
|
1985
|
-
SANDBOX_RUNTIME_ERROR_CAPTURE_HTML,
|
|
1986
|
-
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",
|
|
1987
|
-
...hrefs.map((href) => `<link rel="stylesheet" href="${escapeHtmlAttr(href)}">`),
|
|
1988
|
-
"<style>",
|
|
1989
|
-
...styleBlocks,
|
|
1990
|
-
"</style>"
|
|
1991
|
-
].join("\n"),
|
|
1992
|
-
customCode: {
|
|
1993
|
-
importCode: DOCS_LINK_IMPORT_CODE,
|
|
1994
|
-
useCode: DOCS_LINK_USE_CODE
|
|
1995
|
-
}
|
|
1996
|
-
};
|
|
1997
|
-
};
|
|
1998
|
-
var toReplFilename = (filename) => filename.startsWith("src/") ? filename : `src/${filename}`;
|
|
1999
|
-
var createReplFile = (filename, code) => {
|
|
2000
|
-
const replFilename = toReplFilename(filename);
|
|
2001
|
-
return new _vue_repl.File(replFilename, code);
|
|
2002
|
-
};
|
|
2003
|
-
var createRuntimeStore = (files, entry, options) => {
|
|
2004
|
-
const { cdnURL, builtinImportMap, ...storeOptions } = options;
|
|
2005
|
-
const replFiles = (0, vue.ref)(Object.fromEntries(Object.entries(files).map(([filename, code]) => {
|
|
2006
|
-
const file = createReplFile(filename, code);
|
|
2007
|
-
return [file.filename, file];
|
|
2008
|
-
})));
|
|
2009
|
-
const mainFile = (0, vue.ref)(toReplFilename(entry));
|
|
2010
|
-
const activeFilename = (0, vue.ref)(toReplFilename(entry));
|
|
2011
|
-
const store = (0, _vue_repl.useStore)({
|
|
2012
|
-
...storeOptions,
|
|
2013
|
-
files: replFiles,
|
|
2014
|
-
mainFile,
|
|
2015
|
-
activeFilename,
|
|
2016
|
-
builtinImportMap: (0, vue.ref)({
|
|
2017
|
-
...builtinImportMap,
|
|
2018
|
-
imports: {
|
|
2019
|
-
...createBuiltinImports(cdnURL),
|
|
2020
|
-
...getPlaygroundSiteModules(),
|
|
2021
|
-
...filterSafeHrefs(builtinImportMap?.imports),
|
|
2022
|
-
...getPlaygroundImportMapOverrides()
|
|
2023
|
-
}
|
|
2024
|
-
}),
|
|
2025
|
-
template: (0, vue.ref)({
|
|
2026
|
-
welcomeSFC: files[entry],
|
|
2027
|
-
newSFC: NEW_SFC_CODE
|
|
2028
|
-
})
|
|
2029
|
-
});
|
|
2030
|
-
bindPlaygroundScss(store);
|
|
2031
|
-
whenSassReady(files, () => store.init());
|
|
2032
|
-
return store;
|
|
2033
|
-
};
|
|
2034
|
-
//#endregion
|
|
2035
1382
|
//#region packages/playground/src/core/runtime/alone/wrapper.vue?vue&type=script&setup=true&lang.ts
|
|
2036
1383
|
var _hoisted_1$2 = ["aria-label"];
|
|
2037
1384
|
var _hoisted_2$2 = { class: "docs-playground-popup__frame" };
|
|
@@ -2058,6 +1405,17 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2058
1405
|
clearConsole: {
|
|
2059
1406
|
type: Boolean,
|
|
2060
1407
|
default: true
|
|
1408
|
+
},
|
|
1409
|
+
local: {
|
|
1410
|
+
type: Boolean,
|
|
1411
|
+
default: true
|
|
1412
|
+
},
|
|
1413
|
+
files: { default: () => ({}) },
|
|
1414
|
+
entry: { default: "" },
|
|
1415
|
+
options: { default: () => ({}) },
|
|
1416
|
+
previewScroller: {
|
|
1417
|
+
type: Boolean,
|
|
1418
|
+
default: false
|
|
2061
1419
|
}
|
|
2062
1420
|
},
|
|
2063
1421
|
emits: [
|
|
@@ -2067,23 +1425,42 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2067
1425
|
"portal-fulfilled"
|
|
2068
1426
|
],
|
|
2069
1427
|
setup(__props, { emit: __emit }) {
|
|
1428
|
+
const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-DnkKrBhf.cjs")).then((n) => n.local_sandbox_exports));
|
|
2070
1429
|
const props = __props;
|
|
2071
1430
|
const emit = __emit;
|
|
2072
1431
|
const { t } = (0, _deot_docs_locale.useLocale)();
|
|
2073
1432
|
const currentViewport = (0, vue.ref)(props.viewport);
|
|
2074
1433
|
const sandboxRef = (0, vue.ref)(null);
|
|
1434
|
+
const localError = (0, vue.ref)({
|
|
1435
|
+
compile: "",
|
|
1436
|
+
runtime: ""
|
|
1437
|
+
});
|
|
1438
|
+
const handleLocalError = (payload) => {
|
|
1439
|
+
localError.value = payload;
|
|
1440
|
+
};
|
|
1441
|
+
const availableHeight = () => Math.max(0, getWindowInnerSize().height - 40 - 44);
|
|
1442
|
+
const temporaryHeight = usePreviewHeightBridge(sandboxRef, availableHeight);
|
|
2075
1443
|
const sandboxKey = (0, vue.ref)(0);
|
|
2076
1444
|
const layoutTick = (0, vue.ref)(0);
|
|
2077
|
-
const runtimeError = useSandboxRuntimeErrorGuard(sandboxRef);
|
|
1445
|
+
const runtimeError = require_store.useSandboxRuntimeErrorGuard(sandboxRef);
|
|
2078
1446
|
useSandboxTheme(sandboxRef);
|
|
2079
|
-
const storeErrors = (0, vue.computed)(() => (props.store
|
|
1447
|
+
const storeErrors = (0, vue.computed)(() => props.local ? localError.value.compile : (props.store?.errors || []).map(require_store.toErrorText).filter(Boolean).join("\n"));
|
|
2080
1448
|
const errorText = (0, vue.computed)(() => {
|
|
2081
|
-
const runtime = runtimeError.value ? formatSandboxRuntimeError(runtimeError.value, t("playground.runtime.importMapTip")) : "";
|
|
1449
|
+
const runtime = props.local ? localError.value.runtime : runtimeError.value ? require_store.formatSandboxRuntimeError(runtimeError.value, t("playground.runtime.importMapTip")) : "";
|
|
2082
1450
|
return [storeErrors.value, runtime].filter(Boolean).join("\n\n");
|
|
2083
1451
|
});
|
|
2084
1452
|
const layout = (0, vue.computed)(() => {
|
|
2085
1453
|
layoutTick.value;
|
|
2086
|
-
|
|
1454
|
+
const base = resolvePopupLayout(currentViewport.value);
|
|
1455
|
+
if (!temporaryHeight.value) return base;
|
|
1456
|
+
const canvasHeight = Math.min(availableHeight(), Math.max(base.canvasHeight, temporaryHeight.value));
|
|
1457
|
+
const shellHeight = Math.max(base.shellHeight, canvasHeight + 44);
|
|
1458
|
+
return {
|
|
1459
|
+
...base,
|
|
1460
|
+
canvasHeight,
|
|
1461
|
+
shellHeight,
|
|
1462
|
+
bodyHeight: shellHeight - 44
|
|
1463
|
+
};
|
|
2087
1464
|
});
|
|
2088
1465
|
const shellStyle = (0, vue.computed)(() => ({
|
|
2089
1466
|
width: `${layout.value.shellWidth}px`,
|
|
@@ -2092,10 +1469,14 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2092
1469
|
const canvasStyle = (0, vue.computed)(() => ({
|
|
2093
1470
|
width: `${layout.value.canvasWidth}px`,
|
|
2094
1471
|
height: `${layout.value.canvasHeight}px`,
|
|
2095
|
-
background: PLAYGROUND_RUNTIME_CANVAS_BACKGROUND
|
|
1472
|
+
background: require_store.PLAYGROUND_RUNTIME_CANVAS_BACKGROUND
|
|
2096
1473
|
}));
|
|
2097
1474
|
const handleRefresh = () => {
|
|
2098
1475
|
runtimeError.value = "";
|
|
1476
|
+
localError.value = {
|
|
1477
|
+
compile: "",
|
|
1478
|
+
runtime: ""
|
|
1479
|
+
};
|
|
2099
1480
|
sandboxKey.value++;
|
|
2100
1481
|
};
|
|
2101
1482
|
const handleViewportChange = (viewport) => {
|
|
@@ -2120,8 +1501,7 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2120
1501
|
layoutTick.value++;
|
|
2121
1502
|
};
|
|
2122
1503
|
const handleBridgeMessage = (event) => {
|
|
2123
|
-
|
|
2124
|
-
if (!iframe || event.source !== iframe.contentWindow) return;
|
|
1504
|
+
if (!require_store.isSandboxMessage(sandboxRef.value, event)) return;
|
|
2125
1505
|
const data = event.data;
|
|
2126
1506
|
if (!data || data.action !== "docs:navigate" || typeof data.to !== "string") return;
|
|
2127
1507
|
emit("navigate", data.to);
|
|
@@ -2183,7 +1563,23 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2183
1563
|
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
|
|
2184
1564
|
class: "docs-playground-popup__canvas",
|
|
2185
1565
|
style: (0, vue.normalizeStyle)(canvasStyle.value)
|
|
2186
|
-
}, [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(
|
|
1566
|
+
}, [__props.local ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LocalSandbox), {
|
|
1567
|
+
key: sandboxKey.value,
|
|
1568
|
+
ref_key: "sandboxRef",
|
|
1569
|
+
ref: sandboxRef,
|
|
1570
|
+
files: __props.files,
|
|
1571
|
+
entry: __props.entry,
|
|
1572
|
+
options: __props.options,
|
|
1573
|
+
"preview-scroller": __props.previewScroller,
|
|
1574
|
+
"clear-console": __props.clearConsole,
|
|
1575
|
+
onError: handleLocalError
|
|
1576
|
+
}, null, 8, [
|
|
1577
|
+
"files",
|
|
1578
|
+
"entry",
|
|
1579
|
+
"options",
|
|
1580
|
+
"preview-scroller",
|
|
1581
|
+
"clear-console"
|
|
1582
|
+
])) : __props.store ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
|
|
2187
1583
|
key: sandboxKey.value,
|
|
2188
1584
|
ref_key: "sandboxRef",
|
|
2189
1585
|
ref: sandboxRef,
|
|
@@ -2195,7 +1591,7 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2195
1591
|
"store",
|
|
2196
1592
|
"clear-console",
|
|
2197
1593
|
"preview-options"
|
|
2198
|
-
]))], 4)]),
|
|
1594
|
+
])) : (0, vue.createCommentVNode)("v-if", true)], 4)]),
|
|
2199
1595
|
_: 1
|
|
2200
1596
|
})])
|
|
2201
1597
|
])], 4)], 8, _hoisted_1$2);
|
|
@@ -2263,7 +1659,11 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2263
1659
|
title: { default: "" },
|
|
2264
1660
|
id: { default: "" },
|
|
2265
1661
|
viewport: { default: "auto" },
|
|
2266
|
-
viewportOptions: { default: () => ["auto", 375] }
|
|
1662
|
+
viewportOptions: { default: () => ["auto", 375] },
|
|
1663
|
+
local: {
|
|
1664
|
+
type: Boolean,
|
|
1665
|
+
default: true
|
|
1666
|
+
}
|
|
2267
1667
|
},
|
|
2268
1668
|
emits: [
|
|
2269
1669
|
"files-change",
|
|
@@ -2272,6 +1672,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2272
1672
|
"navigate"
|
|
2273
1673
|
],
|
|
2274
1674
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1675
|
+
const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-DnkKrBhf.cjs")).then((n) => n.local_sandbox_exports));
|
|
2275
1676
|
const props = __props;
|
|
2276
1677
|
const { locale, t } = (0, _deot_docs_locale.useLocale)();
|
|
2277
1678
|
const displayTitle = (0, vue.computed)(() => props.title.trim());
|
|
@@ -2284,7 +1685,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2284
1685
|
const emit = __emit;
|
|
2285
1686
|
const joinCode = (...values) => values.filter(Boolean).join("\n");
|
|
2286
1687
|
const mergePreviewOptions = (extraHeadHTML) => {
|
|
2287
|
-
const runtimePreviewOptions = createRuntimePreviewOptions(props.options.cdnURL, { previewScroller: props.previewScroller });
|
|
1688
|
+
const runtimePreviewOptions = require_store.createRuntimePreviewOptions(props.options.cdnURL, { previewScroller: props.previewScroller });
|
|
2288
1689
|
return {
|
|
2289
1690
|
...runtimePreviewOptions,
|
|
2290
1691
|
...props.previewOptions,
|
|
@@ -2294,8 +1695,8 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2294
1695
|
extraHeadHTML
|
|
2295
1696
|
].filter(Boolean).join("\n"),
|
|
2296
1697
|
customCode: {
|
|
2297
|
-
importCode: joinCode(
|
|
2298
|
-
useCode: joinCode(runtimePreviewOptions.customCode?.useCode, props.previewOptions?.customCode?.useCode, props.previewScroller ? PREVIEW_SCROLLER_USE_CODE : void 0)
|
|
1698
|
+
importCode: joinCode(runtimePreviewOptions.customCode?.importCode, props.previewOptions?.customCode?.importCode, props.previewScroller ? require_store.PREVIEW_SCROLL_RESET_CODE : void 0, props.previewScroller ? require_store.PREVIEW_SCROLLER_IMPORT_CODE : void 0),
|
|
1699
|
+
useCode: joinCode(runtimePreviewOptions.customCode?.useCode, props.previewOptions?.customCode?.useCode, props.previewScroller ? require_store.PREVIEW_SCROLLER_USE_CODE : void 0)
|
|
2299
1700
|
}
|
|
2300
1701
|
};
|
|
2301
1702
|
};
|
|
@@ -2309,20 +1710,32 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2309
1710
|
"SSR": false
|
|
2310
1711
|
}.MODE !== "development";
|
|
2311
1712
|
const copyValue = (0, vue.computed)(() => props.files[props.entry] || "");
|
|
2312
|
-
const store = createRuntimeStore(props.files, props.entry, props.options);
|
|
1713
|
+
const store = props.local ? null : require_store.createRuntimeStore(props.files, props.entry, props.options);
|
|
2313
1714
|
const sandboxRef = (0, vue.ref)(null);
|
|
1715
|
+
const localError = (0, vue.ref)({
|
|
1716
|
+
compile: "",
|
|
1717
|
+
runtime: ""
|
|
1718
|
+
});
|
|
1719
|
+
const handleLocalError = (payload) => {
|
|
1720
|
+
localError.value = payload;
|
|
1721
|
+
};
|
|
1722
|
+
const temporaryHeight = usePreviewHeightBridge(sandboxRef);
|
|
2314
1723
|
const sandboxKey = (0, vue.ref)(0);
|
|
2315
|
-
const runtimeHeight = useSandboxAutoHeight(sandboxRef);
|
|
2316
|
-
const runtimeError = useSandboxRuntimeErrorGuard(sandboxRef);
|
|
1724
|
+
const runtimeHeight = require_store.useSandboxAutoHeight(sandboxRef);
|
|
1725
|
+
const runtimeError = require_store.useSandboxRuntimeErrorGuard(sandboxRef);
|
|
2317
1726
|
useSandboxTheme(sandboxRef);
|
|
2318
|
-
const compileErrorText = (0, vue.computed)(() =>
|
|
1727
|
+
const compileErrorText = (0, vue.computed)(() => {
|
|
1728
|
+
if (props.local) return localError.value.compile;
|
|
1729
|
+
return (store?.errors || []).map(require_store.toErrorText).filter(Boolean).join("\n");
|
|
1730
|
+
});
|
|
2319
1731
|
const errorText = (0, vue.computed)(() => {
|
|
2320
|
-
|
|
1732
|
+
let runtime = "";
|
|
1733
|
+
if (props.local) runtime = localError.value.runtime;
|
|
1734
|
+
else if (runtimeError.value) runtime = require_store.formatSandboxRuntimeError(runtimeError.value, t("playground.runtime.importMapTip"));
|
|
2321
1735
|
return [compileErrorText.value, runtime].filter(Boolean).join("\n\n");
|
|
2322
1736
|
});
|
|
2323
1737
|
const handleBridgeMessage = (event) => {
|
|
2324
|
-
|
|
2325
|
-
if (!iframe || event.source !== iframe.contentWindow) return;
|
|
1738
|
+
if (!require_store.isSandboxMessage(sandboxRef.value, event)) return;
|
|
2326
1739
|
const data = event.data;
|
|
2327
1740
|
if (!data || data.action !== "docs:navigate" || typeof data.to !== "string") return;
|
|
2328
1741
|
emit("navigate", data.to);
|
|
@@ -2355,27 +1768,33 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2355
1768
|
}) - vertical * 2 - 2);
|
|
2356
1769
|
};
|
|
2357
1770
|
const syncFrozenExpandedHeight = () => {
|
|
2358
|
-
if (!previewExpanded.value || props.expandable !== true) return;
|
|
1771
|
+
if (props.local || !previewExpanded.value || props.expandable !== true) return;
|
|
2359
1772
|
frozenExpandedHeight.value = measureExpandedPreviewHeight();
|
|
2360
1773
|
};
|
|
2361
1774
|
if (typeof window !== "undefined") {
|
|
2362
1775
|
window.addEventListener("message", handleBridgeMessage);
|
|
2363
1776
|
window.addEventListener("resize", syncFrozenExpandedHeight);
|
|
2364
1777
|
}
|
|
2365
|
-
const canExpandPreview = (0, vue.computed)(() => !props.styleless && isPlaygroundExpandable(props.expandable));
|
|
1778
|
+
const canExpandPreview = (0, vue.computed)(() => !props.local && !props.styleless && isPlaygroundExpandable(props.expandable));
|
|
2366
1779
|
const expandLabel = (0, vue.computed)(() => t(previewExpanded.value ? "playground.runtime.collapsePreview" : "playground.runtime.expandPreview"));
|
|
2367
|
-
const
|
|
1780
|
+
const baseViewportHeight = (0, vue.computed)(() => {
|
|
1781
|
+
if (props.local) {
|
|
1782
|
+
const fixedHeight = getViewportHeight(props.viewport);
|
|
1783
|
+
if (fixedHeight) return fixedHeight;
|
|
1784
|
+
return runtimeHeight.value;
|
|
1785
|
+
}
|
|
2368
1786
|
if (previewExpanded.value && props.expandable === true) return frozenExpandedHeight.value;
|
|
2369
1787
|
if (previewExpanded.value && isPlaygroundExpandable(props.expandable)) return resolveExpandedPreviewHeight(props.expandable, 0);
|
|
2370
1788
|
const fixedHeight = getViewportHeight(props.viewport);
|
|
2371
1789
|
if (fixedHeight) return fixedHeight;
|
|
2372
1790
|
return runtimeHeight.value;
|
|
2373
1791
|
});
|
|
1792
|
+
const desiredViewportHeight = (0, vue.computed)(() => Math.max(baseViewportHeight.value, temporaryHeight.value));
|
|
2374
1793
|
const scrollExpandedPreviewIntoView = () => {
|
|
2375
1794
|
scrollPlaygroundToViewportStart(runtimeRoot.value);
|
|
2376
1795
|
};
|
|
2377
1796
|
const handleTogglePreviewExpand = () => {
|
|
2378
|
-
if (!canExpandPreview.value) return;
|
|
1797
|
+
if (props.local || !canExpandPreview.value) return;
|
|
2379
1798
|
if (!previewExpanded.value) {
|
|
2380
1799
|
if (props.expandable === true) frozenExpandedHeight.value = measureExpandedPreviewHeight();
|
|
2381
1800
|
else frozenExpandedHeight.value = 0;
|
|
@@ -2397,7 +1816,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2397
1816
|
return {
|
|
2398
1817
|
height: `${resolvePreviewBoxHeight(desiredViewportHeight.value, vertical)}px`,
|
|
2399
1818
|
padding: vertical === horizontal ? `${vertical}px` : `${vertical}px ${horizontal}px`,
|
|
2400
|
-
background: PLAYGROUND_RUNTIME_CANVAS_BACKGROUND
|
|
1819
|
+
background: require_store.PLAYGROUND_RUNTIME_CANVAS_BACKGROUND
|
|
2401
1820
|
};
|
|
2402
1821
|
});
|
|
2403
1822
|
const stylelessStyle = (0, vue.computed)(() => errorText.value ? void 0 : { height: `${desiredViewportHeight.value}px` });
|
|
@@ -2415,42 +1834,50 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2415
1834
|
syncedFiles = { ...files };
|
|
2416
1835
|
syncedEntry = entry;
|
|
2417
1836
|
const apply = () => {
|
|
2418
|
-
switch (action.type) {
|
|
1837
|
+
if (store) switch (action.type) {
|
|
2419
1838
|
case "update": {
|
|
2420
|
-
const file = store.files[toReplFilename(action.filename)];
|
|
1839
|
+
const file = store.files[require_store.toReplFilename(action.filename)];
|
|
2421
1840
|
if (file) file.code = files[action.filename];
|
|
2422
1841
|
break;
|
|
2423
1842
|
}
|
|
2424
1843
|
case "create":
|
|
2425
|
-
store.addFile(createReplFile(action.filename, files[action.filename]));
|
|
1844
|
+
store.addFile(require_store.createReplFile(action.filename, files[action.filename]));
|
|
2426
1845
|
break;
|
|
2427
1846
|
case "rename":
|
|
2428
|
-
store.renameFile(toReplFilename(action.previousFilename), toReplFilename(action.filename));
|
|
1847
|
+
store.renameFile(require_store.toReplFilename(action.previousFilename), require_store.toReplFilename(action.filename));
|
|
2429
1848
|
break;
|
|
2430
1849
|
case "delete":
|
|
2431
|
-
store.setActive(toReplFilename(entry));
|
|
2432
|
-
delete store.files[toReplFilename(action.filename)];
|
|
1850
|
+
store.setActive(require_store.toReplFilename(entry));
|
|
1851
|
+
delete store.files[require_store.toReplFilename(action.filename)];
|
|
2433
1852
|
break;
|
|
2434
1853
|
case "entry":
|
|
2435
|
-
store.mainFile = toReplFilename(entry);
|
|
2436
|
-
store.setActive(toReplFilename(entry));
|
|
1854
|
+
store.mainFile = require_store.toReplFilename(entry);
|
|
1855
|
+
store.setActive(require_store.toReplFilename(entry));
|
|
2437
1856
|
}
|
|
2438
1857
|
emit("files-change", files, entry, action);
|
|
2439
1858
|
};
|
|
2440
|
-
whenSassReady(files, apply);
|
|
1859
|
+
if (store) require_scss.whenSassReady(files, apply);
|
|
1860
|
+
else apply();
|
|
2441
1861
|
};
|
|
2442
1862
|
const handleEditor = () => {
|
|
2443
1863
|
Editor.popup({
|
|
2444
1864
|
files: { ...props.files },
|
|
2445
1865
|
entry: props.entry,
|
|
2446
1866
|
locale: locale.value,
|
|
2447
|
-
getCodeErrors: () =>
|
|
1867
|
+
getCodeErrors: () => {
|
|
1868
|
+
if (!props.local) return store?.errors || [];
|
|
1869
|
+
return localError.value.compile ? [localError.value.compile] : [];
|
|
1870
|
+
},
|
|
2448
1871
|
onFilesChange: handleFilesChange,
|
|
2449
|
-
onActiveChange: (filename) => store
|
|
1872
|
+
onActiveChange: (filename) => store?.setActive(require_store.toReplFilename(filename))
|
|
2450
1873
|
});
|
|
2451
1874
|
};
|
|
2452
1875
|
const handleInlineRefresh = () => {
|
|
2453
1876
|
runtimeError.value = "";
|
|
1877
|
+
localError.value = {
|
|
1878
|
+
compile: "",
|
|
1879
|
+
runtime: ""
|
|
1880
|
+
};
|
|
2454
1881
|
sandboxKey.value++;
|
|
2455
1882
|
};
|
|
2456
1883
|
const handleClosePopup = () => {
|
|
@@ -2458,6 +1885,11 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2458
1885
|
};
|
|
2459
1886
|
const handleOpenPopup = () => {
|
|
2460
1887
|
Alone.popup({
|
|
1888
|
+
local: props.local,
|
|
1889
|
+
files: props.files,
|
|
1890
|
+
entry: props.entry,
|
|
1891
|
+
options: props.options,
|
|
1892
|
+
previewScroller: props.previewScroller,
|
|
2461
1893
|
store,
|
|
2462
1894
|
copyValue: copyValue.value,
|
|
2463
1895
|
title: props.title,
|
|
@@ -2478,13 +1910,18 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2478
1910
|
syncedFiles = { ...files };
|
|
2479
1911
|
syncedEntry = props.entry;
|
|
2480
1912
|
runtimeError.value = "";
|
|
2481
|
-
|
|
1913
|
+
localError.value = {
|
|
1914
|
+
compile: "",
|
|
1915
|
+
runtime: ""
|
|
1916
|
+
};
|
|
1917
|
+
if (store) store.setFiles(files, props.entry);
|
|
2482
1918
|
}, { deep: true });
|
|
2483
1919
|
(0, vue.watch)(() => props.entry, (entry) => {
|
|
2484
1920
|
if (!entry || entry === syncedEntry) return;
|
|
2485
1921
|
syncedEntry = entry;
|
|
2486
|
-
|
|
2487
|
-
store.
|
|
1922
|
+
if (!store) return;
|
|
1923
|
+
store.mainFile = require_store.toReplFilename(entry);
|
|
1924
|
+
store.setActive(require_store.toReplFilename(entry));
|
|
2488
1925
|
});
|
|
2489
1926
|
(0, vue.watch)(() => props.activeView, (view) => {
|
|
2490
1927
|
if (view !== "runtime") handleClosePopup();
|
|
@@ -2509,13 +1946,29 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2509
1946
|
}, [errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_2$1, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("div", {
|
|
2510
1947
|
class: "docs-playground-runtime__viewport",
|
|
2511
1948
|
style: (0, vue.normalizeStyle)(viewportStyle.value)
|
|
2512
|
-
}, [(0, vue.
|
|
1949
|
+
}, [__props.local ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LocalSandbox), {
|
|
1950
|
+
key: 0,
|
|
1951
|
+
ref_key: "sandboxRef",
|
|
1952
|
+
ref: sandboxRef,
|
|
1953
|
+
files: __props.files,
|
|
1954
|
+
entry: __props.entry,
|
|
1955
|
+
options: __props.options,
|
|
1956
|
+
"preview-scroller": __props.previewScroller,
|
|
1957
|
+
"clear-console": clearConsole,
|
|
1958
|
+
onError: handleLocalError
|
|
1959
|
+
}, null, 8, [
|
|
1960
|
+
"files",
|
|
1961
|
+
"entry",
|
|
1962
|
+
"options",
|
|
1963
|
+
"preview-scroller"
|
|
1964
|
+
])) : (0, vue.unref)(store) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
|
|
1965
|
+
key: 1,
|
|
2513
1966
|
ref_key: "sandboxRef",
|
|
2514
1967
|
ref: sandboxRef,
|
|
2515
1968
|
store: (0, vue.unref)(store),
|
|
2516
1969
|
"auto-store-init": false,
|
|
2517
1970
|
"preview-options": mergedPreviewOptions.value
|
|
2518
|
-
}, null, 8, ["store", "preview-options"])], 4)], 4)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
1971
|
+
}, null, 8, ["store", "preview-options"])) : (0, vue.createCommentVNode)("v-if", true)], 4)], 4)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
2519
1972
|
key: 1,
|
|
2520
1973
|
ref_key: "runtimeRoot",
|
|
2521
1974
|
ref: runtimeRoot,
|
|
@@ -2553,7 +2006,22 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2553
2006
|
}, [(0, vue.createElementVNode)("div", _hoisted_8, [(0, vue.createElementVNode)("div", {
|
|
2554
2007
|
class: "docs-playground-runtime__viewport",
|
|
2555
2008
|
style: (0, vue.normalizeStyle)(viewportStyle.value)
|
|
2556
|
-
}, [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(
|
|
2009
|
+
}, [__props.local ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LocalSandbox), {
|
|
2010
|
+
key: sandboxKey.value,
|
|
2011
|
+
ref_key: "sandboxRef",
|
|
2012
|
+
ref: sandboxRef,
|
|
2013
|
+
files: __props.files,
|
|
2014
|
+
entry: __props.entry,
|
|
2015
|
+
options: __props.options,
|
|
2016
|
+
"preview-scroller": __props.previewScroller,
|
|
2017
|
+
"clear-console": clearConsole,
|
|
2018
|
+
onError: handleLocalError
|
|
2019
|
+
}, null, 8, [
|
|
2020
|
+
"files",
|
|
2021
|
+
"entry",
|
|
2022
|
+
"options",
|
|
2023
|
+
"preview-scroller"
|
|
2024
|
+
])) : (0, vue.unref)(store) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
|
|
2557
2025
|
key: sandboxKey.value,
|
|
2558
2026
|
ref_key: "sandboxRef",
|
|
2559
2027
|
ref: sandboxRef,
|
|
@@ -2561,7 +2029,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2561
2029
|
"auto-store-init": false,
|
|
2562
2030
|
"clear-console": clearConsole,
|
|
2563
2031
|
"preview-options": mergedPreviewOptions.value
|
|
2564
|
-
}, null, 8, ["store", "preview-options"]))], 4)]), canExpandPreview.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
2032
|
+
}, null, 8, ["store", "preview-options"])) : (0, vue.createCommentVNode)("v-if", true)], 4)]), canExpandPreview.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
2565
2033
|
key: 0,
|
|
2566
2034
|
type: "button",
|
|
2567
2035
|
class: (0, vue.normalizeClass)(["docs-playground__expand", { "is-expanded": previewExpanded.value }]),
|
|
@@ -2612,6 +2080,10 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2612
2080
|
type: Boolean,
|
|
2613
2081
|
default: false
|
|
2614
2082
|
},
|
|
2083
|
+
local: {
|
|
2084
|
+
type: Boolean,
|
|
2085
|
+
default: true
|
|
2086
|
+
},
|
|
2615
2087
|
previewOptions: {},
|
|
2616
2088
|
locale: {}
|
|
2617
2089
|
},
|
|
@@ -2630,7 +2102,7 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2630
2102
|
const locale = (0, vue.computed)(() => props.locale || inheritedLocale.locale.value);
|
|
2631
2103
|
(0, _deot_docs_locale.provideLocale)(locale);
|
|
2632
2104
|
const { t } = (0, _deot_docs_locale.useLocale)(locale);
|
|
2633
|
-
const initialFiles = Object.keys(props.files).length ? { ...props.files } : { [DEFAULT_ENTRY]: props.modelValue || NEW_SFC_CODE };
|
|
2105
|
+
const initialFiles = Object.keys(props.files).length ? { ...props.files } : { [require_cdn.DEFAULT_ENTRY]: props.modelValue || require_cdn.NEW_SFC_CODE };
|
|
2634
2106
|
const initialEntry = props.entry && initialFiles[props.entry] !== void 0 ? props.entry : Object.keys(initialFiles)[0];
|
|
2635
2107
|
const sourceFiles = (0, vue.ref)(initialFiles);
|
|
2636
2108
|
const currentEntry = (0, vue.ref)(initialEntry);
|
|
@@ -2770,7 +2242,8 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2770
2242
|
"preview-options": __props.previewOptions,
|
|
2771
2243
|
"preview-inset": __props.previewInset,
|
|
2772
2244
|
"preview-scroller": __props.previewScroller,
|
|
2773
|
-
|
|
2245
|
+
local: __props.local,
|
|
2246
|
+
expandable: __props.local ? false : __props.expandable,
|
|
2774
2247
|
styleless: true,
|
|
2775
2248
|
title: __props.title,
|
|
2776
2249
|
id: __props.id,
|
|
@@ -2786,6 +2259,7 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2786
2259
|
"preview-options",
|
|
2787
2260
|
"preview-inset",
|
|
2788
2261
|
"preview-scroller",
|
|
2262
|
+
"local",
|
|
2789
2263
|
"expandable",
|
|
2790
2264
|
"title",
|
|
2791
2265
|
"id",
|
|
@@ -2839,7 +2313,8 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2839
2313
|
"preview-options": __props.previewOptions,
|
|
2840
2314
|
"preview-inset": __props.previewInset,
|
|
2841
2315
|
"preview-scroller": __props.previewScroller,
|
|
2842
|
-
|
|
2316
|
+
local: __props.local,
|
|
2317
|
+
expandable: __props.local ? false : __props.expandable,
|
|
2843
2318
|
"hide-chrome": true,
|
|
2844
2319
|
title: __props.title,
|
|
2845
2320
|
id: __props.id,
|
|
@@ -2857,6 +2332,7 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2857
2332
|
"preview-options",
|
|
2858
2333
|
"preview-inset",
|
|
2859
2334
|
"preview-scroller",
|
|
2335
|
+
"local",
|
|
2860
2336
|
"expandable",
|
|
2861
2337
|
"title",
|
|
2862
2338
|
"id",
|
|
@@ -2886,34 +2362,35 @@ var playground_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
2886
2362
|
});
|
|
2887
2363
|
//#endregion
|
|
2888
2364
|
exports.CodePreview = code_preview_default;
|
|
2889
|
-
exports.DEFAULT_CDN_URL = DEFAULT_CDN_URL;
|
|
2365
|
+
exports.DEFAULT_CDN_URL = require_cdn.DEFAULT_CDN_URL;
|
|
2890
2366
|
exports.Editor = Editor;
|
|
2891
|
-
exports.PREVIEW_SCROLLER_USE_CODE = PREVIEW_SCROLLER_USE_CODE;
|
|
2892
|
-
exports.PREVIEW_SCROLL_CONTENT_CLASS = PREVIEW_SCROLL_CONTENT_CLASS;
|
|
2893
|
-
exports.PREVIEW_SCROLL_HTML_CLASS = PREVIEW_SCROLL_HTML_CLASS;
|
|
2367
|
+
exports.PREVIEW_SCROLLER_USE_CODE = require_store.PREVIEW_SCROLLER_USE_CODE;
|
|
2368
|
+
exports.PREVIEW_SCROLL_CONTENT_CLASS = require_store.PREVIEW_SCROLL_CONTENT_CLASS;
|
|
2369
|
+
exports.PREVIEW_SCROLL_HTML_CLASS = require_store.PREVIEW_SCROLL_HTML_CLASS;
|
|
2894
2370
|
exports.Playground = playground_default;
|
|
2895
|
-
exports.
|
|
2896
|
-
exports.
|
|
2897
|
-
exports.
|
|
2898
|
-
exports.
|
|
2899
|
-
exports.
|
|
2900
|
-
exports.
|
|
2901
|
-
exports.
|
|
2902
|
-
exports.
|
|
2903
|
-
exports.
|
|
2904
|
-
exports.
|
|
2371
|
+
exports.PlaygroundService = require_store.PlaygroundService;
|
|
2372
|
+
exports.applyPlaygroundImportMapOverride = require_store.applyPlaygroundImportMapOverride;
|
|
2373
|
+
exports.applyPlaygroundStyleOverride = require_store.applyPlaygroundStyleOverride;
|
|
2374
|
+
exports.clearPlaygroundMaps = require_store.clearPlaygroundMaps;
|
|
2375
|
+
exports.createBuiltinImports = require_cdn.createBuiltinImports;
|
|
2376
|
+
exports.createBuiltinStyles = require_cdn.createBuiltinStyles;
|
|
2377
|
+
exports.createRuntimePreviewOptions = require_store.createRuntimePreviewOptions;
|
|
2378
|
+
exports.getPlaygroundImportMapOverrides = require_store.getPlaygroundImportMapOverrides;
|
|
2379
|
+
exports.getPlaygroundSiteModules = require_store.getPlaygroundSiteModules;
|
|
2380
|
+
exports.getPlaygroundSiteStyles = require_store.getPlaygroundSiteStyles;
|
|
2381
|
+
exports.getPlaygroundStyleOverrides = require_store.getPlaygroundStyleOverrides;
|
|
2905
2382
|
exports.highlightCode = highlightCode;
|
|
2906
2383
|
exports.highlightCodeByLanguage = highlightCodeByLanguage;
|
|
2907
|
-
exports.isSafePlaygroundHref = isSafePlaygroundHref;
|
|
2908
|
-
exports.normalizeCdnURL = normalizeCdnURL;
|
|
2384
|
+
exports.isSafePlaygroundHref = require_store.isSafePlaygroundHref;
|
|
2385
|
+
exports.normalizeCdnURL = require_cdn.normalizeCdnURL;
|
|
2909
2386
|
exports.registerVueHighlight = registerVueHighlight;
|
|
2910
|
-
exports.removePlaygroundImportMapOverride = removePlaygroundImportMapOverride;
|
|
2911
|
-
exports.removePlaygroundStyleOverride = removePlaygroundStyleOverride;
|
|
2387
|
+
exports.removePlaygroundImportMapOverride = require_store.removePlaygroundImportMapOverride;
|
|
2388
|
+
exports.removePlaygroundStyleOverride = require_store.removePlaygroundStyleOverride;
|
|
2912
2389
|
exports.resolveHighlightLanguage = resolveHighlightLanguage;
|
|
2913
2390
|
exports.resolvePlaygroundTitleId = resolvePlaygroundTitleId;
|
|
2914
|
-
exports.setPlaygroundImportMapOverrides = setPlaygroundImportMapOverrides;
|
|
2915
|
-
exports.setPlaygroundSiteModules = setPlaygroundSiteModules;
|
|
2916
|
-
exports.setPlaygroundSiteStyles = setPlaygroundSiteStyles;
|
|
2917
|
-
exports.setPlaygroundStyleOverrides = setPlaygroundStyleOverrides;
|
|
2391
|
+
exports.setPlaygroundImportMapOverrides = require_store.setPlaygroundImportMapOverrides;
|
|
2392
|
+
exports.setPlaygroundSiteModules = require_store.setPlaygroundSiteModules;
|
|
2393
|
+
exports.setPlaygroundSiteStyles = require_store.setPlaygroundSiteStyles;
|
|
2394
|
+
exports.setPlaygroundStyleOverrides = require_store.setPlaygroundStyleOverrides;
|
|
2918
2395
|
exports.slugifyPlaygroundTitle = slugifyPlaygroundTitle;
|
|
2919
2396
|
exports.vueHighlight = vueHighlight;
|