@wangtaizong/components 1.0.1 → 1.0.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.
Files changed (37) hide show
  1. package/dist/base-80a1f760-daa8780a.js +23 -0
  2. package/dist/components/editor/MonacoEditor.d.ts +2 -0
  3. package/dist/components/editor/WEditor.d.ts +12 -0
  4. package/dist/components/editor/sandpack-file-explorer/CreateNewNode.d.ts +3 -0
  5. package/dist/components/editor/sandpack-file-explorer/Example.d.ts +4 -0
  6. package/dist/components/editor/sandpack-file-explorer/FileTreeExplorer.d.ts +1 -0
  7. package/dist/components/editor/sandpack-file-explorer/SandpackFilesProvider.d.ts +24 -0
  8. package/dist/components/editor/sandpack-file-explorer/SingleInputForm.d.ts +8 -0
  9. package/dist/components/editor/sandpack-file-explorer/index.d.ts +6 -0
  10. package/dist/components/editor/sandpack-file-explorer/types.d.ts +18 -0
  11. package/dist/components/editor/sandpack-file-explorer/utils/arrayToObject.d.ts +1 -0
  12. package/dist/components/editor/sandpack-file-explorer/utils/buildPath.d.ts +2 -0
  13. package/dist/components/editor/sandpack-file-explorer/utils/deepMerge.d.ts +2 -0
  14. package/dist/components/editor/sandpack-file-explorer/utils/deleteKeys.d.ts +4 -0
  15. package/dist/components/editor/sandpack-file-explorer/utils/directoryFileMap.d.ts +3 -0
  16. package/dist/components/editor/sandpack-file-explorer/utils/fiindParentPath.d.ts +1 -0
  17. package/dist/components/editor/sandpack-file-explorer/utils/flattenObject.d.ts +2 -0
  18. package/dist/components/editor/sandpack-file-explorer/utils/getEntryFile.d.ts +2 -0
  19. package/dist/components/editor/sandpack-file-explorer/utils/getRemovedKeys.d.ts +5 -0
  20. package/dist/components/editor/sandpack-file-explorer/utils/index.d.ts +12 -0
  21. package/dist/components/editor/sandpack-file-explorer/utils/mergeHierarchicalArray.d.ts +2 -0
  22. package/dist/components/editor/sandpack-file-explorer/utils/removeHiddenEntries.d.ts +3 -0
  23. package/dist/components/editor/sandpack-file-explorer/utils/toHierarchicalArray.d.ts +3 -0
  24. package/dist/components/editor/utils/map.d.ts +4 -0
  25. package/dist/consoleHook-59e792cb-9ddf7539.js +168 -0
  26. package/dist/index-2f9d96f2.js +316 -0
  27. package/dist/index-585bceb7-137dd510.js +8813 -0
  28. package/dist/index-8e5d739b.js +32180 -0
  29. package/dist/index-cb3fd099.js +1104 -0
  30. package/dist/index.d.ts +2 -3
  31. package/dist/index.es.js +3 -1640
  32. package/dist/index.umd.js +765 -21
  33. package/package.json +1 -1
  34. package/dist/components/emptyTable/EmptyDataList.d.ts +0 -7
  35. package/dist/components/multipleSelector/MutiCell.d.ts +0 -16
  36. package/dist/components/multipleSelector/MutipleSelector.d.ts +0 -40
  37. package/dist/style.css +0 -1
@@ -0,0 +1,316 @@
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-8e5d739b.js";
2
+ import { S as R } from "./base-80a1f760-daa8780a.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
+ };