@sheetxl/primitives 0.8.0-beta.2 → 0.8.0-beta.21

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 CHANGED
@@ -1,11 +1,21 @@
1
- # Repository Licensing
1
+ MIT License
2
2
 
3
- SheetXL contains a mix of open-source and commercially licensed packages. Each package is individually licensed and contains its own license file.
3
+ Copyright (c) 2026-present SheetXL Inc. & Michael T. Ford
4
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.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
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.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
8
14
 
9
- For more details on commercial licensing, please visit our website:
10
-
11
- https://www.sheetxl.com/docs/guides/licensing-pricing
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.2
2
+ * @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.21
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
5
+ * License: MIT
6
6
  */
7
7
  var e;
8
8
  (function(e) {
@@ -21,6 +21,39 @@ var e;
21
21
  }
22
22
  return i === null ? e : i.join("");
23
23
  };
24
+ let n = e.MIN_NUMBER = 22250738585072014e-324;
25
+ e.flushSubnormal = function(e) {
26
+ return e > -n && e < n ? 0 : e;
27
+ }, e.isNumberTextInRange = function(e, t = ".") {
28
+ let n = e.length;
29
+ if (n < 309 && e.indexOf("E") < 0 && e.indexOf("e") < 0) return !0;
30
+ let r = t.charCodeAt(0), i = !1, a = !1, o = !1, s = 0, c = 0, l = 0, u = 0;
31
+ for (; u < n; u++) {
32
+ let t = e.charCodeAt(u);
33
+ if (t >= 48 && t <= 57) i = !0, a ? (l++, o || (t === 48 ? c++ : o = !0)) : (o || t !== 48) && (o = !0, s++);
34
+ else if (t === r) a = !0;
35
+ else if ((t === 69 || t === 101) && i) break;
36
+ }
37
+ let d = 0;
38
+ if (u < n) {
39
+ let t = u + 1, r = !1, i = e.charCodeAt(t);
40
+ i === 45 ? (r = !0, t++) : i === 43 && t++;
41
+ let a = 0;
42
+ for (; t < n; t++) {
43
+ let n = e.charCodeAt(t);
44
+ if (n < 48 || n > 57) break;
45
+ d = 10 * d + (n - 48), a++;
46
+ }
47
+ if (a === 0) return !0;
48
+ r && (d = -d);
49
+ }
50
+ if (o) {
51
+ let e = (s > 0 ? s - 1 : -(c + 1)) + d;
52
+ return e >= -309 && e <= 307;
53
+ }
54
+ let f = d - l;
55
+ return f >= -308 && f <= 308;
56
+ };
24
57
  })(e ||= {});
25
58
  var t, n, r, i, a = {
26
59
  Number: "number",
@@ -47,9 +80,7 @@ var t, n, r, i, a = {
47
80
  if (n === "~") {
48
81
  let n = e[t + 1];
49
82
  n !== "*" && n !== "?" && n !== "~" || (r += l(n), t++);
50
- continue;
51
- }
52
- n === "*" ? r += "[\\s\\S]*" : r += n === "?" ? "[\\s\\S]" : l(n);
83
+ } else r += n === "*" ? "[\\s\\S]*" : n === "?" ? "[\\s\\S]" : l(n);
53
84
  }
54
85
  return RegExp(n === "start" ? `^${r}` : n ? `^${r}$` : r, t);
55
86
  }
@@ -372,34 +403,34 @@ var v = class {
372
403
  }
