@borgar/fx 4.12.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/index-BMr6cTgc.d.cts +1444 -0
  2. package/dist/index-BMr6cTgc.d.ts +1444 -0
  3. package/dist/index.cjs +3054 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +1 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +2984 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/xlsx/index.cjs +3120 -0
  10. package/dist/xlsx/index.cjs.map +1 -0
  11. package/dist/xlsx/index.d.cts +55 -0
  12. package/dist/xlsx/index.d.ts +55 -0
  13. package/dist/xlsx/index.js +3049 -0
  14. package/dist/xlsx/index.js.map +1 -0
  15. package/docs/API.md +2959 -718
  16. package/docs/AST_format.md +2 -2
  17. package/eslint.config.mjs +40 -0
  18. package/lib/a1.spec.ts +32 -0
  19. package/lib/a1.ts +26 -0
  20. package/lib/addA1RangeBounds.ts +50 -0
  21. package/lib/addTokenMeta.spec.ts +166 -0
  22. package/lib/{addTokenMeta.js → addTokenMeta.ts} +53 -33
  23. package/lib/astTypes.ts +211 -0
  24. package/lib/cloneToken.ts +29 -0
  25. package/lib/{constants.js → constants.ts} +6 -3
  26. package/lib/fixRanges.spec.ts +220 -0
  27. package/lib/fixRanges.ts +260 -0
  28. package/lib/fromCol.spec.ts +15 -0
  29. package/lib/{fromCol.js → fromCol.ts} +1 -1
  30. package/lib/index.spec.ts +119 -0
  31. package/lib/index.ts +76 -0
  32. package/lib/isNodeType.ts +151 -0
  33. package/lib/isType.spec.ts +208 -0
  34. package/lib/{isType.js → isType.ts} +26 -25
  35. package/lib/lexers/advRangeOp.ts +18 -0
  36. package/lib/lexers/canEndRange.ts +25 -0
  37. package/lib/lexers/lexBoolean.ts +55 -0
  38. package/lib/lexers/lexContext.ts +104 -0
  39. package/lib/lexers/lexError.ts +15 -0
  40. package/lib/lexers/lexFunction.ts +37 -0
  41. package/lib/lexers/lexNameFuncCntx.ts +112 -0
  42. package/lib/lexers/lexNamed.ts +60 -0
  43. package/lib/lexers/lexNewLine.ts +12 -0
  44. package/lib/lexers/lexNumber.ts +48 -0
  45. package/lib/lexers/lexOperator.ts +26 -0
  46. package/lib/lexers/lexRange.ts +15 -0
  47. package/lib/lexers/lexRangeA1.ts +134 -0
  48. package/lib/lexers/lexRangeR1C1.ts +146 -0
  49. package/lib/lexers/lexRangeTrim.ts +26 -0
  50. package/lib/lexers/lexRefOp.ts +19 -0
  51. package/lib/lexers/lexString.ts +22 -0
  52. package/lib/lexers/lexStructured.ts +25 -0
  53. package/lib/lexers/lexWhitespace.ts +31 -0
  54. package/lib/lexers/sets.ts +51 -0
  55. package/lib/mergeRefTokens.spec.ts +141 -0
  56. package/lib/{mergeRefTokens.js → mergeRefTokens.ts} +47 -32
  57. package/lib/nodeTypes.ts +54 -0
  58. package/lib/parse.spec.ts +1410 -0
  59. package/lib/{parser.js → parse.ts} +81 -63
  60. package/lib/parseA1Range.spec.ts +233 -0
  61. package/lib/parseA1Range.ts +206 -0
  62. package/lib/parseA1Ref.spec.ts +337 -0
  63. package/lib/parseA1Ref.ts +115 -0
  64. package/lib/parseR1C1Range.ts +191 -0
  65. package/lib/parseR1C1Ref.spec.ts +323 -0
  66. package/lib/parseR1C1Ref.ts +127 -0
  67. package/lib/parseRef.spec.ts +90 -0
  68. package/lib/parseRef.ts +240 -0
  69. package/lib/parseSRange.ts +240 -0
  70. package/lib/parseStructRef.spec.ts +168 -0
  71. package/lib/parseStructRef.ts +76 -0
  72. package/lib/stringifyA1Range.spec.ts +72 -0
  73. package/lib/stringifyA1Range.ts +72 -0
  74. package/lib/stringifyA1Ref.spec.ts +64 -0
  75. package/lib/stringifyA1Ref.ts +59 -0
  76. package/lib/{stringifyPrefix.js → stringifyPrefix.ts} +17 -2
  77. package/lib/stringifyR1C1Range.spec.ts +92 -0
  78. package/lib/stringifyR1C1Range.ts +73 -0
  79. package/lib/stringifyR1C1Ref.spec.ts +63 -0
  80. package/lib/stringifyR1C1Ref.ts +67 -0
  81. package/lib/stringifyStructRef.spec.ts +124 -0
  82. package/lib/stringifyStructRef.ts +113 -0
  83. package/lib/stringifyTokens.ts +15 -0
  84. package/lib/toCol.spec.ts +11 -0
  85. package/lib/{toCol.js → toCol.ts} +4 -4
  86. package/lib/tokenTypes.ts +76 -0
  87. package/lib/tokenize-srefs.spec.ts +429 -0
  88. package/lib/tokenize.spec.ts +2103 -0
  89. package/lib/tokenize.ts +346 -0
  90. package/lib/translate.spec.ts +35 -0
  91. package/lib/translateToA1.spec.ts +247 -0
  92. package/lib/translateToA1.ts +231 -0
  93. package/lib/translateToR1C1.spec.ts +227 -0
  94. package/lib/translateToR1C1.ts +145 -0
  95. package/lib/types.ts +179 -0
  96. package/lib/xlsx/index.spec.ts +27 -0
  97. package/lib/xlsx/index.ts +32 -0
  98. package/package.json +46 -30
  99. package/tsconfig.json +28 -0
  100. package/typedoc-ignore-links.ts +17 -0
  101. package/typedoc.json +41 -0
  102. package/.eslintrc +0 -22
  103. package/dist/fx.d.ts +0 -823
  104. package/dist/fx.js +0 -2
  105. package/dist/package.json +0 -1
  106. package/lib/a1.js +0 -348
  107. package/lib/a1.spec.js +0 -458
  108. package/lib/addTokenMeta.spec.js +0 -153
  109. package/lib/astTypes.js +0 -96
  110. package/lib/extraTypes.js +0 -74
  111. package/lib/fixRanges.js +0 -104
  112. package/lib/fixRanges.spec.js +0 -170
  113. package/lib/fromCol.spec.js +0 -11
  114. package/lib/index.js +0 -134
  115. package/lib/index.spec.js +0 -67
  116. package/lib/isType.spec.js +0 -168
  117. package/lib/lexer-srefs.spec.js +0 -324
  118. package/lib/lexer.js +0 -283
  119. package/lib/lexer.spec.js +0 -1953
  120. package/lib/lexerParts.js +0 -228
  121. package/lib/mergeRefTokens.spec.js +0 -121
  122. package/lib/package.json +0 -1
  123. package/lib/parseRef.js +0 -157
  124. package/lib/parseRef.spec.js +0 -71
  125. package/lib/parseSRange.js +0 -167
  126. package/lib/parseStructRef.js +0 -48
  127. package/lib/parseStructRef.spec.js +0 -164
  128. package/lib/parser.spec.js +0 -1208
  129. package/lib/rc.js +0 -341
  130. package/lib/rc.spec.js +0 -403
  131. package/lib/stringifyStructRef.js +0 -80
  132. package/lib/stringifyStructRef.spec.js +0 -182
  133. package/lib/toCol.spec.js +0 -11
  134. package/lib/translate-toA1.spec.js +0 -214
  135. package/lib/translate-toRC.spec.js +0 -197
  136. package/lib/translate.js +0 -239
  137. package/lib/translate.spec.js +0 -21
  138. package/rollup.config.mjs +0 -22
  139. package/tsd.json +0 -12
