{"_id":"@ai-path/lattica-core","_rev":"3-34ff3613be3fd40b47f2bfa7d2ece2a8","name":"@ai-path/lattica-core","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@ai-path/lattica-core","version":"0.1.0","license":"MIT","_id":"@ai-path/lattica-core@0.1.0","maintainers":[{"name":"fsakurai","email":"f-sakurai@ai-path.jp"}],"dist":{"shasum":"41618242ea180f351c406e6094f80e3f4d3aa70a","tarball":"https://registry.npmjs.org/@ai-path/lattica-core/-/lattica-core-0.1.0.tgz","fileCount":8,"integrity":"sha512-k0rVZAgWjVryxrbKXwTZRdWJW1rvR65GopmSlyVjKMvXyLst7QseDPvfDlBGxgnjha3VUMU8RcAHe/UAA7OwZw==","signatures":[{"sig":"MEUCICdiy26zmJSXxQj6qSzzagX4deHQjEsU02eO2k97lop6AiEAoYfeeuWDeyxn1NsVfeTLy4gnVKuOZeVOlNnthKB5jEQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":648227},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"2e14dee9aa41d49bc8899cc2091f182e6f3dd349","scripts":{"build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"fsakurai","email":"f-sakurai@ai-path.jp"},"_npmVersion":"10.9.3","description":"Framework-agnostic core engine for the Lattica data grid: data model, coordinate system, selection, virtualization math, command/undo-redo.","directories":{},"sideEffects":false,"_nodeVersion":"22.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/lattica-core_0.1.0_1783152240549_0.3601601159141279","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @ai-path/tb-core (product: Taible). Install @ai-path/tb-core instead."},"0.1.1":{"name":"@ai-path/lattica-core","version":"0.1.1","license":"MIT","_id":"@ai-path/lattica-core@0.1.1","maintainers":[{"name":"fsakurai","email":"f-sakurai@ai-path.jp"}],"dist":{"shasum":"97170fec0045ccec58f94fc357aa5b630c638c9e","tarball":"https://registry.npmjs.org/@ai-path/lattica-core/-/lattica-core-0.1.1.tgz","fileCount":9,"integrity":"sha512-Ftd93MUO3nH6vB9Ry/27bamzjejaQE5RVqqpbRNqxcZ0xJUXt7qbtj9RW2vsvgWp+ksf3pQndypevRZxnWn0HA==","signatures":[{"sig":"MEYCIQCz+Qkia/zr+mW/b6aYiN4Ppa15IWMDTcVLIb7IGBLWOgIhAPhKpV1ViuqTHGkWGPAXRUkLpV0LSCz+DFZBFlHPKiud","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":650457},"main":"./dist/index.cjs","type":"module","_from":"file:ai-path-lattica-core-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"fsakurai","email":"f-sakurai@ai-path.jp"},"_resolved":"/private/var/folders/tf/0c43660d4k1dg4ssxq0n63ww0000gn/T/da7f6556c4eaca9dbf2846be08467df3/ai-path-lattica-core-0.1.1.tgz","_integrity":"sha512-Ftd93MUO3nH6vB9Ry/27bamzjejaQE5RVqqpbRNqxcZ0xJUXt7qbtj9RW2vsvgWp+ksf3pQndypevRZxnWn0HA==","_npmVersion":"10.9.3","description":"Framework-agnostic core engine for the Lattica data grid: data model, coordinate system, selection, virtualization math, command/undo-redo.","directories":{},"sideEffects":false,"_nodeVersion":"22.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/lattica-core_0.1.1_1783177103565_0.5616962635265004","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @ai-path/tb-core (product: Taible). Install @ai-path/tb-core instead."}},"time":{"created":"2026-07-04T08:04:00.324Z","modified":"2026-07-04T16:08:43.194Z","0.1.0":"2026-07-04T08:04:00.747Z","0.1.1":"2026-07-04T14:58:23.768Z"},"license":"MIT","description":"Framework-agnostic core engine for the Lattica data grid: data model, coordinate system, selection, virtualization math, command/undo-redo.","maintainers":[{"name":"fsakurai","email":"f-sakurai@ai-path.jp"}],"readme":"# @ai-path/lattica-core\n\nThe framework-agnostic data-grid engine at the heart of Lattica. It provides the pure, DOM-free building blocks a grid is made of — coordinate math, a sparse cell store, selection and undo models, multi-level headers, search, validation, conditional formatting, comments, borders, and fill/series logic — so that view layers (such as `@ai-path/lattica-react`) and tooling can compose them without pulling in any rendering concerns.\n\n## Install\n\n```sh\npnpm add @ai-path/lattica-core\n```\n\n## API overview\n\nThe package re-exports cell/value types from `./types.js` plus a set of focused models and pure helpers. The most commonly used exports are listed below.\n\n### Coordinates\n\nA1-notation conversion and addressing helpers.\n\n```ts\nimport { toA1, parseA1, columnIndexToLabel, addressKey } from '@ai-path/lattica-core';\n\ntoA1({ row: 0, col: 0 }); // 'A1'\nparseA1('B3');            // { row: 2, col: 1 }\ncolumnIndexToLabel(26);   // 'AA'\naddressKey({ row: 1, col: 1 }); // stable string key for maps/sets\n```\n\n### DataStore\n\nA sparse, observable cell store with change events.\n\n```ts\nimport { DataStore } from '@ai-path/lattica-core';\n\nconst store = new DataStore();\nconst off = store.subscribe((change) => console.info('changed', change));\nstore.set({ row: 0, col: 0 }, 42);\nstore.get({ row: 0, col: 0 }); // 42\noff();\n```\n\n### Selection & undo\n\n`SelectionModel` tracks the active cell and selected ranges; `UndoManager` runs\nreversible `Command`s (and `CompositeCommand`s) with undo/redo.\n\n```ts\nimport { SelectionModel, UndoManager, type Command } from '@ai-path/lattica-core';\n\nconst selection = new SelectionModel({ rowCount: 100, colCount: 26 });\nselection.moveTo({ row: 0, col: 0 });\n\nconst undo = new UndoManager();\nconst cmd: Command = { label: 'demo', apply() {/* … */}, invert() { return cmd; } };\nundo.execute(cmd);\nundo.undo();\n```\n\n### Search & conditional formatting\n\n`searchGrid` is a pure scan over a cell accessor; `ConditionalFormatModel` maps a\nvalue to a `CfStyle` via an ordered list of `CfRule`s (first match wins).\n\n```ts\nimport { searchGrid, ConditionalFormatModel, type CfRule } from '@ai-path/lattica-core';\n\nconst matches = searchGrid(rows, cols, (r, c) => getDisplay(r, c), 'total', {\n  caseSensitive: false,\n  wholeCell: false,\n});\n\nconst cf = new ConditionalFormatModel();\nconst rule: CfRule = { kind: 'gt', value: 100, style: { background: '#fee', bold: true } };\ncf.addRule(rule);\ncf.styleFor(150); // -> { background: '#fee', bold: true }\n```\n\n### Other models\n\n- `SizeManager` — row/column size tracking with defaults and overrides.\n- `HeaderModel` / `computeHeaderLayout` — multi-level grouped column headers (`ColumnDef`, `ColumnGroupDef`, `ColumnNode`).\n- `MergeModel`, `BorderModel`, `CommentModel`, `ValidationModel` (with `validators`).\n- `SummaryFn` helpers: `summarize`, `summarizeColumn`, `toNumberOrNull`.\n- Ranges: `normalizeRange`, `rangeContains`, `rangesIntersect`, `forEachCell`, `clampRange`.\n- Viewport: `computeVisibleWindow`, `forEachIndex`.\n- Fill: `detectSeries` / `extendSeries` (`SeriesKind`) and `fillRegion` (`FillDirection`).\n- Persistence: `serializeState` / `deserializeState` / `emptyState` (`GridStateSnapshot`).\n- Eventing: `Emitter`, `HookBus`.\n","readmeFilename":"README.md"}