@gridsheet/core 3.0.0-rc.8

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 (250) hide show
  1. package/README.md +17 -0
  2. package/dist/constants.d.ts +21 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +28 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/formula/evaluator.d.ts +134 -0
  7. package/dist/formula/evaluator.d.ts.map +1 -0
  8. package/dist/formula/evaluator.js +585 -0
  9. package/dist/formula/evaluator.js.map +1 -0
  10. package/dist/formula/formula-error.d.ts +10 -0
  11. package/dist/formula/formula-error.d.ts.map +1 -0
  12. package/dist/formula/formula-error.js +15 -0
  13. package/dist/formula/formula-error.js.map +1 -0
  14. package/dist/formula/functions/__async.d.ts +67 -0
  15. package/dist/formula/functions/__async.d.ts.map +1 -0
  16. package/dist/formula/functions/__async.js +70 -0
  17. package/dist/formula/functions/__async.js.map +1 -0
  18. package/dist/formula/functions/__base.d.ts +112 -0
  19. package/dist/formula/functions/__base.d.ts.map +1 -0
  20. package/dist/formula/functions/__base.js +265 -0
  21. package/dist/formula/functions/__base.js.map +1 -0
  22. package/dist/formula/functions/__utils.d.ts +28 -0
  23. package/dist/formula/functions/__utils.d.ts.map +1 -0
  24. package/dist/formula/functions/__utils.js +179 -0
  25. package/dist/formula/functions/__utils.js.map +1 -0
  26. package/dist/formula/functions/abs.d.ts +9 -0
  27. package/dist/formula/functions/abs.d.ts.map +1 -0
  28. package/dist/formula/functions/abs.js +15 -0
  29. package/dist/formula/functions/abs.js.map +1 -0
  30. package/dist/formula/functions/add.d.ts +10 -0
  31. package/dist/formula/functions/add.d.ts.map +1 -0
  32. package/dist/formula/functions/add.js +37 -0
  33. package/dist/formula/functions/add.js.map +1 -0
  34. package/dist/formula/functions/and.d.ts +9 -0
  35. package/dist/formula/functions/and.d.ts.map +1 -0
  36. package/dist/formula/functions/and.js +23 -0
  37. package/dist/formula/functions/and.js.map +1 -0
  38. package/dist/formula/functions/arrayformula.d.ts +12 -0
  39. package/dist/formula/functions/arrayformula.d.ts.map +1 -0
  40. package/dist/formula/functions/arrayformula.js +24 -0
  41. package/dist/formula/functions/arrayformula.js.map +1 -0
  42. package/dist/formula/functions/average.d.ts +9 -0
  43. package/dist/formula/functions/average.d.ts.map +1 -0
  44. package/dist/formula/functions/average.js +40 -0
  45. package/dist/formula/functions/average.js.map +1 -0
  46. package/dist/formula/functions/concat.d.ts +9 -0
  47. package/dist/formula/functions/concat.d.ts.map +1 -0
  48. package/dist/formula/functions/concat.js +27 -0
  49. package/dist/formula/functions/concat.js.map +1 -0
  50. package/dist/formula/functions/count.d.ts +9 -0
  51. package/dist/formula/functions/count.d.ts.map +1 -0
  52. package/dist/formula/functions/count.js +32 -0
  53. package/dist/formula/functions/count.js.map +1 -0
  54. package/dist/formula/functions/counta.d.ts +9 -0
  55. package/dist/formula/functions/counta.d.ts.map +1 -0
  56. package/dist/formula/functions/counta.js +32 -0
  57. package/dist/formula/functions/counta.js.map +1 -0
  58. package/dist/formula/functions/divide.d.ts +10 -0
  59. package/dist/formula/functions/divide.d.ts.map +1 -0
  60. package/dist/formula/functions/divide.js +34 -0
  61. package/dist/formula/functions/divide.js.map +1 -0
  62. package/dist/formula/functions/eq.d.ts +9 -0
  63. package/dist/formula/functions/eq.d.ts.map +1 -0
  64. package/dist/formula/functions/eq.js +19 -0
  65. package/dist/formula/functions/eq.js.map +1 -0
  66. package/dist/formula/functions/gt.d.ts +9 -0
  67. package/dist/formula/functions/gt.d.ts.map +1 -0
  68. package/dist/formula/functions/gt.js +19 -0
  69. package/dist/formula/functions/gt.js.map +1 -0
  70. package/dist/formula/functions/gte.d.ts +9 -0
  71. package/dist/formula/functions/gte.d.ts.map +1 -0
  72. package/dist/formula/functions/gte.js +19 -0
  73. package/dist/formula/functions/gte.js.map +1 -0
  74. package/dist/formula/functions/if.d.ts +9 -0
  75. package/dist/formula/functions/if.d.ts.map +1 -0
  76. package/dist/formula/functions/if.js +29 -0
  77. package/dist/formula/functions/if.js.map +1 -0
  78. package/dist/formula/functions/iferror.d.ts +10 -0
  79. package/dist/formula/functions/iferror.d.ts.map +1 -0
  80. package/dist/formula/functions/iferror.js +28 -0
  81. package/dist/formula/functions/iferror.js.map +1 -0
  82. package/dist/formula/functions/len.d.ts +9 -0
  83. package/dist/formula/functions/len.d.ts.map +1 -0
  84. package/dist/formula/functions/len.js +21 -0
  85. package/dist/formula/functions/len.js.map +1 -0
  86. package/dist/formula/functions/lt.d.ts +9 -0
  87. package/dist/formula/functions/lt.d.ts.map +1 -0
  88. package/dist/formula/functions/lt.js +19 -0
  89. package/dist/formula/functions/lt.js.map +1 -0
  90. package/dist/formula/functions/lte.d.ts +9 -0
  91. package/dist/formula/functions/lte.d.ts.map +1 -0
  92. package/dist/formula/functions/lte.js +19 -0
  93. package/dist/formula/functions/lte.js.map +1 -0
  94. package/dist/formula/functions/max.d.ts +9 -0
  95. package/dist/formula/functions/max.d.ts.map +1 -0
  96. package/dist/formula/functions/max.js +37 -0
  97. package/dist/formula/functions/max.js.map +1 -0
  98. package/dist/formula/functions/min.d.ts +9 -0
  99. package/dist/formula/functions/min.d.ts.map +1 -0
  100. package/dist/formula/functions/min.js +37 -0
  101. package/dist/formula/functions/min.js.map +1 -0
  102. package/dist/formula/functions/minus.d.ts +10 -0
  103. package/dist/formula/functions/minus.d.ts.map +1 -0
  104. package/dist/formula/functions/minus.js +41 -0
  105. package/dist/formula/functions/minus.js.map +1 -0
  106. package/dist/formula/functions/multiply.d.ts +9 -0
  107. package/dist/formula/functions/multiply.d.ts.map +1 -0
  108. package/dist/formula/functions/multiply.js +19 -0
  109. package/dist/formula/functions/multiply.js.map +1 -0
  110. package/dist/formula/functions/ne.d.ts +9 -0
  111. package/dist/formula/functions/ne.d.ts.map +1 -0
  112. package/dist/formula/functions/ne.js +19 -0
  113. package/dist/formula/functions/ne.js.map +1 -0
  114. package/dist/formula/functions/not.d.ts +9 -0
  115. package/dist/formula/functions/not.d.ts.map +1 -0
  116. package/dist/formula/functions/not.js +22 -0
  117. package/dist/formula/functions/not.js.map +1 -0
  118. package/dist/formula/functions/now.d.ts +9 -0
  119. package/dist/formula/functions/now.d.ts.map +1 -0
  120. package/dist/formula/functions/now.js +14 -0
  121. package/dist/formula/functions/now.js.map +1 -0
  122. package/dist/formula/functions/or.d.ts +9 -0
  123. package/dist/formula/functions/or.d.ts.map +1 -0
  124. package/dist/formula/functions/or.js +23 -0
  125. package/dist/formula/functions/or.js.map +1 -0
  126. package/dist/formula/functions/power.d.ts +9 -0
  127. package/dist/formula/functions/power.d.ts.map +1 -0
  128. package/dist/formula/functions/power.js +18 -0
  129. package/dist/formula/functions/power.js.map +1 -0
  130. package/dist/formula/functions/sum.d.ts +9 -0
  131. package/dist/formula/functions/sum.d.ts.map +1 -0
  132. package/dist/formula/functions/sum.js +34 -0
  133. package/dist/formula/functions/sum.js.map +1 -0
  134. package/dist/formula/functions/uminus.d.ts +9 -0
  135. package/dist/formula/functions/uminus.d.ts.map +1 -0
  136. package/dist/formula/functions/uminus.js +17 -0
  137. package/dist/formula/functions/uminus.js.map +1 -0
  138. package/dist/formula/mapping.d.ts +11 -0
  139. package/dist/formula/mapping.d.ts.map +1 -0
  140. package/dist/formula/mapping.js +82 -0
  141. package/dist/formula/mapping.js.map +1 -0
  142. package/dist/formula/solver.d.ts +39 -0
  143. package/dist/formula/solver.d.ts.map +1 -0
  144. package/dist/formula/solver.js +71 -0
  145. package/dist/formula/solver.js.map +1 -0
  146. package/dist/index.d.ts +22 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +74 -0
  149. package/dist/index.js.map +1 -0
  150. package/dist/lib/autofill.d.ts +22 -0
  151. package/dist/lib/autofill.d.ts.map +1 -0
  152. package/dist/lib/autofill.js +276 -0
  153. package/dist/lib/autofill.js.map +1 -0
  154. package/dist/lib/book.d.ts +131 -0
  155. package/dist/lib/book.d.ts.map +1 -0
  156. package/dist/lib/book.js +53 -0
  157. package/dist/lib/book.js.map +1 -0
  158. package/dist/lib/cell.d.ts +17 -0
  159. package/dist/lib/cell.d.ts.map +1 -0
  160. package/dist/lib/cell.js +17 -0
  161. package/dist/lib/cell.js.map +1 -0
  162. package/dist/lib/coords.d.ts +22 -0
  163. package/dist/lib/coords.d.ts.map +1 -0
  164. package/dist/lib/coords.js +73 -0
  165. package/dist/lib/coords.js.map +1 -0
  166. package/dist/lib/date.d.ts +2 -0
  167. package/dist/lib/date.d.ts.map +1 -0
  168. package/dist/lib/date.js +91 -0
  169. package/dist/lib/date.js.map +1 -0
  170. package/dist/lib/dom.d.ts +7 -0
  171. package/dist/lib/dom.d.ts.map +1 -0
  172. package/dist/lib/dom.js +28 -0
  173. package/dist/lib/dom.js.map +1 -0
  174. package/dist/lib/filter.d.ts +7 -0
  175. package/dist/lib/filter.d.ts.map +1 -0
  176. package/dist/lib/filter.js +122 -0
  177. package/dist/lib/filter.js.map +1 -0
  178. package/dist/lib/input.d.ts +28 -0
  179. package/dist/lib/input.d.ts.map +1 -0
  180. package/dist/lib/input.js +73 -0
  181. package/dist/lib/input.js.map +1 -0
  182. package/dist/lib/label.d.ts +4 -0
  183. package/dist/lib/label.d.ts.map +1 -0
  184. package/dist/lib/label.js +10 -0
  185. package/dist/lib/label.js.map +1 -0
  186. package/dist/lib/operation.d.ts +31 -0
  187. package/dist/lib/operation.d.ts.map +1 -0
  188. package/dist/lib/operation.js +36 -0
  189. package/dist/lib/operation.js.map +1 -0
  190. package/dist/lib/palette.d.ts +2 -0
  191. package/dist/lib/palette.d.ts.map +1 -0
  192. package/dist/lib/palette.js +26 -0
  193. package/dist/lib/palette.js.map +1 -0
  194. package/dist/lib/popup.d.ts +24 -0
  195. package/dist/lib/popup.d.ts.map +1 -0
  196. package/dist/lib/popup.js +21 -0
  197. package/dist/lib/popup.js.map +1 -0
  198. package/dist/lib/reference.d.ts +19 -0
  199. package/dist/lib/reference.d.ts.map +1 -0
  200. package/dist/lib/reference.js +40 -0
  201. package/dist/lib/reference.js.map +1 -0
  202. package/dist/lib/sheet.d.ts +512 -0
  203. package/dist/lib/sheet.d.ts.map +1 -0
  204. package/dist/lib/sheet.js +1530 -0
  205. package/dist/lib/sheet.js.map +1 -0
  206. package/dist/lib/sheet_utils.d.ts +55 -0
  207. package/dist/lib/sheet_utils.d.ts.map +1 -0
  208. package/dist/lib/sheet_utils.js +125 -0
  209. package/dist/lib/sheet_utils.js.map +1 -0
  210. package/dist/lib/spatial.d.ts +79 -0
  211. package/dist/lib/spatial.d.ts.map +1 -0
  212. package/dist/lib/spatial.js +227 -0
  213. package/dist/lib/spatial.js.map +1 -0
  214. package/dist/lib/time.d.ts +29 -0
  215. package/dist/lib/time.d.ts.map +1 -0
  216. package/dist/lib/time.js +113 -0
  217. package/dist/lib/time.js.map +1 -0
  218. package/dist/lib/virtualization.d.ts +22 -0
  219. package/dist/lib/virtualization.d.ts.map +1 -0
  220. package/dist/lib/virtualization.js +91 -0
  221. package/dist/lib/virtualization.js.map +1 -0
  222. package/dist/policy/core.d.ts +161 -0
  223. package/dist/policy/core.d.ts.map +1 -0
  224. package/dist/policy/core.js +248 -0
  225. package/dist/policy/core.js.map +1 -0
  226. package/dist/policy/thousand_separator.d.ts +4 -0
  227. package/dist/policy/thousand_separator.d.ts.map +1 -0
  228. package/dist/policy/thousand_separator.js +13 -0
  229. package/dist/policy/thousand_separator.js.map +1 -0
  230. package/dist/sentinels.d.ts +40 -0
  231. package/dist/sentinels.d.ts.map +1 -0
  232. package/dist/sentinels.js +41 -0
  233. package/dist/sentinels.js.map +1 -0
  234. package/dist/styles/embedder.d.ts +2 -0
  235. package/dist/styles/embedder.d.ts.map +1 -0
  236. package/dist/styles/embedder.js +11 -0
  237. package/dist/styles/embedder.js.map +1 -0
  238. package/dist/styles/minified.d.ts +3 -0
  239. package/dist/styles/minified.d.ts.map +1 -0
  240. package/dist/styles/minified.js +6 -0
  241. package/dist/styles/minified.js.map +1 -0
  242. package/dist/types.d.ts +310 -0
  243. package/dist/types.d.ts.map +1 -0
  244. package/dist/types.js +2 -0
  245. package/dist/types.js.map +1 -0
  246. package/dist/utils.d.ts +2 -0
  247. package/dist/utils.d.ts.map +1 -0
  248. package/dist/utils.js +5 -0
  249. package/dist/utils.js.map +1 -0
  250. package/package.json +59 -0
