@ricsam/formula-engine 0.0.18 → 0.0.20

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.
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib.ts"],
4
4
  "sourcesContent": [
5
- "export { FormulaEngine } from \"./core/engine.mjs\";\nexport * from \"./core/types.mjs\";\nexport * from \"./core/utils.mjs\";\nexport * from \"./core/utils/color-utils.mjs\";\n\n// API Schema exports\nexport { defineApi, createApi } from \"./core/api/api.mjs\";\nexport type { CreateApi, Declaration, Api, TableApi, CellApi } from \"./core/api/api.mjs\";\nexport { TableOrm } from \"./core/api/table-orm.mjs\";\nexport { CellOrm } from \"./core/api/cell-orm.mjs\";\nexport { SchemaValidationError } from \"./core/managers/api-schema-manager.mjs\";\nexport type { ValidationResult } from \"./core/managers/api-schema-manager.mjs\";\n\n// Command Pattern exports\nexport { SchemaIntegrityError } from \"./core/commands.mjs\";\nexport type { EngineAction, EngineCommand } from \"./core/commands.mjs\";\n"
5
+ "export { FormulaEngine } from \"./core/engine.mjs\";\nexport * from \"./core/types.mjs\";\nexport * from \"./core/utils.mjs\";\nexport * from \"./core/utils/color-utils.mjs\";\n\n// API Schema exports\nexport { defineApi, createApi } from \"./core/api/api.mjs\";\nexport type { CreateApi, Declaration, Api, TableApi, CellApi } from \"./core/api/api.mjs\";\nexport { TableOrm } from \"./core/api/table-orm.mjs\";\nexport { CellOrm } from \"./core/api/cell-orm.mjs\";\nexport { SchemaValidationError } from \"./core/managers/api-schema-manager.mjs\";\nexport type { ValidationResult } from \"./core/managers/api-schema-manager.mjs\";\n\n// Command Pattern exports\nexport { SchemaIntegrityError } from \"./core/commands/command-executor.mjs\";\nexport type { EngineAction, EngineCommand } from \"./core/commands/types.mjs\";\n"
6
6
  ],
7
7
  "mappings": ";AAAA;AAAA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AAIA;",
8
- "debugId": "71B0D4615CC7C29C64756E2164756E21",
8
+ "debugId": "0A3DD3BE22C9A95664756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/formula-engine",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "type": "module"
5
5
  }
@@ -13,7 +13,7 @@ import { EvaluationManager } from "./managers/evaluation-manager";
13
13
  import { DependencyManager } from "./managers/dependency-manager";
14
14
  import { StyleManager } from "./managers/style-manager";
15
15
  import type { Api, CreateApi, Declaration } from "./api/api";
16
- import { type EngineAction } from "./commands";
16
+ import { type EngineAction } from "./commands/types";
17
17
  type Metadata = {
18
18
  cell?: unknown;
19
19
  sheet?: unknown;
@@ -216,7 +216,8 @@ export declare class FormulaEngine<TMetadata extends Metadata = Metadata, TCreat
216
216
  isCellInTable(cellAddress: CellAddress): TableDefinition | undefined;
217
217
  /**
218
218
  * Get all data cells in a table (excluding header row).
219
- * Uses workbook indexes to efficiently handle infinite tables.
219
+ * Since spills cannot enter tables (they get #SPILL! error), this only
220
+ * needs to return cells with direct content.
220
221
  */
221
222
  private getTableDataCells;
222
223
  /**
@@ -1,4 +1,4 @@
1
- import type { CellAddress, SerializedCellValue, SpreadsheetRangeEnd, TableDefinition } from "../types";
1
+ import type { CellAddress, SerializedCellValue, SpreadsheetRange, SpreadsheetRangeEnd, TableDefinition } from "../types";
2
2
  import type { WorkbookManager } from "./workbook-manager";
3
3
  export declare class TableManager {
4
4
  tables: Map<
@@ -81,4 +81,9 @@ export declare class TableManager {
81
81
  workbookName: string;
82
82
  }): void;
83
83
  isCellInTable(cellAddress: CellAddress): TableDefinition | undefined;
84
+ /**
85
+ * Check if a range intersects with any table in the given workbook/sheet.
86
+ * Used to prevent spilling into tables (Excel behavior).
87
+ */
88
+ doesRangeIntersectTable(workbookName: string, sheetName: string, range: SpreadsheetRange): boolean;
84
89
  }
