@alaarab/ogrid-js 2.1.7 → 2.1.9

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.
package/dist/esm/index.js CHANGED
@@ -69,6 +69,9 @@ function getCellValue(item, col) {
69
69
  if (col.valueGetter) return col.valueGetter(item);
70
70
  return item[col.columnId];
71
71
  }
72
+ function isColumnEditable(col, item) {
73
+ return col.editable === true || typeof col.editable === "function" && col.editable(item);
74
+ }
72
75
  function isColumnGroupDef(c) {
73
76
  return "children" in c && Array.isArray(c.children);
74
77
  }
@@ -757,9 +760,9 @@ function getHeaderFilterConfig(col, input) {
757
760
  function getCellRenderDescriptor(item, col, rowIndex, colIdx, input) {
758
761
  const rowId = input.getRowId(item);
759
762
  const globalColIndex = colIdx + input.colOffset;
760
- const colEditable = col.editable === true || typeof col.editable === "function" && col.editable(item);
761
- const canEditInline = input.editable !== false && !!colEditable && !!input.onCellValueChanged && typeof col.cellEditor !== "function";
762
- const canEditPopup = input.editable !== false && !!colEditable && !!input.onCellValueChanged && typeof col.cellEditor === "function" && col.cellEditorPopup !== false;
763
+ const colEditable = isColumnEditable(col, item);
764
+ const canEditInline = input.editable !== false && colEditable && !!input.onCellValueChanged && typeof col.cellEditor !== "function";
765
+ const canEditPopup = input.editable !== false && colEditable && !!input.onCellValueChanged && typeof col.cellEditor === "function" && col.cellEditorPopup !== false;
763
766
  const canEditAny = canEditInline || canEditPopup;
764
767
  const isEditing = input.editingCell?.rowId === rowId && input.editingCell?.columnId === col.columnId;
765
768
  const isActive = !input.isDragging && input.activeCell?.rowIndex === rowIndex && input.activeCell?.columnIndex === globalColIndex;
@@ -891,6 +894,18 @@ function measureRange(container, range, colOffset) {
891
894
  height: brRect.bottom - tlRect.top
892
895
  };
893
896
  }
897
+ function buildCellIndex(container) {
898
+ const index = /* @__PURE__ */ new Map();
899
+ if (!container) return index;
900
+ const cells = container.querySelectorAll("[data-row-index][data-col-index]");
901
+ for (let i = 0; i < cells.length; i++) {
902
+ const el = cells[i];
903
+ const r = el.getAttribute("data-row-index") ?? "";
904
+ const c = el.getAttribute("data-col-index") ?? "";
905
+ index.set(`${r},${c}`, el);
906
+ }
907
+ return index;
908
+ }
894
909
  function injectGlobalStyles(id, css) {
895
910
  if (typeof document === "undefined") return;
896
911
  if (document.getElementById(id)) return;
@@ -1044,8 +1059,7 @@ function applyCellDeletion(range, items, visibleCols) {
1044
1059
  if (r >= items.length || c >= visibleCols.length) continue;
1045
1060
  const item = items[r];
1046
1061
  const col = visibleCols[c];
1047
- const colEditable = col.editable === true || typeof col.editable === "function" && col.editable(item);
1048
- if (!colEditable) continue;
1062
+ if (!isColumnEditable(col, item)) continue;
1049
1063
  const oldValue = getCellValue(item, col);
1050
1064
  const result = parseValue("", oldValue, item, col);
1051
1065
  if (!result.valid) continue;
@@ -1141,8 +1155,7 @@ function applyPastedValues(parsedRows, anchorRow, anchorCol, items, visibleCols)
1141
1155
  if (targetRow >= items.length || targetCol >= visibleCols.length) continue;
1142
1156
  const item = items[targetRow];
1143
1157
  const col = visibleCols[targetCol];
1144
- const colEditable = col.editable === true || typeof col.editable === "function" && col.editable(item);
1145
- if (!colEditable) continue;
1158
+ if (!isColumnEditable(col, item)) continue;
1146
1159
  const rawValue = cells[c] ?? "";
1147
1160
  const oldValue = getCellValue(item, col);
1148
1161
  const result = parseValue(rawValue, oldValue, item, col);
@@ -1165,8 +1178,7 @@ function applyCutClear(cutRange, items, visibleCols) {
1165
1178
  if (r >= items.length || c >= visibleCols.length) continue;
1166
1179
  const item = items[r];
1167
1180
  const col = visibleCols[c];
1168
- const colEditable = col.editable === true || typeof col.editable === "function" && col.editable(item);
1169
- if (!colEditable) continue;
1181
+ if (!isColumnEditable(col, item)) continue;
1170
1182
  const oldValue = getCellValue(item, col);
1171
1183
  const result = parseValue("", oldValue, item, col);
1172
1184
  if (!result.valid) continue;
@@ -1193,8 +1205,7 @@ function applyFillValues(range, sourceRow, sourceCol, items, visibleCols) {
1193
1205
  if (row >= items.length || col >= visibleCols.length) continue;
1194
1206
  const item = items[row];
1195
1207
  const colDef = visibleCols[col];
1196
- const colEditable = colDef.editable === true || typeof colDef.editable === "function" && colDef.editable(item);
1197
- if (!colEditable) continue;
1208
+ if (!isColumnEditable(colDef, item)) continue;
1198
1209
  const oldValue = getCellValue(item, colDef);
1199
1210
  const result = parseValue(startValue, oldValue, item, colDef);
1200
1211
  if (!result.valid) continue;
@@ -5809,86 +5820,107 @@ var OGridRendering = class {
5809
5820
  // src/OGrid.ts
5810
5821
  var OGRID_THEME_CSS = `
5811
5822
  .ogrid-drag-target { box-shadow: inset 0 0 0 1px var(--ogrid-accent, #0078d4); }
5812
- :root {
5823
+ :where(:root) {
5813
5824
  --ogrid-bg: #ffffff;
5814
5825
  --ogrid-fg: rgba(0, 0, 0, 0.87);
5815
5826
  --ogrid-fg-secondary: rgba(0, 0, 0, 0.6);
5816
5827
  --ogrid-fg-muted: rgba(0, 0, 0, 0.5);
5817
5828
  --ogrid-border: rgba(0, 0, 0, 0.12);
5818
- --ogrid-header-bg: rgba(0, 0, 0, 0.04);
5829
+ --ogrid-border-strong: rgba(0, 0, 0, 0.5);
5830
+ --ogrid-border-hover: rgba(0, 0, 0, 0.3);
5831
+ --ogrid-header-bg: #f5f5f5;
5819
5832
  --ogrid-hover-bg: rgba(0, 0, 0, 0.04);
5820
5833
  --ogrid-selected-row-bg: #e6f0fb;
5834
+ --ogrid-bg-selected-hover: #dae8f8;
5821
5835
  --ogrid-active-cell-bg: rgba(0, 0, 0, 0.02);
5822
5836
  --ogrid-range-bg: rgba(33, 115, 70, 0.12);
5823
5837
  --ogrid-accent: #0078d4;
5838
+ --ogrid-accent-dark: #005a9e;
5824
5839
  --ogrid-selection-color: #217346;
5825
- --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
5826
- --ogrid-bg-subtle: #f3f2f1;
5840
+ --ogrid-primary: #0078d4;
5841
+ --ogrid-primary-fg: #fff;
5842
+ --ogrid-primary-hover: #106ebe;
5843
+ --ogrid-bg-subtle: #f5f5f5;
5827
5844
  --ogrid-bg-hover: rgba(0, 0, 0, 0.04);
5828
- --ogrid-bg-selected: #e6f0fb;
5829
- --ogrid-bg-selected-hover: #dae8f8;
5830
- --ogrid-bg-range: rgba(33, 115, 70, 0.12);
5845
+ --ogrid-active-bg: rgba(0, 0, 0, 0.06);
5831
5846
  --ogrid-muted: rgba(0, 0, 0, 0.5);
5847
+ --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
5848
+ --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
5849
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.1);
5850
+ --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
5832
5851
  --ogrid-selection: #217346;
5833
- --ogrid-primary: #217346;
5834
- --ogrid-primary-fg: #fff;
5852
+ --ogrid-bg-range: rgba(33, 115, 70, 0.12);
5853
+ --ogrid-bg-selected: #e6f0fb;
5835
5854
  --ogrid-loading-bg: rgba(255, 255, 255, 0.7);
5836
- --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
5837
- }
5838
- [data-theme='dark'] {
5839
- --ogrid-bg: #1e1e1e;
5840
- --ogrid-fg: rgba(255, 255, 255, 0.87);
5841
- --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
5842
- --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
5843
- --ogrid-border: rgba(255, 255, 255, 0.12);
5844
- --ogrid-header-bg: rgba(255, 255, 255, 0.06);
5845
- --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
5846
- --ogrid-selected-row-bg: #1a3a5c;
5847
- --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
5848
- --ogrid-range-bg: rgba(46, 160, 67, 0.15);
5849
- --ogrid-accent: #4da6ff;
5850
- --ogrid-selection-color: #2ea043;
5851
- --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
5852
- --ogrid-bg-subtle: #2a2a2a;
5853
- --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
5854
- --ogrid-bg-selected: #1a3a5c;
5855
- --ogrid-bg-selected-hover: #1f426b;
5856
- --ogrid-bg-range: rgba(46, 160, 67, 0.15);
5857
- --ogrid-muted: rgba(255, 255, 255, 0.5);
5858
- --ogrid-selection: #2ea043;
5859
- --ogrid-primary: #2ea043;
5860
- --ogrid-primary-fg: #fff;
5861
- --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
5862
- --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
5863
5855
  }
5864
5856
  @media (prefers-color-scheme: dark) {
5865
- :root:not([data-theme='light']) {
5857
+ :where(:root:not([data-theme="light"])) {
5866
5858
  --ogrid-bg: #1e1e1e;
5867
5859
  --ogrid-fg: rgba(255, 255, 255, 0.87);
5868
5860
  --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
5869
5861
  --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
5870
5862
  --ogrid-border: rgba(255, 255, 255, 0.12);
5871
- --ogrid-header-bg: rgba(255, 255, 255, 0.06);
5863
+ --ogrid-border-strong: rgba(255, 255, 255, 0.5);
5864
+ --ogrid-border-hover: rgba(255, 255, 255, 0.3);
5865
+ --ogrid-header-bg: #2c2c2c;
5872
5866
  --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
5873
5867
  --ogrid-selected-row-bg: #1a3a5c;
5868
+ --ogrid-bg-selected-hover: #1f3650;
5874
5869
  --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
5875
5870
  --ogrid-range-bg: rgba(46, 160, 67, 0.15);
5876
5871
  --ogrid-accent: #4da6ff;
5872
+ --ogrid-accent-dark: #3390e0;
5877
5873
  --ogrid-selection-color: #2ea043;
5878
- --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
5879
- --ogrid-bg-subtle: #2a2a2a;
5874
+ --ogrid-primary: #4da6ff;
5875
+ --ogrid-primary-fg: #fff;
5876
+ --ogrid-primary-hover: #66b3ff;
5877
+ --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);
5880
5878
  --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
5881
- --ogrid-bg-selected: #1a3a5c;
5882
- --ogrid-bg-selected-hover: #1f426b;
5883
- --ogrid-bg-range: rgba(46, 160, 67, 0.15);
5879
+ --ogrid-active-bg: rgba(255, 255, 255, 0.08);
5884
5880
  --ogrid-muted: rgba(255, 255, 255, 0.5);
5881
+ --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
5882
+ --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
5883
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
5884
+ --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
5885
5885
  --ogrid-selection: #2ea043;
5886
- --ogrid-primary: #2ea043;
5887
- --ogrid-primary-fg: #fff;
5886
+ --ogrid-bg-range: rgba(46, 160, 67, 0.15);
5887
+ --ogrid-bg-selected: #1a3a5c;
5888
5888
  --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
5889
- --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
5890
5889
  }
5891
5890
  }
5891
+ :where([data-theme='dark']) {
5892
+ --ogrid-bg: #1e1e1e;
5893
+ --ogrid-fg: rgba(255, 255, 255, 0.87);
5894
+ --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
5895
+ --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
5896
+ --ogrid-border: rgba(255, 255, 255, 0.12);
5897
+ --ogrid-border-strong: rgba(255, 255, 255, 0.5);
5898
+ --ogrid-border-hover: rgba(255, 255, 255, 0.3);
5899
+ --ogrid-header-bg: #2c2c2c;
5900
+ --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
5901
+ --ogrid-selected-row-bg: #1a3a5c;
5902
+ --ogrid-bg-selected-hover: #1f3650;
5903
+ --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
5904
+ --ogrid-range-bg: rgba(46, 160, 67, 0.15);
5905
+ --ogrid-accent: #4da6ff;
5906
+ --ogrid-accent-dark: #3390e0;
5907
+ --ogrid-selection-color: #2ea043;
5908
+ --ogrid-primary: #4da6ff;
5909
+ --ogrid-primary-fg: #fff;
5910
+ --ogrid-primary-hover: #66b3ff;
5911
+ --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);
5912
+ --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
5913
+ --ogrid-active-bg: rgba(255, 255, 255, 0.08);
5914
+ --ogrid-muted: rgba(255, 255, 255, 0.5);
5915
+ --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
5916
+ --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
5917
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
5918
+ --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
5919
+ --ogrid-selection: #2ea043;
5920
+ --ogrid-bg-range: rgba(46, 160, 67, 0.15);
5921
+ --ogrid-bg-selected: #1a3a5c;
5922
+ --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
5923
+ }
5892
5924
  `;
5893
5925
  var OGrid = class {
5894
5926
  constructor(container, options) {
@@ -6340,4 +6372,4 @@ var OGrid = class {
6340
6372
  }
6341
6373
  };
6342
6374
 
6343
- export { AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, ClipboardState, ColumnChooser, ColumnPinningState, ColumnReorderState, ColumnResizeState, ContextMenu, DEFAULT_DEBOUNCE_MS, DEFAULT_MIN_COLUMN_WIDTH, EventEmitter, FillHandleState, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GridState, HeaderFilter, HeaderFilterState, InlineCellEditor, KeyboardNavState, MAX_PAGE_BUTTONS, MarchingAntsOverlay, OGrid, OGridEventWiring, OGridRendering, PAGE_SIZE_OPTIONS, PEOPLE_SEARCH_DEBOUNCE_MS, PaginationControls, ROW_NUMBER_COLUMN_WIDTH, RowSelectionState, SIDEBAR_TRANSITION_MS, SelectionState, SideBar, SideBarState, StatusBar, TableLayoutState, TableRenderer, UndoRedoStack, UndoRedoState, VirtualScrollState, Z_INDEX, applyCellDeletion, applyCutClear, applyFillValues, applyPastedValues, applyRangeRowSelection, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps, buildPopoverEditorProps, calculateDropTarget, clampSelectionToBounds, computeAggregations, computeArrowNavigation, computeAutoScrollSpeed, computeNextSortState, computeRowSelectionState, computeTabNavigation, computeTotalHeight, computeVisibleRange, currencyParser, dateParser, debounce, deriveFilterOptionsFromData, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellRenderDescriptor, getCellValue, getColumnHeaderMenuItems, getContextMenuHandlers, getDataGridStatusBarConfig, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getPinStateForColumn, getScrollTopForRow, getStatusBarParts, injectGlobalStyles, isFilterConfig, isInSelectionRange, isRowInRange, measureColumnContentWidth, measureRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, processClientSideData, rangesEqual, reorderColumnArray, resolveCellDisplayContent, resolveCellStyle, toUserLike, triggerCsvDownload, validateColumns, validateRowIds };
6375
+ export { AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, ClipboardState, ColumnChooser, ColumnPinningState, ColumnReorderState, ColumnResizeState, ContextMenu, DEFAULT_DEBOUNCE_MS, DEFAULT_MIN_COLUMN_WIDTH, EventEmitter, FillHandleState, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GridState, HeaderFilter, HeaderFilterState, InlineCellEditor, KeyboardNavState, MAX_PAGE_BUTTONS, MarchingAntsOverlay, OGrid, OGridEventWiring, OGridRendering, PAGE_SIZE_OPTIONS, PEOPLE_SEARCH_DEBOUNCE_MS, PaginationControls, ROW_NUMBER_COLUMN_WIDTH, RowSelectionState, SIDEBAR_TRANSITION_MS, SelectionState, SideBar, SideBarState, StatusBar, TableLayoutState, TableRenderer, UndoRedoStack, UndoRedoState, VirtualScrollState, Z_INDEX, applyCellDeletion, applyCutClear, applyFillValues, applyPastedValues, applyRangeRowSelection, areGridRowPropsEqual, booleanParser, buildCellIndex, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps, buildPopoverEditorProps, calculateDropTarget, clampSelectionToBounds, computeAggregations, computeArrowNavigation, computeAutoScrollSpeed, computeNextSortState, computeRowSelectionState, computeTabNavigation, computeTotalHeight, computeVisibleRange, currencyParser, dateParser, debounce, deriveFilterOptionsFromData, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellRenderDescriptor, getCellValue, getColumnHeaderMenuItems, getContextMenuHandlers, getDataGridStatusBarConfig, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getPinStateForColumn, getScrollTopForRow, getStatusBarParts, injectGlobalStyles, isColumnEditable, isFilterConfig, isInSelectionRange, isRowInRange, measureColumnContentWidth, measureRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, processClientSideData, rangesEqual, reorderColumnArray, resolveCellDisplayContent, resolveCellStyle, toUserLike, triggerCsvDownload, validateColumns, validateRowIds };
@@ -4,112 +4,113 @@
4
4
  Override any --ogrid-* variable to customize.
5
5
  ────────────────────────────────────────────────────────────── */
6
6
 
7
- /* ── Light Theme (default) ── */
8
- :root {
7
+ /* ── Light Theme (default) — :where() for zero specificity ── */
8
+ :where(:root) {
9
9
  --ogrid-bg: #ffffff;
10
10
  --ogrid-fg: rgba(0, 0, 0, 0.87);
11
11
  --ogrid-fg-secondary: rgba(0, 0, 0, 0.6);
12
12
  --ogrid-fg-muted: rgba(0, 0, 0, 0.5);
13
13
  --ogrid-border: rgba(0, 0, 0, 0.12);
14
- --ogrid-header-bg: rgba(0, 0, 0, 0.04);
14
+ --ogrid-border-strong: rgba(0, 0, 0, 0.5);
15
+ --ogrid-border-hover: rgba(0, 0, 0, 0.3);
16
+ --ogrid-header-bg: #f5f5f5;
15
17
  --ogrid-hover-bg: rgba(0, 0, 0, 0.04);
16
18
  --ogrid-selected-row-bg: #e6f0fb;
19
+ --ogrid-bg-selected-hover: #dae8f8;
17
20
  --ogrid-active-cell-bg: rgba(0, 0, 0, 0.02);
18
21
  --ogrid-range-bg: rgba(33, 115, 70, 0.12);
19
22
  --ogrid-accent: #0078d4;
23
+ --ogrid-accent-dark: #005a9e;
20
24
  --ogrid-selection-color: #217346;
21
- --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
22
- /* Aliases for backward compat */
23
- --ogrid-border-strong: #888;
24
- --ogrid-border-hover: #999;
25
- --ogrid-bg-subtle: #f3f2f1;
25
+ --ogrid-primary: #0078d4;
26
+ --ogrid-primary-fg: #fff;
27
+ --ogrid-primary-hover: #106ebe;
28
+ --ogrid-bg-subtle: #f5f5f5;
26
29
  --ogrid-bg-hover: rgba(0, 0, 0, 0.04);
27
- --ogrid-bg-selected: #e6f0fb;
28
- --ogrid-bg-selected-hover: #dae8f8;
29
- --ogrid-bg-range: rgba(33, 115, 70, 0.12);
30
+ --ogrid-active-bg: rgba(0, 0, 0, 0.06);
30
31
  --ogrid-muted: rgba(0, 0, 0, 0.5);
31
- --ogrid-selection: #217346;
32
- --ogrid-primary: #217346;
33
- --ogrid-primary-fg: #fff;
34
- --ogrid-primary-hover: #1b5f39;
35
- --ogrid-accent-dark: #1b5f39;
36
32
  --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
37
33
  --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
34
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.1);
35
+ --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
36
+ --ogrid-selection: #217346;
37
+ --ogrid-bg-range: rgba(33, 115, 70, 0.12);
38
+ --ogrid-bg-selected: #e6f0fb;
38
39
  --ogrid-loading-bg: rgba(255, 255, 255, 0.7);
39
- --ogrid-pinned-shadow: rgba(0, 0, 0, 0.12);
40
- }
41
-
42
- /* ── Dark Theme ── */
43
- [data-theme='dark'] {
44
- --ogrid-bg: #1e1e1e;
45
- --ogrid-fg: rgba(255, 255, 255, 0.87);
46
- --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
47
- --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
48
- --ogrid-border: rgba(255, 255, 255, 0.12);
49
- --ogrid-header-bg: rgba(255, 255, 255, 0.06);
50
- --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
51
- --ogrid-selected-row-bg: #1a3a5c;
52
- --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
53
- --ogrid-range-bg: rgba(46, 160, 67, 0.15);
54
- --ogrid-accent: #4da6ff;
55
- --ogrid-selection-color: #2ea043;
56
- --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
57
- /* Aliases for backward compat */
58
- --ogrid-border-strong: #555;
59
- --ogrid-border-hover: #666;
60
- --ogrid-bg-subtle: #2a2a2a;
61
- --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
62
- --ogrid-bg-selected: #1a3a5c;
63
- --ogrid-bg-selected-hover: #1f426b;
64
- --ogrid-bg-range: rgba(46, 160, 67, 0.15);
65
- --ogrid-muted: rgba(255, 255, 255, 0.5);
66
- --ogrid-selection: #2ea043;
67
- --ogrid-primary: #2ea043;
68
- --ogrid-primary-fg: #fff;
69
- --ogrid-primary-hover: #3db852;
70
- --ogrid-accent-dark: #3db852;
71
- --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
72
- --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
73
- --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
74
- --ogrid-pinned-shadow: rgba(0, 0, 0, 0.4);
75
40
  }
76
41
 
42
+ /* ── Auto Dark (system preference) ── */
77
43
  @media (prefers-color-scheme: dark) {
78
- :root:not([data-theme='light']) {
44
+ :where(:root:not([data-theme="light"])) {
79
45
  --ogrid-bg: #1e1e1e;
80
46
  --ogrid-fg: rgba(255, 255, 255, 0.87);
81
47
  --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
82
48
  --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
83
49
  --ogrid-border: rgba(255, 255, 255, 0.12);
84
- --ogrid-header-bg: rgba(255, 255, 255, 0.06);
50
+ --ogrid-border-strong: rgba(255, 255, 255, 0.5);
51
+ --ogrid-border-hover: rgba(255, 255, 255, 0.3);
52
+ --ogrid-header-bg: #2c2c2c;
85
53
  --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
86
54
  --ogrid-selected-row-bg: #1a3a5c;
55
+ --ogrid-bg-selected-hover: #1f3650;
87
56
  --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
88
57
  --ogrid-range-bg: rgba(46, 160, 67, 0.15);
89
58
  --ogrid-accent: #4da6ff;
59
+ --ogrid-accent-dark: #3390e0;
90
60
  --ogrid-selection-color: #2ea043;
91
- --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
92
- /* Aliases for backward compat */
93
- --ogrid-border-strong: #555;
94
- --ogrid-border-hover: #666;
95
- --ogrid-bg-subtle: #2a2a2a;
61
+ --ogrid-primary: #4da6ff;
62
+ --ogrid-primary-fg: #fff;
63
+ --ogrid-primary-hover: #66b3ff;
64
+ --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);
96
65
  --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
97
- --ogrid-bg-selected: #1a3a5c;
98
- --ogrid-bg-selected-hover: #1f426b;
99
- --ogrid-bg-range: rgba(46, 160, 67, 0.15);
66
+ --ogrid-active-bg: rgba(255, 255, 255, 0.08);
100
67
  --ogrid-muted: rgba(255, 255, 255, 0.5);
101
- --ogrid-selection: #2ea043;
102
- --ogrid-primary: #2ea043;
103
- --ogrid-primary-fg: #fff;
104
- --ogrid-primary-hover: #3db852;
105
- --ogrid-accent-dark: #3db852;
106
- --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
68
+ --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
107
69
  --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
70
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
71
+ --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
72
+ --ogrid-selection: #2ea043;
73
+ --ogrid-bg-range: rgba(46, 160, 67, 0.15);
74
+ --ogrid-bg-selected: #1a3a5c;
108
75
  --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
109
- --ogrid-pinned-shadow: rgba(0, 0, 0, 0.4);
110
76
  }
111
77
  }
112
78
 
79
+ /* ── Explicit Dark ── */
80
+ :where([data-theme='dark']) {
81
+ --ogrid-bg: #1e1e1e;
82
+ --ogrid-fg: rgba(255, 255, 255, 0.87);
83
+ --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
84
+ --ogrid-fg-muted: rgba(255, 255, 255, 0.5);
85
+ --ogrid-border: rgba(255, 255, 255, 0.12);
86
+ --ogrid-border-strong: rgba(255, 255, 255, 0.5);
87
+ --ogrid-border-hover: rgba(255, 255, 255, 0.3);
88
+ --ogrid-header-bg: #2c2c2c;
89
+ --ogrid-hover-bg: rgba(255, 255, 255, 0.08);
90
+ --ogrid-selected-row-bg: #1a3a5c;
91
+ --ogrid-bg-selected-hover: #1f3650;
92
+ --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
93
+ --ogrid-range-bg: rgba(46, 160, 67, 0.15);
94
+ --ogrid-accent: #4da6ff;
95
+ --ogrid-accent-dark: #3390e0;
96
+ --ogrid-selection-color: #2ea043;
97
+ --ogrid-primary: #4da6ff;
98
+ --ogrid-primary-fg: #fff;
99
+ --ogrid-primary-hover: #66b3ff;
100
+ --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);
101
+ --ogrid-bg-hover: rgba(255, 255, 255, 0.08);
102
+ --ogrid-active-bg: rgba(255, 255, 255, 0.08);
103
+ --ogrid-muted: rgba(255, 255, 255, 0.5);
104
+ --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
105
+ --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
106
+ --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);
107
+ --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
108
+ --ogrid-selection: #2ea043;
109
+ --ogrid-bg-range: rgba(46, 160, 67, 0.15);
110
+ --ogrid-bg-selected: #1a3a5c;
111
+ --ogrid-loading-bg: rgba(0, 0, 0, 0.7);
112
+ }
113
+
113
114
  /* ── Layout ── */
114
115
 
115
116
  .ogrid-container {
@@ -316,6 +317,7 @@
316
317
 
317
318
  .ogrid-table tbody td {
318
319
  padding: 6px 10px;
320
+ background: var(--ogrid-bg, #ffffff);
319
321
  border-bottom: 1px solid var(--ogrid-border, #e8e8e8);
320
322
  position: relative;
321
323
  color: var(--ogrid-fg, #242424);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-js",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "OGrid vanilla JS – framework-free data grid with sorting, filtering, pagination, and spreadsheet-style editing.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,7 +36,7 @@
36
36
  "node": ">=18"
37
37
  },
38
38
  "dependencies": {
39
- "@alaarab/ogrid-core": "2.1.7"
39
+ "@alaarab/ogrid-core": "2.1.9"
40
40
  },
41
41
  "sideEffects": [
42
42
  "**/*.css"