@svgrid/create 1.0.3 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svgrid/create",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Scaffold a Svelte app powered by SvGrid in one command: npm create @svgrid@latest",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "vite": "^8.0.10"
23
23
  },
24
24
  "dependencies": {
25
- "@svgrid/grid": "^1.0.1"
25
+ "@svgrid/grid": "^1.0.2"
26
26
  }
27
27
  }
@@ -89,325 +89,44 @@ body {
89
89
  sans-serif;
90
90
  }
91
91
 
92
-
93
92
  /* ---------------------------------------------------------------------------
94
- * Grid theming overrides. SvGrid ships hard-coded light-mode colors on its
95
- * internals (.sv-grid-cell, .sv-grid-head, menus, pager, ...). These rules -
96
- * the same ones the svgrid.com demos use - route them through the --sg-* tokens
97
- * above so the grid themes (and goes dark) with the rest of the app.
93
+ * Optional polish. The grid themes itself from the --sg-* tokens above, so it
94
+ * already follows light / dark with no extra CSS. These rules only add table
95
+ * niceties the grid leaves to the app: cell gridlines, zebra striping, row
96
+ * hover, and a styled pagination bar. Delete any you don't want.
98
97
  * ------------------------------------------------------------------------- */
99
- /*
100
- * The SvGrid component ships with hard-coded light-mode colors on
101
- * .sv-grid-cell / .sv-grid-head / .sv-grid-foot / .sv-grid-shell. We
102
- * override them to use our CSS custom properties so dark mode works.
103
- */
104
- .sv-grid-shell {
105
- border-bottom: 1px solid var(--sg-border) !important;
106
- }
98
+
99
+ /* Cell gridlines (the grid draws none by default). */
107
100
  .sv-grid-column,
108
101
  .sv-grid-cell {
109
- background: var(--sg-bg) !important;
110
- color: var(--sg-fg);
111
- /* Visible row + column borders. The table uses border-collapse: separate
112
- * so we draw right + bottom only (no doubles between adjacent cells). */
113
102
  border-right: 1px solid var(--sg-border) !important;
114
103
  border-bottom: 1px solid var(--sg-border) !important;
115
104
  }
116
- /* Last column has no right border so it doesn't double up against the grid edge */
117
105
  .sv-grid-table tr > :last-child.sv-grid-column,
118
106
  .sv-grid-table tr > :last-child.sv-grid-cell {
119
107
  border-right: 0 !important;
120
108
  }
