@zhangt58/svelte-vtable 0.5.0 → 0.6.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.
@@ -298,6 +298,9 @@
298
298
  --vtable-color-info: #3b82f6; /* blue-500 */
299
299
 
300
300
  --vtable-radius: 0.375rem; /* rounded-md */
301
+
302
+ --vtable-resize-line: #cbd5e1; /* slate-300: resize separator at rest */
303
+ --vtable-resize-line-hover: #64748b; /* slate-500: while its header is hovered */
301
304
  --vtable-row-height: 2.25rem; /* default row height hint for virtual scroll */
302
305
  }
303
306
  .virtual-data-table {
@@ -361,6 +364,63 @@
361
364
  :global(.dark .virtual-data-table[data-scrolled-end] .vtable-sticky-edge-right) {
362
365
  box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.6);
363
366
  }
367
+ /* Resizable columns: once a column is resized the table switches to a
368
+ fixed layout whose width is the sum of the column widths (set by DataTable
369
+ as --vtable-table-width). */
370
+ :global(.virtual-data-table.vtable-fixed-layout table.vtlist-inner) {
371
+ table-layout: fixed;
372
+ width: var(--vtable-table-width);
373
+ }
374
+ :global(.datatable-table thead th .vtable-resize-handle) {
375
+ position: absolute;
376
+ top: 0;
377
+ right: 0;
378
+ bottom: 0;
379
+ width: 0.6rem;
380
+ cursor: col-resize;
381
+ touch-action: none;
382
+ z-index: 1;
383
+ }
384
+ /* Separator line on the header's right edge: always shown on resizable
385
+ columns, stronger while the header is hovered, accent-coloured and full
386
+ height on the handle itself or while dragging. */
387
+ :global(.datatable-table thead th .vtable-resize-handle::after) {
388
+ content: '';
389
+ position: absolute;
390
+ top: 22%;
391
+ bottom: 22%;
392
+ right: 0;
393
+ width: 2px;
394
+ border-radius: 1px;
395
+ background-color: var(--vtable-resize-line);
396
+ transition:
397
+ background-color 0.12s ease-in-out,
398
+ top 0.12s ease-in-out,
399
+ bottom 0.12s ease-in-out,
400
+ width 0.12s ease-in-out;
401
+ }
402
+ :global(.datatable-table thead th:hover .vtable-resize-handle::after) {
403
+ top: 12%;
404
+ bottom: 12%;
405
+ background-color: var(--vtable-resize-line-hover);
406
+ }
407
+ :global(.datatable-table thead th .vtable-resize-handle:hover::after),
408
+ :global(.datatable-table thead th .vtable-resize-handle.vtable-resize-active::after) {
409
+ top: 0;
410
+ bottom: 0;
411
+ width: 3px;
412
+ background-color: var(--vtable-color-accent-border);
413
+ }
414
+ :global(.dark) :global(.datatable-table thead th .vtable-resize-handle) {
415
+ --vtable-resize-line: #4b5563; /* gray-600 */
416
+ --vtable-resize-line-hover: #9ca3af; /* gray-400 */
417
+ }
418
+ /* Keep the resize cursor and stop text selection while dragging */
419
+ :global(.virtual-data-table.vtable-resizing),
420
+ :global(.virtual-data-table.vtable-resizing *) {
421
+ cursor: col-resize !important;
422
+ user-select: none;
423
+ }
364
424
  /* Header visual styles - only bottom border */
365
425
  :global(.datatable-table) thead th {
366
426
  background-color: #f8f9fa;
@@ -469,6 +529,48 @@
469
529
  gap: 0.25rem;
470
530
  text-align: left;
471
531
  }
