@rivm-loculus-tools/sequence-editor 0.1.7 → 1.0.0

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 (85) hide show
  1. package/dist/_chunks/EngineErrorUtil.js +18 -0
  2. package/dist/_chunks/EngineErrorUtil.js.map +1 -0
  3. package/dist/_chunks/SequenceEditor.js +311 -318
  4. package/dist/_chunks/SequenceEditor.js.map +1 -1
  5. package/dist/_chunks/SequenceEditorEventBusService.js +21 -0
  6. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -0
  7. package/dist/_chunks/SequenceEditorPageDrawer.js +112 -112
  8. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  9. package/dist/_chunks/comlink.js.map +1 -1
  10. package/dist/_chunks/react.js.map +1 -1
  11. package/dist/_chunks/sequenceEditorStore.js +4 -0
  12. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  13. package/dist/assets/{index-Dn92arD_.js → index-B5Du4hQk.js} +2 -2
  14. package/dist/assets/index-B5Du4hQk.js.map +1 -0
  15. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +4 -6
  16. package/dist/classes/services/EditorWorkerService/index.js +112 -2
  17. package/dist/classes/services/EditorWorkerService/index.js.map +1 -0
  18. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -4
  19. package/dist/classes/services/SequenceEditorEventBusService/index.js +1 -16
  20. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +3 -2
  21. package/dist/classes/workers/EngineWorker/index.js +7 -8
  22. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  23. package/dist/components/app/App/App.d.ts +5 -1
  24. package/dist/components/app/App/index.js +7 -16
  25. package/dist/components/app/App/index.js.map +1 -1
  26. package/dist/components/ui/SequenceEditor/index.js +1 -2
  27. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +1 -1
  28. package/dist/components/ui/SequenceEditorPageDrawer/index.js +1 -2
  29. package/dist/components/ui/SequenceEditorPageHeader/index.js +39 -38
  30. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
  31. package/dist/components/ui/SequenceEditorSearchBar/index.js +19 -18
  32. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
  33. package/dist/constants/editor.d.ts +1 -1
  34. package/dist/constants/editor.js.map +1 -1
  35. package/dist/constants/keyboard.js +36 -35
  36. package/dist/constants/keyboard.js.map +1 -1
  37. package/dist/constants/palette.d.ts +1 -1
  38. package/dist/constants/palette.js +138 -138
  39. package/dist/constants/palette.js.map +1 -1
  40. package/dist/models/config.models.d.ts +3 -0
  41. package/dist/models/config.models.js +0 -0
  42. package/dist/models/{model.d.ts → editor.models.d.ts} +8 -1
  43. package/dist/models/{model.js → editor.models.js} +6 -4
  44. package/dist/models/editor.models.js.map +1 -0
  45. package/dist/models/{palette.js → palette.models.js} +2 -2
  46. package/dist/models/palette.models.js.map +1 -0
  47. package/dist/{components/pages → pages}/SequenceEditorMainPage/index.js +25 -23
  48. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -0
  49. package/dist/stores/sequenceEditorStore/index.js +1 -2
  50. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +2 -1
  51. package/dist/utils/EditorUtil/EditorUtil.d.ts +3 -3
  52. package/dist/utils/EditorUtil/index.js +73 -64
  53. package/dist/utils/EditorUtil/index.js.map +1 -1
  54. package/dist/utils/EngineErrorUtil/index.d.ts +1 -0
  55. package/dist/utils/EngineErrorUtil/index.js +1 -0
  56. package/dist/utils/PaletteUtil/PaletteUtil.d.ts +1 -1
  57. package/dist/utils/PaletteUtil/index.js.map +1 -1
  58. package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +4 -0
  59. package/dist/utils/SequenceEditorStandardConfigUtil/index.d.ts +1 -0
  60. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +19 -0
  61. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -0
  62. package/package.json +50 -46
  63. package/dist/_chunks/EditorWorkerService.js +0 -127
  64. package/dist/_chunks/EditorWorkerService.js.map +0 -1
  65. package/dist/assets/index-Dn92arD_.js.map +0 -1
  66. package/dist/classes/services/SequenceEditorEventBusService/index.js.map +0 -1
  67. package/dist/components/pages/EmptyWorkspace.d.ts +0 -3
  68. package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +0 -3
  69. package/dist/components/pages/SequenceEditorErrorPage/index.d.ts +0 -1
  70. package/dist/components/pages/SequenceEditorErrorPage/index.js +0 -12
  71. package/dist/components/pages/SequenceEditorErrorPage/index.js.map +0 -1
  72. package/dist/components/pages/SequenceEditorMainPage/index.js.map +0 -1
  73. package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +0 -5
  74. package/dist/components/ui/SequenceEditorPage/index.d.ts +0 -1
  75. package/dist/components/ui/SequenceEditorPage/index.js +0 -15
  76. package/dist/components/ui/SequenceEditorPage/index.js.map +0 -1
  77. package/dist/models/editor.d.ts +0 -6
  78. package/dist/models/editor.js +0 -8
  79. package/dist/models/editor.js.map +0 -1
  80. package/dist/models/index.d.ts +0 -3
  81. package/dist/models/model.js.map +0 -1
  82. package/dist/models/palette.js.map +0 -1
  83. /package/dist/models/{palette.d.ts → palette.models.d.ts} +0 -0
  84. /package/dist/{components/pages → pages}/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +0 -0
  85. /package/dist/{components/pages → pages}/SequenceEditorMainPage/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["sequenceEditorStore","SequenceEditor","BiotechOutlinedIcon","SequenceEditorMainPage","loadingStatus","useStore","state","setData","rawFasta","onClickLoadDemoData","useCallback","demoFastaText","container","FastaDataEventBusService","err","errorMessage","ErrorUtil","extraFastaDataImportDialogLoaderActions","useMemo","PageCommon","FastaNotLoaded","FastaDataImportDialogLoader","BackdropSpinner","LOADING_STATUS"],"sources":["../../../src/pages/SequenceEditorMainPage/SequenceEditorMainPage.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useStore } from 'zustand';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { FastaDataEventBusService } from '@rivm-loculus-tools/common-frontend/classes/services/FastaDataEventBusService';\nimport { ErrorUtil } from '@rivm-loculus-tools/common-frontend/utils/ErrorUtil';\nimport { UrlUtil } from '@rivm-loculus-tools/common-frontend/utils/UrlUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport { FastaDataImportDialogLoader } from '@rivm-loculus-tools/common-frontend/components/fasta/FastaDataImportDialogLoader';\nimport { BackdropSpinner } from '@gen-epix/ui-core-components/components/BackdropSpinner';\nimport { FastaNotLoaded } from '@rivm-loculus-tools/common-frontend/components/fasta/FastaNotLoaded';\nimport BiotechOutlinedIcon from '@mui/icons-material/BiotechOutlined';\nimport { LOADING_STATUS } from '@rivm-loculus-tools/common-frontend/models/fasta.models';\nimport { PageCommon } from '@rivm-loculus-tools/common-frontend/components/ui/PageCommon';\n\nimport { sequenceEditorStore } from '../../stores/sequenceEditorStore';\nimport { SequenceEditor } from '../../components/ui/SequenceEditor';\n\n\nexport const SequenceEditorMainPage = () => {\n const loadingStatus = useStore(sequenceEditorStore, (state) => state.loadingStatus);\n const setData = useStore(sequenceEditorStore, (state) => state.setData);\n const rawFasta = useStore(sequenceEditorStore, (state) => state.rawFasta);\n\n const onClickLoadDemoData = useCallback(async () => {\n try {\n const fastaRes = await fetch('/sample-data/sarscov2_demo.fasta');\n const demoFastaText = await fastaRes.text();\n\n await setData(demoFastaText);\n container.resolve(FastaDataEventBusService).emit('onCloseImportDialog');\n } catch (err: unknown) {\n container.resolve(FastaDataEventBusService).emit('onCloseImportDialog');\n const errorMessage = `Failed to load demo dataset: ${ErrorUtil.getErrorMessage(err, 'Unknown error')}`;\n container.resolve(FastaDataEventBusService).emit('onShowImportDialog', errorMessage);\n } finally {\n UrlUtil.clearSearchParams();\n }\n }, [setData]);\n\n const extraFastaDataImportDialogLoaderActions = useMemo<DialogAction[]>(() => [\n {\n autoFocus: true,\n color: 'secondary',\n label: 'Demo (SARS-CoV-2)',\n onClick: onClickLoadDemoData,\n variant: 'contained',\n },\n ], [onClickLoadDemoData]);\n\n return (\n <PageCommon\n isNoInteraction={false}\n title={'Sequence Editor'}\n >\n {rawFasta && (\n <SequenceEditor />\n )}\n {!rawFasta && (\n <FastaNotLoaded\n description={'Load a FASTA sequence file to enable the editor.'}\n icon={<BiotechOutlinedIcon sx={{ color: 'text.disabled', fontSize: 72 }} />}\n title={'No FASTA Sequence Loaded'}\n />\n )}\n <FastaDataImportDialogLoader\n extraActions={extraFastaDataImportDialogLoaderActions}\n store={sequenceEditorStore}\n />\n <BackdropSpinner\n label={`Computing phylogenetic tree`}\n open={loadingStatus === LOADING_STATUS.LOADING}\n />\n </PageCommon>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,IAAaG,UAA+B;CAC1C,IAAMC,IAAgBC,EAASL,IAAsB,MAAUM,EAAM,aAAa,GAC5EC,IAAUF,EAASL,IAAsB,MAAUM,EAAM,OAAO,GAChEE,IAAWH,EAASL,IAAsB,MAAUM,EAAM,QAAQ,GAElEG,IAAsBC,EAAY,YAAY;EAClD,IAAI;GAEF,IAAMC,IAAgB,OAAM,MADL,MAAM,kCAAkC,EAAA,CAC1B,KAAK;GAG1C,AADA,MAAMJ,EAAQI,CAAa,GAC3BC,EAAU,QAAQC,CAAwB,CAAC,CAAC,KAAK,qBAAqB;EACxE,SAASC,GAAc;GACrB,EAAU,QAAQD,CAAwB,CAAC,CAAC,KAAK,qBAAqB;GACtE,IAAME,IAAe,gCAAgCC,EAAU,gBAAgBF,GAAK,eAAe;GACnG,EAAU,QAAQD,CAAwB,CAAC,CAAC,KAAK,sBAAsBE,CAAY;EACrF,UAAU;GACR,EAAQ,kBAAkB;EAC5B;CACF,GAAG,CAACR,CAAO,CAAC,GAENU,IAA0CC,QAA8B,CAC5E;EACE,WAAW;EACX,OAAO;EACP,OAAO;EACP,SAAST;EACT,SAAS;CACX,CACF,GAAG,CAACA,CAAmB,CAAC;CAExB,OACE,kBAACU,GAAD;EACE,iBAAiB;EACjB,OAAO;EAFT,UAAA;GAIGX,KACC,kBAACP,GAAD,CAAiB,CAAA;GAElB,CAACO,KACA,kBAACY,GAAD;IACE,aAAa;IACb,MAAM,kBAAClB,GAAD,EAAqB,IAAI;KAAE,OAAO;KAAiB,UAAU;IAAG,EAAI,CAAA;IAC1E,OAAO;GACR,CAAA;GAEH,kBAACmB,GAAD;IACE,cAAcJ;IACd,OAAOjB;GACR,CAAA;GACD,kBAACsB,GAAD;IACE,OAAO;IACP,MAAMlB,MAAkBmB,EAAe;GACxC,CAAA;EACS;;AAEhB"}
