handsontable 0.0.0-next-3d1a0ea-20241007 → 0.0.0-next-b0eaa90-20241016

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (77) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +5 -1
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +5 -2
  3. package/3rdparty/walkontable/src/core/clone.js +1 -0
  4. package/3rdparty/walkontable/src/core/clone.mjs +1 -0
  5. package/3rdparty/walkontable/src/core/core.js +2 -0
  6. package/3rdparty/walkontable/src/core/core.mjs +2 -0
  7. package/3rdparty/walkontable/src/overlay/_base.js +3 -1
  8. package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
  9. package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
  10. package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
  11. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  12. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  13. package/3rdparty/walkontable/src/settings.js +0 -2
  14. package/3rdparty/walkontable/src/settings.mjs +0 -2
  15. package/3rdparty/walkontable/src/table.js +6 -5
  16. package/3rdparty/walkontable/src/table.mjs +6 -5
  17. package/3rdparty/walkontable/src/utils/column.js +1 -1
  18. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  19. package/3rdparty/walkontable/src/utils/stylesHandler.js +185 -0
  20. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +181 -0
  21. package/3rdparty/walkontable/src/viewport.js +1 -0
  22. package/3rdparty/walkontable/src/viewport.mjs +1 -0
  23. package/base.js +2 -2
  24. package/base.mjs +2 -2
  25. package/core.js +11 -0
  26. package/core.mjs +11 -0
  27. package/dataMap/metaManager/metaSchema.js +17 -0
  28. package/dataMap/metaManager/metaSchema.mjs +17 -0
  29. package/dist/handsontable.css +236 -5
  30. package/dist/handsontable.full.css +3 -3
  31. package/dist/handsontable.full.js +3886 -3807
  32. package/dist/handsontable.full.min.css +4 -3
  33. package/dist/handsontable.full.min.js +26 -26
  34. package/dist/handsontable.js +3593 -3508
  35. package/dist/handsontable.min.css +9 -4
  36. package/dist/handsontable.min.js +24 -24
  37. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  38. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  39. package/editors/baseEditor/baseEditor.js +1 -1
  40. package/editors/baseEditor/baseEditor.mjs +1 -1
  41. package/editors/dateEditor/dateEditor.js +2 -0
  42. package/editors/dateEditor/dateEditor.mjs +2 -0
  43. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  44. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  45. package/editors/selectEditor/selectEditor.js +20 -9
  46. package/editors/selectEditor/selectEditor.mjs +20 -9
  47. package/editors/textEditor/textEditor.js +4 -11
  48. package/editors/textEditor/textEditor.mjs +4 -11
  49. package/helpers/mixed.js +2 -2
  50. package/helpers/mixed.mjs +2 -2
  51. package/helpers/themes.js +17 -0
  52. package/helpers/themes.mjs +13 -0
  53. package/package.json +10 -3
  54. package/plugins/comments/commentEditor.js +8 -1
  55. package/plugins/comments/commentEditor.mjs +8 -1
  56. package/plugins/comments/comments.js +1 -1
  57. package/plugins/comments/comments.mjs +1 -1
  58. package/plugins/contextMenu/menu/menu.js +4 -4
  59. package/plugins/contextMenu/menu/menu.mjs +4 -4
  60. package/plugins/manualRowMove/manualRowMove.js +1 -1
  61. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  62. package/plugins/mergeCells/mergeCells.js +1 -1
  63. package/plugins/mergeCells/mergeCells.mjs +1 -1
  64. package/plugins/nestedRows/ui/headers.js +3 -1
  65. package/plugins/nestedRows/ui/headers.mjs +3 -1
  66. package/styles/handsontable.css +1920 -0
  67. package/styles/handsontable.min.css +30 -0
  68. package/styles/ht-theme-gemini.css +690 -0
  69. package/styles/ht-theme-gemini.min.css +30 -0
  70. package/styles/ht-theme-main.css +712 -0
  71. package/styles/ht-theme-main.min.css +30 -0
  72. package/tableView.js +33 -0
  73. package/tableView.mjs +33 -0
  74. package/utils/autoResize.js +4 -1
  75. package/utils/autoResize.mjs +4 -1
  76. package/utils/ghostTable.js +1 -1
  77. package/utils/ghostTable.mjs +1 -1