532
+ /* Grouped column headers (ColumnDef.group): a header row above the column
533
+ headers, one cell per run of columns sharing a group. */
534
+ :global(.datatable-table thead th.vtable-group-header) {
535
+ text-align: center;
536
+ padding-top: 0.25rem;
537
+ padding-bottom: 0.25rem;
538
+ font-size: 0.75rem;
539
+ letter-spacing: 0.05em;
540
+ color: #475569;
541
+ box-shadow: none;
542
+ }
543
+ /* Divider between groups; a run continued past a sticky boundary has none */
544
+ :global(
545
+ .datatable-table thead th.vtable-group-header + th.vtable-group-header:not(.vtable-group-cont)
546
+ ) {
547
+ border-left: 1px solid #dee2e6;
548
+ }
549
+ :global(.datatable-table thead th.vtable-group-empty) {
550
+ border-bottom-color: transparent;
551
+ }
552
+ :global(.dark) :global(.datatable-table thead th.vtable-group-header) {
553
+ color: #cbd5e1;
554
+ box-shadow: none;
555
+ }
556
+ :global(.dark)
557
+ :global(
558
+ .datatable-table thead th.vtable-group-header + th.vtable-group-header:not(.vtable-group-cont)
559
+ ) {
560
+ border-left-color: #374151;
561
+ }
562
+ :global(.dark) :global(.datatable-table thead th.vtable-group-empty) {
563
+ border-bottom-color: transparent;
564
+ }
565
+ /* Single-line cells (DataTable wrap={false} or ColumnDef.wrap: false). The
566
+ zero max-width keeps cell text out of the automatic column sizing, so
567
+ columns keep their declared widths and long text ends in an ellipsis
568
+ (revealed in a tooltip on hover). */
569
+ :global(.datatable-table tbody td.vtable-truncate) {
570
+ white-space: nowrap;
571
+ text-overflow: ellipsis;
572
+ max-width: 0;
573
+ }
472
574
  /* Allow certain long cells to wrap fully if explicitly requested */
473
575
  :global(.datatable-table td.wrap) {
474
576
  white-space: normal;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export type ColumnDef<T extends Record<string, unknown> = Record<string, unknown
29
29
  * - Minimum column width as a CSS length (e.g. `'12rem'`).
30
30
  * A CSS-length `width` is also a minimum. When the minimums exceed the
31
31
  * container, the table scrolls sideways instead of squeezing its columns.
32
+ * Applies to the declared layout: a user may resize the column below it.
32
33
  */
33
34
  minWidth?: string;
34
35
  /**
@@ -37,6 +38,22 @@ export type ColumnDef<T extends Record<string, unknown> = Record<string, unknown
37
38
  * offsets are measured, so any width type works.
38
39
  */
39
40
  sticky?: "left" | "right";
41
+ /**
42
+ * - Group label shown in a header row above the
43
+ * column headers. Adjacent columns with the same group share one cell.
44
+ */
45
+ group?: string;
46
+ /**
47
+ * - Set `false` to keep this column fixed when
48
+ * the table is `resizable`. Defaults to `true`.
49
+ */
50
+ resizable?: boolean;
51
+ /**
52
+ * - Wrap long text in this column's cells; overrides
53
+ * the table's `wrap` prop. When false, cells stay on one line and cut-off text
54
+ * is shown in a tooltip.
55
+ */
56
+ wrap?: boolean;
40
57
  /**
41
58
  * - Whether clicking the column header sorts the
42
59
  * table. Defaults to `true`.
package/dist/index.js CHANGED
@@ -43,9 +43,17 @@ export {
43
43
  * @property {string} [minWidth] - Minimum column width as a CSS length (e.g. `'12rem'`).
44
44
  * A CSS-length `width` is also a minimum. When the minimums exceed the
45
45
  * container, the table scrolls sideways instead of squeezing its columns.
46
+ * Applies to the declared layout: a user may resize the column below it.
46
47
  * @property {'left'|'right'} [sticky] - Keep the column in view while the table
47
48
  * scrolls sideways, pinned to that edge. Several columns may stick per side;
48
49
  * offsets are measured, so any width type works.
50
+ * @property {string} [group] - Group label shown in a header row above the
51
+ * column headers. Adjacent columns with the same group share one cell.
52
+ * @property {boolean} [resizable] - Set `false` to keep this column fixed when
53
+ * the table is `resizable`. Defaults to `true`.
54
+ * @property {boolean} [wrap] - Wrap long text in this column's cells; overrides
55
+ * the table's `wrap` prop. When false, cells stay on one line and cut-off text
56
+ * is shown in a tooltip.
49
57
  * @property {boolean} [sortable] - Whether clicking the column header sorts the
50
58
  * table. Defaults to `true`.
51
59
  * @property {'value'|'list'|'daterange'|'datetimerange'|'none'} [filterType]
package/dist/styles.css CHANGED
@@ -9,6 +9,9 @@
9
9
  --vtable-color-info: #3b82f6; /* blue-500 */
10
10
 
11
11
  --vtable-radius: 0.375rem; /* rounded-md */
12
+
13
+ --vtable-resize-line: #cbd5e1; /* slate-300: resize separator at rest */
14
+ --vtable-resize-line-hover: #64748b; /* slate-500: while its header is hovered */
12
15
  --vtable-row-height: 2.25rem; /* default row height hint for virtual scroll */
13
16
  }