@@ -1,2 +1 @@
1
- import { t as e } from "../../_chunks/sequenceEditorStore.js";
2
- export { e as sequenceEditorStore };
1
+ export { t as sequenceEditorStore } from "../../_chunks/sequenceEditorStore.js";
@@ -1,5 +1,6 @@
1
1
  import { FastaDataStoreActions, FastaDataStoreState } from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';
2
- import { AminoAcidPalette, EditorSelection, EngineMeta, EngineSearchResult, NucleotidePalette } from '../../models';
2
+ import { EditorSelection, EngineMeta, EngineSearchResult } from '../../models/editor.models';
3
+ import { AminoAcidPalette, NucleotidePalette } from '../../models/palette.models';
3
4
  export type SequenceEditorStore = SequenceEditorStoreActions & SequenceEditorStoreState;
4
5
  export interface SequenceEditorStoreActions extends FastaDataStoreActions {
5
6
  setAminoAcidPalette: (palette: AminoAcidPalette) => void;
@@ -1,5 +1,5 @@
1
- import { AminoAcidPalette, EditorAssembly, EditorPathProperties, EditorSelection, EngineMeta, EngineSearchResult, EngineViewportResult, GridGeometry, GridRange, NucleotidePalette, StatusBarSelectionStats, VisibleGridRange } from '../../models';
2
- import { EDITOR_DIRECTION } from '../../models/editor';
1
+ import { EditorAssembly, EditorPathProperties, EditorSelection, EngineMeta, EngineSearchResult, EngineViewportResult, GridGeometry, GridRange, StatusBarSelectionStats, VisibleGridRange, EDITOR_DIRECTION } from '../../models/editor.models';
2
+ import { AminoAcidPalette, NucleotidePalette } from '../../models/palette.models';
3
3
  export declare class EditorUtil {
4
4
  static drawCanvas({ canvasElement, devicePixelRatio, geometry, meta, palette, rowNames, rowNamesStartRow, scrollLeft, scrollTop, searchResult, searchResultHighlightedIndex, selection, viewport, viewportHeight, viewportWidth, }: {
5
5
  canvasElement: HTMLCanvasElement;
@@ -19,7 +19,7 @@ export declare class EditorUtil {
19
19
  viewportWidth: number;
20
20
  }): EditorAssembly;
21
21
  static getExpandedSelection(currentSelection: EditorSelection, initialSelection: EditorSelection, direction: EDITOR_DIRECTION, metaData: EngineMeta): EditorSelection | null;
22
- static getMovedSelection(selection: EditorSelection | null, direction: EDITOR_DIRECTION, metaData: EngineMeta): EditorSelection | null;
22
+ static getMovedSelection(selection: EditorSelection | null, direction: EDITOR_DIRECTION, metaData: EngineMeta | null): EditorSelection | null;
23
23
  static getMutateArguments(selection: EditorSelection | null, metaData: EngineMeta, offset?: number): {
24
24
  endCol: number;
25
25
  rows: number[];
@@ -1,7 +1,6 @@
1
- import { PaletteUtil as e } from "../PaletteUtil/index.js";
2
- import { EDITOR_DIRECTION as t } from "../../models/editor.js";
3
- import { EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/model.js";
4
- import { DEFAULT_GRID_GEOMETRY as i } from "../../constants/editor.js";
1
+ import { DEFAULT_GRID_GEOMETRY as e } from "../../constants/editor.js";
2
+ import { EDITOR_DIRECTION as t, EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/editor.models.js";
3
+ import { PaletteUtil as i } from "../PaletteUtil/index.js";
5
4
  import "../../constants/index.js";
6
5
  //#region \0rolldown/runtime.js
7
6
  var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = (e, t, n, r) => {
@@ -236,77 +235,87 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
236
235
  }
237
236
  t.exports = o;
238
237
  })))(), 1), G = class a {
239
- static drawCanvas({ canvasElement: t, devicePixelRatio: r, geometry: i, meta: o, palette: s, rowNames: c, rowNamesStartRow: l, scrollLeft: u, scrollTop: d, searchResult: f, searchResultHighlightedIndex: p, selection: m, viewport: h, viewportHeight: g, viewportWidth: _ }) {
240
- let v = {
238
+ static drawCanvas({ canvasElement: e, devicePixelRatio: t, geometry: o, meta: s, palette: c, rowNames: l, rowNamesStartRow: u, scrollLeft: d, scrollTop: f, searchResult: p, searchResultHighlightedIndex: m, selection: h, viewport: g, viewportHeight: _, viewportWidth: v }) {
239
+ let y = {
241
240
  cells: { pathPropertiesMap: /* @__PURE__ */ new Map() },
242
241
  divider: { pathPropertiesMap: /* @__PURE__ */ new Map() },
243
242
  labels: { pathPropertiesMap: /* @__PURE__ */ new Map() },
244
243
  ruler: { pathPropertiesMap: /* @__PURE__ */ new Map() }
245
244
  };
246
- if (!t) return v;
247
- let y = t.getContext("2d");
248
- if (!y) return v;
249
- let b = o.sequenceCount.toString().length, x = (e) => m?.rows?.includes(e) ?? !1, S = (e, t) => !!(m?.cells && t >= m.cells.startCol && t <= m.cells.endCol && e >= m.cells.startRow && e <= m.cells.endRow) || !!m?.cols?.includes(t) || !!x(e), C = f && p !== null ? a.searchHitAt(f, p) : null;
250
- return a.draw(t, r, () => {
251
- y.clearRect(0, 0, t.width, t.height);
252
- let { cellHeight: r, cellWidth: o, dividerWidth: p, labelWidth: w, rulerHeight: T } = i, E = w + p, { bytes: D, cols: O, rows: k, startCol: A, startRow: j } = h, M = (f?.positions.length ?? 0) > 0, N = M ? new Uint8Array(k * O) : null, P = C ? new Uint8Array(k * O) : null, F = M ? new Path2D() : null, I = C ? new Path2D() : null, L = !1, R = !1, z = (e, t) => {
253
- if (!f) return;
254
- let n = Math.max(1, f.query.length), r = Math.max(A, e.col), i = Math.min(A + O, e.col + n), o = e.row - j;
255
- if (o < 0 || o >= k || r >= i || !a.searchHitContainsCell(e, f.query, e.row, r)) return;
256
- let s = o * O + r - A;
257
- t.fill(1, s, s + i - r);
245
+ if (!e) return y;
246
+ let b = e.getContext("2d");
247
+ if (!b) return y;
248
+ let x = s.sequenceCount.toString().length, S = (e) => h?.rows?.includes(e) ?? !1, C = (e, t) => !!(h?.cells && t >= h.cells.startCol && t <= h.cells.endCol && e >= h.cells.startRow && e <= h.cells.endRow) || !!h?.cols?.includes(t) || !!S(e), w = p && m !== null ? a.searchHitAt(p, m) : null;
249
+ return a.draw(e, t, () => {
250
+ b.clearRect(0, 0, e.width, e.height);
251
+ let { cellHeight: t, cellWidth: s, dividerWidth: m, labelWidth: T, rulerHeight: E } = o, D = T + m, { bytes: O, cols: k, rows: A, startCol: j, startRow: M } = g, N = (p?.positions.length ?? 0) > 0, P = N ? new Uint8Array(A * k) : null, F = w ? new Uint8Array(A * k) : null, I = N ? new Uint8Array(A) : null, L = w ? new Uint8Array(A) : null, R = N ? new Path2D() : null, z = w ? new Path2D() : null, B = !1, V = !1, H = (e, t) => {
252
+ if (!p) return;
253
+ let n = Math.max(1, p.query.length), i = e.row - M;
254
+ if (i < 0 || i >= A) return;
255
+ if (e.matrix_type === r.RECORD_NAME) {
256
+ t.fill(1, i * k, (i + 1) * k);
257
+ return;
258
+ }
259
+ let o = Math.max(j, e.col), s = Math.min(j + k, e.col + n);
260
+ if (o >= s || !a.searchHitContainsCell(e, p.query, e.row, o)) return;
261
+ let c = i * k + o - j;
262
+ t.fill(1, c, c + s - o);
263
+ }, U = (e, t) => {
264
+ e.matrix_type === r.RECORD_NAME && e.row >= M && e.row < M + A && (t[e.row - M] = 1);
258
265
  };
259
- f && N && (f.positions.forEach((e) => z(e, N)), C && P && z(C, P)), y.font = "12px monospace", y.textAlign = "center", y.textBaseline = "middle";
260
- for (let t = 0; t < k; t++) {
261
- let i = (j + t) * r + T - d;
262
- if (!(i + r < T || i > g)) for (let a = 0; a < O; a++) {
263
- let c = (A + a) * o + E - u;
264
- if (c + o < E || c > _) continue;
265
- let l = D[t * O + a], d = A + a, f = j + t, p = l ?? "", m = String.fromCharCode(p), h = e.paletteEntryFor(s, m), g = h.background;
266
+ p && P && (p.positions.forEach((e) => H(e, P)), p.positions.forEach((e) => {
267
+ I && U(e, I);
268
+ }), w && F && (H(w, F), L && U(w, L))), b.font = "12px monospace", b.textAlign = "center", b.textBaseline = "middle";
269
+ for (let e = 0; e < A; e++) {
270
+ let r = (M + e) * t + E - f;
271
+ if (!(r + t < E || r > _)) for (let a = 0; a < k; a++) {
272
+ let o = (j + a) * s + D - d;
273
+ if (o + s < D || o > v) continue;
274
+ let l = O[e * k + a], u = j + a, f = M + e, p = l ?? "", m = String.fromCharCode(p), h = i.paletteEntryFor(c, m), g = h.background;
266
275
  l === null ? g = "#e9eef2" : m === " " && (g = "#f7f8f9");
267
- let b = h.foreground;
268
- S(f, d) && (g = h.backgroundSelected, b = h.foregroundSelected);
269
- let x = t * O + a, C = N?.[x] === 1, w = P?.[x] === 1, T = new Path2D();
270
- T.rect(c, i, o, r), T.closePath(), v.cells.pathPropertiesMap.set(T, {
271
- col: d,
276
+ let _ = h.foreground;
277
+ C(f, u) && (g = h.backgroundSelected, _ = h.foregroundSelected);
278
+ let x = e * k + a, S = P?.[x] === 1, w = F?.[x] === 1, T = new Path2D();
279
+ T.rect(o, r, s, t), T.closePath(), y.cells.pathPropertiesMap.set(T, {
280
+ col: u,
272
281
  row: f,
273
282
  type: n.CELL
274
- }), y.fillStyle = g, y.fill(T), w && (y.fillStyle = "rgba(255, 193, 7, 0.35)", y.fillRect(c + 2, i + 2, Math.max(0, o - 4), Math.max(0, r - 4))), y.fillStyle = b, y.fillText(m, c + o / 2, i + r / 2), C && F && (L = !0, F.rect(c + .5, i + .5, o - 1, r - 1), w && I && (R = !0, I.rect(c + 1, i + 1, o - 2, r - 2)));
283
+ }), b.fillStyle = g, b.fill(T), (w || L?.[e] === 1) && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(o + 2, r + 2, Math.max(0, s - 4), Math.max(0, t - 4))), b.fillStyle = _, b.fillText(m, o + s / 2, r + t / 2), (S || I?.[e] === 1) && R && (B = !0, R.rect(o + .5, r + .5, s - 1, t - 1), (w || L?.[e] === 1) && z && (V = !0, z.rect(o + 1, r + 1, s - 2, t - 2)));
275
284
  }
276
285
  }
277
- L && F && (y.strokeStyle = "#000000", y.lineWidth = 1, y.stroke(F)), R && I && (y.lineWidth = 2, y.stroke(I)), y.fillStyle = "#edf2f6", y.fillRect(0, 0, _, T), y.font = "12px monospace", y.textBaseline = "middle";
278
- let B = [];
279
- y.strokeStyle = "#9fb3c8", y.lineWidth = 1, y.beginPath();
280
- for (let e = 0; e < O; e++) {
281
- let t = (A + e + 1) % 10 == 0;
282
- t && B.push(e);
283
- let r = (A + e) * o + E - u, i = new Path2D();
284
- i.rect(r, 0, o, T), i.closePath(), v.ruler.pathPropertiesMap.set(i, {
285
- col: A + e,
286
+ B && R && (b.strokeStyle = "#000000", b.lineWidth = 1, b.stroke(R)), V && z && (b.lineWidth = 2, b.stroke(z)), b.fillStyle = "#edf2f6", b.fillRect(0, 0, v, E), b.font = "12px monospace", b.textBaseline = "middle";
287
+ let G = [];
288
+ b.strokeStyle = "#9fb3c8", b.lineWidth = 1, b.beginPath();
289
+ for (let e = 0; e < k; e++) {
290
+ let t = (j + e + 1) % 10 == 0;
291
+ t && G.push(e);
292
+ let r = (j + e) * s + D - d, i = new Path2D();
293
+ i.rect(r, 0, s, E), i.closePath(), y.ruler.pathPropertiesMap.set(i, {
294
+ col: j + e,
286
295
  type: n.RULER
287
296
  });
288
- let a = r + .5, s = t ? 8 : 4;
289
- y.moveTo(a, T), y.lineTo(a, T - s);
297
+ let a = r + .5, o = t ? 8 : 4;
298
+ b.moveTo(a, E), b.lineTo(a, E - o);
290
299
  }
291
- y.stroke(), y.fillStyle = "#486581", y.textAlign = "center", B.forEach((e) => {
292
- let t = (A + e) * o + E - u, n = String(A + e + 1), r = y.measureText(n).width;
293
- t - r / 2 < E || t + r / 2 > _ || y.fillText(n, t, T / 2);
294
- }), y.textAlign = "start", y.strokeStyle = "#bcccdc", y.lineWidth = 1, y.beginPath(), y.moveTo(E + .5, 0), y.lineTo(E + .5, g), y.moveTo(0, T + .5), y.lineTo(_, T + .5), y.stroke(), y.fillStyle = "#edf2f6", y.fillRect(0, 0, E, T), y.fillStyle = "#d9e2ec", y.fillRect(w, 0, p, g);
295
- let V = new Path2D();
296
- V.rect(w, 0, p, g), V.closePath(), v.divider.pathPropertiesMap.set(V, { type: n.DIVIDER }), y.fillStyle = "#f8fafb", y.fillRect(0, T, w, g - T), y.font = "12px monospace", y.textBaseline = "middle", y.save(), y.beginPath(), y.rect(0, T, w, g - T), y.clip();
297
- for (let e = 0; e < k; e++) {
298
- let t = (j + e) * r + T - d;
299
- if (t + r < T || t > g) continue;
300
+ b.stroke(), b.fillStyle = "#486581", b.textAlign = "center", G.forEach((e) => {
301
+ let t = (j + e) * s + D - d, n = String(j + e + 1), r = b.measureText(n).width;
302
+ t - r / 2 < D || t + r / 2 > v || b.fillText(n, t, E / 2);
303
+ }), b.textAlign = "start", b.strokeStyle = "#bcccdc", b.lineWidth = 1, b.beginPath(), b.moveTo(D + .5, 0), b.lineTo(D + .5, _), b.moveTo(0, E + .5), b.lineTo(v, E + .5), b.stroke(), b.fillStyle = "#edf2f6", b.fillRect(0, 0, D, E), b.fillStyle = "#d9e2ec", b.fillRect(T, 0, m, _);
304
+ let K = new Path2D();
305
+ K.rect(T, 0, m, _), K.closePath(), y.divider.pathPropertiesMap.set(K, { type: n.DIVIDER }), b.fillStyle = "#f8fafb", b.fillRect(0, E, T, _ - E), b.font = "12px monospace", b.textBaseline = "middle", b.save(), b.beginPath(), b.rect(0, E, T, _ - E), b.clip();
306
+ for (let e = 0; e < A; e++) {
307
+ let r = (M + e) * t + E - f;
308
+ if (r + t < E || r > _) continue;
300
309
  let i = new Path2D();
301
- i.rect(0, t, w, r), i.closePath(), v.labels.pathPropertiesMap.set(i, {
302
- row: j + e,
310
+ i.rect(0, r, T, t), i.closePath(), y.labels.pathPropertiesMap.set(i, {
311
+ row: M + e,
303
312
  type: n.LABEL
304
313
  });
305
- let a = j + e - l, o = j + e, s = !!m?.cols || !!(m?.cells && o >= m.cells.startRow && o <= m.cells.endRow) || x(o);
306
- y.fillStyle = s ? "#1565c0" : "#f8fafb", y.fillRect(0, t, w, r), y.fillStyle = s ? "#ffffff" : "#334e68", y.fillText(`${(0, W.default)(String(j + e + 1), b, "0")}: ${c[a] ?? ""}`, 8, t + r / 2);
314
+ let a = M + e - u, o = M + e, s = I?.[e] === 1, c = L?.[e] === 1, d = !!h?.cols || !!(h?.cells && o >= h.cells.startRow && o <= h.cells.endRow) || S(o);
315
+ b.fillStyle = d ? "#1565c0" : "#f8fafb", b.fillRect(0, r, T, t), s && (b.fillStyle = "#ffecb3", b.fillRect(0, r, T, t)), c && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(2, r + 2, Math.max(0, T - 4), Math.max(0, t - 4))), b.fillStyle = d ? "#ffffff" : "#334e68", b.fillText(`${(0, W.default)(String(M + e + 1), x, "0")}: ${l[a] ?? ""}`, 8, r + t / 2);
307
316
  }
308
- y.restore();
309
- }), v;
317
+ b.restore();
318
+ }), y;
310
319
  }
311
320
  static getExpandedSelection(e, n, r, i) {
312
321
  let a = e.cells;
@@ -361,7 +370,7 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
361
370
  return e.rows ? e : null;
362
371
  }
363
372
  static getMovedSelection(e, n, r) {
364
- if (!e) return null;
373
+ if (!e || !r) return null;
365
374
  let i = n === t.LEFT || n === t.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
366
375
  if (o) return n === t.LEFT || n === t.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
367
376
  endCol: o.endCol + i,
@@ -493,14 +502,14 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
493
502
  rows: a
494
503
  };
495
504
  }
496
- static getVisibleGridRange(e) {
497
- let { geometry: t = i, numCols: n, numRows: r, scrollLeft: a, scrollTop: o, viewportHeight: s, viewportWidth: c } = e, l = t.labelWidth + t.dividerWidth, u = Math.max(0, Math.floor(a / t.cellWidth)), d = Math.min(n, u + Math.max(1, Math.ceil((c - l) / t.cellWidth) + 1)), f = Math.max(0, Math.floor(Math.max(0, o - t.rulerHeight) / t.cellHeight)), p = Math.min(r, f + Math.max(1, Math.ceil((s - t.rulerHeight) / t.cellHeight) + 1));
505
+ static getVisibleGridRange(t) {
506
+ let { geometry: n = e, numCols: r, numRows: i, scrollLeft: a, scrollTop: o, viewportHeight: s, viewportWidth: c } = t, l = n.labelWidth + n.dividerWidth, u = Math.max(0, Math.floor(a / n.cellWidth)), d = Math.min(r, u + Math.max(1, Math.ceil((c - l) / n.cellWidth) + 1)), f = Math.max(0, Math.floor(Math.max(0, o - n.rulerHeight) / n.cellHeight)), p = Math.min(i, f + Math.max(1, Math.ceil((s - n.rulerHeight) / n.cellHeight) + 1));
498
507
  return {
499
508
  cache: {
500
- endCol: Math.min(n, d + t.numOverscanCols),
501
- endRow: Math.min(r, p + t.numOverscanRows),
502
- startCol: Math.max(0, u - t.numOverscanCols),
503
- startRow: Math.max(0, f - t.numOverscanRows)
509
+ endCol: Math.min(r, d + n.numOverscanCols),
510
+ endRow: Math.min(i, p + n.numOverscanRows),
511
+ startCol: Math.max(0, u - n.numOverscanCols),
512
+ startRow: Math.max(0, f - n.numOverscanRows)
504
513
  },
505
514
  visible: {
506
515
  endCol: d,