@@ -7,7 +7,8 @@ var _viewportBase = require("./viewportBase");
7
7
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
9
9
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- const DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 23;
10
+ // eslint-disable-next-line import/no-mutable-exports
11
+ let DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 23;
11
12
 
12
13
  /**
13
14
  * @typedef {object} ViewportRowsCalculatorOptions
@@ -34,10 +35,13 @@ class ViewportRowsCalculator extends _viewportBase.ViewportBaseCalculator {
34
35
  viewportHeight,
35
36
  scrollOffset,
36
37
  totalRows,
38
+ defaultRowHeight,
37
39
  rowHeightFn,
38
40
  overrideFn,
39
41
  horizontalScrollbarHeight
40
42
  } = _ref;
43
+ // Replace the default height of `23px` with a value from the current theme.
44
+ exports.DEFAULT_HEIGHT = DEFAULT_HEIGHT = defaultRowHeight;
41
45
  super(calculationTypes);
42
46
  _defineProperty(this, "viewportHeight", 0);
43
47
  _defineProperty(this, "scrollOffset", 0);
@@ -3,8 +3,8 @@ import "core-js/modules/es.array.push.js";
3
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import { ViewportBaseCalculator } from "./viewportBase.mjs";
7
- export const DEFAULT_HEIGHT = 23;
6
+ import { ViewportBaseCalculator } from "./viewportBase.mjs"; // eslint-disable-next-line import/no-mutable-exports
7
+ export let DEFAULT_HEIGHT = 23;
8
8
 
9
9
  /**
10
10
  * @typedef {object} ViewportRowsCalculatorOptions
@@ -31,10 +31,13 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
31
31
  viewportHeight,
32
32
  scrollOffset,
33
33
  totalRows,
34
+ defaultRowHeight,
34
35
  rowHeightFn,
35
36
  overrideFn,
36
37
  horizontalScrollbarHeight
37
38
  } = _ref;
39
+ // Replace the default height of `23px` with a value from the current theme.
40
+ DEFAULT_HEIGHT = defaultRowHeight;
38
41
  super(calculationTypes);
39
42
  _defineProperty(this, "viewportHeight", 0);
40
43
  _defineProperty(this, "scrollOffset", 0);
@@ -33,6 +33,7 @@ class Clone extends _base.default {
33
33
  this.wtTable = this.cloneOverlay.createTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
34
34
  this.wtViewport = clone.viewport;
35
35
  this.selectionManager = clone.selectionManager;
36
+ this.stylesHandler = clone.stylesHandler;
36
37
  this.wtEvent = new _event.default(facadeGetter, this.domBindings, this.wtSettings, this.eventManager, this.wtTable, this.selectionManager, clone.event);
37
38
  this.findOriginalHeaders();
38
39
  }
@@ -29,6 +29,7 @@ export default class Clone extends CoreAbstract {
29
29
  this.wtTable = this.cloneOverlay.createTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
30
30
  this.wtViewport = clone.viewport;
31
31
  this.selectionManager = clone.selectionManager;
32
+ this.stylesHandler = clone.stylesHandler;
32
33
  this.wtEvent = new Event(facadeGetter, this.domBindings, this.wtSettings, this.eventManager, this.wtTable, this.selectionManager, clone.event);
33
34
  this.findOriginalHeaders();
34
35
  }
@@ -12,6 +12,7 @@ var _base = _interopRequireDefault(require("./_base"));
12
12
  var _manager = require("../selection/manager");
13
13
  var _object = require("../../../../helpers/object");
14
14
  var _element = require("../../../../helpers/dom/element");
15
+ var _stylesHandler = require("../utils/stylesHandler");
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  /**
17
18
  * @class Walkontable
@@ -23,6 +24,7 @@ class Walkontable extends _base.default {
23
24
  */
