Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

708 B
Raw Blame
import { LoroDoc } from 'loro-crdt';
import { onCleanup } from 'solid-js';
import type { SpreadsheetDocumentSource } from '../context/spreadsheet-source';
import {
  type SpreadsheetCells,
  writeSpreadsheetCells,
} from '../core/spreadsheet-document';

/** A standalone editor source for previews and integration tests. */
export function createLocalSpreadsheetSource(
  initialCells: SpreadsheetCells = {}
): SpreadsheetDocumentSource {
  const doc = new LoroDoc();
  writeSpreadsheetCells(doc, initialCells);
  onCleanup(() => doc.free());
  return {
    doc: () => doc,
    ready: () => true,
    error: () => undefined,
    status: () => 'local',
    peers: () => [],
    setSelection: () => {},
  };
}