argent-grid 0.1.0 → 0.2.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 (108) hide show
  1. package/.github/workflows/ci.yml +69 -0
  2. package/.github/workflows/pages.yml +6 -12
  3. package/.storybook/main.ts +20 -0
  4. package/.storybook/preview.ts +18 -0
  5. package/.storybook/tsconfig.json +24 -0
  6. package/AGENTS.md +2 -2
  7. package/README.md +51 -34
  8. package/angular.json +66 -0
  9. package/biome.json +66 -0
  10. package/demo-app/e2e/selection-screenshot.spec.ts +20 -0
  11. package/docs/AG-GRID-COMPARISON.md +725 -0
  12. package/docs/CELL-RENDERER-GUIDE.md +241 -0
  13. package/docs/CONTEXT-MENU-GUIDE.md +371 -0
  14. package/docs/LIVE-DATA-OPTIMIZATIONS.md +497 -0
  15. package/docs/PERFORMANCE-OPTIMIZATIONS-PHASE1.md +162 -0
  16. package/docs/PERFORMANCE-REVIEW.md +571 -0
  17. package/docs/RESEARCH-STATUS.md +234 -0
  18. package/docs/STATE-PERSISTENCE-GUIDE.md +370 -0
  19. package/docs/STORYBOOK-REFACTOR.md +215 -0
  20. package/docs/STORYBOOK-STATUS.md +156 -0
  21. package/docs/TEST-COVERAGE-REPORT.md +276 -0
  22. package/docs/THEME-API-GUIDE.md +445 -0
  23. package/docs/THEME-API-PLAN.md +364 -0
  24. package/e2e/advanced.spec.ts +109 -0
  25. package/e2e/argentgrid.spec.ts +65 -0
  26. package/e2e/benchmark.spec.ts +52 -0
  27. package/e2e/screenshots.spec.ts +52 -0
  28. package/e2e/theming.spec.ts +35 -0
  29. package/e2e/visual.spec.ts +91 -0
  30. package/e2e/visual.spec.ts-snapshots/grid-default.png +0 -0
  31. package/e2e/visual.spec.ts-snapshots/grid-empty-state.png +0 -0
  32. package/e2e/visual.spec.ts-snapshots/grid-filter-popup.png +0 -0
  33. package/e2e/visual.spec.ts-snapshots/grid-scroll-borders.png +0 -0
  34. package/e2e/visual.spec.ts-snapshots/grid-sidebar-buttons.png +0 -0
  35. package/e2e/visual.spec.ts-snapshots/grid-text-filter.png +0 -0
  36. package/e2e/visual.spec.ts-snapshots/grid-with-selection.png +0 -0
  37. package/package.json +20 -6
  38. package/plan.md +50 -18
  39. package/playwright.config.ts +38 -0
  40. package/setup-vitest.ts +10 -13
  41. package/src/lib/argent-grid.module.ts +10 -12
  42. package/src/lib/components/argent-grid.component.css +327 -76
  43. package/src/lib/components/argent-grid.component.html +186 -64
  44. package/src/lib/components/argent-grid.component.spec.ts +120 -160
  45. package/src/lib/components/argent-grid.component.ts +642 -189
  46. package/src/lib/components/argent-grid.selection.spec.ts +132 -0
  47. package/src/lib/components/set-filter/set-filter.component.ts +302 -0
  48. package/src/lib/directives/ag-grid-compatibility.directive.ts +16 -26
  49. package/src/lib/directives/click-outside.directive.ts +19 -0
  50. package/src/lib/rendering/canvas-renderer.spec.ts +366 -0
  51. package/src/lib/rendering/canvas-renderer.ts +418 -305
  52. package/src/lib/rendering/live-data-handler.ts +110 -0
  53. package/src/lib/rendering/live-data-optimizations.ts +133 -0
  54. package/src/lib/rendering/render/blit.spec.ts +16 -27
  55. package/src/lib/rendering/render/blit.ts +48 -36
  56. package/src/lib/rendering/render/cells.spec.ts +132 -0
  57. package/src/lib/rendering/render/cells.ts +46 -24
  58. package/src/lib/rendering/render/column-utils.ts +73 -0
  59. package/src/lib/rendering/render/hit-test.ts +55 -0
  60. package/src/lib/rendering/render/index.ts +79 -76
  61. package/src/lib/rendering/render/lines.ts +43 -43
  62. package/src/lib/rendering/render/primitives.ts +161 -0
  63. package/src/lib/rendering/render/theme.spec.ts +8 -12
  64. package/src/lib/rendering/render/theme.ts +7 -10
  65. package/src/lib/rendering/render/types.ts +2 -2
  66. package/src/lib/rendering/render/walk.spec.ts +35 -38
  67. package/src/lib/rendering/render/walk.ts +60 -50
  68. package/src/lib/rendering/utils/damage-tracker.spec.ts +8 -7
  69. package/src/lib/rendering/utils/damage-tracker.ts +6 -18
  70. package/src/lib/rendering/utils/index.ts +1 -1
  71. package/src/lib/services/grid.service.set-filter.spec.ts +219 -0
  72. package/src/lib/services/grid.service.spec.ts +1165 -201
  73. package/src/lib/services/grid.service.ts +819 -187
  74. package/src/lib/themes/parts/color-schemes.ts +132 -0
  75. package/src/lib/themes/parts/icon-sets.ts +258 -0
  76. package/src/lib/themes/theme-builder.ts +347 -0
  77. package/src/lib/themes/theme-quartz.ts +72 -0
  78. package/src/lib/themes/types.ts +238 -0
  79. package/src/lib/types/ag-grid-types.ts +73 -14
  80. package/src/public-api.ts +39 -9
  81. package/src/stories/Advanced.stories.ts +188 -0
  82. package/src/stories/ArgentGrid.stories.ts +277 -0
  83. package/src/stories/Benchmark.stories.ts +74 -0
  84. package/src/stories/CellRenderers.stories.ts +221 -0
  85. package/src/stories/Filtering.stories.ts +252 -0
  86. package/src/stories/Grouping.stories.ts +217 -0
  87. package/src/stories/Theming.stories.ts +124 -0
  88. package/src/stories/benchmark-wrapper.component.ts +315 -0
  89. package/tsconfig.storybook.json +10 -0
  90. package/vitest.config.ts +9 -9
  91. package/demo-app/README.md +0 -70
  92. package/demo-app/angular.json +0 -78
  93. package/demo-app/e2e/benchmark.spec.ts +0 -53
  94. package/demo-app/e2e/demo-page.spec.ts +0 -77
  95. package/demo-app/e2e/grid-features.spec.ts +0 -269
  96. package/demo-app/package-lock.json +0 -14023
  97. package/demo-app/package.json +0 -36
  98. package/demo-app/playwright-test-menu.js +0 -19
  99. package/demo-app/playwright.config.ts +0 -23
  100. package/demo-app/src/app/app.component.ts +0 -10
  101. package/demo-app/src/app/app.config.ts +0 -13
  102. package/demo-app/src/app/app.routes.ts +0 -7
  103. package/demo-app/src/app/demo-page/demo-page.component.css +0 -313
  104. package/demo-app/src/app/demo-page/demo-page.component.html +0 -124
  105. package/demo-app/src/app/demo-page/demo-page.component.ts +0 -366
  106. package/demo-app/src/index.html +0 -19
  107. package/demo-app/src/main.ts +0 -6
  108. package/demo-app/tsconfig.json +0 -31
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Color Scheme Parts
3
+ *
4
+ * Predefined color schemes that can be mixed with any theme
5
+ */
6
+
7
+ import type { ColorSchemePart, ThemeParameters } from '../types';
8
+
9
+ // ============================================================================
10
+ // LIGHT COLOR SCHEME
11
+ // ============================================================================
12
+
13
+ /**
14
+ * Light color scheme parameters
15
+ */
16
+ const LIGHT_SCHEME_PARAMS: ThemeParameters = {
17
+ backgroundColor: '#ffffff',
18
+ foregroundColor: '#181d1f',
19
+ secondaryForegroundColor: '#666666',
20
+ headerBackgroundColor: '#f5f5f5',
21
+ rowBackgroundColor: '#ffffff',
22
+ rowEvenBackgroundColor: '#fafafa',
23
+ rowHoverBackgroundColor: '#f0f0f0',
24
+ rowSelectedBackgroundColor: '#e3f2fd',
25
+ cellHoverBackgroundColor: '#f5f5f5',
26
+ groupRowBackgroundColor: '#fafafa',
27
+ borderColor: '#dcdcdc',
28
+ iconColor: '#181d1f',
29
+ };
30
+
31
+ /**
32
+ * Light color scheme part
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import { themeQuartz, colorSchemeLight } from 'argent-grid';
37
+ *
38
+ * const myTheme = themeQuartz.withPart(colorSchemeLight);
39
+ * ```
40
+ */
41
+ export const colorSchemeLight: ColorSchemePart = {
42
+ name: 'color-scheme-light',
43
+ type: 'color-scheme',
44
+ scheme: 'light',
45
+ params: LIGHT_SCHEME_PARAMS,
46
+ };
47
+
48
+ // ============================================================================
49
+ // DARK COLOR SCHEME
50
+ // ============================================================================
51
+
52
+ /**
53
+ * Dark color scheme parameters
54
+ */
55
+ const DARK_SCHEME_PARAMS: ThemeParameters = {
56
+ backgroundColor: '#1e1e1e',
57
+ foregroundColor: '#e0e0e0',
58
+ secondaryForegroundColor: '#a0a0a0',
59
+ headerBackgroundColor: '#2d2d30',
60
+ rowBackgroundColor: '#1e1e1e',
61
+ rowEvenBackgroundColor: '#252526',
62
+ rowHoverBackgroundColor: '#2a2d2e',
63
+ rowSelectedBackgroundColor: '#094771',
64
+ cellHoverBackgroundColor: '#2a2d2e',
65
+ groupRowBackgroundColor: '#252526',
66
+ borderColor: '#3c3c3c',
67
+ iconColor: '#e0e0e0',
68
+ };
69
+
70
+ /**
71
+ * Dark color scheme part
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * import { themeQuartz, colorSchemeDark } from 'argent-grid';
76
+ *
77
+ * const myTheme = themeQuartz.withPart(colorSchemeDark);
78
+ * ```
79
+ */
80
+ export const colorSchemeDark: ColorSchemePart = {
81
+ name: 'color-scheme-dark',
82
+ type: 'color-scheme',
83
+ scheme: 'dark',
84
+ params: DARK_SCHEME_PARAMS,
85
+ };
86
+
87
+ // ============================================================================
88
+ // AUTO COLOR SCHEME
89
+ // ============================================================================
90
+
91
+ /**
92
+ * Auto color scheme (follows system preference)
93
+ *
94
+ * Note: This requires JavaScript to detect system preference
95
+ * and apply the appropriate scheme
96
+ */
97
+ export const colorSchemeAuto = {
98
+ name: 'color-scheme-auto',
99
+ type: 'color-scheme' as const,
100
+ scheme: 'auto' as const,
101
+
102
+ /**
103
+ * Get the appropriate scheme based on system preference
104
+ */
105
+ getScheme(): ColorSchemePart {
106
+ if (typeof window !== 'undefined' && window.matchMedia) {
107
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
108
+ return prefersDark ? colorSchemeDark : colorSchemeLight;
109
+ }
110
+ return colorSchemeLight;
111
+ },
112
+ };
113
+
114
+ // ============================================================================
115
+ // EXPORTS
116
+ // ============================================================================
117
+
118
+ /**
119
+ * All available color schemes
120
+ */
121
+ export const COLOR_SCHEMES: Record<string, ColorSchemePart> = {
122
+ light: colorSchemeLight,
123
+ dark: colorSchemeDark,
124
+ auto: colorSchemeAuto as any,
125
+ };
126
+
127
+ /**
128
+ * Get color scheme by name
129
+ */
130
+ export function getColorScheme(name: string): ColorSchemePart | undefined {
131
+ return COLOR_SCHEMES[name];
132
+ }
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Icon Set Parts
3
+ *
4
+ * Predefined icon sets that can be mixed with any theme
5
+ */
6
+
7
+ import type { IconDefinition, IconSetPart } from '../types';
8
+
9
+ // ============================================================================
10
+ // QUARTZ ICON SET
11
+ // ============================================================================
12
+
13
+ const QUARTZ_ICONS: Record<string, IconDefinition> = {
14
+ asc: {
15
+ name: 'asc',
16
+ path: 'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z',
17
+ viewBox: '0 0 24 24',
18
+ },
19
+ desc: {
20
+ name: 'desc',
21
+ path: 'M19 13H5v-2h14v2z',
22
+ viewBox: '0 0 24 24',
23
+ },
24
+ menu: {
25
+ name: 'menu',
26
+ path: 'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z',
27
+ viewBox: '0 0 24 24',
28
+ },
29
+ filter: {
30
+ name: 'filter',
31
+ path: 'M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z',
32
+ viewBox: '0 0 24 24',
33
+ },
34
+ close: {
35
+ name: 'close',
36
+ path: 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',
37
+ viewBox: '0 0 24 24',
38
+ },
39
+ expand: {
40
+ name: 'expand',
41
+ path: 'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z',
42
+ viewBox: '0 0 24 24',
43
+ },
44
+ collapse: {
45
+ name: 'collapse',
46
+ path: 'M16.59 14.59L12 10.83 7.41 14.59 6 13.17l6-6 6 6z',
47
+ viewBox: '0 0 24 24',
48
+ },
49
+ pin: {
50
+ name: 'pin',
51
+ path: 'M16 12V4H8v8l-2 2v2h6v6l4-4v-2h6v-2z',
52
+ viewBox: '0 0 24 24',
53
+ },
54
+ columns: {
55
+ name: 'columns',
56
+ path: 'M10 18h5v-6h-5v6zm-6 0h5V5H4v13zm12 0h5v-6h-5v6zM10 5v6h11V5H10z',
57
+ viewBox: '0 0 24 24',
58
+ },
59
+ search: {
60
+ name: 'search',
61
+ path: 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z',
62
+ viewBox: '0 0 24 24',
63
+ },
64
+ };
65
+
66
+ /**
67
+ * Quartz icon set part
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * import { themeQuartz, iconSetQuartz } from 'argent-grid';
72
+ *
73
+ * const myTheme = themeQuartz.withPart(iconSetQuartz);
74
+ * ```
75
+ */
76
+ export const iconSetQuartz: IconSetPart = {
77
+ name: 'icon-set-quartz',
78
+ type: 'icon-set',
79
+ icons: QUARTZ_ICONS,
80
+ };
81
+
82
+ // ============================================================================
83
+ // MATERIAL ICON SET
84
+ // ============================================================================
85
+
86
+ const MATERIAL_ICONS: Record<string, IconDefinition> = {
87
+ asc: {
88
+ name: 'asc',
89
+ path: 'M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z',
90
+ viewBox: '0 0 24 24',
91
+ },
92
+ desc: {
93
+ name: 'desc',
94
+ path: 'M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z',
95
+ viewBox: '0 0 24 24',
96
+ },
97
+ menu: {
98
+ name: 'menu',
99
+ path: 'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z',
100
+ viewBox: '0 0 24 24',
101
+ },
102
+ filter: {
103
+ name: 'filter',
104
+ path: 'M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z',
105
+ viewBox: '0 0 24 24',
106
+ },
107
+ close: {
108
+ name: 'close',
109
+ path: 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',
110
+ viewBox: '0 0 24 24',
111
+ },
112
+ expand: {
113
+ name: 'expand',
114
+ path: 'M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z',
115
+ viewBox: '0 0 24 24',
116
+ },
117
+ collapse: {
118
+ name: 'collapse',
119
+ path: 'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z',
120
+ viewBox: '0 0 24 24',
121
+ },
122
+ pin: {
123
+ name: 'pin',
124
+ path: 'M17 4v7l2.29 2.29c.63.63.63 1.64 0 2.27l-1.83 1.83c-.63.63-1.64.63-2.27 0L13 13.29V20h-2v-6.71l-2.29 2.29c-.63.63-1.64.63-2.27 0L4.54 13.75c-.63-.63-.63-1.64 0-2.27L6.83 9.17V4h10.17z',
125
+ viewBox: '0 0 24 24',
126
+ },
127
+ columns: {
128
+ name: 'columns',
129
+ path: 'M10 18h5v-6h-5v6zm-6 0h5V5H4v13zm12 0h5v-6h-5v6zM10 5v6h11V5H10z',
130
+ viewBox: '0 0 24 24',
131
+ },
132
+ search: {
133
+ name: 'search',
134
+ path: 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z',
135
+ viewBox: '0 0 24 24',
136
+ },
137
+ };
138
+
139
+ /**
140
+ * Material Design icon set part
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * import { themeQuartz, iconSetMaterial } from 'argent-grid';
145
+ *
146
+ * const myTheme = themeQuartz.withPart(iconSetMaterial);
147
+ * ```
148
+ */
149
+ export const iconSetMaterial: IconSetPart = {
150
+ name: 'icon-set-material',
151
+ type: 'icon-set',
152
+ icons: MATERIAL_ICONS,
153
+ };
154
+
155
+ // ============================================================================
156
+ // MINIMAL ICON SET
157
+ // ============================================================================
158
+
159
+ const MINIMAL_ICONS: Record<string, IconDefinition> = {
160
+ asc: {
161
+ name: 'asc',
162
+ path: 'M7 14l5-5 5 5z',
163
+ viewBox: '0 0 24 24',
164
+ },
165
+ desc: {
166
+ name: 'desc',
167
+ path: 'M7 10l5 5 5-5z',
168
+ viewBox: '0 0 24 24',
169
+ },
170
+ menu: {
171
+ name: 'menu',
172
+ path: 'M3 12h18M3 6h18M3 18h18',
173
+ viewBox: '0 0 24 24',
174
+ },
175
+ filter: {
176
+ name: 'filter',
177
+ path: 'M3 5h18M6 12h12M10 19h4',
178
+ viewBox: '0 0 24 24',
179
+ },
180
+ close: {
181
+ name: 'close',
182
+ path: 'M18 6L6 18M6 6l12 12',
183
+ viewBox: '0 0 24 24',
184
+ },
185
+ expand: {
186
+ name: 'expand',
187
+ path: 'M8 9l4-4 4 4',
188
+ viewBox: '0 0 24 24',
189
+ },
190
+ collapse: {
191
+ name: 'collapse',
192
+ path: 'M8 15l4 4 4-4',
193
+ viewBox: '0 0 24 24',
194
+ },
195
+ pin: {
196
+ name: 'pin',
197
+ path: 'M12 2L8 6v6l-4 4v2h6v6l4-4 4 4v-6h6v-2l-4-4V6z',
198
+ viewBox: '0 0 24 24',
199
+ },
200
+ columns: {
201
+ name: 'columns',
202
+ path: 'M4 4h16v16H4z M12 4v16',
203
+ viewBox: '0 0 24 24',
204
+ },
205
+ search: {
206
+ name: 'search',
207
+ path: 'M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z',
208
+ viewBox: '0 0 24 24',
209
+ },
210
+ };
211
+
212
+ /**
213
+ * Minimal line icon set part
214
+ *
215
+ * @example
216
+ * ```typescript
217
+ * import { themeQuartz, iconSetMinimal } from 'argent-grid';
218
+ *
219
+ * const myTheme = themeQuartz.withPart(iconSetMinimal);
220
+ * ```
221
+ */
222
+ export const iconSetMinimal: IconSetPart = {
223
+ name: 'icon-set-minimal',
224
+ type: 'icon-set',
225
+ icons: MINIMAL_ICONS,
226
+ };
227
+
228
+ // ============================================================================
229
+ // EXPORTS
230
+ // ============================================================================
231
+
232
+ /**
233
+ * All available icon sets
234
+ */
235
+ export const ICON_SETS: Record<string, IconSetPart> = {
236
+ quartz: iconSetQuartz,
237
+ material: iconSetMaterial,
238
+ minimal: iconSetMinimal,
239
+ };
240
+
241
+ /**
242
+ * Get icon set by name
243
+ */
244
+ export function getIconSet(name: string): IconSetPart | undefined {
245
+ return ICON_SETS[name];
246
+ }
247
+
248
+ /**
249
+ * Get icon SVG from icon set
250
+ */
251
+ export function getIconSvg(iconSet: IconSetPart, iconName: string): string | undefined {
252
+ const icon = iconSet.icons[iconName];
253
+ if (!icon) return undefined;
254
+
255
+ return `<svg viewBox="${icon.viewBox || '0 0 24 24'}" fill="currentColor">
256
+ <path d="${icon.path}"/>
257
+ </svg>`;
258
+ }