@toolbox-web/grid 0.4.2 → 0.5.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 (118) hide show
  1. package/README.md +1 -2
  2. package/all.js +1060 -1023
  3. package/all.js.map +1 -1
  4. package/index.js +588 -502
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +11 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/dom-builder.d.ts +2 -0
  9. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  10. package/lib/core/internal/header.d.ts.map +1 -1
  11. package/lib/core/internal/resize.d.ts.map +1 -1
  12. package/lib/core/internal/rows.d.ts.map +1 -1
  13. package/lib/core/internal/shell.d.ts +19 -13
  14. package/lib/core/internal/shell.d.ts.map +1 -1
  15. package/lib/core/plugin/base-plugin.d.ts +13 -2
  16. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  17. package/lib/core/plugin/expander-column.d.ts.map +1 -1
  18. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  19. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  20. package/lib/core/types.d.ts +6 -3
  21. package/lib/core/types.d.ts.map +1 -1
  22. package/lib/plugins/clipboard/index.js +22 -11
  23. package/lib/plugins/clipboard/index.js.map +1 -1
  24. package/lib/plugins/column-virtualization/index.js +59 -48
  25. package/lib/plugins/column-virtualization/index.js.map +1 -1
  26. package/lib/plugins/context-menu/index.js +71 -60
  27. package/lib/plugins/context-menu/index.js.map +1 -1
  28. package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
  29. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  30. package/lib/plugins/editing/index.js +93 -80
  31. package/lib/plugins/editing/index.js.map +1 -1
  32. package/lib/plugins/export/index.js +29 -18
  33. package/lib/plugins/export/index.js.map +1 -1
  34. package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
  35. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  36. package/lib/plugins/filtering/index.js +199 -165
  37. package/lib/plugins/filtering/index.js.map +1 -1
  38. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
  39. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  40. package/lib/plugins/grouping-columns/index.js +79 -49
  41. package/lib/plugins/grouping-columns/index.js.map +1 -1
  42. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  43. package/lib/plugins/grouping-rows/index.js +98 -87
  44. package/lib/plugins/grouping-rows/index.js.map +1 -1
  45. package/lib/plugins/master-detail/index.js +70 -57
  46. package/lib/plugins/master-detail/index.js.map +1 -1
  47. package/lib/plugins/multi-sort/index.js +48 -37
  48. package/lib/plugins/multi-sort/index.js.map +1 -1
  49. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  50. package/lib/plugins/pinned-columns/index.js +71 -66
  51. package/lib/plugins/pinned-columns/index.js.map +1 -1
  52. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  53. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  54. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  55. package/lib/plugins/pinned-rows/index.js +63 -52
  56. package/lib/plugins/pinned-rows/index.js.map +1 -1
  57. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  58. package/lib/plugins/pivot/index.js +310 -299
  59. package/lib/plugins/pivot/index.js.map +1 -1
  60. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  61. package/lib/plugins/reorder/index.d.ts +1 -1
  62. package/lib/plugins/reorder/index.d.ts.map +1 -1
  63. package/lib/plugins/reorder/index.js +79 -68
  64. package/lib/plugins/reorder/index.js.map +1 -1
  65. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  66. package/lib/plugins/selection/index.js +115 -105
  67. package/lib/plugins/selection/index.js.map +1 -1
  68. package/lib/plugins/server-side/index.js +15 -4
  69. package/lib/plugins/server-side/index.js.map +1 -1
  70. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  71. package/lib/plugins/tree/index.js +41 -30
  72. package/lib/plugins/tree/index.js.map +1 -1
  73. package/lib/plugins/undo-redo/index.js +29 -18
  74. package/lib/plugins/undo-redo/index.js.map +1 -1
  75. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  76. package/lib/plugins/visibility/index.js +59 -47
  77. package/lib/plugins/visibility/index.js.map +1 -1
  78. package/package.json +1 -1
  79. package/themes/dg-theme-bootstrap.css +55 -53
  80. package/themes/dg-theme-contrast.css +42 -40
  81. package/themes/dg-theme-large.css +38 -37
  82. package/themes/dg-theme-material.css +54 -52
  83. package/themes/dg-theme-standard.css +19 -17
  84. package/themes/dg-theme-vibrant.css +16 -14
  85. package/umd/grid.all.umd.js +23 -22
  86. package/umd/grid.all.umd.js.map +1 -1
  87. package/umd/grid.umd.js +12 -11
  88. package/umd/grid.umd.js.map +1 -1
  89. package/umd/plugins/column-virtualization.umd.js +1 -1
  90. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  91. package/umd/plugins/context-menu.umd.js +1 -1
  92. package/umd/plugins/context-menu.umd.js.map +1 -1
  93. package/umd/plugins/editing.umd.js +1 -1
  94. package/umd/plugins/editing.umd.js.map +1 -1
  95. package/umd/plugins/filtering.umd.js +1 -1
  96. package/umd/plugins/filtering.umd.js.map +1 -1
  97. package/umd/plugins/grouping-columns.umd.js +1 -1
  98. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  99. package/umd/plugins/grouping-rows.umd.js +1 -1
  100. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  101. package/umd/plugins/master-detail.umd.js +1 -1
  102. package/umd/plugins/master-detail.umd.js.map +1 -1
  103. package/umd/plugins/multi-sort.umd.js +1 -1
  104. package/umd/plugins/multi-sort.umd.js.map +1 -1
  105. package/umd/plugins/pinned-columns.umd.js +1 -1
  106. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  107. package/umd/plugins/pinned-rows.umd.js +1 -1
  108. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  109. package/umd/plugins/pivot.umd.js +1 -1
  110. package/umd/plugins/pivot.umd.js.map +1 -1
  111. package/umd/plugins/reorder.umd.js +1 -1
  112. package/umd/plugins/reorder.umd.js.map +1 -1
  113. package/umd/plugins/selection.umd.js +1 -1
  114. package/umd/plugins/selection.umd.js.map +1 -1
  115. package/umd/plugins/tree.umd.js +1 -1
  116. package/umd/plugins/tree.umd.js.map +1 -1
  117. package/umd/plugins/visibility.umd.js +1 -1
  118. package/umd/plugins/visibility.umd.js.map +1 -1
package/index.js CHANGED
@@ -1,11 +1,11 @@
1
- const te = ':root{color-scheme:light dark}:host{--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #adacac);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: 2px 8px;--tbw-cell-padding: 2px 8px;--tbw-cell-padding-input: 2px 6px;--tbw-row-height: 28px;--tbw-header-height: 30px;--tbw-cell-white-space: nowrap;--tbw-border-radius: 4px;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: 6px;--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-checkbox-size: 16px;--tbw-density-scale: 1}:host{position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none}:host,:host *{box-sizing:border-box}:host .header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}:host .header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}:host .header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start))}:host .header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30)}:host .header-row>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}:host .header-row>.cell>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .header-row>.cell>span[part~=sort-indicator]{flex-shrink:0;opacity:.6}:host .header-row>.cell:last-child{border-right:0}:host .header-group-cell:not(:last-child),:host .header-row>.cell.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}:host .tbw-grid-root{display:flex;flex-direction:column;height:100%}:host .rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}:host .rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}:host .rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}:host .rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip}:host .faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}:host .faux-vscroll-spacer{width:1px}:host .rows-viewport .rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}:host .data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height)}:host .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}:host .selecting .data-grid-row>.cell{user-select:none}:host .data-grid-row>.cell.selected:focus-visible,:host .data-grid-row>.cell:focus-visible:not(.cell-focus){outline:none}:host .data-grid-row>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis}:host .data-grid-row>.cell>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}:host .data-grid-row>.cell:last-child{border-right:0}:host .data-grid-row>.cell[data-type=boolean]{text-align:center}:host .data-grid-row>.cell[data-type=boolean] input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}:host .data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px)}:host .data-grid-row>.cell.editing input:not([type=checkbox]),:host .data-grid-row>.cell.editing select,:host .data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}:host .data-grid-row:nth-child(2n){background:var(--tbw-color-row-alt)}:host .data-grid-row:hover{background:var(--tbw-color-row-hover)}:host .sortable{cursor:pointer;user-select:none}:host .header-row>.cell.resizable{position:relative}:host .tbw-editor-host{display:contents}:host .resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius)}:host .resize-handle:hover{background:var(--tbw-resize-handle-color-hover)}:host([data-has-focus]) .cell-focus,:host([data-has-focus]) .row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}:host .sticky-left,:host .sticky-right{position:sticky;z-index:25}:host .header-row>.cell.sticky-left,:host .header-row>.cell.sticky-right{background:var(--tbw-color-header-bg);z-index:35}:host .data-grid-row>.cell.sticky-left,:host .data-grid-row>.cell.sticky-right{background:var(--tbw-color-panel-bg)}:host .sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}:host .sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}:host{--tbw-shell-header-height: 44px;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: 14px;--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 280px;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 40px;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 32px;--tbw-toolbar-button-gap: 4px}:host .tbw-grid-root.has-shell{display:flex;flex-direction:column;height:100%}:host .tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}:host .tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}:host .tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}:host .tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease)}:host .tbw-toolbar-btn:hover{background:var(--tbw-color-row-hover)}:host .tbw-toolbar-btn:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}:host .tbw-toolbar-btn.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}:host .tbw-toolbar-btn:disabled{opacity:.5;cursor:not-allowed}:host .tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}:host .tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}:host .tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}:host .tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}:host .tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow)}:host .tbw-tool-panel[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}:host .tbw-tool-panel.open{width:var(--tbw-tool-panel-width)}:host .tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease)}:host .tbw-tool-panel-resize[data-handle-position=left]{left:0}:host .tbw-tool-panel-resize[data-handle-position=right]{right:0}:host .tbw-tool-panel-resize:hover,:host .tbw-tool-panel-resize.resizing{background:var(--tbw-color-accent)}:host .tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}:host .tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px}:host .tbw-tool-panel-close:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}:host .tbw-tool-panel-content{flex:1;overflow:auto}:host .tbw-accordion{display:flex;flex-direction:column;gap:0}:host .tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border)}:host .tbw-accordion-section:last-child{border-bottom:none}:host .tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none}:host .tbw-accordion-header:hover{background:var(--tbw-color-row-hover)}:host .tbw-accordion-section.single .tbw-accordion-header{cursor:default}:host .tbw-accordion-section.single .tbw-accordion-header:hover{background:transparent}:host .tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}:host .tbw-accordion-section.expanded .tbw-accordion-chevron{transform:rotate(90deg)}:host .tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}:host .tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .tbw-accordion-content{display:none}:host .tbw-accordion-section.expanded .tbw-accordion-content{display:block}@media(forced-colors:active){:host{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight}:host .cell:focus,:host .cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}:host .data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}@media(prefers-reduced-motion:reduce){:host([data-animation-mode="reduced-motion"]){--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms}}:host([data-animation-mode="off"]){--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms}:host .tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}:host .tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}', W = {
1
+ const te = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-scheme:light dark}tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}}', W = {
2
2
  STRETCH: "stretch",
3
3
  FIXED: "fixed"
4
- }, Me = {
4
+ }, De = {
5
5
  mode: "reduced-motion",
6
6
  duration: 200,
7
7
  easing: "ease-out"
8
- }, L = {
8
+ }, H = {
9
9
  expand: "▶",
10
10
  collapse: "▼",
11
11
  sortAsc: "▲",
@@ -15,7 +15,7 @@ const te = ':root{color-scheme:light dark}:host{--tbw-color-bg: transparent;--tb
15
15
  dragHandle: "⋮⋮",
16
16
  toolPanel: "☰"
17
17
  };