@@ -0,0 +1,36 @@
1
+ const t = 1, l = 2, n = 4, c = 8, R = 16, r = 32, i = 64, u = 128, f = 256, h = 512, w = 8192, I = 1024, C = 16384, S = 32768, m = 65536, a = 131072, y = 0, M = 192, b = 157440, d = 12, p = 48, v = 60, L = 3, F = 157695, A = 229376, O = 524288, g = 255999, e = (s, o) => s === void 0 ? !1 : (s & o) === o, z = (s) => {
2
+ const o = [];
3
+ return e(s, 1) && o.push("RemoveRow"), e(s, 2) && o.push("RemoveCol"), e(s, 4) && o.push("InsertRowAbove"), e(s, 8) && o.push("InsertRowBelow"), e(s, 16) && o.push("InsertColLeft"), e(s, 32) && o.push("InsertColRight"), e(s, 64) && o.push("MoveFrom"), e(s, 128) && o.push("MoveTo"), e(s, 256) && o.push("Write"), e(s, 512) && o.push("Style"), e(s, 1024) && o.push("Resize"), e(s, 16384) && o.push("SetPolicy"), e(s, 131072) && o.push("SetLabel"), e(s, 32768) && o.push("Sort"), e(s, 65536) && o.push("Filter"), o;
4
+ };
5
+ export {
6
+ v as Add,
7
+ A as ColumnMenu,
8
+ w as Copy,
9
+ L as Delete,
10
+ m as Filter,
11
+ p as InsertCols,
12
+ R as InsertColsLeft,
13
+ r as InsertColsRight,
14
+ d as InsertRows,
15
+ n as InsertRowsAbove,
16
+ c as InsertRowsBelow,
17
+ M as Move,
18
+ i as MoveFrom,
19
+ u as MoveTo,
20
+ y as NoOperation,
21
+ F as ReadOnly,
22
+ l as RemoveCols,
23
+ t as RemoveRows,
24
+ I as Resize,
25
+ O as RowMenu,
26
+ a as SetLabel,
27
+ C as SetPolicy,
28
+ S as Sort,
29
+ h as Style,
30
+ b as Update,
31
+ g as ViewOnly,
32
+ f as Write,
33
+ z as debugOperations,
34
+ e as hasOperation
35
+ };
36
+ //# sourceMappingURL=operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.js","sources":["../../src/lib/operation.ts"],"sourcesContent":["import { OperationType as operations } from '../types';\n\nexport const RemoveRows: operations = 0b00000000000000000000000000000000000000000000000000001; // 1\nexport const RemoveCols: operations = 0b00000000000000000000000000000000000000000000000000010; // 2\nexport const InsertRowsAbove: operations = 0b00000000000000000000000000000000000000000000000000100; // 4\nexport const InsertRowsBelow: operations = 0b00000000000000000000000000000000000000000000000001000; // 8\nexport const InsertColsLeft: operations = 0b00000000000000000000000000000000000000000000000010000; // 16\nexport const InsertColsRight: operations = 0b00000000000000000000000000000000000000000000000100000; // 32\nexport const MoveFrom: operations = 0b00000000000000000000000000000000000000000000001000000; // 64\nexport const MoveTo: operations = 0b00000000000000000000000000000000000000000000010000000; // 128\nexport const Write: operations = 0b00000000000000000000000000000000000000000000100000000; // 256\nexport const Style: operations = 0b00000000000000000000000000000000000000000001000000000; // 512\nexport const Copy: operations = 0b00000000000000000000000000000000000000010000000000000; // 8192\nexport const Resize: operations = 0b00000000000000000000000000000000000000000010000000000; // 1024\nexport const SetPolicy: operations = 0b00000000000000000000000000000000000000100000000000000; // 16384\nexport const Sort: operations = 0b00000000000000000000000000000000000001000000000000000; // 32768\nexport const Filter: operations = 0b00000000000000000000000000000000000010000000000000000; // 65536\nexport const SetLabel: operations = 0b00000000000000000000000000000000000100000000000000000; // 131072\n\nexport const NoOperation: operations = 0;\n\nexport const Move: operations = MoveFrom | MoveTo; // 192\n\nexport const Update: operations = Write | Style | Copy | Resize | SetPolicy | SetLabel;\n\nexport const InsertRows: operations = InsertRowsAbove | InsertRowsBelow; // 12\n\nexport const InsertCols: operations = InsertColsLeft | InsertColsRight; // 48\n\nexport const Add: operations = InsertRows | InsertCols; // 60\n\nexport const Delete: operations = RemoveRows | RemoveCols; // 3\n\nexport const ReadOnly: operations = Update | Delete | Add | Move;\n\nexport const ColumnMenu: operations = Filter | Sort | SetLabel;\n\nexport const RowMenu: operations = 0b00000000000000000000000000000000010000000000000000000; // 524288\n\nexport const ViewOnly: operations = ReadOnly | ColumnMenu;\n\nexport const hasOperation = (operation: operations | undefined, flag: operations) => {\n if (operation === undefined) {\n return false;\n }\n return (operation & flag) === flag;\n};\n\n// Don't use this function in production\nexport const debugOperations = (prevention: operations | undefined) => {\n const operations: string[] = [];\n if (hasOperation(prevention, RemoveRows)) {\n operations.push('RemoveRow');\n }\n if (hasOperation(prevention, RemoveCols)) {\n operations.push('RemoveCol');\n }\n if (hasOperation(prevention, InsertRowsAbove)) {\n operations.push('InsertRowAbove');\n }\n if (hasOperation(prevention, InsertRowsBelow)) {\n operations.push('InsertRowBelow');\n }\n if (hasOperation(prevention, InsertColsLeft)) {\n operations.push('InsertColLeft');\n }\n if (hasOperation(prevention, InsertColsRight)) {\n operations.push('InsertColRight');\n }\n if (hasOperation(prevention, MoveFrom)) {\n operations.push('MoveFrom');\n }\n if (hasOperation(prevention, MoveTo)) {\n operations.push('MoveTo');\n }\n if (hasOperation(prevention, Write)) {\n operations.push('Write');\n }\n if (hasOperation(prevention, Style)) {\n operations.push('Style');\n }\n if (hasOperation(prevention, Resize)) {\n operations.push('Resize');\n }\n if (hasOperation(prevention, SetPolicy)) {\n operations.push('SetPolicy');\n }\n if (hasOperation(prevention, SetLabel)) {\n operations.push('SetLabel');\n }\n if (hasOperation(prevention, Sort)) {\n operations.push('Sort');\n }\n if (hasOperation(prevention, Filter)) {\n operations.push('Filter');\n }\n return operations;\n};\n"],"names":["RemoveRows","RemoveCols","InsertRowsAbove","InsertRowsBelow","InsertColsLeft","InsertColsRight","MoveFrom","MoveTo","Write","Style","Copy","Resize","SetPolicy","Sort","Filter","SetLabel","NoOperation","Move","Update","InsertRows","InsertCols","Add","Delete","ReadOnly","ColumnMenu","RowMenu","ViewOnly","hasOperation","operation","flag","debugOperations","prevention","operations"],"mappings":"AAEO,MAAMA,IAAyB,GACz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AAY,KAAI,KAC/BC,EAAW,KAAK,MAAM,GAEpBL,EAAaI,GAAY,KAAM,KACjCC,EAAW,KAAK,QAAQ,GAEnBA;AACT;"}
@@ -0,0 +1,2 @@
1
+ export declare const COLOR_PALETTE: string[];
2
+ //# sourceMappingURL=palette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/lib/palette.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,UAqBzB,CAAC"}
@@ -0,0 +1,26 @@
1
+ const F = [
2
+ // orange
3
+ "#FF6600",
4
+ // purple
5
+ "#AA44FF",
6
+ // emeraldblue
7
+ "#00CCCC",
8
+ // peach
9
+ "#EEAAEE",
10
+ // yellow
11
+ "#DDDD00",
12
+ // winered
13
+ "#AA4444",
14
+ // lightgreen
15
+ "#00FF00",
16
+ // pink
17
+ "#FF00FF",
18
+ // navy
19
+ "#3366FF",
20
+ // cyan
21
+ "#008888"
22
+ ];
23
+ export {
24
+ F as COLOR_PALETTE
25
+ };
26
+ //# sourceMappingURL=palette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"palette.js","sources":["../../src/lib/palette.ts"],"sourcesContent":["export const COLOR_PALETTE = [\n // orange\n '#FF6600',\n // purple\n '#AA44FF',\n // emeraldblue\n '#00CCCC',\n // peach\n '#EEAAEE',\n // yellow\n '#DDDD00',\n // winered\n '#AA4444',\n // lightgreen\n '#00FF00',\n // pink\n '#FF00FF',\n // navy\n '#3366FF',\n // cyan\n '#008888',\n];\n"],"names":["COLOR_PALETTE"],"mappings":"AAAO,MAAMA,IAAgB;AAAA;AAAA,EAE3B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AACF;"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * lib/popup.ts
3
+ *
4
+ * Utility functions for computing the position of floating UI elements
5
+ * (tooltips, dropdowns, autocomplete lists, function guides, etc.)
6
+ * so they don't overflow the viewport.
7
+ */
8
+ export type HAlign = 'left' | 'right';
9
+ export type VAlign = 'top' | 'bottom';
10
+ export type PopupPosition = {
11
+ x: number;
12
+ y: number;
13
+ hAlign: HAlign;
14
+ };
15
+ export declare const calcBelowPosition: (rect: DOMRect, maxWidth?: number, margin?: number) => PopupPosition;
16
+ export declare const clampLeft: (left: number, width: number, margin?: number) => number;
17
+ export type SideStyle = {
18
+ left: string;
19
+ right: string;
20
+ };
21
+ export declare const calcSideStyle: (el: HTMLElement, gap?: number) => SideStyle;
22
+ export declare const clampPopup: (el: HTMLElement) => void;
23
+ export declare const hAlignTransform: (hAlign: HAlign) => string;
24
+ //# sourceMappingURL=popup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../src/lib/popup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgBF,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,EAAE,iBAAc,EAAE,eAAe,KAAG,aAKlF,CAAC;AAUF,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,eAAe,KAAG,MAIxE,CAAC;AAgBF,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,eAAO,MAAM,aAAa,GAAI,IAAI,WAAW,EAAE,YAAY,KAAG,SAc7D,CAAC;AAYF,eAAO,MAAM,UAAU,GAAI,IAAI,WAAW,KAAG,IAW5C,CAAC;AASF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAA6D,CAAC"}
@@ -0,0 +1,21 @@
1
+ const r = (t, n = 260, o = 8) => t.right - n >= o ? { x: t.right, y: t.bottom, hAlign: "right" } : { x: Math.max(t.left, o), y: t.bottom, hAlign: "left" }, c = (t, n, o = 8) => {
2
+ const e = t + n - (window.innerWidth - o);
3
+ return e > 0 ? t - e : t;
4
+ }, l = (t, n = 8) => {
5
+ if (t.style.left = `calc(100% + ${n}px)`, t.style.right = "auto", t.getBoundingClientRect().right > window.innerWidth - 8) {
6
+ const i = { left: "auto", right: `calc(100% + ${n}px)` };
7
+ return t.style.left = i.left, t.style.right = i.right, i;
8
+ }
9
+ return { left: `calc(100% + ${n}px)`, right: "auto" };
10
+ }, s = (t) => {
11
+ const n = t.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight;
12
+ n.right > o - 8 && (t.style.left = `${parseFloat(t.style.left || "0") - (n.right - (o - 8))}px`), n.bottom > i - 8 && (t.style.top = `${parseFloat(t.style.top || "0") - (n.bottom - (i - 8))}px`);
13
+ }, h = (t) => t === "right" ? "translateX(-100%)" : "none";
14
+ export {
15
+ r as calcBelowPosition,
16
+ l as calcSideStyle,
17
+ c as clampLeft,
18
+ s as clampPopup,
19
+ h as hAlignTransform
20
+ };
21
+ //# sourceMappingURL=popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popup.js","sources":["../../src/lib/popup.ts"],"sourcesContent":["/**\n * lib/popup.ts\n *\n * Utility functions for computing the position of floating UI elements\n * (tooltips, dropdowns, autocomplete lists, function guides, etc.)\n * so they don't overflow the viewport.\n */\n\nconst MARGIN = 8; // px gap from the viewport edge\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type HAlign = 'left' | 'right';\nexport type VAlign = 'top' | 'bottom';\n\nexport type PopupPosition = {\n x: number;\n y: number;\n hAlign: HAlign;\n};\n\n// ---------------------------------------------------------------------------\n// calcBelowPosition\n//\n// Places a popup BELOW an anchor rect.\n// Prefers aligning the popup's RIGHT edge to rect.right (hAlign='right'),\n// but falls back to aligning its LEFT edge to rect.left (hAlign='left')\n// when there is not enough room on the left side of the viewport.\n//\n// In the 'right' case the caller should apply translateX(-100%) to shift the\n// popup leftward so its right edge lands at x.\n// In the 'left' case x is the desired left edge directly.\n//\n// Usage: error triangle tooltip, any anchored-to-element popup.\n// ---------------------------------------------------------------------------\nexport const calcBelowPosition = (rect: DOMRect, maxWidth = 260, margin = MARGIN): PopupPosition => {\n if (rect.right - maxWidth >= margin) {\n return { x: rect.right, y: rect.bottom, hAlign: 'right' };\n }\n return { x: Math.max(rect.left, margin), y: rect.bottom, hAlign: 'left' };\n};\n\n// ---------------------------------------------------------------------------\n// clampLeft\n//\n// Given the desired left position of a popup and its rendered width,\n// returns an adjusted left value that keeps the popup within the viewport.\n//\n// Usage: EditorOptions dropdown, FunctionGuide floating panel.\n// ---------------------------------------------------------------------------\nexport const clampLeft = (left: number, width: number, margin = MARGIN): number => {\n const rightEdge = left + width;\n const overflow = rightEdge - (window.innerWidth - margin);\n return overflow > 0 ? left - overflow : left;\n};\n\n// ---------------------------------------------------------------------------\n// calcSidePosition\n//\n// Places a popup to the LEFT or RIGHT of an anchor element.\n// Prefers the right side; falls back to the left side if the right side\n// overflows the viewport.\n//\n// Resets the element to the preferred (right-side) position BEFORE measuring,\n// so that stale styles from a previous render don't corrupt the measurement.\n//\n// Applies the final styles directly to the element and also returns them.\n//\n// Usage: FunctionGuide guide1 (option tooltip panel).\n// ---------------------------------------------------------------------------\nexport type SideStyle = { left: string; right: string };\n\nexport const calcSideStyle = (el: HTMLElement, gap = MARGIN): SideStyle => {\n // 1. Reset to preferred position so getBoundingClientRect reflects the right side.\n el.style.left = `calc(100% + ${gap}px)`;\n el.style.right = 'auto';\n\n // 2. Measure after reset.\n const rect = el.getBoundingClientRect();\n if (rect.right > window.innerWidth - MARGIN) {\n const flipped: SideStyle = { left: 'auto', right: `calc(100% + ${gap}px)` };\n el.style.left = flipped.left;\n el.style.right = flipped.right;\n return flipped;\n }\n return { left: `calc(100% + ${gap}px)`, right: 'auto' };\n};\n\n// ---------------------------------------------------------------------------\n// clampPopup\n//\n// Adjusts a rendered popup element's position so it stays within the viewport.\n// Applies left/top corrections directly as inline styles to avoid re-renders.\n// Call this inside useLayoutEffect with no dependency array so it runs after\n// every render (content changes may change the popup dimensions).\n//\n// Usage: ContextMenu, FunctionGuide guide2, any popup that can change size.\n// ---------------------------------------------------------------------------\nexport const clampPopup = (el: HTMLElement): void => {\n const rect = el.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n if (rect.right > vw - MARGIN) {\n el.style.left = `${parseFloat(el.style.left || '0') - (rect.right - (vw - MARGIN))}px`;\n }\n if (rect.bottom > vh - MARGIN) {\n el.style.top = `${parseFloat(el.style.top || '0') - (rect.bottom - (vh - MARGIN))}px`;\n }\n};\n\n// ---------------------------------------------------------------------------\n// hAlignTransform\n//\n// Returns the CSS transform string for a popup based on its horizontal alignment.\n// 'right' → shift left by full width so the popup's right edge sits at x.\n// 'left' → no transform needed.\n// ---------------------------------------------------------------------------\nexport const hAlignTransform = (hAlign: HAlign): string => (hAlign === 'right' ? 'translateX(-100%)' : 'none');\n"],"names":["calcBelowPosition","rect","maxWidth","margin","clampLeft","left","width","overflow","calcSideStyle","el","gap","flipped","clampPopup","vw","vh","hAlignTransform","hAlign"],"mappings":"AAqCO,MAAMA,IAAoB,CAACC,GAAeC,IAAW,KAAKC,IAAS,MACpEF,EAAK,QAAQC,KAAYC,IACpB,EAAE,GAAGF,EAAK,OAAO,GAAGA,EAAK,QAAQ,QAAQ,QAAQ,IAEnD,EAAE,GAAG,KAAK,IAAIA,EAAK,MAAME,CAAM,GAAG,GAAGF,EAAK,QAAQ,QAAQ,OAAO,GAW7DG,IAAY,CAACC,GAAcC,GAAeH,IAAS,MAAmB;AAE3E,QAAAI,IADYF,IAAOC,KACK,OAAO,aAAaH;AAC3C,SAAAI,IAAW,IAAIF,IAAOE,IAAWF;AAC1C,GAkBaG,IAAgB,CAACC,GAAiBC,IAAM,MAAsB;AAOzE,MALGD,EAAA,MAAM,OAAO,eAAeC,CAAG,OAClCD,EAAG,MAAM,QAAQ,QAGJA,EAAG,sBAAsB,EAC7B,QAAQ,OAAO,aAAa,GAAQ;AAC3C,UAAME,IAAqB,EAAE,MAAM,QAAQ,OAAO,eAAeD,CAAG,MAAM;AACvE,WAAAD,EAAA,MAAM,OAAOE,EAAQ,MACrBF,EAAA,MAAM,QAAQE,EAAQ,OAClBA;AAAA,EAAA;AAET,SAAO,EAAE,MAAM,eAAeD,CAAG,OAAO,OAAO,OAAO;AACxD,GAYaE,IAAa,CAACH,MAA0B;AAC7C,QAAAR,IAAOQ,EAAG,sBAAsB,GAChCI,IAAK,OAAO,YACZC,IAAK,OAAO;AAEd,EAAAb,EAAK,QAAQY,IAAK,MACpBJ,EAAG,MAAM,OAAO,GAAG,WAAWA,EAAG,MAAM,QAAQ,GAAG,KAAKR,EAAK,SAASY,IAAK,GAAQ,OAEhFZ,EAAK,SAASa,IAAK,MACrBL,EAAG,MAAM,MAAM,GAAG,WAAWA,EAAG,MAAM,OAAO,GAAG,KAAKR,EAAK,UAAUa,IAAK,GAAQ;AAErF,GASaC,IAAkB,CAACC,MAA4BA,MAAW,UAAU,sBAAsB;"}
@@ -0,0 +1,19 @@
1
+ import { CellsByIdType, Id } from '../types';
2
+ import { Sheet } from './sheet';
3
+ export declare class ReferencePreserver {
4
+ map: {
5
+ [id: Id]: Id;
6
+ };
7
+ private sheet;
8
+ private dependentIds;
9
+ constructor(sheet: Sheet);
10
+ collectDependents(...ids: Id[]): void;
11
+ /**
12
+ * Compare two idMatrix snapshots (`before` and `after`) and populate
13
+ * `this.map` and collect dependents for every position where the occupying
14
+ * cell ID changed. Works for any rearrangement (sort, move, etc.).
15
+ */
16
+ buildMap(before: Id[], after: Id[]): void;
17
+ resolveDependents(operation?: 'move' | 'removeRows' | 'removeCols'): CellsByIdType;
18
+ }
19
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/lib/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,kBAAkB;IACtB,GAAG,EAAE;QAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAA;KAAE,CAAM;IAClC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,YAAY,CAA0B;gBAElC,KAAK,EAAE,KAAK;IAIxB,iBAAiB,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE;IAQ9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IAWlC,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa;CAmBnF"}
@@ -0,0 +1,40 @@
1
+ class h {
2
+ constructor(t) {
3
+ this.map = {}, this.dependentIds = /* @__PURE__ */ new Set(), this.sheet = t;
4
+ }
5
+ collectDependents(...t) {
6
+ t.forEach((n) => {
7
+ var e, s;
8
+ (s = (e = this.sheet.registry.systems[n]) == null ? void 0 : e.dependents) == null || s.forEach((r) => {
9
+ this.dependentIds.add(r);
10
+ });
11
+ });
12
+ }
13
+ /**
14
+ * Compare two idMatrix snapshots (`before` and `after`) and populate
15
+ * `this.map` and collect dependents for every position where the occupying
16
+ * cell ID changed. Works for any rearrangement (sort, move, etc.).
17
+ */
18
+ buildMap(t, n) {
19
+ for (let e = 0; e < t.length; e++) {
20
+ const s = t[e], r = n[e];
21
+ s != null && r != null && s !== r && (this.collectDependents(s, r), this.map[s] = r);
22
+ }
23
+ }
24
+ resolveDependents(t) {
25
+ this.sheet.clearAddressCaches();
26
+ const n = {};
27
+ return this.dependentIds.forEach((e) => {
28
+ const s = this.sheet.registry.data[e];
29
+ s != null && (n[e] = { ...s }, this.sheet.clearDependencies(e), s.value = this.sheet.processFormula(s.value, {
30
+ dependency: e,
31
+ idMap: this.map,
32
+ operation: t
33
+ }));
34
+ }), n;
35
+ }
36
+ }
37
+ export {
38
+ h as ReferencePreserver
39
+ };
40
+ //# sourceMappingURL=reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.js","sources":["../../src/lib/reference.ts"],"sourcesContent":["import { CellsByIdType, Id } from '../types';\nimport { Sheet } from './sheet';\n\nexport class ReferencePreserver {\n public map: { [id: Id]: Id } = {};\n private sheet: Sheet;\n private dependentIds: Set<Id> = new Set<Id>();\n\n constructor(sheet: Sheet) {\n this.sheet = sheet;\n }\n\n collectDependents(...ids: Id[]) {\n ids.forEach((id) => {\n this.sheet.registry.systems[id]?.dependents?.forEach((did) => {\n this.dependentIds.add(did);\n });\n });\n }\n\n /**\n * Compare two idMatrix snapshots (`before` and `after`) and populate\n * `this.map` and collect dependents for every position where the occupying\n * cell ID changed. Works for any rearrangement (sort, move, etc.).\n */\n buildMap(before: Id[], after: Id[]) {\n for (let i = 0; i < before.length; i++) {\n const prevId = before[i];\n const currId = after[i];\n if (prevId != null && currId != null && prevId !== currId) {\n this.collectDependents(prevId, currId);\n this.map[prevId] = currId;\n }\n }\n }\n\n resolveDependents(operation?: 'move' | 'removeRows' | 'removeCols'): CellsByIdType {\n this.sheet.clearAddressCaches();\n const diffBefore: CellsByIdType = {};\n this.dependentIds.forEach((id) => {\n const dep = this.sheet.registry.data[id];\n if (dep == null) {\n return;\n }\n diffBefore[id] = { ...dep };\n this.sheet.clearDependencies(id);\n dep.value = this.sheet.processFormula(dep.value, {\n dependency: id,\n idMap: this.map,\n operation,\n });\n });\n\n return diffBefore;\n }\n}\n"],"names":["ReferencePreserver","sheet","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