@dxos/plugin-sheet 0.6.10 → 0.6.11-staging.32b42e4
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/dist/lib/browser/{SheetContainer-ISY6DUVE.mjs → SheetContainer-U4H5D34A.mjs} +64 -52
- package/dist/lib/browser/SheetContainer-U4H5D34A.mjs.map +7 -0
- package/dist/lib/browser/chunk-APHOLYUB.mjs +175 -0
- package/dist/lib/browser/chunk-APHOLYUB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CBRBNG3R.mjs → chunk-D5AGLXJP.mjs} +123 -202
- package/dist/lib/browser/chunk-D5AGLXJP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-D3PUKBH6.mjs → chunk-FUAGSXA4.mjs} +1 -1
- package/dist/lib/browser/{chunk-D3PUKBH6.mjs.map → chunk-FUAGSXA4.mjs.map} +2 -2
- package/dist/lib/browser/chunk-NU4PBN33.mjs +8 -0
- package/dist/lib/browser/chunk-NU4PBN33.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +37 -80
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing.mjs +92 -0
- package/dist/lib/browser/testing.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-ESRTE7A5.cjs → SheetContainer-AXQV3ZT5.cjs} +83 -72
- package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs.map +7 -0
- package/dist/lib/node/{chunk-4EGEA3KL.cjs → chunk-5KKJ4NPP.cjs} +135 -214
- package/dist/lib/node/chunk-5KKJ4NPP.cjs.map +7 -0
- package/dist/lib/node/chunk-CN3RPESU.cjs +202 -0
- package/dist/lib/node/chunk-CN3RPESU.cjs.map +7 -0
- package/dist/lib/node/{chunk-3R3J7IZR.cjs → chunk-DSYKOI4E.cjs} +4 -4
- package/dist/lib/node/{chunk-3R3J7IZR.cjs.map → chunk-DSYKOI4E.cjs.map} +2 -2
- package/dist/lib/node/chunk-PYXHNAAK.cjs +40 -0
- package/dist/lib/node/chunk-PYXHNAAK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -79
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing.cjs +111 -0
- package/dist/lib/node/testing.cjs.map +7 -0
- package/dist/lib/node/types.cjs +9 -9
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer.d.ts +1 -1
- package/dist/types/src/components/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/model/model.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +9 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +38 -28
- package/src/SheetPlugin.tsx +36 -16
- package/src/components/CellEditor/extension.ts +16 -10
- package/src/components/ComputeGraph/edge-function.ts +6 -2
- package/src/components/ComputeGraph/graph-context.tsx +10 -1
- package/src/components/Sheet/Sheet.stories.tsx +9 -47
- package/src/components/Sheet/Sheet.tsx +24 -33
- package/src/components/Sheet/formatting.ts +1 -1
- package/src/components/SheetContainer.tsx +3 -4
- package/src/components/Toolbar/Toolbar.stories.tsx +5 -10
- package/src/model/model.ts +2 -3
- package/src/testing.ts +50 -0
- package/src/types.ts +2 -0
- package/dist/lib/browser/SheetContainer-ISY6DUVE.mjs.map +0 -7
- package/dist/lib/browser/chunk-CBRBNG3R.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-ESRTE7A5.cjs.map +0 -7
- package/dist/lib/node/chunk-4EGEA3KL.cjs.map +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ValueTypeEnum
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FUAGSXA4.mjs";
|
|
4
4
|
|
|
5
5
|
// packages/plugins/plugin-sheet/src/components/ComputeGraph/graph.ts
|
|
6
6
|
import { HyperFormula } from "hyperformula";
|
|
@@ -177,71 +177,6 @@ var ComputeGraph = class {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
// packages/plugins/plugin-sheet/src/model/types.ts
|
|
181
|
-
import { invariant } from "@dxos/invariant";
|
|
182
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/types.ts";
|
|
183
|
-
var MAX_COLUMNS = 26 * 26;
|
|
184
|
-
var posEquals = (a, b) => {
|
|
185
|
-
return a?.column === b?.column && a?.row === b?.row;
|
|
186
|
-
};
|
|
187
|
-
var columnLetter = (column) => {
|
|
188
|
-
invariant(column < MAX_COLUMNS, `Invalid column: ${column}`, {
|
|
189
|
-
F: __dxlog_file3,
|
|
190
|
-
L: 17,
|
|
191
|
-
S: void 0,
|
|
192
|
-
A: [
|
|
193
|
-
"column < MAX_COLUMNS",
|
|
194
|
-
"`Invalid column: ${column}`"
|
|
195
|
-
]
|
|
196
|
-
});
|
|
197
|
-
return (column >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(column / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + column % 26);
|
|
198
|
-
};
|
|
199
|
-
var addressToA1Notation = ({ column, row }) => {
|
|
200
|
-
return `${columnLetter(column)}${row + 1}`;
|
|
201
|
-
};
|
|
202
|
-
var addressFromA1Notation = (ref) => {
|
|
203
|
-
const match = ref.match(/([A-Z]+)(\d+)/);
|
|
204
|
-
invariant(match, `Invalid notation: ${ref}`, {
|
|
205
|
-
F: __dxlog_file3,
|
|
206
|
-
L: 30,
|
|
207
|
-
S: void 0,
|
|
208
|
-
A: [
|
|
209
|
-
"match",
|
|
210
|
-
"`Invalid notation: ${ref}`"
|
|
211
|
-
]
|
|
212
|
-
});
|
|
213
|
-
return {
|
|
214
|
-
row: parseInt(match[2], 10) - 1,
|
|
215
|
-
column: match[1].split("").reduce((acc, c) => acc * 26 + c.charCodeAt(0) - "A".charCodeAt(0) + 1, 0) - 1
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
var rangeToA1Notation = (range) => {
|
|
219
|
-
return [
|
|
220
|
-
range?.from && addressToA1Notation(range?.from),
|
|
221
|
-
range?.to && addressToA1Notation(range?.to)
|
|
222
|
-
].filter(Boolean).join(":");
|
|
223
|
-
};
|
|
224
|
-
var inRange = (range, cell) => {
|
|
225
|
-
if (!range) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
const { from, to } = range;
|
|
229
|
-
if (from && posEquals(from, cell) || to && posEquals(to, cell)) {
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
if (!from || !to) {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
const { column: c1, row: r1 } = from;
|
|
236
|
-
const { column: c2, row: r2 } = to;
|
|
237
|
-
const cMin = Math.min(c1, c2);
|
|
238
|
-
const cMax = Math.max(c1, c2);
|
|
239
|
-
const rMin = Math.min(r1, r2);
|
|
240
|
-
const rMax = Math.max(r1, r2);
|
|
241
|
-
const { column, row } = cell;
|
|
242
|
-
return column >= cMin && column <= cMax && row >= rMin && row <= rMax;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
180
|
// packages/plugins/plugin-sheet/src/model/model.ts
|
|
246
181
|
import { DetailedCellError, ExportedCellChange } from "hyperformula";
|
|
247
182
|
import { Event as Event2 } from "@dxos/async";
|
|
@@ -2624,6 +2559,71 @@ var defaultFunctions = [
|
|
|
2624
2559
|
}
|
|
2625
2560
|
];
|
|
2626
2561
|
|
|
2562
|
+
// packages/plugins/plugin-sheet/src/model/types.ts
|
|
2563
|
+
import { invariant } from "@dxos/invariant";
|
|
2564
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/types.ts";
|
|
2565
|
+
var MAX_COLUMNS = 26 * 26;
|
|
2566
|
+
var posEquals = (a, b) => {
|
|
2567
|
+
return a?.column === b?.column && a?.row === b?.row;
|
|
2568
|
+
};
|
|
2569
|
+
var columnLetter = (column) => {
|
|
2570
|
+
invariant(column < MAX_COLUMNS, `Invalid column: ${column}`, {
|
|
2571
|
+
F: __dxlog_file3,
|
|
2572
|
+
L: 17,
|
|
2573
|
+
S: void 0,
|
|
2574
|
+
A: [
|
|
2575
|
+
"column < MAX_COLUMNS",
|
|
2576
|
+
"`Invalid column: ${column}`"
|
|
2577
|
+
]
|
|
2578
|
+
});
|
|
2579
|
+
return (column >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(column / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + column % 26);
|
|
2580
|
+
};
|
|
2581
|
+
var addressToA1Notation = ({ column, row }) => {
|
|
2582
|
+
return `${columnLetter(column)}${row + 1}`;
|
|
2583
|
+
};
|
|
2584
|
+
var addressFromA1Notation = (ref) => {
|
|
2585
|
+
const match = ref.match(/([A-Z]+)(\d+)/);
|
|
2586
|
+
invariant(match, `Invalid notation: ${ref}`, {
|
|
2587
|
+
F: __dxlog_file3,
|
|
2588
|
+
L: 30,
|
|
2589
|
+
S: void 0,
|
|
2590
|
+
A: [
|
|
2591
|
+
"match",
|
|
2592
|
+
"`Invalid notation: ${ref}`"
|
|
2593
|
+
]
|
|
2594
|
+
});
|
|
2595
|
+
return {
|
|
2596
|
+
row: parseInt(match[2], 10) - 1,
|
|
2597
|
+
column: match[1].split("").reduce((acc, c) => acc * 26 + c.charCodeAt(0) - "A".charCodeAt(0) + 1, 0) - 1
|
|
2598
|
+
};
|
|
2599
|
+
};
|
|
2600
|
+
var rangeToA1Notation = (range) => {
|
|
2601
|
+
return [
|
|
2602
|
+
range?.from && addressToA1Notation(range?.from),
|
|
2603
|
+
range?.to && addressToA1Notation(range?.to)
|
|
2604
|
+
].filter(Boolean).join(":");
|
|
2605
|
+
};
|
|
2606
|
+
var inRange = (range, cell) => {
|
|
2607
|
+
if (!range) {
|
|
2608
|
+
return false;
|
|
2609
|
+
}
|
|
2610
|
+
const { from, to } = range;
|
|
2611
|
+
if (from && posEquals(from, cell) || to && posEquals(to, cell)) {
|
|
2612
|
+
return true;
|
|
2613
|
+
}
|
|
2614
|
+
if (!from || !to) {
|
|
2615
|
+
return false;
|
|
2616
|
+
}
|
|
2617
|
+
const { column: c1, row: r1 } = from;
|
|
2618
|
+
const { column: c2, row: r2 } = to;
|
|
2619
|
+
const cMin = Math.min(c1, c2);
|
|
2620
|
+
const cMax = Math.max(c1, c2);
|
|
2621
|
+
const rMin = Math.min(r1, r2);
|
|
2622
|
+
const rMax = Math.max(r1, r2);
|
|
2623
|
+
const { column, row } = cell;
|
|
2624
|
+
return column >= cMin && column <= cMax && row >= rMin && row <= rMax;
|
|
2625
|
+
};
|
|
2626
|
+
|
|
2627
2627
|
// packages/plugins/plugin-sheet/src/model/util.ts
|
|
2628
2628
|
import { randomBytes } from "@dxos/crypto";
|
|
2629
2629
|
var ApiError = class extends Error {
|
|
@@ -2647,8 +2647,8 @@ var createIndices = (length) => Array.from({
|
|
|
2647
2647
|
|
|
2648
2648
|
// packages/plugins/plugin-sheet/src/model/model.ts
|
|
2649
2649
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/model.ts";
|
|
2650
|
-
var DEFAULT_ROWS =
|
|
2651
|
-
var DEFAULT_COLUMNS = 26
|
|
2650
|
+
var DEFAULT_ROWS = 100;
|
|
2651
|
+
var DEFAULT_COLUMNS = 26;
|
|
2652
2652
|
var typeMap = {
|
|
2653
2653
|
BOOLEAN: ValueTypeEnum.Boolean,
|
|
2654
2654
|
NUMBER_RAW: ValueTypeEnum.Number,
|
|
@@ -2738,13 +2738,13 @@ var SheetModel = class {
|
|
|
2738
2738
|
id: this.id
|
|
2739
2739
|
}, {
|
|
2740
2740
|
F: __dxlog_file4,
|
|
2741
|
-
L:
|
|
2741
|
+
L: 142,
|
|
2742
2742
|
S: this,
|
|
2743
2743
|
C: (f, a) => f(...a)
|
|
2744
2744
|
});
|
|
2745
2745
|
invariant2(!this.initialized, "Already initialized.", {
|
|
2746
2746
|
F: __dxlog_file4,
|
|
2747
|
-
L:
|
|
2747
|
+
L: 143,
|
|
2748
2748
|
S: this,
|
|
2749
2749
|
A: [
|
|
2750
2750
|
"!this.initialized",
|
|
@@ -2753,7 +2753,7 @@ var SheetModel = class {
|
|
|
2753
2753
|
});
|
|
2754
2754
|
this._ctx = new Context(void 0, {
|
|
2755
2755
|
F: __dxlog_file4,
|
|
2756
|
-
L:
|
|
2756
|
+
L: 144
|
|
2757
2757
|
});
|
|
2758
2758
|
if (!this._sheet.rows.length) {
|
|
2759
2759
|
this._insertIndices(this._sheet.rows, 0, this._options.rows, DEFAULT_ROWS);
|
|
@@ -2765,9 +2765,9 @@ var SheetModel = class {
|
|
|
2765
2765
|
const unsubscribe = this._graph.update.on(() => this.update.emit());
|
|
2766
2766
|
this._ctx.onDispose(unsubscribe);
|
|
2767
2767
|
if (this._space) {
|
|
2768
|
-
const { Filter
|
|
2769
|
-
const { FunctionType
|
|
2770
|
-
const query = this._space?.db.query(
|
|
2768
|
+
const { Filter } = await import("@dxos/client/echo");
|
|
2769
|
+
const { FunctionType } = await import("@dxos/plugin-script/types");
|
|
2770
|
+
const query = this._space?.db.query(Filter.schema(FunctionType));
|
|
2771
2771
|
const unsubscribe2 = query.subscribe(({ objects }) => {
|
|
2772
2772
|
this._functions = objects.filter((fn) => fn.binding);
|
|
2773
2773
|
this.update.emit();
|
|
@@ -2781,7 +2781,7 @@ var SheetModel = class {
|
|
|
2781
2781
|
id: this.id
|
|
2782
2782
|
}, {
|
|
2783
2783
|
F: __dxlog_file4,
|
|
2784
|
-
L:
|
|
2784
|
+
L: 174,
|
|
2785
2785
|
S: this,
|
|
2786
2786
|
C: (f, a) => f(...a)
|
|
2787
2787
|
});
|
|
@@ -3106,7 +3106,7 @@ var SheetModel = class {
|
|
|
3106
3106
|
mapFormulaRefsToIndices(formula) {
|
|
3107
3107
|
invariant2(formula.charAt(0) === "=", void 0, {
|
|
3108
3108
|
F: __dxlog_file4,
|
|
3109
|
-
L:
|
|
3109
|
+
L: 509,
|
|
3110
3110
|
S: this,
|
|
3111
3111
|
A: [
|
|
3112
3112
|
"formula.charAt(0) === '='",
|
|
@@ -3123,7 +3123,7 @@ var SheetModel = class {
|
|
|
3123
3123
|
mapFormulaIndicesToRefs(formula) {
|
|
3124
3124
|
invariant2(formula.charAt(0) === "=", void 0, {
|
|
3125
3125
|
F: __dxlog_file4,
|
|
3126
|
-
L:
|
|
3126
|
+
L: 519,
|
|
3127
3127
|
S: this,
|
|
3128
3128
|
A: [
|
|
3129
3129
|
"formula.charAt(0) === '='",
|
|
@@ -3157,146 +3157,71 @@ var SheetModel = class {
|
|
|
3157
3157
|
}
|
|
3158
3158
|
};
|
|
3159
3159
|
|
|
3160
|
-
// packages/plugins/plugin-sheet/src/components/ComputeGraph/
|
|
3161
|
-
import {
|
|
3162
|
-
import {
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
const
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
ttl: 0
|
|
3186
|
-
});
|
|
3187
|
-
});
|
|
3188
|
-
this.context.createSubscription(ast.procedureName, unsubscribe);
|
|
3160
|
+
// packages/plugins/plugin-sheet/src/components/ComputeGraph/custom.ts
|
|
3161
|
+
import { FunctionArgumentType } from "hyperformula";
|
|
3162
|
+
import { getDeep } from "@dxos/util";
|
|
3163
|
+
var parseNumberString = (str) => {
|
|
3164
|
+
return parseFloat(str.replace(/[^\d.]/g, ""));
|
|
3165
|
+
};
|
|
3166
|
+
var CustomPlugin = class extends FunctionPluginAsync {
|
|
3167
|
+
test(ast, state) {
|
|
3168
|
+
const handler = async () => {
|
|
3169
|
+
return Math.random();
|
|
3170
|
+
};
|
|
3171
|
+
return this.runAsyncFunction(ast, state, handler);
|
|
3172
|
+
}
|
|
3173
|
+
crypto(ast, state) {
|
|
3174
|
+
const handler = async (_currency) => {
|
|
3175
|
+
const currency = (_currency || "USD").toUpperCase();
|
|
3176
|
+
const result = await fetch(`https://api.coindesk.com/v1/bpi/currentprice/${currency}.json`);
|
|
3177
|
+
const data = await result.json();
|
|
3178
|
+
const rate = getDeep(data, [
|
|
3179
|
+
"bpi",
|
|
3180
|
+
currency,
|
|
3181
|
+
"rate"
|
|
3182
|
+
]);
|
|
3183
|
+
if (!rate) {
|
|
3184
|
+
return NaN;
|
|
3189
3185
|
}
|
|
3190
|
-
|
|
3191
|
-
const result = await fetch(`${this.context.remoteFunctionUrl}${path}`, {
|
|
3192
|
-
method: "POST",
|
|
3193
|
-
headers: {
|
|
3194
|
-
"Content-Type": "application/json"
|
|
3195
|
-
},
|
|
3196
|
-
body: JSON.stringify({
|
|
3197
|
-
args: args.filter(nonNullable)
|
|
3198
|
-
})
|
|
3199
|
-
});
|
|
3200
|
-
return await result.text();
|
|
3186
|
+
return parseNumberString(rate);
|
|
3201
3187
|
};
|
|
3202
|
-
return this.runAsyncFunction(ast, state, handler
|
|
3203
|
-
ttl:
|
|
3188
|
+
return this.runAsyncFunction(ast, state, handler, {
|
|
3189
|
+
ttl: 1e4
|
|
3204
3190
|
});
|
|
3205
3191
|
}
|
|
3206
3192
|
};
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
method: "
|
|
3193
|
+
CustomPlugin.implementedFunctions = {
|
|
3194
|
+
TEST: {
|
|
3195
|
+
method: "test",
|
|
3196
|
+
parameters: [],
|
|
3197
|
+
isVolatile: true
|
|
3198
|
+
},
|
|
3199
|
+
CRYPTO: {
|
|
3200
|
+
method: "crypto",
|
|
3210
3201
|
parameters: [
|
|
3211
|
-
// Binding
|
|
3212
|
-
{
|
|
3213
|
-
argumentType: FunctionArgumentType.STRING
|
|
3214
|
-
},
|
|
3215
|
-
// Remote function arguments (currently supporting up to 9).
|
|
3216
|
-
{
|
|
3217
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3218
|
-
optionalArg: true
|
|
3219
|
-
},
|
|
3220
|
-
{
|
|
3221
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3222
|
-
optionalArg: true
|
|
3223
|
-
},
|
|
3224
3202
|
{
|
|
3225
|
-
argumentType: FunctionArgumentType.
|
|
3226
|
-
optionalArg: true
|
|
3227
|
-
},
|
|
3228
|
-
{
|
|
3229
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3230
|
-
optionalArg: true
|
|
3231
|
-
},
|
|
3232
|
-
{
|
|
3233
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3234
|
-
optionalArg: true
|
|
3235
|
-
},
|
|
3236
|
-
{
|
|
3237
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3238
|
-
optionalArg: true
|
|
3239
|
-
},
|
|
3240
|
-
{
|
|
3241
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3242
|
-
optionalArg: true
|
|
3243
|
-
},
|
|
3244
|
-
{
|
|
3245
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3246
|
-
optionalArg: true
|
|
3247
|
-
},
|
|
3248
|
-
{
|
|
3249
|
-
argumentType: FunctionArgumentType.ANY,
|
|
3203
|
+
argumentType: FunctionArgumentType.STRING,
|
|
3250
3204
|
optionalArg: true
|
|
3251
3205
|
}
|
|
3252
3206
|
],
|
|
3253
3207
|
isVolatile: true
|
|
3254
3208
|
}
|
|
3255
3209
|
};
|
|
3256
|
-
var
|
|
3210
|
+
var CustomPluginTranslations = {
|
|
3257
3211
|
enGB: {
|
|
3258
|
-
|
|
3212
|
+
TEST: "TEST",
|
|
3213
|
+
CRYPTO: "CRYPTO"
|
|
3259
3214
|
},
|
|
3260
3215
|
enUS: {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
};
|
|
3264
|
-
|
|
3265
|
-
// packages/plugins/plugin-sheet/src/components/ComputeGraph/graph-context.tsx
|
|
3266
|
-
import React, { createContext, useContext, useEffect } from "react";
|
|
3267
|
-
var ComputeGraphContext = /* @__PURE__ */ createContext({
|
|
3268
|
-
graphs: {},
|
|
3269
|
-
setGraph: () => {
|
|
3216
|
+
TEST: "TEST",
|
|
3217
|
+
CRYPTO: "CRYPTO"
|
|
3270
3218
|
}
|
|
3271
|
-
});
|
|
3272
|
-
var ComputeGraphContextProvider = ({ children, graphs, setGraph }) => {
|
|
3273
|
-
return /* @__PURE__ */ React.createElement(ComputeGraphContext.Provider, {
|
|
3274
|
-
value: {
|
|
3275
|
-
graphs,
|
|
3276
|
-
setGraph
|
|
3277
|
-
}
|
|
3278
|
-
}, children);
|
|
3279
|
-
};
|
|
3280
|
-
var useComputeGraph = (space, options) => {
|
|
3281
|
-
const { graphs, setGraph } = useContext(ComputeGraphContext);
|
|
3282
|
-
const graph = graphs[space.id] ?? createComputeGraph([
|
|
3283
|
-
{
|
|
3284
|
-
plugin: EdgeFunctionPlugin,
|
|
3285
|
-
translations: EdgeFunctionPluginTranslations
|
|
3286
|
-
}
|
|
3287
|
-
], space, options);
|
|
3288
|
-
useEffect(() => {
|
|
3289
|
-
if (!graphs[space.id]) {
|
|
3290
|
-
setGraph(space.id, graph);
|
|
3291
|
-
}
|
|
3292
|
-
}, [
|
|
3293
|
-
space
|
|
3294
|
-
]);
|
|
3295
|
-
return graph;
|
|
3296
3219
|
};
|
|
3297
3220
|
|
|
3298
3221
|
export {
|
|
3299
3222
|
FunctionPluginAsync,
|
|
3223
|
+
CustomPlugin,
|
|
3224
|
+
CustomPluginTranslations,
|
|
3300
3225
|
createComputeGraph,
|
|
3301
3226
|
defaultFunctions,
|
|
3302
3227
|
posEquals,
|
|
@@ -3305,10 +3230,6 @@ export {
|
|
|
3305
3230
|
addressFromA1Notation,
|
|
3306
3231
|
rangeToA1Notation,
|
|
3307
3232
|
inRange,
|
|
3308
|
-
SheetModel
|
|
3309
|
-
EdgeFunctionPlugin,
|
|
3310
|
-
EdgeFunctionPluginTranslations,
|
|
3311
|
-
ComputeGraphContextProvider,
|
|
3312
|
-
useComputeGraph
|
|
3233
|
+
SheetModel
|
|
3313
3234
|
};
|
|
3314
|
-
//# sourceMappingURL=chunk-
|
|
3235
|
+
//# sourceMappingURL=chunk-D5AGLXJP.mjs.map
|