18
- function ze(t) {
18
+ function Me(t) {
19
19
  return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
20
20
  const i = o.getAttribute("field") || "";
21
21
  if (!i) return null;
@@ -34,19 +34,19 @@ function ze(t) {
34
34
  p && (h.__editorName = p), u && (h.__rendererName = u);
35
35
  const g = o.getAttribute("options");
36
36
  g && (h.options = g.split(",").map((v) => {
37
- const [Y, De] = v.includes(":") ? v.split(":") : [v.trim(), v.trim()];
38
- return { value: Y.trim(), label: De?.trim() || Y.trim() };
37
+ const [Y, Oe] = v.includes(":") ? v.split(":") : [v.trim(), v.trim()];
38
+ return { value: Y.trim(), label: Oe?.trim() || Y.trim() };
39
39
  }));
40
- const m = o.querySelector("tbw-grid-column-view"), b = o.querySelector("tbw-grid-column-editor"), _ = o.querySelector("tbw-grid-column-header");
41
- m && (h.__viewTemplate = m), b && (h.__editorTemplate = b), _ && (h.__headerTemplate = _);
42
- const C = globalThis.DataGridElement?.getAdapters?.() ?? [], y = m ?? o, R = C.find((v) => v.canHandle(y));
40
+ const b = o.querySelector("tbw-grid-column-view"), C = o.querySelector("tbw-grid-column-editor"), y = o.querySelector("tbw-grid-column-header");
41
+ b && (h.__viewTemplate = b), C && (h.__editorTemplate = C), y && (h.__headerTemplate = y);
42
+ const w = globalThis.DataGridElement?.getAdapters?.() ?? [], _ = b ?? o, R = w.find((v) => v.canHandle(_));
43
43
  if (R) {
44
- const v = R.createRenderer(y);
44
+ const v = R.createRenderer(_);
45
45
  v && (h.viewRenderer = v);
46
46
  }
47
- const U = b ?? o, x = C.find((v) => v.canHandle(U));
48
- if (x) {
49
- const v = x.createEditor(U);
47
+ const $ = C ?? o, A = w.find((v) => v.canHandle($));
48
+ if (A) {
49
+ const v = A.createEditor($);
50
50
  v && (h.editor = v);
51
51
  }
52
52
  return h;
@@ -111,23 +111,23 @@ function q(t) {
111
111
  return i != null ? `minmax(${i}px, 1fr)` : "1fr";
112
112
  }).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((o) => o.width ? `${o.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
113
113
  }
114
- function Ne(t) {
114
+ function ze(t) {
115
115
  return t == null ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t instanceof Date || typeof t == "string" && /\d{4}-\d{2}-\d{2}/.test(t) && !isNaN(Date.parse(t)) ? "date" : "string";
116
116
  }
117
- function ke(t, e) {
117
+ function Ne(t, e) {
118
118
  const o = t[0] || {}, i = Object.keys(o).map((r) => {
119
- const s = o[r], l = Ne(s);
119
+ const s = o[r], l = ze(s);
120
120
  return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
121
121
  }), n = {};
122
122
  return i.forEach((r) => {
123
123
  n[r.field] = r.type || "string";
124
124
  }), { columns: i, typeMap: n };
125
125
  }
126
- const Ie = /{{\s*([^}]+)\s*}}/g, A = "__DG_EMPTY__", qe = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Be = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
127
- function We(t) {
126
+ const ke = /{{\s*([^}]+)\s*}}/g, P = "__DG_EMPTY__", Ie = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, qe = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
127
+ function Be(t) {
128
128
  return !t || typeof t != "string" ? "" : t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
129
129
  }
130
- const Ue = /* @__PURE__ */ new Set([
130
+ const We = /* @__PURE__ */ new Set([
131
131
  "script",
132
132
  "iframe",
133
133
  "object",
@@ -152,18 +152,18 @@ const Ue = /* @__PURE__ */ new Set([
152
152
  "plaintext",
153
153
  "xmp",
154
154
  "listing"
155
- ]), re = /^on\w+$/i, $e = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Fe = /^\s*(javascript|vbscript|data|blob):/i;
155
+ ]), re = /^on\w+$/i, $e = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Ue = /^\s*(javascript|vbscript|data|blob):/i;
156
156
  function G(t) {
157
157
  if (!t || typeof t != "string") return "";
158
158
  if (t.indexOf("<") === -1) return t;
159
159
  const e = document.createElement("template");
160
- return e.innerHTML = t, Ve(e.content), e.innerHTML;
160
+ return e.innerHTML = t, Fe(e.content), e.innerHTML;
161
161
  }
162
- function Ve(t) {
162
+ function Fe(t) {
163
163
  const e = [], o = t.querySelectorAll("*");
164
164
  for (const i of o) {
165
165
  const n = i.tagName.toLowerCase();
166
- if (Ue.has(n)) {
166
+ if (We.has(n)) {
167
167
  e.push(i);
168
168
  continue;
169
169
  }
@@ -180,7 +180,7 @@ function Ve(t) {
180
180
  r.push(s.name);
181
181
  continue;
182
182
  }
183
- if ($e.has(l) && Fe.test(s.value)) {
183
+ if ($e.has(l) && Ue.test(s.value)) {
184
184
  r.push(s.name);
185
185
  continue;
186
186
  }
@@ -193,35 +193,35 @@ function Ve(t) {
193
193
  }
194
194
  e.forEach((i) => i.remove());
195
195
  }
196
- function ve(t, e) {
196
+ function we(t, e) {
197
197
  if (!t || t.indexOf("{{") === -1) return t;
198
- const o = [], i = t.replace(Ie, (l, a) => {
199
- const c = Ge(a, e);
198
+ const o = [], i = t.replace(ke, (l, a) => {
199
+ const c = Ve(a, e);
200
200
  return o.push({ expr: a.trim(), result: c }), c;
201
- }), n = Xe(i), r = o.length && o.every((l) => l.result === "" || l.result === A);
201
+ }), n = Ge(i), r = o.length && o.every((l) => l.result === "" || l.result === P);
202
202
  return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : n;
203
203
  }
204
- function Ge(t, e) {
205
- if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return A;
206
- if (t === "value") return e.value == null ? A : String(e.value);
204
+ function Ve(t, e) {
205
+ if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return P;
206
+ if (t === "value") return e.value == null ? P : String(e.value);
207
207
  if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
208
208
  const i = t.slice(4), n = e.row ? e.row[i] : void 0;
209
- return n == null ? A : String(n);
209
+ return n == null ? P : String(n);
210
210
  }
211
- if (t.length > 80 || !qe.test(t) || Be.test(t)) return A;
211
+ if (t.length > 80 || !Ie.test(t) || qe.test(t)) return P;
212
212
  const o = t.match(/\./g);
213
- if (o && o.length > 1) return A;
213
+ if (o && o.length > 1) return P;
214
214
  try {
215
215
  const n = new Function("value", "row", `return (${t});`)(e.value, e.row), r = n == null ? "" : String(n);
216
- return /Reflect|Proxy|ownKeys/.test(r) ? A : r || A;
216
+ return /Reflect|Proxy|ownKeys/.test(r) ? P : r || P;
217
217
  } catch {
218
- return A;
218
+ return P;
219
219
  }
220
220
  }
221
- function Xe(t) {
222
- return t && t.replace(new RegExp(A, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
221
+ function Ge(t) {
222
+ return t && t.replace(new RegExp(P, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
223
223
  }
224
- function Ye(t) {
224
+ function Xe(t) {
225
225
  if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
226
226
  if (Array.from(t.childNodes).forEach((e) => {
227
227
  e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
@@ -234,11 +234,11 @@ function Ye(t) {
234
234
  }
235
235
  }
236
236
  function se(t) {
237
- const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((i) => e ? "" : ve(t, i));
237
+ const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((i) => e ? "" : we(t, i));
238
238
  return o.__blocked = e, o;
239
239
  }
240
- const je = 100;
241
- class Ke {
240
+ const Ye = 100;
241
+ class je {
242
242
  // ============================================================================
243
243
  // Sources (raw input from user)
244
244
  // ============================================================================
@@ -270,11 +270,11 @@ class Ke {
270
270
  #p = !0;
271
271
  #l = [];
272
272
  #v;
273
- #w;
273
+ #m;
274
274
  #b;
275
275
  #s;
276
276
  // Shell state (Light DOM title)
277
- #m;
277
+ #w;
278
278
  constructor(e) {
279
279
  this.#s = e;
280
280
  }
@@ -315,11 +315,11 @@ class Ke {
315
315
  }
316
316
  /** Get light DOM title */
317
317
  get lightDomTitle() {
318
- return this.#m;
318
+ return this.#w;
319
319
  }
320
320
  /** Set light DOM title */
321
321
  set lightDomTitle(e) {
322
- this.#m = e;
322
+ this.#w = e;
323
323
  }
324
324
  /** Get initial column state */
325
325
  get initialColumnState() {
@@ -403,7 +403,7 @@ class Ke {
403
403
  const e = (this.#u.columns?.length ?? 0) > 0;
404
404
  if (!this.#p && e)
405
405
  return;
406
- const o = this.#_();
406
+ const o = this.#y();
407
407
  this.#p = !1, this.#h = o, Object.freeze(this.#h), this.#h.columns && Object.freeze(this.#h.columns), this.#u = this.#A(this.#h), this.#g();
408
408
  }
409
409
  /**
@@ -445,7 +445,7 @@ class Ke {
445
445
  *
446
446
  * Runtime state (hidden, width) is NOT preserved here - that's in effectiveConfig.
447
447
  */
448
- #_() {
448
+ #y() {
449
449
  const e = this.#o ? { ...this.#o } : {}, o = Array.isArray(e.columns) ? [...e.columns] : [], i = (this.#r ?? []).map((s) => ({
450
450
  ...s
451
451
  }));
@@ -458,11 +458,11 @@ class Ke {
458
458
  i
459
459
  ));
460
460
  const r = this.#s.getRows();
461
- return n.length === 0 && r.length && (n = ke(r).columns), n.length && (n.forEach((s) => {
461
+ return n.length === 0 && r.length && (n = Ne(r).columns), n.length && (n.forEach((s) => {
462
462
  s.sortable === void 0 && (s.sortable = !0), s.resizable === void 0 && (s.resizable = !0), s.__originalWidth === void 0 && typeof s.width == "number" && (s.__originalWidth = s.width);
463
463
  }), n.forEach((s) => {
464
464
  s.__viewTemplate && !s.__compiledView && (s.__compiledView = se(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = se(s.__editorTemplate.innerHTML));
465
- }), e.columns = n), this.#f && (e.fitMode = this.#f), e.fitMode || (e.fitMode = "stretch"), this.#d && (e.editOn = this.#d), this.#y(e), e.columnState && !this.#b && (this.#b = e.columnState), e;
465
+ }), e.columns = n), this.#f && (e.fitMode = this.#f), e.fitMode || (e.fitMode = "stretch"), this.#d && (e.editOn = this.#d), this.#_(e), e.columnState && !this.#b && (this.#b = e.columnState), e;
466
466
  }
467
467
  /**
468
468
  * Merge shell state into base config's shell property.
@@ -471,10 +471,10 @@ class Ke {
471
471
  * IMPORTANT: This method must NOT mutate the original gridConfig.
472
472
  * We shallow-clone the shell hierarchy to avoid side effects.
473
473
  */
474
- #y(e) {
474
+ #_(e) {
475
475
  e.shell = e.shell ? { ...e.shell } : {}, e.shell.header = e.shell.header ? { ...e.shell.header } : {};
476
476
  const o = this.#s.getShellLightDomTitle();
477
- o && (this.#m = o), this.#m && !e.shell.header.title && (e.shell.header.title = this.#m);
477
+ o && (this.#w = o), this.#w && !e.shell.header.title && (e.shell.header.title = this.#w);
478
478
  const i = this.#s.getShellLightDomHeaderContent();
479
479
  i?.length > 0 && (e.shell.header.lightDomContent = i), this.#s.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
480
480
  const n = this.#s.getShellToolPanels();
@@ -582,11 +582,11 @@ class Ke {
582
582
  * Request a debounced state change event.
583
583
  */
584
584
  requestStateChange(e) {
585
- this.#w && clearTimeout(this.#w), this.#w = setTimeout(() => {
586
- this.#w = void 0;
585
+ this.#m && clearTimeout(this.#m), this.#m = setTimeout(() => {
586
+ this.#m = void 0;
587
587
  const o = this.collectState(e);
588
588
  this.#s.emit("column-state-change", o);
589
- }, je);
589
+ }, Ye);
590
590
  }
591
591
  // ============================================================================
592
592
  // Column Visibility API
@@ -665,7 +665,7 @@ class Ke {
665
665
  * Parse light DOM columns from host element.
666
666
  */
667
667
  parseLightDomColumns(e) {
668
- this.#r || (this.#n = Array.from(e.querySelectorAll("tbw-grid-column")), this.#r = this.#n.length ? ze(e) : []);
668
+ this.#r || (this.#n = Array.from(e.querySelectorAll("tbw-grid-column")), this.#r = this.#n.length ? Me(e) : []);
669
669
  }
670
670
  /**
671
671
  * Clear the light DOM columns cache.
@@ -765,13 +765,13 @@ class Ke {
765
765
  * Dispose of the ConfigManager and clean up resources.
766
766
  */
767
767
  dispose() {
768
- this.#v?.disconnect(), this.#l = [], this.#w && clearTimeout(this.#w);
768
+ this.#v?.disconnect(), this.#l = [], this.#m && clearTimeout(this.#m);
769
769
  }
770
770
  }
771
- function Ce(t) {
771
+ function ve(t) {
772
772
  return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "&#x1F5F9;" : "&#9744;"}</span>`;
773
773
  }
774
- function _e(t) {
774
+ function Ce(t) {
775
775
  if (t == null || t === "") return "";
776
776
  if (t instanceof Date)
777
777
  return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
@@ -794,7 +794,7 @@ function ye(t) {
794
794
  if (n[r] === o) return r;
795
795
  return -1;
796
796
  }
797
- function Ze(t) {
797
+ function Ke(t) {
798
798
  if (!t) return -1;
799
799
  const e = t.getAttribute("data-col");
800
800
  return e ? parseInt(e, 10) : -1;
@@ -802,25 +802,25 @@ function Ze(t) {
802
802
  function ee(t) {
803
803
  t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
804
804
  }
805
- function Je(t, e) {
806
- const o = ye(e), i = Ze(e);
805
+ function Ze(t, e) {
806
+ const o = ye(e), i = Ke(e);
807
807
  o < 0 || i < 0 || (t._focusRow = o, t._focusCol = i, ee(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
808
808
  }
809
- function Qe(t, e, o) {
809
+ function Je(t, e, o) {
810
810
  e.addEventListener(
811
811
  "mousedown",
812
812
  (i) => {
813
813
  const n = i.target.closest(".cell[data-col]");
814
- n && (n.classList.contains("editing") || Je(t, n));
814
+ n && (n.classList.contains("editing") || Ze(t, n));
815
815
  },
816
816
  { signal: o }
817
817
  );
818
818
  }
819
- function et(t, e) {
819
+ function Qe(t, e) {
820
820
  return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
821
821
  }
822
- function tt(t, e, o) {
823
- const n = o.find((l) => l.field === e.field)?.sortComparator ?? et, { field: r, direction: s } = e;
822
+ function et(t, e, o) {
823
+ const n = o.find((l) => l.field === e.field)?.sortComparator ?? Qe, { field: r, direction: s } = e;
824
824
  return [...t].sort((l, a) => n(l[r], a[r], l, a) * s);
825
825
  }
826
826
  function le(t, e, o, i) {
@@ -837,32 +837,32 @@ function ae(t, e) {
837
837
  }
838
838
  function ce(t, e, o) {
839
839
  t._sortState = { field: e.field, direction: o };
840
- const i = { field: e.field, direction: o }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? tt)(t._rows, i, n);
840
+ const i = { field: e.field, direction: o }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? et)(t._rows, i, n);
841
841
  s && typeof s.then == "function" ? s.then((l) => {
842
842
  le(t, l, e, o);
843
843
  }) : le(t, s, e, o);
844
844
  }
845
- function ot(t, e) {
845
+ function tt(t, e) {
846
846
  typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
847
847
  }
848
848
  function X(t) {
849
849
  t._headerRowEl = t.findHeaderRow();
850
850
  const e = t._headerRowEl;
851
- e.innerHTML = "", t._visibleColumns.forEach((o, i) => {
851
+ e && (e.innerHTML = "", t._visibleColumns.forEach((o, i) => {
852
852
  const n = document.createElement("div");
853
853
  n.className = "cell", ie(n, "header-cell"), n.setAttribute("role", "columnheader"), n.setAttribute("aria-colindex", String(i + 1)), n.setAttribute("data-field", o.field), n.setAttribute("data-col", String(i));
854
854
  const r = o.__headerTemplate;
855
855
  if (r) Array.from(r.childNodes).forEach((s) => n.appendChild(s.cloneNode(!0)));
856
856
  else {
857
- const s = o.header || o.field, l = document.createElement("span");
857
+ const s = o.header ?? o.field, l = document.createElement("span");
858
858
  l.textContent = s, n.appendChild(l);
859
859
  }
860
860
  if (o.sortable) {
861
861
  n.classList.add("sortable"), n.tabIndex = 0;
862
862
  const s = document.createElement("span");
863
863
  ie(s, "sort-indicator");
864
- const l = t._sortState?.field === o.field ? t._sortState.direction : 0, a = { ...L, ...t.icons }, c = l === 1 ? a.sortAsc : l === -1 ? a.sortDesc : a.sortNone;
865
- ot(s, c), n.appendChild(s), n.setAttribute("aria-sort", l === 0 ? "none" : l === 1 ? "ascending" : "descending"), n.addEventListener("click", (h) => {
864
+ const l = t._sortState?.field === o.field ? t._sortState.direction : 0, a = { ...H, ...t.icons }, c = l === 1 ? a.sortAsc : l === -1 ? a.sortDesc : a.sortNone;
865
+ tt(s, c), n.appendChild(s), n.setAttribute("aria-sort", l === 0 ? "none" : l === 1 ? "ascending" : "descending"), n.addEventListener("click", (h) => {
866
866
  t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, i, n) || ae(t, o);
867
867
  }), n.addEventListener("keydown", (h) => {
868
868
  if (h.key === "Enter" || h.key === " ") {
@@ -883,11 +883,11 @@ function X(t) {
883
883
  e.appendChild(n);
884
884
  }), e.querySelectorAll(".cell.sortable").forEach((o) => {
885
885
  o.getAttribute("aria-sort") || o.setAttribute("aria-sort", "none");
886
- }), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex"));
886
+ }), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
887
887
  }
888
- const Ee = typeof requestIdleCallback == "function";
889
- function it(t, e) {
890
- return Ee ? requestIdleCallback(t, e) : window.setTimeout(() => {
888
+ const _e = typeof requestIdleCallback == "function";
889
+ function ot(t, e) {
890
+ return _e ? requestIdleCallback(t, e) : window.setTimeout(() => {
891
891
  const o = Date.now();
892
892
  t({
893
893
  didTimeout: !1,
@@ -896,33 +896,33 @@ function it(t, e) {
896
896
  }, 1);
897
897
  }
898
898
  function de(t) {
899
- Ee ? cancelIdleCallback(t) : clearTimeout(t);
899
+ _e ? cancelIdleCallback(t) : clearTimeout(t);
900
900
  }
901
- const Se = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
901
+ const Ee = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
902
902
  function j(t) {
903
903
  return (t.__editingCellCount ?? 0) > 0;
904
904
  }
905
905
  function K(t) {
906
906
  t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((o) => o.classList.remove("editing"));
907
907
  }
908
- const Re = document.createElement("template");
909
- Re.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
908
+ const Se = document.createElement("template");
909
+ Se.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
910
910
  const Te = document.createElement("template");
911
911
  Te.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
912
- function nt() {
913
- return Re.content.firstElementChild.cloneNode(!0);
912
+ function it() {
913
+ return Se.content.firstElementChild.cloneNode(!0);
914
914
  }
915
- function rt() {
915
+ function nt() {
916
916
  return Te.content.firstElementChild.cloneNode(!0);
917
917
  }
918
- function $(t) {
918
+ function U(t) {
919
919
  t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
920
920
  }
921
- function st(t, e, o, i, n) {
921
+ function rt(t, e, o, i, n) {
922
922
  const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, a = l.length;
923
923
  let c = t.__cachedHeaderRowCount;
924
- for (c === void 0 && (c = t.shadowRoot?.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
925
- const d = rt();
924
+ for (c === void 0 && (c = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
925
+ const d = nt();
926
926
  d.addEventListener("click", (f) => he(t, f, d)), d.addEventListener("dblclick", (f) => he(t, f, d)), t._rowPool.push(d);
927
927
  }
928
928
  if (t._rowPool.length > r) {
@@ -939,27 +939,27 @@ function st(t, e, o, i, n) {
939
939
  u.__epoch = i, u.__rowDataRef = p, u.parentNode !== s && s.appendChild(u);
940
940
  continue;
941
941
  }
942
- const g = u.__epoch, m = u.__rowDataRef, b = u.children.length, w = g === i && b === a, C = m !== p;
943
- let y = !1;
944
- if (w && C) {
945
- for (let x = 0; x < a; x++)
946
- if (l[x].externalView && !u.querySelector(`.cell[data-col="${x}"] [data-external-view]`)) {
947
- y = !0;
942
+ const g = u.__epoch, b = u.__rowDataRef, C = u.children.length, m = g === i && C === a, w = b !== p;
943
+ let _ = !1;
944
+ if (m && w) {
945
+ for (let A = 0; A < a; A++)
946
+ if (l[A].externalView && !u.querySelector(`.cell[data-col="${A}"] [data-external-view]`)) {
947
+ _ = !0;
948
948
  break;
949
949
  }
950
950
  }
951
- if (!w || y) {
952
- const x = j(u), v = t._activeEditRows === f;
953
- x && !v ? (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : x && v ? (Z(t, u, p, f), u.__rowDataRef = p) : (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p);
954
- } else if (C) {
955
- const x = j(u), v = t._activeEditRows === f;
956
- x && !v ? (K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : (Z(t, u, p, f), u.__rowDataRef = p);
951
+ if (!m || _) {
952
+ const A = j(u), v = t._activeEditRows === f;
953
+ A && !v ? (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : A && v ? (Z(t, u, p, f), u.__rowDataRef = p) : (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p);
954
+ } else if (w) {
955
+ const A = j(u), v = t._activeEditRows === f;
956
+ A && !v ? (K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : (Z(t, u, p, f), u.__rowDataRef = p);
957
957
  } else {
958
- const x = j(u), v = t._activeEditRows === f;
959
- x && !v ? (K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : Z(t, u, p, f);
958
+ const A = j(u), v = t._activeEditRows === f;
959
+ A && !v ? (K(u), B(t, u, p, f), u.__epoch = i, u.__rowDataRef = p) : Z(t, u, p, f);
960
960
  }
961
- const R = t._changedRowIndices?.has(f) ?? !1, U = u.classList.contains("changed");
962
- R !== U && u.classList.toggle("changed", R), u.parentNode !== s && s.appendChild(u);
961
+ const R = t._changedRowIndices?.has(f) ?? !1, $ = u.classList.contains("changed");
962
+ R !== $ && u.classList.toggle("changed", R), u.parentNode !== s && s.appendChild(u);
963
963
  }
964
964
  }
965
965
  function Z(t, e, o, i) {
@@ -979,10 +979,12 @@ function Z(t, e, o, i) {
979
979
  const f = String(i);
980
980
  if (!d) {
981
981
  for (let p = 0; p < a; p++) {
982
- const u = n[p], g = o[r[p].field];
982
+ const u = n[p];
983
+ if (u.classList.contains("editing")) continue;
984
+ const g = o[r[p].field];
983
985
  u.textContent = g == null ? "" : String(g), u.getAttribute("data-row") !== f && u.setAttribute("data-row", f);
984
- const m = c === i && h === p, b = u.classList.contains("cell-focus");
985
- m !== b && (u.classList.toggle("cell-focus", m), u.setAttribute("aria-selected", String(m)));
986
+ const b = c === i && h === p, C = u.classList.contains("cell-focus");
987
+ b !== C && (u.classList.toggle("cell-focus", b), u.setAttribute("aria-selected", String(b)));
986
988
  }
987
989
  return;
988
990
  }
@@ -994,53 +996,53 @@ function Z(t, e, o, i) {
994
996
  for (let p = 0; p < a; p++) {
995
997
  const u = r[p], g = n[p];
996
998
  g.getAttribute("data-row") !== f && g.setAttribute("data-row", f);
997
- const m = c === i && h === p, b = g.classList.contains("cell-focus");
998
- if (m !== b && (g.classList.toggle("cell-focus", m), g.setAttribute("aria-selected", String(m))), g.classList.contains("editing")) continue;
999
- const _ = u.renderer || u.viewRenderer;
1000
- if (_) {
1001
- const y = o[u.field], R = _({ row: o, value: y, field: u.field, column: u, cellEl: g });
1002
- typeof R == "string" ? g.innerHTML = G(R) : R instanceof Node ? R.parentElement !== g && (g.innerHTML = "", g.appendChild(R)) : R == null && (g.textContent = y == null ? "" : String(y));
999
+ const b = c === i && h === p, C = g.classList.contains("cell-focus");
1000
+ if (b !== C && (g.classList.toggle("cell-focus", b), g.setAttribute("aria-selected", String(b))), g.classList.contains("editing")) continue;
1001
+ const y = u.renderer || u.viewRenderer;
1002
+ if (y) {
1003
+ const _ = o[u.field], R = y({ row: o, value: _, field: u.field, column: u, cellEl: g });
1004
+ typeof R == "string" ? g.innerHTML = G(R) : R instanceof Node ? R.parentElement !== g && (g.innerHTML = "", g.appendChild(R)) : R == null && (g.textContent = _ == null ? "" : String(_));
1003
1005
  continue;
1004
1006
  }
1005
1007
  if (u.__viewTemplate || u.__compiledView || u.externalView)
1006
1008
  continue;
1007
- const w = o[u.field];
1008
- let C;
1009
+ const m = o[u.field];
1010
+ let w;
1009
1011
  if (u.format)
1010
1012
  try {
1011
- const y = u.format(w, o);
1012
- C = y == null ? "" : String(y);
1013
- } catch (y) {
1014
- console.warn(`[tbw-grid] Format error in column '${u.field}':`, y), C = w == null ? "" : String(w);
1013
+ const _ = u.format(m, o);
1014
+ w = _ == null ? "" : String(_);
1015
+ } catch (_) {
1016
+ console.warn(`[tbw-grid] Format error in column '${u.field}':`, _), w = m == null ? "" : String(m);
1015
1017
  }
1016
- else u.type === "date" ? (C = _e(w), g.textContent = C) : u.type === "boolean" ? g.innerHTML = Ce(!!w) : (C = w == null ? "" : String(w), g.textContent = C);
1018
+ else u.type === "date" ? (w = Ce(m), g.textContent = w) : u.type === "boolean" ? g.innerHTML = ve(!!m) : (w = m == null ? "" : String(m), g.textContent = w);
1017
1019
  }
1018
1020
  }
1019
1021
  function B(t, e, o, i) {
1020
1022
  e.innerHTML = "";
1021
1023
  const n = t._visibleColumns, r = n.length, s = t._focusRow, l = t._focusCol, a = t, c = document.createDocumentFragment();
1022
1024
  for (let h = 0; h < r; h++) {
1023
- const d = n[h], f = nt();
1025
+ const d = n[h], f = it();
1024
1026
  f.setAttribute("aria-colindex", String(h + 1)), f.setAttribute("data-col", String(h)), f.setAttribute("data-row", String(i)), f.setAttribute("data-field", d.field), d.type && f.setAttribute("data-type", d.type);
1025
1027
  let p = o[d.field];
1026
1028
  if (d.format)
1027
1029
  try {
1028
1030
  p = d.format(p, o);
1029
- } catch (w) {
1030
- console.warn(`[tbw-grid] Format error in column '${d.field}':`, w);
1031
+ } catch (m) {
1032
+ console.warn(`[tbw-grid] Format error in column '${d.field}':`, m);
1031
1033
  }
1032
- const u = d.__compiledView, g = d.__viewTemplate, m = d.renderer || d.viewRenderer, b = d.externalView;
1033
- let _ = !1;
1034
- if (m) {
1035
- const w = m({ row: o, value: p, field: d.field, column: d, cellEl: f });
1036
- typeof w == "string" ? (f.innerHTML = G(w), _ = !0) : w instanceof Node ? w.parentElement !== f && (f.textContent = "", f.appendChild(w)) : w == null && (f.textContent = p == null ? "" : String(p));
1037
- } else if (b) {
1038
- const w = b, C = document.createElement("div");
1039
- C.setAttribute("data-external-view", ""), C.setAttribute("data-field", d.field), f.appendChild(C);
1040
- const y = { row: o, value: p, field: d.field, column: d };
1041
- if (w.mount)
1034
+ const u = d.__compiledView, g = d.__viewTemplate, b = d.renderer || d.viewRenderer, C = d.externalView;
1035
+ let y = !1;
1036
+ if (b) {
1037
+ const m = b({ row: o, value: p, field: d.field, column: d, cellEl: f });
1038
+ typeof m == "string" ? (f.innerHTML = G(m), y = !0) : m instanceof Node ? m.parentElement !== f && (f.textContent = "", f.appendChild(m)) : m == null && (f.textContent = p == null ? "" : String(p));
1039
+ } else if (C) {
1040
+ const m = C, w = document.createElement("div");
1041
+ w.setAttribute("data-external-view", ""), w.setAttribute("data-field", d.field), f.appendChild(w);
1042
+ const _ = { row: o, value: p, field: d.field, column: d };
1043
+ if (m.mount)
1042
1044
  try {
1043
- w.mount({ placeholder: C, context: y, spec: w });
1045
+ m.mount({ placeholder: w, context: _, spec: m });
1044
1046
  } catch (R) {
1045
1047
  console.warn(`[tbw-grid] External view mount error for column '${d.field}':`, R);
1046
1048
  }
@@ -1051,26 +1053,26 @@ function B(t, e, o, i) {
1051
1053
  new CustomEvent("mount-external-view", {
1052
1054
  bubbles: !0,
1053
1055
  composed: !0,
1054
- detail: { placeholder: C, spec: w, context: y }
1056
+ detail: { placeholder: w, spec: m, context: _ }
1055
1057
  })
1056
1058
  );
1057
1059
  } catch (R) {
1058
1060
  console.warn(`[tbw-grid] External view event dispatch error for column '${d.field}':`, R);
1059
1061
  }
1060
1062
  });
1061
- C.setAttribute("data-mounted", "");
1063
+ w.setAttribute("data-mounted", "");
1062
1064
  } else if (u) {
1063
- const w = u({ row: o, value: p, field: d.field, column: d }), C = u.__blocked;
1064
- f.innerHTML = C ? "" : G(w), _ = !0, C && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
1065
+ const m = u({ row: o, value: p, field: d.field, column: d }), w = u.__blocked;
1066
+ f.innerHTML = w ? "" : G(m), y = !0, w && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
1065
1067
  } else if (g) {
1066
- const w = g.innerHTML;
1067
- /Reflect\.|\bProxy\b|ownKeys\(/.test(w) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = G(ve(w, { row: o, value: p })), _ = !0);
1068
+ const m = g.innerHTML;
1069
+ /Reflect\.|\bProxy\b|ownKeys\(/.test(m) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = G(we(m, { row: o, value: p })), y = !0);
1068
1070
  } else
1069
- d.type === "date" ? f.textContent = _e(p) : d.type === "boolean" ? f.innerHTML = Ce(!!p) : f.textContent = p == null ? "" : String(p);
1070
- if (_) {
1071
- Ye(f);
1072
- const w = f.textContent || "";
1073
- /Proxy|Reflect\.ownKeys/.test(w) && (f.textContent = w.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
1071
+ d.type === "date" ? f.textContent = Ce(p) : d.type === "boolean" ? f.innerHTML = ve(!!p) : f.textContent = p == null ? "" : String(p);
1072
+ if (y) {
1073
+ Xe(f);
1074
+ const m = f.textContent || "";
1075
+ /Proxy|Reflect\.ownKeys/.test(m) && (f.textContent = m.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
1074
1076
  }
1075
1077
  f.hasAttribute("data-blocked-template") && (f.textContent || "").trim().length && (f.textContent = ""), d.editable ? f.tabIndex = 0 : d.type === "boolean" && (f.hasAttribute("tabindex") || (f.tabIndex = 0)), s === i && l === h ? (f.classList.add("cell-focus"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false"), c.appendChild(f);
1076
1078
  }
@@ -1091,8 +1093,8 @@ function he(t, e, o, i) {
1091
1093
  return;
1092
1094
  const c = t._focusRow !== r || t._focusCol !== a;
1093
1095
  if (t._focusRow = r, t._focusCol = a, l.classList.contains("editing")) {
1094
- c && (ee(t.shadowRoot ?? t._bodyEl), l.classList.add("cell-focus"));
1095
- const h = l.querySelector(Se);
1096
+ c && (ee(t._bodyEl ?? t), l.classList.add("cell-focus"));
1097
+ const h = l.querySelector(Ee);
1096
1098
  try {
1097
1099
  h?.focus({ preventScroll: !0 });
1098
1100
  } catch {
@@ -1103,7 +1105,7 @@ function he(t, e, o, i) {
1103
1105
  }
1104
1106
  }
1105
1107
  }
1106
- function lt(t, e) {
1108
+ function st(t, e) {
1107
1109
  if (t._dispatchKeyDown?.(e))
1108
1110
  return;
1109
1111
  const o = t._rows.length - 1, i = t._visibleColumns.length - 1, n = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (h) => {
@@ -1178,7 +1180,7 @@ function k(t, e) {
1178
1180
  let l = s?.children[t._focusCol];
1179
1181
  if ((!l || !l.classList?.contains("cell")) && (l = s?.querySelector(`.cell[data-col="${t._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), l) {
1180
1182
  l.classList.add("cell-focus"), l.setAttribute("aria-selected", "true");
1181
- const a = t.shadowRoot?.querySelector(".tbw-scroll-area");
1183
+ const a = t.querySelector(".tbw-scroll-area");
1182
1184
  if (a && l && !o)
1183
1185
  if (e?.forceScrollLeft)
1184
1186
  a.scrollLeft = 0;
@@ -1192,7 +1194,7 @@ function k(t, e) {
1192
1194
  }
1193
1195
  }
1194
1196
  if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
1195
- const c = l.querySelector(Se);
1197
+ const c = l.querySelector(Ee);
1196
1198
  if (c && document.activeElement !== c)
1197
1199
  try {
1198
1200
  c.focus({ preventScroll: !0 });
@@ -1209,7 +1211,7 @@ function k(t, e) {
1209
1211
  }
1210
1212
  }
1211
1213
  var S = /* @__PURE__ */ ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(S || {});
1212
- class at {
1214
+ class lt {
1213
1215
  #o;
1214
1216
  /** Current pending phase (0 = none pending) */
1215
1217
  #c = 0;
@@ -1288,7 +1290,7 @@ class at {
1288
1290
  this.#c = 0, e >= 5 && this.#o.mergeConfig(), e >= 4 && this.#o.processRows(), e >= 5 && (this.#o.processColumns(), this.#o.updateTemplate()), e >= 3 && this.#o.renderHeader(), e >= 2 && this.#o.renderVirtualWindow(), e >= 1 && this.#o.afterRender(), !this.#h && this.#n && (this.#h = !0, this.#n()), this.#r && (this.#r(), this.#r = null, this.#d = null);
1289
1291
  }
1290
1292
  }
1291
- function ct(t) {
1293
+ function at(t) {
1292
1294
  let e = null, o = null, i = null, n = null;
1293
1295
  const r = (a) => {
1294
1296
  if (!e) return;
@@ -1312,8 +1314,8 @@ function ct(t) {
1312
1314
  },
1313
1315
  start(a, c, h) {
1314
1316
  a.preventDefault();
1315
- const d = h.getBoundingClientRect();
1316
- e = { startX: a.clientX, colIndex: c, startWidth: d.width }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), i === null && (i = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", n === null && (n = document.body.style.userSelect), document.body.style.userSelect = "none";
1317
+ const d = t._visibleColumns[c], f = typeof d?.width == "number" ? d.width : void 0, p = d?.__renderedWidth ?? f ?? h.getBoundingClientRect().width;
1318
+ e = { startX: a.clientX, colIndex: c, startWidth: p }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), i === null && (i = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", n === null && (n = document.body.style.userSelect), document.body.style.userSelect = "none";
1317
1319
  },
1318
1320
  resetColumn(a) {
1319
1321
  const c = t._visibleColumns[a];
@@ -1344,7 +1346,7 @@ function T(t, e) {
1344
1346
  }
1345
1347
  return o;
1346
1348
  }
1347
- function xe(t, e, o) {
1349
+ function Re(t, e, o) {
1348
1350
  const i = document.createElement("button");
1349
1351
  if (t && (i.className = t), e)
1350
1352
  for (const n in e) {
@@ -1353,12 +1355,8 @@ function xe(t, e, o) {
1353
1355
  }
1354
1356
  return i;
1355
1357
  }
1356
- function ue(t) {
1357
- const e = document.createElement("slot");
1358
- return t && (e.name = t), e;
1359
- }
1360
- const Ae = document.createElement("template");
1361
- Ae.innerHTML = `
1358
+ const xe = document.createElement("template");
1359
+ xe.innerHTML = `
1362
1360
  <div class="tbw-scroll-area">
1363
1361
  <div class="rows-body-wrapper">
1364
1362
  <div class="rows-body" role="grid">
@@ -1377,34 +1375,38 @@ Ae.innerHTML = `
1377
1375
  <div class="faux-vscroll-spacer"></div>
1378
1376
  </div>
1379
1377
  `;
1380
- function Pe() {
1381
- return Ae.content.cloneNode(!0);
1378
+ function Ae() {
1379
+ return xe.content.cloneNode(!0);
1382
1380
  }
1383
- function fe(t) {
1381
+ function ue(t) {
1384
1382
  const e = document.createDocumentFragment(), o = T(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
1385
1383
  if (t.hasShell && t.shellHeader && t.shellBody)
1386
1384
  o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
1387
1385
  else {
1388
1386
  const i = T("tbw-grid-content");
1389
- i.appendChild(Pe()), o.appendChild(i);
1387
+ i.appendChild(Ae()), o.appendChild(i);
1390
1388
  }
1391
1389
  return e.appendChild(o), e;
1392
1390
  }
1393
- function dt(t) {
1391
+ function ct(t) {
1394
1392
  const e = T("tbw-shell-header", { part: "shell-header", role: "presentation" });
1395
1393
  if (t.title) {
1396
1394
  const r = T("tbw-shell-title");
1397
1395
  r.textContent = t.title, e.appendChild(r);
1398
1396
  }
1399
- const o = T("tbw-shell-content", { part: "shell-content", role: "presentation" });
1400
- o.appendChild(ue("header-content")), e.appendChild(o);
1397
+ const o = T("tbw-shell-content", {
1398
+ part: "shell-content",
1399
+ role: "presentation",
1400
+ "data-light-dom-header-content": ""
1401
+ });
1402
+ e.appendChild(o);
1401
1403
  const i = T("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
1402
1404
  for (const r of t.configButtons)
1403
1405
  (r.hasElement || r.hasRender) && i.appendChild(T("tbw-toolbar-btn-slot", { "data-btn-slot": r.id }));
1404
1406
  for (const r of t.apiButtons)
1405
1407
  (r.hasElement || r.hasRender) && i.appendChild(T("tbw-toolbar-btn-slot", { "data-btn-slot": r.id }));
1406
- if (i.appendChild(ue("toolbar")), (t.configButtons.some((r) => r.hasElement || r.hasRender) || t.apiButtons.some((r) => r.hasElement || r.hasRender)) && t.hasPanels && i.appendChild(T("tbw-toolbar-separator")), t.hasPanels) {
1407
- const r = xe(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
1408
+ if (i.appendChild(T("tbw-toolbar-light-dom", { "data-light-dom-toolbar": "" })), (t.configButtons.some((r) => r.hasElement || r.hasRender) || t.apiButtons.some((r) => r.hasElement || r.hasRender)) && t.hasPanels && i.appendChild(T("tbw-toolbar-separator")), t.hasPanels) {
1409
+ const r = Re(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
1408
1410
  "data-panel-toggle": "",
1409
1411
  title: "Settings",
1410
1412
  "aria-label": "Toggle settings panel",
@@ -1415,9 +1417,9 @@ function dt(t) {
1415
1417
  }
1416
1418
  return e.appendChild(i), e;
1417
1419
  }
1418
- function ht(t) {
1420
+ function dt(t) {
1419
1421
  const e = T("tbw-shell-body"), o = t.panels.length > 0, i = t.panels.length === 1, n = T("tbw-grid-content");
1420
- n.appendChild(Pe());
1422
+ n.appendChild(Ae());
1421
1423
  let r = null;
1422
1424
  if (o) {
1423
1425
  r = F("aside", {
@@ -1437,7 +1439,7 @@ function ht(t) {
1437
1439
  );
1438
1440
  const l = T("tbw-tool-panel-content", { role: "presentation" }), a = T("tbw-accordion");
1439
1441
  for (const c of t.panels) {
1440
- const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${i ? " single" : ""}`, d = T(h, { "data-section": c.id }), f = xe("tbw-accordion-header", {
1442
+ const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${i ? " single" : ""}`, d = T(h, { "data-section": c.id }), f = Re("tbw-accordion-header", {
1441
1443
  "aria-expanded": String(c.isExpanded),
1442
1444
  "aria-controls": `tbw-section-${c.id}`
1443
1445
  });
@@ -1461,10 +1463,10 @@ function ht(t) {
1461
1463
  }
1462
1464
  return t.position === "left" && r ? (e.appendChild(r), e.appendChild(n)) : (e.appendChild(n), r && e.appendChild(r)), e;
1463
1465
  }
1464
- function O(t) {
1466
+ function D(t) {
1465
1467
  return t ? typeof t == "string" ? t : t.outerHTML : "";
1466
1468
  }
1467
- function ut() {
1469
+ function ht() {
1468
1470
  return {
1469
1471
  toolPanels: /* @__PURE__ */ new Map(),
1470
1472
  headerContents: /* @__PURE__ */ new Map(),
@@ -1478,29 +1480,29 @@ function ut() {
1478
1480
  expandedSections: /* @__PURE__ */ new Set(),
1479
1481
  headerContentCleanups: /* @__PURE__ */ new Map(),
1480
1482
  panelCleanups: /* @__PURE__ */ new Map(),
1481
- toolbarButtonCleanups: /* @__PURE__ */ new Map()
1483
+ toolbarButtonCleanups: /* @__PURE__ */ new Map(),
1484
+ lightDomContentMoved: !1,
1485
+ lightDomToolButtonsMoved: !1
1482
1486
  };
1483
1487
  }
1484
- function Le(t) {
1488
+ function Pe(t) {
1485
1489
  return !!(t?.header?.title || t?.header?.toolbarButtons?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
1486
1490
  }
1487
- function pe(t, e, o = "☰") {
1488
- const i = t?.header?.title ?? e.lightDomTitle ?? "", n = !!i, r = O(o), s = t?.header?.toolbarButtons ?? [], l = s.some((g) => g.element || g.render), a = [...e.toolbarButtons.values()].some((g) => g.element || g.render), c = e.toolPanels.size > 0, d = (l || a) && c, f = [...s].sort((g, m) => (g.order ?? 100) - (m.order ?? 100)), p = [...e.toolbarButtons.values()].sort((g, m) => (g.order ?? 100) - (m.order ?? 100));
1491
+ function fe(t, e, o = "☰") {
1492
+ const i = t?.header?.title ?? e.lightDomTitle ?? "", n = !!i, r = D(o), s = t?.header?.toolbarButtons ?? [], l = s.some((g) => g.element || g.render), a = [...e.toolbarButtons.values()].some((g) => g.element || g.render), c = e.toolPanels.size > 0, d = (l || a) && c, f = [...s].sort((g, b) => (g.order ?? 100) - (b.order ?? 100)), p = [...e.toolbarButtons.values()].sort((g, b) => (g.order ?? 100) - (b.order ?? 100));
1489
1493
  let u = "";
1490
1494
  for (const g of f)
1491
1495
  (g.element || g.render) && (u += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${g.id}"></div>`);
1492
1496
  for (const g of p)
1493
1497
  (g.element || g.render) && (u += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${g.id}"></div>`);
1494
- if (u += '<slot name="toolbar"></slot>', d && (u += '<div class="tbw-toolbar-separator"></div>'), c) {
1498
+ if (u += '<div class="tbw-toolbar-light-dom" data-light-dom-toolbar></div>', d && (u += '<div class="tbw-toolbar-separator"></div>'), c) {
1495
1499
  const g = e.isPanelOpen;
1496
1500
  u += `<button class="${g ? "tbw-toolbar-btn active" : "tbw-toolbar-btn"}" data-panel-toggle title="Settings" aria-label="Toggle settings panel" aria-pressed="${g}" aria-controls="tbw-tool-panel">${r}</button>`;
1497
1501
  }
1498
1502
  return `
1499
1503
  <div class="tbw-shell-header" part="shell-header" role="presentation">
1500
- ${n ? `<div class="tbw-shell-title">${We(i)}</div>` : ""}
1501
- <div class="tbw-shell-content" part="shell-content" role="presentation">
1502
- <slot name="header-content"></slot>
1503
- </div>
1504
+ ${n ? `<div class="tbw-shell-title">${Be(i)}</div>` : ""}
1505
+ <div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
1504
1506
  <div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
1505
1507
  ${u}
1506
1508
  </div>
@@ -1515,13 +1517,11 @@ function M(t, e) {
1515
1517
  n && (e.lightDomTitle = n);
1516
1518
  }
1517
1519
  const i = o.querySelectorAll("tbw-grid-header-content");
1518
- i.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(i), e.lightDomHeaderContent.forEach((n) => {
1519
- n.setAttribute("slot", "header-content");
1520
- })), o.style.display = "none";
1520
+ i.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(i)), o.style.display = "none";
1521
1521
  }
1522
1522
  function z(t, e) {
1523
1523
  const o = t.querySelector(":scope > tbw-grid-tool-buttons");
1524
- o && (e.hasToolButtonsContainer = !0, o.setAttribute("slot", "toolbar"));
1524
+ o && (e.hasToolButtonsContainer = !0, o.style.display = "none");
1525
1525
  }
1526
1526
  function N(t, e, o) {
1527
1527
  t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((n) => {
@@ -1539,9 +1539,9 @@ function N(t, e, o) {
1539
1539
  d = f;
1540
1540
  else {
1541
1541
  const g = r.innerHTML.trim();
1542
- d = (m) => {
1543
- const b = document.createElement("div");
1544
- return b.innerHTML = g, m.appendChild(b), () => b.remove();
1542
+ d = (b) => {
1543
+ const C = document.createElement("div");
1544
+ return C.innerHTML = g, b.appendChild(C), () => C.remove();
1545
1545
  };
1546
1546
  }
1547
1547
  const p = e.toolPanels.get(s);
@@ -1564,7 +1564,7 @@ function N(t, e, o) {
1564
1564
  e.toolPanels.set(s, u), e.lightDomToolPanelIds.add(s), r.style.display = "none";
1565
1565
  });
1566
1566
  }
1567
- function ft(t, e, o, i) {
1567
+ function ut(t, e, o, i) {
1568
1568
  const n = t.querySelector(".tbw-shell-toolbar");
1569
1569
  n && n.addEventListener("click", (s) => {
1570
1570
  const l = s.target;
@@ -1587,7 +1587,7 @@ function ft(t, e, o, i) {
1587
1587
  }
1588
1588
  });
1589
1589
  }
1590
- function pt(t, e, o) {
1590
+ function ft(t, e, o) {
1591
1591
  const i = t.querySelector(".tbw-tool-panel"), n = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
1592
1592
  if (!i || !n || !r)
1593
1593
  return () => {
@@ -1597,8 +1597,8 @@ function pt(t, e, o) {
1597
1597
  const f = (g) => {
1598
1598
  if (!d) return;
1599
1599
  g.preventDefault();
1600
- const m = s === "left" ? g.clientX - a : a - g.clientX, b = Math.min(h, Math.max(l, c + m));
1601
- i.style.width = `${b}px`;
1600
+ const b = s === "left" ? g.clientX - a : a - g.clientX, C = Math.min(h, Math.max(l, c + b));
1601
+ i.style.width = `${C}px`;
1602
1602
  }, p = () => {
1603
1603
  if (!d) return;
1604
1604
  d = !1, n.classList.remove("resizing"), i.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
@@ -1611,36 +1611,52 @@ function pt(t, e, o) {
1611
1611
  n.removeEventListener("mousedown", u), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", p);
1612
1612
  };
1613
1613
  }
1614
- function gt(t, e, o) {
1615
- const i = [...e?.header?.toolbarButtons ?? [], ...o.toolbarButtons.values()];
1616
- for (const n of i) {
1617
- const r = t.querySelector(`[data-btn-slot="${n.id}"]`);
1618
- if (!r) continue;
1619
- const s = o.toolbarButtonCleanups.get(n.id);
1620
- if (s && (s(), o.toolbarButtonCleanups.delete(n.id)), n.element)
1621
- r.appendChild(n.element);
1622
- else if (n.render) {
1623
- const l = n.render(r);
1624
- l && o.toolbarButtonCleanups.set(n.id, l);
1614
+ function pt(t, e, o, i) {
1615
+ const n = [...e?.header?.toolbarButtons ?? [], ...o.toolbarButtons.values()];
1616
+ for (const r of n) {
1617
+ if (r.element?.parentNode || o.toolbarButtonCleanups.has(r.id)) continue;
1618
+ const s = t.querySelector(`[data-btn-slot="${r.id}"]`);
1619
+ if (s) {
1620
+ if (r.element)
1621
+ s.appendChild(r.element);
1622
+ else if (r.render) {
1623
+ const l = r.render(s);
1624
+ l && o.toolbarButtonCleanups.set(r.id, l);
1625
+ }
1626
+ }
1627
+ }
1628
+ if (i && o.hasToolButtonsContainer && !o.lightDomToolButtonsMoved) {
1629
+ const r = t.querySelector("[data-light-dom-toolbar]"), s = i.querySelector(":scope > tbw-grid-tool-buttons");
1630
+ if (r && s && s.firstChild) {
1631
+ for (; s.firstChild; )
1632
+ r.appendChild(s.firstChild);
1633
+ o.lightDomToolButtonsMoved = !0;
1625
1634
  }
1626
1635
  }
1627
1636
  }
1628
- function He(t, e) {
1629
- const o = t.querySelector(".tbw-shell-content");
1630
- if (!o) return;
1631
- const i = [...e.headerContents.values()].sort((r, s) => (r.order ?? 100) - (s.order ?? 100)), n = o.querySelector('slot[name="header-content"]');
1632
- for (const r of i) {
1633
- const s = e.headerContentCleanups.get(r.id);
1634
- s && (s(), e.headerContentCleanups.delete(r.id));
1635
- let l = o.querySelector(`[data-header-content="${r.id}"]`);
1636
- l || (l = document.createElement("div"), l.setAttribute("data-header-content", r.id), n ? o.insertBefore(l, n) : o.appendChild(l));
1637
- const a = r.render(l);
1638
- a && e.headerContentCleanups.set(r.id, a);
1637
+ function Le(t, e) {
1638
+ const o = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, i = e.headerContents.size > 0;
1639
+ if (!o && !i) return;
1640
+ const n = t.querySelector(".tbw-shell-content");
1641
+ if (!n) return;
1642
+ if (o) {
1643
+ for (const s of e.lightDomHeaderContent)
1644
+ s.style.display = "", n.appendChild(s);
1645
+ e.lightDomContentMoved = !0;
1646
+ }
1647
+ const r = [...e.headerContents.values()].sort((s, l) => (s.order ?? 100) - (l.order ?? 100));
1648
+ for (const s of r) {
1649
+ const l = e.headerContentCleanups.get(s.id);
1650
+ l && (l(), e.headerContentCleanups.delete(s.id));
1651
+ let a = n.querySelector(`[data-header-content="${s.id}"]`);
1652
+ a || (a = document.createElement("div"), a.setAttribute("data-header-content", s.id), n.appendChild(a));
1653
+ const c = s.render(a);
1654
+ c && e.headerContentCleanups.set(s.id, c);
1639
1655
  }
1640
1656
  }
1641
- function wt(t, e, o) {
1657
+ function gt(t, e, o) {
1642
1658
  if (!e.isPanelOpen) return;
1643
- const i = O(o?.expand ?? L.expand), n = O(o?.collapse ?? L.collapse);
1659
+ const i = D(o?.expand ?? H.expand), n = D(o?.collapse ?? H.collapse);
1644
1660
  for (const [r, s] of e.toolPanels) {
1645
1661
  const l = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
1646
1662
  if (!a || !c) continue;
@@ -1659,15 +1675,15 @@ function wt(t, e, o) {
1659
1675
  }
1660
1676
  }
1661
1677
  }
1662
- function ge(t, e) {
1678
+ function pe(t, e) {
1663
1679
  const o = t.querySelector("[data-panel-toggle]");
1664
1680
  o && (o.classList.toggle("active", e.isPanelOpen), o.setAttribute("aria-pressed", String(e.isPanelOpen)));
1665
1681
  }
1666
- function we(t, e) {
1682
+ function ge(t, e) {
1667
1683
  const o = t.querySelector(".tbw-tool-panel");
1668
1684
  o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
1669
1685
  }
1670
- function bt(t, e) {
1686
+ function mt(t, e) {
1671
1687
  const o = [];
1672
1688
  for (const i of t?.header?.toolbarButtons ?? [])
1673
1689
  o.push({
@@ -1690,7 +1706,7 @@ function bt(t, e) {
1690
1706
  });
1691
1707
  return o;
1692
1708
  }
1693
- function mt(t) {
1709
+ function bt(t) {
1694
1710
  for (const e of t.headerContentCleanups.values())
1695
1711
  e();
1696
1712
  t.headerContentCleanups.clear();
@@ -1702,9 +1718,9 @@ function mt(t) {
1702
1718
  if (t.toolbarButtonCleanups.clear(), t.isPanelOpen)
1703
1719
  for (const e of t.expandedSections)
1704
1720
  t.toolPanels.get(e)?.onClose?.();
1705
- t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarButtons.clear(), t.lightDomHeaderContent = [];
1721
+ t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarButtons.clear(), t.lightDomHeaderContent = [], t.lightDomContentMoved = !1, t.lightDomToolButtonsMoved = !1;
1706
1722
  }
1707
- function vt(t, e) {
1723
+ function wt(t, e) {
1708
1724
  let o = !1;
1709
1725
  const i = {
1710
1726
  get isInitialized() {
@@ -1733,7 +1749,7 @@ function vt(t, e) {
1733
1749
  s && t.expandedSections.add(s.id);
1734
1750
  }
1735
1751
  const n = e.getShadow();
1736
- ge(n, t), we(n, t), wt(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: i.expandedSections });
1752
+ pe(n, t), ge(n, t), gt(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: i.expandedSections });
1737
1753
  },
1738
1754
  closeToolPanel() {
1739
1755
  if (!t.isPanelOpen) return;
@@ -1744,7 +1760,7 @@ function vt(t, e) {
1744
1760
  r.onClose?.();
1745
1761
  t.isPanelOpen = !1;
1746
1762
  const n = e.getShadow();
1747
- ge(n, t), we(n, t), e.emit("tool-panel-close", {});
1763
+ pe(n, t), ge(n, t), e.emit("tool-panel-close", {});
1748
1764
  },
1749
1765
  toggleToolPanel() {
1750
1766
  t.isPanelOpen ? i.closeToolPanel() : i.openToolPanel();
@@ -1769,7 +1785,7 @@ function vt(t, e) {
1769
1785
  const d = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
1770
1786
  d && (d.innerHTML = "");
1771
1787
  }
1772
- t.expandedSections.add(n), J(s, n, !0), Ct(s, t, n);
1788
+ t.expandedSections.add(n), J(s, n, !0), vt(s, t, n);
1773
1789
  }
1774
1790
  e.emit("tool-panel-section-toggle", { id: n, expanded: !l });
1775
1791
  },
@@ -1798,14 +1814,14 @@ function vt(t, e) {
1798
1814
  console.warn(`[tbw-grid] Header content "${n.id}" already registered`);
1799
1815
  return;
1800
1816
  }
1801
- t.headerContents.set(n.id, n), o && He(e.getShadow(), t);
1817
+ t.headerContents.set(n.id, n), o && Le(e.getShadow(), t);
1802
1818
  },
1803
1819
  unregisterHeaderContent(n) {
1804
1820
  const r = t.headerContentCleanups.get(n);
1805
1821
  r && (r(), t.headerContentCleanups.delete(n)), t.headerContents.get(n)?.onDestroy?.(), t.headerContents.delete(n), e.getShadow().querySelector(`[data-header-content="${n}"]`)?.remove();
1806
1822
  },
1807
1823
  getToolbarButtons() {
1808
- return bt(e.getShellConfig(), t);
1824
+ return mt(e.getShellConfig(), t);
1809
1825
  },
1810
1826
  registerToolbarButton(n) {
1811
1827
  if (t.toolbarButtons.has(n.id)) {
@@ -1833,7 +1849,7 @@ function J(t, e, o) {
1833
1849
  const i = t.querySelector(`[data-section="${e}"]`);
1834
1850
  i && i.classList.toggle("expanded", o);
1835
1851
  }
1836
- function Ct(t, e, o) {
1852
+ function vt(t, e, o) {
1837
1853
  const i = e.toolPanels.get(o);
1838
1854
  if (!i?.render) return;
1839
1855
  const n = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
@@ -1841,42 +1857,47 @@ function Ct(t, e, o) {
1841
1857
  const r = i.render(n);
1842
1858
  r && e.panelCleanups.set(o, r);
1843
1859
  }
1844
- function _t(t, e, o, i) {
1845
- const n = Le(e);
1846
- if (t.replaceChildren(), n) {
1847
- const r = O(i?.toolPanel ?? L.toolPanel), s = O(i?.expand ?? L.expand), l = O(i?.collapse ?? L.collapse), c = [...e?.header?.toolbarButtons ?? []].sort((b, _) => (b.order ?? 100) - (_.order ?? 100)), d = [...e?.toolPanels ?? []].sort((b, _) => (b.order ?? 100) - (_.order ?? 100)), f = {
1860
+ function Ct(t, e, o, i) {
1861
+ const n = Pe(e), r = [], s = ["tbw-grid-header", "tbw-grid-tool-buttons", "tbw-grid-tool-panel", "tbw-grid-column"];
1862
+ for (const l of s)
1863
+ t.querySelectorAll(`:scope > ${l}`).forEach((c) => r.push(c));
1864
+ t.replaceChildren();
1865
+ for (const l of r)
1866
+ t.appendChild(l);
1867
+ if (n) {
1868
+ const l = D(i?.toolPanel ?? H.toolPanel), a = D(i?.expand ?? H.expand), c = D(i?.collapse ?? H.collapse), d = [...e?.header?.toolbarButtons ?? []].sort((m, w) => (m.order ?? 100) - (w.order ?? 100)), p = [...e?.toolPanels ?? []].sort((m, w) => (m.order ?? 100) - (w.order ?? 100)), u = {
1848
1869
  title: e?.header?.title ?? void 0,
1849
- hasPanels: d.length > 0,
1870
+ hasPanels: p.length > 0,
1850
1871
  isPanelOpen: o.isPanelOpen,
1851
- toolPanelIcon: r,
1872
+ toolPanelIcon: l,
1852
1873
  // All buttons are now in config (no more separate config vs API distinction for rendering)
1853
- configButtons: c.map((b) => ({
1854
- id: b.id,
1855
- hasElement: !!b.element,
1856
- hasRender: !!b.render
1874
+ configButtons: d.map((m) => ({
1875
+ id: m.id,
1876
+ hasElement: !!m.element,
1877
+ hasRender: !!m.render
1857
1878
  })),
1858
1879
  apiButtons: []
1859
1880
  // No longer needed - all buttons merged into configButtons
1860
- }, p = {
1881
+ }, g = {
1861
1882
  position: e?.toolPanel?.position ?? "right",
1862
1883
  isPanelOpen: o.isPanelOpen,
1863
- expandIcon: s,
1864
- collapseIcon: l,
1865
- panels: d.map((b) => ({
1866
- id: b.id,
1867
- title: b.title,
1868
- icon: O(b.icon),
1869
- isExpanded: o.expandedSections.has(b.id)
1884
+ expandIcon: a,
1885
+ collapseIcon: c,
1886
+ panels: p.map((m) => ({
1887
+ id: m.id,
1888
+ title: m.title,
1889
+ icon: D(m.icon),
1890
+ isExpanded: o.expandedSections.has(m.id)
1870
1891
  }))
1871
- }, u = dt(f), g = ht(p), m = fe({
1892
+ }, b = ct(u), C = dt(g), y = ue({
1872
1893
  hasShell: !0,
1873
- shellHeader: u,
1874
- shellBody: g
1894
+ shellHeader: b,
1895
+ shellBody: C
1875
1896
  });
1876
- t.appendChild(m);
1897
+ t.appendChild(y);
1877
1898
  } else {
1878
- const r = fe({ hasShell: !1 });
1879
- t.appendChild(r);
1899
+ const l = ue({ hasShell: !1 });
1900
+ t.appendChild(l);
1880
1901
  }
1881
1902
  return n;
1882
1903
  }
@@ -1894,19 +1915,19 @@ function yt() {
1894
1915
  momentumRaf: 0
1895
1916
  };
1896
1917
  }
1897
- function Et(t) {
1918
+ function _t(t) {
1898
1919
  t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
1899
1920
  }
1900
- function Oe(t) {
1921
+ function He(t) {
1901
1922
  t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
1902
1923
  }
1903
- function St(t, e, o) {
1924
+ function Et(t, e, o) {
1904
1925
  if (t.touches.length !== 1) return;
1905
- Oe(e);
1926
+ He(e);
1906
1927
  const i = t.touches[0];
1907
1928
  e.startY = i.clientY, e.startX = i.clientX, e.lastY = i.clientY, e.lastX = i.clientX, e.lastTime = performance.now(), e.scrollTop = o.fauxScrollbar.scrollTop, e.scrollLeft = o.scrollArea?.scrollLeft ?? 0, e.velocityY = 0, e.velocityX = 0;
1908
1929
  }
1909
- function Rt(t, e, o) {
1930
+ function St(t, e, o) {
1910
1931
  if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
1911
1932
  return !1;
1912
1933
  const i = t.touches[0], n = i.clientY, r = i.clientX, s = performance.now(), l = e.startY - n, a = e.startX - r;
@@ -1918,15 +1939,15 @@ function Rt(t, e, o) {
1918
1939
  const { scrollTop: c, scrollHeight: h, clientHeight: d } = o.fauxScrollbar, f = h - d, p = l > 0 && c < f || l < 0 && c > 0;
1919
1940
  let u = !1;
1920
1941
  if (o.scrollArea) {
1921
- const { scrollLeft: g, scrollWidth: m, clientWidth: b } = o.scrollArea, _ = m - b;
1922
- u = a > 0 && g < _ || a < 0 && g > 0;
1942
+ const { scrollLeft: g, scrollWidth: b, clientWidth: C } = o.scrollArea, y = b - C;
1943
+ u = a > 0 && g < y || a < 0 && g > 0;
1923
1944
  }
1924
1945
  return p && (o.fauxScrollbar.scrollTop = e.scrollTop + l), u && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + a), p || u;
1925
1946
  }
1926
1947
  function Tt(t, e) {
1927
- (Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && xt(t, e), Et(t);
1948
+ (Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Rt(t, e), _t(t);
1928
1949
  }
1929
- function xt(t, e) {
1950
+ function Rt(t, e) {
1930
1951
  const n = () => {
1931
1952
  t.velocityY *= 0.95, t.velocityX *= 0.95;
1932
1953
  const r = t.velocityY * 16, s = t.velocityX * 16;
@@ -1934,19 +1955,19 @@ function xt(t, e) {
1934
1955
  };
1935
1956
  t.momentumRaf = requestAnimationFrame(n);
1936
1957
  }
1937
- function At(t, e, o, i) {
1938
- t.addEventListener("touchstart", (n) => St(n, e, o), {
1958
+ function xt(t, e, o, i) {
1959
+ t.addEventListener("touchstart", (n) => Et(n, e, o), {
1939
1960
  passive: !0,
1940
1961
  signal: i
1941
1962
  }), t.addEventListener(
1942
1963
  "touchmove",
1943
1964
  (n) => {
1944
- Rt(n, e, o) && n.preventDefault();
1965
+ St(n, e, o) && n.preventDefault();
1945
1966
  },
1946
1967
  { passive: !1, signal: i }
1947
1968
  ), t.addEventListener("touchend", () => Tt(e, o), { passive: !0, signal: i });
1948
1969
  }
1949
- const Pt = [
1970
+ const At = [
1950
1971
  // EditingPlugin
1951
1972
  {
1952
1973
  property: "editable",
@@ -1976,7 +1997,7 @@ const Pt = [
1976
1997
  importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
1977
1998
  isUsed: (t) => t === "left" || t === "right"
1978
1999
  }
1979
- ], Lt = [
2000
+ ], Pt = [
1980
2001
  // GroupingColumnsPlugin
1981
2002
  {
1982
2003
  property: "columnGroups",
@@ -1986,29 +2007,29 @@ const Pt = [
1986
2007
  isUsed: (t) => Array.isArray(t) && t.length > 0
1987
2008
  }
1988
2009
  ];
1989
- function H(t) {
2010
+ function O(t) {
1990
2011
  return t.charAt(0).toUpperCase() + t.slice(1);
1991
2012
  }
1992
- function be(t, e) {
2013
+ function me(t, e) {
1993
2014
  return t.some((o) => o.name === e);
1994
2015
  }
1995
- function Ht(t, e) {
2016
+ function Lt(t, e) {
1996
2017
  const o = /* @__PURE__ */ new Map();
1997
2018
  function i(r, s, l, a, c = !1) {
1998
2019
  o.has(r) || o.set(r, { description: s, importHint: l, fields: [], isConfigProperty: c });
1999
2020
  const h = o.get(r);
2000
2021
  h.fields.includes(a) || h.fields.push(a);
2001
2022
  }
2002
- for (const r of Lt) {
2023
+ for (const r of Pt) {
2003
2024
  const s = t[r.property];
2004
- (r.isUsed ? r.isUsed(s) : s !== void 0) && !be(e, r.pluginName) && i(r.pluginName, r.description, r.importHint, r.property, !0);
2025
+ (r.isUsed ? r.isUsed(s) : s !== void 0) && !me(e, r.pluginName) && i(r.pluginName, r.description, r.importHint, r.property, !0);
2005
2026
  }
2006
2027
  const n = t.columns;
2007
2028
  if (n && n.length > 0)
2008
2029
  for (const r of n)
2009
- for (const s of Pt) {
2030
+ for (const s of At) {
2010
2031
  const l = r[s.property];
2011
- if ((s.isUsed ? s.isUsed(l) : l !== void 0) && !be(e, s.pluginName)) {
2032
+ if ((s.isUsed ? s.isUsed(l) : l !== void 0) && !me(e, s.pluginName)) {
2012
2033
  const c = r.field || "<unknown>";
2013
2034
  i(s.pluginName, s.description, s.importHint, c);
2014
2035
  }
@@ -2043,7 +2064,7 @@ This validation helps catch misconfigurations early. The properties listed above
2043
2064
  );
2044
2065
  }
2045
2066
  }
2046
- const Ot = {
2067
+ const Ht = {
2047
2068
  editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
2048
2069
  selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
2049
2070
  reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
@@ -2064,32 +2085,32 @@ const Ot = {
2064
2085
  serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
2065
2086
  columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
2066
2087
  };
2067
- function Dt(t) {
2068
- return Ot[t] ?? `import { ${H(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
2088
+ function Ot(t) {
2089
+ return Ht[t] ?? `import { ${O(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
2069
2090
  }
2070
- function Mt(t, e) {
2091
+ function Dt(t, e) {
2071
2092
  const o = t.name, n = t.constructor.dependencies ?? [];
2072
2093
  for (const r of n) {
2073
2094
  const s = r.name, l = r.required ?? !0, a = r.reason;
2074
2095
  if (!e.some((h) => h.name === s)) {
2075
- const h = a ?? `${H(o)}Plugin requires ${H(s)}Plugin`, d = Dt(s);
2096
+ const h = a ?? `${O(o)}Plugin requires ${O(s)}Plugin`, d = Ot(s);
2076
2097
  if (l)
2077
2098
  throw new Error(
2078
2099
  `[tbw-grid] Plugin dependency error:
2079
2100
 
2080
2101
  ${h}.
2081
2102
 
2082
- → Add the plugin to your gridConfig.plugins array BEFORE ${H(o)}Plugin:
2103
+ → Add the plugin to your gridConfig.plugins array BEFORE ${O(o)}Plugin:
2083
2104
  ${d}
2084
- plugins: [new ${H(s)}Plugin(), new ${H(o)}Plugin()]`
2105
+ plugins: [new ${O(s)}Plugin(), new ${O(o)}Plugin()]`
2085
2106
  );
2086
2107
  console.info(
2087
- `[tbw-grid] ${H(o)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
2108
+ `[tbw-grid] ${O(o)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
2088
2109
  );
2089
2110
  }
2090
2111
  }
2091
2112
  }
2092
- class zt {
2113
+ class Mt {
2093
2114
  constructor(e) {
2094
2115
  this.grid = e;
2095
2116
  }
@@ -2119,7 +2140,7 @@ class zt {
2119
2140
  * Validates dependencies and notifies other plugins of the new attachment.
2120
2141
  */
2121
2142
  attach(e) {
2122
- if (Mt(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
2143
+ if (Dt(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
2123
2144
  for (const [o, i] of Object.entries(e.cellRenderers))
2124
2145
  this.cellRenderers.set(o, i);
2125
2146
  if (e.headerRenderers)
@@ -2193,11 +2214,11 @@ class zt {
2193
2214
  return this.cellEditors.get(e);
2194
2215
  }
2195
2216
  /**
2196
- * Get all CSS styles from all plugins.
2217
+ * Get all CSS styles from all plugins as structured data.
2218
+ * Returns an array of { name, styles } for each plugin with styles.
2197
2219
  */
2198
- getAllStyles() {
2199
- return this.plugins.filter((e) => e.styles).map((e) => e.styles).join(`
2200
- `);
2220
+ getPluginStyles() {
2221
+ return this.plugins.filter((e) => e.styles).map((e) => ({ name: e.name, styles: e.styles }));
2201
2222
  }
2202
2223
  // #region Hook execution methods
2203
2224
  /**
@@ -2423,10 +2444,10 @@ class zt {
2423
2444
  }
2424
2445
  // #endregion
2425
2446
  }
2426
- class D extends HTMLElement {
2447
+ class x extends HTMLElement {
2427
2448
  // TODO: Rename to 'data-grid' when migration is complete
2428
2449
  static tagName = "tbw-grid";
2429
- static version = "0.4.2";
2450
+ static version = "0.5.0";
2430
2451
  // ---------------- Framework Adapters ----------------
2431
2452
  /**
2432
2453
  * Registry of framework adapters that handle converting light DOM elements
@@ -2467,7 +2488,26 @@ class D extends HTMLElement {
2467
2488
  static get observedAttributes() {
2468
2489
  return ["rows", "columns", "grid-config", "fit-mode", "edit-on"];
2469
2490
  }
2470
- #o;
2491
+ /**
2492
+ * The render root for the grid. Without Shadow DOM, this is the element itself.
2493
+ * This abstraction allows internal code to work the same way regardless of DOM mode.
2494
+ */
2495
+ get #o() {
2496
+ return this;
2497
+ }
2498
+ /**
2499
+ * Access the grid's ShadowRoot.
2500
+ *
2501
+ * Note: The grid renders into its light DOM and does not attach a shadow root,
2502
+ * so this getter returns `null`. Use `grid.querySelector()` directly for DOM queries.
2503
+ *
2504
+ * @deprecated This property returns `null` since Shadow DOM was removed.
2505
+ * Use `grid.querySelector()` or `grid.querySelectorAll()` directly.
2506
+ * @returns null (no shadow root is attached)
2507
+ */
2508
+ get shadowRoot() {
2509
+ return super.shadowRoot;
2510
+ }
2471
2511
  #c = !1;
2472
2512
  // ---------------- Ready Promise ----------------
2473
2513
  #f;
@@ -2498,16 +2538,16 @@ class D extends HTMLElement {
2498
2538
  // Centralizes all rendering through a single RAF-based pipeline
2499
2539
  #l;
2500
2540
  #v = 0;
2501
- #w = null;
2541
+ #m = null;
2502
2542
  #b = !1;
2503
2543
  // Cached flag for plugin scroll handlers
2504
2544
  #s;
2505
2545
  // Cached hook to avoid closures
2506
- #m = !1;
2546
+ #w = !1;
2507
2547
  #A = yt();
2508
2548
  #g;
2509
- #_;
2510
2549
  #y;
2550
+ #_;
2511
2551
  // Watches first row for size changes (CSS loading, custom renderers)
2512
2552
  #C;
2513
2553
  // Handle for cancelling deferred idle work
@@ -2534,7 +2574,7 @@ class D extends HTMLElement {
2534
2574
  // ---------------- Config Manager ----------------
2535
2575
  #t;
2536
2576
  // ---------------- Shell State ----------------
2537
- #e = ut();
2577
+ #e = ht();
2538
2578
  #a;
2539
2579
  #D;
2540
2580
  // #endregion
@@ -2543,7 +2583,7 @@ class D extends HTMLElement {
2543
2583
  _rows = [];
2544
2584
  // _baseColumns: columns before plugin transformation (analogous to #rows for row processing)
2545
2585
  // This is the source of truth for processColumns - plugins transform these
2546
- #N = [];
2586
+ #k = [];
2547
2587
  // _columns is a getter/setter that operates on effectiveConfig.columns
2548
2588
  // This ensures effectiveConfig.columns is the single source of truth for columns
2549
2589
  // _columns always contains ALL columns (including hidden)
@@ -2681,29 +2721,29 @@ class D extends HTMLElement {
2681
2721
  }
2682
2722
  // #endregion
2683
2723
  constructor() {
2684
- super(), this.#o = this.attachShadow({ mode: "open" }), this.#J(), this.#f = new Promise((e) => this.#d = e), this.#l = new at({
2724
+ super(), this.#ie(), this.#f = new Promise((e) => this.#d = e), this.#l = new lt({
2685
2725
  mergeConfig: () => {
2686
- this.#t.parseLightDomColumns(this), this.#t.merge(), this.#G(), Ht(this.#n, this.#i?.getPlugins() ?? []), this.#N = [...this._columns];
2726
+ this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), Lt(this.#n, this.#i?.getPlugins() ?? []), this.#k = [...this._columns];
2687
2727
  },
2688
- processColumns: () => this.#de(),
2689
- processRows: () => this.#he(),
2728
+ processColumns: () => this.#ge(),
2729
+ processRows: () => this.#me(),
2690
2730
  renderHeader: () => X(this),
2691
2731
  updateTemplate: () => q(this),
2692
2732
  renderVirtualWindow: () => this.refreshVirtualWindow(!0),
2693
2733
  afterRender: () => {
2694
- this.#i?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, ne(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, k(this)), this._virtualization.enabled && !this.#z && this.#te();
2734
+ this.#i?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, ne(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, k(this)), this._virtualization.enabled && !this.#N && this.#se();
2695
2735
  },
2696
2736
  isConnected: () => this.isConnected && this.#h
2697
- }), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a = vt(this.#e, {
2737
+ }), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a = wt(this.#e, {
2698
2738
  getShadow: () => this.#o,
2699
2739
  getShellConfig: () => this.#n?.shell,
2700
2740
  getAccordionIcons: () => ({
2701
- expand: this.#n?.icons?.expand ?? L.expand,
2702
- collapse: this.#n?.icons?.collapse ?? L.collapse
2741
+ expand: this.#n?.icons?.expand ?? H.expand,
2742
+ collapse: this.#n?.icons?.collapse ?? H.collapse
2703
2743
  }),
2704
- emit: (e, o) => this.#Y(e, o),
2744
+ emit: (e, o) => this.#J(e, o),
2705
2745
  refreshShellHeader: () => this.refreshShellHeader()
2706
- }), this.#t = new Ke({
2746
+ }), this.#t = new je({
2707
2747
  getRows: () => this.#r,
2708
2748
  getSortState: () => this._sortState,
2709
2749
  setSortState: (e) => {
@@ -2712,11 +2752,11 @@ class D extends HTMLElement {
2712
2752
  onConfigChange: () => {
2713
2753
  this.#l.requestPhase(S.FULL, "configChange");
2714
2754
  },
2715
- emit: (e, o) => this.#Y(e, o),
2755
+ emit: (e, o) => this.#J(e, o),
2716
2756
  clearRowPool: () => {
2717
2757
  this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
2718
2758
  },
2719
- setup: () => this.#T(),
2759
+ setup: () => this.#x(),
2720
2760
  renderHeader: () => X(this),
2721
2761
  updateTemplate: () => q(this),
2722
2762
  refreshVirtualWindow: () => this.#l.requestPhase(S.VIRTUALIZATION, "configManager"),
@@ -2724,7 +2764,7 @@ class D extends HTMLElement {
2724
2764
  setRowHeight: (e) => {
2725
2765
  this._virtualization.rowHeight = e;
2726
2766
  },
2727
- applyAnimationConfig: (e) => this.#ue(e),
2767
+ applyAnimationConfig: (e) => this.#be(e),
2728
2768
  getShellLightDomTitle: () => this.#e.lightDomTitle,
2729
2769
  getShellToolPanels: () => this.#e.toolPanels,
2730
2770
  getShellHeaderContents: () => this.#e.headerContents,
@@ -2733,33 +2773,64 @@ class D extends HTMLElement {
2733
2773
  getShellHasToolButtonsContainer: () => this.#e.hasToolButtonsContainer
2734
2774
  });
2735
2775
  }
2736
- async #J() {
2737
- const e = new CSSStyleSheet();
2738
- if (te.length > 0) {
2739
- e.replaceSync(te), this.#o.adoptedStyleSheets = [e];
2740
- return;
2741
- }
2742
- await new Promise((o) => setTimeout(o, 50));
2743
- try {
2744
- let o = "";
2745
- for (const i of Array.from(document.styleSheets))
2746
- try {
2747
- const r = Array.from(i.cssRules || []).map((s) => s.cssText).join(`
2776
+ /** ID for the consolidated grid stylesheet in document.head */
2777
+ static #Y = "tbw-grid-styles";
2778
+ /** Track injected base styles CSS text */
2779
+ static #M = "";
2780
+ /** Track injected plugin styles by plugin name (accumulates across all grid instances) */
2781
+ static #I = /* @__PURE__ */ new Map();
2782
+ /**
2783
+ * Get or create the consolidated style element in document.head.
2784
+ * All grid and plugin styles are combined into this single element.
2785
+ */
2786
+ static #oe() {
2787
+ let e = document.getElementById(this.#Y);
2788
+ return e || (e = document.createElement("style"), e.id = this.#Y, e.setAttribute("data-tbw-grid", "true"), document.head.appendChild(e)), e;
2789
+ }
2790
+ /**
2791
+ * Update the consolidated stylesheet with current base + plugin styles.
2792
+ */
2793
+ static #q() {
2794
+ const e = this.#oe(), o = Array.from(this.#I.values()).join(`
2795
+ `);
2796
+ e.textContent = `${this.#M}
2797
+
2798
+ /* Plugin Styles */
2799
+ ${o}`;
2800
+ }
2801
+ /**
2802
+ * Inject grid styles into the document.
2803
+ * All styles go into a single <style id="tbw-grid-styles"> element in document.head.
2804
+ * Uses a singleton pattern to avoid duplicate injection across multiple grid instances.
2805
+ */
2806
+ async #ie() {
2807
+ if (!x.#M) {
2808
+ if (te.length > 0) {
2809
+ x.#M = te, x.#q();
2810
+ return;
2811
+ }
2812
+ await new Promise((e) => setTimeout(e, 50));
2813
+ try {
2814
+ let e = "";
2815
+ for (const o of Array.from(document.styleSheets))
2816
+ try {
2817
+ const n = Array.from(o.cssRules || []).map((r) => r.cssText).join(`
2748
2818
  `);
2749
- if (r.includes(".tbw-grid-root") && r.includes(":host")) {
2750
- o = r;
2751
- break;
2819
+ if (n.includes(".tbw-grid-root") && n.includes("tbw-grid")) {
2820
+ e = n;
2821
+ break;
2822
+ }
2823
+ } catch {
2824
+ continue;
2752
2825
  }
2753
- } catch {
2754
- continue;
2755
- }
2756
- o ? (e.replaceSync(o), this.#o.adoptedStyleSheets = [e]) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
2757
- "[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
2758
- "Available stylesheets:",
2759
- Array.from(document.styleSheets).map((i) => i.href || "(inline)")
2760
- );
2761
- } catch (o) {
2762
- console.warn("[tbw-grid] Failed to extract grid.css from document stylesheets:", o);
2826
+ e ? (x.#M = e, x.#q()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
2827
+ "[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
2828
+ "Available stylesheets:",
2829
+ Array.from(document.styleSheets).map((o) => o.href || "(inline)")
2830
+ );
2831
+ } catch (e) {
2832
+ console.warn("[tbw-grid] Failed to extract grid.css from document stylesheets:", e);
2833
+ }
2763
2834
  }
2764
2835
  }
2765
2836
  // ---------------- Plugin System ----------------
@@ -2818,28 +2889,29 @@ class D extends HTMLElement {
2818
2889
  * Initialize plugin system with instances from config.
2819
2890
  * Plugins are class instances passed in gridConfig.plugins[].
2820
2891
  */
2821
- #V() {
2822
- this.#i = new zt(this);
2892
+ #j() {
2893
+ this.#i = new Mt(this);
2823
2894
  const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
2824
2895
  this.#i.attachAll(o);
2825
2896
  }
2826
2897
  /**
2827
- * Inject all plugin styles into the shadow DOM.
2828
- * Must be called after #render() since innerHTML wipes existing content.
2898
+ * Inject all plugin styles into the consolidated style element.
2899
+ * Plugin styles are appended after base grid styles in the same <style> element.
2900
+ * Uses a Map to accumulate styles from all grid instances on the page.
2829
2901
  */
2830
- #M() {
2831
- const e = this.#i?.getAllStyles() ?? "";
2832
- if (e) {
2833
- const o = document.createElement("style");
2834
- o.setAttribute("data-plugin", "all"), o.textContent = e, this.#o.appendChild(o);
2835
- }
2902
+ #z() {
2903
+ const e = this.#i?.getPluginStyles() ?? [];
2904
+ let o = !1;
2905
+ for (const { name: i, styles: n } of e)
2906
+ x.#I.has(i) || (x.#I.set(i, n), o = !0);
2907
+ o && x.#q();
2836
2908
  }
2837
2909
  /**
2838
2910
  * Update plugins when grid config changes.
2839
2911
  * With class-based plugins, we need to detach old and attach new.
2840
2912
  * Skips re-initialization if the plugins array hasn't changed.
2841
2913
  */
2842
- #G() {
2914
+ #K() {
2843
2915
  const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
2844
2916
  if (this.#E !== o) {
2845
2917
  if (this.#E && this.#E.length === o.length && this.#E.every((i, n) => i === o[n])) {
@@ -2858,20 +2930,20 @@ class D extends HTMLElement {
2858
2930
  const n = this.#e.headerContentCleanups.get(i);
2859
2931
  n && (n(), this.#e.headerContentCleanups.delete(i)), this.#e.headerContents.delete(i);
2860
2932
  }
2861
- this.#V(), this.#M(), this.#E = o, this.#X(), this.#b = this.#i?.getAll().some((i) => i.onScroll) ?? !1;
2933
+ this.#j(), this.#z(), this.#E = o, this.#Z(), this.#b = this.#i?.getAll().some((i) => i.onScroll) ?? !1;
2862
2934
  }
2863
2935
  }
2864
2936
  /**
2865
2937
  * Clean up plugin states when grid disconnects.
2866
2938
  */
2867
- #Q() {
2939
+ #ne() {
2868
2940
  this.#i?.detachAll();
2869
2941
  }
2870
2942
  /**
2871
2943
  * Collect tool panels and header content from all plugins.
2872
2944
  * Called after plugins are attached but before render.
2873
2945
  */
2874
- #X() {
2946
+ #Z() {
2875
2947
  if (!this.#i) return;
2876
2948
  const e = this.#i.getToolPanels();
2877
2949
  for (const { panel: i } of e)
@@ -2885,7 +2957,7 @@ class D extends HTMLElement {
2885
2957
  * Returns a factory function that tries each adapter in order until one handles the element.
2886
2958
  */
2887
2959
  #R() {
2888
- const e = D.getAdapters();
2960
+ const e = x.getAdapters();
2889
2961
  if (e.length === 0 && !this.__frameworkAdapter) return;
2890
2962
  const o = this.__frameworkAdapter;
2891
2963
  return (i) => {
@@ -2902,17 +2974,17 @@ class D extends HTMLElement {
2902
2974
  }
2903
2975
  // ---------------- Lifecycle ----------------
2904
2976
  connectedCallback() {
2905
- this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", D.version), this._rows = Array.isArray(this.#r) ? [...this.#r] : [], this.#g && (this.#g.abort(), this.#O = !1), this.#g = new AbortController(), this.#C && (de(this.#C), this.#C = void 0), M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#V();
2977
+ this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", x.version), this._rows = Array.isArray(this.#r) ? [...this.#r] : [], this.#g && (this.#g.abort(), this.#O = !1), this.#g = new AbortController(), this.#C && (de(this.#C), this.#C = void 0), M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#j();
2906
2978
  const e = this.#n?.plugins;
2907
- this.#E = Array.isArray(e) ? e : [], this.#X(), this.#c || (this.#$(), this.#M(), this.#c = !0), this.#k(), this.#C = it(
2979
+ this.#E = Array.isArray(e) ? e : [], this.#Z(), this.#c || (this.#G(), this.#z(), this.#c = !0), this.#B(), this.#C = ot(
2908
2980
  () => {
2909
- this.#me();
2981
+ this.#Ee();
2910
2982
  },
2911
2983
  { timeout: 100 }
2912
2984
  );
2913
2985
  }
2914
2986
  disconnectedCallback() {
2915
- this.#C && (de(this.#C), this.#C = void 0), this.#Q(), mt(this.#e), this.#a.setInitialized(!1), this.#D?.(), this.#D = void 0, Oe(this.#A), this.#g && (this.#g.abort(), this.#g = void 0), this.#P?.abort(), this.#P = void 0, this.#O = !1, this._resizeController && this._resizeController.dispose(), this.#_ && (this.#_.disconnect(), this.#_ = void 0), this.#y && (this.#y.disconnect(), this.#y = void 0, this.#z = !1), $(this), this.#x.clear(), this.#E = void 0;
2987
+ this.#C && (de(this.#C), this.#C = void 0), this.#ne(), bt(this.#e), this.#a.setInitialized(!1), this.#D?.(), this.#D = void 0, He(this.#A), this.#g && (this.#g.abort(), this.#g = void 0), this.#P?.abort(), this.#P = void 0, this.#O = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#_ && (this.#_.disconnect(), this.#_ = void 0, this.#N = !1), U(this), this.#T.clear(), this.#E = void 0;
2916
2988
  for (const e of this._rowPool)
2917
2989
  e.remove();
2918
2990
  this._rowPool.length = 0, this.__rowsBodyEl = null, this.#h = !1;
@@ -2933,26 +3005,26 @@ class D extends HTMLElement {
2933
3005
  }
2934
3006
  else e === "fit-mode" ? this.fitMode = i : e === "edit-on" && (this.editOn = i);
2935
3007
  }
2936
- #k() {
3008
+ #B() {
2937
3009
  const o = this.#o.querySelector(".tbw-grid-content") ?? this.#o.querySelector(".tbw-grid-root");
2938
3010
  if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#a.isInitialized) {
2939
- He(this.#o, this.#e), gt(this.#o, this.#n?.shell, this.#e);
3011
+ Le(this.#o, this.#e), pt(this.#o, this.#n?.shell, this.#e, this);
2940
3012
  const r = this.#n?.shell?.toolPanel?.defaultOpen;
2941
3013
  r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
2942
3014
  }
2943
- if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController = ct(this), this.#T(), this.#ee(o), this.#O)
3015
+ if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController = at(this), this.#x(), this.#re(o), this.#O)
2944
3016
  return;
2945
3017
  this.#O = !0;
2946
3018
  const i = this.disconnectSignal;
2947
- this.addEventListener("keydown", (r) => lt(this, r), { signal: i }), this.#o.addEventListener("mousedown", (r) => this.#pe(r), { signal: i }), document.addEventListener("mousemove", (r) => this.#ge(r), { signal: i }), document.addEventListener("mouseup", (r) => this.#we(r), { signal: i });
3019
+ this.addEventListener("keydown", (r) => st(this, r), { signal: i }), this.#o.addEventListener("mousedown", (r) => this.#ve(r), { signal: i }), document.addEventListener("mousemove", (r) => this.#Ce(r), { signal: i }), document.addEventListener("mouseup", (r) => this.#ye(r), { signal: i });
2948
3020
  const n = this.#n.rowHeight;
2949
- n && n > 0 ? this._virtualization.rowHeight = n : requestAnimationFrame(() => this.#I()), queueMicrotask(() => this.#oe()), this.#l.requestPhase(S.FULL, "afterConnect");
3021
+ n && n > 0 ? this._virtualization.rowHeight = n : requestAnimationFrame(() => this.#W()), queueMicrotask(() => this.#le()), this.#l.requestPhase(S.FULL, "afterConnect");
2950
3022
  }
2951
3023
  /**
2952
3024
  * Measure actual row height from DOM.
2953
3025
  * Finds the tallest cell to account for custom renderers that may push height.
2954
3026
  */
2955
- #I() {
3027
+ #W() {
2956
3028
  const e = this._bodyEl?.querySelector(".data-grid-row");
2957
3029
  if (!e) return;
2958
3030
  const o = e.querySelectorAll(".cell");
@@ -2969,7 +3041,7 @@ class D extends HTMLElement {
2969
3041
  * These need to be re-attached when the DOM is recreated (e.g., shell toggle).
2970
3042
  * Uses a separate AbortController that is recreated each time.
2971
3043
  */
2972
- #ee(e) {
3044
+ #re(e) {
2973
3045
  this.#P?.abort(), this.#P = new AbortController();
2974
3046
  const o = this.#P.signal, i = e?.querySelector(".faux-vscroll"), n = e?.querySelector(".rows");
2975
3047
  if (this._virtualization.container = i ?? this, this.#b = this.#i?.getAll().some((r) => r.onScroll) ?? !1, i && n) {
@@ -2984,8 +3056,8 @@ class D extends HTMLElement {
2984
3056
  const c = Math.floor(l / a), h = c - c % 2, d = -(l - h * a);
2985
3057
  n.style.transform = `translateY(${d}px)`;
2986
3058
  }
2987
- this.#w = l, this.#v || (this.#v = requestAnimationFrame(() => {
2988
- this.#v = 0, this.#w !== null && (this.#fe(this.#w), this.#w = null);
3059
+ this.#m = l, this.#v || (this.#v = requestAnimationFrame(() => {
3060
+ this.#v = 0, this.#m !== null && (this.#we(this.#m), this.#m = null);
2989
3061
  }));
2990
3062
  },
2991
3063
  { passive: !0, signal: o }
@@ -3004,11 +3076,11 @@ class D extends HTMLElement {
3004
3076
  }
3005
3077
  },
3006
3078
  { passive: !1, signal: o }
3007
- ), At(r, this.#A, { fauxScrollbar: i, scrollArea: s }, o));
3079
+ ), xt(r, this.#A, { fauxScrollbar: i, scrollArea: s }, o));
3008
3080
  }
3009
- this._bodyEl && Qe(this, this._bodyEl, o), this.#_?.disconnect(), this._virtualization.viewportEl && (this.#_ = new ResizeObserver(() => {
3081
+ this._bodyEl && Je(this, this._bodyEl, o), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
3010
3082
  this.#l.requestPhase(S.VIRTUALIZATION, "resize-observer");
3011
- }), this.#_.observe(this._virtualization.viewportEl)), this._virtualization.enabled && this.#l.requestPhase(S.VIRTUALIZATION, "init-virtualization"), this.#o.addEventListener(
3083
+ }), this.#y.observe(this._virtualization.viewportEl)), this._virtualization.enabled && this.#l.requestPhase(S.VIRTUALIZATION, "init-virtualization"), this.#o.addEventListener(
3012
3084
  "focusin",
3013
3085
  () => {
3014
3086
  this.dataset.hasFocus = "";
@@ -3028,23 +3100,23 @@ class D extends HTMLElement {
3028
3100
  * Called after rows are rendered to observe the actual content.
3029
3101
  * Handles dynamic CSS loading, lazy images, font loading, column virtualization, etc.
3030
3102
  */
3031
- #z = !1;
3103
+ #N = !1;
3032
3104
  // Only set up once per lifecycle
3033
- #te() {
3034
- if (this.#z) return;
3105
+ #se() {
3106
+ if (this.#N) return;
3035
3107
  const e = this._bodyEl?.querySelector(".data-grid-row");
3036
- e && (this.#z = !0, this.#y?.disconnect(), this.#y = new ResizeObserver(() => {
3037
- this.#I();
3038
- }), this.#y.observe(e), requestAnimationFrame(() => {
3039
- this.#I();
3108
+ e && (this.#N = !0, this.#_?.disconnect(), this.#_ = new ResizeObserver(() => {
3109
+ this.#W();
3110
+ }), this.#_.observe(e), requestAnimationFrame(() => {
3111
+ this.#W();
3040
3112
  }));
3041
3113
  }
3042
3114
  // ---------------- Event Emitters ----------------
3043
- #Y(e, o) {
3115
+ #J(e, o) {
3044
3116
  this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
3045
3117
  }
3046
3118
  /** Update ARIA selection attributes on rendered rows/cells */
3047
- #oe() {
3119
+ #le() {
3048
3120
  this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, i) => {
3049
3121
  const n = i === this._focusRow;
3050
3122
  o.setAttribute("aria-selected", String(n)), o.querySelectorAll(".cell").forEach((r, s) => {
@@ -3060,13 +3132,13 @@ class D extends HTMLElement {
3060
3132
  * All updates queued within the same microtask are batched together.
3061
3133
  */
3062
3134
  #H(e) {
3063
- this.#p[e] = !0, !this.#u && (this.#u = !0, queueMicrotask(() => this.#ie()));
3135
+ this.#p[e] = !0, !this.#u && (this.#u = !0, queueMicrotask(() => this.#ae()));
3064
3136
  }
3065
3137
  /**
3066
3138
  * Process all pending updates in optimal order.
3067
3139
  * Priority: gridConfig first (may affect all), then columns, rows, fitMode, editMode
3068
3140
  */
3069
- #ie() {
3141
+ #ae() {
3070
3142
  if (!this.#u || !this.#h) {
3071
3143
  this.#u = !1;
3072
3144
  return;
@@ -3079,42 +3151,42 @@ class D extends HTMLElement {
3079
3151
  fitMode: !1,
3080
3152
  editMode: !1
3081
3153
  }, e.gridConfig) {
3082
- this.#ae();
3154
+ this.#fe();
3083
3155
  return;
3084
3156
  }
3085
- e.columns && this.#re(), e.rows && this.#ne(), e.fitMode && this.#se(), e.editMode && this.#le();
3157
+ e.columns && this.#de(), e.rows && this.#ce(), e.fitMode && this.#he(), e.editMode && this.#ue();
3086
3158
  }
3087
3159
  // Individual update applicators - these do the actual work
3088
- #ne() {
3160
+ #ce() {
3089
3161
  this._rows = Array.isArray(this.#r) ? [...this.#r] : [], this.#l.requestPhase(S.ROWS, "applyRowsUpdate");
3090
3162
  }
3091
- #re() {
3092
- $(this), this.#t.merge(), this.#T();
3163
+ #de() {
3164
+ U(this), this.#t.merge(), this.#x();
3093
3165
  }
3094
- #se() {
3166
+ #he() {
3095
3167
  this.#t.merge(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, ne(this)) : (this._columns.forEach((o) => {
3096
3168
  !o.__userResized && o.__autoSized && delete o.width;
3097
3169
  }), q(this));
3098
3170
  }
3099
- #le() {
3171
+ #ue() {
3100
3172
  this.#t.merge(), this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.#l.requestPhase(S.VIRTUALIZATION, "applyEditModeUpdate");
3101
3173
  }
3102
- #ae() {
3174
+ #fe() {
3103
3175
  M(this, this.#e), z(this, this.#e);
3104
3176
  const e = !!this.#o.querySelector(".has-shell"), o = !!this.#o.querySelector(".tbw-tool-panel"), i = this.#o.querySelectorAll(".tbw-accordion-section").length;
3105
- this.#t.parseLightDomColumns(this), this.#t.merge(), this.#G(), N(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
3106
- const n = Le(this.#n?.shell), r = (this.#n?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#n?.shell?.toolPanels?.length ?? 0) !== i;
3177
+ this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), N(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
3178
+ const n = Pe(this.#n?.shell), r = (this.#n?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#n?.shell?.toolPanels?.length ?? 0) !== i;
3107
3179
  if (e !== n || !e && n || !o && r || o && s) {
3108
- this.#$(), this.#M(), this.#k();
3180
+ this.#G(), this.#z(), this.#B();
3109
3181
  return;
3110
3182
  }
3111
- e && this.#ce(), this.#l.requestPhase(S.COLUMNS, "applyGridConfigUpdate");
3183
+ e && this.#pe(), this.#l.requestPhase(S.COLUMNS, "applyGridConfigUpdate");
3112
3184
  }
3113
3185
  /**
3114
3186
  * Update the shell header DOM in place without a full re-render.
3115
3187
  * Handles title, toolbar buttons, and other shell header changes.
3116
3188
  */
3117
- #ce() {
3189
+ #pe() {
3118
3190
  const e = this.#o.querySelector(".tbw-shell-header");
3119
3191
  if (!e) return;
3120
3192
  const o = this.#n.shell?.header?.title ?? this.#e.lightDomTitle;
@@ -3125,9 +3197,9 @@ class D extends HTMLElement {
3125
3197
  // The #queueUpdate() method schedules updates which are processed by #flushPendingUpdates()
3126
3198
  // and individual #apply*Update() methods. This coalesces rapid property changes
3127
3199
  // (e.g., setting rows, columns, gridConfig in quick succession) into a single update cycle.
3128
- #de() {
3200
+ #ge() {
3129
3201
  if (this.#i) {
3130
- const e = this.#N.length > 0 ? this.#N : this._columns, o = e.filter((r) => !r.hidden), i = e.filter((r) => r.hidden), n = this.#i.processColumns([...o]);
3202
+ const e = this.#k.length > 0 ? this.#k : this._columns, o = e.filter((r) => !r.hidden), i = e.filter((r) => r.hidden), n = this.#i.processColumns([...o]);
3131
3203
  if (n !== o) {
3132
3204
  new Set(o.map((l) => l.field));
3133
3205
  const r = new Set(n.map((l) => l.field));
@@ -3137,8 +3209,8 @@ class D extends HTMLElement {
3137
3209
  }
3138
3210
  }
3139
3211
  /** Recompute row model via plugin hooks. */
3140
- #he() {
3141
- $(this);
3212
+ #me() {
3213
+ U(this);
3142
3214
  const e = Array.isArray(this.#r) ? [...this.#r] : [], o = this.#i?.processRows(e) ?? e;
3143
3215
  this._rows = o;
3144
3216
  }
@@ -3147,31 +3219,31 @@ class D extends HTMLElement {
3147
3219
  * This makes the grid's animation settings available to plugins via CSS variables.
3148
3220
  * Called by ConfigManager after merge.
3149
3221
  */
3150
- #ue(e) {
3222
+ #be(e) {
3151
3223
  const o = {
3152
- ...Me,
3224
+ ...De,
3153
3225
  ...e.animation
3154
3226
  }, i = o.mode ?? "reduced-motion";
3155
3227
  let n = 1;
3156
3228
  i === !1 || i === "off" ? n = 0 : (i === !0 || i === "on") && (n = 1), this.style.setProperty("--tbw-animation-duration", `${o.duration}ms`), this.style.setProperty("--tbw-animation-easing", o.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(n)), this.dataset.animationMode = typeof i == "boolean" ? i ? "on" : "off" : i;
3157
3229
  }
3158
3230
  // ---------------- Delegate Wrappers ----------------
3159
- #q(e, o, i = this.__rowRenderEpoch) {
3160
- this.#s || (this.#s = (n, r, s) => this.#i?.renderRow(n, r, s) ?? !1), st(this, e, o, i, this.#s);
3231
+ #$(e, o, i = this.__rowRenderEpoch) {
3232
+ this.#s || (this.#s = (n, r, s) => this.#i?.renderRow(n, r, s) ?? !1), rt(this, e, o, i, this.#s);
3161
3233
  }
3162
3234
  // Cache for ARIA counts to avoid redundant DOM writes on scroll (hot path)
3163
- #B = -1;
3164
- #j = -1;
3235
+ #U = -1;
3236
+ #Q = -1;
3165
3237
  /**
3166
3238
  * Updates ARIA row/col counts on the grid container.
3167
3239
  * Also sets role="rowgroup" on .rows container only when there are rows.
3168
3240
  * Uses caching to avoid redundant DOM writes on every scroll frame.
3169
3241
  */
3170
- #K(e, o) {
3171
- if (e === this.#B && o === this.#j)
3242
+ #ee(e, o) {
3243
+ if (e === this.#U && o === this.#Q)
3172
3244
  return;
3173
- const i = this.#B;
3174
- this.#B = e, this.#j = o, this.__rowsBodyEl && (this.__rowsBodyEl.setAttribute("aria-rowcount", String(e)), this.__rowsBodyEl.setAttribute("aria-colcount", String(o))), e !== i && this._bodyEl && (e > 0 ? this._bodyEl.setAttribute("role", "rowgroup") : this._bodyEl.removeAttribute("role"));
3245
+ const i = this.#U;
3246
+ this.#U = e, this.#Q = o, this.__rowsBodyEl && (this.__rowsBodyEl.setAttribute("aria-rowcount", String(e)), this.__rowsBodyEl.setAttribute("aria-colcount", String(o))), e !== i && this._bodyEl && (e > 0 ? this._bodyEl.setAttribute("role", "rowgroup") : this._bodyEl.removeAttribute("role"));
3175
3247
  }
3176
3248
  // ---------------- Core Helpers ----------------
3177
3249
  /**
@@ -3182,7 +3254,7 @@ class D extends HTMLElement {
3182
3254
  * Previously this method executed rendering synchronously, but that caused race
3183
3255
  * conditions with framework adapters that also schedule their own render work.
3184
3256
  */
3185
- #T() {
3257
+ #x() {
3186
3258
  if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
3187
3259
  if (this.#t.parseLightDomColumns(this), this.#L) {
3188
3260
  const e = this.#L;
@@ -3193,7 +3265,7 @@ class D extends HTMLElement {
3193
3265
  this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#l.requestPhase(S.FULL, "setup");
3194
3266
  }
3195
3267
  }
3196
- #fe(e) {
3268
+ #we(e) {
3197
3269
  if (this.refreshVirtualWindow(!1), this.#i?.onScrollRender(), this.#b) {
3198
3270
  const o = this._virtualization.container, i = this.#S;
3199
3271
  i.scrollTop = e, i.scrollLeft = o?.scrollLeft ?? 0, i.scrollHeight = o?.scrollHeight ?? 0, i.scrollWidth = o?.scrollWidth ?? 0, i.clientHeight = o?.clientHeight ?? 0, i.clientWidth = o?.clientWidth ?? 0, this.#i?.onScroll(i);
@@ -3300,11 +3372,11 @@ class D extends HTMLElement {
3300
3372
  * Build a CellMouseEvent from a native MouseEvent.
3301
3373
  * Extracts cell/row information from the event target.
3302
3374
  */
3303
- #W(e, o) {
3375
+ #F(e, o) {
3304
3376
  let i = null;
3305
3377
  const n = e.composedPath?.();
3306
3378
  if (n && n.length > 0 ? i = n[0] : i = e.target, i && !this.#o.contains(i)) {
3307
- const u = this.#o.elementFromPoint(e.clientX, e.clientY);
3379
+ const u = document.elementFromPoint(e.clientX, e.clientY);
3308
3380
  u && (i = u);
3309
3381
  }
3310
3382
  const r = i?.closest?.("[data-col]"), s = i?.closest?.(".data-grid-row"), l = i?.closest?.(".header-row");
@@ -3327,25 +3399,25 @@ class D extends HTMLElement {
3327
3399
  /**
3328
3400
  * Handle mousedown events and dispatch to plugin system.
3329
3401
  */
3330
- #pe(e) {
3331
- const o = this.#W(e, "mousedown");
3332
- (this.#i?.onCellMouseDown(o) ?? !1) && (this.#m = !0);
3402
+ #ve(e) {
3403
+ const o = this.#F(e, "mousedown");
3404
+ (this.#i?.onCellMouseDown(o) ?? !1) && (this.#w = !0);
3333
3405
  }
3334
3406
  /**
3335
3407
  * Handle mousemove events (only when dragging).
3336
3408
  */
3337
- #ge(e) {
3338
- if (!this.#m) return;
3339
- const o = this.#W(e, "mousemove");
3409
+ #Ce(e) {
3410
+ if (!this.#w) return;
3411
+ const o = this.#F(e, "mousemove");
3340
3412
  this.#i?.onCellMouseMove(o);
3341
3413
  }
3342
3414
  /**
3343
3415
  * Handle mouseup events.
3344
3416
  */
3345
- #we(e) {
3346
- if (!this.#m) return;
3347
- const o = this.#W(e, "mouseup");
3348
- this.#i?.onCellMouseUp(o), this.#m = !1;
3417
+ #ye(e) {
3418
+ if (!this.#w) return;
3419
+ const o = this.#F(e, "mouseup");
3420
+ this.#i?.onCellMouseUp(o), this.#w = !1;
3349
3421
  }
3350
3422
  async ready() {
3351
3423
  return this.#f;
@@ -3403,7 +3475,7 @@ class D extends HTMLElement {
3403
3475
  * Use this to restore previously saved column state.
3404
3476
  */
3405
3477
  set columnState(e) {
3406
- e && (this.#L = e, this.#t.initialColumnState = e, this.#c && this.#be(e));
3478
+ e && (this.#L = e, this.#t.initialColumnState = e, this.#c && this.#_e(e));
3407
3479
  }
3408
3480
  /**
3409
3481
  * Get the current column state.
@@ -3414,9 +3486,9 @@ class D extends HTMLElement {
3414
3486
  /**
3415
3487
  * Apply column state internally.
3416
3488
  */
3417
- #be(e) {
3489
+ #_e(e) {
3418
3490
  const o = this.#i?.getAll() ?? [];
3419
- this.#t.applyState(e, o), this.#T();
3491
+ this.#t.applyState(e, o), this.#x();
3420
3492
  }
3421
3493
  /**
3422
3494
  * Request a state change event to be emitted.
@@ -3436,7 +3508,7 @@ class D extends HTMLElement {
3436
3508
  resetColumnState() {
3437
3509
  this.#L = void 0, this.__originalOrder = [];
3438
3510
  const e = this.#i?.getAll() ?? [];
3439
- this.#t.resetState(e), this.#t.merge(), this.#T();
3511
+ this.#t.resetState(e), this.#t.merge(), this.#x();
3440
3512
  }
3441
3513
  // ---------------- Shell / Tool Panel API ----------------
3442
3514
  // These methods delegate to ShellController for implementation.
@@ -3518,11 +3590,11 @@ class D extends HTMLElement {
3518
3590
  * Call this after dynamically modifying <tbw-grid-header> children.
3519
3591
  */
3520
3592
  refreshShellHeader() {
3521
- M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#$(), this.#M(), this.#k();
3593
+ M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#G(), this.#z(), this.#B();
3522
3594
  }
3523
3595
  // #region Custom Styles API
3524
3596
  /** Map of registered custom stylesheets by ID - uses adoptedStyleSheets which survive DOM rebuilds */
3525
- #x = /* @__PURE__ */ new Map();
3597
+ #T = /* @__PURE__ */ new Map();
3526
3598
  /**
3527
3599
  * Register custom CSS styles to be injected into the grid's shadow DOM.
3528
3600
  * Use this to style custom cell renderers, editors, or detail panels.
@@ -3548,28 +3620,31 @@ class D extends HTMLElement {
3548
3620
  * ```
3549
3621
  */
3550
3622
  registerStyles(e, o) {
3551
- let i = this.#x.get(e);
3552
- i || (i = new CSSStyleSheet(), this.#x.set(e, i)), i.replaceSync(o), this.#Z();
3623
+ let i = this.#T.get(e);
3624
+ i || (i = new CSSStyleSheet(), this.#T.set(e, i)), i.replaceSync(o), this.#te();
3553
3625
  }
3554
3626
  /**
3555
3627
  * Remove previously registered custom styles.
3556
3628
  * @param id - The ID used when registering the styles
3557
3629
  */
3558
3630
  unregisterStyles(e) {
3559
- this.#x.delete(e) && this.#Z();
3631
+ this.#T.delete(e) && this.#te();
3560
3632
  }
3561
3633
  /**
3562
3634
  * Get list of registered custom style IDs.
3563
3635
  */
3564
3636
  getRegisteredStyles() {
3565
- return Array.from(this.#x.keys());
3637
+ return Array.from(this.#T.keys());
3566
3638
  }
3567
3639
  /**
3568
- * Update the shadow root's adoptedStyleSheets to include base + custom sheets.
3640
+ * Update document.adoptedStyleSheets to include custom sheets.
3641
+ * Without Shadow DOM, all custom styles go into the document.
3569
3642
  */
3570
- #Z() {
3571
- const e = this.#o.adoptedStyleSheets[0], o = Array.from(this.#x.values());
3572
- this.#o.adoptedStyleSheets = e ? [e, ...o] : o;
3643
+ #te() {
3644
+ const e = Array.from(this.#T.values()), o = document.adoptedStyleSheets.filter(
3645
+ (i) => !Array.from(this.#T.values()).includes(i)
3646
+ );
3647
+ document.adoptedStyleSheets = [...o, ...e];
3573
3648
  }
3574
3649
  // #endregion
3575
3650
  /**
@@ -3582,7 +3657,7 @@ class D extends HTMLElement {
3582
3657
  * This separation allows plugins to register their own Light DOM elements
3583
3658
  * and handle parsing themselves.
3584
3659
  */
3585
- #me() {
3660
+ #Ee() {
3586
3661
  const e = () => {
3587
3662
  const i = this.#e.lightDomTitle, n = this.#e.hasToolButtonsContainer;
3588
3663
  M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R());
@@ -3591,18 +3666,18 @@ class D extends HTMLElement {
3591
3666
  this.#t.markSourcesChanged(), this.#t.merge();
3592
3667
  const l = this.#o.querySelector(".tbw-shell-header");
3593
3668
  if (l) {
3594
- const a = pe(
3669
+ const a = fe(
3595
3670
  this.#n.shell,
3596
3671
  this.#e,
3597
3672
  this.#n.icons?.toolPanel
3598
3673
  ), c = document.createElement("div");
3599
3674
  c.innerHTML = a;
3600
3675
  const h = c.firstElementChild;
3601
- h && (l.replaceWith(h), this.#F());
3676
+ h && (l.replaceWith(h), this.#X());
3602
3677
  }
3603
3678
  }
3604
3679
  }, o = () => {
3605
- this.__lightDomColumnsCache = void 0, this.#T();
3680
+ this.__lightDomColumnsCache = void 0, this.#x();
3606
3681
  };
3607
3682
  this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", o), this.#t.registerLightDomHandler("tbw-grid-detail", o), this.#t.observeLightDOM(this);
3608
3683
  }
@@ -3613,7 +3688,7 @@ class D extends HTMLElement {
3613
3688
  * @internal Used by framework integration libraries (Angular, React, Vue)
3614
3689
  */
3615
3690
  refreshColumns() {
3616
- this.__lightDomColumnsCache = void 0, $(this), this.#t.parseLightDomColumns(this);
3691
+ this.__lightDomColumnsCache = void 0, U(this), this.#t.parseLightDomColumns(this);
3617
3692
  const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
3618
3693
  M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R());
3619
3694
  const i = this.#e.lightDomTitle, n = this.#e.hasToolButtonsContainer;
@@ -3621,14 +3696,14 @@ class D extends HTMLElement {
3621
3696
  this.#t.markSourcesChanged(), this.#t.merge();
3622
3697
  const s = this.#o.querySelector(".tbw-shell-header");
3623
3698
  if (s) {
3624
- const l = pe(
3699
+ const l = fe(
3625
3700
  this.#n.shell,
3626
3701
  this.#e,
3627
3702
  this.#n.icons?.toolPanel
3628
3703
  ), a = document.createElement("div");
3629
3704
  a.innerHTML = l;
3630
3705
  const c = a.firstElementChild;
3631
- c && (s.replaceWith(c), this.#F());
3706
+ c && (s.replaceWith(c), this.#X());
3632
3707
  }
3633
3708
  }
3634
3709
  this.#l.requestPhase(S.COLUMNS, "refreshColumns");
@@ -3638,7 +3713,7 @@ class D extends HTMLElement {
3638
3713
  * Calculate total height for the faux scrollbar spacer element.
3639
3714
  * Used by both bypass and virtualized rendering paths to ensure consistent scroll behavior.
3640
3715
  */
3641
- #U(e) {
3716
+ #V(e) {
3642
3717
  const o = this._virtualization.rowHeight, i = this._virtualization.container ?? this, n = this._virtualization.viewportEl ?? i, r = i.clientHeight, s = n.clientHeight, a = this.shadowRoot?.querySelector(".tbw-scroll-area"), c = a ? a.clientHeight : r, d = c - s, f = this.#i?.getExtraHeight() ?? 0, p = Math.max(0, r - c);
3643
3718
  return e * o + d + f + p;
3644
3719
  }
@@ -3651,20 +3726,20 @@ class D extends HTMLElement {
3651
3726
  if (!this._bodyEl) return;
3652
3727
  const o = this._rows.length;
3653
3728
  if (!this._virtualization.enabled) {
3654
- this.#q(0, o), this.#i?.afterRender();
3729
+ this.#$(0, o), this.#i?.afterRender();
3655
3730
  return;
3656
3731
  }
3657
3732
  if (this._rows.length <= this._virtualization.bypassThreshold) {
3658
- this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#q(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#U(o)}px`), this.#K(o, this._visibleColumns.length), this.#i?.afterRender();
3733
+ this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#$(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#V(o)}px`), this.#ee(o, this._visibleColumns.length), this.#i?.afterRender();
3659
3734
  return;
3660
3735
  }
3661
3736
  const i = this._virtualization.container ?? this, n = this._virtualization.viewportEl ?? i, r = n.clientHeight, s = this._virtualization.rowHeight, l = i.scrollTop;
3662
3737
  let a = Math.floor(l / s), c = 0;
3663
3738
  const h = 10;
3664
3739
  for (; c < h; ) {
3665
- const _ = this.#i?.getExtraHeightBefore?.(a) ?? 0, w = Math.floor((l - _) / s);
3666
- if (w >= a || w < 0) break;
3667
- a = w, c++;
3740
+ const y = this.#i?.getExtraHeightBefore?.(a) ?? 0, m = Math.floor((l - y) / s);
3741
+ if (m >= a || m < 0) break;
3742
+ a = m, c++;
3668
3743
  }
3669
3744
  a = a - a % 2, a < 0 && (a = 0);
3670
3745
  const d = this.#i?.adjustVirtualStart(a, l, s);
@@ -3675,36 +3750,36 @@ class D extends HTMLElement {
3675
3750
  this.#l.requestPhase(S.VIRTUALIZATION, "stale-refs-retry");
3676
3751
  return;
3677
3752
  }
3678
- const g = this.#U(o);
3753
+ const g = this.#V(o);
3679
3754
  this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${g}px`);
3680
- const m = this.#i?.getExtraHeightBefore?.(a) ?? 0, b = -(l - a * s - m);
3681
- this._bodyEl.style.transform = `translateY(${b}px)`, this.#q(a, p, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#K(o, this._visibleColumns.length), e && (this.#i?.afterRender(), queueMicrotask(() => {
3682
- const _ = i.clientHeight, w = n.clientHeight;
3683
- if (_ === 0 && w > 0) return;
3684
- const C = this.#U(o);
3685
- this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${C}px`);
3755
+ const b = this.#i?.getExtraHeightBefore?.(a) ?? 0, C = -(l - a * s - b);
3756
+ this._bodyEl.style.transform = `translateY(${C}px)`, this.#$(a, p, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ee(o, this._visibleColumns.length), e && (this.#i?.afterRender(), queueMicrotask(() => {
3757
+ const y = i.clientHeight, m = n.clientHeight;
3758
+ if (y === 0 && m > 0) return;
3759
+ const w = this.#V(o);
3760
+ this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${w}px`);
3686
3761
  }));
3687
3762
  }
3688
3763
  // ---------------- Render ----------------
3689
- #$() {
3764
+ #G() {
3690
3765
  M(this, this.#e), z(this, this.#e), N(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
3691
3766
  const e = this.#n?.shell;
3692
- _t(
3767
+ Ct(
3693
3768
  this.#o,
3694
3769
  e,
3695
3770
  { isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
3696
3771
  this.#n?.icons
3697
- ) && (this.#F(), this.#a.setInitialized(!0));
3772
+ ) && (this.#X(), this.#a.setInitialized(!0));
3698
3773
  }
3699
3774
  /**
3700
3775
  * Set up shell event listeners after render.
3701
3776
  */
3702
- #F() {
3703
- ft(this.#o, this.#n?.shell, this.#e, {
3777
+ #X() {
3778
+ ut(this.#o, this.#n?.shell, this.#e, {
3704
3779
  onPanelToggle: () => this.toggleToolPanel(),
3705
3780
  onSectionToggle: (e) => this.toggleToolPanelSection(e),
3706
- onToolbarButtonClick: (e) => this.#ve(e)
3707
- }), this.#D?.(), this.#D = pt(this.#o, this.#n?.shell, (e) => {
3781
+ onToolbarButtonClick: (e) => this.#Se(e)
3782
+ }), this.#D?.(), this.#D = ft(this.#o, this.#n?.shell, (e) => {
3708
3783
  this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
3709
3784
  });
3710
3785
  }
@@ -3714,18 +3789,18 @@ class D extends HTMLElement {
3714
3789
  * This method is kept for backwards compatibility but may emit an event in the future.
3715
3790
  */
3716
3791
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3717
- #ve(e) {
3792
+ #Se(e) {
3718
3793
  }
3719
3794
  }
3720
- customElements.get(D.tagName) || customElements.define(D.tagName, D);
3721
- globalThis.DataGridElement = D;
3722
- const kt = {
3795
+ customElements.get(x.tagName) || customElements.define(x.tagName, x);
3796
+ globalThis.DataGridElement = x;
3797
+ const Nt = {
3723
3798
  /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
3724
3799
  CAN_MOVE_COLUMN: "canMoveColumn",
3725
3800
  /** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
3726
3801
  GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
3727
3802
  };
3728
- class It {
3803
+ class kt {
3729
3804
  /**
3730
3805
  * Plugin dependencies - declare other plugins this one requires.
3731
3806
  *
@@ -3746,7 +3821,7 @@ class It {
3746
3821
  * Plugin version - defaults to grid version for built-in plugins.
3747
3822
  * Third-party plugins can override with their own semver.
3748
3823
  */
3749
- version = "0.4.2";
3824
+ version = "0.5.0";
3750
3825
  /** CSS styles to inject into the grid's shadow DOM */
3751
3826
  styles;
3752
3827
  /** Custom cell renderers keyed by type name */
@@ -3902,10 +3977,21 @@ class It {
3902
3977
  return this.grid;
3903
3978
  }
3904
3979
  /**
3905
- * Get the shadow root of the grid.
3980
+ * Get the render root of the grid for DOM queries.
3981
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
3982
+ *
3983
+ * With Shadow DOM removed, the grid element itself is the render root.
3984
+ * All new code should use `this.gridElement` for DOM queries.
3985
+ *
3986
+ * @example
3987
+ * // OLD (deprecated)
3988
+ * const rows = this.shadowRoot?.querySelector('.rows');
3989
+ *
3990
+ * // NEW (preferred)
3991
+ * const rows = this.gridElement.querySelector('.rows');
3906
3992
  */
3907
3993
  get shadowRoot() {
3908
- return this.grid?.shadowRoot ?? null;
3994
+ return this.gridElement;
3909
3995
  }
3910
3996
  /**
3911
3997
  * Get the disconnect signal for event listener cleanup.
@@ -3933,7 +4019,7 @@ class It {
3933
4019
  */
3934
4020
  get gridIcons() {
3935
4021
  const e = this.grid?.gridConfig?.icons ?? {};
3936
- return { ...L, ...e };
4022
+ return { ...H, ...e };
3937
4023
  }
3938
4024
  // #region Animation Helpers
3939
4025
  /**
@@ -3956,7 +4042,7 @@ class It {
3956
4042
  const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
3957
4043
  if (e === !1 || e === "off") return !1;
3958
4044
  if (e === !0 || e === "on") return !0;
3959
- const o = this.shadowRoot?.host;
4045
+ const o = this.gridElement;
3960
4046
  return o ? getComputedStyle(o).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
3961
4047
  }
3962
4048
  /**
@@ -3972,7 +4058,7 @@ class It {
3972
4058
  * ```
3973
4059
  */
3974
4060
  get animationDuration() {
3975
- const e = this.shadowRoot?.host;
4061
+ const e = this.gridElement;
3976
4062
  if (e) {
3977
4063
  const o = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(o, 10);
3978
4064
  if (!isNaN(i)) return i;
@@ -4069,7 +4155,7 @@ const E = {
4069
4155
  // TreePlugin
4070
4156
  STICKY: "data-sticky"
4071
4157
  // PinnedColumnsPlugin
4072
- }, qt = {
4158
+ }, It = {
4073
4159
  ROOT: `.${E.ROOT}`,
4074
4160
  HEADER: `.${E.HEADER}`,
4075
4161
  HEADER_ROW: `.${E.HEADER_ROW}`,
@@ -4086,7 +4172,7 @@ const E = {
4086
4172
  // State selectors
4087
4173
  SELECTED_ROWS: `.${E.DATA_ROW}.${E.SELECTED}`,
4088
4174
  EDITING_CELL: `.${E.DATA_CELL}.${E.EDITING}`
4089
- }, Bt = {
4175
+ }, qt = {
4090
4176
  // Colors
4091
4177
  COLOR_BG: "--tbw-color-bg",
4092
4178
  COLOR_FG: "--tbw-color-fg",
@@ -4108,7 +4194,7 @@ const E = {
4108
4194
  // Borders
4109
4195
  BORDER_RADIUS: "--tbw-border-radius",
4110
4196
  FOCUS_OUTLINE: "--tbw-focus-outline"
4111
- }, Wt = {
4197
+ }, Bt = {
4112
4198
  CELL_COMMIT: "cell-commit",
4113
4199
  ROW_COMMIT: "row-commit",
4114
4200
  CHANGED_ROWS_RESET: "changed-rows-reset",
@@ -4119,7 +4205,7 @@ const E = {
4119
4205
  ACTIVATE_CELL: "activate-cell",
4120
4206
  GROUP_TOGGLE: "group-toggle",
4121
4207
  COLUMN_STATE_CHANGE: "column-state-change"
4122
- }, Ut = {
4208
+ }, Wt = {
4123
4209
  // Selection plugin
4124
4210
  SELECTION_CHANGE: "selection-change",
4125
4211
  // Tree plugin
@@ -4161,7 +4247,7 @@ const E = {
4161
4247
  max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
4162
4248
  first: (t, e) => t[0]?.[e],
4163
4249
  last: (t, e) => t[t.length - 1]?.[e]
4164
- }, I = /* @__PURE__ */ new Map(), P = {
4250
+ }, I = /* @__PURE__ */ new Map(), L = {
4165
4251
  /**
4166
4252
  * Register a custom aggregator function.
4167
4253
  */
@@ -4200,7 +4286,7 @@ const E = {
4200
4286
  list() {
4201
4287
  return [...Object.keys(Q), ...I.keys()];
4202
4288
  }
4203
- }, me = {
4289
+ }, be = {
4204
4290
  sum: (t) => t.reduce((e, o) => e + o, 0),
4205
4291
  avg: (t) => t.length ? t.reduce((e, o) => e + o, 0) / t.length : 0,
4206
4292
  count: (t) => t.length,
@@ -4209,43 +4295,43 @@ const E = {
4209
4295
  first: (t) => t[0] ?? 0,
4210
4296
  last: (t) => t[t.length - 1] ?? 0
4211
4297
  };
4212
- function Nt(t) {
4213
- return me[t] ?? me.sum;
4298
+ function zt(t) {
4299
+ return be[t] ?? be.sum;
4214
4300
  }
4215
4301
  function $t(t, e) {
4216
- return Nt(t)(e);
4302
+ return zt(t)(e);
4217
4303
  }
4218
- const Ft = P.register.bind(P), Vt = P.unregister.bind(P), Gt = P.get.bind(P), Xt = P.run.bind(P), Yt = P.list.bind(P);
4304
+ const Ut = L.register.bind(L), Ft = L.unregister.bind(L), Vt = L.get.bind(L), Gt = L.run.bind(L), Xt = L.list.bind(L);
4219
4305
  export {
4220
- It as BaseGridPlugin,
4221
- Me as DEFAULT_ANIMATION_CONFIG,
4222
- L as DEFAULT_GRID_ICONS,
4223
- Wt as DGEvents,
4224
- D as DataGridElement,
4306
+ kt as BaseGridPlugin,
4307
+ De as DEFAULT_ANIMATION_CONFIG,
4308
+ H as DEFAULT_GRID_ICONS,
4309
+ Bt as DGEvents,
4310
+ x as DataGridElement,
4225
4311
  W as FitModeEnum,
4226
- Bt as GridCSSVars,
4312
+ qt as GridCSSVars,
4227
4313
  E as GridClasses,
4228
4314
  V as GridDataAttrs,
4229
- D as GridElement,
4230
- qt as GridSelectors,
4231
- kt as PLUGIN_QUERIES,
4232
- Ut as PluginEvents,
4233
- zt as PluginManager,
4315
+ x as GridElement,
4316
+ It as GridSelectors,
4317
+ Nt as PLUGIN_QUERIES,
4318
+ Wt as PluginEvents,
4319
+ Mt as PluginManager,
4234
4320
  S as RenderPhase,
4235
4321
  k as a,
4236
- P as aggregatorRegistry,
4237
- tt as builtInSort,
4322
+ L as aggregatorRegistry,
4323
+ et as builtInSort,
4238
4324
  ee as c,
4239
- et as defaultComparator,
4240
- ve as e,
4325
+ Qe as defaultComparator,
4326
+ we as e,
4241
4327
  ye as g,
4242
- Gt as getAggregator,
4243
- Nt as getValueAggregator,
4244
- Yt as listAggregators,
4245
- Ft as registerAggregator,
4246
- Xt as runAggregator,
4328
+ Vt as getAggregator,
4329
+ zt as getValueAggregator,
4330
+ Xt as listAggregators,
4331
+ Ut as registerAggregator,
4332
+ Gt as runAggregator,
4247
4333
  $t as runValueAggregator,
4248
4334
  G as s,
4249
- Vt as unregisterAggregator
4335
+ Ft as unregisterAggregator
4250
4336
  };
4251
4337
  //# sourceMappingURL=index.js.map