@@ -0,0 +1,55 @@
1
+ import { T as Token, a as TokenEnhanced } from '../index-BMr6cTgc.js';
2
+ export { an as ArrayExpression, ar as AstExpression, ak as BinaryExpression, al as BinaryOperator, am as CallExpression, ah as ErrorLiteral, ae as Identifier, ao as LambdaExpression, aq as LetDeclarator, ap as LetExpression, ag as Literal, M as MAX_COLS, r as MAX_ROWS, ad as Node, v as OptsFixRanges, i as OptsParse, X as OptsParseA1Ref, Z as OptsParseR1C1Ref, _ as OptsStringifyStructRef, O as OptsTokenize, n as OptsTranslateFormulaToA1, l as OptsTranslateToR1C1, q as OptsTranslateTokensToA1, a0 as RangeA1, a1 as RangeR1C1, a2 as ReferenceA1, a3 as ReferenceA1Xlsx, af as ReferenceIdentifier, a8 as ReferenceName, a9 as ReferenceNameXlsx, a4 as ReferenceR1C1, a5 as ReferenceR1C1Xlsx, a6 as ReferenceStruct, a7 as ReferenceStructXlsx, ac as SourceLocation, ai as UnaryExpression, aj as UnaryOperator, S as addA1RangeBounds, b as fixFormulaRanges, f as fixTokenRanges, V as fromCol, E as isArrayNode, F as isBinaryNode, G as isCallNode, w as isError, H as isErrorNode, I as isExpressionNode, x as isFunction, y as isFxPrefix, J as isIdentifierNode, K as isLambdaNode, L as isLetDeclaratorNode, N as isLetNode, z as isLiteral, P as isLiteralNode, A as isOperator, B as isRange, C as isReference, Q as isReferenceNode, R as isUnaryNode, D as isWhitespace, u as mergeRefTokens, ab as nodeTypes, h as parse, W as parseA1Range, p as parseA1Ref, Y as parseR1C1Range, c as parseR1C1Ref, d as parseStructRef, s as stringifyA1Ref, e as stringifyR1C1Ref, g as stringifyStructRef, $ as stringifyTokens, U as toCol, aa as tokenTypes, t as tokenize, m as translateFormulaToA1, j as translateFormulaToR1C1, o as translateTokensToA1, k as translateTokensToR1C1 } from '../index-BMr6cTgc.js';
3
+
4
+ /**
5
+ * Runs through a list of tokens and adds extra attributes such as matching
6
+ * parens and ranges.
7
+ *
8
+ * The `context` parameter defines default reference attributes:
9
+ * `{ workbookName: 'report.xlsx', sheetName: 'Sheet1' }`.
10
+ * If supplied, these are used to match `A1` to `Sheet1!A1`.
11
+ *
12
+ * All tokens will be tagged with a `.depth` number value to indicating the
13
+ * level of nesting in parentheses as well as an `.index` number indicating
14
+ * their zero based position in the list.
15
+ *
16
+ * The returned output will be the same array of tokens but the following
17
+ * properties will added to tokens (as applicable):
18
+ *
19
+ * #### Parentheses ( )
20
+ *
21
+ * Matching parens will be tagged with `.groupId` string identifier as well as
22
+ * a `.depth` number value (indicating the level of nesting).
23
+ *
24
+ * Closing parens without a counterpart will be tagged with `.error`
25
+ * (boolean true).
26
+ *
27
+ * #### Curly brackets { }
28
+ *
29
+ * Matching curly brackets will be tagged with `.groupId` string identifier.
30
+ * These may not be nested in Excel.
31
+ *
32
+ * Closing curly brackets without a counterpart will be tagged with `.error`
33
+ * (boolean `true`).
34
+ *
35
+ * #### Ranges (`REF_RANGE` or `REF_BEAM` type tokens)
36
+ *
37
+ * All ranges will be tagged with `.groupId` string identifier regardless of
38
+ * the number of times they occur.
39
+ *
40
+ * #### Tokens of type `UNKNOWN`
41
+ *
42
+ * All will be tagged with `.error` (boolean `true`).
43
+ *
44
+ * @param tokenlist An array of tokens (from `tokenize()`)
45
+ * @param [context={}] A contest used to match `A1` to `Sheet1!A1`.
46
+ * @param [context.sheetName=''] An implied sheet name ('Sheet1')
47
+ * @param [context.workbookName=''] An implied workbook name ('report.xlsx')
48
+ * @returns The input array with the enchanced tokens
49
+ */
50
+ declare function addTokenMeta(tokenlist: Token[], { sheetName, workbookName }?: {
51
+ sheetName?: string;
52
+ workbookName?: string;
53
+ }): TokenEnhanced[];
54
+
55
+ export { Token, TokenEnhanced, addTokenMeta };