373
404
  }, y = class {
374
405
  createRange(e, t, n) {
375
- throw new S();
406
+ throw x("createRange");
376
407
  }
377
408
  flattenAreas(e) {
378
- throw new S();
409
+ throw x("flattenAreas");
379
410
  }
380
411
  getReference(e, t) {
381
- throw new S();
412
+ throw x("getReference");
382
413
  }
383
414
  getResizedReference(e, t, n) {
384
- throw new S();
415
+ throw x("getResizedReference");
385
416
  }
386
417
  getNumberFormat(e, t) {
387
- throw new S();
418
+ throw x("getNumberFormat");
388
419
  }
389
420
  fromSerialDate(e, t) {
390
- throw new S();
421
+ throw x("fromSerialDate");
391
422
  }
392
423
  toSerialDate(e, t) {
393
- throw new S();
424
+ throw x("toSerialDate");
394
425
  }
395
426
  getDateParts(e, t) {
396
- throw new S();
427
+ throw x("getDateParts");
397
428
  }
398
429
  getSerialDate(e, t, n, r, i, a, o) {
399
- throw new S();
430
+ throw x("getSerialDate");
400
431
  }
401
432
  getNow() {
402
- throw new S();
433
+ throw x("getNow");
403
434
  }
404
435
  getRandom() {
405
436
  return Math.random();
@@ -408,10 +439,10 @@ var v = class {
408
439
  return null;
409
440
  }
410
441
  getEntireCoords() {
411
- return C;
442
+ return T;
412
443
  }
413
444
  isValidDate(e, t) {
414
- return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]" ? !isNaN(e.getTime()) : !t && typeof e == "number" && !(e < 0 || e > T);
445
+ return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]" ? !isNaN(e.getTime()) : !t && typeof e == "number" && !(e < 0 || e > D);
415
446
  }