121
- .sv-grid-head {
122
- background: var(--sg-header-bg) !important;
123
- color: var(--sg-header-fg);
124
- }
125
- .sv-grid-foot {
126
- background: var(--sg-header-bg) !important;
127
- color: var(--sg-header-fg);
128
- }
129
- .sv-grid-scrollbar-corner,
130
- .sv-grid-scrollbar-corner-br {
131
- background: var(--sg-header-bg) !important;
132
- border-bottom-color: var(--sg-border) !important;
133
- }
134
- /* Hide the corner when its accompanying scrollbar is absent. */
135
- .sv-grid-no-scroll .sv-grid-scrollbar-corner,
136
- .sv-grid-no-scroll .sv-grid-scrollbar {
137
- display: none !important;
138
- }
139
- /* Tone down the active-cell outline; SvGrid's default is 2px solid #0b63f3 which
140
- reads as a hard rectangle on otherwise calm rows. */
141
- .sv-grid-cell-active {
142
- outline-color: var(--sg-accent) !important;
143
- outline-offset: -1px !important;
144
- }
145
-
146
- /* Filter row inputs + cell editor inputs + column menu inputs */
147
- .sv-grid-column-filter,
148
- .sv-grid-filter-value,
149
- .sv-grid-cell-editor,
150
- .sv-grid-menu-search,
151
- .sv-grid-menu-condition-value,
152
- .sv-grid-global-filter input {
153
- background: var(--sg-input-bg) !important;
154
- color: var(--sg-fg) !important;
155
- border: 1px solid var(--sg-input-border) !important;
156
- border-radius: 4px !important;
157
- padding: 0 8px !important;
158
- box-sizing: border-box !important;
159
- }
160
- /*
161
- * SvGrid's `.sv-grid-menu-condition-value` is styled `flex: 1 1 0`, which is
162
- * only meaningful inside a flex parent. Since the redesigned menu uses block
163
- * layout, force the input to span the full menu width.
164
- */
165
- .sv-grid-menu-condition-value,
166
- .sv-grid-menu-search {
167
- width: 100% !important;
168
- }
169
- .sv-grid-column-filter::placeholder,
170
- .sv-grid-filter-value::placeholder,
171
- .sv-grid-cell-editor::placeholder,
172
- .sv-grid-menu-search::placeholder {
173
- color: var(--sg-muted);
174
- opacity: 0.7;
175
- }
176
-
177
- /* Filter row sizing - make the row read as a single calm bar */
178
- .sv-grid-column-filter {
179
- height: 28px !important;
180
- width: 100% !important;
181
- font-size: 0.8125rem !important;
182
- }
183
-
184
- /*
185
- * Override SvGrid's hard-coded #0b63f3 focus outline on filter inputs and the
186
- * inline cell editor. The library sets:
187
- * outline: 2px solid #0b63f3; outline-offset: -2px; border-color: #0b63f3
188
- * which is harsh on a dark background. Replace with a calm accent-tinted
189
- * box-shadow that respects the active theme.
190
- */
191
- .sv-grid-column-filter:focus,
192
- .sv-grid-filter-value:focus,
193
- .sv-grid-menu-search:focus,
194
- .sv-grid-menu-condition-value:focus,
195
- .sv-grid-global-filter input:focus,
196
- .sv-grid-cell-editor:focus {
197
- outline: none !important;
198
- outline-offset: 0 !important;
199
- border-color: var(--sg-accent) !important;
200
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--sg-accent) 30%, transparent) !important;
201
- }
202
-
203
- /* Column menu popover */
204
- .sv-grid-menu {
205
- background: var(--sg-bg) !important;
206
- color: var(--sg-fg) !important;
207
- border-color: var(--sg-border) !important;
208
- box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4) !important;
209
- }
210
- .sv-grid-menu-item:hover {
211
- background: var(--sg-row-hover-bg) !important;
212
- }
213
- .sv-grid-menu-sep {
214
- background: var(--sg-border) !important;
215
- }
216
- .sv-grid-menu-filter-head {
217
- color: var(--sg-muted) !important;
218
- }
219
- .sv-grid-menu-operator-btn {
220
- background: var(--sg-input-bg) !important;
221
- color: var(--sg-fg) !important;
222
- border-color: var(--sg-input-border) !important;
223
- }
224
- .sv-grid-menu-operator-btn.is-active {
225
- background: var(--sg-accent) !important;
226
- color: #fff !important;
227
- border-color: var(--sg-accent) !important;
228
- }
229
109
 
230
- /* New <select> for filter operator (replaces the radio-button group) */
231
- .sv-grid-menu-operator-select {
232
- width: 100%;
233
- height: 28px;
234
- padding: 0 22px 0 8px;
235
- margin-bottom: 6px;
236
- border: 1px solid var(--sg-input-border);
237
- border-radius: 5px;
238
- background: var(--sg-input-bg);
239
- color: var(--sg-fg);
240
- font: inherit;
241
- font-size: 13px;
242
- cursor: pointer;
243
- appearance: none;
244
- -webkit-appearance: none;
245
- background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
246
- linear-gradient(135deg, currentColor 50%, transparent 50%);
247
- background-position:
248
- calc(100% - 12px) 12px,
249
- calc(100% - 8px) 12px;
250
- background-size:
251
- 4px 4px,
252
- 4px 4px;
253
- background-repeat: no-repeat;
254
- }
255
- .sv-grid-menu-operator-select:focus {
256
- outline: none;
257
- border-color: var(--sg-accent);
258
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--sg-accent) 40%, transparent);
110
+ /* Zebra striping + row hover. */
111
+ .sv-grid-table tbody tr:nth-child(even) .sv-grid-cell {
112
+ background: var(--sg-row-alt-bg) !important;
259
113
  }
