@dxos/plugin-sheet 0.6.8-main.046e6cf

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 (147) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +14 -0
  3. package/dist/lib/browser/SheetContainer-H22IDJ43.mjs +3740 -0
  4. package/dist/lib/browser/SheetContainer-H22IDJ43.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-6VPEAUG6.mjs +82 -0
  6. package/dist/lib/browser/chunk-6VPEAUG6.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-AT2FJXQX.mjs +861 -0
  8. package/dist/lib/browser/chunk-AT2FJXQX.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-JRL5LGCE.mjs +18 -0
  10. package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +213 -0
  12. package/dist/lib/browser/index.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -0
  14. package/dist/lib/browser/meta.mjs +9 -0
  15. package/dist/lib/browser/meta.mjs.map +7 -0
  16. package/dist/lib/browser/types.mjs +22 -0
  17. package/dist/lib/browser/types.mjs.map +7 -0
  18. package/dist/lib/node/SheetContainer-S32KTNZ6.cjs +3731 -0
  19. package/dist/lib/node/SheetContainer-S32KTNZ6.cjs.map +7 -0
  20. package/dist/lib/node/chunk-4CE6FK5Z.cjs +108 -0
  21. package/dist/lib/node/chunk-4CE6FK5Z.cjs.map +7 -0
  22. package/dist/lib/node/chunk-BJ6ZD7MN.cjs +51 -0
  23. package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +7 -0
  24. package/dist/lib/node/chunk-FCKJ4QRM.cjs +881 -0
  25. package/dist/lib/node/chunk-FCKJ4QRM.cjs.map +7 -0
  26. package/dist/lib/node/index.cjs +226 -0
  27. package/dist/lib/node/index.cjs.map +7 -0
  28. package/dist/lib/node/meta.cjs +30 -0
  29. package/dist/lib/node/meta.cjs.map +7 -0
  30. package/dist/lib/node/meta.json +1 -0
  31. package/dist/lib/node/types.cjs +44 -0
  32. package/dist/lib/node/types.cjs.map +7 -0
  33. package/dist/types/src/SheetPlugin.d.ts +4 -0
  34. package/dist/types/src/SheetPlugin.d.ts.map +1 -0
  35. package/dist/types/src/components/CellEditor/CellEditor.d.ts +14 -0
  36. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +1 -0
  37. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts +29 -0
  38. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +1 -0
  39. package/dist/types/src/components/CellEditor/extension.d.ts +18 -0
  40. package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -0
  41. package/dist/types/src/components/CellEditor/extension.test.d.ts +2 -0
  42. package/dist/types/src/components/CellEditor/extension.test.d.ts.map +1 -0
  43. package/dist/types/src/components/CellEditor/functions.d.ts +66 -0
  44. package/dist/types/src/components/CellEditor/functions.d.ts.map +1 -0
  45. package/dist/types/src/components/CellEditor/index.d.ts +3 -0
  46. package/dist/types/src/components/CellEditor/index.d.ts.map +1 -0
  47. package/dist/types/src/components/ComputeGraph/async-function.d.ts +52 -0
  48. package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +1 -0
  49. package/dist/types/src/components/ComputeGraph/custom.d.ts +21 -0
  50. package/dist/types/src/components/ComputeGraph/custom.d.ts.map +1 -0
  51. package/dist/types/src/components/ComputeGraph/edge-function.d.ts +20 -0
  52. package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +1 -0
  53. package/dist/types/src/components/ComputeGraph/graph-context.d.ts +11 -0
  54. package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +1 -0
  55. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +2 -0
  56. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +1 -0
  57. package/dist/types/src/components/ComputeGraph/graph.d.ts +21 -0
  58. package/dist/types/src/components/ComputeGraph/graph.d.ts.map +1 -0
  59. package/dist/types/src/components/ComputeGraph/index.d.ts +4 -0
  60. package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -0
  61. package/dist/types/src/components/Sheet/Sheet.d.ts +55 -0
  62. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  63. package/dist/types/src/components/Sheet/Sheet.stories.d.ts +54 -0
  64. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -0
  65. package/dist/types/src/components/Sheet/formatting.d.ts +14 -0
  66. package/dist/types/src/components/Sheet/formatting.d.ts.map +1 -0
  67. package/dist/types/src/components/Sheet/grid.d.ts +52 -0
  68. package/dist/types/src/components/Sheet/grid.d.ts.map +1 -0
  69. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  70. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  71. package/dist/types/src/components/Sheet/nav.d.ts +29 -0
  72. package/dist/types/src/components/Sheet/nav.d.ts.map +1 -0
  73. package/dist/types/src/components/Sheet/sheet-context.d.ts +24 -0
  74. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -0
  75. package/dist/types/src/components/Sheet/util.d.ts +18 -0
  76. package/dist/types/src/components/Sheet/util.d.ts.map +1 -0
  77. package/dist/types/src/components/SheetContainer.d.ts +9 -0
  78. package/dist/types/src/components/SheetContainer.d.ts.map +1 -0
  79. package/dist/types/src/components/Toolbar/Toolbar.d.ts +21 -0
  80. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  81. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +35 -0
  82. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -0
  83. package/dist/types/src/components/Toolbar/common.d.ts +20 -0
  84. package/dist/types/src/components/Toolbar/common.d.ts.map +1 -0
  85. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  86. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  87. package/dist/types/src/components/index.d.ts +7 -0
  88. package/dist/types/src/components/index.d.ts.map +1 -0
  89. package/dist/types/src/index.d.ts +4 -0
  90. package/dist/types/src/index.d.ts.map +1 -0
  91. package/dist/types/src/meta.d.ts +15 -0
  92. package/dist/types/src/meta.d.ts.map +1 -0
  93. package/dist/types/src/model/index.d.ts +3 -0
  94. package/dist/types/src/model/index.d.ts.map +1 -0
  95. package/dist/types/src/model/model.browser.test.d.ts +2 -0
  96. package/dist/types/src/model/model.browser.test.d.ts.map +1 -0
  97. package/dist/types/src/model/model.d.ts +142 -0
  98. package/dist/types/src/model/model.d.ts.map +1 -0
  99. package/dist/types/src/model/types.d.ts +17 -0
  100. package/dist/types/src/model/types.d.ts.map +1 -0
  101. package/dist/types/src/model/types.test.d.ts +2 -0
  102. package/dist/types/src/model/types.test.d.ts.map +1 -0
  103. package/dist/types/src/model/util.d.ts +15 -0
  104. package/dist/types/src/model/util.d.ts.map +1 -0
  105. package/dist/types/src/translations.d.ts +16 -0
  106. package/dist/types/src/translations.d.ts.map +1 -0
  107. package/dist/types/src/types.d.ts +94 -0
  108. package/dist/types/src/types.d.ts.map +1 -0
  109. package/package.json +122 -0
  110. package/src/SheetPlugin.tsx +150 -0
  111. package/src/components/CellEditor/CellEditor.stories.tsx +88 -0
  112. package/src/components/CellEditor/CellEditor.tsx +113 -0
  113. package/src/components/CellEditor/extension.test.ts +42 -0
  114. package/src/components/CellEditor/extension.ts +286 -0
  115. package/src/components/CellEditor/functions.ts +2017 -0
  116. package/src/components/CellEditor/index.ts +6 -0
  117. package/src/components/ComputeGraph/async-function.ts +148 -0
  118. package/src/components/ComputeGraph/custom.ts +70 -0
  119. package/src/components/ComputeGraph/edge-function.ts +60 -0
  120. package/src/components/ComputeGraph/graph-context.tsx +37 -0
  121. package/src/components/ComputeGraph/graph.browser.test.ts +49 -0
  122. package/src/components/ComputeGraph/graph.ts +52 -0
  123. package/src/components/ComputeGraph/index.ts +7 -0
  124. package/src/components/Sheet/Sheet.stories.tsx +329 -0
  125. package/src/components/Sheet/Sheet.tsx +1164 -0
  126. package/src/components/Sheet/formatting.ts +106 -0
  127. package/src/components/Sheet/grid.ts +191 -0
  128. package/src/components/Sheet/index.ts +5 -0
  129. package/src/components/Sheet/nav.ts +157 -0
  130. package/src/components/Sheet/sheet-context.tsx +101 -0
  131. package/src/components/Sheet/util.ts +56 -0
  132. package/src/components/SheetContainer.tsx +30 -0
  133. package/src/components/Toolbar/Toolbar.stories.tsx +36 -0
  134. package/src/components/Toolbar/Toolbar.tsx +198 -0
  135. package/src/components/Toolbar/common.tsx +72 -0
  136. package/src/components/Toolbar/index.ts +5 -0
  137. package/src/components/index.ts +10 -0
  138. package/src/index.ts +9 -0
  139. package/src/meta.tsx +18 -0
  140. package/src/model/index.ts +6 -0
  141. package/src/model/model.browser.test.ts +100 -0
  142. package/src/model/model.ts +480 -0
  143. package/src/model/types.test.ts +92 -0
  144. package/src/model/types.ts +71 -0
  145. package/src/model/util.ts +36 -0
  146. package/src/translations.ts +22 -0
  147. package/src/types.ts +110 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ComputeGraph/graph.ts", "../../../src/components/ComputeGraph/async-function.ts", "../../../src/components/ComputeGraph/custom.ts", "../../../src/components/ComputeGraph/edge-function.ts", "../../../src/components/ComputeGraph/graph-context.tsx", "../../../src/model/types.ts", "../../../src/model/model.ts", "../../../src/model/util.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { HyperFormula } from 'hyperformula';\n\nimport { Event } from '@dxos/async';\nimport { type Space } from '@dxos/client/echo';\nimport { PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\n\nimport { FunctionContext } from './async-function';\nimport { CustomPlugin, CustomPluginTranslations } from './custom';\nimport { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './edge-function';\n\n/**\n * Create root graph for space.\n */\nexport const createComputeGraph = (space?: Space): ComputeGraph => {\n // TODO(burdon): Configure.\n HyperFormula.registerFunctionPlugin(CustomPlugin, CustomPluginTranslations);\n HyperFormula.registerFunctionPlugin(EdgeFunctionPlugin, EdgeFunctionPluginTranslations);\n\n const hf = HyperFormula.buildEmpty({ licenseKey: 'gpl-v3' });\n return new ComputeGraph(hf, space);\n};\n\n/**\n * Per-space compute and dependency graph.\n */\n// TODO(burdon): Create instance for each space.\nexport class ComputeGraph {\n public readonly id = `graph-${PublicKey.random().truncate()}`;\n public readonly update = new Event();\n\n // The context is passed to all functions.\n public readonly context = new FunctionContext(this.hf, this._space, () => {\n this.refresh();\n });\n\n constructor(\n public readonly hf: HyperFormula,\n private readonly _space?: Space,\n ) {\n this.hf.updateConfig({ context: this.context });\n }\n\n refresh() {\n log('refresh', { id: this.id });\n this.update.emit();\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CellError, ErrorType, EmptyValue, FunctionPlugin, type HyperFormula } from 'hyperformula';\nimport { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';\nimport { type InterpreterValue } from 'hyperformula/typings/interpreter/InterpreterValue';\nimport { type ProcedureAst } from 'hyperformula/typings/parser';\n\nimport { debounce } from '@dxos/async';\nimport { type Space } from '@dxos/client/echo';\nimport { log } from '@dxos/log';\n\n// TODO(burdon): API gateways!\n// https://publicapis.io\n// https://api-ninjas.com/api/cryptoprice\n// https://developers.google.com/apis-explorer\n// https://publicapis.io/coin-desk-api\n\n// TODO(burdon): Create wrapper.\nexport type AsyncFunction = (...args: any) => Promise<InterpreterValue>;\n\nexport type FunctionOptions = {\n ttl?: number;\n};\n\nexport type FunctionContextOptions = {\n defaultTtl: number;\n recalculationDelay: number;\n};\n\nexport const defaultFunctionContextOptions: FunctionContextOptions = {\n defaultTtl: 5_000,\n recalculationDelay: 200,\n};\n\n/**\n * The context singleton for the model is passed into custom functions.\n *\n * HyperFormula does not support async functions.\n * - https://hyperformula.handsontable.com/guide/custom-functions.html\n * - https://hyperformula.handsontable.com/guide/known-limitations.html#known-limitations\n * - https://github.com/handsontable/hyperformula/issues/892\n */\nexport class FunctionContext {\n // Mangle name with params.\n static createInvocationKey(name: string, ...args: any) {\n return JSON.stringify({ name, ...args });\n }\n\n // Cached values for cell.\n private readonly _cache = new Map<string, { value: InterpreterValue; ts: number }>();\n\n // Active requests.\n private readonly _pending = new Map<string, number>();\n\n // Invocation count.\n private _invocations: Record<string, number> = {};\n\n private readonly _onUpdate: () => void;\n\n constructor(\n private readonly _hf: HyperFormula,\n private readonly _space: Space | undefined,\n onUpdate: (context: FunctionContext) => void,\n private readonly _options = defaultFunctionContextOptions,\n ) {\n this._onUpdate = debounce(() => {\n // TODO(burdon): Better way to trigger recalculation?\n // NOTE: rebuildAndRecalculate resets the undo history.\n this._hf.resumeEvaluation();\n onUpdate(this);\n }, this._options.recalculationDelay);\n }\n\n get space() {\n return this._space;\n }\n\n get info() {\n return { cache: this._cache.size, invocations: this._invocations };\n }\n\n flush() {\n this._cache.clear();\n this._invocations = {};\n }\n\n /**\n * Exec the function if TTL has expired.\n * Return the cached value.\n */\n invokeFunction(\n name: string,\n state: InterpreterState,\n args: any[],\n cb: AsyncFunction,\n options?: FunctionOptions,\n ): InterpreterValue | undefined {\n const ttl = options?.ttl ?? this._options.defaultTtl;\n\n const { formulaAddress: cell } = state;\n const invocationKey = FunctionContext.createInvocationKey(name, ...args);\n const { value = undefined, ts = 0 } = this._cache.get(invocationKey) ?? {};\n\n const now = Date.now();\n const delta = now - ts;\n if ((!ts || delta > ttl) && !this._pending.has(invocationKey)) {\n this._pending.set(invocationKey, now);\n setTimeout(async () => {\n this._invocations[name] = (this._invocations[name] ?? 0) + 1;\n try {\n // Exec function.\n const value = await cb(...args);\n this._cache.set(invocationKey, { value, ts: Date.now() });\n log('set', { cell, value });\n this._onUpdate();\n } catch (err) {\n // TODO(burdon): Show error to user.\n log.warn('failed', { cell, err });\n this._cache.set(invocationKey, { value: new CellError(ErrorType.ERROR, 'Function failed.'), ts: Date.now() });\n } finally {\n this._pending.delete(invocationKey);\n }\n });\n }\n\n log('invoke', { cell, name, args, cache: value });\n return value;\n }\n}\n\n/**\n * Base class for async functions.\n */\nexport class FunctionPluginAsync extends FunctionPlugin {\n get context() {\n return this.config.context as FunctionContext;\n }\n\n runAsyncFunction(ast: ProcedureAst, state: InterpreterState, cb: AsyncFunction, options?: FunctionOptions) {\n const { procedureName } = ast;\n const metadata = this.metadata(procedureName);\n return this.runFunction(ast.args, state, metadata, (...args: any) => {\n return this.context.invokeFunction(procedureName, state, args, cb, options) ?? EmptyValue;\n });\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FunctionArgumentType } from 'hyperformula';\nimport { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';\nimport { type ProcedureAst } from 'hyperformula/typings/parser';\n\nimport { getDeep } from '@dxos/util';\n\nimport { type AsyncFunction, FunctionPluginAsync } from './async-function';\n\n// TODO(burdon): Factor out.\nconst parseNumberString = (str: string): number => {\n return parseFloat(str.replace(/[^\\d.]/g, ''));\n};\n\n/**\n * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function\n */\nexport class CustomPlugin extends FunctionPluginAsync {\n test(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async () => {\n return Math.random();\n };\n\n return this.runAsyncFunction(ast, state, handler);\n }\n\n crypto(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async (_currency) => {\n const currency = (_currency || 'USD').toUpperCase();\n const result = await fetch(`https://api.coindesk.com/v1/bpi/currentprice/${currency}.json`);\n const data = await result.json();\n const rate = getDeep<string>(data, ['bpi', currency, 'rate']);\n if (!rate) {\n return NaN;\n }\n\n return parseNumberString(rate);\n };\n\n return this.runAsyncFunction(ast, state, handler, { ttl: 10_000 });\n }\n}\n\nCustomPlugin.implementedFunctions = {\n TEST: {\n method: 'test',\n parameters: [],\n isVolatile: true,\n },\n\n CRYPTO: {\n method: 'crypto',\n parameters: [{ argumentType: FunctionArgumentType.STRING, optionalArg: true }],\n isVolatile: true,\n },\n};\n\nexport const CustomPluginTranslations = {\n enGB: {\n TEST: 'TEST',\n CRYPTO: 'CRYPTO',\n },\n enUS: {\n TEST: 'TEST',\n CRYPTO: 'CRYPTO',\n },\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CellError, ErrorType, FunctionArgumentType } from 'hyperformula';\nimport { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';\nimport { type ProcedureAst } from 'hyperformula/typings/parser';\n\nimport { Filter, getMeta } from '@dxos/client/echo';\nimport { getUserFunctionUrlInMetadata } from '@dxos/plugin-script/edge';\nimport { ScriptType } from '@dxos/plugin-script/types';\n\nimport { type AsyncFunction, FunctionPluginAsync } from './async-function';\n\n/**\n * A hyperformula function plugin for calling EDGE functions.\n *\n * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function\n */\nexport class EdgeFunctionPlugin extends FunctionPluginAsync {\n edge(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async (binding: string) => {\n const space = this.context.space;\n if (!space) {\n return new CellError(ErrorType.VALUE, 'No space');\n }\n\n const {\n objects: [script],\n } = await space.db.query(Filter.schema(ScriptType, { binding })).run();\n if (!script) {\n return new CellError(ErrorType.VALUE, 'No script');\n }\n\n const path = getUserFunctionUrlInMetadata(getMeta(script));\n // TODO(wittjosiah): Get base url from client config.\n const result = await fetch(`https://functions-staging.dxos.workers.dev${path}`, { method: 'POST' });\n return await result.text();\n };\n\n return this.runAsyncFunction(ast, state, handler, { ttl: 10_000 });\n }\n}\n\nEdgeFunctionPlugin.implementedFunctions = {\n EDGE: {\n method: 'edge',\n parameters: [{ argumentType: FunctionArgumentType.STRING }],\n isVolatile: true,\n },\n};\n\nexport const EdgeFunctionPluginTranslations = {\n enGB: {\n EDGE: 'EDGE',\n },\n enUS: {\n EDGE: 'EDGE',\n },\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { createContext, type PropsWithChildren, useContext, useEffect } from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { createComputeGraph, type ComputeGraph } from './graph';\n\nexport type ComputeGraphContextType = {\n graphs: Record<string, ComputeGraph>;\n setGraph: (key: string, graph: ComputeGraph) => void;\n};\n\nexport const ComputeGraphContext = createContext<ComputeGraphContextType>({ graphs: {}, setGraph: () => {} });\n\nexport const ComputeGraphContextProvider = ({\n children,\n graphs,\n setGraph,\n}: PropsWithChildren<ComputeGraphContextType>) => {\n return <ComputeGraphContext.Provider value={{ graphs, setGraph }}>{children}</ComputeGraphContext.Provider>;\n};\n\nexport const useComputeGraph = (space: Space): ComputeGraph => {\n const { graphs, setGraph } = useContext(ComputeGraphContext);\n const graph = graphs[space.id] ?? createComputeGraph(space);\n\n useEffect(() => {\n if (!graphs[space.id]) {\n setGraph(space.id, graph);\n }\n }, [space]);\n\n return graph;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\n\nexport const MAX_COLUMNS = 26 * 26;\n\nexport type CellAddress = { column: number; row: number };\nexport type CellRange = { from: CellAddress; to?: CellAddress };\n\nexport const posEquals = (a: CellAddress | undefined, b: CellAddress | undefined) => {\n return a?.column === b?.column && a?.row === b?.row;\n};\n\nexport const columnLetter = (column: number): string => {\n invariant(column < MAX_COLUMNS, `Invalid column: ${column}`);\n return (\n (column >= 26 ? String.fromCharCode('A'.charCodeAt(0) + Math.floor(column / 26) - 1) : '') +\n String.fromCharCode('A'.charCodeAt(0) + (column % 26))\n );\n};\n\nexport const addressToA1Notation = ({ column, row }: CellAddress): string => {\n return `${columnLetter(column)}${row + 1}`;\n};\n\nexport const addressFromA1Notation = (ref: string): CellAddress => {\n const match = ref.match(/([A-Z]+)(\\d+)/);\n invariant(match, `Invalid notation: ${ref}`);\n return {\n row: parseInt(match[2], 10) - 1,\n column: match[1].split('').reduce((acc, c) => acc * 26 + c.charCodeAt(0) - 'A'.charCodeAt(0) + 1, 0) - 1,\n };\n};\n\nexport const rangeToA1Notation = (range: CellRange) => {\n return [range?.from && addressToA1Notation(range?.from), range?.to && addressToA1Notation(range?.to)]\n .filter(Boolean)\n .join(':');\n};\n\nexport const rangeFromA1Notation = (ref: string): CellRange => {\n const [from, to] = ref.split(':').map(addressFromA1Notation);\n return { from, to };\n};\n\nexport const inRange = (range: CellRange | undefined, cell: CellAddress): boolean => {\n if (!range) {\n return false;\n }\n\n const { from, to } = range;\n if ((from && posEquals(from, cell)) || (to && posEquals(to, cell))) {\n return true;\n }\n\n if (!from || !to) {\n return false;\n }\n\n const { column: c1, row: r1 } = from;\n const { column: c2, row: r2 } = to;\n const cMin = Math.min(c1, c2);\n const cMax = Math.max(c1, c2);\n const rMin = Math.min(r1, r2);\n const rMax = Math.max(r1, r2);\n\n const { column, row } = cell;\n return column >= cMin && column <= cMax && row >= rMin && row <= rMax;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { DetailedCellError, ExportedCellChange } from 'hyperformula';\nimport { type SimpleCellRange } from 'hyperformula/typings/AbsoluteCellRange';\nimport { type SimpleCellAddress } from 'hyperformula/typings/Cell';\nimport { type SimpleDate, type SimpleDateTime } from 'hyperformula/typings/DateTimeHelper';\n\nimport { Event } from '@dxos/async';\nimport { Context } from '@dxos/context';\nimport { invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\n\nimport { addressFromA1Notation, addressToA1Notation, type CellAddress, type CellRange } from './types';\nimport { createIndices, RangeException, ReadonlyException } from './util';\nimport { type ComputeGraph } from '../components';\nimport { type CellScalarValue, type CellValue, type SheetType, ValueTypeEnum } from '../types';\n\n// TODO(burdon): Defaults or Max?\nconst DEFAULT_ROWS = 500;\nconst DEFAULT_COLUMNS = 26 * 2;\n\nexport type CellIndex = string;\n\nexport type CellContentValue = number | string | boolean | null;\n\nexport type SheetModelOptions = {\n readonly?: boolean;\n rows: number;\n columns: number;\n};\n\nconst typeMap: Record<string, ValueTypeEnum> = {\n BOOLEAN: ValueTypeEnum.Boolean,\n NUMBER_RAW: ValueTypeEnum.Number,\n NUMBER_PERCENT: ValueTypeEnum.Percent,\n NUMBER_CURRENCY: ValueTypeEnum.Currency,\n NUMBER_DATETIME: ValueTypeEnum.DateTime,\n NUMBER_DATE: ValueTypeEnum.Date,\n NUMBER_TIME: ValueTypeEnum.Time,\n};\n\nexport const defaultOptions: SheetModelOptions = {\n rows: 50,\n columns: 26,\n};\n\nconst getTopLeft = (range: CellRange) => {\n const to = range.to ?? range.from;\n return { row: Math.min(range.from.row, to.row), column: Math.min(range.from.column, to.column) };\n};\n\nconst toSimpleCellAddress = (sheet: number, cell: CellAddress): SimpleCellAddress => ({\n sheet,\n row: cell.row,\n col: cell.column,\n});\n\nconst toModelRange = (sheet: number, range: CellRange): SimpleCellRange => ({\n start: toSimpleCellAddress(sheet, range.from),\n end: toSimpleCellAddress(sheet, range.to ?? range.from),\n});\n\n/**\n * Spreadsheet data model.\n *\n * [ComputeGraphContext] > [SheetContext]:[SheetModel] > [Sheet.Root]\n */\nexport class SheetModel {\n public readonly id = `model-${PublicKey.random().truncate()}`;\n private _ctx?: Context = undefined;\n\n /**\n * Formula engine.\n * Acts as a write through cache for scalar and computed values.\n */\n private readonly _sheetId: number;\n private readonly _options: SheetModelOptions;\n\n public readonly update = new Event();\n\n constructor(\n private readonly _graph: ComputeGraph,\n private readonly _sheet: SheetType,\n options: Partial<SheetModelOptions> = {},\n ) {\n // Sheet for this object.\n const name = this._sheet.id;\n if (!this._graph.hf.doesSheetExist(name)) {\n this._graph.hf.addSheet(name);\n }\n this._sheetId = this._graph.hf.getSheetId(name)!;\n this._options = { ...defaultOptions, ...options };\n this.reset();\n }\n\n get graph() {\n return this._graph;\n }\n\n get sheet() {\n return this._sheet;\n }\n\n get readonly() {\n return this._options.readonly;\n }\n\n get bounds() {\n return {\n rows: this._sheet.rows.length,\n columns: this._sheet.columns.length,\n };\n }\n\n get functions(): string[] {\n return this._graph.hf.getRegisteredFunctionNames();\n }\n\n get initialized(): boolean {\n return !!this._ctx;\n }\n\n /**\n * Initialize sheet and engine.\n */\n async initialize() {\n log('initialize', { id: this.id });\n invariant(!this.initialized, 'Already initialized.');\n this._ctx = new Context();\n if (!this._sheet.rows.length) {\n this._insertIndices(this._sheet.rows, 0, this._options.rows, DEFAULT_ROWS);\n }\n if (!this._sheet.columns.length) {\n this._insertIndices(this._sheet.columns, 0, this._options.columns, DEFAULT_COLUMNS);\n }\n this.reset();\n\n // Listen for model updates (e.g., async calculations).\n const unsubscribe = this._graph.update.on(() => this.update.emit());\n this._ctx.onDispose(unsubscribe);\n\n return this;\n }\n\n async destroy() {\n log('destroy', { id: this.id });\n if (this._ctx) {\n await this._ctx.dispose();\n this._ctx = undefined;\n }\n }\n\n /**\n * Update engine.\n * NOTE: This resets the undo history.\n * @deprecated\n */\n reset() {\n this._graph.hf.clearSheet(this._sheetId);\n Object.entries(this._sheet.cells).forEach(([key, { value }]) => {\n const { column, row } = this.addressFromIndex(key);\n if (typeof value === 'string' && value.charAt(0) === '=') {\n value = this.mapFormulaIndicesToRefs(value);\n }\n\n this._graph.hf.setCellContents({ sheet: this._sheetId, row, col: column }, value);\n });\n }\n\n /**\n * Recalculate formulas.\n * NOTE: This resets the undo history.\n * https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions\n * @deprecated\n */\n // TODO(burdon): Remove.\n recalculate() {\n this._graph.hf.rebuildAndRecalculate();\n }\n\n insertRows(i: number, n = 1) {\n this._insertIndices(this._sheet.rows, i, n, DEFAULT_ROWS);\n this.reset();\n }\n\n insertColumns(i: number, n = 1) {\n this._insertIndices(this._sheet.columns, i, n, DEFAULT_COLUMNS);\n this.reset();\n }\n\n //\n // Undoable actions.\n // TODO(burdon): Group undoable methods; consistently update hf/sheet.\n //\n\n /**\n * Clear range of values.\n */\n clear(range: CellRange) {\n const topLeft = getTopLeft(range);\n const values = this._iterRange(range, () => null);\n this._graph.hf.setCellContents(toSimpleCellAddress(this._sheetId, topLeft), values);\n this._iterRange(range, (cell) => {\n const idx = this.addressToIndex(cell);\n delete this._sheet.cells[idx];\n });\n }\n\n cut(range: CellRange) {\n this._graph.hf.cut(toModelRange(this._sheetId, range));\n this._iterRange(range, (cell) => {\n const idx = this.addressToIndex(cell);\n delete this._sheet.cells[idx];\n });\n }\n\n copy(range: CellRange) {\n this._graph.hf.copy(toModelRange(this._sheetId, range));\n }\n\n paste(cell: CellAddress) {\n if (!this._graph.hf.isClipboardEmpty()) {\n const changes = this._graph.hf.paste(toSimpleCellAddress(this._sheetId, cell));\n for (const change of changes) {\n if (change instanceof ExportedCellChange) {\n const { address, newValue } = change;\n const idx = this.addressToIndex({ row: address.row, column: address.col });\n this._sheet.cells[idx] = { value: newValue };\n }\n }\n }\n }\n\n // TODO(burdon): Display undo/redo state.\n undo() {\n if (this._graph.hf.isThereSomethingToUndo()) {\n this._graph.hf.undo();\n this.update.emit();\n }\n }\n\n redo() {\n if (this._graph.hf.isThereSomethingToRedo()) {\n this._graph.hf.redo();\n this.update.emit();\n }\n }\n\n /**\n * Get value from sheet.\n */\n getCellValue(cell: CellAddress): CellScalarValue {\n const idx = this.addressToIndex(cell);\n return this._sheet.cells[idx]?.value ?? null;\n }\n\n /**\n * Get value as a string for editing.\n */\n getCellText(cell: CellAddress): string | undefined {\n const value = this.getCellValue(cell);\n if (value == null) {\n return undefined;\n }\n\n if (typeof value === 'string' && value.charAt(0) === '=') {\n return this.mapFormulaIndicesToRefs(value);\n } else {\n return String(value);\n }\n }\n\n /**\n * Get array of raw values from sheet.\n */\n getCellValues(range: CellRange): CellScalarValue[][] {\n return this._iterRange(range, (cell) => this.getCellValue(cell));\n }\n\n /**\n * Gets the regular or computed value from the engine.\n */\n getValue(cell: CellAddress): CellScalarValue {\n // Applies rounding and post-processing.\n const value = this._graph.hf.getCellValue(toSimpleCellAddress(this._sheetId, cell));\n if (value instanceof DetailedCellError) {\n return value.toString();\n }\n\n return value;\n }\n\n /**\n * Get value type.\n */\n getValueType(cell: CellAddress): ValueTypeEnum {\n const addr = toSimpleCellAddress(this._sheetId, cell);\n const type = this._graph.hf.getCellValueDetailedType(addr);\n return typeMap[type];\n }\n\n /**\n * Sets the value, updating the sheet and engine.\n */\n setValue(cell: CellAddress, value: CellScalarValue) {\n if (this._options.readonly) {\n throw new ReadonlyException();\n }\n\n // Reallocate if > current bounds.\n let refresh = false;\n if (cell.row >= this._sheet.rows.length) {\n this._insertIndices(this._sheet.rows, cell.row, 1, DEFAULT_ROWS);\n refresh = true;\n }\n if (cell.column >= this._sheet.columns.length) {\n this._insertIndices(this._sheet.columns, cell.column, 1, DEFAULT_COLUMNS);\n refresh = true;\n }\n if (refresh) {\n // TODO(burdon): Remove.\n this.reset();\n }\n\n // Insert into engine.\n this._graph.hf.setCellContents({ sheet: this._sheetId, row: cell.row, col: cell.column }, [[value]]);\n\n // Insert into sheet.\n const idx = this.addressToIndex(cell);\n if (value === undefined || value === null) {\n delete this._sheet.cells[idx];\n } else {\n if (typeof value === 'string' && value.charAt(0) === '=') {\n value = this.mapFormulaRefsToIndices(value);\n }\n\n this._sheet.cells[idx] = { value };\n }\n }\n\n /**\n * Sets values from a simple map.\n */\n setValues(values: Record<string, CellValue>) {\n Object.entries(values).forEach(([key, { value }]) => {\n this.setValue(addressFromA1Notation(key), value);\n });\n }\n\n /**\n * Iterate range.\n */\n private _iterRange(range: CellRange, cb: (cell: CellAddress) => CellScalarValue | void): CellScalarValue[][] {\n const to = range.to ?? range.from;\n const rowRange = [Math.min(range.from.row, to.row), Math.max(range.from.row, to.row)];\n const columnRange = [Math.min(range.from.column, to.column), Math.max(range.from.column, to.column)];\n const rows: CellScalarValue[][] = [];\n for (let row = rowRange[0]; row <= rowRange[1]; row++) {\n const rowCells: CellScalarValue[] = [];\n for (let column = columnRange[0]; column <= columnRange[1]; column++) {\n const value = cb({ row, column });\n if (value !== undefined) {\n rowCells.push(value);\n }\n }\n rows.push(rowCells);\n }\n\n return rows;\n }\n\n /**\n *\n */\n // TODO(burdon): Insert indices into sheet.\n private _insertIndices(indices: string[], i: number, n: number, max: number) {\n if (i + n > max) {\n throw new RangeException(i + n);\n }\n\n const idx = createIndices(n);\n indices.splice(i, 0, ...idx);\n }\n\n // TODO(burdon): Delete index.\n private _deleteIndices(indices: string[], i: number, n: number) {\n throw new Error('Not implemented');\n }\n\n // TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?\n private _moveIndices(indices: string[], i: number, j: number, n: number) {\n throw new Error('Not implemented');\n }\n\n //\n // Indices.\n //\n\n /**\n * E.g., \"A1\" => \"x1@y1\".\n */\n addressToIndex(cell: CellAddress): CellIndex {\n return `${this._sheet.columns[cell.column]}@${this._sheet.rows[cell.row]}`;\n }\n\n /**\n * E.g., \"x1@y1\" => \"A1\".\n */\n addressFromIndex(idx: CellIndex): CellAddress {\n const [column, row] = idx.split('@');\n return {\n column: this._sheet.columns.indexOf(column),\n row: this._sheet.rows.indexOf(row),\n };\n }\n\n /**\n * E.g., \"A1:B2\" => \"x1@y1:x2@y2\".\n */\n rangeToIndex(range: CellRange): string {\n return [range.from, range.to ?? range.from].map((cell) => this.addressToIndex(cell)).join(':');\n }\n\n /**\n * E.g., \"x1@y1:x2@y2\" => \"A1:B2\".\n */\n rangeFromIndex(idx: string): CellRange {\n const [from, to] = idx.split(':').map((idx) => this.addressFromIndex(idx));\n return { from, to };\n }\n\n /**\n * Map from A1 notation to indices.\n */\n mapFormulaRefsToIndices(formula: string): string {\n invariant(formula.charAt(0) === '=');\n return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {\n return this.addressToIndex(addressFromA1Notation(match));\n });\n }\n\n /**\n * Map from indices to A1 notation.\n */\n mapFormulaIndicesToRefs(formula: string): string {\n invariant(formula.charAt(0) === '=');\n return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {\n return addressToA1Notation(this.addressFromIndex(idx));\n });\n }\n\n //\n // Values\n //\n\n /**\n * https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example\n * https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate\n * NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().\n */\n toLocalDate(num: number): Date {\n const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);\n return new Date(year, month - 1, day, hours, minutes, seconds);\n }\n\n toDateTime(num: number): SimpleDateTime {\n return this._graph.hf.numberToDateTime(num) as SimpleDateTime;\n }\n\n toDate(num: number): SimpleDate {\n return this._graph.hf.numberToDate(num) as SimpleDate;\n }\n\n toTime(num: number): SimpleDate {\n return this._graph.hf.numberToTime(num) as SimpleDate;\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { randomBytes } from '@dxos/crypto';\n\n// TODO(burdon): Factor out from dxos/protocols to new common package.\nexport class ApiError extends Error {}\nexport class ReadonlyException extends ApiError {}\nexport class RangeException extends ApiError {\n constructor(n: number) {\n super();\n }\n}\n\n/**\n * With a string length of 8, the chance of a collision is 0.02% for a sheet with 10,000 strings.\n */\nexport const createIndex = (length = 8): string => {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charactersLength = characters.length;\n const randomBuffer = randomBytes(length);\n return Array.from(randomBuffer, (byte) => characters[byte % charactersLength]).join('');\n};\n\nexport const createIndices = (length: number): string[] => Array.from({ length }).map(() => createIndex());\n\n// TODO(burdon): Factor out.\nexport const pickOne = <T>(values: T[]): T => values[Math.floor(Math.random() * values.length)];\nexport const pickSome = <T>(values: T[], n = 1): T[] => {\n const result = new Set<T>();\n while (result.size < n) {\n result.add(pickOne(values));\n }\n return Array.from(result.values());\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAA6B;AAE7B,mBAAsB;AAEtB,kBAA0B;AAC1B,iBAAoB;ACLpB,IAAAA,uBAAoF;AAKpF,IAAAC,gBAAyB;AAEzB,IAAAC,cAAoB;ACPpB,IAAAF,uBAAqC;AAIrC,kBAAwB;ACJxB,IAAAA,uBAA2D;AAI3D,kBAAgC;AAChC,kBAA6C;AAC7C,mBAA2B;AC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,QAAQ,kCAAkC,CAACmM,QAAAA;AACxD,aAAO5G,oBAAoB,KAAKgG,iBAAiBY,GAAAA,CAAAA;IACnD,CAAA;EACF;;;;;;;;;EAWAyC,YAAYC,KAAmB;AAC7B,UAAM,EAAEC,MAAMC,OAAOC,KAAKC,OAAOC,SAASC,QAAO,IAAK,KAAKC,WAAWP,GAAAA;AACtE,WAAO,IAAItQ,KAAKuQ,MAAMC,QAAQ,GAAGC,KAAKC,OAAOC,SAASC,OAAAA;EACxD;EAEAC,WAAWP,KAA6B;AACtC,WAAO,KAAKjF,OAAOzG,GAAGkM,iBAAiBR,GAAAA;EACzC;EAEAS,OAAOT,KAAyB;AAC9B,WAAO,KAAKjF,OAAOzG,GAAGoM,aAAaV,GAAAA;EACrC;EAEAW,OAAOX,KAAyB;AAC9B,WAAO,KAAKjF,OAAOzG,GAAGsM,aAAaZ,GAAAA;EACrC;AACF;",
6
+ "names": ["import_hyperformula", "import_async", "import_log", "import_invariant", "import_keys", "defaultFunctionContextOptions", "defaultTtl", "recalculationDelay", "FunctionContext", "createInvocationKey", "name", "args", "JSON", "stringify", "constructor", "_hf", "_space", "onUpdate", "_options", "_cache", "Map", "_pending", "_invocations", "_onUpdate", "debounce", "resumeEvaluation", "space", "info", "cache", "size", "invocations", "flush", "clear", "invokeFunction", "state", "cb", "options", "ttl", "formulaAddress", "cell", "invocationKey", "value", "undefined", "ts", "get", "now", "Date", "delta", "has", "set", "setTimeout", "log", "err", "warn", "CellError", "ErrorType", "ERROR", "delete", "FunctionPluginAsync", "FunctionPlugin", "context", "config", "runAsyncFunction", "ast", "procedureName", "metadata", "runFunction", "EmptyValue", "parseNumberString", "str", "parseFloat", "replace", "CustomPlugin", "test", "handler", "Math", "random", "crypto", "_currency", "currency", "toUpperCase", "result", "fetch", "data", "json", "rate", "getDeep", "NaN", "implementedFunctions", "TEST", "method", "parameters", "isVolatile", "CRYPTO", "argumentType", "FunctionArgumentType", "STRING", "optionalArg", "CustomPluginTranslations", "enGB", "enUS", "EdgeFunctionPlugin", "edge", "binding", "VALUE", "objects", "script", "db", "query", "Filter", "schema", "ScriptType", "run", "path", "getUserFunctionUrlInMetadata", "getMeta", "text", "EDGE", "EdgeFunctionPluginTranslations", "createComputeGraph", "HyperFormula", "registerFunctionPlugin", "hf", "buildEmpty", "licenseKey", "ComputeGraph", "id", "PublicKey", "truncate", "update", "Event", "refresh", "updateConfig", "emit", "ComputeGraphContext", "createContext", "graphs", "setGraph", "ComputeGraphContextProvider", "children", "React", "Provider", "useComputeGraph", "useContext", "graph", "useEffect", "MAX_COLUMNS", "posEquals", "a", "b", "column", "row", "columnLetter", "invariant", "String", "fromCharCode", "charCodeAt", "floor", "addressToA1Notation", "addressFromA1Notation", "ref", "match", "parseInt", "split", "reduce", "acc", "c", "rangeToA1Notation", "range", "from", "to", "filter", "Boolean", "join", "inRange", "c1", "r1", "c2", "r2", "cMin", "min", "cMax", "max", "rMin", "rMax", "ApiError", "Error", "ReadonlyException", "RangeException", "n", "createIndex", "length", "characters", "charactersLength", "randomBuffer", "randomBytes", "Array", "byte", "createIndices", "map", "DEFAULT_ROWS", "DEFAULT_COLUMNS", "typeMap", "BOOLEAN", "ValueTypeEnum", "NUMBER_RAW", "Number", "NUMBER_PERCENT", "Percent", "NUMBER_CURRENCY", "Currency", "NUMBER_DATETIME", "DateTime", "NUMBER_DATE", "NUMBER_TIME", "Time", "defaultOptions", "rows", "columns", "getTopLeft", "toSimpleCellAddress", "sheet", "col", "toModelRange", "start", "end", "SheetModel", "_graph", "_sheet", "_ctx", "doesSheetExist", "addSheet", "_sheetId", "getSheetId", "reset", "readonly", "bounds", "functions", "getRegisteredFunctionNames", "initialized", "initialize", "Context", "_insertIndices", "unsubscribe", "on", "onDispose", "destroy", "dispose", "clearSheet", "Object", "entries", "cells", "forEach", "key", "addressFromIndex", "charAt", "mapFormulaIndicesToRefs", "setCellContents", "recalculate", "rebuildAndRecalculate", "insertRows", "i", "insertColumns", "topLeft", "values", "_iterRange", "idx", "addressToIndex", "cut", "copy", "paste", "isClipboardEmpty", "changes", "change", "ExportedCellChange", "address", "newValue", "undo", "isThereSomethingToUndo", "redo", "isThereSomethingToRedo", "getCellValue", "getCellText", "getCellValues", "getValue", "DetailedCellError", "toString", "getValueType", "addr", "type", "getCellValueDetailedType", "setValue", "mapFormulaRefsToIndices", "setValues", "rowRange", "columnRange", "rowCells", "push", "indices", "splice", "_deleteIndices", "_moveIndices", "j", "indexOf", "rangeToIndex", "rangeFromIndex", "formula", "toLocalDate", "num", "year", "month", "day", "hours", "minutes", "seconds", "toDateTime", "numberToDateTime", "toDate", "numberToDate", "toTime", "numberToTime"]
7
+ }
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var node_exports = {};
30
+ __export(node_exports, {
31
+ SheetPlugin: () => SheetPlugin,
32
+ default: () => src_default
33
+ });
34
+ module.exports = __toCommonJS(node_exports);
35
+ var import_chunk_FCKJ4QRM = require("./chunk-FCKJ4QRM.cjs");
36
+ var import_chunk_4CE6FK5Z = require("./chunk-4CE6FK5Z.cjs");
37
+ var import_chunk_BJ6ZD7MN = require("./chunk-BJ6ZD7MN.cjs");
38
+ var import_react = require("@phosphor-icons/react");
39
+ var import_react2 = __toESM(require("react"));
40
+ var import_app_framework = require("@dxos/app-framework");
41
+ var import_echo_schema = require("@dxos/echo-schema");
42
+ var import_plugin_client = require("@dxos/plugin-client");
43
+ var import_plugin_graph = require("@dxos/plugin-graph");
44
+ var import_plugin_space = require("@dxos/plugin-space");
45
+ var import_echo = require("@dxos/react-client/echo");
46
+ var import_react3 = __toESM(require("react"));
47
+ var SheetContainer = import_react3.default.lazy(() => import("./SheetContainer-S32KTNZ6.cjs"));
48
+ var translations_default = [
49
+ {
50
+ "en-US": {
51
+ [import_chunk_BJ6ZD7MN.SHEET_PLUGIN]: {
52
+ "plugin name": "Sheets",
53
+ "sheet title placeholder": "New sheet",
54
+ "create sheet label": "Create sheet",
55
+ "create sheet section label": "Create sheet",
56
+ "cell placeholder": "Cell value...",
57
+ "toolbar left label": "Align left",
58
+ "toolbar left center": "Align center",
59
+ "toolbar left right": "Align right"
60
+ }
61
+ }
62
+ }
63
+ ];
64
+ var SheetPlugin = () => {
65
+ const graphs = (0, import_echo_schema.create)({});
66
+ const setGraph = (key, graph) => {
67
+ graphs[key] = graph;
68
+ };
69
+ return {
70
+ meta: import_chunk_BJ6ZD7MN.meta_default,
71
+ provides: {
72
+ context: ({ children }) => {
73
+ return /* @__PURE__ */ import_react2.default.createElement(import_chunk_FCKJ4QRM.ComputeGraphContextProvider, {
74
+ graphs,
75
+ setGraph
76
+ }, children);
77
+ },
78
+ metadata: {
79
+ records: {
80
+ [import_chunk_4CE6FK5Z.SheetType.typename]: {
81
+ placeholder: [
82
+ "sheet title placeholder",
83
+ {
84
+ ns: import_chunk_BJ6ZD7MN.SHEET_PLUGIN
85
+ }
86
+ ],
87
+ icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.GridNine, props),
88
+ iconSymbol: "ph--grid-nine--regular"
89
+ }
90
+ }
91
+ },
92
+ translations: translations_default,
93
+ echo: {
94
+ schema: [
95
+ import_chunk_4CE6FK5Z.SheetType
96
+ ]
97
+ },
98
+ graph: {
99
+ builder: (plugins) => {
100
+ const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
101
+ const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
102
+ if (!client || !dispatch) {
103
+ return [];
104
+ }
105
+ return (0, import_plugin_graph.createExtension)({
106
+ id: import_chunk_4CE6FK5Z.SheetAction.CREATE,
107
+ filter: (node) => (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
108
+ actions: ({ node }) => {
109
+ const id = node.id.split("/").at(-1);
110
+ const [spaceId, objectId] = id?.split(":") ?? [];
111
+ const space = client.spaces.get().find((space2) => space2.id === spaceId);
112
+ const object = objectId && space?.db.getObjectById(objectId);
113
+ const target = objectId ? object : space;
114
+ if (!target) {
115
+ return;
116
+ }
117
+ return [
118
+ {
119
+ id: `${import_chunk_BJ6ZD7MN.SHEET_PLUGIN}/create/${node.id}`,
120
+ data: async () => {
121
+ await dispatch([
122
+ {
123
+ plugin: import_chunk_BJ6ZD7MN.SHEET_PLUGIN,
124
+ action: import_chunk_4CE6FK5Z.SheetAction.CREATE,
125
+ data: {
126
+ space
127
+ }
128
+ },
129
+ {
130
+ action: import_plugin_space.SpaceAction.ADD_OBJECT,
131
+ data: {
132
+ target
133
+ }
134
+ },
135
+ {
136
+ action: import_app_framework.NavigationAction.OPEN
137
+ }
138
+ ]);
139
+ },
140
+ properties: {
141
+ label: [
142
+ "create sheet label",
143
+ {
144
+ ns: import_chunk_BJ6ZD7MN.SHEET_PLUGIN
145
+ }
146
+ ],
147
+ icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.GridNine, props),
148
+ iconSymbol: "ph--grid-nine--regular",
149
+ testId: "sheetPlugin.createObject"
150
+ }
151
+ }
152
+ ];
153
+ }
154
+ });
155
+ }
156
+ },
157
+ stack: {
158
+ creators: [
159
+ {
160
+ id: "create-stack-section-sheet",
161
+ testId: "sheetPlugin.createSectionSpaceSheet",
162
+ type: [
163
+ "plugin name",
164
+ {
165
+ ns: import_chunk_BJ6ZD7MN.SHEET_PLUGIN
166
+ }
167
+ ],
168
+ label: [
169
+ "create sheet section label",
170
+ {
171
+ ns: import_chunk_BJ6ZD7MN.SHEET_PLUGIN
172
+ }
173
+ ],
174
+ icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.GridNine, props),
175
+ intent: [
176
+ {
177
+ plugin: import_chunk_BJ6ZD7MN.SHEET_PLUGIN,
178
+ action: import_chunk_4CE6FK5Z.SheetAction.CREATE
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ },
184
+ surface: {
185
+ component: ({ data, role = "never" }) => {
186
+ if (![
187
+ "article",
188
+ "section"
189
+ ].includes(role) || !(0, import_echo.isEchoObject)(data.object)) {
190
+ return null;
191
+ }
192
+ const space = (0, import_echo.getSpace)(data.object);
193
+ return space && data.object instanceof import_chunk_4CE6FK5Z.SheetType ? /* @__PURE__ */ import_react2.default.createElement(SheetContainer, {
194
+ sheet: data.object,
195
+ space,
196
+ role,
197
+ coordinate: data.coordinate
198
+ }) : null;
199
+ }
200
+ },
201
+ intent: {
202
+ resolver: async (intent) => {
203
+ switch (intent.action) {
204
+ case import_chunk_4CE6FK5Z.SheetAction.CREATE: {
205
+ const space = intent.data?.space;
206
+ const sheet = (0, import_chunk_4CE6FK5Z.createSheet)();
207
+ const graph = graphs[space.id] ?? (0, import_chunk_FCKJ4QRM.createComputeGraph)(space);
208
+ const model = new import_chunk_FCKJ4QRM.SheetModel(graph, sheet);
209
+ await model.initialize();
210
+ await model.destroy();
211
+ return {
212
+ data: sheet
213
+ };
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ };
220
+ };
221
+ var src_default = SheetPlugin;
222
+ // Annotate the CommonJS export names for ESM import in node:
223
+ 0 && (module.exports = {
224
+ SheetPlugin
225
+ });
226
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/SheetPlugin.tsx", "../../../src/components/index.ts", "../../../src/translations.ts", "../../../src/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type IconProps, GridNine } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport {\n NavigationAction,\n parseIntentPlugin,\n resolvePlugin,\n type PluginDefinition,\n type LayoutCoordinate,\n} from '@dxos/app-framework';\nimport { create } from '@dxos/echo-schema';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';\nimport { SpaceAction } from '@dxos/plugin-space';\nimport { getSpace, isEchoObject } from '@dxos/react-client/echo';\n\nimport { ComputeGraphContextProvider, createComputeGraph, SheetContainer, type ComputeGraph } from './components';\nimport meta, { SHEET_PLUGIN } from './meta';\nimport { SheetModel } from './model';\nimport translations from './translations';\nimport { createSheet, SheetAction, type SheetPluginProvides, SheetType } from './types';\n\nexport const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {\n const graphs = create<Record<string, ComputeGraph>>({});\n const setGraph = (key: string, graph: ComputeGraph) => {\n graphs[key] = graph;\n };\n\n return {\n meta,\n provides: {\n context: ({ children }) => {\n return (\n <ComputeGraphContextProvider graphs={graphs} setGraph={setGraph}>\n {children}\n </ComputeGraphContextProvider>\n );\n },\n metadata: {\n records: {\n [SheetType.typename]: {\n placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],\n icon: (props: IconProps) => <GridNine {...props} />,\n iconSymbol: 'ph--grid-nine--regular',\n },\n },\n },\n translations,\n echo: {\n schema: [SheetType],\n },\n graph: {\n builder: (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;\n if (!client || !dispatch) {\n return [];\n }\n\n return createExtension({\n id: SheetAction.CREATE,\n filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),\n actions: ({ node }) => {\n const id = node.id.split('/').at(-1);\n const [spaceId, objectId] = id?.split(':') ?? [];\n const space = client.spaces.get().find((space) => space.id === spaceId);\n const object = objectId && space?.db.getObjectById(objectId);\n const target = objectId ? object : space;\n if (!target) {\n return;\n }\n\n return [\n {\n id: `${SHEET_PLUGIN}/create/${node.id}`,\n data: async () => {\n await dispatch([\n { plugin: SHEET_PLUGIN, action: SheetAction.CREATE, data: { space } },\n { action: SpaceAction.ADD_OBJECT, data: { target } },\n { action: NavigationAction.OPEN },\n ]);\n },\n properties: {\n label: ['create sheet label', { ns: SHEET_PLUGIN }],\n icon: (props: IconProps) => <GridNine {...props} />,\n iconSymbol: 'ph--grid-nine--regular',\n testId: 'sheetPlugin.createObject',\n },\n },\n ];\n },\n });\n },\n },\n stack: {\n creators: [\n {\n id: 'create-stack-section-sheet',\n testId: 'sheetPlugin.createSectionSpaceSheet',\n type: ['plugin name', { ns: SHEET_PLUGIN }],\n label: ['create sheet section label', { ns: SHEET_PLUGIN }],\n icon: (props: any) => <GridNine {...props} />,\n intent: [\n {\n plugin: SHEET_PLUGIN,\n action: SheetAction.CREATE,\n },\n ],\n },\n ],\n },\n surface: {\n component: ({ data, role = 'never' }) => {\n if (!['article', 'section'].includes(role) || !isEchoObject(data.object)) {\n return null;\n }\n\n const space = getSpace(data.object);\n return space && data.object instanceof SheetType ? (\n <SheetContainer\n sheet={data.object}\n space={space}\n role={role}\n coordinate={data.coordinate as LayoutCoordinate}\n />\n ) : null;\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case SheetAction.CREATE: {\n const space = intent.data?.space;\n const sheet = createSheet();\n const graph = graphs[space.id] ?? createComputeGraph(space);\n const model = new SheetModel(graph, sheet);\n await model.initialize();\n await model.destroy();\n return { data: sheet };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nexport * from './ComputeGraph';\n\n// Lazily load components for content surfaces.\nexport const SheetContainer = React.lazy(() => import('./SheetContainer'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SHEET_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [SHEET_PLUGIN]: {\n 'plugin name': 'Sheets',\n 'sheet title placeholder': 'New sheet',\n 'create sheet label': 'Create sheet',\n 'create sheet section label': 'Create sheet',\n 'cell placeholder': 'Cell value...',\n 'toolbar left label': 'Align left',\n 'toolbar left center': 'Align center',\n 'toolbar left right': 'Align right',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SheetPlugin } from './SheetPlugin';\n\nexport default SheetPlugin;\n\nexport * from './SheetPlugin';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAyC;AACzC,IAAAA,gBAAkB;AAElB,2BAMO;AACP,yBAAuB;AACvB,2BAAkC;AAClC,0BAAiE;AACjE,0BAA4B;AAC5B,kBAAuC;ACdvC,IAAAA,gBAAkB;AAKX,IAAMC,iBAAiBC,cAAAA,QAAMC,KAAK,MAAM,OAAO,+BAAA,CAAA;ACHtD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,kCAAAA,GAAe;QACd,eAAe;QACf,2BAA2B;QAC3B,sBAAsB;QACtB,8BAA8B;QAC9B,oBAAoB;QACpB,sBAAsB;QACtB,uBAAuB;QACvB,sBAAsB;MACxB;IACF;EACF;;AFMK,IAAMC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OjB,KAAKJ;YACZJ;YACAqB;YACAK,YAAYlB,KAAKkB;eAEjB;QACN;MACF;MACA1C,QAAQ;QACN2C,UAAU,OAAO3C,WAAAA;AACf,kBAAQA,OAAO0B,QAAM;YACnB,KAAKvB,kCAAYC,QAAQ;AACvB,oBAAMY,QAAQhB,OAAOwB,MAAMR;AAC3B,oBAAMyB,YAAQG,mCAAAA;AACd,oBAAMtE,QAAQJ,OAAO8C,MAAMd,EAAE,SAAK2C,0CAAmB7B,KAAAA;AACrD,oBAAM8B,QAAQ,IAAIC,iCAAWzE,OAAOmE,KAAAA;AACpC,oBAAMK,MAAME,WAAU;AACtB,oBAAMF,MAAMG,QAAO;AACnB,qBAAO;gBAAEzB,MAAMiB;cAAM;YACvB;UACF;QACF;MACF;IACF;EACF;AACF;AG/IA,IAAA,cAAexE;",
6
+ "names": ["import_react", "SheetContainer", "React", "lazy", "SHEET_PLUGIN", "SheetPlugin", "graphs", "create", "setGraph", "key", "graph", "meta", "provides", "context", "children", "ComputeGraphContextProvider", "metadata", "records", "SheetType", "typename", "placeholder", "ns", "icon", "props", "GridNine", "iconSymbol", "translations", "echo", "schema", "builder", "plugins", "client", "resolvePlugin", "parseClientPlugin", "dispatch", "parseIntentPlugin", "intent", "createExtension", "id", "SheetAction", "CREATE", "filter", "node", "isActionGroup", "startsWith", "SpaceAction", "ADD_OBJECT", "actions", "split", "at", "spaceId", "objectId", "space", "spaces", "get", "find", "object", "db", "getObjectById", "target", "data", "plugin", "action", "NavigationAction", "OPEN", "properties", "label", "testId", "stack", "creators", "type", "surface", "component", "role", "includes", "isEchoObject", "getSpace", "sheet", "coordinate", "resolver", "createSheet", "createComputeGraph", "model", "SheetModel", "initialize", "destroy"]
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var meta_exports = {};
20
+ __export(meta_exports, {
21
+ SHEET_PLUGIN: () => import_chunk_BJ6ZD7MN.SHEET_PLUGIN,
22
+ default: () => import_chunk_BJ6ZD7MN.meta_default
23
+ });
24
+ module.exports = __toCommonJS(meta_exports);
25
+ var import_chunk_BJ6ZD7MN = require("./chunk-BJ6ZD7MN.cjs");
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ SHEET_PLUGIN
29
+ });
30
+ //# sourceMappingURL=meta.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["meta.cjs"],
4
+ "sourcesContent": ["import {\n SHEET_PLUGIN,\n meta_default\n} from \"./chunk-BJ6ZD7MN.cjs\";\nexport {\n SHEET_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/plugins/plugin-sheet/src/components/ComputeGraph/async-function.ts":{"bytes":15885,"imports":[{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/ComputeGraph/custom.ts":{"bytes":6745,"imports":[{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/async-function.ts","kind":"import-statement","original":"./async-function"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/ComputeGraph/edge-function.ts":{"bytes":6826,"imports":[{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/plugin-script/edge","kind":"import-statement","external":true},{"path":"@dxos/plugin-script/types","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/async-function.ts","kind":"import-statement","original":"./async-function"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph.ts":{"bytes":5833,"imports":[{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/async-function.ts","kind":"import-statement","original":"./async-function"},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/custom.ts","kind":"import-statement","original":"./custom"},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/edge-function.ts","kind":"import-statement","original":"./edge-function"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph-context.tsx":{"bytes":3755,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph.ts","kind":"import-statement","original":"./graph"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/ComputeGraph/index.ts":{"bytes":705,"imports":[{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/custom.ts","kind":"import-statement","original":"./custom"},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph-context.tsx","kind":"import-statement","original":"./graph-context"}],"format":"esm"},"packages/plugins/plugin-sheet/src/model/types.ts":{"bytes":8465,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-sheet/src/model/util.ts":{"bytes":4597,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-sheet/src/meta.tsx":{"bytes":1868,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-sheet/src/types.ts":{"bytes":10263,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/meta.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-sheet/src/model/model.ts":{"bytes":49767,"imports":[{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/model/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/plugin-sheet/src/model/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/plugins/plugin-sheet/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-sheet/src/model/index.ts":{"bytes":581,"imports":[{"path":"packages/plugins/plugin-sheet/src/model/model.ts","kind":"import-statement","original":"./model"},{"path":"packages/plugins/plugin-sheet/src/model/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/grid.ts":{"bytes":17316,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"../../model"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/nav.ts":{"bytes":15441,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/grid.ts","kind":"import-statement","original":"./grid"},{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"../../model"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/formatting.ts":{"bytes":12660,"imports":[{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"../../model"},{"path":"packages/plugins/plugin-sheet/src/types.ts","kind":"import-statement","original":"../../types"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/sheet-context.tsx":{"bytes":7818,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/formatting.ts","kind":"import-statement","original":"./formatting"},{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"../../model"},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/index.ts","kind":"import-statement","original":"../ComputeGraph"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/util.ts":{"bytes":7372,"imports":[],"format":"esm"},"packages/plugins/plugin-sheet/src/components/CellEditor/CellEditor.tsx":{"bytes":10459,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/CellEditor/functions.ts":{"bytes":186103,"imports":[],"format":"esm"},"packages/plugins/plugin-sheet/src/components/CellEditor/extension.ts":{"bytes":27343,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"codemirror-lang-spreadsheet","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/CellEditor/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/CellEditor/index.ts":{"bytes":618,"imports":[{"path":"packages/plugins/plugin-sheet/src/components/CellEditor/CellEditor.tsx","kind":"import-statement","original":"./CellEditor"},{"path":"packages/plugins/plugin-sheet/src/components/CellEditor/extension.ts","kind":"import-statement","original":"./extension"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/Sheet.tsx":{"bytes":119445,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"re-resizable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/grid.ts","kind":"import-statement","original":"./grid"},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/nav.ts","kind":"import-statement","original":"./nav"},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/sheet-context.tsx","kind":"import-statement","original":"./sheet-context"},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"../../model"},{"path":"packages/plugins/plugin-sheet/src/components/CellEditor/index.ts","kind":"import-statement","original":"../CellEditor"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/Sheet/index.ts":{"bytes":511,"imports":[{"path":"packages/plugins/plugin-sheet/src/components/Sheet/Sheet.tsx","kind":"import-statement","original":"./Sheet"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/SheetContainer.tsx":{"bytes":3149,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/Sheet/index.ts","kind":"import-statement","original":"./Sheet"}],"format":"esm"},"packages/plugins/plugin-sheet/src/components/index.ts":{"bytes":1061,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/ComputeGraph/index.ts","kind":"import-statement","original":"./ComputeGraph"},{"path":"packages/plugins/plugin-sheet/src/components/SheetContainer.tsx","kind":"dynamic-import","original":"./SheetContainer"}],"format":"esm"},"packages/plugins/plugin-sheet/src/translations.ts":{"bytes":1989,"imports":[{"path":"packages/plugins/plugin-sheet/src/meta.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-sheet/src/SheetPlugin.tsx":{"bytes":20577,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-sheet/src/meta.tsx","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-sheet/src/model/index.ts","kind":"import-statement","original":"./model"},{"path":"packages/plugins/plugin-sheet/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-sheet/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-sheet/src/index.ts":{"bytes":769,"imports":[{"path":"packages/plugins/plugin-sheet/src/SheetPlugin.tsx","kind":"import-statement","original":"./SheetPlugin"},{"path":"packages/plugins/plugin-sheet/src/SheetPlugin.tsx","kind":"import-statement","original":"./SheetPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-sheet/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10651},"packages/plugins/plugin-sheet/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-FCKJ4QRM.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-sheet/dist/lib/node/SheetContainer-S32KTNZ6.cjs","kind":"dynamic-import"}],"exports":["SheetPlugin","default"],"entryPoint":"packages/plugins/plugin-sheet/src/index.ts","inputs":{"packages/plugins/plugin-sheet/src/SheetPlugin.tsx":{"bytesInOutput":5284},"packages/plugins/plugin-sheet/src/components/index.ts":{"bytesInOutput":107},"packages/plugins/plugin-sheet/src/translations.ts":{"bytesInOutput":454},"packages/plugins/plugin-sheet/src/index.ts":{"bytesInOutput":31}},"bytes":6489},"packages/plugins/plugin-sheet/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-sheet/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs","kind":"import-statement"}],"exports":["SHEET_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-sheet/src/meta.tsx","inputs":{},"bytes":159},"packages/plugins/plugin-sheet/dist/lib/node/types.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-sheet/dist/lib/node/types.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs","kind":"import-statement"}],"exports":["CellValue","Formatting","RowColumnMeta","SheetAction","SheetType","ValueType","ValueTypeEnum","createSheet"],"entryPoint":"packages/plugins/plugin-sheet/src/types.ts","inputs":{},"bytes":350},"packages/plugins/plugin-sheet/dist/lib/node/SheetContainer-S32KTNZ6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":193181},"packages/plugins/plugin-sheet/dist/lib/node/SheetContainer-S32KTNZ6.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-FCKJ4QRM.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"re-resizable","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"codemirror-lang-spreadsheet","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-sheet/src/components/SheetContainer.tsx","inputs":{"packages/plugins/plugin-sheet/src/components/SheetContainer.tsx":{"bytesInOutput":724},"packages/plugins/plugin-sheet/src/components/Sheet/Sheet.tsx":{"bytesInOutput":29137},"packages/plugins/plugin-sheet/src/components/Sheet/grid.ts":{"bytesInOutput":3517},"packages/plugins/plugin-sheet/src/components/Sheet/nav.ts":{"bytesInOutput":3414},"packages/plugins/plugin-sheet/src/components/Sheet/sheet-context.tsx":{"bytesInOutput":1643},"packages/plugins/plugin-sheet/src/components/Sheet/formatting.ts":{"bytesInOutput":2712},"packages/plugins/plugin-sheet/src/components/Sheet/util.ts":{"bytesInOutput":1375},"packages/plugins/plugin-sheet/src/components/CellEditor/CellEditor.tsx":{"bytesInOutput":2445},"packages/plugins/plugin-sheet/src/components/CellEditor/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-sheet/src/components/CellEditor/extension.ts":{"bytesInOutput":5941},"packages/plugins/plugin-sheet/src/components/CellEditor/functions.ts":{"bytesInOutput":62607},"packages/plugins/plugin-sheet/src/components/Sheet/index.ts":{"bytesInOutput":0}},"bytes":114847},"packages/plugins/plugin-sheet/dist/lib/node/chunk-FCKJ4QRM.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":49438},"packages/plugins/plugin-sheet/dist/lib/node/chunk-FCKJ4QRM.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs","kind":"import-statement"},{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/plugin-script/edge","kind":"import-statement","external":true},{"path":"@dxos/plugin-script/types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"hyperformula","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true}],"exports":["ComputeGraphContextProvider","SheetModel","addressFromA1Notation","addressToA1Notation","columnLetter","createComputeGraph","inRange","posEquals","rangeToA1Notation","useComputeGraph"],"inputs":{"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph.ts":{"bytesInOutput":1133},"packages/plugins/plugin-sheet/src/components/ComputeGraph/async-function.ts":{"bytesInOutput":3341},"packages/plugins/plugin-sheet/src/components/ComputeGraph/custom.ts":{"bytesInOutput":1354},"packages/plugins/plugin-sheet/src/components/ComputeGraph/edge-function.ts":{"bytesInOutput":1384},"packages/plugins/plugin-sheet/src/components/ComputeGraph/graph-context.tsx":{"bytesInOutput":677},"packages/plugins/plugin-sheet/src/model/types.ts":{"bytesInOutput":1899},"packages/plugins/plugin-sheet/src/model/model.ts":{"bytesInOutput":11771},"packages/plugins/plugin-sheet/src/model/util.ts":{"bytesInOutput":611},"packages/plugins/plugin-sheet/src/model/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-sheet/src/components/ComputeGraph/index.ts":{"bytesInOutput":0}},"bytes":23141},"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5005},"packages/plugins/plugin-sheet/dist/lib/node/chunk-4CE6FK5Z.cjs":{"imports":[{"path":"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs","kind":"import-statement"},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["CellValue","Formatting","RowColumnMeta","SheetAction","SheetType","ValueType","ValueTypeEnum","createSheet"],"inputs":{"packages/plugins/plugin-sheet/src/types.ts":{"bytesInOutput":2484}},"bytes":2759},"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":931},"packages/plugins/plugin-sheet/dist/lib/node/chunk-BJ6ZD7MN.cjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["SHEET_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-sheet/src/meta.tsx":{"bytesInOutput":412}},"bytes":546}}}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var types_exports = {};
20
+ __export(types_exports, {
21
+ CellValue: () => import_chunk_4CE6FK5Z.CellValue,
22
+ Formatting: () => import_chunk_4CE6FK5Z.Formatting,
23
+ RowColumnMeta: () => import_chunk_4CE6FK5Z.RowColumnMeta,
24
+ SheetAction: () => import_chunk_4CE6FK5Z.SheetAction,
25
+ SheetType: () => import_chunk_4CE6FK5Z.SheetType,
26
+ ValueType: () => import_chunk_4CE6FK5Z.ValueType,
27
+ ValueTypeEnum: () => import_chunk_4CE6FK5Z.ValueTypeEnum,
28
+ createSheet: () => import_chunk_4CE6FK5Z.createSheet
29
+ });
30
+ module.exports = __toCommonJS(types_exports);
31
+ var import_chunk_4CE6FK5Z = require("./chunk-4CE6FK5Z.cjs");
32
+ var import_chunk_BJ6ZD7MN = require("./chunk-BJ6ZD7MN.cjs");
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ CellValue,
36
+ Formatting,
37
+ RowColumnMeta,
38
+ SheetAction,
39
+ SheetType,
40
+ ValueType,
41
+ ValueTypeEnum,
42
+ createSheet
43
+ });
44
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["types.cjs"],
4
+ "sourcesContent": ["import {\n CellValue,\n Formatting,\n RowColumnMeta,\n SheetAction,\n SheetType,\n ValueType,\n ValueTypeEnum,\n createSheet\n} from \"./chunk-4CE6FK5Z.cjs\";\nimport \"./chunk-BJ6ZD7MN.cjs\";\nexport {\n CellValue,\n Formatting,\n RowColumnMeta,\n SheetAction,\n SheetType,\n ValueType,\n ValueTypeEnum,\n createSheet\n};\n//# sourceMappingURL=types.cjs.map\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BASO;AACP,4BAAO;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ import { type PluginDefinition } from '@dxos/app-framework';
2
+ import { type SheetPluginProvides } from './types';
3
+ export declare const SheetPlugin: () => PluginDefinition<SheetPluginProvides>;
4
+ //# sourceMappingURL=SheetPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SheetPlugin.d.ts","sourceRoot":"","sources":["../../../src/SheetPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EAA4B,KAAK,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAExF,eAAO,MAAM,WAAW,QAAO,gBAAgB,CAAC,mBAAmB,CA2HlE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ import React, { type DOMAttributes, type KeyboardEvent } from 'react';
3
+ import { type UseTextEditorProps } from '@dxos/react-ui-editor';
4
+ export type EditorKeysProps = {
5
+ onClose: (value: string | undefined) => void;
6
+ onNav?: (value: string | undefined, ev: Pick<KeyboardEvent<HTMLInputElement>, 'key'>) => void;
7
+ };
8
+ export declare const editorKeys: ({ onNav, onClose }: EditorKeysProps) => Extension;
9
+ export type CellEditorProps = {
10
+ value?: string;
11
+ extension?: Extension;
12
+ } & Pick<UseTextEditorProps, 'autoFocus'> & Pick<DOMAttributes<HTMLInputElement>, 'onBlur' | 'onKeyDown'>;
13
+ export declare const CellEditor: ({ value, extension, autoFocus, onBlur }: CellEditorProps) => React.JSX.Element;
14
+ //# sourceMappingURL=CellEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CellEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/CellEditor/CellEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;CAC/F,CAAC;AAEF,eAAO,MAAM,UAAU,uBAAwB,eAAe,KAAG,SAiDhE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,GACvC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC;AAEhE,eAAO,MAAM,UAAU,4CAA6C,eAAe,sBAiClF,CAAC"}