416
447
  getRow() {
417
448
  return 0;
@@ -434,7 +465,7 @@ var v = class {
434
465
  getSheetCount() {
435
466
  return 1;
436
467
  }
437
- markVolatile() {}
468
+ defer(e, t) {}
438
469
  formatResults(e) {}
439
470
  filterHidden(e, t) {
440
471
  return e;
@@ -446,19 +477,25 @@ var v = class {
446
477
  return null;
447
478
  }
448
479
  getAddress(e, t) {
449
- throw new S();
480
+ throw x("getAddress");
450
481
  }
451
482
  parseAsSerialDate(e, t) {
452
- throw new S();
483
+ throw x("parseAsSerialDate");
453
484
  }
454
485
  parseAsDate(e, t) {
455
- throw new S();
486
+ throw x("parseAsDate");
456
487
  }
457
488
  parseAsNumber(e, t) {
458
- throw new S();
489
+ throw x("parseAsNumber");
459
490
  }
460
491
  createCriteria(e, t) {
461
- throw new S();
492
+ throw x("createCriteria");
493
+ }
494
+ createPivot(e, t, n) {
495
+ throw x("createPivot");
496
+ }
497
+ getPivotAt(e) {
498
+ return null;
462
499
  }
463
500
  parseAsLiteral(e) {
464
501
  let t = e.toUpperCase();
@@ -473,10 +510,13 @@ var v = class {
473
510
  return r === i ? e < t ? -1 : +(e > t) : r < i ? -1 : 1;
474
511
  }
475
512
  getRuntime() {
476
- return w;
513
+ return E;
477
514
  }
478
515
  getArgs() {
479
- throw new S(x);
516
+ throw new w(S);
517
+ }
518
+ createRichData(e, t) {
519
+ throw new w(C);
480
520
  }
481
521
  }, b = (e) => {
482
522
  if (e == null) return 0;
@@ -486,19 +526,19 @@ var v = class {
486
526
  case "boolean": return 3;
487
527
  default: return 4;
488
528
  }
489
- }, x = "FormulaContext.getArgs() is only valid while a function body is running", S = class extends Error {
529
+ }, x = (e) => new w(`FormulaContext.${e}() is only valid while a function body is running. A deferred executor reads its workbook through ctx.getFormulaContext().`), S = "FormulaContext.getArgs() is only valid while a function body is running", C = "FormulaContext.createRichData() needs a workbook being calculated", w = class extends Error {
490
530
  constructor(e = "Not implemented in StubbedFormulaContext") {
491
531
  super(e), this.name = "NotImplementedError";
492
532
  }
493
- }, C = Object.freeze({
533
+ }, T = Object.freeze({
494
534
  colStart: 0,
495
535
  rowStart: 0,
496
536
  colEnd: 2 ** 14 - 1,
497
537
  rowEnd: 2 ** 20 - 1
498
- }), w = {
538
+ }), E = {
499
539
  isDate1904: () => !1,
500
- getLocale: () => O.tag,
501
- getLocaleProfile: () => O,
540
+ getLocale: () => A.tag,
541
+ getLocaleProfile: () => A,
502
542
  isR1C1: () => !1,
503
543
  getNow: () => 0,
504
544
  getRandom: () => Math.random(),
@@ -507,12 +547,12 @@ var v = class {
507
547
  getOS: () => "unknown",
508
548
  getUser: () => "unidentified",
509
549
  getDescription: () => "Stubbed Formula Context"
510
- }, T = 2958465, E = new y(), D = class {
550
+ }, D = 2958465, O = new y(), k = class {
511
551
  constructor() {
512
- this._scope = E, this._argsFn = null;
552
+ this._scope = O, this._argsFn = null;
513
553
  }
514
554
  _setScope(e) {
515
- this._scope = e ?? E;
555
+ this._scope = e ?? O;
516
556
  }
517
557
  _getScope() {
518
558
  return this._scope;
@@ -524,7 +564,7 @@ var v = class {
524
564
  return this._getScope().getNumberFormat(e, t);
525
565
  }
526
566
  getEntireCoords() {
527
- return this._getScope().getEntireCoords() ?? C;
567
+ return this._getScope().getEntireCoords() ?? T;
528
568
  }
529
569
  parseAsSerialDate(e, t) {
530
570
  return this._getScope().parseAsSerialDate(e, t);
@@ -538,9 +578,15 @@ var v = class {
538
578
  createCriteria(e, t) {
539
579
  return this._getScope().createCriteria(e, t);
540
580
  }
581
+ createPivot(e, t, n) {
582
+ return this._getScope().createPivot(e, t, n);
583
+ }
584
+ getPivotAt(e) {
585
+ return this._getScope().getPivotAt?.(e) ?? null;
586
+ }
541
587
  parseAsLiteral(e) {
542
588
  let t = this._getScope();
543
- return t.parseAsLiteral ? t.parseAsLiteral(e) : E.parseAsLiteral(e);
589
+ return t.parseAsLiteral ? t.parseAsLiteral(e) : O.parseAsLiteral(e);
544
590
  }
545
591
  toText(e) {
546
592
  return this._getScope().toText(e);
@@ -608,8 +654,8 @@ var v = class {
608
654
  getSheetCount() {
609
655
  return this._getScope().getSheetCount?.() ?? 1;
610
656
  }
611
- markVolatile() {
612
- this._getScope().markVolatile?.();
657
+ defer(e, t) {
658
+ return this._getScope().defer?.(e, t);
613
659
  }
614
660
  formatResults(e) {
615
661
  this._getScope().formatResults?.(e);
@@ -627,14 +673,18 @@ var v = class {
627
673
  return this._getScope().getAddress(e, t);
628
674
  }
629
675
  compare(e, t, n) {
630
- return this._getScope().compare?.(e, t, n) ?? E.compare(e, t, n);
676
+ return this._getScope().compare?.(e, t, n) ?? O.compare(e, t, n);
631
677
  }
632
678
  getRuntime() {
633
679
  return this._getScope().getRuntime();
634
680
  }
681
+ createRichData(e, t) {
682
+ let n = this._getScope();
683
+ return n.createRichData ? n.createRichData(e, t) : O.createRichData(e, t);
684
+ }
635
685
  getArgs() {
636
686
  let e = this._argsFn, t = e ? e() : null;
637
- if (!t) throw new S(x);
687
+ if (!t) throw new w(S);
638
688
  return t;
639
689
  }
640
690
  get [Symbol.toStringTag]() {
@@ -643,7 +693,7 @@ var v = class {
643
693
  toString() {
644
694
  return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
645
695
  }
646
- }, O = Object.freeze({
696
+ }, A = Object.freeze({
647
697
  tag: "en-US",
648
698
  numberingSystem: "latn",
649
699
  decimal: ".",
@@ -723,5 +773,5 @@ var v = class {
723
773
  sensitivity: "base",
724
774
  numeric: !0
725
775
  })
726
- }), k = new D();
727
- export { O as DEFAULT_LOCALE_PROFILE, k as FormulaContext, i as FormulaError, t as IRange, r as IRangeStats, o as InteropScalarType, v as Observable, e as Scalar, a as ScalarType, D as ScopedFormulaContext, y as StubbedFormulaContext, s as ValueKind, u as WildCard, d as isLazyValue };
776
+ }), j = new k();
777
+ export { A as DEFAULT_LOCALE_PROFILE, j as FormulaContext, i as FormulaError, t as IRange, r as IRangeStats, o as InteropScalarType, v as Observable, e as Scalar, a as ScalarType, k as ScopedFormulaContext, y as StubbedFormulaContext, s as ValueKind, u as WildCard, d as isLazyValue };