24
25
  constructor(table, settings) {
25
26
  super(table, new _settings.default(settings));
27
+ this.stylesHandler = new _stylesHandler.StylesHandler(this.domBindings);
26
28
  const facadeGetter = this.wtSettings.getSetting('facade', this); // todo rethink. I would like to have no access to facade from the internal scope.
27
29
 
28
30
  this.wtTable = new _master.default(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
@@ -9,6 +9,7 @@ import CoreAbstract from "./_base.mjs";
9
9
  import { SelectionManager } from "../selection/manager.mjs";
10
10
  import { objectEach } from "../../../../helpers/object.mjs";
11
11
  import { addClass, removeClass } from "../../../../helpers/dom/element.mjs";
12
+ import { StylesHandler } from "../utils/stylesHandler.mjs";
12
13
  /**
13
14
  * @class Walkontable
14
15
  */
@@ -19,6 +20,7 @@ export default class Walkontable extends CoreAbstract {
19
20
  */
20
21
  constructor(table, settings) {
21
22
  super(table, new Settings(settings));
23
+ this.stylesHandler = new StylesHandler(this.domBindings);
22
24
  const facadeGetter = this.wtSettings.getSetting('facade', this); // todo rethink. I would like to have no access to facade from the internal scope.
23
25
 
24
26
  this.wtTable = new MasterTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
@@ -302,7 +302,9 @@ class Overlay {
302
302
  // todo ioc , or factor func if used only here
303
303
  event: this.wot.wtEvent,
304
304
  // todo ioc , or factory func if used only here
305
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
305
+ selectionManager: this.wot.selectionManager,
306
+ // todo ioc , or factory func if used only here
307
+ stylesHandler: this.wot.stylesHandler
306
308
  });
307
309
  }
308
310
 
@@ -298,7 +298,9 @@ export class Overlay {
298
298
  // todo ioc , or factor func if used only here
299
299
  event: this.wot.wtEvent,
300
300
  // todo ioc , or factory func if used only here
301
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
301
+ selectionManager: this.wot.selectionManager,
302
+ // todo ioc , or factory func if used only here
303
+ stylesHandler: this.wot.stylesHandler
302
304
  });
303
305
  }
304
306
 