260
-
261
- /* Facet list (the "Select all" + value checklist inside the menu) */
262
- .sv-grid-facet:hover {
114
+ .sv-grid-table tbody tr:hover .sv-grid-cell {
263
115
  background: var(--sg-row-hover-bg) !important;
264
116
  }
265
- .sv-grid-facet-all {
266
- border-bottom-color: var(--sg-border) !important;
267
- }
268
- .sv-grid-facet-list {
269
- border-color: var(--sg-border) !important;
270
- }
271
- .sv-grid-facet-empty,
272
- .sv-grid-facet-note {
273
- color: var(--sg-muted) !important;
274
- }
275
-
276
- /* Menu action buttons */
277
- .sv-grid-menu-btn {
278
- background: var(--sg-input-bg) !important;
279
- color: var(--sg-fg) !important;
280
- border-color: var(--sg-input-border) !important;
281
- }
282
- .sv-grid-menu-btn-primary {
283
- background: var(--sg-accent) !important;
284
- color: #fff !important;
285
- border-color: var(--sg-accent) !important;
286
- }
287
-
288
- /* New filter-only popover (split out from the column menu) */
289
- .sv-grid-filter-menu {
290
- width: 260px;
291
- }
292
-
293
- /* Choose Columns submenu */
294
- .sv-grid-choose-columns-menu {
295
- width: 240px;
296
- }
297
- .sv-grid-choose-columns-menu .sv-grid-facet-list {
298
- max-height: 280px;
299
- }
300
- /* Native checkboxes inside the facet list pick up the theme accent */
301
- .sv-grid-facet input[type='checkbox'] {
302
- accent-color: var(--sg-accent);
303
- width: 14px;
304
- height: 14px;
305
- cursor: pointer;
306
- }
307
-
308
- /* Right-chevron on the "Choose columns" item to indicate a submenu */
309
- .sv-grid-menu-item-chevron {
310
- margin-left: auto;
311
- transform: rotate(-90deg);
312
- opacity: 0.55;
313
- }
314
- .sv-grid-menu-item.is-open .sv-grid-menu-item-chevron {
315
- opacity: 1;
316
- }
317
-
318
- /* Filter button on the column header (funnel icon, next to the 3-line menu)
319
- * Hidden when the column is idle. Becomes visible when:
320
- * - the column is hovered, OR
321
- * - the menu is open on this column, OR
322
- * - the column has an active filter (.is-active - also tinted in accent). */
323
- .sv-grid-col-filter-btn {
324
- opacity: 0 !important;
325
- }
326
- .sv-grid-column:hover .sv-grid-col-filter-btn,
327
- .sv-grid-col-filter-btn:hover,
328
- .sv-grid-col-filter-btn.is-open {
329
- opacity: 1 !important;
330
- }
331
- .sv-grid-col-filter-btn.is-active {
332
- color: var(--sg-accent) !important;
333
- opacity: 1 !important;
334
- }
335
-
336
- /* Magnifying-glass prefix on the filter menu's search input */
337
- .sv-grid-menu-search {
338
- padding-left: 28px !important;
339
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='M20 20l-4.5-4.5'/%3E%3C/svg%3E");
340
- background-position: 8px center;
341
- background-repeat: no-repeat;
342
- background-size: 14px 14px;
343
- }
344
-
345
- /* Filter menu spacing rhythm */
346
- .sv-grid-menu-filter > * + * {
347
- margin-top: 6px;
348
- }
349
- .sv-grid-facet-all {
350
- font-weight: 600;
351
- }
352
-
353
- /* Row-number column: themed muted text and matched background tokens. */
354
- .sv-grid-row-number-column,
355
- .sv-grid-row-number-cell {
356
- color: var(--sg-muted) !important;
357
- background: var(--sg-header-bg) !important;
358
- }
359
-
360
- /* Group row background (selection rules live below the zebra rule so they
361
- * win on source order; see below). */
362
- .sv-grid-group-row > .sv-grid-cell {
363
- background: var(--sg-header-bg) !important;
364
- color: var(--sg-header-fg) !important;
365
- }
366
-
367
- /* Checkbox (used for row selection + the read-only checkbox cells) */
368
- .sv-grid-checkbox {
369
- background: var(--sg-input-bg) !important;
370
- border-color: var(--sg-input-border) !important;
371
- }
372
- .sv-grid-checkbox[aria-checked='true'],
373
- .sv-grid-checkbox[aria-checked='mixed'] {
374
- background: var(--sg-accent) !important;
375
- border-color: var(--sg-accent) !important;
376
- color: #fff !important;
377
- }
378
-
379
- /* Filter-row operator button: SvGrid's scoped styles hard-code white bg +
380
- * dark text which is too bright in dark mode. Route through theme tokens. */
381
- .sv-grid-filter-operator-btn {
382
- background: var(--sg-input-bg) !important;
383
- color: var(--sg-fg) !important;
384
- border-color: var(--sg-input-border) !important;
385
- opacity: 0.85;
386
- }
387
- .sv-grid-filter-operator-btn:hover {
388
- opacity: 1;
389
- border-color: var(--sg-accent) !important;
390
- }
391
- .sv-grid-filter-operator-btn.is-open {
392
- border-color: var(--sg-accent) !important;
393
- opacity: 1;
394
- }
395
- .sv-grid-filter-operator-btn .sv-grid-header-icon {
396
- color: var(--sg-muted);
397
- }
398
- .sv-grid-filter-operator-btn .sv-grid-caret {
399
- color: var(--sg-muted);
117
+ /* Selection wins over zebra (declared after, same specificity). */
118
+ .sv-grid-table tbody tr.sv-grid-row-selected .sv-grid-cell,
119
+ .sv-grid-table tbody tr .sv-grid-cell[data-selected-range='true'] {
120
+ background: var(--sg-selection-bg) !important;
400
121
  }
401
122
 
402
- /* Pagination footer below the grid. Layout: PageSize · Range · Nav buttons.
403
- * Matches the AG-Grid-style pager the user shipped as a reference. */
123
+ /* Pagination bar: layout + theme (the grid ships the markup, not the styling). */
404
124
  .sv-grid-pagination {
405
125
  display: flex !important;
406
126
  align-items: center !important;
407
127
  justify-content: flex-end !important;
408
128
  gap: 24px !important;
409
129
  padding: 12px 16px !important;
410
- margin-top: 0 !important;
411
130
  border: 1px solid var(--sg-border) !important;
412
131
  border-top: 0 !important;
413
132
  border-radius: 0 0 6px 6px !important;
@@ -415,66 +134,31 @@ body {
415
134
  color: var(--sg-fg) !important;
416
135
  font-size: 13px !important;
417
136
  }
418
-
419
137
  .sv-grid-pagination-pagesize {
420
138
  display: inline-flex;
421
139
  align-items: center;
422
140
  gap: 8px;
423
141
  color: var(--sg-muted);
424
142
  }
425
- .sv-grid-pagination-pagesize select {
426
- height: 28px;
427
- padding: 0 22px 0 8px;
143
+ .sv-grid-pagination-pagesize select,
144
+ .sv-grid-pagination-btn {
428
145
  border: 1px solid var(--sg-input-border);
429
- border-radius: 5px;
430
146
  background: var(--sg-input-bg);
431
147
  color: var(--sg-fg);
148
+ border-radius: 5px;
149
+ height: 28px;
432
150
  font: inherit;
433
151
  font-size: 13px;
434
152
  cursor: pointer;
435
- appearance: none;
436
- -webkit-appearance: none;
437
- background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
438
- linear-gradient(135deg, currentColor 50%, transparent 50%);
439
- background-position:
440
- calc(100% - 12px) 12px,
441
- calc(100% - 8px) 12px;
442
- background-size:
443
- 4px 4px,
444
- 4px 4px;
445
- background-repeat: no-repeat;
446
153
  }
447
- .sv-grid-pagination-pagesize select:focus {
448
- outline: none;
449
- border-color: var(--sg-accent);
450
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--sg-accent) 30%, transparent);
451
- }
452
-
453
- .sv-grid-pagination-range {
454
- color: var(--sg-fg);
455
- }
456
-
457
- .sv-grid-pagination-nav {
458
- display: inline-flex;
459
- align-items: center;
460
- gap: 4px;
461
- }
462
-
463
154
  .sv-grid-pagination-btn {
464
155
  display: inline-flex !important;
465
156
  align-items: center !important;
466
157
  justify-content: center !important;
467
158
  width: 28px !important;
468
- height: 28px !important;
469
- padding: 0 !important;
470
159
  border: 0 !important;
471
- border-radius: 5px !important;
472
160
  background: transparent !important;
473
- color: var(--sg-fg) !important;
474
- font: inherit !important;
475
161
  font-size: 16px !important;
476
- cursor: pointer !important;
477
- transition: background-color 100ms ease, color 100ms ease;
478
162
  }
479
163
  .sv-grid-pagination-btn:hover:not(:disabled) {
480
164
  background: var(--sg-input-bg) !important;
@@ -485,64 +169,8 @@ body {
485
169
  opacity: 0.4 !important;
486
170
  cursor: default !important;
487
171
  }
488
-
489
- .sv-grid-pagination-label {
490
- margin: 0 8px;
491
- color: var(--sg-fg);
492
- }
493
-
494
- /* Resize handle: an invisible 6px hit-zone on the right edge of every
495
- * header. The pill ::after only appears while the column is hovered, the
496
- * handle is hovered, or a drag is in progress. Standard AG-Grid behavior. */
497
- .sv-grid-resize-handle {
498
- position: absolute !important;
499
- top: 0 !important;
500
- right: 0 !important;
501
- width: 6px !important;
502
- height: 100% !important;
503
- z-index: 100 !important;
504
- cursor: col-resize !important;
505
- background: transparent !important;
506
- pointer-events: auto !important;
507
- }
508
- .sv-grid-resize-handle::after {
509
- content: '';
510
- position: absolute;
511
- inset: 0;
512
- margin: auto 2px;
513
- width: 2px;
514
- background: var(--sg-fg);
515
- opacity: 0;
516
- border-radius: 1px;
517
- transition: background-color 100ms ease, opacity 100ms ease;
518
- }
519
- /* faint pill while the parent column is hovered */
520
- .sv-grid-column:hover .sv-grid-resize-handle::after {
521
- opacity: 0.3;
522
- }
523
- /* bright accent pill when the handle itself is hovered or being dragged.
524
- * The selector includes ".sv-grid-column:hover" to match the specificity
525
- * of the rule above and rank higher (extra :hover) so it wins on cascade. */
526
- .sv-grid-column:hover .sv-grid-resize-handle:hover::after,
527
- .sv-grid-resize-handle.is-resizing::after {
528
- background: var(--sg-accent);
529
- opacity: 1;
530
- }
531
- /* zebra striping by row */
532
- .sv-grid-table tbody tr:nth-child(even) .sv-grid-cell {
533
- background: var(--sg-row-alt-bg) !important;
534
- }
535
- .sv-grid-table tbody tr:hover .sv-grid-cell {
536
- background: var(--sg-row-hover-bg) !important;
537
- }
538
- /* Selected row and cell-range backgrounds. We re-write them here, AFTER
539
- * the zebra rule, with the same `.sv-grid-table tbody tr` prefix so they
540
- * match zebra's specificity (0,3,2) and beat it on source order. Without
541
- * this, even-numbered selected rows show the zebra bg instead of the
542
- * selection bg. */
543
- .sv-grid-table tbody tr.sv-grid-row-selected .sv-grid-cell {
544
- background: var(--sg-selection-bg) !important;
545
- }
546
- .sv-grid-table tbody tr .sv-grid-cell[data-selected-range='true'] {
547
- background: var(--sg-selection-bg) !important;
172
+ .sv-grid-pagination-nav {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ gap: 4px;
548
176
  }