@vuetify/vue-repl 1.4.3 → 1.5.0
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/repl.d.ts +3 -0
- package/dist/style.css +27 -27
- package/dist/vue-repl.js +63 -10
- package/dist/vue-repl.js.map +1 -1
- package/package.json +1 -1
package/dist/repl.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare class ReplStore implements Store {
|
|
|
117
117
|
setFiles(newFiles: Record<string, string>, mainFile?: string): Promise<void>;
|
|
118
118
|
private forceSandboxReset;
|
|
119
119
|
private initImportMap;
|
|
120
|
+
private initLinks;
|
|
120
121
|
getImportMap(): any;
|
|
121
122
|
setImportMap(map: {
|
|
122
123
|
imports: Record<string, string>;
|
|
@@ -124,6 +125,7 @@ export declare class ReplStore implements Store {
|
|
|
124
125
|
}): void;
|
|
125
126
|
setVueVersion(version: string): Promise<void>;
|
|
126
127
|
resetVueVersion(): void;
|
|
128
|
+
getLinks(): any;
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
export declare interface SFCOptions {
|
|
@@ -144,6 +146,7 @@ export declare interface Store {
|
|
|
144
146
|
getImportMap: () => any;
|
|
145
147
|
initialShowOutput: boolean;
|
|
146
148
|
initialOutputMode: OutputModes;
|
|
149
|
+
getLinks: () => any;
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
export declare interface StoreOptions {
|
package/dist/style.css
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
.split-pane[data-v-
|
|
2
|
+
.split-pane[data-v-09a71c4b] {
|
|
3
3
|
display: flex;
|
|
4
4
|
height: 100%;
|
|
5
5
|
position: relative;
|
|
6
6
|
}
|
|
7
|
-
.split-pane.dragging[data-v-
|
|
7
|
+
.split-pane.dragging[data-v-09a71c4b] {
|
|
8
8
|
cursor: ew-resize;
|
|
9
9
|
}
|
|
10
|
-
.dragging .left[data-v-
|
|
11
|
-
.dragging .right[data-v-
|
|
10
|
+
.dragging .left[data-v-09a71c4b],
|
|
11
|
+
.dragging .right[data-v-09a71c4b] {
|
|
12
12
|
pointer-events: none;
|
|
13
13
|
}
|
|
14
|
-
.left[data-v-
|
|
15
|
-
.right[data-v-
|
|
14
|
+
.left[data-v-09a71c4b],
|
|
15
|
+
.right[data-v-09a71c4b] {
|
|
16
16
|
position: relative;
|
|
17
17
|
height: 100%;
|
|
18
18
|
}
|
|
19
|
-
.left[data-v-
|
|
19
|
+
.left[data-v-09a71c4b] {
|
|
20
20
|
border-right: 1px solid var(--border);
|
|
21
21
|
}
|
|
22
|
-
.dragger[data-v-
|
|
22
|
+
.dragger[data-v-09a71c4b] {
|
|
23
23
|
position: absolute;
|
|
24
24
|
z-index: 3;
|
|
25
25
|
top: 0;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
width: 10px;
|
|
29
29
|
cursor: ew-resize;
|
|
30
30
|
}
|
|
31
|
-
.toggler[data-v-
|
|
31
|
+
.toggler[data-v-09a71c4b] {
|
|
32
32
|
display: none;
|
|
33
33
|
z-index: 3;
|
|
34
34
|
font-family: var(--font-code);
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
|
|
46
46
|
/* vertical */
|
|
47
47
|
@media (min-width: 721px) {
|
|
48
|
-
.split-pane.vertical[data-v-
|
|
48
|
+
.split-pane.vertical[data-v-09a71c4b] {
|
|
49
49
|
display: block;
|
|
50
50
|
}
|
|
51
|
-
.split-pane.vertical.dragging[data-v-
|
|
51
|
+
.split-pane.vertical.dragging[data-v-09a71c4b] {
|
|
52
52
|
cursor: ns-resize;
|
|
53
53
|
}
|
|
54
|
-
.vertical .dragger[data-v-
|
|
54
|
+
.vertical .dragger[data-v-09a71c4b] {
|
|
55
55
|
top: auto;
|
|
56
56
|
height: 10px;
|
|
57
57
|
width: 100%;
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
bottom: -5px;
|
|
61
61
|
cursor: ns-resize;
|
|
62
62
|
}
|
|
63
|
-
.vertical .left[data-v-
|
|
64
|
-
.vertical .right[data-v-
|
|
63
|
+
.vertical .left[data-v-09a71c4b],
|
|
64
|
+
.vertical .right[data-v-09a71c4b] {
|
|
65
65
|
width: 100%;
|
|
66
66
|
}
|
|
67
|
-
.vertical .left[data-v-
|
|
67
|
+
.vertical .left[data-v-09a71c4b] {
|
|
68
68
|
border-right: none;
|
|
69
69
|
border-bottom: 1px solid var(--border);
|
|
70
70
|
}
|
|
@@ -72,38 +72,38 @@
|
|
|
72
72
|
|
|
73
73
|
/* mobile */
|
|
74
74
|
@media (max-width: 720px) {
|
|
75
|
-
.left[data-v-
|
|
76
|
-
.right[data-v-
|
|
75
|
+
.left[data-v-09a71c4b],
|
|
76
|
+
.right[data-v-09a71c4b] {
|
|
77
77
|
width: 100% !important;
|
|
78
78
|
height: 100% !important;
|
|
79
79
|
}
|
|
80
|
-
.dragger[data-v-
|
|
80
|
+
.dragger[data-v-09a71c4b] {
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
|
-
.split-pane .toggler[data-v-
|
|
83
|
+
.split-pane .toggler[data-v-09a71c4b] {
|
|
84
84
|
display: block;
|
|
85
85
|
}
|
|
86
|
-
.split-pane .right[data-v-
|
|
86
|
+
.split-pane .right[data-v-09a71c4b] {
|
|
87
87
|
display: none;
|
|
88
88
|
}
|
|
89
|
-
.split-pane.show-output .right[data-v-
|
|
89
|
+
.split-pane.show-output .right[data-v-09a71c4b] {
|
|
90
90
|
display: block;
|
|
91
91
|
}
|
|
92
|
-
.split-pane.show-output .left[data-v-
|
|
92
|
+
.split-pane.show-output .left[data-v-09a71c4b] {
|
|
93
93
|
display: none;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.remove[data-v-
|
|
97
|
+
.remove[data-v-ca5e80cf] {
|
|
98
98
|
align-self: flex-end;
|
|
99
99
|
}
|
|
100
|
-
.file.import-map[data-v-
|
|
100
|
+
.file.import-map[data-v-ca5e80cf] {
|
|
101
101
|
/*position: sticky;*/
|
|
102
102
|
/*right: 0;*/
|
|
103
103
|
margin-left: auto;
|
|
104
104
|
background: rgb(var(--v-theme-background)) !important;
|
|
105
105
|
}
|
|
106
|
-
.file.pending input[data-v-
|
|
106
|
+
.file.pending input[data-v-ca5e80cf] {
|
|
107
107
|
width: 90px;
|
|
108
108
|
height: 30px;
|
|
109
109
|
line-height: 30px;
|
|
@@ -726,8 +726,8 @@ pre[data-v-92411507] {
|
|
|
726
726
|
position: relative;
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
.iframe-container[data-v-
|
|
730
|
-
.iframe-container[data-v-
|
|
729
|
+
.iframe-container[data-v-574b6cff],
|
|
730
|
+
.iframe-container[data-v-574b6cff] iframe {
|
|
731
731
|
width: 100%;
|
|
732
732
|
height: 100%;
|
|
733
733
|
border: none;
|
package/dist/vue-repl.js
CHANGED
|
@@ -18,9 +18,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
const container = ref();
|
|
19
19
|
const store = inject("store");
|
|
20
20
|
const showOutput = ref(store.initialShowOutput);
|
|
21
|
+
const savedSplit = parseFloat(localStorage.getItem("vue-repl:split") ?? "");
|
|
21
22
|
const state = reactive({
|
|
22
23
|
dragging: false,
|
|
23
|
-
split: 50
|
|
24
|
+
split: !isNaN(savedSplit) ? savedSplit : 50
|
|
24
25
|
});
|
|
25
26
|
const boundSplit = computed(() => {
|
|
26
27
|
const { split } = state;
|
|
@@ -43,6 +44,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
43
44
|
}
|
|
44
45
|
function dragEnd() {
|
|
45
46
|
state.dragging = false;
|
|
47
|
+
localStorage.setItem("vue-repl:split", state.split.toString());
|
|
46
48
|
}
|
|
47
49
|
return (_ctx, _cache) => {
|
|
48
50
|
return openBlock(), createElementBlock("div", {
|
|
@@ -82,7 +84,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
86
|
|
|
85
|
-
const
|
|
87
|
+
const SplitPane_vue_vue_type_style_index_0_scoped_09a71c4b_lang = '';
|
|
86
88
|
|
|
87
89
|
const _export_sfc = (sfc, props) => {
|
|
88
90
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -92,10 +94,11 @@ const _export_sfc = (sfc, props) => {
|
|
|
92
94
|
return target;
|
|
93
95
|
};
|
|
94
96
|
|
|
95
|
-
const SplitPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
|
97
|
+
const SplitPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-09a71c4b"]]);
|
|
96
98
|
|
|
97
99
|
const _hoisted_1$2 = ["onKeyup"];
|
|
98
100
|
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" Import Map ");
|
|
101
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" Links ");
|
|
99
102
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
100
103
|
__name: "FileSelector",
|
|
101
104
|
setup(__props) {
|
|
@@ -103,9 +106,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
103
106
|
const pending = ref(false);
|
|
104
107
|
const pendingFilename = ref("Comp.vue");
|
|
105
108
|
const importMapFile = "import-map.json";
|
|
109
|
+
const linksFile = "links.json";
|
|
106
110
|
const showImportMap = inject("import-map");
|
|
107
111
|
const files = computed(
|
|
108
|
-
() => Object.entries(store.state.files).filter(([name, file]) => name
|
|
112
|
+
() => Object.entries(store.state.files).filter(([name, file]) => ![importMapFile, linksFile].includes(name) && !file.hidden).map(([name]) => name)
|
|
109
113
|
);
|
|
110
114
|
function startAddFile() {
|
|
111
115
|
let i = 0;
|
|
@@ -234,7 +238,17 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
234
238
|
_hoisted_2
|
|
235
239
|
]),
|
|
236
240
|
_: 1
|
|
237
|
-
})) : createCommentVNode("", true)
|
|
241
|
+
})) : createCommentVNode("", true),
|
|
242
|
+
createVNode(VTab, {
|
|
243
|
+
class: "file",
|
|
244
|
+
size: "small",
|
|
245
|
+
value: linksFile
|
|
246
|
+
}, {
|
|
247
|
+
default: withCtx(() => [
|
|
248
|
+
_hoisted_3
|
|
249
|
+
]),
|
|
250
|
+
_: 1
|
|
251
|
+
})
|
|
238
252
|
]),
|
|
239
253
|
_: 1
|
|
240
254
|
}, 8, ["modelValue", "class"]);
|
|
@@ -242,9 +256,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
242
256
|
}
|
|
243
257
|
});
|
|
244
258
|
|
|
245
|
-
const
|
|
259
|
+
const FileSelector_vue_vue_type_style_index_0_scoped_ca5e80cf_lang = '';
|
|
246
260
|
|
|
247
|
-
const FileSelector = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
261
|
+
const FileSelector = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-ca5e80cf"]]);
|
|
248
262
|
|
|
249
263
|
// DEFLATE is a complex format; to read this code, you should probably check the RFC first:
|
|
250
264
|
|
|
@@ -14841,7 +14855,7 @@ const Editor_vue_vue_type_style_index_0_scoped_0384e940_lang = '';
|
|
|
14841
14855
|
|
|
14842
14856
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-0384e940"]]);
|
|
14843
14857
|
|
|
14844
|
-
const srcdoc = "<!doctype html>\n<html>\n\t<head>\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto,\n\t\t\t\tOxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\t<style id=\"__sfc-styles\"></style>\n\t\t<script>\n\t\t\t(() => {\n\t\t\t\tlet scriptEls = []\n\n\t\t\t\twindow.process = { env: {} }\n\t\t\t\twindow.__modules__ = {}\n\n\t\t\t\twindow.__export__ = (mod, key, get) => {\n\t\t\t\t\tObject.defineProperty(mod, key, {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tget\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\twindow.__dynamic_import__ = key => {\n\t\t\t\t\treturn Promise.resolve(window.__modules__[key])\n\t\t\t\t}\n\n\t\t\t\tasync function handle_message(ev) {\n\t\t\t\t\tlet { action, cmd_id } = ev.data;\n\t\t\t\t\tconst send_message = (payload) => parent.postMessage( { ...payload }, ev.origin);\n\t\t\t\t\tconst send_reply = (payload) => send_message({ ...payload, cmd_id });\n\t\t\t\t\tconst send_ok = () => send_reply({ action: 'cmd_ok' });\n\t\t\t\t\tconst send_error = (message, stack) => send_reply({ action: 'cmd_error', message, stack });\n\n\t\t\t\t\tif (action === 'eval') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (scriptEls.length) {\n\t\t\t\t\t\t\t\tscriptEls.forEach(el => {\n\t\t\t\t\t\t\t\t\tdocument.head.removeChild(el)\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tscriptEls.length = 0\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet { script: scripts } = ev.data.args\n\t\t\t\t\t\t\tif (typeof scripts === 'string') scripts = [scripts]\n\n\t\t\t\t\t\t\tfor (const script of scripts) {\n\t\t\t\t\t\t\t\tconst scriptEl = document.createElement('script')\n\t\t\t\t\t\t\t\tscriptEl.setAttribute('type', 'module')\n\t\t\t\t\t\t\t\t// send ok in the module script to ensure sequential evaluation\n\t\t\t\t\t\t\t\t// of multiple proxy.eval() calls\n\t\t\t\t\t\t\t\tconst done = new Promise((resolve) => {\n\t\t\t\t\t\t\t\t\twindow.__next__ = resolve\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tscriptEl.innerHTML = script + `\\nwindow.__next__()`\n\t\t\t\t\t\t\t\tdocument.head.appendChild(scriptEl)\n\t\t\t\t\t\t\t\tscriptEl.onerror = err => send_error(err.message, err.stack)\n\t\t\t\t\t\t\t\tscriptEls.push(scriptEl)\n\t\t\t\t\t\t\t\tawait done\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsend_ok()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tsend_error(e.message, e.stack);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (action === 'catch_clicks') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst top_origin = ev.origin;\n\t\t\t\t\t\t\tdocument.body.addEventListener('click', event => {\n\t\t\t\t\t\t\t\tif (event.which !== 1) return;\n\t\t\t\t\t\t\t\tif (event.metaKey || event.ctrlKey || event.shiftKey) return;\n\t\t\t\t\t\t\t\tif (event.defaultPrevented) return;\n\n\t\t\t\t\t\t\t\t// ensure target is a link\n\t\t\t\t\t\t\t\tlet el = event.target;\n\t\t\t\t\t\t\t\twhile (el && el.nodeName !== 'A') el = el.parentNode;\n\t\t\t\t\t\t\t\tif (!el || el.nodeName !== 'A') return;\n\n\t\t\t\t\t\t\t\tif (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target) return;\n\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\tif (el.href.startsWith(top_origin)) {\n\t\t\t\t\t\t\t\t\tconst url = new URL(el.href);\n\t\t\t\t\t\t\t\t\tif (url.hash[0] === '#') {\n\t\t\t\t\t\t\t\t\t\twindow.location.hash = url.hash;\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\twindow.open(el.href, '_blank');\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsend_ok();\n\t\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t\tsend_error(e.message, e.stack);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twindow.addEventListener('message', handle_message, false);\n\n\t\t\t\twindow.onerror = function (msg, url, lineNo, columnNo, error) {\n\t\t\t\t\tif (msg.includes('module specifier “vue”')) {\n\t\t\t\t\t\t// firefox only error, ignore\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tparent.postMessage({ action: 'error', value: error }, '*');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tparent.postMessage({ action: 'error', value: msg }, '*');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twindow.addEventListener(\"unhandledrejection\", event => {\n\t\t\t\t\tif (event.reason.message.includes('Cross-origin')) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tparent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tparent.postMessage({ action: 'unhandledrejection', value: event.reason.message }, '*');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tlet previous = { level: null, args: null };\n\n\t\t\t\t['clear', 'log', 'info', 'dir', 'warn', 'error', 'table'].forEach((level) => {\n\t\t\t\t\tconst original = console[level];\n\t\t\t\t\tconsole[level] = (...args) => {\n\t\t\t\t\t\tconst msg = String(args[0])\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmsg.includes('You are running a development build of Vue') ||\n\t\t\t\t\t\t\tmsg.includes('You are running the esm-bundler build of Vue')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst stringifiedArgs = stringify(args);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tprevious.level === level &&\n\t\t\t\t\t\t\tprevious.args &&\n\t\t\t\t\t\t\tprevious.args === stringifiedArgs\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, duplicate: true }, '*');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprevious = { level, args: stringifiedArgs };\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, args }, '*');\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, args: args.map(a => {\n\t\t\t\t\t\t\t\t\treturn a instanceof Error ? a.message : String(a)\n\t\t\t\t\t\t\t\t}) }, '*');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginal(...args);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t[\n\t\t\t\t\t{ method: 'group', action: 'console_group' },\n\t\t\t\t\t{ method: 'groupEnd', action: 'console_group_end' },\n\t\t\t\t\t{ method: 'groupCollapsed', action: 'console_group_collapsed' },\n\t\t\t\t].forEach((group_action) => {\n\t\t\t\t\tconst original = console[group_action.method];\n\t\t\t\t\tconsole[group_action.method] = (label) => {\n\t\t\t\t\t\tparent.postMessage({ action: group_action.action, label }, '*');\n\n\t\t\t\t\t\toriginal(label);\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tconst timers = new Map();\n\t\t\t\tconst original_time = console.time;\n\t\t\t\tconst original_timelog = console.timeLog;\n\t\t\t\tconst original_timeend = console.timeEnd;\n\n\t\t\t\tconsole.time = (label = 'default') => {\n\t\t\t\t\toriginal_time(label);\n\t\t\t\t\ttimers.set(label, performance.now());\n\t\t\t\t}\n\t\t\t\tconsole.timeLog = (label = 'default') => {\n\t\t\t\t\toriginal_timelog(label);\n\t\t\t\t\tconst now = performance.now();\n\t\t\t\t\tif (timers.has(label)) {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: [`${label}: ${now - timers.get(label)}ms`] }, '*');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] }, '*');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.timeEnd = (label = 'default') => {\n\t\t\t\t\toriginal_timeend(label);\n\t\t\t\t\tconst now = performance.now();\n\t\t\t\t\tif (timers.has(label)) {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: [`${label}: ${now - timers.get(label)}ms`] }, '*');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] }, '*');\n\t\t\t\t\t}\n\t\t\t\t\ttimers.delete(label);\n\t\t\t\t};\n\n\t\t\t\tconst original_assert = console.assert;\n\t\t\t\tconsole.assert = (condition, ...args) => {\n\t\t\t\t\tif (condition) {\n\t\t\t\t\t\tconst stack = new Error().stack;\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'assert', args, stack }, '*');\n\t\t\t\t\t}\n\t\t\t\t\toriginal_assert(condition, ...args);\n\t\t\t\t};\n\n\t\t\t\tconst counter = new Map();\n\t\t\t\tconst original_count = console.count;\n\t\t\t\tconst original_countreset = console.countReset;\n\n\t\t\t\tconsole.count = (label = 'default') => {\n\t\t\t\t\tcounter.set(label, (counter.get(label) || 0) + 1);\n\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: `${label}: ${counter.get(label)}` }, '*');\n\t\t\t\t\toriginal_count(label);\n\t\t\t\t};\n\n\t\t\t\tconsole.countReset = (label = 'default') => {\n\t\t\t\t\tif (counter.has(label)) {\n\t\t\t\t\t\tcounter.set(label, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: `Count for '${label}' does not exist` }, '*');\n\t\t\t\t\t}\n\t\t\t\t\toriginal_countreset(label);\n\t\t\t\t};\n\n\t\t\t\tconst original_trace = console.trace;\n\n\t\t\t\tconsole.trace = (...args) => {\n\t\t\t\t\tconst stack = new Error().stack;\n\t\t\t\t\tparent.postMessage({ action: 'console', level: 'trace', args, stack }, '*');\n\t\t\t\t\toriginal_trace(...args);\n\t\t\t\t};\n\n\t\t\t\tfunction stringify(args) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn JSON.stringify(args);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})()\n\t\t</script>\n\n\t\t<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) -->\n\t\t<script async src=\"https://unpkg.com/es-module-shims@1.5.18/dist/es-module-shims.wasm.js\"></script>\n\t\t<script type=\"importmap\"><!--IMPORT_MAP--></script>\n\t</head>\n\t<body></body>\n</html>\n";
|
|
14858
|
+
const srcdoc = "<!doctype html>\n<html>\n\t<head>\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto,\n\t\t\t\tOxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\t<style id=\"__sfc-styles\"></style>\n\t\t<script>\n\t\t\t(() => {\n\t\t\t\tlet scriptEls = []\n\n\t\t\t\twindow.process = { env: {} }\n\t\t\t\twindow.__modules__ = {}\n\n\t\t\t\twindow.__export__ = (mod, key, get) => {\n\t\t\t\t\tObject.defineProperty(mod, key, {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tget\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\twindow.__dynamic_import__ = key => {\n\t\t\t\t\treturn Promise.resolve(window.__modules__[key])\n\t\t\t\t}\n\n\t\t\t\tasync function handle_message(ev) {\n\t\t\t\t\tlet { action, cmd_id } = ev.data;\n\t\t\t\t\tconst send_message = (payload) => parent.postMessage( { ...payload }, ev.origin);\n\t\t\t\t\tconst send_reply = (payload) => send_message({ ...payload, cmd_id });\n\t\t\t\t\tconst send_ok = () => send_reply({ action: 'cmd_ok' });\n\t\t\t\t\tconst send_error = (message, stack) => send_reply({ action: 'cmd_error', message, stack });\n\n\t\t\t\t\tif (action === 'eval') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (scriptEls.length) {\n\t\t\t\t\t\t\t\tscriptEls.forEach(el => {\n\t\t\t\t\t\t\t\t\tdocument.head.removeChild(el)\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tscriptEls.length = 0\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet { script: scripts } = ev.data.args\n\t\t\t\t\t\t\tif (typeof scripts === 'string') scripts = [scripts]\n\n\t\t\t\t\t\t\tfor (const script of scripts) {\n\t\t\t\t\t\t\t\tconst scriptEl = document.createElement('script')\n\t\t\t\t\t\t\t\tscriptEl.setAttribute('type', 'module')\n\t\t\t\t\t\t\t\t// send ok in the module script to ensure sequential evaluation\n\t\t\t\t\t\t\t\t// of multiple proxy.eval() calls\n\t\t\t\t\t\t\t\tconst done = new Promise((resolve) => {\n\t\t\t\t\t\t\t\t\twindow.__next__ = resolve\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tscriptEl.innerHTML = script + `\\nwindow.__next__()`\n\t\t\t\t\t\t\t\tdocument.head.appendChild(scriptEl)\n\t\t\t\t\t\t\t\tscriptEl.onerror = err => send_error(err.message, err.stack)\n\t\t\t\t\t\t\t\tscriptEls.push(scriptEl)\n\t\t\t\t\t\t\t\tawait done\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsend_ok()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tsend_error(e.message, e.stack);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (action === 'catch_clicks') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst top_origin = ev.origin;\n\t\t\t\t\t\t\tdocument.body.addEventListener('click', event => {\n\t\t\t\t\t\t\t\tif (event.which !== 1) return;\n\t\t\t\t\t\t\t\tif (event.metaKey || event.ctrlKey || event.shiftKey) return;\n\t\t\t\t\t\t\t\tif (event.defaultPrevented) return;\n\n\t\t\t\t\t\t\t\t// ensure target is a link\n\t\t\t\t\t\t\t\tlet el = event.target;\n\t\t\t\t\t\t\t\twhile (el && el.nodeName !== 'A') el = el.parentNode;\n\t\t\t\t\t\t\t\tif (!el || el.nodeName !== 'A') return;\n\n\t\t\t\t\t\t\t\tif (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target) return;\n\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\tif (el.href.startsWith(top_origin)) {\n\t\t\t\t\t\t\t\t\tconst url = new URL(el.href);\n\t\t\t\t\t\t\t\t\tif (url.hash[0] === '#') {\n\t\t\t\t\t\t\t\t\t\twindow.location.hash = url.hash;\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\twindow.open(el.href, '_blank');\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsend_ok();\n\t\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t\tsend_error(e.message, e.stack);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twindow.addEventListener('message', handle_message, false);\n\n\t\t\t\twindow.onerror = function (msg, url, lineNo, columnNo, error) {\n\t\t\t\t\tif (msg.includes('module specifier “vue”')) {\n\t\t\t\t\t\t// firefox only error, ignore\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tparent.postMessage({ action: 'error', value: error }, '*');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tparent.postMessage({ action: 'error', value: msg }, '*');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twindow.addEventListener(\"unhandledrejection\", event => {\n\t\t\t\t\tif (event.reason.message.includes('Cross-origin')) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tparent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tparent.postMessage({ action: 'unhandledrejection', value: event.reason.message }, '*');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tlet previous = { level: null, args: null };\n\n\t\t\t\t['clear', 'log', 'info', 'dir', 'warn', 'error', 'table'].forEach((level) => {\n\t\t\t\t\tconst original = console[level];\n\t\t\t\t\tconsole[level] = (...args) => {\n\t\t\t\t\t\tconst msg = String(args[0])\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmsg.includes('You are running a development build of Vue') ||\n\t\t\t\t\t\t\tmsg.includes('You are running the esm-bundler build of Vue')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst stringifiedArgs = stringify(args);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tprevious.level === level &&\n\t\t\t\t\t\t\tprevious.args &&\n\t\t\t\t\t\t\tprevious.args === stringifiedArgs\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, duplicate: true }, '*');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprevious = { level, args: stringifiedArgs };\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, args }, '*');\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tparent.postMessage({ action: 'console', level, args: args.map(a => {\n\t\t\t\t\t\t\t\t\treturn a instanceof Error ? a.message : String(a)\n\t\t\t\t\t\t\t\t}) }, '*');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginal(...args);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t[\n\t\t\t\t\t{ method: 'group', action: 'console_group' },\n\t\t\t\t\t{ method: 'groupEnd', action: 'console_group_end' },\n\t\t\t\t\t{ method: 'groupCollapsed', action: 'console_group_collapsed' },\n\t\t\t\t].forEach((group_action) => {\n\t\t\t\t\tconst original = console[group_action.method];\n\t\t\t\t\tconsole[group_action.method] = (label) => {\n\t\t\t\t\t\tparent.postMessage({ action: group_action.action, label }, '*');\n\n\t\t\t\t\t\toriginal(label);\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tconst timers = new Map();\n\t\t\t\tconst original_time = console.time;\n\t\t\t\tconst original_timelog = console.timeLog;\n\t\t\t\tconst original_timeend = console.timeEnd;\n\n\t\t\t\tconsole.time = (label = 'default') => {\n\t\t\t\t\toriginal_time(label);\n\t\t\t\t\ttimers.set(label, performance.now());\n\t\t\t\t}\n\t\t\t\tconsole.timeLog = (label = 'default') => {\n\t\t\t\t\toriginal_timelog(label);\n\t\t\t\t\tconst now = performance.now();\n\t\t\t\t\tif (timers.has(label)) {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: [`${label}: ${now - timers.get(label)}ms`] }, '*');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] }, '*');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.timeEnd = (label = 'default') => {\n\t\t\t\t\toriginal_timeend(label);\n\t\t\t\t\tconst now = performance.now();\n\t\t\t\t\tif (timers.has(label)) {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: [`${label}: ${now - timers.get(label)}ms`] }, '*');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] }, '*');\n\t\t\t\t\t}\n\t\t\t\t\ttimers.delete(label);\n\t\t\t\t};\n\n\t\t\t\tconst original_assert = console.assert;\n\t\t\t\tconsole.assert = (condition, ...args) => {\n\t\t\t\t\tif (condition) {\n\t\t\t\t\t\tconst stack = new Error().stack;\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'assert', args, stack }, '*');\n\t\t\t\t\t}\n\t\t\t\t\toriginal_assert(condition, ...args);\n\t\t\t\t};\n\n\t\t\t\tconst counter = new Map();\n\t\t\t\tconst original_count = console.count;\n\t\t\t\tconst original_countreset = console.countReset;\n\n\t\t\t\tconsole.count = (label = 'default') => {\n\t\t\t\t\tcounter.set(label, (counter.get(label) || 0) + 1);\n\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-log', args: `${label}: ${counter.get(label)}` }, '*');\n\t\t\t\t\toriginal_count(label);\n\t\t\t\t};\n\n\t\t\t\tconsole.countReset = (label = 'default') => {\n\t\t\t\t\tif (counter.has(label)) {\n\t\t\t\t\t\tcounter.set(label, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent.postMessage({ action: 'console', level: 'system-warn', args: `Count for '${label}' does not exist` }, '*');\n\t\t\t\t\t}\n\t\t\t\t\toriginal_countreset(label);\n\t\t\t\t};\n\n\t\t\t\tconst original_trace = console.trace;\n\n\t\t\t\tconsole.trace = (...args) => {\n\t\t\t\t\tconst stack = new Error().stack;\n\t\t\t\t\tparent.postMessage({ action: 'console', level: 'trace', args, stack }, '*');\n\t\t\t\t\toriginal_trace(...args);\n\t\t\t\t};\n\n\t\t\t\tfunction stringify(args) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn JSON.stringify(args);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})()\n\t\t</script>\n\n\t\t<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) -->\n\t\t<script async src=\"https://unpkg.com/es-module-shims@1.5.18/dist/es-module-shims.wasm.js\"></script>\n\t\t<script type=\"importmap\"><!--IMPORT_MAP--></script>\n\t\t<!--CSS-->\n\t</head>\n\t<body></body>\n</html>\n";
|
|
14845
14859
|
|
|
14846
14860
|
let uid = 1;
|
|
14847
14861
|
class PreviewProxy {
|
|
@@ -15177,6 +15191,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15177
15191
|
}
|
|
15178
15192
|
}
|
|
15179
15193
|
);
|
|
15194
|
+
watch(
|
|
15195
|
+
() => store.state.files["links.json"].code,
|
|
15196
|
+
() => {
|
|
15197
|
+
try {
|
|
15198
|
+
createSandbox();
|
|
15199
|
+
} catch (e) {
|
|
15200
|
+
store.state.errors = [e];
|
|
15201
|
+
}
|
|
15202
|
+
}
|
|
15203
|
+
);
|
|
15180
15204
|
watch(() => store.state.resetFlip, createSandbox);
|
|
15181
15205
|
onUnmounted(() => {
|
|
15182
15206
|
proxy.destroy();
|
|
@@ -15208,9 +15232,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15208
15232
|
if (!importMap.imports.vue) {
|
|
15209
15233
|
importMap.imports.vue = store.state.vueRuntimeURL;
|
|
15210
15234
|
}
|
|
15235
|
+
const links = store.getLinks();
|
|
15236
|
+
if (!links.css) {
|
|
15237
|
+
links.css = [];
|
|
15238
|
+
}
|
|
15211
15239
|
const sandboxSrc = srcdoc.replace(
|
|
15212
15240
|
/<!--IMPORT_MAP-->/,
|
|
15213
15241
|
JSON.stringify(importMap)
|
|
15242
|
+
).replace(
|
|
15243
|
+
/<!--CSS-->/,
|
|
15244
|
+
links.css.map((link) => `<link rel="stylesheet" type="text/css" href="${link}" />`).join("\n")
|
|
15214
15245
|
);
|
|
15215
15246
|
sandbox.srcdoc = sandboxSrc;
|
|
15216
15247
|
container.value.appendChild(sandbox);
|
|
@@ -15356,9 +15387,9 @@ if (window.__app__) window.__app__.unmount()
|
|
|
15356
15387
|
}
|
|
15357
15388
|
});
|
|
15358
15389
|
|
|
15359
|
-
const
|
|
15390
|
+
const Preview_vue_vue_type_style_index_0_scoped_574b6cff_lang = '';
|
|
15360
15391
|
|
|
15361
|
-
const Preview = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
15392
|
+
const Preview = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-574b6cff"]]);
|
|
15362
15393
|
|
|
15363
15394
|
const _hoisted_1 = { class: "output-container" };
|
|
15364
15395
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -28983,6 +29014,7 @@ class ReplStore {
|
|
|
28983
29014
|
resetFlip: true
|
|
28984
29015
|
});
|
|
28985
29016
|
this.initImportMap();
|
|
29017
|
+
this.initLinks();
|
|
28986
29018
|
}
|
|
28987
29019
|
init() {
|
|
28988
29020
|
watchEffect(() => compileFile(this, this.state.activeFile));
|
|
@@ -29033,6 +29065,7 @@ class ReplStore {
|
|
|
29033
29065
|
this.state.mainFile = mainFile;
|
|
29034
29066
|
this.state.files = files;
|
|
29035
29067
|
this.initImportMap();
|
|
29068
|
+
this.initLinks();
|
|
29036
29069
|
this.setActive(mainFile);
|
|
29037
29070
|
this.forceSandboxReset();
|
|
29038
29071
|
}
|
|
@@ -29069,6 +29102,17 @@ class ReplStore {
|
|
|
29069
29102
|
}
|
|
29070
29103
|
}
|
|
29071
29104
|
}
|
|
29105
|
+
initLinks() {
|
|
29106
|
+
const links = this.state.files["links.json"];
|
|
29107
|
+
if (!links) {
|
|
29108
|
+
this.state.files["links.json"] = new File(
|
|
29109
|
+
"links.json",
|
|
29110
|
+
JSON.stringify({
|
|
29111
|
+
css: []
|
|
29112
|
+
}, null, 2)
|
|
29113
|
+
);
|
|
29114
|
+
}
|
|
29115
|
+
}
|
|
29072
29116
|
getImportMap() {
|
|
29073
29117
|
try {
|
|
29074
29118
|
return JSON.parse(this.state.files["import-map.json"].code);
|
|
@@ -29116,6 +29160,15 @@ class ReplStore {
|
|
|
29116
29160
|
this.forceSandboxReset();
|
|
29117
29161
|
console.info(`[@vue/repl] Now using default Vue version`);
|
|
29118
29162
|
}
|
|
29163
|
+
getLinks() {
|
|
29164
|
+
try {
|
|
29165
|
+
return JSON.parse(this.state.files["links.json"].code);
|
|
29166
|
+
} catch (e) {
|
|
29167
|
+
this.state.errors = [
|
|
29168
|
+
`Syntax error in links.json: ${e.message}`
|
|
29169
|
+
];
|
|
29170
|
+
}
|
|
29171
|
+
}
|
|
29119
29172
|
}
|
|
29120
29173
|
|
|
29121
29174
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|