14
17
 
@@ -20,7 +23,7 @@
20
23
  isolation: isolate;
21
24
  }
22
25
 
23
- :global(.datatable-table) {
26
+ .datatable-table {
24
27
  display: table;
25
28
  width: 100%;
26
29
  min-width: 0;
@@ -34,7 +37,7 @@
34
37
 
35
38
  /* Sticky header: each header cell sticks (rather than the <thead>), so a
36
39
  cell can also stick horizontally for sticky columns. */
37
- :global(.datatable-table thead.sticky-header th) {
40
+ .datatable-table thead.sticky-header th {
38
41
  position: sticky;
39
42
  top: 0;
40
43
  z-index: 2;
@@ -43,7 +46,7 @@
43
46
  /* separate + 0 spacing looks like collapse here (bottom borders only) but
44
47
  keeps each border on its cell, so borders move with sticky cells. Set on
45
48
  the inner <table> itself: Tailwind's preflight collapses every table. */
46
- :global(.datatable-table table.vtlist-inner) {
49
+ .datatable-table table.vtlist-inner {
47
50
  border-collapse: separate;
48
51
  border-spacing: 0;
49
52
  }
@@ -51,41 +54,105 @@
51
54
  /* Sticky columns (ColumnDef.sticky). Body cells take the row's background
52
55
  (striping, hover, selection) so scrolled cells do not show through. The
53
56
  <tbody> is rendered by VirtualList, hence fully global. */
54
- :global(.datatable-table tbody td.vtable-sticky) {
57
+ .datatable-table tbody td.vtable-sticky {
55
58
  position: sticky;
56
59
  z-index: 1;
57
60
  background-color: inherit;
58
61
  }
59
62
 
60
- :global(.datatable-table thead.sticky-header th.vtable-sticky) {
63
+ .datatable-table thead.sticky-header th.vtable-sticky {
61
64
  z-index: 3;
62
65
  }
63
66
 
64
67
  /* Keep an open header filter above the sticky header cells */
65
- :global(.datatable-table thead.sticky-header th.vtable-filter-open) {
68
+ .datatable-table thead.sticky-header th.vtable-filter-open {
66
69
  z-index: 4;
67
70
  }
68
71
 
69
72
  /* Divider shadow on the innermost sticky column, only while columns are
70
73
  scrolled under it */
71
- :global(.virtual-data-table[data-scrolled-start] .vtable-sticky-edge-left) {
74
+ .virtual-data-table[data-scrolled-start] .vtable-sticky-edge-left {
72
75
  box-shadow: 6px 0 6px -4px rgba(15, 23, 42, 0.18);
73
76
  }
74
77
 
75
- :global(.virtual-data-table[data-scrolled-end] .vtable-sticky-edge-right) {
78
+ .virtual-data-table[data-scrolled-end] .vtable-sticky-edge-right {
76
79
  box-shadow: -6px 0 6px -4px rgba(15, 23, 42, 0.18);
77
80
  }
78
81
 
79
- :global(.dark .virtual-data-table[data-scrolled-start] .vtable-sticky-edge-left) {
82
+ .dark .virtual-data-table[data-scrolled-start] .vtable-sticky-edge-left {
80
83
  box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.6);
81
84
  }
82
85
 
83
- :global(.dark .virtual-data-table[data-scrolled-end] .vtable-sticky-edge-right) {
86
+ .dark .virtual-data-table[data-scrolled-end] .vtable-sticky-edge-right {
84
87
  box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.6);
85
88
  }
86
89
 
90
+ /* Resizable columns: once a column is resized the table switches to a
91
+ fixed layout whose width is the sum of the column widths (set by DataTable
92
+ as --vtable-table-width). */
93
+ .virtual-data-table.vtable-fixed-layout table.vtlist-inner {
94
+ table-layout: fixed;
95
+ width: var(--vtable-table-width);
96
+ }
97
+
98
+ .datatable-table thead th .vtable-resize-handle {
99
+ position: absolute;
100
+ top: 0;
101
+ right: 0;
102
+ bottom: 0;
103
+ width: 0.6rem;
104
+ cursor: col-resize;
105
+ touch-action: none;
106
+ z-index: 1;
107
+ }
108
+
109
+ /* Separator line on the header's right edge: always shown on resizable
110
+ columns, stronger while the header is hovered, accent-coloured and full
111
+ height on the handle itself or while dragging. */
112
+ .datatable-table thead th .vtable-resize-handle::after {
113
+ content: '';
114
+ position: absolute;
115
+ top: 22%;
116
+ bottom: 22%;
117
+ right: 0;
118
+ width: 2px;
119
+ border-radius: 1px;
120
+ background-color: var(--vtable-resize-line);
121
+ transition:
122
+ background-color 0.12s ease-in-out,
123
+ top 0.12s ease-in-out,
124
+ bottom 0.12s ease-in-out,
125
+ width 0.12s ease-in-out;
126
+ }
127
+
128
+ .datatable-table thead th:hover .vtable-resize-handle::after {
129
+ top: 12%;
130
+ bottom: 12%;
131
+ background-color: var(--vtable-resize-line-hover);
132
+ }
133
+
134
+ .datatable-table thead th .vtable-resize-handle:hover::after,
135
+ .datatable-table thead th .vtable-resize-handle.vtable-resize-active::after {
136
+ top: 0;
137
+ bottom: 0;
138
+ width: 3px;
139
+ background-color: var(--vtable-color-accent-border);
140
+ }
141
+
142
+ .dark .datatable-table thead th .vtable-resize-handle {
143
+ --vtable-resize-line: #4b5563; /* gray-600 */
144
+ --vtable-resize-line-hover: #9ca3af; /* gray-400 */
145
+ }
146
+
147
+ /* Keep the resize cursor and stop text selection while dragging */
148
+ .virtual-data-table.vtable-resizing,
149
+ .virtual-data-table.vtable-resizing * {
150
+ cursor: col-resize !important;
151
+ user-select: none;
152
+ }
153
+
87
154
  /* Header visual styles - only bottom border */
88
- :global(.datatable-table) thead th {
155
+ .datatable-table thead th {
89
156
  background-color: #f8f9fa;
90
157
  font-size: 0.8125rem; /* 13px */
91
158
  font-weight: 600;
@@ -104,32 +171,32 @@
104
171
 
105
172
  /* Row striping - alternating colors */
106
173
  /* VirtualList may wrap rows, so we target tr directly */
107
- :global(.datatable-table tbody tr:nth-of-type(even)) {
174
+ .datatable-table tbody tr:nth-of-type(even) {
108
175
  background-color: #ffffff;
109
176
  }
110
177
 
111
- :global(.datatable-table tbody tr:nth-of-type(odd)) {
178
+ .datatable-table tbody tr:nth-of-type(odd) {
112
179
  background-color: #f8f9fa;
113
180
  }
114
181
 
115
182
  /* Also ensure tr elements themselves have background */
116
- :global(.datatable-table tbody tr) {
183
+ .datatable-table tbody tr {
117
184
  background-color: inherit;
118
185
  }
119
186
 
120
187
  /* Hover effect */
121
- :global(.datatable-table tbody tr:hover) {
188
+ .datatable-table tbody tr:hover {
122
189
  background-color: #e7f1ff !important;
123
190
  transition: background-color 0.15s ease-in-out;
124
191
  }
125
192
 
126
193
  /* Selesky-500 row overrides striping and hover */
127
- :global(.datatable-table tbody tr.selected-row) {
194
+ .datatable-table tbody tr.selected-row {
128
195
  background-color: #e0f2fe !important; /* light sky background */
129
196
  box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
130
197
  }
131
198
 
132
- :global(.dark) :global(.datatable-table tbody tr.selected-row) {
199
+ .dark .datatable-table tbody tr.selected-row {
133
200
  /* brighter, higher-contrast selection in dark mode */
134
201
  background-color: rgba(14, 165, 233, 0.22) !important; /* stronger visible blue */
135
202
  box-shadow: inset 6px 0 0 0 rgba(56, 189, 248, 0.85); /* stronger left accent */
@@ -139,18 +206,18 @@
139
206
  }
140
207
 
141
208
  /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
142
- :global(.datatable-table tbody tr.selected-row) td {
209
+ .datatable-table tbody tr.selected-row td {
143
210
  background-color: #e0f2fe !important;
144
211
  }
145
212
 
146
- :global(.dark) :global(.datatable-table tbody tr.selected-row) td {
213
+ .dark .datatable-table tbody tr.selected-row td {
147
214
  background-color: rgba(14, 165, 233, 0.22) !important;
148
215
  color: #f0fbff !important; /* ensure high-contrast, very light text */
149
216
  border-bottom-color: rgba(255, 255, 255, 0.06);
150
217
  }
151
218
 
152
219
  /* Body cell defaults - only bottom border */
153
- :global(.datatable-table tbody td) {
220
+ .datatable-table tbody td {
154
221
  padding: 0.5rem 0.5rem;
155
222
  border-top: none;
156
223
  border-left: none;
@@ -166,24 +233,24 @@
166
233
  }
167
234
 
168
235
  /* No-wrap variant for cells that should truncate */
169
- :global(.datatable-table tbody td.nowrap) {
236
+ .datatable-table tbody td.nowrap {
170
237
  white-space: nowrap;
171
238
  text-overflow: ellipsis;
172
239
  }
173
240
 
174
241
  /* Compact variant */
175
- :global(.datatable-table.compact tbody td) {
242
+ .datatable-table.compact tbody td {
176
243
  padding: 0.25rem 0.5rem;
177
244
  }
178
245
 
179
246
  /* Header content alignment helper */
180
- :global(.datatable-table thead th > div) {
247
+ .datatable-table thead th > div {
181
248
  display: inline-flex;
182
249
  align-items: center;
183
250
  gap: 0.25rem;
184
251
  }
185
252
 
186
- :global(.datatable-table thead th .vtable-header-content) {
253
+ .datatable-table thead th .vtable-header-content {
187
254
  display: flex;
188
255
  align-items: center;
189
256
  justify-content: space-between;
@@ -192,7 +259,7 @@
192
259
  width: 100%;
193
260
  }
194
261
 
195
- :global(.datatable-table thead th .vtable-header-sort-button) {
262
+ .datatable-table thead th .vtable-header-sort-button {
196
263
  appearance: none;
197
264
  border: 0;
198
265
  background: transparent;
@@ -207,33 +274,80 @@
207
274
  text-align: left;
208
275
  }
209
276
 
277
+ /* Grouped column headers (ColumnDef.group): a header row above the column
278
+ headers, one cell per run of columns sharing a group. */
279
+ .datatable-table thead th.vtable-group-header {
280
+ text-align: center;
281
+ padding-top: 0.25rem;
282
+ padding-bottom: 0.25rem;
283
+ font-size: 0.75rem;
284
+ letter-spacing: 0.05em;
285
+ color: #475569;
286
+ box-shadow: none;
287
+ }
288
+
289
+ /* Divider between groups; a run continued past a sticky boundary has none */
290
+ .datatable-table thead th.vtable-group-header + th.vtable-group-header:not(.vtable-group-cont
291
+ ) {
292
+ border-left: 1px solid #dee2e6;
293
+ }
294
+
295
+ .datatable-table thead th.vtable-group-empty {
296
+ border-bottom-color: transparent;
297
+ }
298
+
299
+ .dark .datatable-table thead th.vtable-group-header {
300
+ color: #cbd5e1;
301
+ box-shadow: none;
302
+ }
303
+
304
+ .dark
305
+ .datatable-table thead th.vtable-group-header + th.vtable-group-header:not(.vtable-group-cont
306
+ ) {
307
+ border-left-color: #374151;
308
+ }
309
+
310
+ .dark .datatable-table thead th.vtable-group-empty {
311
+ border-bottom-color: transparent;
312
+ }
313
+
314
+ /* Single-line cells (DataTable wrap={false} or ColumnDef.wrap: false). The
315
+ zero max-width keeps cell text out of the automatic column sizing, so
316
+ columns keep their declared widths and long text ends in an ellipsis
317
+ (revealed in a tooltip on hover). */
318
+ .datatable-table tbody td.vtable-truncate {
319
+ white-space: nowrap;
320
+ text-overflow: ellipsis;
321
+ max-width: 0;
322
+ }
323
+
210
324
  /* Allow certain long cells to wrap fully if explicitly requested */
211
- :global(.datatable-table td.wrap) {
325
+ .datatable-table td.wrap {
212
326
  white-space: normal;
213
327
  word-break: break-word;
214
328
  }
215
329
 
216
330
  /* Dark mode variants for the datatable */
217
- :global(.dark) :global(.datatable-table thead th) {
331
+ .dark .datatable-table thead th {
218
332
  background-color: #1f2937;
219
333
  border-bottom-color: #374151;
220
334
  color: #f9fafb;
221
335
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
222
336
  }
223
337
 
224
- :global(.dark) :global(.datatable-table tbody tr:nth-of-type(even)) {
338
+ .dark .datatable-table tbody tr:nth-of-type(even) {
225
339
  background-color: #111827;
226
340
  }
227
341
 
228
- :global(.dark) :global(.datatable-table tbody tr:nth-of-type(odd)) {
342
+ .dark .datatable-table tbody tr:nth-of-type(odd) {
229
343
  background-color: #1f2937;
230
344
  }
231
345
 
232
- :global(.dark) :global(.datatable-table tbody tr:hover) {
346
+ .dark .datatable-table tbody tr:hover {
233
347
  background-color: #374151 !important;
234
348
  }
235
349
 
236
- :global(.dark) :global(.datatable-table tbody td) {
350
+ .dark .datatable-table tbody td {
237
351
  border-bottom-color: #374151;
238
352
  color: #e5e7eb;
239
353
  }
@@ -241,36 +355,36 @@
241
355
  /* Shared control styles (inputs, pagination, column filters) used by page components */
242
356
 
243
357
  /* Accent-color focus ring for search input and per-page select — respects --vtable-color-accent */
244
- :global(.vtable-search-input:focus),
245
- :global(.vtable-perpage-select:focus) {
358
+ .vtable-search-input:focus,
359
+ .vtable-perpage-select:focus {
246
360
  border-color: var(--vtable-color-accent-border);
247
361
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--vtable-color-accent) 20%, transparent);
248
362
  outline: none;
249
363
  }
250
364
 
251
- :global(.datatable-input) {
365
+ .datatable-input {
252
366
  padding: 0.375rem 0.75rem;
253
367
  font-size: 0.95rem;
254
368
  border: 1px solid #ced4da;
255
369
  border-radius: 0.25rem;
256
370
  }
257
371
 
258
- :global(.datatable-input:focus) {
372
+ .datatable-input:focus {
259
373
  border-color: #86b7fe;
260
374
  outline: 0;
261
375
  box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
262
376
  }
263
377
 
264
- :global(.search-filtering-row) {
378
+ .search-filtering-row {
265
379
  background-color: #f8f9fa;
266
380
  }
267
381
 
268
- :global(.search-filtering-row th) {
382
+ .search-filtering-row th {
269
383
  padding: 0.1rem 0.1rem;
270
384
  border-bottom: 1px solid #dee2e6;
271
385
  }
272
386
 
273
- :global(.column-filter) {
387
+ .column-filter {
274
388
  width: 95%;
275
389
  padding: 0.2rem 0.25rem;
276
390
  font-size: 0.8rem;
@@ -278,20 +392,20 @@
278
392
  border-radius: 0.25rem;
279
393
  }
280
394
 
281
- :global(.column-filter::placeholder) {
395
+ .column-filter::placeholder {
282
396
  color: #adb5bd;
283
397
  font-size: 0.75rem;
284
398
  font-style: italic;
285
399
  }
286
400
 
287
- :global(.datatable-pagination) {
401
+ .datatable-pagination {
288
402
  display: flex;
289
403
  gap: 0.1rem;
290
404
  margin-top: 0.6rem;
291
405
  }
292
406
 
293
- :global(.datatable-pagination li a),
294
- :global(.datatable-pagination li button) {
407
+ .datatable-pagination li a,
408
+ .datatable-pagination li button {
295
409
  padding: 0.3rem 0.7rem;
296
410
  border: 1px solid #dee2e6;
297
411
  border-radius: 0;
@@ -300,13 +414,13 @@
300
414
  text-decoration: none;
301
415
  }
302
416
 
303
- :global(.datatable-pagination li a:hover),
304
- :global(.datatable-pagination li button:hover) {
417
+ .datatable-pagination li a:hover,
418
+ .datatable-pagination li button:hover {
305
419
  background-color: #e9ecef;
306
420
  }
307
421
 
308
- :global(.datatable-pagination .datatable-active a),
309
- :global(.datatable-pagination .datatable-active button) {
422
+ .datatable-pagination .datatable-active a,
423
+ .datatable-pagination .datatable-active button {
310
424
  background-color: #0d6efd;
311
425
  border-color: #0d6efd;
312
426
  color: #fff;
@@ -314,7 +428,7 @@
314
428
 
315
429
  /* Force the active/current page to use the accent tokens (override flowbite's primary/orange).
316
430
  Intentionally specific to reliably win over third-party rules. */
317
- :global([data-pagination-id] ul li [aria-current='page']) {
431
+ [data-pagination-id] ul li [aria-current='page'] {
318
432
  background-color: var(--vtable-color-accent-light) !important;
319
433
  color: var(--vtable-color-accent) !important;
320
434
  border-color: transparent !important;
@@ -323,10 +437,10 @@
323
437
  /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
324
438
  (keeps border, radius and min-width consistent). This is minimal and won't
325
439
  override hover/text colors managed by Tailwind classes applied at runtime. */
326
- :global([data-pagination-id] ul li:first-child > button),
327
- :global([data-pagination-id] ul li:first-child > a),
328
- :global([data-pagination-id] ul li:last-child > button),
329
- :global([data-pagination-id] ul li:last-child > a) {
440
+ [data-pagination-id] ul li:first-child > button,
441
+ [data-pagination-id] ul li:first-child > a,
442
+ [data-pagination-id] ul li:last-child > button,
443
+ [data-pagination-id] ul li:last-child > a {
330
444
  border: 1px solid #d1d5db; /* border-gray-300 */
331
445
  min-width: 2rem; /* align with numeric buttons' min width */
332
446
  background: transparent;
@@ -334,20 +448,20 @@
334
448
  }
335
449
 
336
450
  /* Light mode: hover/focus for Prev/Next match numeric button hover */
337
- :global([data-pagination-id] ul li:first-child > button:hover),
338
- :global([data-pagination-id] ul li:first-child > a:hover),
339
- :global([data-pagination-id] ul li:last-child > button:hover),
340
- :global([data-pagination-id] ul li:last-child > a:hover),
341
- :global([data-pagination-id] ul li:first-child > button:focus),
342
- :global([data-pagination-id] ul li:first-child > a:focus),
343
- :global([data-pagination-id] ul li:last-child > button:focus),
344
- :global([data-pagination-id] ul li:last-child > a:focus) {
451
+ [data-pagination-id] ul li:first-child > button:hover,
452
+ [data-pagination-id] ul li:first-child > a:hover,
453
+ [data-pagination-id] ul li:last-child > button:hover,
454
+ [data-pagination-id] ul li:last-child > a:hover,
455
+ [data-pagination-id] ul li:first-child > button:focus,
456
+ [data-pagination-id] ul li:first-child > a:focus,
457
+ [data-pagination-id] ul li:last-child > button:focus,
458
+ [data-pagination-id] ul li:last-child > a:focus {
345
459
  background-color: #f3f4f6; /* tailwind gray-100 */
346
460
  outline: none;
347
461
  }
348
462
 
349
463
  /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
350
- :global([data-pagination-id] ul li [data-ellipsis='true']) {
464
+ [data-pagination-id] ul li [data-ellipsis='true'] {
351
465
  cursor: pointer;
352
466
  background: transparent !important;
353
467
  color: inherit;
@@ -357,8 +471,8 @@
357
471
  }
358
472
 
359
473
  /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
360
- :global([data-pagination-id] ul li:first-child svg),
361
- :global([data-pagination-id] ul li:last-child svg) {
474
+ [data-pagination-id] ul li:first-child svg,
475
+ [data-pagination-id] ul li:last-child svg {
362
476
  height: 1.25rem;
363
477
  width: 1.25rem;
364
478
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangt58/svelte-vtable",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A Svelte 5 library for virtualized data tables with sorting, selection, and pagination controls.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -31,8 +31,8 @@
31
31
  "scripts": {
32
32
  "check": "svelte-check --tsconfig ./tsconfig.json",
33
33
  "build:styles": "node ./scripts/build-styles.cjs",
34
- "build": "svelte-package -i src/lib",
35
- "prepare": "npm run build:styles && npm run build",
34
+ "build": "svelte-package -i src/lib && node ./scripts/build-styles.cjs",
35
+ "prepare": "npm run build",
36
36
  "prepublishOnly": "npm run build && npm run check && npm run test",
37
37
  "format": "prettier --write .",
38
38
  "format:check": "prettier --check .",