@sheetxl/scripting-react 0.8.0-beta.5 → 0.8.0-beta.7
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/browser/cjs/index.cjs +14 -6
- package/browser/esm/{ChmMboMvC3r-fyiI.mjs → CKXz5vlYfTsEi1zz.mjs} +1 -1
- package/browser/esm/{B-YthIPCy4mPj2Om.mjs → DfPf0snAGn4Uk6C9.mjs} +1 -1
- package/browser/esm/{QaEJpU-DHNL8Cw91.mjs → UxWLkTf3nf2Op-PV.mjs} +2 -2
- package/browser/esm/index.mjs +359 -238
- package/node/esm/index.mjs +358 -234
- package/package.json +7 -6
- package/types/src/mergeImports.d.ts +64 -0
package/browser/esm/index.mjs
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._script-editor_1kuph_5{& .monaco-editor{position:absolute;& .margin-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;width:16px;height:16px;display:block}& .formula{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 12.106007,8.1692949 c 0.124174,-0.1578352 0.181773,-0.3565642 0.283755,-0.5271169 0.10273,-0.1715492 0.04413,-0.2027176 -0.129161,-0.2014713 -0.685452,0.00576 -1.371152,-0.00277 -2.056604,0.00501 C 10.021228,7.4479573 9.9586414,7.407817 9.9935503,7.2080883 10.145401,6.3413623 10.291269,5.4736396 10.51219,4.6213758 10.642847,4.1167002 10.782479,3.6117747 11.061498,3.1622046 11.339518,2.7138809 11.726751,2.5974365 12.2035,2.829328 c 0.398455,0.1934923 0.722604,0.4827333 0.990152,0.8340617 0.116944,0.1535968 0.27079,0.2740306 0.449073,0.1715499 0.343348,-0.1974819 0.644807,-0.4383502 0.819599,-0.826332 0.100985,-0.2244112 0.157836,-0.476001 0.04039,-0.7058977 C 14.339646,1.9840253 14.038187,1.7618584 13.707056,1.6394296 13.156999,1.4362128 12.562559,1.4840872 12.017239,1.6758341 11.38789,1.8970037 10.783727,2.2625445 10.259602,2.6724688 10.066109,2.8238217 9.8783519,2.9839017 9.7013165,3.1547035 9.0502751,3.7823067 8.5657962,4.529097 8.2246919,5.3651534 7.9823276,5.9595939 7.7888351,6.5660026 7.6913412,7.2015842 7.673637,7.318528 7.6357391,7.423253 7.5065759,7.4432009 7.3472438,7.4678879 7.1592376,7.4436995 6.9974121,7.4441728 6.6351128,7.4451447 6.2598478,7.3676233 5.9915515,7.6815496 5.8721151,7.8211835 5.7461952,7.9840062 5.6439635,8.1371045 c -0.1009847,0.1518511 -0.093255,0.3002122 0.085027,0.367535 0.1957362,0.073561 0.4528118,0.026182 0.6530361,0.0197 0.2645558,-0.00847 0.5291116,0.00501 0.7936674,-7.476e-4 0.1820229,-0.00374 0.2413669,0.030421 0.2064588,0.2358807 C 7.3487406,8.9587006 7.3095941,9.1492003 7.2804197,9.3464333 7.1804317,10.024404 7.0667304,10.700629 6.9525298,11.376606 6.7936963,12.314146 6.6371075,13.252434 6.4655575,14.188478 6.3017374,15.082631 6.1855427,15.985013 5.983074,16.873433 5.8249883,17.568607 5.7240037,18.277248 5.5556954,18.969682 5.4145655,19.550158 5.293882,20.143601 4.9722259,20.665731 4.7380909,21.045734 4.3959882,21.206312 3.9663652,21.104829 3.5778849,21.012322 3.2115961,20.866205 2.8951763,20.608631 2.6862246,20.438328 2.4473513,20.31141 2.1920214,20.458026 1.9519014,20.595915 1.7791048,20.851743 1.646453,21.088123 1.2205704,21.847879 1.915497,22.569984 2.6655289,22.684434 3.1692071,22.760986 3.666153,22.580208 4.1087416,22.356046 4.6996913,22.056582 5.2103511,21.635437 5.6387269,21.13874 5.9898058,20.731558 6.3575906,20.343327 6.6500737,19.890016 6.8450616,19.58756 7.0238427,19.274881 7.1866655,18.954471 7.7639005,17.817206 8.1227091,16.589926 8.4189318,15.354418 8.5613081,14.760227 8.716401,14.169777 8.8478064,13.572843 9.0268365,12.760724 9.1741996,11.934891 9.3083481,11.114294 9.3749255,10.707112 9.4310263,10.300679 9.5160532,9.8967389 9.5861222,9.5636133 9.6442168,9.2185186 9.6890985,8.8814035 9.7414633,8.4891827 9.990308,8.5136187 10.329668,8.4762164 c 0.286249,-0.03167 0.574492,-0.046376 0.861739,-0.067571 0.230395,-0.016703 0.494951,0.00396 0.711881,-0.088019 0.07754,-0.032911 0.147613,-0.080788 0.202719,-0.1513533 z\\"/><path d=\\"M 22.473802,7.8481382 C 22.426924,7.6912996 22.341898,7.5501696 22.231437,7.4294861 22.130452,7.3192756 21.987827,7.1749046 21.851933,7.1098255 21.411589,6.8988785 20.817398,7.0838898 20.436149,7.3422154 20.23343,7.479854 20.052405,7.6519026 19.871131,7.8167201 19.691352,7.9802913 19.517061,8.1488492 19.35723,8.3321177 19.025101,8.7128687 18.724639,9.1210479 18.436396,9.5354601 18.296263,9.7374301 17.901549,10.472252 17.781115,10.399942 17.654198,10.323892 17.495365,9.5905657 17.435023,9.3843566 17.351243,9.0978583 17.29539,8.8016361 17.161741,8.5323425 16.97922,8.1643081 16.865268,7.7623629 16.608941,7.4307332 16.325934,7.0639457 16.001036,6.9584722 15.558946,7.092371 c -0.43436,0.1314054 -0.78469,0.4049374 -1.128539,0.6819608 -0.503927,0.4056851 -0.879442,0.926319 -1.256951,1.4439609 -0.28226,0.387483 -0.284753,0.3857373 0.04488,0.7380631 0.206458,0.2211702 0.202718,0.2184272 0.389229,-0.00847 0.2663,-0.3251469 0.524872,-0.6595196 0.882433,-0.8934057 0.261315,-0.1713009 0.417904,-0.1368908 0.57948,0.1326518 0.07929,0.1326517 0.146866,0.2752777 0.200225,0.4208957 0.335619,0.9141014 0.590201,1.8541344 0.89191,2.7784594 0.03815,0.117691 -0.01122,0.193991 -0.06707,0.278519 -0.356565,0.538837 -0.719363,1.074182 -1.123054,1.578607 -0.320409,0.401198 -0.643312,0.803891 -1.073932,1.097621 -0.187757,0.128912 -0.40768,0.217679 -0.635831,0.156839 -0.233887,-0.06283 -0.37377,-0.27478 -0.587459,-0.373521 -0.006,-0.003 -0.01272,-0.0052 -0.01895,-0.0079 -0.09974,-0.04064 -0.249845,-0.0389 -0.353074,-0.01571 -0.454059,0.102482 -0.697669,0.614139 -0.790177,1.023813 -0.08379,0.371776 -0.0013,0.778209 0.261315,1.062463 0.228899,0.24785 0.572248,0.351327 0.901634,0.356315 0.189003,0.0028 0.39995,-0.04663 0.57549,-0.11445 0.670241,-0.262062 1.181649,-0.887172 1.605038,-1.441717 0.285501,-0.374517 0.550555,-0.763994 0.829573,-1.143499 0.230645,-0.313677 0.68595,-1.247726 0.81586,-1.250718 0.07854,-0.0017 0.09924,0.185762 0.114199,0.241117 0.03341,0.123675 0.06658,0.247351 0.102232,0.370279 0.167561,0.578481 0.343848,1.156464 0.525122,1.730458 0.120934,0.384242 0.315921,0.782697 0.560779,1.103356 0.07431,0.09749 0.167311,0.190749 0.26306,0.266799 0.371276,0.296972 0.838799,0.27453 1.266177,0.123177 0.191498,-0.06757 0.370029,-0.163071 0.539335,-0.275527 0.781948,-0.519886 1.340732,-1.244235 1.868598,-2.002495 0.124423,-0.178781 0.107467,-0.278769 -0.03441,-0.428127 -0.367286,-0.386237 -0.357062,-0.389727 -0.705149,0.01995 -0.261066,0.306446 -0.527117,0.612643 -0.879442,0.818851 -0.245855,0.144621 -0.413416,0.103229 -0.592696,-0.118439 -0.14861,-0.183518 -0.246353,-0.396709 -0.33138,-0.614886 -0.349831,-0.901136 -0.588954,-1.838675 -0.885177,-2.757515 -0.21743,-0.674231 -0.223414,-0.680464 0.20945,-1.248723 0.447575,-0.587708 0.875703,-1.1968602 1.462163,-1.6613914 0.431119,-0.3416031 0.73183,-0.3226534 1.129037,0.059094 0.0788,0.075801 0.207456,0.1388856 0.316919,0.1476127 0.369781,0.029674 0.691187,-0.3024566 0.880939,-0.5792304 0.188006,-0.2727835 0.259319,-0.6183768 0.163072,-0.9392845 z\\"/></svg>")}& .macro{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 7.3808594,2.8925781 c 0.6501558,0 1.3048608,0.1705676 1.8886719,0.5078125 l 9.2343747,5.3242188 c 1.167878,0.6758404 1.882813,1.9216266 1.882813,3.2675786 0,1.306438 -0.674828,2.517089 -1.783203,3.205078 L 9.2617188,20.595703 C 8.1035923,21.277644 6.6635531,21.275631 5.4960937,20.589844 4.3295773,19.917617 3.6132812,18.67473 3.6132813,17.330078 V 6.6660156 c 0,-1.3461361 0.7160606,-2.5932648 1.8828124,-3.265625 C 6.0817308,3.0628871 6.7318751,2.8925781 7.3808594,2.8925781 Z M 7.375,5.1835937 C 7.1238145,5.188954 6.883074,5.2521559 6.6601562,5.3691406 l -0.00781,0.00586 -0.00781,0.00391 C 6.1849913,5.6446615 5.9023438,6.1366335 5.9023437,6.6660156 V 17.330078 c 0,0.524949 0.2791508,1.016586 0.7363282,1.275391 0.4554716,0.266714 1.013907,0.272881 1.4785156,0.0098 l 9.2441405,-5.34375 c 0.450764,-0.263898 0.736328,-0.74603 0.736328,-1.27539 0,-0.52882 -0.290494,-1.018444 -0.742187,-1.277344 L 8.1171875,5.3789062 C 7.8951499,5.2512094 7.6461047,5.183439 7.375,5.1835937 Z\\"/></svg>")}& .autorun{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 11.999964,1.7500508 c -0.462401,0 -0.923676,0.3281109 -0.924272,0.9260918 V 13.159721 c -0.0012,1.23176 1.847315,1.231936 1.848545,0 V 2.6761426 c 5.97e-4,-0.598201 -0.461872,-0.9260918 -0.924273,-0.9260918 z m 5.998674,2.6454569 c -0.728133,0.068914 -1.207022,1.0512547 -0.5149,1.63931 1.880223,1.6037705 2.962848,3.9512403 2.962038,6.4226023 -4.23e-4,4.655627 -3.790565,8.443993 -8.445812,8.443993 -4.6552096,0 -8.443993,-3.789762 -8.443993,-8.445813 C 3.5560359,10.008191 4.6172167,7.6804932 6.4634264,6.0784841 7.4240529,5.2735715 6.1821863,3.8462722 5.2535029,4.6829783 -1.9571321,10.940557 2.4945266,22.78839 12.039992,22.749957 21.585452,22.711525 25.944958,10.82919 18.684564,4.6302147 18.515847,4.4852865 18.331563,4.4098479 18.146012,4.3955077 c -0.05049,-0.0039 -0.09883,-0.00459 -0.147374,0 z\\"/></svg>")}}}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
2
|
/**
|
|
3
|
-
* @license @sheetxl/scripting-react - Scripting React - Monaco based script editor and scripting UI for SheetXL. - v0.8.0-beta.
|
|
3
|
+
* @license @sheetxl/scripting-react - Scripting React - Monaco based script editor and scripting UI for SheetXL. - v0.8.0-beta.7
|
|
4
4
|
*
|
|
5
5
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
6
6
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
7
7
|
*/
|
|
8
|
-
import { n as e } from "./
|
|
8
|
+
import { n as e } from "./CKXz5vlYfTsEi1zz.mjs";
|
|
9
9
|
import { Suspense as t, forwardRef as n, memo as r, useEffect as i, useMemo as a, useRef as o, useState as s, version as c } from "react";
|
|
10
10
|
import { createRoot as l } from "react-dom/client";
|
|
11
11
|
import { CommonUtils as u, TimerUtils as d, defineLazyModule as f, messageKey as p } from "@sheetxl/utils";
|
|
12
12
|
import { DocTags as m } from "@sheetxl/scripting";
|
|
13
13
|
import { IScript as h } from "@sheetxl/sdk";
|
|
14
|
-
import { Command as g, lazyComponent as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { DefaultTaskPaneRegistry as
|
|
17
|
-
function
|
|
14
|
+
import { Command as g, lazyComponent as _, useCallbackRef as v, useCommands as ee, useImperativeElement as te, useLazyRetry as y, useNotifier as ne, useTranslator as re } from "@sheetxl/utils-react";
|
|
15
|
+
import { jsx as b, jsxs as ie } from "react/jsx-runtime";
|
|
16
|
+
import { DefaultTaskPaneRegistry as x, useModelListener as ae, useTaskPaneArea as S, useWorkbook as oe } from "@sheetxl/react";
|
|
17
|
+
function C(e) {
|
|
18
18
|
var t, n, r = "";
|
|
19
19
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
20
20
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
21
21
|
var i = e.length;
|
|
22
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
22
|
+
for (t = 0; t < i; t++) e[t] && (n = C(e[t])) && (r && (r += " "), r += n);
|
|
23
23
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
24
24
|
return r;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
26
|
+
function se() {
|
|
27
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = C(e)) && (r && (r += " "), r += t);
|
|
28
28
|
return r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function w(e, t) {
|
|
31
31
|
if (typeof e == "function") return e(t);
|
|
32
32
|
e && (e.current = t);
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var ce = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
35
35
|
return (t) => {
|
|
36
36
|
let n = [];
|
|
37
37
|
for (let r of e) {
|
|
38
|
-
let e =
|
|
39
|
-
n.push(i ? e : () =>
|
|
38
|
+
let e = w(r, t), i = typeof e == "function";
|
|
39
|
+
n.push(i ? e : () => w(r, null));
|
|
40
40
|
}
|
|
41
41
|
return () => {
|
|
42
42
|
for (let e of n) e();
|
|
@@ -44,9 +44,9 @@ var le = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
44
44
|
};
|
|
45
45
|
} : function(e) {
|
|
46
46
|
return (t) => {
|
|
47
|
-
for (let n of e)
|
|
47
|
+
for (let n of e) w(n, t);
|
|
48
48
|
};
|
|
49
|
-
},
|
|
49
|
+
}, T = {
|
|
50
50
|
defaultToken: "invalid",
|
|
51
51
|
tokenPostfix: ".ts",
|
|
52
52
|
keywords: /* @__PURE__ */ "abstract.any.as.asserts.bigint.boolean.break.case.catch.class.continue.const.constructor.debugger.declare.default.delete.do.else.enum.export.extends.false.finally.for.from.function.get.if.implements.import.in.infer.instanceof.interface.is.keyof.let.module.namespace.never.new.null.number.object.out.package.private.protected.public.override.readonly.require.global.return.satisfies.set.static.string.super.switch.symbol.this.throw.true.try.type.typeof.undefined.unique.unknown.var.void.while.with.yield.async.await.of".split("."),
|
|
@@ -263,7 +263,48 @@ var le = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
263
263
|
{ include: "common" }
|
|
264
264
|
]
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, E = /(?:\s|\/\/[^\n]*|\/\*[\s\S]*?\*\/)*/y, D = /(import\b\s*(?:type\s+(?!from\b))?)(?:([^'";]*?)\s*\bfrom\s*)?(['"])([^'"\n]+)\3[ \t]*;?/y, O = (e) => e.replace(/\s+/g, " ").trim(), k = (e) => {
|
|
267
|
+
let t = [], n = 0;
|
|
268
|
+
for (;;) {
|
|
269
|
+
E.lastIndex = n, E.exec(e), D.lastIndex = E.lastIndex;
|
|
270
|
+
let r = D.exec(e);
|
|
271
|
+
if (!r) return t;
|
|
272
|
+
let i = r[2] ?? "", a = r.index + r[1].length, o = i.indexOf("{"), s = i.lastIndexOf("}"), c = o >= 0 && s > o, l = c ? i.slice(0, o) + i.slice(s + 1) : i;
|
|
273
|
+
t.push({
|
|
274
|
+
start: r.index,
|
|
275
|
+
end: D.lastIndex,
|
|
276
|
+
text: r[0],
|
|
277
|
+
module: r[4],
|
|
278
|
+
quote: r[3],
|
|
279
|
+
typeOnly: /\btype\s+$/.test(r[1]),
|
|
280
|
+
binding: O(l).replace(/\s*,$/, ""),
|
|
281
|
+
names: c ? i.slice(o + 1, s).split(",").map(O).filter(Boolean) : null,
|
|
282
|
+
namesStart: a + o + 1,
|
|
283
|
+
namesEnd: a + s
|
|
284
|
+
}), n = D.lastIndex;
|
|
285
|
+
}
|
|
286
|
+
}, A = (e) => [
|
|
287
|
+
e.typeOnly,
|
|
288
|
+
e.binding,
|
|
289
|
+
e.names?.join(","),
|
|
290
|
+
e.module
|
|
291
|
+
].join("|"), le = (e) => `${e.typeOnly ? "type " : ""}${e.module}`, ue = (e, t, n) => {
|
|
292
|
+
let r = e.slice(t.namesStart, t.namesEnd), i = r.trimEnd();
|
|
293
|
+
if (i.trim() === "") return {
|
|
294
|
+
offset: t.namesStart,
|
|
295
|
+
text: ` ${n.join(", ")}${r === "" ? " " : ""}`
|
|
296
|
+
};
|
|
297
|
+
let a = t.namesStart + i.length, o = i.endsWith(","), s = i.lastIndexOf("\n");
|
|
298
|
+
if (s < 0) return {
|
|
299
|
+
offset: a,
|
|
300
|
+
text: `${o ? " " : ", "}${n.join(", ")}`
|
|
301
|
+
};
|
|
302
|
+
let c = /^[ \t]*/.exec(i.slice(s + 1))[0];
|
|
303
|
+
return {
|
|
304
|
+
offset: a,
|
|
305
|
+
text: `${o ? "" : ","}\n${c}${n.join(`,\n${c}`)}${o ? "," : ""}`
|
|
306
|
+
};
|
|
307
|
+
}, de = {
|
|
267
308
|
lightbulb: { enabled: !1 },
|
|
268
309
|
tabSize: 2,
|
|
269
310
|
acceptSuggestionOnCommitCharacter: !0,
|
|
@@ -326,10 +367,10 @@ var le = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
326
367
|
wordWrapColumn: 80,
|
|
327
368
|
wordWrapMinified: !0,
|
|
328
369
|
wrappingIndent: "none"
|
|
329
|
-
},
|
|
370
|
+
}, fe = "_script-editor_1kuph_5", pe = (e) => {
|
|
330
371
|
let t = e?.getModules();
|
|
331
372
|
return t && t.getByName(h.DEFAULT_MODULE), h.DEFAULT_MODULE;
|
|
332
|
-
},
|
|
373
|
+
}, j = (e) => e?.getModules()?.getByName(pe(e)) ?? null, M, me = f("scripting-react:monaco", async () => (function() {
|
|
333
374
|
if (typeof window > "u") return;
|
|
334
375
|
let e = window;
|
|
335
376
|
if (e.__sxlDefineShim) return;
|
|
@@ -347,9 +388,9 @@ var le = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
347
388
|
} catch {}
|
|
348
389
|
}
|
|
349
390
|
});
|
|
350
|
-
}(), import("./
|
|
351
|
-
let t =
|
|
352
|
-
return
|
|
391
|
+
}(), import("./DfPf0snAGn4Uk6C9.mjs")), { prefetch: !1 }), N = ({ error: e }) => {
|
|
392
|
+
let t = y(), n = re();
|
|
393
|
+
return ie("div", {
|
|
353
394
|
style: {
|
|
354
395
|
display: "flex",
|
|
355
396
|
flexDirection: "column",
|
|
@@ -358,20 +399,134 @@ var le = parseInt(c.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
358
399
|
gap: "8px",
|
|
359
400
|
flex: "1 1 100%"
|
|
360
401
|
},
|
|
361
|
-
children: [
|
|
402
|
+
children: [b("span", { children: e instanceof Error ? e.message : String(e) }), t ? b("button", {
|
|
362
403
|
type: "button",
|
|
363
404
|
onClick: t,
|
|
364
405
|
children: n("scriptEditor.retry")
|
|
365
406
|
}) : null]
|
|
366
407
|
});
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
var
|
|
408
|
+
}, P = _(me.load, { renderError: (e) => b(N, { error: e }) }), F = ["define", "require"], he = !1, I = "@0.8.0-beta.7";
|
|
409
|
+
I !== "@local" && I !== "@0.0.0" || (I = "");
|
|
410
|
+
var L = `https://cdn.jsdelivr.net/npm/@sheetxl/sdk${I}/types/scripting.d.ts`, R = (e) => {
|
|
370
411
|
try {
|
|
371
|
-
e.languages.setMonarchTokensProvider("typescript",
|
|
412
|
+
e.languages.setMonarchTokensProvider("typescript", T);
|
|
372
413
|
} catch {}
|
|
373
|
-
},
|
|
374
|
-
|
|
414
|
+
}, z = !1, ge = async (e, t, n) => {
|
|
415
|
+
let r = e.getModel();
|
|
416
|
+
if (!r) return;
|
|
417
|
+
let i = await (await (await t.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()), a = e.getPosition(), o = { ...a };
|
|
418
|
+
o.lineNumber = 1, o.column = 1;
|
|
419
|
+
let s = !1;
|
|
420
|
+
for (let e = a.lineNumber; e >= 1; e--) if (r.getLineContent(e).trim() === "") {
|
|
421
|
+
let t = H(i, r.getOffsetAt({
|
|
422
|
+
lineNumber: e,
|
|
423
|
+
column: 1
|
|
424
|
+
}), "function");
|
|
425
|
+
if (!t || _e(t)) {
|
|
426
|
+
s = !0, o.lineNumber = e + 1;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
{
|
|
430
|
+
let n = t.spans[0].start;
|
|
431
|
+
e = r.getPositionAt(n).lineNumber, o.lineNumber = e;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
let c = ((e, t) => {
|
|
435
|
+
let n = k(e), r = n.length > 0 ? n[n.length - 1].end : 0, i = k(t);
|
|
436
|
+
if (i.length === 0) return {
|
|
437
|
+
body: t,
|
|
438
|
+
inserts: [],
|
|
439
|
+
importsEnd: r
|
|
440
|
+
};
|
|
441
|
+
let a = "", o = 0;
|
|
442
|
+
for (let e of i) a += t.slice(o, e.start), o = e.end + (/^[ \t]*\r?\n/.exec(t.slice(e.end))?.[0].length ?? 0);
|
|
443
|
+
a = (a + t.slice(o)).replace(/^(?:[ \t]*\r?\n)+/, "");
|
|
444
|
+
let s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
445
|
+
for (let e of n) {
|
|
446
|
+
if (s.add(A(e)), !e.names) continue;
|
|
447
|
+
let t = le(e);
|
|
448
|
+
l.has(t) || l.set(t, e);
|
|
449
|
+
let n = c.get(t);
|
|
450
|
+
n || c.set(t, n = /* @__PURE__ */ new Set());
|
|
451
|
+
for (let t of e.names) n.add(t);
|
|
452
|
+
}
|
|
453
|
+
let u = /* @__PURE__ */ new Map(), d = [], f = /* @__PURE__ */ new Map();
|
|
454
|
+
for (let e of i) {
|
|
455
|
+
if (!e.names || e.binding) {
|
|
456
|
+
let t = A(e);
|
|
457
|
+
if (s.has(t)) continue;
|
|
458
|
+
s.add(t), d.push(e.text);
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
let t = le(e), n = c.get(t);
|
|
462
|
+
n || c.set(t, n = /* @__PURE__ */ new Set());
|
|
463
|
+
let r = e.typeOnly ? c.get(e.module) : void 0, i = e.names.filter((e) => !n.has(e) && !r?.has(e));
|
|
464
|
+
if (i.length === 0) continue;
|
|
465
|
+
for (let e of i) n.add(e);
|
|
466
|
+
let a = l.get(t);
|
|
467
|
+
if (a) {
|
|
468
|
+
u.set(a, [...u.get(a) ?? [], ...i]);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
let o = f.get(t);
|
|
472
|
+
if (o) {
|
|
473
|
+
o.names.push(...i), o.verbatim = !1;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
let p = {
|
|
477
|
+
statement: e,
|
|
478
|
+
names: i,
|
|
479
|
+
verbatim: i.length === e.names.length
|
|
480
|
+
};
|
|
481
|
+
f.set(t, p), d.push(p);
|
|
482
|
+
}
|
|
483
|
+
let p = [];
|
|
484
|
+
for (let [t, n] of u) p.push(ue(e, t, n));
|
|
485
|
+
if (p.sort((e, t) => e.offset - t.offset), d.length > 0) {
|
|
486
|
+
let t = d.map((e) => {
|
|
487
|
+
if (typeof e == "string") return e;
|
|
488
|
+
let { statement: t, names: n, verbatim: r } = e;
|
|
489
|
+
if (r) return t.text;
|
|
490
|
+
let { quote: i } = t;
|
|
491
|
+
return `import ${t.typeOnly ? "type " : ""}{ ${n.join(", ")} } from ${i}${t.module}${i};`;
|
|
492
|
+
}).join("\n");
|
|
493
|
+
r > 0 ? p.push({
|
|
494
|
+
offset: r,
|
|
495
|
+
text: `\n${t}`
|
|
496
|
+
}) : p.unshift({
|
|
497
|
+
offset: 0,
|
|
498
|
+
text: `${t}\n${/^[ \t]*\r?\n/.test(e) ? "" : "\n"}`
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
body: a,
|
|
503
|
+
inserts: p,
|
|
504
|
+
importsEnd: r
|
|
505
|
+
};
|
|
506
|
+
})(r.getValue(), n), l = c.importsEnd > 0 ? r.getPositionAt(c.importsEnd).lineNumber : 0, u = c.body, d = "";
|
|
507
|
+
o.lineNumber <= l ? l < r.getLineCount() ? (o.lineNumber = l + 1, d = u.startsWith("\n") ? "" : "\n") : (o.lineNumber = l, o.column = r.getLineMaxColumn(l), d = "\n\n") : !s && !u.startsWith("\n") && o.lineNumber > 1 && (d = "\n");
|
|
508
|
+
let f = !1;
|
|
509
|
+
r.getLineCount() > 1 && (u.endsWith("\n\n") || (u += "\n\n", f = !0));
|
|
510
|
+
let p = r.validatePosition(o), m = new t.Range(p.lineNumber, p.column, p.lineNumber, p.column), h = [];
|
|
511
|
+
for (let e of c.inserts) {
|
|
512
|
+
let n = r.getPositionAt(e.offset);
|
|
513
|
+
n.lineNumber === m.startLineNumber && n.column === m.startColumn ? d = e.text + d : h.push({
|
|
514
|
+
range: new t.Range(n.lineNumber, n.column, n.lineNumber, n.column),
|
|
515
|
+
text: e.text
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
let g = d.split("\n").length - 1, _ = [{
|
|
519
|
+
range: m,
|
|
520
|
+
text: `${d}${u}`
|
|
521
|
+
}, ...h], v = null;
|
|
522
|
+
r.pushEditOperations([], _, (e) => (v = e[0].range, g > 0 && (v.startLineNumber += g, v.startColumn = 1), f && v.endLineNumber--, [new t.Selection(v.startLineNumber, v.startColumn, v.endLineNumber, v.endColumn)])), e.setSelection({
|
|
523
|
+
startLineNumber: v.endLineNumber,
|
|
524
|
+
startColumn: v.endColumn,
|
|
525
|
+
endLineNumber: v.startLineNumber,
|
|
526
|
+
endColumn: v.startColumn
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
function B(e, t) {
|
|
375
530
|
let n = null, r = e.length;
|
|
376
531
|
for (let i = 0; !n && i < r; i++) {
|
|
377
532
|
let r = e[i];
|
|
@@ -379,47 +534,47 @@ function he(e, t) {
|
|
|
379
534
|
}
|
|
380
535
|
return n ? n.getContext() : "formula";
|
|
381
536
|
}
|
|
382
|
-
function
|
|
537
|
+
function V(e, t, n, r, i = []) {
|
|
383
538
|
if (r.kind === "function" && r.kindModifiers === "export") {
|
|
384
539
|
let t = r.spans[0].start, a = e.getPositionAt(t);
|
|
385
540
|
i.push({
|
|
386
541
|
name: r.text,
|
|
387
|
-
type:
|
|
542
|
+
type: B(n, r),
|
|
388
543
|
lineNumber: a.lineNumber
|
|
389
544
|
});
|
|
390
545
|
}
|
|
391
|
-
if (r.childItems) for (let a of r.childItems)
|
|
546
|
+
if (r.childItems) for (let a of r.childItems) V(e, t, n, a, i);
|
|
392
547
|
return i;
|
|
393
548
|
}
|
|
394
|
-
function
|
|
549
|
+
function H(e, t, n = "function", r) {
|
|
395
550
|
let i = e.spans, a = i.length;
|
|
396
551
|
for (let o = 0; o < a; o++) {
|
|
397
552
|
let a = i[o];
|
|
398
553
|
if (a.start <= t && t < a.start + a.length) {
|
|
399
554
|
if (e.kind === n && (!r || e.kindModifiers === r)) return e;
|
|
400
555
|
for (let i of e.childItems || []) {
|
|
401
|
-
let e =
|
|
556
|
+
let e = H(i, t, n, r);
|
|
402
557
|
if (e) return e;
|
|
403
558
|
}
|
|
404
559
|
}
|
|
405
560
|
return null;
|
|
406
561
|
}
|
|
407
562
|
}
|
|
408
|
-
function
|
|
563
|
+
function _e(e) {
|
|
409
564
|
return e.kind === "comment";
|
|
410
565
|
}
|
|
411
|
-
var
|
|
412
|
-
|
|
566
|
+
var U = null, W = null, G = null, K = null, ve = !1, ye = !1, be = !1, q = { current: null }, xe = (e, t) => {
|
|
567
|
+
W = {
|
|
413
568
|
editor: e,
|
|
414
569
|
monaco: t
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
|
|
570
|
+
}, G && (K = G(e, t));
|
|
571
|
+
}, Se = (e) => {
|
|
572
|
+
be || (be = !0, e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
418
573
|
noSemanticValidation: !0,
|
|
419
574
|
noSyntaxValidation: !1,
|
|
420
575
|
diagnosticCodesToIgnore: [2307]
|
|
421
|
-
}), e.languages.typescript.typescriptDefaults.setEagerModelSync(!0), e.languages.json.jsonDefaults.setDiagnosticsOptions({ validate: !0 }),
|
|
422
|
-
|
|
576
|
+
}), e.languages.typescript.typescriptDefaults.setEagerModelSync(!0), e.languages.json.jsonDefaults.setDiagnosticsOptions({ validate: !0 }), R(e), ((e) => {
|
|
577
|
+
z || (z = !0, e.languages.registerCompletionItemProvider("typescript", {
|
|
423
578
|
triggerCharacters: ["@"],
|
|
424
579
|
provideCompletionItems: (t, n) => {
|
|
425
580
|
let r = t.getValueInRange({
|
|
@@ -496,7 +651,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
496
651
|
}), (async () => {
|
|
497
652
|
let t = !1;
|
|
498
653
|
try {
|
|
499
|
-
let n = await (async () => await (await fetch(
|
|
654
|
+
let n = await (async () => await (await fetch(L)).text())(), r = e.Uri.parse("inmemory://model/\"sheetxl-models\".d.ts"), i = e.editor.getModel(r);
|
|
500
655
|
i ? t = !0 : i = e.editor.createModel(n, "typescript", r), e.editor.setModelMarkers(i, "default", []);
|
|
501
656
|
} catch (e) {
|
|
502
657
|
console.warn("cant load types", e);
|
|
@@ -514,7 +669,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
514
669
|
let p = d[d.length - 1];
|
|
515
670
|
p !== "`" && p !== "'" && p !== "\"" || (c++, d = d.substring(0, d.length - 1));
|
|
516
671
|
try {
|
|
517
|
-
|
|
672
|
+
q.current?.getRanges(d) && r.push({
|
|
518
673
|
range: {
|
|
519
674
|
endColumn: l,
|
|
520
675
|
endLineNumber: n,
|
|
@@ -532,7 +687,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
532
687
|
} }), e.editor.registerLinkOpener({ open(e) {
|
|
533
688
|
if (e?.path?.startsWith("/range/")) {
|
|
534
689
|
try {
|
|
535
|
-
|
|
690
|
+
q.current?.getRanges(e.path.substring(7))?.select();
|
|
536
691
|
} catch (e) {
|
|
537
692
|
console.warn("invalid range", e);
|
|
538
693
|
}
|
|
@@ -567,102 +722,102 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
567
722
|
})();
|
|
568
723
|
}
|
|
569
724
|
})());
|
|
570
|
-
},
|
|
725
|
+
}, Ce = (e) => {
|
|
571
726
|
let t = !1, n = e ? e.length : 0;
|
|
572
727
|
for (let r = 0; !t && r < n; r++) e[r].severity === 8 && (t = !0);
|
|
573
|
-
},
|
|
574
|
-
let [e, n] = s(() =>
|
|
575
|
-
return i(() => (
|
|
576
|
-
|
|
577
|
-
}), []),
|
|
728
|
+
}, we = () => {
|
|
729
|
+
let [e, n] = s(() => U.props);
|
|
730
|
+
return i(() => (U && (U.setProps = n), () => {
|
|
731
|
+
U && (U.setProps = null);
|
|
732
|
+
}), []), b("div", {
|
|
578
733
|
style: {
|
|
579
734
|
display: "flex",
|
|
580
735
|
flex: "1 1 100%",
|
|
581
736
|
width: "100%",
|
|
582
737
|
height: "100%"
|
|
583
738
|
},
|
|
584
|
-
children:
|
|
739
|
+
children: b(t, { children: b(P, {
|
|
585
740
|
theme: e.theme,
|
|
586
741
|
options: e.options,
|
|
587
742
|
language: "typescript",
|
|
588
743
|
value: e.value,
|
|
589
744
|
onValidate: e.onValidate,
|
|
590
745
|
beforeMount: e.beforeMount,
|
|
591
|
-
onMount:
|
|
746
|
+
onMount: xe
|
|
592
747
|
}) })
|
|
593
748
|
});
|
|
594
|
-
},
|
|
595
|
-
let { className: r, style: c, readOnly: f = !1, darkMode: m, loadingPanel: h, autoFocus:
|
|
749
|
+
}, J = r(n((t, n) => {
|
|
750
|
+
let { className: r, style: c, readOnly: f = !1, darkMode: m, loadingPanel: h, autoFocus: _ = !0, frame: y, scripts: x, onStatusChange: S, ...C } = t, w = re(), T = o(null), [E, D] = s(!1), O = oe(), [k] = ee(["insertFunction"]), [A, le] = s({
|
|
596
751
|
message: "Loading",
|
|
597
752
|
cursor: "",
|
|
598
753
|
dirty: !1
|
|
599
|
-
}), [
|
|
754
|
+
}), [ue, me] = s({
|
|
600
755
|
loading: !1,
|
|
601
756
|
compiling: !1,
|
|
602
757
|
errors: [],
|
|
603
758
|
warnings: []
|
|
604
|
-
}),
|
|
605
|
-
|
|
759
|
+
}), N = v((e) => {
|
|
760
|
+
le((t) => {
|
|
606
761
|
let n = {
|
|
607
762
|
...t,
|
|
608
763
|
...e
|
|
609
764
|
};
|
|
610
|
-
return u.deepEqual(n, t) ? t : (
|
|
765
|
+
return u.deepEqual(n, t) ? t : (D(n.dirty ?? !1), n);
|
|
611
766
|
});
|
|
612
|
-
}, [
|
|
767
|
+
}, [S]);
|
|
613
768
|
i(() => {
|
|
614
|
-
|
|
615
|
-
}, [
|
|
616
|
-
let
|
|
769
|
+
S?.(A);
|
|
770
|
+
}, [S, A]);
|
|
771
|
+
let P = ne(), I = v(async (e) => {
|
|
617
772
|
let t = null, n = null;
|
|
618
773
|
try {
|
|
619
|
-
e && (n = await
|
|
774
|
+
e && (n = await P.showBusy(w("scriptEditor.saving")), t = await x.createModule({ source: e })), x.addModule(pe(x), t, { replace: !0 }), n?.();
|
|
620
775
|
} catch (e) {
|
|
621
|
-
n?.(), console.warn("Unable to compile", e),
|
|
776
|
+
n?.(), console.warn("Unable to compile", e), P.showError(e);
|
|
622
777
|
}
|
|
623
778
|
return t;
|
|
624
|
-
}, [
|
|
625
|
-
if (!
|
|
626
|
-
let e =
|
|
627
|
-
if (
|
|
779
|
+
}, [x]), L = v(async () => {
|
|
780
|
+
if (!T.current || f) return;
|
|
781
|
+
let e = T.current.editor, t;
|
|
782
|
+
if (A.dirty) {
|
|
628
783
|
let n = e.getValue();
|
|
629
|
-
await
|
|
784
|
+
await I(n), t = j(x);
|
|
630
785
|
let r = t?.getSource(), i = e.getValue(), a = (r?.length ?? 0) !== n.length || r !== i;
|
|
631
|
-
|
|
632
|
-
} else t =
|
|
786
|
+
N({ dirty: a });
|
|
787
|
+
} else t = j(x);
|
|
633
788
|
return t;
|
|
634
|
-
}, [
|
|
789
|
+
}, [A, x]);
|
|
635
790
|
i(() => {
|
|
636
|
-
let e =
|
|
791
|
+
let e = y?.addListener({ onBeforeHide: async () => (await L(), !0) });
|
|
637
792
|
return () => {
|
|
638
793
|
e?.();
|
|
639
794
|
};
|
|
640
|
-
}, [
|
|
641
|
-
if (
|
|
642
|
-
}, [
|
|
795
|
+
}, [y]), i(() => {
|
|
796
|
+
if (x) return x.addListeners({ onBeforeSearch: () => L() });
|
|
797
|
+
}, [x]), ae(O, {
|
|
643
798
|
onBeforeSave: async () => {
|
|
644
|
-
await
|
|
799
|
+
await L();
|
|
645
800
|
},
|
|
646
801
|
onLoad: () => {
|
|
647
|
-
let e =
|
|
648
|
-
e && e.setValue(
|
|
802
|
+
let e = T.current?.editor;
|
|
803
|
+
e && e.setValue(j(x)?.getSource() ?? "");
|
|
649
804
|
}
|
|
650
805
|
});
|
|
651
|
-
let
|
|
652
|
-
if (!
|
|
806
|
+
let z = v(async (e) => {
|
|
807
|
+
if (!x) return;
|
|
653
808
|
let t = typeof e == "string" ? { functionName: e } : e ?? {}, n = null;
|
|
654
809
|
if (t?.declaration || t?.functionName) {
|
|
655
810
|
let e = t.declaration ? t.declaration.getName() : t.functionName;
|
|
656
|
-
(await
|
|
811
|
+
(await x.searchFunctions({ name: e })).length > 0 && (n = e);
|
|
657
812
|
}
|
|
658
813
|
if (n) try {
|
|
659
|
-
await
|
|
814
|
+
await x.executeMacro(n);
|
|
660
815
|
} catch (e) {
|
|
661
|
-
|
|
816
|
+
P.showError(e);
|
|
662
817
|
}
|
|
663
|
-
}, [
|
|
664
|
-
if (!
|
|
665
|
-
let e =
|
|
818
|
+
}, [x, P]), [B, _e] = s(!1), be = v(async () => {
|
|
819
|
+
if (!T.current) return null;
|
|
820
|
+
let e = T.current, t = e.editor;
|
|
666
821
|
if (!t) return null;
|
|
667
822
|
let n = await (async (e, t, n = "export") => {
|
|
668
823
|
let r = e.getModel();
|
|
@@ -671,7 +826,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
671
826
|
if (!o) return null;
|
|
672
827
|
let s = o.startLineNumber === o.endLineNumber && o.startColumn === o.endColumn ? r.getLineCount() : Math.min(o.endLineNumber, r.getLineCount());
|
|
673
828
|
for (let e = o.startLineNumber; !a && e <= s; e++) {
|
|
674
|
-
let t =
|
|
829
|
+
let t = H(i, r.getOffsetAt({
|
|
675
830
|
lineNumber: e,
|
|
676
831
|
column: 1
|
|
677
832
|
}), "function", n);
|
|
@@ -679,20 +834,20 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
679
834
|
}
|
|
680
835
|
return a;
|
|
681
836
|
})(t, e.monaco);
|
|
682
|
-
return
|
|
837
|
+
return N({ message: (n ?? "").toUpperCase() }), n ? {
|
|
683
838
|
source: t.getValue(),
|
|
684
839
|
name: n
|
|
685
840
|
} : null;
|
|
686
841
|
}, []);
|
|
687
|
-
|
|
688
|
-
let
|
|
689
|
-
|
|
842
|
+
v(d.debounce(L, 200), []);
|
|
843
|
+
let xe = v(async (e, t, n) => {
|
|
844
|
+
me((e) => ({
|
|
690
845
|
...e,
|
|
691
846
|
compiling: !0
|
|
692
847
|
}));
|
|
693
848
|
let r = null;
|
|
694
849
|
try {
|
|
695
|
-
if (r = await
|
|
850
|
+
if (r = await x.createModule({
|
|
696
851
|
source: n?.getValue(),
|
|
697
852
|
declarationsOnly: !0
|
|
698
853
|
}), !r) return;
|
|
@@ -713,9 +868,9 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
713
868
|
});
|
|
714
869
|
t.editor.setModelMarkers(e, "sheetxl", r);
|
|
715
870
|
})(e, t, i), async function(e, t, n, r) {
|
|
716
|
-
let i =
|
|
871
|
+
let i = V(e, t, r, await (await (await t.languages.typescript.getTypeScriptWorker())(e.uri)).getNavigationTree(e.uri.toString())).map((e) => {
|
|
717
872
|
let n = null, r = null;
|
|
718
|
-
return e.type === "formula" ? (n = "formula.margin-icon", r =
|
|
873
|
+
return e.type === "formula" ? (n = "formula.margin-icon", r = w("scriptEditor.glyph.formula")) : e.type === "macro" ? (n = "macro.margin-icon", r = w("scriptEditor.glyph.macro")) : e.type === "autoRun" && (n = "autorun.margin-icon", r = w("scriptEditor.glyph.autoRun")), {
|
|
719
874
|
range: new t.Range(e.lineNumber, 1, e.lineNumber, 1),
|
|
720
875
|
options: {
|
|
721
876
|
isWholeLine: !1,
|
|
@@ -726,32 +881,32 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
726
881
|
};
|
|
727
882
|
});
|
|
728
883
|
Z.current && Z.current.clear(), Z.current = n.createDecorationsCollection(i);
|
|
729
|
-
}(e, t, n, r ? r.getFunctions().getItems() : u.EmptyArray),
|
|
884
|
+
}(e, t, n, r ? r.getFunctions().getItems() : u.EmptyArray), me((e) => ({
|
|
730
885
|
...e,
|
|
731
886
|
compiling: !1,
|
|
732
887
|
errors: i.filter((e) => e.severity === "error").map((e) => `${e.code}: ${e.message}`),
|
|
733
888
|
warnings: i.filter((e) => e.severity === "warning").map((e) => `${e.code}: ${e.message}`)
|
|
734
889
|
}));
|
|
735
|
-
}, [
|
|
736
|
-
if (!
|
|
737
|
-
let t =
|
|
738
|
-
e !== void 0 && (n.message = e),
|
|
890
|
+
}, [x]), J = v(d.debounce(xe, 580), []), Y = v(async (e) => {
|
|
891
|
+
if (!T.current) return;
|
|
892
|
+
let t = T.current.editor.getPosition(), n = { cursor: t ? t.toString() : "" };
|
|
893
|
+
e !== void 0 && (n.message = e), N(n);
|
|
739
894
|
}, []);
|
|
740
|
-
i(() => {}, [
|
|
741
|
-
let
|
|
742
|
-
await
|
|
743
|
-
}, [
|
|
744
|
-
let t =
|
|
895
|
+
i(() => {}, [ue]);
|
|
896
|
+
let Te = o(null), Ee = v(async () => {
|
|
897
|
+
await L(), y?.close();
|
|
898
|
+
}, [y]), X = v((e) => {
|
|
899
|
+
let t = T.current?.editor;
|
|
745
900
|
return !!t && (t.focus(e), !0);
|
|
746
|
-
}, [
|
|
747
|
-
let e =
|
|
901
|
+
}, [A]), De = v(async () => {
|
|
902
|
+
let e = T.current?.editor, t = e?.getModel(), n = e?.getSelection();
|
|
748
903
|
if (!t || !n) return;
|
|
749
904
|
let r = n.isEmpty() ? t.getLineContent(n.positionLineNumber) + "\n" : t.getValueInRange(n);
|
|
750
905
|
try {
|
|
751
906
|
await navigator.clipboard?.writeText(r);
|
|
752
907
|
} catch {}
|
|
753
|
-
}, []), Oe =
|
|
754
|
-
let e =
|
|
908
|
+
}, []), Oe = v(async () => {
|
|
909
|
+
let e = T.current, t = e?.editor, n = t?.getModel(), r = t?.getSelection();
|
|
755
910
|
if (!n || !r) return;
|
|
756
911
|
let i = r.isEmpty() ? new e.monaco.Range(r.positionLineNumber, 1, r.positionLineNumber + 1, 1) : r, a = n.getValueInRange(i);
|
|
757
912
|
try {
|
|
@@ -764,8 +919,8 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
764
919
|
text: "",
|
|
765
920
|
forceMoveMarkers: !0
|
|
766
921
|
}]), t.pushUndoStop(), t.focus();
|
|
767
|
-
}, []), ke =
|
|
768
|
-
let e =
|
|
922
|
+
}, []), ke = v(async () => {
|
|
923
|
+
let e = T.current?.editor;
|
|
769
924
|
if (!e) return;
|
|
770
925
|
let t;
|
|
771
926
|
try {
|
|
@@ -780,16 +935,16 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
780
935
|
text: t,
|
|
781
936
|
forceMoveMarkers: !0
|
|
782
937
|
}]), e.pushUndoStop(), e.focus();
|
|
783
|
-
}, []), Z = o(null), Ae =
|
|
784
|
-
|
|
938
|
+
}, []), Z = o(null), Ae = v((t, n) => {
|
|
939
|
+
T.current = {
|
|
785
940
|
monaco: n,
|
|
786
941
|
editor: t
|
|
787
|
-
},
|
|
942
|
+
}, q.current = O ?? null;
|
|
788
943
|
let r = t.getModel(), i = [];
|
|
789
|
-
|
|
790
|
-
let a =
|
|
791
|
-
return t.getValue() !== a && t.setValue(a),
|
|
792
|
-
|
|
944
|
+
_e(!0);
|
|
945
|
+
let a = j(x)?.getSource() ?? "";
|
|
946
|
+
return t.getValue() !== a && t.setValue(a), ve ? (Y(""), J(r, n, t), R(n)) : (ve = !0, Y("Loading Types"), import("./UxWLkTf3nf2Op-PV.mjs").then((t) => e(t.default, 1)).then(async (e) => {
|
|
947
|
+
Y(""), e.AutoTypings.create(t, {
|
|
793
948
|
shareCache: !0,
|
|
794
949
|
dontAdaptEditorOptions: !0,
|
|
795
950
|
monaco: n,
|
|
@@ -806,8 +961,8 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
806
961
|
e === "Not implemented yet" && (e = "Compile Errors"), console.warn("Error compiling types", e);
|
|
807
962
|
}
|
|
808
963
|
}).then((e) => {
|
|
809
|
-
|
|
810
|
-
if (
|
|
964
|
+
Te.current = e, J(t.getModel(), n, t), (() => {
|
|
965
|
+
if (he) return;
|
|
811
966
|
let e = (e, t) => {
|
|
812
967
|
try {
|
|
813
968
|
if (t === void 0) try {
|
|
@@ -819,17 +974,17 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
819
974
|
}
|
|
820
975
|
else globalThis[e] = t;
|
|
821
976
|
} catch {}
|
|
822
|
-
}, t =
|
|
977
|
+
}, t = F.length;
|
|
823
978
|
for (let n = 0; n < t; n++) {
|
|
824
|
-
let t =
|
|
825
|
-
e(t,
|
|
979
|
+
let t = F[n];
|
|
980
|
+
e(t, M[t]);
|
|
826
981
|
}
|
|
827
|
-
|
|
828
|
-
})(),
|
|
982
|
+
M = void 0, he = !0;
|
|
983
|
+
})(), R(n);
|
|
829
984
|
});
|
|
830
985
|
}).catch((e) => {
|
|
831
|
-
|
|
832
|
-
})),
|
|
986
|
+
ve = !1, Y(""), console.warn("Auto typings could not be loaded:", e);
|
|
987
|
+
})), ye || (ye = !0, function(e, t) {
|
|
833
988
|
t.languages.registerInlayHintsProvider("typescript", { provideInlayHints(e, n, r) {
|
|
834
989
|
let i = [];
|
|
835
990
|
for (let n = 1; n < e.getLineCount() + 1; n++) {
|
|
@@ -858,56 +1013,56 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
858
1013
|
label: "Execute",
|
|
859
1014
|
keybindings: [n.KeyCode.F8],
|
|
860
1015
|
run: async (e) => {
|
|
861
|
-
let t = await
|
|
862
|
-
|
|
1016
|
+
let t = await be();
|
|
1017
|
+
z(t);
|
|
863
1018
|
}
|
|
864
1019
|
})), i.push(t.addAction({
|
|
865
1020
|
id: "saveScript",
|
|
866
1021
|
label: "Save Script",
|
|
867
1022
|
keybindings: [n.KeyMod.CtrlCmd | n.KeyCode.KeyS],
|
|
868
1023
|
run: (e) => {
|
|
869
|
-
|
|
1024
|
+
L();
|
|
870
1025
|
}
|
|
871
1026
|
})), i.push(t.onMouseDown(async (e) => {
|
|
872
1027
|
if (e.target.type === n.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
|
|
873
1028
|
e.event.browserEvent.preventDefault();
|
|
874
|
-
let t = e.target.position.lineNumber, i = await (await (await n.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()), a = await
|
|
1029
|
+
let t = e.target.position.lineNumber, i = await (await (await n.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()), a = await L();
|
|
875
1030
|
if (!a) return;
|
|
876
|
-
let o = a.getFunctions().getItems(), s =
|
|
1031
|
+
let o = a.getFunctions().getItems(), s = V(r, n, o, i).find((e) => e.lineNumber === t);
|
|
877
1032
|
if (s) {
|
|
878
1033
|
let t = e.event.browserEvent.button;
|
|
879
1034
|
if (t === 0) {
|
|
880
|
-
if (s.type === "macro" || s.type === "autoRun")
|
|
1035
|
+
if (s.type === "macro" || s.type === "autoRun") z({ functionName: s.name });
|
|
881
1036
|
else if (s.type === "formula") {
|
|
882
1037
|
let e = o?.find((e) => e.getName() === s.name);
|
|
883
|
-
e &&
|
|
1038
|
+
e && k?.execute(e);
|
|
884
1039
|
}
|
|
885
1040
|
} else t === 2 && (console.log("Context menu for function:", s.name), e.event.browserEvent.preventDefault());
|
|
886
1041
|
}
|
|
887
1042
|
}
|
|
888
1043
|
})), i.push(t.onDidChangeModelContent(() => {
|
|
889
|
-
|
|
1044
|
+
N({ dirty: !0 }), J(r, n, t);
|
|
890
1045
|
})), i.push(n.editor.onDidChangeMarkers((e) => {
|
|
891
1046
|
e.some((e) => e.toString() === r.uri.toString());
|
|
892
1047
|
})), i.push(r.onDidChangeContent((e) => {
|
|
893
|
-
let n =
|
|
894
|
-
|
|
1048
|
+
let n = j(x)?.getSource(), r = t.getValue(), i = (n?.length ?? 0) !== r.length || n !== r;
|
|
1049
|
+
N({ dirty: i });
|
|
895
1050
|
})), i.push(t.onDidChangeCursorPosition((e) => {
|
|
896
|
-
|
|
1051
|
+
Y();
|
|
897
1052
|
})), () => {
|
|
898
1053
|
for (let e of i) try {
|
|
899
1054
|
e.dispose();
|
|
900
1055
|
} catch {}
|
|
901
1056
|
};
|
|
902
|
-
}, [
|
|
1057
|
+
}, [x, O]), je = a(() => B ? null : h || b("div", {
|
|
903
1058
|
style: {
|
|
904
1059
|
position: "absolute",
|
|
905
1060
|
width: "100%",
|
|
906
1061
|
height: "100%"
|
|
907
1062
|
},
|
|
908
|
-
children:
|
|
909
|
-
}), [
|
|
910
|
-
...
|
|
1063
|
+
children: w("scriptEditor.loading")
|
|
1064
|
+
}), [B, h]), Me = a(() => ({
|
|
1065
|
+
...de,
|
|
911
1066
|
fixedOverflowWidgets: !1,
|
|
912
1067
|
contextmenu: !1,
|
|
913
1068
|
readOnly: f
|
|
@@ -916,17 +1071,17 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
916
1071
|
let e = {
|
|
917
1072
|
theme: m ? "extended-dark" : "extended",
|
|
918
1073
|
options: Me,
|
|
919
|
-
value:
|
|
920
|
-
beforeMount:
|
|
921
|
-
onValidate:
|
|
1074
|
+
value: j(x)?.getSource() ?? "",
|
|
1075
|
+
beforeMount: Se,
|
|
1076
|
+
onValidate: Ce
|
|
922
1077
|
}, t = ((e) => {
|
|
923
|
-
if (
|
|
924
|
-
if (!
|
|
925
|
-
|
|
926
|
-
let e =
|
|
1078
|
+
if (U) return U;
|
|
1079
|
+
if (!M) {
|
|
1080
|
+
M = {};
|
|
1081
|
+
let e = F.length;
|
|
927
1082
|
for (let t = 0; t < e; t++) {
|
|
928
|
-
let e =
|
|
929
|
-
|
|
1083
|
+
let e = F[t];
|
|
1084
|
+
M[e] = globalThis[e];
|
|
930
1085
|
}
|
|
931
1086
|
}
|
|
932
1087
|
let t = document.createElement("div");
|
|
@@ -934,33 +1089,33 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
934
1089
|
let n = document.createElement("div");
|
|
935
1090
|
n.style.width = "100%", n.style.height = "100%", n.style.display = "flex", n.style.flex = "1 1 100%", t.appendChild(n), document.body.appendChild(t);
|
|
936
1091
|
let r = l(n);
|
|
937
|
-
return
|
|
1092
|
+
return U = {
|
|
938
1093
|
root: r,
|
|
939
1094
|
hostEl: n,
|
|
940
1095
|
stashEl: t,
|
|
941
1096
|
props: e,
|
|
942
1097
|
setProps: null
|
|
943
|
-
}, r.render(
|
|
1098
|
+
}, r.render(b(we, {})), U;
|
|
944
1099
|
})(e);
|
|
945
|
-
return t.props = e, t.setProps?.(e),
|
|
946
|
-
|
|
1100
|
+
return t.props = e, t.setProps?.(e), G = (e, t) => Ae(e, t), Ne.current?.appendChild(t.hostEl), W && (K = Ae(W.editor, W.monaco)), () => {
|
|
1101
|
+
K?.(), K = null, G = null, T.current = null, U?.stashEl.appendChild(U.hostEl);
|
|
947
1102
|
};
|
|
948
1103
|
}, []), i(() => {
|
|
949
|
-
if (!
|
|
1104
|
+
if (!U) return;
|
|
950
1105
|
let e = {
|
|
951
|
-
...
|
|
1106
|
+
...U.props,
|
|
952
1107
|
theme: m ? "extended-dark" : "extended",
|
|
953
1108
|
options: Me
|
|
954
1109
|
};
|
|
955
|
-
|
|
1110
|
+
U.props = e, U.setProps?.(e);
|
|
956
1111
|
}, [m, Me]), i(() => {
|
|
957
|
-
let e =
|
|
1112
|
+
let e = T.current, t = e?.editor;
|
|
958
1113
|
if (!t) return;
|
|
959
|
-
|
|
960
|
-
let n =
|
|
961
|
-
t.getValue() !== n && (t.setValue(n),
|
|
962
|
-
}, [
|
|
963
|
-
let Pe =
|
|
1114
|
+
q.current = O ?? null;
|
|
1115
|
+
let n = j(x)?.getSource() ?? "";
|
|
1116
|
+
t.getValue() !== n && (t.setValue(n), J(t.getModel(), e.monaco, t), N({ dirty: !1 }));
|
|
1117
|
+
}, [x, O]);
|
|
1118
|
+
let Pe = ie("div", {
|
|
964
1119
|
style: {
|
|
965
1120
|
display: "flex",
|
|
966
1121
|
flex: "1 1 100%",
|
|
@@ -969,7 +1124,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
969
1124
|
position: "relative",
|
|
970
1125
|
boxSizing: "border-box"
|
|
971
1126
|
},
|
|
972
|
-
children: [
|
|
1127
|
+
children: [b("div", {
|
|
973
1128
|
ref: Ne,
|
|
974
1129
|
style: {
|
|
975
1130
|
display: "flex",
|
|
@@ -978,62 +1133,28 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
978
1133
|
position: "relative"
|
|
979
1134
|
}
|
|
980
1135
|
}), je]
|
|
981
|
-
}), Q =
|
|
1136
|
+
}), Q = te(n, () => ({
|
|
982
1137
|
isScriptEditorElement: () => !0,
|
|
983
1138
|
showCommandPalette: () => {
|
|
984
|
-
|
|
1139
|
+
T.current?.editor && T.current.editor.trigger("keyboard", "editor.action.quickCommand", null);
|
|
985
1140
|
},
|
|
986
|
-
getScripts: () =>
|
|
1141
|
+
getScripts: () => x,
|
|
987
1142
|
focus: (e) => {
|
|
988
|
-
|
|
1143
|
+
X(e);
|
|
989
1144
|
},
|
|
990
|
-
close: () =>
|
|
991
|
-
insertSnippet: (e) =>
|
|
992
|
-
let r = e.getModel();
|
|
993
|
-
if (!r) return;
|
|
994
|
-
let i = await (await (await t.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()), a = e.getPosition(), o = { ...a };
|
|
995
|
-
o.lineNumber = 1, o.column = 1;
|
|
996
|
-
let s = !1;
|
|
997
|
-
for (let e = a.lineNumber; e >= 1; e--) if (r.getLineContent(e).trim() === "") {
|
|
998
|
-
let t = F(i, r.getOffsetAt({
|
|
999
|
-
lineNumber: e,
|
|
1000
|
-
column: 1
|
|
1001
|
-
}), "function");
|
|
1002
|
-
if (!t || ge(t)) {
|
|
1003
|
-
s = !0, o.lineNumber = e + 1;
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
{
|
|
1007
|
-
let n = t.spans[0].start;
|
|
1008
|
-
e = r.getPositionAt(n).lineNumber, o.lineNumber = e;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
let c = n, l = !1;
|
|
1012
|
-
!s && !c.startsWith("\n") && o.lineNumber > 1 && (c = "\n" + c, l = !0);
|
|
1013
|
-
let u = !1;
|
|
1014
|
-
r.getLineCount() > 1 && (c.endsWith("\n\n") || (c += "\n\n", u = !0));
|
|
1015
|
-
let d = [{
|
|
1016
|
-
range: new t.Range(o.lineNumber, o.column, o.lineNumber, o.column),
|
|
1017
|
-
text: `${c}`
|
|
1018
|
-
}], f = null;
|
|
1019
|
-
r.pushEditOperations([], d, (e) => (f = e[0].range, l && f.startLineNumber++, u && f.endLineNumber--, [new t.Selection(f.startLineNumber, f.startColumn, f.endLineNumber, f.endColumn)])), e.setSelection({
|
|
1020
|
-
startLineNumber: f.endLineNumber,
|
|
1021
|
-
startColumn: f.endColumn,
|
|
1022
|
-
endLineNumber: f.startLineNumber,
|
|
1023
|
-
endColumn: f.startColumn
|
|
1024
|
-
});
|
|
1025
|
-
})(w.current.editor, w.current.monaco, e) : Promise.resolve(),
|
|
1145
|
+
close: () => Ee(),
|
|
1146
|
+
insertSnippet: (e) => T.current?.editor ? ge(T.current.editor, T.current.monaco, e) : Promise.resolve(),
|
|
1026
1147
|
saveSource: async () => {
|
|
1027
|
-
await
|
|
1148
|
+
await L();
|
|
1028
1149
|
},
|
|
1029
1150
|
runAction: (e) => {
|
|
1030
|
-
let t =
|
|
1151
|
+
let t = T.current?.editor;
|
|
1031
1152
|
t && (t.focus(), t.trigger("source", e, null));
|
|
1032
1153
|
},
|
|
1033
1154
|
copy: () => De(),
|
|
1034
1155
|
cut: () => Oe(),
|
|
1035
1156
|
paste: () => ke()
|
|
1036
|
-
}), [O]), [Fe, Ie] = s(null), Le =
|
|
1157
|
+
}), [O]), [Fe, Ie] = s(null), Le = v((e) => {
|
|
1037
1158
|
e !== null && Ie(e);
|
|
1038
1159
|
}, []), $ = g.useCommandScope();
|
|
1039
1160
|
return i(() => {
|
|
@@ -1058,7 +1179,7 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
1058
1179
|
}), e.updateCommand("copy", { callback: () => n.copy() }), e.updateCommand("cut", { callback: () => n.cut() }), e.updateCommand("paste", { callback: () => n.paste() }), e.updateCommand("selectAll", { callback: () => n.runAction("editor.action.selectAll") }), e.updateCommand("find", { callback: () => n.runAction("actions.find") }), e.updateCommand("findReplace", { callback: () => n.runAction("editor.action.startFindReplaceAction") }), e.updateCommand("goto", { callback: () => n.runAction("editor.action.gotoLine") });
|
|
1059
1180
|
}(e, {
|
|
1060
1181
|
scriptEditor: Fe,
|
|
1061
|
-
isDirty:
|
|
1182
|
+
isDirty: E,
|
|
1062
1183
|
readOnly: f
|
|
1063
1184
|
}), () => {
|
|
1064
1185
|
e.remove();
|
|
@@ -1066,16 +1187,16 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
1066
1187
|
}, [
|
|
1067
1188
|
$,
|
|
1068
1189
|
Fe,
|
|
1069
|
-
|
|
1190
|
+
E,
|
|
1070
1191
|
f
|
|
1071
|
-
]), i(() => (
|
|
1192
|
+
]), i(() => (_ && requestAnimationFrame(() => {
|
|
1072
1193
|
Q.current?.focus();
|
|
1073
1194
|
}), () => {
|
|
1074
|
-
|
|
1195
|
+
T.current?.editor && requestAnimationFrame(() => {
|
|
1075
1196
|
Q.current?.contains(document.activeElement) && Q.current?.focus();
|
|
1076
1197
|
});
|
|
1077
|
-
}), []),
|
|
1078
|
-
className:
|
|
1198
|
+
}), []), b("div", {
|
|
1199
|
+
className: se("script-editor", fe, r),
|
|
1079
1200
|
style: {
|
|
1080
1201
|
display: "flex",
|
|
1081
1202
|
flexDirection: "row",
|
|
@@ -1083,14 +1204,14 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
1083
1204
|
position: "relative",
|
|
1084
1205
|
...c
|
|
1085
1206
|
},
|
|
1086
|
-
ref:
|
|
1087
|
-
...
|
|
1207
|
+
ref: ce([Q, Le]),
|
|
1208
|
+
...C,
|
|
1088
1209
|
children: Pe
|
|
1089
1210
|
});
|
|
1090
|
-
})),
|
|
1091
|
-
|
|
1092
|
-
},
|
|
1093
|
-
let { scope: t, data: n } = e, { workbook: r } = n, a =
|
|
1211
|
+
})), Y = null, Te = (e) => {
|
|
1212
|
+
Y = e;
|
|
1213
|
+
}, Ee = () => Y, X = r((e) => {
|
|
1214
|
+
let { scope: t, data: n } = e, { workbook: r } = n, a = ne(), o = S(), s = o.getOpen(), c = v(async (e) => {
|
|
1094
1215
|
if (!r) return;
|
|
1095
1216
|
let t = null, n = r.getScripts();
|
|
1096
1217
|
if (e?.declaration || e?.functionName) {
|
|
@@ -1103,8 +1224,8 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
1103
1224
|
a.showError(e);
|
|
1104
1225
|
return;
|
|
1105
1226
|
}
|
|
1106
|
-
}, [r, a]), l =
|
|
1107
|
-
let e =
|
|
1227
|
+
}, [r, a]), l = v(() => {
|
|
1228
|
+
let e = Ee();
|
|
1108
1229
|
e ? r && e({ workbook: r }) : o.getOpen().includes("scriptEditor") ? o.close("scriptEditor") : o.activate("scriptEditor", {});
|
|
1109
1230
|
}, [r, o]), u = s.includes("scriptEditor");
|
|
1110
1231
|
return i(() => {
|
|
@@ -1124,12 +1245,12 @@ var I = null, L = null, R = null, z = null, B = !1, _e = !1, V = !1, H = { curre
|
|
|
1124
1245
|
r,
|
|
1125
1246
|
c,
|
|
1126
1247
|
l
|
|
1127
|
-
]),
|
|
1248
|
+
]), ae(r, { onLoad: () => {
|
|
1128
1249
|
r?.getScripts().start();
|
|
1129
1250
|
} }), null;
|
|
1130
1251
|
});
|
|
1131
|
-
|
|
1132
|
-
var
|
|
1252
|
+
X.displayName = "WorkbookScriptCommands";
|
|
1253
|
+
var De = {
|
|
1133
1254
|
"reason.noChangesToSave": "No changes to save",
|
|
1134
1255
|
"reason.scriptsReadOnly": "Scripts can't be changed while the workbook structure is protected.",
|
|
1135
1256
|
"scriptEditor.glyph.autoRun": "Auto Run",
|
|
@@ -1138,7 +1259,7 @@ var xe = {
|
|
|
1138
1259
|
"scriptEditor.loading": "Loading...",
|
|
1139
1260
|
"scriptEditor.retry": "Retry",
|
|
1140
1261
|
"scriptEditor.saving": "Saving Scripts..."
|
|
1141
|
-
},
|
|
1262
|
+
}, Oe = [
|
|
1142
1263
|
{
|
|
1143
1264
|
sourceId: "groups",
|
|
1144
1265
|
catalog: {
|
|
@@ -1220,29 +1341,29 @@ var xe = {
|
|
|
1220
1341
|
}
|
|
1221
1342
|
}
|
|
1222
1343
|
}
|
|
1223
|
-
], { DefaultCommandCatalogService:
|
|
1344
|
+
], { DefaultCommandCatalogService: ke } = g, Z = !1, Ae = (e) => {
|
|
1224
1345
|
let { model: t, entryKey: n, frame: r, ref: i, ...a } = e;
|
|
1225
|
-
return
|
|
1346
|
+
return b(J, {
|
|
1226
1347
|
ref: i,
|
|
1227
1348
|
frame: r,
|
|
1228
1349
|
scripts: t?.getScripts(),
|
|
1229
1350
|
...a
|
|
1230
1351
|
});
|
|
1231
|
-
},
|
|
1232
|
-
|
|
1352
|
+
}, je = () => {
|
|
1353
|
+
x.registerTaskPane({
|
|
1233
1354
|
key: "scriptEditor",
|
|
1234
1355
|
getTitle: () => "Script (Typescript)",
|
|
1235
1356
|
getIcon: () => "ScriptRun",
|
|
1236
|
-
component:
|
|
1357
|
+
component: Ae,
|
|
1237
1358
|
keepMounted: !0
|
|
1238
1359
|
}, !0), function() {
|
|
1239
|
-
if (
|
|
1240
|
-
|
|
1241
|
-
let e =
|
|
1360
|
+
if (Z) return;
|
|
1361
|
+
Z = !0;
|
|
1362
|
+
let e = ke;
|
|
1242
1363
|
e.registerFromManifest("@sheetxl/scripting-react", import.meta.url, {
|
|
1243
|
-
messages:
|
|
1244
|
-
catalogs:
|
|
1364
|
+
messages: De,
|
|
1365
|
+
catalogs: Oe
|
|
1245
1366
|
}), e.prefetch();
|
|
1246
|
-
}(), g.DefaultCommandRegistry.registerDynamic("workbook",
|
|
1367
|
+
}(), g.DefaultCommandRegistry.registerDynamic("workbook", X);
|
|
1247
1368
|
};
|
|
1248
|
-
export {
|
|
1369
|
+
export { J as ScriptEditor, je as ScriptingReactPlugin, X as WorkbookScriptCommands, Ee as getScriptEditorOpener, Te as setScriptEditorOpener };
|