@sheetxl/primitives 0.1.97
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/LICENSE.md +11 -0
- package/README.md +7 -0
- package/build/browser/cjs/index.cjs +6 -0
- package/build/browser/esm/index.mjs +309 -0
- package/build/licenses/dependencies.txt +1 -0
- package/build/node/esm/index.mjs +309 -0
- package/build/package.json +39 -0
- package/build/types/index.d.ts +1622 -0
- package/package.json +48 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Repository Licensing
|
|
2
|
+
|
|
3
|
+
The SheetXL monorepo contains a mix of open-source and commercially licensed packages. Each package is individually licensed and contains its own license file.
|
|
4
|
+
|
|
5
|
+
For the specific terms and conditions applicable to a package, please see the `LICENSE.md` file located in that package's root directory.
|
|
6
|
+
|
|
7
|
+
Generally, packages intended for public distribution (such as CLIs, adapters, and vanilla wrappers) are licensed under the MIT license. All other core packages are proprietary and require a commercial license for use.
|
|
8
|
+
|
|
9
|
+
For more details on commercial licensing, please visit our website:
|
|
10
|
+
|
|
11
|
+
https://www.sheetxl.com/licensing-pricing
|
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";/**
|
|
2
|
+
* @license @sheetxl/primitives - Primitive - Base types for SheetXL functions. - v0.0.0
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var i;exports.IRange=void 0,(i=exports.IRange||(exports.IRange={})).Orientation={Column:"column",Row:"row"},i.Orientations={...i.Orientation,Both:"both"},i.Direction={Up:"up",Down:"down",Left:"left",Right:"right"},exports.FormulaError=void 0,(e=>{e.Code={Parse:0,Null:1,Div0:2,Value:3,Ref:4,Name:5,Num:6,NA:7,GettingData:8,Spill:9,Connect:10,Blocked:11,Unknown:12,Field:13,Calc:14,Busy:16,Python:19,Timeout:20},e.Label={Parse:"#PARSE!",Null:"#NULL!",Div0:"#DIV/0!",Value:"#VALUE!",Ref:"#REF!",Name:"#NAME?",Num:"#NUM!",NA:"#N/A",GettingData:"#GETTING_DATA",Spill:"#SPILL!",Connect:"#CONNECT!",Blocked:"#BLOCKED!",Unknown:"#UNKNOWN!",Field:"#FIELD!",Calc:"#CALC!",Busy:"#BUSY!",Python:"#PYTHON!",Timeout:"#TIMEOUT!"};class r extends Error{constructor(t,o,U,C){super(U,C),this._label=o,this._code=t,this.details=C}static{this.code=e.Code.Unknown}get isFormulaError(){return!0}getLabel(){return this._label}getCode(){return this._code}equals(t){return!!t&&(this._code===t._code||this._code===t.code)}get[Symbol.toStringTag](){return"[FormulaError]"}toString(){return this.message||this._label}}e.Known=r;class s extends r{constructor(t,o){super(e.Code.Parse,e.Label.Parse,t,o)}static{this.code=e.Code.Parse}getDetails(){const t=this.details;return{line:t?.line??1,column:t?.column??1,offset:t?.offset??0,length:t?.length??0}}}e.Parse=s;class u extends r{constructor(t,o){super(e.Code.Null,e.Label.Null,t,o)}static{this.code=e.Code.Null}}e.Null=u;class c extends r{constructor(t,o){super(e.Code.Div0,e.Label.Div0,t,o)}static{this.code=e.Code.Div0}}e.Div0=c;class N extends r{constructor(t,o){super(e.Code.Value,e.Label.Value,t,o)}static{this.code=e.Code.Value}}e.Value=N;class p extends r{constructor(t,o){super(e.Code.Ref,e.Label.Ref,t,o)}static{this.code=e.Code.Ref}}e.Ref=p;class h extends r{constructor(t,o){super(e.Code.Name,e.Label.Name,t,o)}static{this.code=e.Code.Name}}e.Name=h;class D extends r{constructor(t,o){super(e.Code.Num,e.Label.Num,t,o)}static{this.code=e.Code.Num}}e.Num=D;class y extends r{constructor(t,o){super(e.Code.NA,e.Label.NA,t,o)}static{this.code=e.Code.NA}}e.NA=y;class S extends r{constructor(t,o){super(e.Code.GettingData,e.Label.GettingData,t,o)}static{this.code=e.Code.GettingData}}e.GettingData=S;class L extends r{constructor(t,o){super(e.Code.Spill,e.Label.Spill,t,o)}static{this.code=e.Code.Spill}}e.Spill=L;class x extends r{constructor(t,o){super(e.Code.Connect,e.Label.Connect,t,o)}static{this.code=e.Code.Connect}}e.Connect=x;class f extends r{constructor(t,o){super(e.Code.Blocked,e.Label.Blocked,t,o)}static{this.code=e.Code.Blocked}}e.Blocked=f;class B extends r{constructor(t,o){super(e.Code.Unknown,e.Label.Unknown,t,o)}static{this.code=e.Code.Unknown}}e.Unknown=B;class k extends r{constructor(t,o){super(e.Code.Field,e.Label.Field,t,o)}static{this.code=e.Code.Field}}e.Field=k;class P extends r{constructor(t,o){super(e.Code.Calc,e.Label.Calc,t,o)}static{this.code=e.Code.Calc}}e.Calc=P;class A extends r{constructor(t,o){super(e.Code.Busy,e.Label.Busy,t,o)}static{this.code=e.Code.Busy}}e.Busy=A;class T extends r{constructor(t,o){super(e.Code.Python,e.Label.Python,t,o)}static{this.code=e.Code.Python}}e.Python=T;class R extends r{constructor(t,o){super(e.Code.Timeout,e.Label.Timeout,t,o)}static{this.code=e.Code.Timeout}}e.Timeout=R})(exports.FormulaError||(exports.FormulaError={}));const l={};l[exports.FormulaError.Code.Parse]=exports.FormulaError.Parse,l[exports.FormulaError.Code.Null]=exports.FormulaError.Null,l[exports.FormulaError.Code.Div0]=exports.FormulaError.Div0,l[exports.FormulaError.Code.Value]=exports.FormulaError.Value,l[exports.FormulaError.Code.Ref]=exports.FormulaError.Ref,l[exports.FormulaError.Code.Name]=exports.FormulaError.Name,l[exports.FormulaError.Code.Num]=exports.FormulaError.Num,l[exports.FormulaError.Code.NA]=exports.FormulaError.NA,l[exports.FormulaError.Code.GettingData]=exports.FormulaError.GettingData,l[exports.FormulaError.Code.Spill]=exports.FormulaError.Spill,l[exports.FormulaError.Code.Connect]=exports.FormulaError.Connect,l[exports.FormulaError.Code.Blocked]=exports.FormulaError.Blocked,l[exports.FormulaError.Code.Unknown]=exports.FormulaError.Unknown,l[exports.FormulaError.Code.Field]=exports.FormulaError.Field,l[exports.FormulaError.Code.Calc]=exports.FormulaError.Calc,l[exports.FormulaError.Code.Busy]=exports.FormulaError.Busy,l[exports.FormulaError.Code.Python]=exports.FormulaError.Python,l[exports.FormulaError.Code.Timeout]=exports.FormulaError.Timeout;const g=new Map,m=new Map,E=new Map,b=new Map,F=Object.keys(l);for(let e=0;e<F.length;e++){const r=F[e],s=l[r];E.set(exports.FormulaError.Label[r],s),b.set(exports.FormulaError.Code[r],s);const u=new s;g.set(u.getLabel(),u),m.set(u.getCode(),u)}const O=m.get(exports.FormulaError.Code.Unknown);var n;(n=exports.FormulaError||(exports.FormulaError={})).BuiltIn={Parse:new n.Parse,Null:new n.Null,Div0:new n.Div0,Value:new n.Value,Ref:new n.Ref,Name:new n.Name,Num:new n.Num,NA:new n.NA,GettingData:new n.GettingData,Spill:new n.Spill,Connect:new n.Connect,Blocked:new n.Blocked,Unknown:new n.Unknown,Field:new n.Field,Calc:new n.Calc,Busy:new n.Busy,Python:new n.Python,Timeout:new n.Timeout},n.getBuiltInByLabel=e=>g.get(e),n.newTypedError=(e,r,s)=>{let u;return u=typeof e=="string"?E.get(e):b.get(e),u||(u=n.Unknown),new u(r,s)},n.getBuiltInById=e=>m.get(e)||O;class w{getRange(r){throw new d}getReference(r,s){throw new d}getNumberFormat(r,s){return s?.toString()??""}fromOADate(r){return new Date(r)}toOADate(r){return r.getTime()}getValueAt(r,s){return null}getEntireCoords(){return I}isValidDate(r){return(r instanceof Date||Object.prototype.toString.call(r)==="[object Date]")&&!isNaN(r.getTime())}getPosition(){return v}getFormulaAt(r,s){return null}getSpillAt(r,s){return null}getSheetIndex(r){return-1}getSheetCount(){return 1}markVolatile(){}formatResults(r){}getFunction(r){return null}getAddress(r,s){throw new d}parseAsDateTime(r,s){throw new d}getRuntime(){return V}}class d extends Error{constructor(r="Not implemented in StubbedFormulaContext"){super(r),this.name="NotImplementedError"}}const v=Object.freeze({colIndex:0,rowIndex:0}),I=Object.freeze({colStart:0,rowStart:0,colEnd:Math.pow(2,14)-1,rowEnd:Math.pow(2,20)-1}),V={getCurrencySymbol:()=>"$",getNumberDecimalSeparator:()=>".",getNumberGroupSeparator:()=>",",isDate1904:()=>!1,getLocation:()=>"unknown",getVersion:()=>"1.0.0",getOS:()=>"unknown",getUser:()=>"unidentified",getDescription:()=>"Stubbed Formula Context"},G=new w;exports.FormulaContext=G,exports.Observable=class{constructor(e){this._subscribeFn=e}subscribe(e,r,s){const u=typeof e=="object"?{next:e.next||(()=>{}),error:e.error||(()=>{}),complete:e.complete||(()=>{}),unsubscribe:()=>{}}:{next:e||(()=>{}),error:r||(()=>{}),complete:s||(()=>{}),unsubscribe:()=>{}},c=this._subscribeFn(u);return u.unsubscribe=()=>{typeof c=="function"&&c()},u}},exports.ScalarType={Number:"n",String:"s",Boolean:"b",Error:"e",RichData:"r",Null:"z"},exports.StubbedFormulaContext=w;
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/primitives - Primitive - Base types for SheetXL functions. - v0.0.0
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
const M = { Number: "n", String: "s", Boolean: "b", Error: "e", RichData: "r", Null: "z" };
|
|
8
|
+
var w, C, n;
|
|
9
|
+
(C = w || (w = {})).Orientation = { Column: "column", Row: "row" }, C.Orientations = { ...C.Orientation, Both: "both" }, C.Direction = { Up: "up", Down: "down", Left: "left", Right: "right" }, ((e) => {
|
|
10
|
+
e.Code = { Parse: 0, Null: 1, Div0: 2, Value: 3, Ref: 4, Name: 5, Num: 6, NA: 7, GettingData: 8, Spill: 9, Connect: 10, Blocked: 11, Unknown: 12, Field: 13, Calc: 14, Busy: 16, Python: 19, Timeout: 20 }, e.Label = { Parse: "#PARSE!", Null: "#NULL!", Div0: "#DIV/0!", Value: "#VALUE!", Ref: "#REF!", Name: "#NAME?", Num: "#NUM!", NA: "#N/A", GettingData: "#GETTING_DATA", Spill: "#SPILL!", Connect: "#CONNECT!", Blocked: "#BLOCKED!", Unknown: "#UNKNOWN!", Field: "#FIELD!", Calc: "#CALC!", Busy: "#BUSY!", Python: "#PYTHON!", Timeout: "#TIMEOUT!" };
|
|
11
|
+
class t extends Error {
|
|
12
|
+
constructor(o, s, O, b) {
|
|
13
|
+
super(O, b), this._label = s, this._code = o, this.details = b;
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.code = e.Code.Unknown;
|
|
17
|
+
}
|
|
18
|
+
get isFormulaError() {
|
|
19
|
+
return !0;
|
|
20
|
+
}
|
|
21
|
+
getLabel() {
|
|
22
|
+
return this._label;
|
|
23
|
+
}
|
|
24
|
+
getCode() {
|
|
25
|
+
return this._code;
|
|
26
|
+
}
|
|
27
|
+
equals(o) {
|
|
28
|
+
return !!o && (this._code === o._code || this._code === o.code);
|
|
29
|
+
}
|
|
30
|
+
get [Symbol.toStringTag]() {
|
|
31
|
+
return "[FormulaError]";
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return this.message || this._label;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
e.Known = t;
|
|
38
|
+
class c extends t {
|
|
39
|
+
constructor(o, s) {
|
|
40
|
+
super(e.Code.Parse, e.Label.Parse, o, s);
|
|
41
|
+
}
|
|
42
|
+
static {
|
|
43
|
+
this.code = e.Code.Parse;
|
|
44
|
+
}
|
|
45
|
+
getDetails() {
|
|
46
|
+
const o = this.details;
|
|
47
|
+
return { line: o?.line ?? 1, column: o?.column ?? 1, offset: o?.offset ?? 0, length: o?.length ?? 0 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
e.Parse = c;
|
|
51
|
+
class u extends t {
|
|
52
|
+
constructor(o, s) {
|
|
53
|
+
super(e.Code.Null, e.Label.Null, o, s);
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.code = e.Code.Null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
e.Null = u;
|
|
60
|
+
class i extends t {
|
|
61
|
+
constructor(o, s) {
|
|
62
|
+
super(e.Code.Div0, e.Label.Div0, o, s);
|
|
63
|
+
}
|
|
64
|
+
static {
|
|
65
|
+
this.code = e.Code.Div0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
e.Div0 = i;
|
|
69
|
+
class d extends t {
|
|
70
|
+
constructor(o, s) {
|
|
71
|
+
super(e.Code.Value, e.Label.Value, o, s);
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
this.code = e.Code.Value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
e.Value = d;
|
|
78
|
+
class L extends t {
|
|
79
|
+
constructor(o, s) {
|
|
80
|
+
super(e.Code.Ref, e.Label.Ref, o, s);
|
|
81
|
+
}
|
|
82
|
+
static {
|
|
83
|
+
this.code = e.Code.Ref;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
e.Ref = L;
|
|
87
|
+
class y extends t {
|
|
88
|
+
constructor(o, s) {
|
|
89
|
+
super(e.Code.Name, e.Label.Name, o, s);
|
|
90
|
+
}
|
|
91
|
+
static {
|
|
92
|
+
this.code = e.Code.Name;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
e.Name = y;
|
|
96
|
+
class S extends t {
|
|
97
|
+
constructor(o, s) {
|
|
98
|
+
super(e.Code.Num, e.Label.Num, o, s);
|
|
99
|
+
}
|
|
100
|
+
static {
|
|
101
|
+
this.code = e.Code.Num;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
e.Num = S;
|
|
105
|
+
class x extends t {
|
|
106
|
+
constructor(o, s) {
|
|
107
|
+
super(e.Code.NA, e.Label.NA, o, s);
|
|
108
|
+
}
|
|
109
|
+
static {
|
|
110
|
+
this.code = e.Code.NA;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
e.NA = x;
|
|
114
|
+
class B extends t {
|
|
115
|
+
constructor(o, s) {
|
|
116
|
+
super(e.Code.GettingData, e.Label.GettingData, o, s);
|
|
117
|
+
}
|
|
118
|
+
static {
|
|
119
|
+
this.code = e.Code.GettingData;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
e.GettingData = B;
|
|
123
|
+
class f extends t {
|
|
124
|
+
constructor(o, s) {
|
|
125
|
+
super(e.Code.Spill, e.Label.Spill, o, s);
|
|
126
|
+
}
|
|
127
|
+
static {
|
|
128
|
+
this.code = e.Code.Spill;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
e.Spill = f;
|
|
132
|
+
class k extends t {
|
|
133
|
+
constructor(o, s) {
|
|
134
|
+
super(e.Code.Connect, e.Label.Connect, o, s);
|
|
135
|
+
}
|
|
136
|
+
static {
|
|
137
|
+
this.code = e.Code.Connect;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
e.Connect = k;
|
|
141
|
+
class A extends t {
|
|
142
|
+
constructor(o, s) {
|
|
143
|
+
super(e.Code.Blocked, e.Label.Blocked, o, s);
|
|
144
|
+
}
|
|
145
|
+
static {
|
|
146
|
+
this.code = e.Code.Blocked;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
e.Blocked = A;
|
|
150
|
+
class F extends t {
|
|
151
|
+
constructor(o, s) {
|
|
152
|
+
super(e.Code.Unknown, e.Label.Unknown, o, s);
|
|
153
|
+
}
|
|
154
|
+
static {
|
|
155
|
+
this.code = e.Code.Unknown;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
e.Unknown = F;
|
|
159
|
+
class P extends t {
|
|
160
|
+
constructor(o, s) {
|
|
161
|
+
super(e.Code.Field, e.Label.Field, o, s);
|
|
162
|
+
}
|
|
163
|
+
static {
|
|
164
|
+
this.code = e.Code.Field;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
e.Field = P;
|
|
168
|
+
class T extends t {
|
|
169
|
+
constructor(o, s) {
|
|
170
|
+
super(e.Code.Calc, e.Label.Calc, o, s);
|
|
171
|
+
}
|
|
172
|
+
static {
|
|
173
|
+
this.code = e.Code.Calc;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
e.Calc = T;
|
|
177
|
+
class U extends t {
|
|
178
|
+
constructor(o, s) {
|
|
179
|
+
super(e.Code.Busy, e.Label.Busy, o, s);
|
|
180
|
+
}
|
|
181
|
+
static {
|
|
182
|
+
this.code = e.Code.Busy;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
e.Busy = U;
|
|
186
|
+
class E extends t {
|
|
187
|
+
constructor(o, s) {
|
|
188
|
+
super(e.Code.Python, e.Label.Python, o, s);
|
|
189
|
+
}
|
|
190
|
+
static {
|
|
191
|
+
this.code = e.Code.Python;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
e.Python = E;
|
|
195
|
+
class R extends t {
|
|
196
|
+
constructor(o, s) {
|
|
197
|
+
super(e.Code.Timeout, e.Label.Timeout, o, s);
|
|
198
|
+
}
|
|
199
|
+
static {
|
|
200
|
+
this.code = e.Code.Timeout;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
e.Timeout = R;
|
|
204
|
+
})(n || (n = {}));
|
|
205
|
+
const a = {};
|
|
206
|
+
a[n.Code.Parse] = n.Parse, a[n.Code.Null] = n.Null, a[n.Code.Div0] = n.Div0, a[n.Code.Value] = n.Value, a[n.Code.Ref] = n.Ref, a[n.Code.Name] = n.Name, a[n.Code.Num] = n.Num, a[n.Code.NA] = n.NA, a[n.Code.GettingData] = n.GettingData, a[n.Code.Spill] = n.Spill, a[n.Code.Connect] = n.Connect, a[n.Code.Blocked] = n.Blocked, a[n.Code.Unknown] = n.Unknown, a[n.Code.Field] = n.Field, a[n.Code.Calc] = n.Calc, a[n.Code.Busy] = n.Busy, a[n.Code.Python] = n.Python, a[n.Code.Timeout] = n.Timeout;
|
|
207
|
+
const h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), N = Object.keys(a);
|
|
208
|
+
for (let e = 0; e < N.length; e++) {
|
|
209
|
+
const t = N[e], c = a[t];
|
|
210
|
+
p.set(n.Label[t], c), D.set(n.Code[t], c);
|
|
211
|
+
const u = new c();
|
|
212
|
+
h.set(u.getLabel(), u), g.set(u.getCode(), u);
|
|
213
|
+
}
|
|
214
|
+
const V = g.get(n.Code.Unknown);
|
|
215
|
+
var r;
|
|
216
|
+
(r = n || (n = {})).BuiltIn = { Parse: new r.Parse(), Null: new r.Null(), Div0: new r.Div0(), Value: new r.Value(), Ref: new r.Ref(), Name: new r.Name(), Num: new r.Num(), NA: new r.NA(), GettingData: new r.GettingData(), Spill: new r.Spill(), Connect: new r.Connect(), Blocked: new r.Blocked(), Unknown: new r.Unknown(), Field: new r.Field(), Calc: new r.Calc(), Busy: new r.Busy(), Python: new r.Python(), Timeout: new r.Timeout() }, r.getBuiltInByLabel = (e) => h.get(e), r.newTypedError = (e, t, c) => {
|
|
217
|
+
let u;
|
|
218
|
+
return u = typeof e == "string" ? p.get(e) : D.get(e), u || (u = r.Unknown), new u(t, c);
|
|
219
|
+
}, r.getBuiltInById = (e) => g.get(e) || V;
|
|
220
|
+
class j {
|
|
221
|
+
constructor(t) {
|
|
222
|
+
this._subscribeFn = t;
|
|
223
|
+
}
|
|
224
|
+
subscribe(t, c, u) {
|
|
225
|
+
const i = typeof t == "object" ? { next: t.next || (() => {
|
|
226
|
+
}), error: t.error || (() => {
|
|
227
|
+
}), complete: t.complete || (() => {
|
|
228
|
+
}), unsubscribe: () => {
|
|
229
|
+
} } : { next: t || (() => {
|
|
230
|
+
}), error: c || (() => {
|
|
231
|
+
}), complete: u || (() => {
|
|
232
|
+
}), unsubscribe: () => {
|
|
233
|
+
} }, d = this._subscribeFn(i);
|
|
234
|
+
return i.unsubscribe = () => {
|
|
235
|
+
typeof d == "function" && d();
|
|
236
|
+
}, i;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
class I {
|
|
240
|
+
getRange(t) {
|
|
241
|
+
throw new m();
|
|
242
|
+
}
|
|
243
|
+
getReference(t, c) {
|
|
244
|
+
throw new m();
|
|
245
|
+
}
|
|
246
|
+
getNumberFormat(t, c) {
|
|
247
|
+
return c?.toString() ?? "";
|
|
248
|
+
}
|
|
249
|
+
fromOADate(t) {
|
|
250
|
+
return new Date(t);
|
|
251
|
+
}
|
|
252
|
+
toOADate(t) {
|
|
253
|
+
return t.getTime();
|
|
254
|
+
}
|
|
255
|
+
getValueAt(t, c) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
getEntireCoords() {
|
|
259
|
+
return G;
|
|
260
|
+
}
|
|
261
|
+
isValidDate(t) {
|
|
262
|
+
return (t instanceof Date || Object.prototype.toString.call(t) === "[object Date]") && !isNaN(t.getTime());
|
|
263
|
+
}
|
|
264
|
+
getPosition() {
|
|
265
|
+
return v;
|
|
266
|
+
}
|
|
267
|
+
getFormulaAt(t, c) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
getSpillAt(t, c) {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
getSheetIndex(t) {
|
|
274
|
+
return -1;
|
|
275
|
+
}
|
|
276
|
+
getSheetCount() {
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
markVolatile() {
|
|
280
|
+
}
|
|
281
|
+
formatResults(t) {
|
|
282
|
+
}
|
|
283
|
+
getFunction(t) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
getAddress(t, c) {
|
|
287
|
+
throw new m();
|
|
288
|
+
}
|
|
289
|
+
parseAsDateTime(t, c) {
|
|
290
|
+
throw new m();
|
|
291
|
+
}
|
|
292
|
+
getRuntime() {
|
|
293
|
+
return _;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
class m extends Error {
|
|
297
|
+
constructor(t = "Not implemented in StubbedFormulaContext") {
|
|
298
|
+
super(t), this.name = "NotImplementedError";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const v = Object.freeze({ colIndex: 0, rowIndex: 0 }), G = Object.freeze({ colStart: 0, rowStart: 0, colEnd: Math.pow(2, 14) - 1, rowEnd: Math.pow(2, 20) - 1 }), _ = { getCurrencySymbol: () => "$", getNumberDecimalSeparator: () => ".", getNumberGroupSeparator: () => ",", isDate1904: () => !1, getLocation: () => "unknown", getVersion: () => "1.0.0", getOS: () => "unknown", getUser: () => "unidentified", getDescription: () => "Stubbed Formula Context" }, z = new I();
|
|
302
|
+
export {
|
|
303
|
+
z as FormulaContext,
|
|
304
|
+
n as FormulaError,
|
|
305
|
+
w as IRange,
|
|
306
|
+
j as Observable,
|
|
307
|
+
M as ScalarType,
|
|
308
|
+
I as StubbedFormulaContext
|
|
309
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
No third parties dependencies
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/primitives - Primitive - Base types for SheetXL functions. - v0.0.0
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
const e = { Number: "n", String: "s", Boolean: "b", Error: "e", RichData: "r", Null: "z" };
|
|
8
|
+
var t, o, n;
|
|
9
|
+
(o = t || (t = {})).Orientation = { Column: "column", Row: "row" }, o.Orientations = { ...o.Orientation, Both: "both" }, o.Direction = { Up: "up", Down: "down", Left: "left", Right: "right" }, ((e2) => {
|
|
10
|
+
e2.Code = { Parse: 0, Null: 1, Div0: 2, Value: 3, Ref: 4, Name: 5, Num: 6, NA: 7, GettingData: 8, Spill: 9, Connect: 10, Blocked: 11, Unknown: 12, Field: 13, Calc: 14, Busy: 16, Python: 19, Timeout: 20 }, e2.Label = { Parse: "#PARSE!", Null: "#NULL!", Div0: "#DIV/0!", Value: "#VALUE!", Ref: "#REF!", Name: "#NAME?", Num: "#NUM!", NA: "#N/A", GettingData: "#GETTING_DATA", Spill: "#SPILL!", Connect: "#CONNECT!", Blocked: "#BLOCKED!", Unknown: "#UNKNOWN!", Field: "#FIELD!", Calc: "#CALC!", Busy: "#BUSY!", Python: "#PYTHON!", Timeout: "#TIMEOUT!" };
|
|
11
|
+
class t2 extends Error {
|
|
12
|
+
constructor(e3, t3, o3, n3) {
|
|
13
|
+
super(o3, n3), this._label = t3, this._code = e3, this.details = n3;
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.code = e2.Code.Unknown;
|
|
17
|
+
}
|
|
18
|
+
get isFormulaError() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
getLabel() {
|
|
22
|
+
return this._label;
|
|
23
|
+
}
|
|
24
|
+
getCode() {
|
|
25
|
+
return this._code;
|
|
26
|
+
}
|
|
27
|
+
equals(e3) {
|
|
28
|
+
return !!e3 && (this._code === e3._code || this._code === e3.code);
|
|
29
|
+
}
|
|
30
|
+
get [Symbol.toStringTag]() {
|
|
31
|
+
return "[FormulaError]";
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return this.message || this._label;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
e2.Known = t2;
|
|
38
|
+
class o2 extends t2 {
|
|
39
|
+
constructor(t3, o3) {
|
|
40
|
+
super(e2.Code.Parse, e2.Label.Parse, t3, o3);
|
|
41
|
+
}
|
|
42
|
+
static {
|
|
43
|
+
this.code = e2.Code.Parse;
|
|
44
|
+
}
|
|
45
|
+
getDetails() {
|
|
46
|
+
const e3 = this.details;
|
|
47
|
+
return { line: e3?.line ?? 1, column: e3?.column ?? 1, offset: e3?.offset ?? 0, length: e3?.length ?? 0 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
e2.Parse = o2;
|
|
51
|
+
class n2 extends t2 {
|
|
52
|
+
constructor(t3, o3) {
|
|
53
|
+
super(e2.Code.Null, e2.Label.Null, t3, o3);
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.code = e2.Code.Null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
e2.Null = n2;
|
|
60
|
+
class s2 extends t2 {
|
|
61
|
+
constructor(t3, o3) {
|
|
62
|
+
super(e2.Code.Div0, e2.Label.Div0, t3, o3);
|
|
63
|
+
}
|
|
64
|
+
static {
|
|
65
|
+
this.code = e2.Code.Div0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
e2.Div0 = s2;
|
|
69
|
+
class r2 extends t2 {
|
|
70
|
+
constructor(t3, o3) {
|
|
71
|
+
super(e2.Code.Value, e2.Label.Value, t3, o3);
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
this.code = e2.Code.Value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
e2.Value = r2;
|
|
78
|
+
class l2 extends t2 {
|
|
79
|
+
constructor(t3, o3) {
|
|
80
|
+
super(e2.Code.Ref, e2.Label.Ref, t3, o3);
|
|
81
|
+
}
|
|
82
|
+
static {
|
|
83
|
+
this.code = e2.Code.Ref;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
e2.Ref = l2;
|
|
87
|
+
class a2 extends t2 {
|
|
88
|
+
constructor(t3, o3) {
|
|
89
|
+
super(e2.Code.Name, e2.Label.Name, t3, o3);
|
|
90
|
+
}
|
|
91
|
+
static {
|
|
92
|
+
this.code = e2.Code.Name;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
e2.Name = a2;
|
|
96
|
+
class c2 extends t2 {
|
|
97
|
+
constructor(t3, o3) {
|
|
98
|
+
super(e2.Code.Num, e2.Label.Num, t3, o3);
|
|
99
|
+
}
|
|
100
|
+
static {
|
|
101
|
+
this.code = e2.Code.Num;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
e2.Num = c2;
|
|
105
|
+
class i2 extends t2 {
|
|
106
|
+
constructor(t3, o3) {
|
|
107
|
+
super(e2.Code.NA, e2.Label.NA, t3, o3);
|
|
108
|
+
}
|
|
109
|
+
static {
|
|
110
|
+
this.code = e2.Code.NA;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
e2.NA = i2;
|
|
114
|
+
class u2 extends t2 {
|
|
115
|
+
constructor(t3, o3) {
|
|
116
|
+
super(e2.Code.GettingData, e2.Label.GettingData, t3, o3);
|
|
117
|
+
}
|
|
118
|
+
static {
|
|
119
|
+
this.code = e2.Code.GettingData;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
e2.GettingData = u2;
|
|
123
|
+
class d2 extends t2 {
|
|
124
|
+
constructor(t3, o3) {
|
|
125
|
+
super(e2.Code.Spill, e2.Label.Spill, t3, o3);
|
|
126
|
+
}
|
|
127
|
+
static {
|
|
128
|
+
this.code = e2.Code.Spill;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
e2.Spill = d2;
|
|
132
|
+
class C2 extends t2 {
|
|
133
|
+
constructor(t3, o3) {
|
|
134
|
+
super(e2.Code.Connect, e2.Label.Connect, t3, o3);
|
|
135
|
+
}
|
|
136
|
+
static {
|
|
137
|
+
this.code = e2.Code.Connect;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
e2.Connect = C2;
|
|
141
|
+
class m2 extends t2 {
|
|
142
|
+
constructor(t3, o3) {
|
|
143
|
+
super(e2.Code.Blocked, e2.Label.Blocked, t3, o3);
|
|
144
|
+
}
|
|
145
|
+
static {
|
|
146
|
+
this.code = e2.Code.Blocked;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
e2.Blocked = m2;
|
|
150
|
+
class g2 extends t2 {
|
|
151
|
+
constructor(t3, o3) {
|
|
152
|
+
super(e2.Code.Unknown, e2.Label.Unknown, t3, o3);
|
|
153
|
+
}
|
|
154
|
+
static {
|
|
155
|
+
this.code = e2.Code.Unknown;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
e2.Unknown = g2;
|
|
159
|
+
class w2 extends t2 {
|
|
160
|
+
constructor(t3, o3) {
|
|
161
|
+
super(e2.Code.Field, e2.Label.Field, t3, o3);
|
|
162
|
+
}
|
|
163
|
+
static {
|
|
164
|
+
this.code = e2.Code.Field;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
e2.Field = w2;
|
|
168
|
+
class N2 extends t2 {
|
|
169
|
+
constructor(t3, o3) {
|
|
170
|
+
super(e2.Code.Calc, e2.Label.Calc, t3, o3);
|
|
171
|
+
}
|
|
172
|
+
static {
|
|
173
|
+
this.code = e2.Code.Calc;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
e2.Calc = N2;
|
|
177
|
+
class h2 extends t2 {
|
|
178
|
+
constructor(t3, o3) {
|
|
179
|
+
super(e2.Code.Busy, e2.Label.Busy, t3, o3);
|
|
180
|
+
}
|
|
181
|
+
static {
|
|
182
|
+
this.code = e2.Code.Busy;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
e2.Busy = h2;
|
|
186
|
+
class b2 extends t2 {
|
|
187
|
+
constructor(t3, o3) {
|
|
188
|
+
super(e2.Code.Python, e2.Label.Python, t3, o3);
|
|
189
|
+
}
|
|
190
|
+
static {
|
|
191
|
+
this.code = e2.Code.Python;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
e2.Python = b2;
|
|
195
|
+
class p extends t2 {
|
|
196
|
+
constructor(t3, o3) {
|
|
197
|
+
super(e2.Code.Timeout, e2.Label.Timeout, t3, o3);
|
|
198
|
+
}
|
|
199
|
+
static {
|
|
200
|
+
this.code = e2.Code.Timeout;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
e2.Timeout = p;
|
|
204
|
+
})(n || (n = {}));
|
|
205
|
+
const s = {};
|
|
206
|
+
s[n.Code.Parse] = n.Parse, s[n.Code.Null] = n.Null, s[n.Code.Div0] = n.Div0, s[n.Code.Value] = n.Value, s[n.Code.Ref] = n.Ref, s[n.Code.Name] = n.Name, s[n.Code.Num] = n.Num, s[n.Code.NA] = n.NA, s[n.Code.GettingData] = n.GettingData, s[n.Code.Spill] = n.Spill, s[n.Code.Connect] = n.Connect, s[n.Code.Blocked] = n.Blocked, s[n.Code.Unknown] = n.Unknown, s[n.Code.Field] = n.Field, s[n.Code.Calc] = n.Calc, s[n.Code.Busy] = n.Busy, s[n.Code.Python] = n.Python, s[n.Code.Timeout] = n.Timeout;
|
|
207
|
+
const r = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), i = Object.keys(s);
|
|
208
|
+
for (let e2 = 0; e2 < i.length; e2++) {
|
|
209
|
+
const t2 = i[e2], o2 = s[t2];
|
|
210
|
+
a.set(n.Label[t2], o2), c.set(n.Code[t2], o2);
|
|
211
|
+
const u2 = new o2();
|
|
212
|
+
r.set(u2.getLabel(), u2), l.set(u2.getCode(), u2);
|
|
213
|
+
}
|
|
214
|
+
const u = l.get(n.Code.Unknown);
|
|
215
|
+
var d;
|
|
216
|
+
(d = n || (n = {})).BuiltIn = { Parse: new d.Parse(), Null: new d.Null(), Div0: new d.Div0(), Value: new d.Value(), Ref: new d.Ref(), Name: new d.Name(), Num: new d.Num(), NA: new d.NA(), GettingData: new d.GettingData(), Spill: new d.Spill(), Connect: new d.Connect(), Blocked: new d.Blocked(), Unknown: new d.Unknown(), Field: new d.Field(), Calc: new d.Calc(), Busy: new d.Busy(), Python: new d.Python(), Timeout: new d.Timeout() }, d.getBuiltInByLabel = (e2) => r.get(e2), d.newTypedError = (e2, t2, o2) => {
|
|
217
|
+
let n2;
|
|
218
|
+
return n2 = "string" == typeof e2 ? a.get(e2) : c.get(e2), n2 || (n2 = d.Unknown), new n2(t2, o2);
|
|
219
|
+
}, d.getBuiltInById = (e2) => l.get(e2) || u;
|
|
220
|
+
class C {
|
|
221
|
+
constructor(e2) {
|
|
222
|
+
this._subscribeFn = e2;
|
|
223
|
+
}
|
|
224
|
+
subscribe(e2, t2, o2) {
|
|
225
|
+
const n2 = "object" == typeof e2 ? { next: e2.next || (() => {
|
|
226
|
+
}), error: e2.error || (() => {
|
|
227
|
+
}), complete: e2.complete || (() => {
|
|
228
|
+
}), unsubscribe: () => {
|
|
229
|
+
} } : { next: e2 || (() => {
|
|
230
|
+
}), error: t2 || (() => {
|
|
231
|
+
}), complete: o2 || (() => {
|
|
232
|
+
}), unsubscribe: () => {
|
|
233
|
+
} }, s2 = this._subscribeFn(n2);
|
|
234
|
+
return n2.unsubscribe = () => {
|
|
235
|
+
"function" == typeof s2 && s2();
|
|
236
|
+
}, n2;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
class m {
|
|
240
|
+
getRange(e2) {
|
|
241
|
+
throw new g();
|
|
242
|
+
}
|
|
243
|
+
getReference(e2, t2) {
|
|
244
|
+
throw new g();
|
|
245
|
+
}
|
|
246
|
+
getNumberFormat(e2, t2) {
|
|
247
|
+
return t2?.toString() ?? "";
|
|
248
|
+
}
|
|
249
|
+
fromOADate(e2) {
|
|
250
|
+
return new Date(e2);
|
|
251
|
+
}
|
|
252
|
+
toOADate(e2) {
|
|
253
|
+
return e2.getTime();
|
|
254
|
+
}
|
|
255
|
+
getValueAt(e2, t2) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
getEntireCoords() {
|
|
259
|
+
return N;
|
|
260
|
+
}
|
|
261
|
+
isValidDate(e2) {
|
|
262
|
+
return (e2 instanceof Date || "[object Date]" === Object.prototype.toString.call(e2)) && !isNaN(e2.getTime());
|
|
263
|
+
}
|
|
264
|
+
getPosition() {
|
|
265
|
+
return w;
|
|
266
|
+
}
|
|
267
|
+
getFormulaAt(e2, t2) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
getSpillAt(e2, t2) {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
getSheetIndex(e2) {
|
|
274
|
+
return -1;
|
|
275
|
+
}
|
|
276
|
+
getSheetCount() {
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
markVolatile() {
|
|
280
|
+
}
|
|
281
|
+
formatResults(e2) {
|
|
282
|
+
}
|
|
283
|
+
getFunction(e2) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
getAddress(e2, t2) {
|
|
287
|
+
throw new g();
|
|
288
|
+
}
|
|
289
|
+
parseAsDateTime(e2, t2) {
|
|
290
|
+
throw new g();
|
|
291
|
+
}
|
|
292
|
+
getRuntime() {
|
|
293
|
+
return h;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
class g extends Error {
|
|
297
|
+
constructor(e2 = "Not implemented in StubbedFormulaContext") {
|
|
298
|
+
super(e2), this.name = "NotImplementedError";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const w = Object.freeze({ colIndex: 0, rowIndex: 0 }), N = Object.freeze({ colStart: 0, rowStart: 0, colEnd: Math.pow(2, 14) - 1, rowEnd: Math.pow(2, 20) - 1 }), h = { getCurrencySymbol: () => "$", getNumberDecimalSeparator: () => ".", getNumberGroupSeparator: () => ",", isDate1904: () => false, getLocation: () => "unknown", getVersion: () => "1.0.0", getOS: () => "unknown", getUser: () => "unidentified", getDescription: () => "Stubbed Formula Context" }, b = new m();
|
|
302
|
+
export {
|
|
303
|
+
b as FormulaContext,
|
|
304
|
+
n as FormulaError,
|
|
305
|
+
t as IRange,
|
|
306
|
+
C as Observable,
|
|
307
|
+
e as ScalarType,
|
|
308
|
+
m as StubbedFormulaContext
|
|
309
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sheetxl/primitives",
|
|
3
|
+
"description": "Primitive - Base types for SheetXL functions.",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./types/index.d.ts",
|
|
10
|
+
"browser": "./browser/esm/index.mjs",
|
|
11
|
+
"node": "./node/esm/index.mjs",
|
|
12
|
+
"import": "./browser/esm/index.mjs",
|
|
13
|
+
"require": "./browser/cjs/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"types": "./types/index.d.ts",
|
|
17
|
+
"module": "./browser/esm/index.mjs",
|
|
18
|
+
"main": "./browser/cjs/index.cjs",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"engineStrict": true,
|
|
27
|
+
"author": "Michael T Ford",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"sheetxl",
|
|
30
|
+
"spreadsheet",
|
|
31
|
+
"data-science",
|
|
32
|
+
"vector-api",
|
|
33
|
+
"formulas",
|
|
34
|
+
"primitives"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {},
|
|
37
|
+
"peerDependencies": {},
|
|
38
|
+
"devDependencies": {}
|
|
39
|
+
}
|