@@ -144,9 +144,9 @@ class BottomOverlay extends _base.Overlay {
144
144
  sumCellSizes(from, to) {
145
145
  const {
146
146
  wtTable,
147
- wtSettings
147
+ stylesHandler
148
148
  } = this.wot;
149
- const defaultRowHeight = wtSettings.getSetting('defaultRowHeight');
149
+ const defaultRowHeight = stylesHandler.getDefaultRowHeight();
150
150
  let row = from;
151
151
  let sum = 0;
152
152
  while (row < to) {
@@ -140,9 +140,9 @@ export class BottomOverlay extends Overlay {
140
140
  sumCellSizes(from, to) {
141
141
  const {
142
142
  wtTable,
143
- wtSettings
143
+ stylesHandler
144
144
  } = this.wot;
145
- const defaultRowHeight = wtSettings.getSetting('defaultRowHeight');
145
+ const defaultRowHeight = stylesHandler.getDefaultRowHeight();
146
146
  let row = from;
147
147
  let sum = 0;
148
148
  while (row < to) {
@@ -138,7 +138,7 @@ class TopOverlay extends _base.Overlay {
138
138
  * @returns {number} Height sum.
139
139
  */
140
140
  sumCellSizes(from, to) {
141
- const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
141
+ const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
142
142
  let row = from;
143
143
  let sum = 0;
144
144
  while (row < to) {
@@ -134,7 +134,7 @@ export class TopOverlay extends Overlay {
134
134
  * @returns {number} Height sum.
135
135
  */
136
136
  sumCellSizes(from, to) {
137
- const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
137
+ const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
138
138
  let row = from;
139
139
  let sum = 0;
140
140
  while (row < to) {
@@ -19,7 +19,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
19
19
  * @property {Option} currentRowClassName Option `currentRowClassName`.
20
20
  * @property {Option} data Option `data`.
21
21
  * @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
22
- * @property {Option} defaultRowHeight Option `defaultRowHeight`.
23
22
  * @property {Option} externalRowCalculator Option `externalRowCalculator`.
24
23
  * @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
25
24
  * @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
@@ -191,7 +190,6 @@ class Settings {
191
190
  rowHeightByOverlayName() {
192
191
  // return undefined means use default size for the rendered cell content
193
192
  },
194
- defaultRowHeight: 23,
195
193
  defaultColumnWidth: 50,
196
194
  selections: null,
197
195
  hideBorderOnMouseDownOver: false,
@@ -16,7 +16,6 @@ import { objectEach } from "../../../helpers/object.mjs";
16
16
  * @property {Option} currentRowClassName Option `currentRowClassName`.
17
17
  * @property {Option} data Option `data`.
18
18
  * @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
19
- * @property {Option} defaultRowHeight Option `defaultRowHeight`.
20
19
  * @property {Option} externalRowCalculator Option `externalRowCalculator`.
21
20
  * @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
22
21
  * @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
@@ -186,7 +185,6 @@ export default class Settings {
186
185
  rowHeightByOverlayName() {
187
186
  // return undefined means use default size for the rendered cell content
188
187
  },
189
- defaultRowHeight: 23,
190
188
  defaultColumnWidth: 50,
191
189
  selections: null,
192
190
  hideBorderOnMouseDownOver: false,
@@ -367,7 +367,7 @@ class Table {
367
367
  markIfOversizedColumnHeader(col) {
368
368
  const sourceColIndex = this.columnFilter.renderedToSource(col);
369
369
  let level = this.wtSettings.getSetting('columnHeaders').length;
370
- const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
370
+ const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
371
371
  let previousColHeaderHeight;
372
372
  let currentHeader;
373
373
  let currentHeaderHeight;
@@ -645,8 +645,9 @@ class Table {
645
645
  return;
646
646
  }
647
647
  let rowCount = this.TBODY.childNodes.length;
648
- const expectedTableHeight = rowCount * this.wtSettings.getSetting('defaultRowHeight');
648
+ const expectedTableHeight = rowCount * this.wot.stylesHandler.getDefaultRowHeight();
649
649
  const actualTableHeight = (0, _element.innerHeight)(this.TBODY) - 1;
650
+ const rowHeightFn = this.wot.stylesHandler.getStyleForTD('box-sizing') === 'border-box' ? _element.outerHeight : _element.innerHeight;
650
651
  let previousRowHeight;
651
652
  let rowInnerHeight;
652
653
  let sourceRowIndex;
@@ -663,11 +664,11 @@ class Table {
663
664
  currentTr = this.getTrForRow(sourceRowIndex);
664
665
  rowHeader = currentTr.querySelector('th');
665
666
  if (rowHeader) {
666
- rowInnerHeight = (0, _element.innerHeight)(rowHeader);
667
+ rowInnerHeight = rowHeightFn(rowHeader);
667
668
  } else {
668
- rowInnerHeight = (0, _element.innerHeight)(currentTr) - 1;
669
+ rowInnerHeight = rowHeightFn(currentTr) - 1;
669
670
  }
670
- if (!previousRowHeight && this.wtSettings.getSetting('defaultRowHeight') < rowInnerHeight || previousRowHeight < rowInnerHeight) {
671
+ if (!previousRowHeight && this.wot.stylesHandler.getDefaultRowHeight() < rowInnerHeight || previousRowHeight < rowInnerHeight) {
671
672
  rowInnerHeight += 1;
672
673
  this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight;
673
674
  }
@@ -363,7 +363,7 @@ class Table {
363
363
  markIfOversizedColumnHeader(col) {
364
364
  const sourceColIndex = this.columnFilter.renderedToSource(col);
365
365
  let level = this.wtSettings.getSetting('columnHeaders').length;
366
- const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
366
+ const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
367
367
  let previousColHeaderHeight;
368
368
  let currentHeader;
369
369
  let currentHeaderHeight;
@@ -641,8 +641,9 @@ class Table {
641
641
  return;
642
642
  }
643
643
  let rowCount = this.TBODY.childNodes.length;
644
- const expectedTableHeight = rowCount * this.wtSettings.getSetting('defaultRowHeight');
644
+ const expectedTableHeight = rowCount * this.wot.stylesHandler.getDefaultRowHeight();
645
645
  const actualTableHeight = innerHeight(this.TBODY) - 1;
646
+ const rowHeightFn = this.wot.stylesHandler.getStyleForTD('box-sizing') === 'border-box' ? outerHeight : innerHeight;
646
647
  let previousRowHeight;
647
648
  let rowInnerHeight;
648
649
  let sourceRowIndex;
@@ -659,11 +660,11 @@ class Table {
659
660
  currentTr = this.getTrForRow(sourceRowIndex);
660
661
  rowHeader = currentTr.querySelector('th');
661
662
  if (rowHeader) {
662
- rowInnerHeight = innerHeight(rowHeader);
663
+ rowInnerHeight = rowHeightFn(rowHeader);
663
664
  } else {
664
- rowInnerHeight = innerHeight(currentTr) - 1;
665
+ rowInnerHeight = rowHeightFn(currentTr) - 1;
665
666
  }
666
- if (!previousRowHeight && this.wtSettings.getSetting('defaultRowHeight') < rowInnerHeight || previousRowHeight < rowInnerHeight) {
667
+ if (!previousRowHeight && this.wot.stylesHandler.getDefaultRowHeight() < rowInnerHeight || previousRowHeight < rowInnerHeight) {
667
668
  rowInnerHeight += 1;
668
669
  this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight;
669
670
  }
@@ -77,7 +77,7 @@ class ColumnUtils {
77
77
  * @returns {number}
78
78
  */
79
79
  getHeaderHeight(level) {
80
- let height = this.wtSettings.getSetting('defaultRowHeight');
80
+ let height = this.dataAccessObject.wot.stylesHandler.getDefaultRowHeight();
81
81
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
82
82
  if (oversizedHeight !== undefined) {
83
83
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -74,7 +74,7 @@ export default class ColumnUtils {
74
74
  * @returns {number}
75
75
  */
76
76
  getHeaderHeight(level) {
77
- let height = this.wtSettings.getSetting('defaultRowHeight');
77
+ let height = this.dataAccessObject.wot.stylesHandler.getDefaultRowHeight();
78
78
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
79
79
  if (oversizedHeight !== undefined) {
80
80
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
6
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
7
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
8
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
9
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
10
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
11
+ var _rootElement = /*#__PURE__*/new WeakMap();
12
+ var _rootComputedStyle = /*#__PURE__*/new WeakMap();
13
+ var _rootDocument = /*#__PURE__*/new WeakMap();
14
+ var _isClassicTheme = /*#__PURE__*/new WeakMap();
15
+ var _cssVars = /*#__PURE__*/new WeakMap();
16
+ var _computedStyles = /*#__PURE__*/new WeakMap();
17
+ var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
18
+ /**
19
+ * Handles the theme-related style operations.
20
+ */
21
+ class StylesHandler {
22
+ /**
23
+ * Initializes a new instance of the `StylesHandler` class.
24
+ *
25
+ * @param {object} domBindings - The DOM bindings for the instance.
26
+ */
27
+ constructor(domBindings) {
28
+ var _classPrivateFieldGet2;
29
+ /**
30
+ * Retrieves and processes the computed styles for a `td` element.
31
+ *
32
+ * This method creates a temporary table structure, appends it to the root element,
33
+ * retrieves the computed styles for the `td` element, and then removes the table
34
+ * from the DOM. The computed styles are passed to the provided callback function.
35
+ *
36
+ * @param {Function} getterCallback - A callback function that processes the computed styles.
37
+ * It receives a `CSSStyleDeclaration` object as its argument.
38
+ * @private
39
+ */
40
+ _classPrivateMethodInitSpec(this, _StylesHandler_brand);
41
+ /**
42
+ * The instance's root element.
43
+ *
44
+ * @type {HTMLElement}
45
+ */
46
+ _classPrivateFieldInitSpec(this, _rootElement, void 0);
47
+ /**
48
+ * The computed style of the root element.
49
+ *
50
+ * @type {CSSStyleDeclaration}
51
+ * @private
52
+ */
53
+ _classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
54
+ /**
55
+ * The root document of the instance.
56
+ *
57
+ * @type {Document}
58
+ * @private
59
+ */
60
+ _classPrivateFieldInitSpec(this, _rootDocument, void 0);
61
+ /**
62
+ * `true` if the classic theme is enabled, `false` otherwise.
63
+ *
64
+ * @type {boolean}
65
+ */
66
+ _classPrivateFieldInitSpec(this, _isClassicTheme, false);
67
+ /**
68
+ * An object to store CSS variable values.
69
+ *
70
+ * @type {object}
71
+ * @private
72
+ */
73
+ _classPrivateFieldInitSpec(this, _cssVars, {});
74
+ /**
75
+ * Stores the computed styles for various elements.
76
+ *
77
+ * @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
78
+ * @private
79
+ */
80
+ _classPrivateFieldInitSpec(this, _computedStyles, {});
81
+ _classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement);
82
+ _classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
83
+ _classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
84
+ if (((_classPrivateFieldGet2 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.getPropertyValue('--ht-line-height')) === '') {
85
+ _classPrivateFieldSet(_isClassicTheme, this, true);
86
+ }
87
+
88
+ // Some of the properties are not stored in the CSS variables, so we need to get them from the computed style.
89
+ _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, computedStyle => {
90
+ _classPrivateFieldSet(_computedStyles, this, {
91
+ ..._classPrivateFieldGet(_computedStyles, this),
92
+ ...{
93
+ td: {
94
+ 'box-sizing': computedStyle['box-sizing'],
95
+ 'border-top-width': parseInt(computedStyle['border-top-width'], 10),
96
+ 'border-bottom-width': parseInt(computedStyle['border-bottom-width'], 10)
97
+ }
98
+ }
99
+ });
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Gets the value indicating whether the classic theme is enabled.
105
+ *
106
+ * @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
107
+ */
108
+ isClassicTheme() {
109
+ return _classPrivateFieldGet(_isClassicTheme, this);
110
+ }
111
+
112
+ /**
113
+ * Retrieves the value of a specified CSS variable.
114
+ *
115
+ * @param {string} variableName - The name of the CSS variable to retrieve.
116
+ * @returns {number|string|undefined} The value of the specified CSS variable, or `undefined` if not found.
117
+ */
118
+ getCSSVariableValue(variableName) {
119
+ if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
120
+ return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
121
+ }
122
+ const acquiredValue = _assertClassBrand(_StylesHandler_brand, this, _getParsedCSSValue).call(this, `--ht-${variableName}`);
123
+ if (acquiredValue && acquiredValue !== '') {
124
+ _classPrivateFieldSet(_cssVars, this, {
125
+ ..._classPrivateFieldGet(_cssVars, this),
126
+ ...{
127
+ [variableName]: acquiredValue
128
+ }
129
+ });
130
+ return acquiredValue;
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Retrieves the computed style value for a specified CSS property of a `td` element.
136
+ *
137
+ * @param {string} cssProperty - The CSS property to retrieve the value for.
138
+ * @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
139
+ */
140
+ getStyleForTD(cssProperty) {
141
+ var _classPrivateFieldGet3;
142
+ const value = (_classPrivateFieldGet3 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.td[cssProperty];
143
+ if (value !== undefined && value !== '') {
144
+ return value;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Calculates the row height based on the current theme and CSS variables.
150
+ *
151
+ * @returns {number} The calculated row height.
152
+ */
153
+ getDefaultRowHeight() {
154
+ if (_classPrivateFieldGet(_isClassicTheme, this)) {
155
+ return 23;
156
+ }
157
+ return this.getStyleForTD('border-top-width') + this.getCSSVariableValue('cell-vertical-padding') * 2 + this.getCSSVariableValue('line-height') + this.getStyleForTD('border-bottom-width');
158
+ }
159
+ }
160
+ exports.StylesHandler = StylesHandler;
161
+ function _getStylesForTD(getterCallback) {
162
+ const table = _classPrivateFieldGet(_rootDocument, this).createElement('table');
163
+ const tbody = _classPrivateFieldGet(_rootDocument, this).createElement('tbody');
164
+ const tr = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
165
+ // This needs not to be the first row in order to get "regular" vaules.
166
+ const tr2 = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
167
+ const td = _classPrivateFieldGet(_rootDocument, this).createElement('td');
168
+ tr2.appendChild(td);
169
+ tbody.appendChild(tr);
170
+ tbody.appendChild(tr2);
171
+ table.appendChild(tbody);
172
+ _classPrivateFieldGet(_rootElement, this).appendChild(table);
173
+ getterCallback(getComputedStyle(td));
174
+ _classPrivateFieldGet(_rootElement, this).removeChild(table);
175
+ }
176
+ /**
177
+ * Parses the value of a specified CSS property from the root element's computed style.
178
+ *
179
+ * @param {string} property - The CSS property to retrieve and parse.
180
+ * @returns {number|string} The parsed value of the CSS property.
181
+ */
182
+ function _getParsedCSSValue(property) {
183
+ var _classPrivateFieldGet4;
184
+ return parseInt((_classPrivateFieldGet4 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.getPropertyValue(property), 10);
185
+ }