@wangtaizong/components 1.0.6 → 1.0.8
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.dumirc.ts +28 -0
- package/.editorconfig +13 -0
- package/.eslintrc.js +3 -0
- package/.husky/commit-msg +5 -0
- package/.husky/pre-commit +8 -0
- package/.husky/pre-push +8 -0
- package/.prettierignore +2 -0
- package/.prettierrc.js +19 -0
- package/.stylelintrc +3 -0
- package/.vscode/settings.json +3 -0
- package/LICENSE +21 -0
- package/README.md +0 -52
- package/commitlint.config.js +21 -0
- package/docs/changelogs/index.md +9 -0
- package/docs/components/index.md +1 -0
- package/docs/guide/install.md +39 -0
- package/docs/index.md +21 -0
- package/docs/utils/index.md +1 -0
- package/lerna.json +8 -0
- package/package.json +66 -69
- package/packages/components/CHANGELOG.md +0 -0
- package/packages/components/package.json +48 -0
- package/packages/components/rollup.config.mjs +108 -0
- package/packages/components/src/Button/index.md +13 -0
- package/packages/components/src/Button/index.tsx +34 -0
- package/packages/components/src/Icon/index.md +81 -0
- package/packages/components/src/Icon/index.tsx +34 -0
- package/packages/components/src/Upload/index.md +209 -0
- package/packages/components/src/Upload/index.tsx +218 -0
- package/packages/components/src/antd/index.md +12 -0
- package/packages/components/src/antd/index.tsx +2 -0
- package/packages/components/src/index.md +23 -0
- package/packages/components/src/index.ts +5 -0
- package/packages/components/tsconfig.json +32 -0
- package/packages/utils/README.md +11 -0
- package/packages/utils/package.json +35 -0
- package/packages/utils/rollup.config.mjs +63 -0
- package/packages/utils/src/CHRRequest/index.md +59 -0
- package/packages/utils/src/CHRRequest/index.ts +94 -0
- package/packages/utils/src/index.ts +17 -0
- package/packages/utils/tsconfig.json +28 -0
- package/pnpm-workspace.yaml +8 -0
- package/public/favicon.ico +0 -0
- package/public/logo.webp +0 -0
- package/tsconfig.json +14 -0
- package/dist/Add.d.ts +0 -2
- package/dist/base-80a1f760-22b3368a.js +0 -23
- package/dist/components/editor/MonacoEditor.d.ts +0 -2
- package/dist/components/editor/WEditor.d.ts +0 -13
- package/dist/components/editor/sandpack-file-explorer/CreateNewNode.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/Example.d.ts +0 -4
- package/dist/components/editor/sandpack-file-explorer/FileTreeExplorer.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/SandpackFilesProvider.d.ts +0 -24
- package/dist/components/editor/sandpack-file-explorer/SingleInputForm.d.ts +0 -8
- package/dist/components/editor/sandpack-file-explorer/index.d.ts +0 -6
- package/dist/components/editor/sandpack-file-explorer/types.d.ts +0 -18
- package/dist/components/editor/sandpack-file-explorer/utils/arrayToObject.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/utils/buildPath.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/deepMerge.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/deleteKeys.d.ts +0 -4
- package/dist/components/editor/sandpack-file-explorer/utils/directoryFileMap.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/utils/fiindParentPath.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/utils/flattenObject.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/getEntryFile.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/getRemovedKeys.d.ts +0 -5
- package/dist/components/editor/sandpack-file-explorer/utils/index.d.ts +0 -12
- package/dist/components/editor/sandpack-file-explorer/utils/mergeHierarchicalArray.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/removeHiddenEntries.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/utils/toHierarchicalArray.d.ts +0 -3
- package/dist/components/editor/utils/map.d.ts +0 -4
- package/dist/consoleHook-59e792cb-0fba2dba.js +0 -168
- package/dist/index-3417dbcd.js +0 -316
- package/dist/index-585bceb7-39d610b1.js +0 -8813
- package/dist/index-6426660e.js +0 -32172
- package/dist/index-a63bd288.js +0 -1104
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -5
- package/dist/index.umd.js +0 -779
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { d as h, i as M } from "./index-6426660e.js";
|
|
2
|
-
var k = (
|
|
3
|
-
/** @class */
|
|
4
|
-
function() {
|
|
5
|
-
function t() {
|
|
6
|
-
this.listeners = {}, this.listenersCount = 0, this.channelId = Math.floor(Math.random() * 1e6), this.listeners = [];
|
|
7
|
-
}
|
|
8
|
-
return t.prototype.cleanup = function() {
|
|
9
|
-
this.listeners = {}, this.listenersCount = 0;
|
|
10
|
-
}, t.prototype.dispatch = function(r) {
|
|
11
|
-
Object.values(this.listeners).forEach(function(e) {
|
|
12
|
-
return e(r);
|
|
13
|
-
});
|
|
14
|
-
}, t.prototype.listener = function(r) {
|
|
15
|
-
var e = this;
|
|
16
|
-
if (typeof r != "function")
|
|
17
|
-
return function() {
|
|
18
|
-
};
|
|
19
|
-
var s = this.listenersCount;
|
|
20
|
-
return this.listeners[s] = r, this.listenersCount++, function() {
|
|
21
|
-
delete e.listeners[s];
|
|
22
|
-
};
|
|
23
|
-
}, t;
|
|
24
|
-
}()
|
|
25
|
-
);
|
|
26
|
-
function v(t) {
|
|
27
|
-
return /[a-zA-Z.]/.test(t);
|
|
28
|
-
}
|
|
29
|
-
function b(t) {
|
|
30
|
-
return /[a-zA-Z]/.test(t);
|
|
31
|
-
}
|
|
32
|
-
function S(t) {
|
|
33
|
-
return /\s/.test(t);
|
|
34
|
-
}
|
|
35
|
-
function y(t) {
|
|
36
|
-
return /[&|]/.test(t);
|
|
37
|
-
}
|
|
38
|
-
function g(t) {
|
|
39
|
-
return /-/.test(t);
|
|
40
|
-
}
|
|
41
|
-
function w(t) {
|
|
42
|
-
return /["']/.test(t);
|
|
43
|
-
}
|
|
44
|
-
function _(t) {
|
|
45
|
-
return b(t) && t === t.toUpperCase();
|
|
46
|
-
}
|
|
47
|
-
var a;
|
|
48
|
-
(function(t) {
|
|
49
|
-
t.OR = "OR", t.AND = "AND", t.PIPE = "PIPE", t.Command = "Command", t.Argument = "Argument", t.String = "String", t.EnvVar = "EnvVar";
|
|
50
|
-
})(a || (a = {}));
|
|
51
|
-
var O = /* @__PURE__ */ new Map([
|
|
52
|
-
["&&", { type: a.AND }],
|
|
53
|
-
["||", { type: a.OR }],
|
|
54
|
-
["|", { type: a.PIPE }],
|
|
55
|
-
["-", { type: a.Argument }]
|
|
56
|
-
]);
|
|
57
|
-
function E(t) {
|
|
58
|
-
var r = 0, e = [];
|
|
59
|
-
function s() {
|
|
60
|
-
for (var n = ""; v(t[r]) && r < t.length; )
|
|
61
|
-
n += t[r], r++;
|
|
62
|
-
return { type: a.Command, value: n };
|
|
63
|
-
}
|
|
64
|
-
function f() {
|
|
65
|
-
for (var n = ""; y(t[r]) && r < t.length; )
|
|
66
|
-
n += t[r], r++;
|
|
67
|
-
return O.get(n);
|
|
68
|
-
}
|
|
69
|
-
function d() {
|
|
70
|
-
for (var n = ""; (g(t[r]) || b(t[r])) && r < t.length; )
|
|
71
|
-
n += t[r], r++;
|
|
72
|
-
return { type: a.Argument, value: n };
|
|
73
|
-
}
|
|
74
|
-
function c() {
|
|
75
|
-
var n = t[r], u = t[r];
|
|
76
|
-
for (r++; t[r] !== n && r < t.length; )
|
|
77
|
-
u += t[r], r++;
|
|
78
|
-
return u += t[r], r++, { type: a.String, value: u };
|
|
79
|
-
}
|
|
80
|
-
function p() {
|
|
81
|
-
for (var n = {}, u = function() {
|
|
82
|
-
for (var l = "", o = ""; t[r] !== "=" && r < t.length; )
|
|
83
|
-
l += t[r], r++;
|
|
84
|
-
for (t[r] === "=" && r++; t[r] !== " " && r < t.length; )
|
|
85
|
-
o += t[r], r++;
|
|
86
|
-
n[l] = o;
|
|
87
|
-
}; _(t[r]) && r < t.length; )
|
|
88
|
-
u(), r++;
|
|
89
|
-
return { type: a.EnvVar, value: n };
|
|
90
|
-
}
|
|
91
|
-
for (; r < t.length; ) {
|
|
92
|
-
var i = t[r];
|
|
93
|
-
if (S(i)) {
|
|
94
|
-
r++;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
switch (!0) {
|
|
98
|
-
case _(i):
|
|
99
|
-
e.push(p());
|
|
100
|
-
break;
|
|
101
|
-
case v(i):
|
|
102
|
-
e.push(s());
|
|
103
|
-
break;
|
|
104
|
-
case y(i):
|
|
105
|
-
e.push(f());
|
|
106
|
-
break;
|
|
107
|
-
case g(i):
|
|
108
|
-
e.push(d());
|
|
109
|
-
break;
|
|
110
|
-
case w(i):
|
|
111
|
-
e.push(c());
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
throw new Error("Unknown character: ".concat(i));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return e;
|
|
118
|
-
}
|
|
119
|
-
var T = 0;
|
|
120
|
-
function z() {
|
|
121
|
-
var t = Date.now(), r = Math.round(Math.random() * 1e4), e = T += 1;
|
|
122
|
-
return (+"".concat(t).concat(r).concat(e)).toString(16);
|
|
123
|
-
}
|
|
124
|
-
var A = function(t) {
|
|
125
|
-
return typeof t == "string" ? new TextEncoder().encode(t) : t;
|
|
126
|
-
}, C = function(t) {
|
|
127
|
-
return typeof t == "string" ? t : new TextDecoder().decode(t);
|
|
128
|
-
}, D = function(t) {
|
|
129
|
-
return Object.entries(t).reduce(function(r, e) {
|
|
130
|
-
var s = e[0], f = e[1];
|
|
131
|
-
return r[s] = A(f.code), r;
|
|
132
|
-
}, {});
|
|
133
|
-
}, I = function(t) {
|
|
134
|
-
var r = {}, e = ["dev", "start"];
|
|
135
|
-
try {
|
|
136
|
-
r = JSON.parse(t).scripts;
|
|
137
|
-
} catch (c) {
|
|
138
|
-
throw h("Could not parse package.json file: " + c.message);
|
|
139
|
-
}
|
|
140
|
-
M(r, "Failed to start. Please provide a `start` or `dev` script on the package.json");
|
|
141
|
-
for (var s = function(c) {
|
|
142
|
-
if (e[c] in r) {
|
|
143
|
-
var p = e[c], i = r[p], n = {}, u = "", l = [];
|
|
144
|
-
return E(i).forEach(function(o) {
|
|
145
|
-
var m = u === "";
|
|
146
|
-
o.type === a.EnvVar && (n = o.value), o.type === a.Command && m && (u = o.value), (o.type === a.Argument || !m && o.type === a.Command) && l.push(o.value);
|
|
147
|
-
}), { value: [u, l, { env: n }] };
|
|
148
|
-
}
|
|
149
|
-
}, f = 0; f < e.length; f++) {
|
|
150
|
-
var d = s(f);
|
|
151
|
-
if (typeof d == "object")
|
|
152
|
-
return d.value;
|
|
153
|
-
}
|
|
154
|
-
throw h("Failed to start. Please provide a `start` or `dev` script on the package.json");
|
|
155
|
-
}, N = function(t) {
|
|
156
|
-
return typeof t == "string" ? t : typeof t == "object" && "message" in t ? t.message : h("The server could not be reached. Make sure that the node script is running and that a port has been started.");
|
|
157
|
-
}, P = `var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={},n={};!function(t){t.__esModule=!0,t.default=["log","debug","info","warn","error","table","clear","time","timeEnd","count","assert","command","result"]}(n);var a,o={},i={};(a=i).__esModule=!0,a.default=function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+"-"+Date.now()};var u={},s={__esModule:!0};s.update=s.state=void 0,s.update=function(t){s.state=t};var f={},c={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.initialState=void 0,r.initialState={timings:{},count:{}};var n=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};r.default=function(t,a){var o,i,u;switch(void 0===t&&(t=r.initialState),a.type){case"COUNT":var s=t.count[a.name]||0;return e(e({},t),{count:e(e({},t.count),(o={},o[a.name]=s+1,o))});case"TIME_START":return e(e({},t),{timings:e(e({},t.timings),(i={},i[a.name]={start:n()},i))});case"TIME_END":var f=t.timings[a.name],c=n(),l=c-f.start;return e(e({},t),{timings:e(e({},t.timings),(u={},u[a.name]=e(e({},f),{end:c,time:l}),u))});default:return t}}}(c),function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var n=e(c),a=s;r.default=function(t){a.update(n.default(a.state,t))}}(f);var l={__esModule:!0};l.timeEnd=l.timeStart=l.count=void 0,l.count=function(t){return{type:"COUNT",name:t}},l.timeStart=function(t){return{type:"TIME_START",name:t}},l.timeEnd=function(t){return{type:"TIME_END",name:t}};var d=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};u.__esModule=!0,u.stop=u.start=void 0;var p=s,h=d(f),m=l;u.start=function(t){h.default(m.timeStart(t))},u.stop=function(t){var r=null===p.state||void 0===p.state?void 0:p.state.timings[t];return r&&!r.end?(h.default(m.timeEnd(t)),{method:"log",data:[t+": "+p.state.timings[t].time+"ms"]}):{method:"warn",data:["Timer '"+t+"' does not exist"]}};var y={},v=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};y.__esModule=!0,y.increment=void 0;var _=s,b=v(f),g=l;y.increment=function(t){return b.default(g.count(t)),{method:"log",data:[t+": "+_.state.count[t]]}};var M={},T=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n};M.__esModule=!0,M.test=void 0,M.test=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return!t&&(0===r.length&&r.push("console.assert"),{method:"error",data:T(["Assertion failed:"],r)})},function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)},n=t&&t.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),a=t&&t.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),o=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)"default"!==e&&Object.prototype.hasOwnProperty.call(t,e)&&n(r,t,e);return a(r,t),r},s=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n},f=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var c=f(i),l=o(u),d=o(y),p=o(M);r.default=function(t,r,n){var a=n||c.default();switch(t){case"clear":return{method:t,id:a};case"count":return!!(o="string"==typeof r[0]?r[0]:"default")&&e(e({},d.increment(o)),{id:a});case"time":case"timeEnd":var o;return!!(o="string"==typeof r[0]?r[0]:"default")&&("time"===t?(l.start(o),!1):e(e({},l.stop(o)),{id:a}));case"assert":if(0!==r.length){var i=p.test.apply(p,s([r[0]],r.slice(1)));if(i)return e(e({},i),{id:a})}return!1;case"error":return{method:t,id:a,data:r.map((function(t){try{return t.stack||t}catch(r){return t}}))};default:return{method:t,id:a,data:r}}}}(o);var S={},O={};!function(t){var r;t.__esModule=!0,function(t){t[t.infinity=0]="infinity",t[t.minusInfinity=1]="minusInfinity",t[t.minusZero=2]="minusZero"}(r||(r={})),t.default={type:"Arithmetic",lookup:Number,shouldTransform:function(t,r){return"number"===t&&(r===1/0||r===-1/0||function(t){return 1/t==-1/0}(r))},toSerializable:function(t){return t===1/0?r.infinity:t===-1/0?r.minusInfinity:r.minusZero},fromSerializable:function(t){return t===r.infinity?1/0:t===r.minusInfinity?-1/0:t===r.minusZero?-0:t}}}(O);var w={};!function(t){t.__esModule=!0,t.default={type:"Function",lookup:Function,shouldTransform:function(t,r){return"function"==typeof r},toSerializable:function(t){var r="";try{r=t.toString().substring(r.indexOf("{")+1,r.lastIndexOf("}"))}catch(t){}return{name:t.name,body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){try{var r=function(){};return"string"==typeof t.name&&Object.defineProperty(r,"name",{value:t.name,writable:!1}),"string"==typeof t.body&&Object.defineProperty(r,"body",{value:t.body,writable:!1}),"string"==typeof t.proto&&(r.constructor={name:t.proto}),r}catch(r){return t}}}}(w);var A={};!function(t){var r;function e(t){for(var r={},e=0,n=t.attributes;e<n.length;e++){var a=n[e];r[a.name]=a.value}return r}t.__esModule=!0,t.default={type:"HTMLElement",shouldTransform:function(t,r){return r&&r.children&&"string"==typeof r.innerHTML&&"string"==typeof r.tagName},toSerializable:function(t){return{tagName:t.tagName.toLowerCase(),attributes:e(t),innerHTML:t.innerHTML}},fromSerializable:function(t){try{var e=(r||(r=document.implementation.createHTMLDocument("sandbox"))).createElement(t.tagName);e.innerHTML=t.innerHTML;for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var o=a[n];try{e.setAttribute(o,t.attributes[o])}catch(t){}}return e}catch(r){return t}}}}(A);var j={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.default={type:"Map",shouldTransform:function(t,r){return r&&r.constructor&&"Map"===r.constructor.name},toSerializable:function(t){var r={};return t.forEach((function(t,e){var n="object"==typeof e?JSON.stringify(e):e;r[n]=t})),{name:"Map",body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){var r=t.body,n=e({},r);return"string"==typeof t.proto&&(n.constructor={name:t.proto}),n}}}(j);var z={};!function(t){t.__esModule=!0;var r="@t",e=/^#*@(t|r)$/,n=(0,eval)("this"),a="function"==typeof ArrayBuffer,o="function"==typeof Map,i="function"==typeof Set,u=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],s=Array.prototype.slice,f={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}},c=function(){function t(t,r){this.references=t,this.transforms=r,this.transformsMap=this._makeTransformsMap(),this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}return t._createRefMark=function(t){var r=Object.create(null);return r["@r"]=t,r},t.prototype._createCircularCandidate=function(t,r,e){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:r,key:e,refIdx:-1})},t.prototype._applyTransform=function(t,e,n,a){var o=Object.create(null),i=a.toSerializable(t);return"object"==typeof i&&this._createCircularCandidate(t,e,n),o[r]=a.type,o.data=this._handleValue((function(){return i}),e,n),o},t.prototype._handleArray=function(t){for(var r=[],e=function(e){r[e]=n._handleValue((function(){return t[e]}),r,e)},n=this,a=0;a<t.length;a++)e(a);return r},t.prototype._handlePlainObject=function(t){var r,n,a=Object.create(null),o=function(r){if(Reflect.has(t,r)){var n=e.test(r)?"#"+r:r;a[n]=i._handleValue((function(){return t[r]}),a,n)}},i=this;for(var u in t)o(u);var s=null===(n=null===(r=null==t?void 0:t.__proto__)||void 0===r?void 0:r.constructor)||void 0===n?void 0:n.name;return s&&"Object"!==s&&(a.constructor={name:s}),a},t.prototype._handleObject=function(t,r,e){return this._createCircularCandidate(t,r,e),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},t.prototype._ensureCircularReference=function(r){var e=this.circularCandidates.indexOf(r);if(e>-1){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),t._createRefMark(n.refIdx)}return null},t.prototype._handleValue=function(t,r,e){try{var n=t(),a=typeof n,o="object"===a&&null!==n;if(o){var i=this._ensureCircularReference(n);if(i)return i}var u=this._findTransform(a,n);return u?this._applyTransform(n,r,e,u):o?this._handleObject(n,r,e):n}catch(t){try{return this._handleValue((function(){return t instanceof Error?t:new Error(t)}),r,e)}catch(t){return null}}},t.prototype._makeTransformsMap=function(){if(o){var t=new Map;return this.transforms.forEach((function(r){r.lookup&&t.set(r.lookup,r)})),t}},t.prototype._findTransform=function(t,r){if(o&&r&&r.constructor&&(null==(a=this.transformsMap.get(r.constructor))?void 0:a.shouldTransform(t,r)))return a;for(var e=0,n=this.transforms;e<n.length;e++){var a;if((a=n[e]).shouldTransform(t,r))return a}},t.prototype.transform=function(){for(var r=this,e=[this._handleValue((function(){return r.references}),null,null)],n=0,a=this.circularCandidatesDescrs;n<a.length;n++){var o=a[n];o.refIdx>0&&(e[o.refIdx]=o.parent[o.key],o.parent[o.key]=t._createRefMark(o.refIdx))}return e},t}(),l=function(){function t(t,r){this.activeTransformsStack=[],this.visitedRefs=Object.create(null),this.references=t,this.transformMap=r}return t.prototype._handlePlainObject=function(t){var r=Object.create(null);for(var n in"constructor"in t&&(t.constructor&&"string"==typeof t.constructor.name||(t.constructor={name:"Object"})),t)t.hasOwnProperty(n)&&(this._handleValue(t[n],t,n),e.test(n)&&(r[n.substring(1)]=t[n],delete t[n]));for(var a in r)t[a]=r[a]},t.prototype._handleTransformedObject=function(t,e,n){var a=t[r],o=this.transformMap[a];if(!o)throw new Error("Can't find transform for \\""+a+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=o.fromSerializable(t.data)},t.prototype._handleCircularSelfRefDuringTransform=function(t,r,e){var n=this.references;Object.defineProperty(r,e,{val:void 0,configurable:!0,enumerable:!0,get:function(){return void 0===this.val&&(this.val=n[t]),this.val},set:function(t){this.val=t}})},t.prototype._handleCircularRef=function(t,r,e){this.activeTransformsStack.includes(this.references[t])?this._handleCircularSelfRefDuringTransform(t,r,e):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),r[e]=this.references[t])},t.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var a=t["@r"];if(void 0!==a)this._handleCircularRef(a,e,n);else if(t[r])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var o=0;o<t.length;o++)this._handleValue(t[o],t,o);else this._handlePlainObject(t)}},t.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]},t}(),d=[{type:"[[NaN]]",shouldTransform:function(t,r){return"number"===t&&isNaN(r)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",lookup:Date,shouldTransform:function(t,r){return r instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var r=new Date;return r.setTime(t),r}},{type:"[[RegExp]]",lookup:RegExp,shouldTransform:function(t,r){return r instanceof RegExp},toSerializable:function(t){var r={src:t.source,flags:""};return t.globalThis&&(r.flags+="g"),t.ignoreCase&&(r.flags+="i"),t.multiline&&(r.flags+="m"),r},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",lookup:Error,shouldTransform:function(t,r){return r instanceof Error},toSerializable:function(t){var r,e;return t.stack||null===(e=(r=Error).captureStackTrace)||void 0===e||e.call(r,t),{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var r=new(n[t.name]||Error)(t.message);return r.stack=t.stack,r}},{type:"[[ArrayBuffer]]",lookup:a&&ArrayBuffer,shouldTransform:function(t,r){return a&&r instanceof ArrayBuffer},toSerializable:function(t){var r=new Int8Array(t);return s.call(r)},fromSerializable:function(t){if(a){var r=new ArrayBuffer(t.length);return new Int8Array(r).set(t),r}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,r){if(a)return ArrayBuffer.isView(r)&&!(r instanceof DataView);for(var e=0,o=u;e<o.length;e++){var i=o[e];if("function"==typeof n[i]&&r instanceof n[i])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:s.call(t)}},fromSerializable:function(t){return"function"==typeof n[t.ctorName]?new n[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",lookup:o&&Map,shouldTransform:function(t,r){return o&&r instanceof Map},toSerializable:function(t){var r=[];return t.forEach((function(t,e){r.push(e),r.push(t)})),r},fromSerializable:function(t){if(o){for(var r=new Map,e=0;e<t.length;e+=2)r.set(t[e],t[e+1]);return r}for(var n=[],a=0;a<t.length;a+=2)n.push([t[e],t[e+1]]);return n}},{type:"[[Set]]",lookup:i&&Set,shouldTransform:function(t,r){return i&&r instanceof Set},toSerializable:function(t){var r=[];return t.forEach((function(t){r.push(t)})),r},fromSerializable:function(t){if(i){for(var r=new Set,e=0;e<t.length;e++)r.add(t[e]);return r}return t}}],p=function(){function t(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||f,this.addTransforms(d)}return t.prototype.addTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},t.prototype.removeTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r],a=this.transforms.indexOf(n);a>-1&&this.transforms.splice(a,1),delete this.transformsMap[n.type]}return this},t.prototype.encode=function(t){var r=new c(t,this.transforms).transform();return this.serializer.serialize(r)},t.prototype.decode=function(t){var r=this.serializer.deserialize(t);return new l(r,this.transformsMap).transform()},t}();t.default=p}(z);var E=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};S.__esModule=!0,S.Decode=P=S.Encode=void 0;var k=E(O),C=E(w),D=E(A),I=E(j),N=E(z),R=[D.default,C.default,k.default,I.default],x=new N.default;x.addTransforms(R);var P=S.Encode=function(t){return JSON.parse(x.encode(t))};S.Decode=function(t){return x.decode(JSON.stringify(t))},function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var a=e(n),i=e(o),u=S;r.default=function(t,r,e){void 0===e&&(e=!0);for(var n=t,o={pointers:{},src:{npm:"https://npmjs.com/package/console-feed",github:"https://github.com/samdenty99/console-feed"}},s=function(t){var a=n[t];n[t]=function(){a.apply(this,arguments);var n=[].slice.call(arguments);setTimeout((function(){var a=i.default(t,n);if(a){var o=a;e&&(o=u.Encode(a)),r(o,a)}}))},o.pointers[t]=a},f=0,c=a.default;f<c.length;f++)s(c[f]);return n.feed=o,n}}(e),r(e)(window.console,(function(t){var r=P(t);parent.postMessage({type:"console",codesandbox:!0,log:Array.isArray(r)?r[0]:r,channelId:scope.channelId},"*")}));
|
|
158
|
-
`;
|
|
159
|
-
export {
|
|
160
|
-
k as E,
|
|
161
|
-
D as a,
|
|
162
|
-
z as b,
|
|
163
|
-
P as c,
|
|
164
|
-
I as f,
|
|
165
|
-
N as g,
|
|
166
|
-
C as r,
|
|
167
|
-
A as w
|
|
168
|
-
};
|
package/dist/index-3417dbcd.js
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { _ as L, e as w, c as u, f as O, d as S, S as I, g as k, n as x, h as m, a as g, b as y, j as _ } from "./index-6426660e.js";
|
|
2
|
-
import { S as R } from "./base-80a1f760-22b3368a.js";
|
|
3
|
-
import "react";
|
|
4
|
-
var j = (
|
|
5
|
-
/** @class */
|
|
6
|
-
function() {
|
|
7
|
-
function a(i, t, r) {
|
|
8
|
-
var o = this;
|
|
9
|
-
this.type = i, this.handleMessage = t, this.protocol = r, this._disposeMessageListener = this.protocol.channelListen(function(e) {
|
|
10
|
-
return g(o, void 0, void 0, function() {
|
|
11
|
-
var n, d, l, c, l;
|
|
12
|
-
return y(this, function(p) {
|
|
13
|
-
switch (p.label) {
|
|
14
|
-
case 0:
|
|
15
|
-
if (!(e.type === this.getTypeId() && e.method))
|
|
16
|
-
return [3, 4];
|
|
17
|
-
n = e, p.label = 1;
|
|
18
|
-
case 1:
|
|
19
|
-
return p.trys.push([1, 3, , 4]), [4, this.handleMessage(n)];
|
|
20
|
-
case 2:
|
|
21
|
-
return d = p.sent(), l = {
|
|
22
|
-
type: this.getTypeId(),
|
|
23
|
-
msgId: n.msgId,
|
|
24
|
-
result: d
|
|
25
|
-
}, this.protocol.dispatch(l), [3, 4];
|
|
26
|
-
case 3:
|
|
27
|
-
return c = p.sent(), l = {
|
|
28
|
-
type: this.getTypeId(),
|
|
29
|
-
msgId: n.msgId,
|
|
30
|
-
error: {
|
|
31
|
-
message: c.message
|
|
32
|
-
}
|
|
33
|
-
}, this.protocol.dispatch(l), [3, 4];
|
|
34
|
-
case 4:
|
|
35
|
-
return [
|
|
36
|
-
2
|
|
37
|
-
/*return*/
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return a.prototype.getTypeId = function() {
|
|
45
|
-
return "protocol-".concat(this.type);
|
|
46
|
-
}, a.prototype.dispose = function() {
|
|
47
|
-
this._disposeMessageListener();
|
|
48
|
-
}, a;
|
|
49
|
-
}()
|
|
50
|
-
), C = (
|
|
51
|
-
/** @class */
|
|
52
|
-
function() {
|
|
53
|
-
function a(i, t) {
|
|
54
|
-
this.globalListeners = {}, this.globalListenersCount = 0, this.channelListeners = {}, this.channelListenersCount = 0, this.channelId = Math.floor(Math.random() * 1e6), this.frameWindow = i.contentWindow, this.origin = t, this.globalListeners = [], this.channelListeners = [], this.eventListener = this.eventListener.bind(this), typeof window < "u" && window.addEventListener("message", this.eventListener);
|
|
55
|
-
}
|
|
56
|
-
return a.prototype.cleanup = function() {
|
|
57
|
-
window.removeEventListener("message", this.eventListener), this.globalListeners = {}, this.channelListeners = {}, this.globalListenersCount = 0, this.channelListenersCount = 0;
|
|
58
|
-
}, a.prototype.register = function() {
|
|
59
|
-
this.frameWindow && this.frameWindow.postMessage({
|
|
60
|
-
type: "register-frame",
|
|
61
|
-
origin: document.location.origin,
|
|
62
|
-
id: this.channelId
|
|
63
|
-
}, this.origin);
|
|
64
|
-
}, a.prototype.dispatch = function(i) {
|
|
65
|
-
this.frameWindow && this.frameWindow.postMessage(u({ $id: this.channelId, codesandbox: !0 }, i), this.origin);
|
|
66
|
-
}, a.prototype.globalListen = function(i) {
|
|
67
|
-
var t = this;
|
|
68
|
-
if (typeof i != "function")
|
|
69
|
-
return function() {
|
|
70
|
-
};
|
|
71
|
-
var r = this.globalListenersCount;
|
|
72
|
-
return this.globalListeners[r] = i, this.globalListenersCount++, function() {
|
|
73
|
-
delete t.globalListeners[r];
|
|
74
|
-
};
|
|
75
|
-
}, a.prototype.channelListen = function(i) {
|
|
76
|
-
var t = this;
|
|
77
|
-
if (typeof i != "function")
|
|
78
|
-
return function() {
|
|
79
|
-
};
|
|
80
|
-
var r = this.channelListenersCount;
|
|
81
|
-
return this.channelListeners[r] = i, this.channelListenersCount++, function() {
|
|
82
|
-
delete t.channelListeners[r];
|
|
83
|
-
};
|
|
84
|
-
}, a.prototype.eventListener = function(i) {
|
|
85
|
-
if (i.source === this.frameWindow) {
|
|
86
|
-
var t = i.data;
|
|
87
|
-
t.codesandbox && (Object.values(this.globalListeners).forEach(function(r) {
|
|
88
|
-
return r(t);
|
|
89
|
-
}), t.$id === this.channelId && Object.values(this.channelListeners).forEach(function(r) {
|
|
90
|
-
return r(t);
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
}, a;
|
|
94
|
-
}()
|
|
95
|
-
), P = 50;
|
|
96
|
-
function E(a, i) {
|
|
97
|
-
if (!a)
|
|
98
|
-
return "static";
|
|
99
|
-
var t = a.dependencies, r = t === void 0 ? {} : t, o = a.devDependencies, e = o === void 0 ? {} : o, n = m(m([], Object.keys(r), !0), Object.keys(e), !0), d = Object.keys(i), c = ["@adonisjs/framework", "@adonisjs/core"];
|
|
100
|
-
if (n.some(function(s) {
|
|
101
|
-
return c.indexOf(s) > -1;
|
|
102
|
-
}))
|
|
103
|
-
return "adonis";
|
|
104
|
-
var l = ["nuxt", "nuxt-edge", "nuxt-ts", "nuxt-ts-edge", "nuxt3"];
|
|
105
|
-
if (n.some(function(s) {
|
|
106
|
-
return l.indexOf(s) > -1;
|
|
107
|
-
}))
|
|
108
|
-
return "nuxt";
|
|
109
|
-
if (n.indexOf("next") > -1)
|
|
110
|
-
return "next";
|
|
111
|
-
var p = [
|
|
112
|
-
"apollo-server",
|
|
113
|
-
"apollo-server-express",
|
|
114
|
-
"apollo-server-hapi",
|
|
115
|
-
"apollo-server-koa",
|
|
116
|
-
"apollo-server-lambda",
|
|
117
|
-
"apollo-server-micro"
|
|
118
|
-
];
|
|
119
|
-
if (n.some(function(s) {
|
|
120
|
-
return p.indexOf(s) > -1;
|
|
121
|
-
}))
|
|
122
|
-
return "apollo";
|
|
123
|
-
if (n.indexOf("mdx-deck") > -1)
|
|
124
|
-
return "mdx-deck";
|
|
125
|
-
if (n.indexOf("gridsome") > -1)
|
|
126
|
-
return "gridsome";
|
|
127
|
-
if (n.indexOf("vuepress") > -1)
|
|
128
|
-
return "vuepress";
|
|
129
|
-
if (n.indexOf("ember-cli") > -1)
|
|
130
|
-
return "ember";
|
|
131
|
-
if (n.indexOf("sapper") > -1)
|
|
132
|
-
return "sapper";
|
|
133
|
-
if (n.indexOf("gatsby") > -1)
|
|
134
|
-
return "gatsby";
|
|
135
|
-
if (n.indexOf("quasar") > -1)
|
|
136
|
-
return "quasar";
|
|
137
|
-
if (n.indexOf("@docusaurus/core") > -1)
|
|
138
|
-
return "docusaurus";
|
|
139
|
-
if (n.indexOf("remix") > -1)
|
|
140
|
-
return "remix";
|
|
141
|
-
if (n.indexOf("astro") > -1)
|
|
142
|
-
return "node";
|
|
143
|
-
if (d.some(function(s) {
|
|
144
|
-
return s.endsWith(".re");
|
|
145
|
-
}))
|
|
146
|
-
return "reason";
|
|
147
|
-
var b = ["parcel-bundler", "parcel"];
|
|
148
|
-
if (n.some(function(s) {
|
|
149
|
-
return b.indexOf(s) > -1;
|
|
150
|
-
}))
|
|
151
|
-
return "parcel";
|
|
152
|
-
var h = ["@dojo/core", "@dojo/framework"];
|
|
153
|
-
if (n.some(function(s) {
|
|
154
|
-
return h.indexOf(s) > -1;
|
|
155
|
-
}))
|
|
156
|
-
return "@dojo/cli-create-app";
|
|
157
|
-
if (n.indexOf("@nestjs/core") > -1 || n.indexOf("@nestjs/common") > -1)
|
|
158
|
-
return "nest";
|
|
159
|
-
if (n.indexOf("react-styleguidist") > -1)
|
|
160
|
-
return "styleguidist";
|
|
161
|
-
if (n.indexOf("react-scripts") > -1)
|
|
162
|
-
return "create-react-app";
|
|
163
|
-
if (n.indexOf("react-scripts-ts") > -1)
|
|
164
|
-
return "create-react-app-typescript";
|
|
165
|
-
if (n.indexOf("@angular/core") > -1)
|
|
166
|
-
return "angular-cli";
|
|
167
|
-
if (n.indexOf("preact-cli") > -1)
|
|
168
|
-
return "preact-cli";
|
|
169
|
-
if (n.indexOf("@sveltech/routify") > -1 || n.indexOf("@roxi/routify") > -1 || n.indexOf("vite") > -1 || n.indexOf("@frontity/core") > -1)
|
|
170
|
-
return "node";
|
|
171
|
-
if (n.indexOf("svelte") > -1)
|
|
172
|
-
return "svelte";
|
|
173
|
-
if (n.indexOf("vue") > -1)
|
|
174
|
-
return "vue-cli";
|
|
175
|
-
if (n.indexOf("cx") > -1)
|
|
176
|
-
return "cxjs";
|
|
177
|
-
var f = [
|
|
178
|
-
"express",
|
|
179
|
-
"koa",
|
|
180
|
-
"nodemon",
|
|
181
|
-
"ts-node",
|
|
182
|
-
"@tensorflow/tfjs-node",
|
|
183
|
-
"webpack-dev-server",
|
|
184
|
-
"snowpack"
|
|
185
|
-
];
|
|
186
|
-
if (n.some(function(s) {
|
|
187
|
-
return f.indexOf(s) > -1;
|
|
188
|
-
}) || Object.keys(r).length >= P)
|
|
189
|
-
return "node";
|
|
190
|
-
}
|
|
191
|
-
var v, N = "https://".concat((v = "2.13.8") === null || v === void 0 ? void 0 : v.replace(/\./g, "-"), "-sandpack.codesandbox.io/"), T = (
|
|
192
|
-
/** @class */
|
|
193
|
-
function(a) {
|
|
194
|
-
L(i, a);
|
|
195
|
-
function i(t, r, o) {
|
|
196
|
-
o === void 0 && (o = {});
|
|
197
|
-
var e = a.call(this, t, r, o) || this;
|
|
198
|
-
if (e.getTranspilerContext = function() {
|
|
199
|
-
return new Promise(function(d) {
|
|
200
|
-
var c = e.listen(function(l) {
|
|
201
|
-
l.type === "transpiler-context" && (d(l.data), c());
|
|
202
|
-
});
|
|
203
|
-
e.dispatch({ type: "get-transpiler-context" });
|
|
204
|
-
});
|
|
205
|
-
}, e.bundlerURL = o.bundlerURL || N, o.teamId && (e.bundlerURL = e.bundlerURL.replace("https://", "https://" + o.teamId + "-") + "?cache=".concat(Date.now())), e.bundlerState = void 0, e.errors = [], e.status = "initializing", typeof t == "string") {
|
|
206
|
-
e.selector = t;
|
|
207
|
-
var n = document.querySelector(t);
|
|
208
|
-
x(n, "The element '".concat(t, "' was not found")), e.element = n, e.iframe = document.createElement("iframe"), e.initializeElement();
|
|
209
|
-
} else
|
|
210
|
-
e.element = t, e.iframe = t;
|
|
211
|
-
return e.iframe.getAttribute("sandbox") || (e.iframe.setAttribute("sandbox", "allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"), e.iframe.setAttribute("allow", "accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;")), e.setLocationURLIntoIFrame(), e.iframeProtocol = new C(e.iframe, e.bundlerURL), e.unsubscribeGlobalListener = e.iframeProtocol.globalListen(function(d) {
|
|
212
|
-
d.type !== "initialized" || !e.iframe.contentWindow || (e.iframeProtocol.register(), e.options.fileResolver && (e.fileResolverProtocol = new j("fs", function(c) {
|
|
213
|
-
return g(e, void 0, void 0, function() {
|
|
214
|
-
return y(this, function(l) {
|
|
215
|
-
if (c.method === "isFile")
|
|
216
|
-
return [2, this.options.fileResolver.isFile(c.params[0])];
|
|
217
|
-
if (c.method === "readFile")
|
|
218
|
-
return [2, this.options.fileResolver.readFile(c.params[0])];
|
|
219
|
-
throw new Error("Method not supported");
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}, e.iframeProtocol)), e.updateSandbox(e.sandboxSetup, !0));
|
|
223
|
-
}), e.unsubscribeChannelListener = e.iframeProtocol.channelListen(function(d) {
|
|
224
|
-
switch (d.type) {
|
|
225
|
-
case "start": {
|
|
226
|
-
e.errors = [];
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
case "status": {
|
|
230
|
-
e.status = d.status;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
case "action": {
|
|
234
|
-
d.action === "show-error" && (e.errors = m(m([], e.errors, !0), [_(d)], !1));
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case "done": {
|
|
238
|
-
e.status = "done";
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
case "state": {
|
|
242
|
-
e.bundlerState = d.state;
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}), e;
|
|
247
|
-
}
|
|
248
|
-
return i.prototype.setLocationURLIntoIFrame = function() {
|
|
249
|
-
var t, r = this.options.startRoute ? new URL(this.options.startRoute, this.bundlerURL).toString() : this.bundlerURL;
|
|
250
|
-
(t = this.iframe.contentWindow) === null || t === void 0 || t.location.replace(r), this.iframe.src = r;
|
|
251
|
-
}, i.prototype.destroy = function() {
|
|
252
|
-
this.unsubscribeChannelListener(), this.unsubscribeGlobalListener(), this.iframeProtocol.cleanup();
|
|
253
|
-
}, i.prototype.updateOptions = function(t) {
|
|
254
|
-
w(this.options, t) || (this.options = t, this.updateSandbox());
|
|
255
|
-
}, i.prototype.updateSandbox = function(t, r) {
|
|
256
|
-
var o, e, n, d;
|
|
257
|
-
t === void 0 && (t = this.sandboxSetup), this.sandboxSetup = u(u({}, this.sandboxSetup), t);
|
|
258
|
-
var c = this.getFiles(), l = Object.keys(c).reduce(function(h, f) {
|
|
259
|
-
var s;
|
|
260
|
-
return u(u({}, h), (s = {}, s[f] = {
|
|
261
|
-
code: c[f].code,
|
|
262
|
-
path: f
|
|
263
|
-
}, s));
|
|
264
|
-
}, {}), p = JSON.parse(O(this.sandboxSetup.dependencies, this.sandboxSetup.devDependencies, this.sandboxSetup.entry));
|
|
265
|
-
try {
|
|
266
|
-
p = JSON.parse(c["/package.json"].code);
|
|
267
|
-
} catch (h) {
|
|
268
|
-
console.error(S("could not parse package.json file: " + h.message));
|
|
269
|
-
}
|
|
270
|
-
var b = Object.keys(c).reduce(function(h, f) {
|
|
271
|
-
var s;
|
|
272
|
-
return u(u({}, h), (s = {}, s[f] = {
|
|
273
|
-
content: c[f].code,
|
|
274
|
-
path: f
|
|
275
|
-
}, s));
|
|
276
|
-
}, {});
|
|
277
|
-
this.dispatch(u(u({}, this.options), { type: "compile", codesandbox: !0, version: 3, isInitializationCompile: r, modules: l, reactDevTools: this.options.reactDevTools, externalResources: this.options.externalResources || [], hasFileResolver: !!this.options.fileResolver, disableDependencyPreprocessing: this.sandboxSetup.disableDependencyPreprocessing, template: this.sandboxSetup.template || E(p, b), showOpenInCodeSandbox: (o = this.options.showOpenInCodeSandbox) !== null && o !== void 0 ? o : !0, showErrorScreen: (e = this.options.showErrorScreen) !== null && e !== void 0 ? e : !0, showLoadingScreen: (n = this.options.showLoadingScreen) !== null && n !== void 0 ? n : !1, skipEval: this.options.skipEval || !1, clearConsoleDisabled: !this.options.clearConsoleOnFirstCompile, logLevel: (d = this.options.logLevel) !== null && d !== void 0 ? d : I.Info, customNpmRegistries: this.options.customNpmRegistries, teamId: this.options.teamId, sandboxId: this.options.sandboxId }));
|
|
278
|
-
}, i.prototype.dispatch = function(t) {
|
|
279
|
-
t.type === "refresh" && this.setLocationURLIntoIFrame(), this.iframeProtocol.dispatch(t);
|
|
280
|
-
}, i.prototype.listen = function(t) {
|
|
281
|
-
return this.iframeProtocol.channelListen(t);
|
|
282
|
-
}, i.prototype.getCodeSandboxURL = function() {
|
|
283
|
-
var t = this.getFiles(), r = Object.keys(t).reduce(function(o, e) {
|
|
284
|
-
var n;
|
|
285
|
-
return u(u({}, o), (n = {}, n[e.replace("/", "")] = {
|
|
286
|
-
content: t[e].code,
|
|
287
|
-
isBinary: !1
|
|
288
|
-
}, n));
|
|
289
|
-
}, {});
|
|
290
|
-
return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1", {
|
|
291
|
-
method: "POST",
|
|
292
|
-
body: JSON.stringify({ files: r }),
|
|
293
|
-
headers: {
|
|
294
|
-
Accept: "application/json",
|
|
295
|
-
"Content-Type": "application/json"
|
|
296
|
-
}
|
|
297
|
-
}).then(function(o) {
|
|
298
|
-
return o.json();
|
|
299
|
-
}).then(function(o) {
|
|
300
|
-
return {
|
|
301
|
-
sandboxId: o.sandbox_id,
|
|
302
|
-
editorUrl: "https://codesandbox.io/s/".concat(o.sandbox_id),
|
|
303
|
-
embedUrl: "https://codesandbox.io/embed/".concat(o.sandbox_id)
|
|
304
|
-
};
|
|
305
|
-
});
|
|
306
|
-
}, i.prototype.getFiles = function() {
|
|
307
|
-
var t = this.sandboxSetup;
|
|
308
|
-
return t.files["/package.json"] === void 0 ? k(t.files, t.dependencies, t.devDependencies, t.entry) : this.sandboxSetup.files;
|
|
309
|
-
}, i.prototype.initializeElement = function() {
|
|
310
|
-
this.iframe.style.border = "0", this.iframe.style.width = this.options.width || "100%", this.iframe.style.height = this.options.height || "100%", this.iframe.style.overflow = "hidden", x(this.element.parentNode, "The given iframe does not have a parent."), this.element.parentNode.replaceChild(this.iframe, this.element);
|
|
311
|
-
}, i;
|
|
312
|
-
}(R)
|
|
313
|
-
);
|
|
314
|
-
export {
|
|
315
|
-
T as SandpackRuntime
|
|
316
|
-
};
|