@@ -8,5 +8,5 @@ export { TableOrm } from "./core/api/table-orm";
8
8
  export { CellOrm } from "./core/api/cell-orm";
9
9
  export { SchemaValidationError } from "./core/managers/api-schema-manager";
10
10
  export type { ValidationResult } from "./core/managers/api-schema-manager";
11
- export { SchemaIntegrityError } from "./core/commands";
12
- export type { EngineAction, EngineCommand } from "./core/commands";
11
+ export { SchemaIntegrityError } from "./core/commands/command-executor";
12
+ export type { EngineAction, EngineCommand } from "./core/commands/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/formula-engine",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "module": "./dist/mjs/lib.mjs",
5
5
  "scripts": {
6
6
  "test": "bun test",
@@ -1,95 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __reExport = (target, mod, secondTarget) => {
6
- for (let key of __getOwnPropNames(mod))
7
- if (!__hasOwnProp.call(target, key) && key !== "default")
8
- __defProp(target, key, {
9
- get: () => mod[key],
10
- enumerable: true
11
- });
12
- if (secondTarget) {
13
- for (let key of __getOwnPropNames(mod))
14
- if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
15
- __defProp(secondTarget, key, {
16
- get: () => mod[key],
17
- enumerable: true
18
- });
19
- return secondTarget;
20
- }
21
- };
22
- var __moduleCache = /* @__PURE__ */ new WeakMap;
23
- var __toCommonJS = (from) => {
24
- var entry = __moduleCache.get(from), desc;
25
- if (entry)
26
- return entry;
27
- entry = __defProp({}, "__esModule", { value: true });
28
- if (from && typeof from === "object" || typeof from === "function")
29
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
30
- get: () => from[key],
31
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
32
- }));
33
- __moduleCache.set(from, entry);
34
- return entry;
35
- };
36
- var __export = (target, all) => {
37
- for (var name in all)
38
- __defProp(target, name, {
39
- get: all[name],
40
- enumerable: true,
41
- configurable: true,
42
- set: (newValue) => all[name] = () => newValue
43
- });
44
- };
45
-
46
- // src/core/commands/index.ts
47
- var exports_commands = {};
48
- __export(exports_commands, {
49
- UpdateTableCommand: () => import_table_commands.UpdateTableCommand,
50
- UpdateNamedExpressionCommand: () => import_named_expression_commands.UpdateNamedExpressionCommand,
51
- SetWorkbookMetadataCommand: () => import_metadata_commands.SetWorkbookMetadataCommand,
52
- SetSheetMetadataCommand: () => import_metadata_commands.SetSheetMetadataCommand,
53
- SetSheetContentCommand: () => import_content_commands.SetSheetContentCommand,
54
- SetNamedExpressionsCommand: () => import_named_expression_commands.SetNamedExpressionsCommand,
55
- SetCellMetadataCommand: () => import_metadata_commands.SetCellMetadataCommand,
56
- SetCellContentCommand: () => import_content_commands.SetCellContentCommand,
57
- SchemaIntegrityError: () => import_command_executor.SchemaIntegrityError,
58
- ResetTablesCommand: () => import_table_commands.ResetTablesCommand,
59
- RenameWorkbookCommand: () => import_structure_commands.RenameWorkbookCommand,
60
- RenameTableCommand: () => import_table_commands.RenameTableCommand,
61
- RenameSheetCommand: () => import_structure_commands.RenameSheetCommand,
62
- RenameNamedExpressionCommand: () => import_named_expression_commands.RenameNamedExpressionCommand,
63
- RemoveWorkbookCommand: () => import_structure_commands.RemoveWorkbookCommand,
64
- RemoveTableCommand: () => import_table_commands.RemoveTableCommand,
65
- RemoveSheetCommand: () => import_structure_commands.RemoveSheetCommand,
66
- RemoveNamedExpressionCommand: () => import_named_expression_commands.RemoveNamedExpressionCommand,
67
- RemoveConditionalStyleCommand: () => import_style_commands.RemoveConditionalStyleCommand,
68
- RemoveCellStyleCommand: () => import_style_commands.RemoveCellStyleCommand,
69
- PasteCellsCommand: () => import_content_commands.PasteCellsCommand,
70
- MoveRangeCommand: () => import_content_commands.MoveRangeCommand,
71
- MoveCellCommand: () => import_content_commands.MoveCellCommand,
72
- FillAreasCommand: () => import_content_commands.FillAreasCommand,
73
- CommandExecutor: () => import_command_executor.CommandExecutor,
74
- CloneWorkbookCommand: () => import_structure_commands.CloneWorkbookCommand,
75
- ClearRangeCommand: () => import_content_commands.ClearRangeCommand,
76
- ClearCellStylesCommand: () => import_style_commands.ClearCellStylesCommand,
77
- AutoFillCommand: () => import_content_commands.AutoFillCommand,
78
- AddWorkbookCommand: () => import_structure_commands.AddWorkbookCommand,
79
- AddTableCommand: () => import_table_commands.AddTableCommand,
80
- AddSheetCommand: () => import_structure_commands.AddSheetCommand,
81
- AddNamedExpressionCommand: () => import_named_expression_commands.AddNamedExpressionCommand,
82
- AddConditionalStyleCommand: () => import_style_commands.AddConditionalStyleCommand,
83
- AddCellStyleCommand: () => import_style_commands.AddCellStyleCommand
84
- });
85
- module.exports = __toCommonJS(exports_commands);
86
- __reExport(exports_commands, require("./types.cjs"), module.exports);
87
- var import_command_executor = require("./command-executor.cjs");
88
- var import_content_commands = require("./content-commands.cjs");
89
- var import_structure_commands = require("./structure-commands.cjs");
90
- var import_table_commands = require("./table-commands.cjs");
91
- var import_named_expression_commands = require("./named-expression-commands.cjs");
92
- var import_metadata_commands = require("./metadata-commands.cjs");
93
- var import_style_commands = require("./style-commands.cjs");
94
-
95
- //# debugId=590D09E29D3CE9A564756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/core/commands/index.ts"],
4
- "sourcesContent": [
5
- "/**\n * Commands Module - Command Pattern implementation for FormulaEngine\n *\n * This module provides:\n * - EngineCommand interface for all commands\n * - CommandExecutor for execution with undo/redo and schema validation\n * - All command implementations organized by category\n */\n\n// Types and executor\nexport * from \"./types.cjs\";\nexport { CommandExecutor, SchemaIntegrityError } from \"./command-executor.cjs\";\n\n// Content commands\nexport {\n SetCellContentCommand,\n SetSheetContentCommand,\n ClearRangeCommand,\n PasteCellsCommand,\n FillAreasCommand,\n MoveCellCommand,\n MoveRangeCommand,\n AutoFillCommand,\n} from \"./content-commands.cjs\";\n\n// Structure commands\nexport {\n AddWorkbookCommand,\n RemoveWorkbookCommand,\n RenameWorkbookCommand,\n CloneWorkbookCommand,\n AddSheetCommand,\n RemoveSheetCommand,\n RenameSheetCommand,\n type StructureCommandDeps,\n} from \"./structure-commands.cjs\";\n\n// Table commands\nexport {\n AddTableCommand,\n RemoveTableCommand,\n RenameTableCommand,\n UpdateTableCommand,\n ResetTablesCommand,\n type TableCommandDeps,\n} from \"./table-commands.cjs\";\n\n// Named expression commands\nexport {\n AddNamedExpressionCommand,\n RemoveNamedExpressionCommand,\n UpdateNamedExpressionCommand,\n RenameNamedExpressionCommand,\n SetNamedExpressionsCommand,\n type NamedExpressionCommandDeps,\n} from \"./named-expression-commands.cjs\";\n\n// Metadata commands\nexport {\n SetCellMetadataCommand,\n SetSheetMetadataCommand,\n SetWorkbookMetadataCommand,\n} from \"./metadata-commands.cjs\";\n\n// Style commands\nexport {\n AddConditionalStyleCommand,\n RemoveConditionalStyleCommand,\n AddCellStyleCommand,\n RemoveCellStyleCommand,\n ClearCellStylesCommand,\n} from \"./style-commands.cjs\";\n\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;AACsD,IAAtD;AAYO,IATP;AAqBO,IATP;AAmBO,IAPP;AAiBO,IAPP;AAcO,IAJP;AAaO,IANP;",
8
- "debugId": "590D09E29D3CE9A564756E2164756E21",
9
- "names": []
10
- }
@@ -1,87 +0,0 @@
1
- // src/core/commands/index.ts
2
- export * from "./types.mjs";
3
- import { CommandExecutor, SchemaIntegrityError } from "./command-executor.mjs";
4
- import {
5
- SetCellContentCommand,
6
- SetSheetContentCommand,
7
- ClearRangeCommand,
8
- PasteCellsCommand,
9
- FillAreasCommand,
10
- MoveCellCommand,
11
- MoveRangeCommand,
12
- AutoFillCommand
13
- } from "./content-commands.mjs";
14
- import {
15
- AddWorkbookCommand,
16
- RemoveWorkbookCommand,
17
- RenameWorkbookCommand,
18
- CloneWorkbookCommand,
19
- AddSheetCommand,
20
- RemoveSheetCommand,
21
- RenameSheetCommand
22
- } from "./structure-commands.mjs";
23
- import {
24
- AddTableCommand,
25
- RemoveTableCommand,
26
- RenameTableCommand,
27
- UpdateTableCommand,
28
- ResetTablesCommand
29
- } from "./table-commands.mjs";
30
- import {
31
- AddNamedExpressionCommand,
32
- RemoveNamedExpressionCommand,
33
- UpdateNamedExpressionCommand,
34
- RenameNamedExpressionCommand,
35
- SetNamedExpressionsCommand
36
- } from "./named-expression-commands.mjs";
37
- import {
38
- SetCellMetadataCommand,
39
- SetSheetMetadataCommand,
40
- SetWorkbookMetadataCommand
41
- } from "./metadata-commands.mjs";
42
- import {
43
- AddConditionalStyleCommand,
44
- RemoveConditionalStyleCommand,
45
- AddCellStyleCommand,
46
- RemoveCellStyleCommand,
47
- ClearCellStylesCommand
48
- } from "./style-commands.mjs";
49
- export {
50
- UpdateTableCommand,
51
- UpdateNamedExpressionCommand,
52
- SetWorkbookMetadataCommand,
53
- SetSheetMetadataCommand,
54
- SetSheetContentCommand,
55
- SetNamedExpressionsCommand,
56
- SetCellMetadataCommand,
57
- SetCellContentCommand,
58
- SchemaIntegrityError,
59
- ResetTablesCommand,
60
- RenameWorkbookCommand,
61
- RenameTableCommand,
62
- RenameSheetCommand,
63
- RenameNamedExpressionCommand,
64
- RemoveWorkbookCommand,
65
- RemoveTableCommand,
66
- RemoveSheetCommand,
67
- RemoveNamedExpressionCommand,
68
- RemoveConditionalStyleCommand,
69
- RemoveCellStyleCommand,
70
- PasteCellsCommand,
71
- MoveRangeCommand,
72
- MoveCellCommand,
73
- FillAreasCommand,
74
- CommandExecutor,
75
- CloneWorkbookCommand,
76
- ClearRangeCommand,
77
- ClearCellStylesCommand,
78
- AutoFillCommand,
79
- AddWorkbookCommand,
80
- AddTableCommand,
81
- AddSheetCommand,
82
- AddNamedExpressionCommand,
83
- AddConditionalStyleCommand,
84
- AddCellStyleCommand
85
- };
86
-
87
- //# debugId=6091959346EC322C64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/core/commands/index.ts"],
4
- "sourcesContent": [
5
- "/**\n * Commands Module - Command Pattern implementation for FormulaEngine\n *\n * This module provides:\n * - EngineCommand interface for all commands\n * - CommandExecutor for execution with undo/redo and schema validation\n * - All command implementations organized by category\n */\n\n// Types and executor\nexport * from \"./types.mjs\";\nexport { CommandExecutor, SchemaIntegrityError } from \"./command-executor.mjs\";\n\n// Content commands\nexport {\n SetCellContentCommand,\n SetSheetContentCommand,\n ClearRangeCommand,\n PasteCellsCommand,\n FillAreasCommand,\n MoveCellCommand,\n MoveRangeCommand,\n AutoFillCommand,\n} from \"./content-commands.mjs\";\n\n// Structure commands\nexport {\n AddWorkbookCommand,\n RemoveWorkbookCommand,\n RenameWorkbookCommand,\n CloneWorkbookCommand,\n AddSheetCommand,\n RemoveSheetCommand,\n RenameSheetCommand,\n type StructureCommandDeps,\n} from \"./structure-commands.mjs\";\n\n// Table commands\nexport {\n AddTableCommand,\n RemoveTableCommand,\n RenameTableCommand,\n UpdateTableCommand,\n ResetTablesCommand,\n type TableCommandDeps,\n} from \"./table-commands.mjs\";\n\n// Named expression commands\nexport {\n AddNamedExpressionCommand,\n RemoveNamedExpressionCommand,\n UpdateNamedExpressionCommand,\n RenameNamedExpressionCommand,\n SetNamedExpressionsCommand,\n type NamedExpressionCommandDeps,\n} from \"./named-expression-commands.mjs\";\n\n// Metadata commands\nexport {\n SetCellMetadataCommand,\n SetSheetMetadataCommand,\n SetWorkbookMetadataCommand,\n} from \"./metadata-commands.mjs\";\n\n// Style commands\nexport {\n AddConditionalStyleCommand,\n RemoveConditionalStyleCommand,\n AddCellStyleCommand,\n RemoveCellStyleCommand,\n ClearCellStylesCommand,\n} from \"./style-commands.mjs\";\n\n"
6
- ],
7
- "mappings": ";AAUA;AACA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
8
- "debugId": "6091959346EC322C64756E2164756E21",
9
- "names": []
10
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Commands Module - Command Pattern implementation for FormulaEngine
3
- *
4
- * This module provides:
5
- * - EngineCommand interface for all commands
6
- * - CommandExecutor for execution with undo/redo and schema validation
7
- * - All command implementations organized by category
8
- */
9
- export * from "./types";
10
- export { CommandExecutor, SchemaIntegrityError } from "./command-executor";
11
- export { SetCellContentCommand, SetSheetContentCommand, ClearRangeCommand, PasteCellsCommand, FillAreasCommand, MoveCellCommand, MoveRangeCommand, AutoFillCommand, } from "./content-commands";
12
- export { AddWorkbookCommand, RemoveWorkbookCommand, RenameWorkbookCommand, CloneWorkbookCommand, AddSheetCommand, RemoveSheetCommand, RenameSheetCommand, type StructureCommandDeps, } from "./structure-commands";
13
- export { AddTableCommand, RemoveTableCommand, RenameTableCommand, UpdateTableCommand, ResetTablesCommand, type TableCommandDeps, } from "./table-commands";
14
- export { AddNamedExpressionCommand, RemoveNamedExpressionCommand, UpdateNamedExpressionCommand, RenameNamedExpressionCommand, SetNamedExpressionsCommand, type NamedExpressionCommandDeps, } from "./named-expression-commands";
15
- export { SetCellMetadataCommand, SetSheetMetadataCommand, SetWorkbookMetadataCommand, } from "./metadata-commands";
16
- export { AddConditionalStyleCommand, RemoveConditionalStyleCommand, AddCellStyleCommand, RemoveCellStyleCommand, ClearCellStylesCommand, } from "./style-commands";