argus-table 0.0.0-stage → 0.0.1

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -2
  3. package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js +8 -0
  4. package/dist/argus-table.js +492 -0
  5. package/dist/argus-table.js.map +1 -0
  6. package/dist/cdn/argus-table.js +4743 -0
  7. package/dist/cdn/argus-table.js.map +1 -0
  8. package/dist/controllers/resize-drag.js +44 -0
  9. package/dist/controllers/resize-drag.js.map +1 -0
  10. package/dist/controllers/table-controller.js +24 -0
  11. package/dist/controllers/table-controller.js.map +1 -0
  12. package/dist/controllers/virtual-controller.js +83 -0
  13. package/dist/controllers/virtual-controller.js.map +1 -0
  14. package/dist/core/src/columns/resolve-columns.js +62 -0
  15. package/dist/core/src/columns/resolve-columns.js.map +1 -0
  16. package/dist/core/src/state/controllable.js +31 -0
  17. package/dist/core/src/state/controllable.js.map +1 -0
  18. package/dist/core/src/table/create-table.js +185 -0
  19. package/dist/core/src/table/create-table.js.map +1 -0
  20. package/dist/core/src/virtual/row-pool.js +64 -0
  21. package/dist/core/src/virtual/row-pool.js.map +1 -0
  22. package/dist/custom-elements.json +1131 -0
  23. package/dist/events.js +22 -0
  24. package/dist/events.js.map +1 -0
  25. package/dist/index.d.ts +236 -0
  26. package/dist/index.js +3 -0
  27. package/dist/render/body.js +49 -0
  28. package/dist/render/body.js.map +1 -0
  29. package/dist/render/cells.js +27 -0
  30. package/dist/render/cells.js.map +1 -0
  31. package/dist/render/content.js +35 -0
  32. package/dist/render/content.js.map +1 -0
  33. package/dist/render/header.js +62 -0
  34. package/dist/render/header.js.map +1 -0
  35. package/dist/styles/base.js +235 -0
  36. package/dist/styles/base.js.map +1 -0
  37. package/package.json +61 -3
@@ -0,0 +1,235 @@
1
+ import { css } from "lit";
2
+ // src/styles/base.ts
3
+ /**
4
+ * Base styles. Everything sits in `@layer argus-base`, and every value reads a
5
+ * public token with a neutral fallback, so themes and page CSS always win.
6
+ * `--_*` properties are private.
7
+ */
8
+ var baseStyles = css`
9
+ @layer argus-base {
10
+ :host {
11
+ display: block;
12
+ /* A table that virtualizes needs a bounded height; set your own on the element. */
13
+ block-size: 400px;
14
+ box-sizing: border-box;
15
+ contain: content;
16
+ color-scheme: light dark;
17
+ color: var(--argus-fg, CanvasText);
18
+ background: var(--argus-bg, Canvas);
19
+ font: var(--argus-font, inherit);
20
+ --_row-height: var(--argus-row-height, 40px);
21
+ --_pad: var(--argus-cell-padding-inline, 12px);
22
+ --_border: var(--argus-border-width, 1px) solid
23
+ var(--argus-border-color, light-dark(#e5e7eb, #374151));
24
+ /* 1 in LTR, -1 in RTL: mirrors the pinned-edge shadow. */
25
+ --_dir: 1;
26
+ }
27
+ :host(:dir(rtl)) {
28
+ --_dir: -1;
29
+ }
30
+ :host([density='compact']) {
31
+ --_row-height: var(--argus-row-height, 32px);
32
+ --_pad: var(--argus-cell-padding-inline, 8px);
33
+ }
34
+ :host([density='spacious']) {
35
+ --_row-height: var(--argus-row-height, 52px);
36
+ --_pad: var(--argus-cell-padding-inline, 16px);
37
+ }
38
+ :host([hidden]) {
39
+ display: none;
40
+ }
41
+
42
+ [part~='table'] {
43
+ position: relative;
44
+ block-size: 100%;
45
+ overflow: auto;
46
+ overscroll-behavior: contain;
47
+ /* A cell moved to by keyboard scrolls clear of the sticky header and pinned columns. */
48
+ scroll-padding-block-start: var(--_row-height);
49
+ scroll-padding-inline: var(--_pin-start, 0) var(--_pin-end, 0);
50
+ }
51
+
52
+ .row {
53
+ display: grid;
54
+ grid-template-columns: var(--_cols);
55
+ inline-size: var(--_width);
56
+ min-inline-size: 100%;
57
+ block-size: var(--_row-height);
58
+ box-sizing: border-box;
59
+ }
60
+
61
+ [part~='header'] {
62
+ position: sticky;
63
+ inset-block-start: 0;
64
+ z-index: 2;
65
+ }
66
+
67
+ [part~='body'] {
68
+ position: relative;
69
+ contain: layout;
70
+ }
71
+ [part~='row'] {
72
+ position: absolute;
73
+ inset-block-start: 0;
74
+ inset-inline-start: 0;
75
+ --_row-bg: var(--argus-bg, Canvas);
76
+ --_row-surface: var(--_row-bg);
77
+ background: var(--_row-surface);
78
+ }
79
+ [part~='row-odd'] {
80
+ --_row-bg: var(--argus-row-stripe-bg, var(--argus-bg, Canvas));
81
+ }
82
+ [part~='row']:hover {
83
+ --_row-surface: var(--argus-row-hover-bg, var(--_row-bg));
84
+ }
85
+
86
+ [part~='cell'],
87
+ [part~='header-cell'] {
88
+ display: flex;
89
+ align-items: center;
90
+ min-inline-size: 0;
91
+ box-sizing: border-box;
92
+ padding-inline: var(--_pad);
93
+ overflow: hidden;
94
+ white-space: nowrap;
95
+ border-block-end: var(--_border);
96
+ }
97
+ [part~='header-cell'] {
98
+ background: var(--argus-header-bg, light-dark(#f9fafb, #111827));
99
+ color: var(--argus-header-fg, inherit);
100
+ font-weight: 600;
101
+ }
102
+ [part~='header-cell'] {
103
+ position: relative;
104
+ }
105
+ [part~='resize-handle'] {
106
+ position: absolute;
107
+ inset-block: 0;
108
+ inset-inline-end: 0;
109
+ inline-size: 8px;
110
+ z-index: 1;
111
+ cursor: col-resize;
112
+ touch-action: none;
113
+ }
114
+ [part~='resize-handle']::after {
115
+ content: '';
116
+ position: absolute;
117
+ inset-block: 25%;
118
+ inset-inline-end: 0;
119
+ inline-size: 2px;
120
+ background: var(--argus-resize-handle-color, light-dark(#9ca3af, #6b7280));
121
+ opacity: 0;
122
+ }
123
+ [part~='header-cell']:hover [part~='resize-handle']::after,
124
+ [part~='header-cell']:focus-visible [part~='resize-handle']::after,
125
+ [part~='resize-handle'][data-active]::after {
126
+ opacity: 1;
127
+ }
128
+ [data-sort-col] {
129
+ cursor: pointer;
130
+ user-select: none;
131
+ }
132
+ [part~='header-cell']:focus-visible,
133
+ [part~='cell']:focus-visible {
134
+ outline: var(--argus-focus-ring, 2px solid Highlight);
135
+ outline-offset: -2px;
136
+ }
137
+ /* A small chevron after the header content; only the sorted column shows it. */
138
+ .sort-indicator {
139
+ flex: none;
140
+ inline-size: 0.35em;
141
+ block-size: 0.35em;
142
+ margin-inline-start: 0.4em;
143
+ /* Physical sides on purpose: the chevron is rotated, so it must not mirror in RTL. */
144
+ border-right: 0.12em solid currentColor;
145
+ border-bottom: 0.12em solid currentColor;
146
+ visibility: hidden;
147
+ }
148
+ [aria-sort] .sort-indicator {
149
+ visibility: visible;
150
+ }
151
+ [aria-sort='ascending'] .sort-indicator {
152
+ transform: translateY(0.1em) rotate(-135deg);
153
+ }
154
+ [aria-sort='descending'] .sort-indicator {
155
+ transform: translateY(-0.1em) rotate(45deg);
156
+ }
157
+ [data-align='end'] .sort-indicator {
158
+ order: -1;
159
+ margin-inline: 0 0.4em;
160
+ }
161
+ /*
162
+ * Pinned columns: sticky inside the scroll container, with offsets from the
163
+ * table model. Logical insets make RTL work without extra rules.
164
+ */
165
+ [data-pin] {
166
+ position: sticky;
167
+ z-index: 1;
168
+ /* Visible so the edge shadow isn't clipped; slotted content still clips itself. */
169
+ overflow: visible;
170
+ }
171
+ [data-pin='start'] {
172
+ inset-inline-start: var(--_pin-offset);
173
+ }
174
+ [data-pin='end'] {
175
+ inset-inline-end: var(--_pin-offset);
176
+ }
177
+ [part~='cell-pinned'] {
178
+ background: var(--_row-surface);
179
+ }
180
+ /*
181
+ * The edge shadow. --argus-pinned-shadow is written for a shadow falling
182
+ * toward the end side; the start edge in RTL and the end edge in LTR mirror it.
183
+ */
184
+ [data-pin-edge]::after {
185
+ content: '';
186
+ position: absolute;
187
+ inset: 0;
188
+ pointer-events: none;
189
+ box-shadow: var(
190
+ --argus-pinned-shadow,
191
+ 4px 0 6px -4px light-dark(rgb(0 0 0 / 0.2), rgb(0 0 0 / 0.6))
192
+ );
193
+ transform: scaleX(var(--_dir));
194
+ }
195
+ [data-pin='end'][data-pin-edge]::after {
196
+ transform: scaleX(calc(-1 * var(--_dir)));
197
+ }
198
+
199
+ [data-align='center'] {
200
+ justify-content: center;
201
+ text-align: center;
202
+ }
203
+ [data-align='end'] {
204
+ justify-content: flex-end;
205
+ text-align: end;
206
+ }
207
+ ::slotted(*) {
208
+ min-inline-size: 0;
209
+ overflow: hidden;
210
+ text-overflow: ellipsis;
211
+ }
212
+
213
+ [part~='empty'] {
214
+ display: flex;
215
+ align-items: center;
216
+ justify-content: center;
217
+ min-block-size: calc(100% - var(--_row-height));
218
+ padding: var(--_pad);
219
+ box-sizing: border-box;
220
+ }
221
+
222
+ /* Measures the resolved row height in px for the virtualizer. */
223
+ .probe {
224
+ position: absolute;
225
+ inset-block-start: 0;
226
+ inline-size: 0;
227
+ block-size: var(--_row-height);
228
+ visibility: hidden;
229
+ pointer-events: none;
230
+ }
231
+ }
232
+ `;
233
+ export { baseStyles };
234
+
235
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","names":[],"sources":["../../src/styles/base.ts"],"sourcesContent":["import { css } from 'lit';\n\n/**\n * Base styles. Everything sits in `@layer argus-base`, and every value reads a\n * public token with a neutral fallback, so themes and page CSS always win.\n * `--_*` properties are private.\n */\nexport const baseStyles = css`\n @layer argus-base {\n :host {\n display: block;\n /* A table that virtualizes needs a bounded height; set your own on the element. */\n block-size: 400px;\n box-sizing: border-box;\n contain: content;\n color-scheme: light dark;\n color: var(--argus-fg, CanvasText);\n background: var(--argus-bg, Canvas);\n font: var(--argus-font, inherit);\n --_row-height: var(--argus-row-height, 40px);\n --_pad: var(--argus-cell-padding-inline, 12px);\n --_border: var(--argus-border-width, 1px) solid\n var(--argus-border-color, light-dark(#e5e7eb, #374151));\n /* 1 in LTR, -1 in RTL: mirrors the pinned-edge shadow. */\n --_dir: 1;\n }\n :host(:dir(rtl)) {\n --_dir: -1;\n }\n :host([density='compact']) {\n --_row-height: var(--argus-row-height, 32px);\n --_pad: var(--argus-cell-padding-inline, 8px);\n }\n :host([density='spacious']) {\n --_row-height: var(--argus-row-height, 52px);\n --_pad: var(--argus-cell-padding-inline, 16px);\n }\n :host([hidden]) {\n display: none;\n }\n\n [part~='table'] {\n position: relative;\n block-size: 100%;\n overflow: auto;\n overscroll-behavior: contain;\n /* A cell moved to by keyboard scrolls clear of the sticky header and pinned columns. */\n scroll-padding-block-start: var(--_row-height);\n scroll-padding-inline: var(--_pin-start, 0) var(--_pin-end, 0);\n }\n\n .row {\n display: grid;\n grid-template-columns: var(--_cols);\n inline-size: var(--_width);\n min-inline-size: 100%;\n block-size: var(--_row-height);\n box-sizing: border-box;\n }\n\n [part~='header'] {\n position: sticky;\n inset-block-start: 0;\n z-index: 2;\n }\n\n [part~='body'] {\n position: relative;\n contain: layout;\n }\n [part~='row'] {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n --_row-bg: var(--argus-bg, Canvas);\n --_row-surface: var(--_row-bg);\n background: var(--_row-surface);\n }\n [part~='row-odd'] {\n --_row-bg: var(--argus-row-stripe-bg, var(--argus-bg, Canvas));\n }\n [part~='row']:hover {\n --_row-surface: var(--argus-row-hover-bg, var(--_row-bg));\n }\n\n [part~='cell'],\n [part~='header-cell'] {\n display: flex;\n align-items: center;\n min-inline-size: 0;\n box-sizing: border-box;\n padding-inline: var(--_pad);\n overflow: hidden;\n white-space: nowrap;\n border-block-end: var(--_border);\n }\n [part~='header-cell'] {\n background: var(--argus-header-bg, light-dark(#f9fafb, #111827));\n color: var(--argus-header-fg, inherit);\n font-weight: 600;\n }\n [part~='header-cell'] {\n position: relative;\n }\n [part~='resize-handle'] {\n position: absolute;\n inset-block: 0;\n inset-inline-end: 0;\n inline-size: 8px;\n z-index: 1;\n cursor: col-resize;\n touch-action: none;\n }\n [part~='resize-handle']::after {\n content: '';\n position: absolute;\n inset-block: 25%;\n inset-inline-end: 0;\n inline-size: 2px;\n background: var(--argus-resize-handle-color, light-dark(#9ca3af, #6b7280));\n opacity: 0;\n }\n [part~='header-cell']:hover [part~='resize-handle']::after,\n [part~='header-cell']:focus-visible [part~='resize-handle']::after,\n [part~='resize-handle'][data-active]::after {\n opacity: 1;\n }\n [data-sort-col] {\n cursor: pointer;\n user-select: none;\n }\n [part~='header-cell']:focus-visible,\n [part~='cell']:focus-visible {\n outline: var(--argus-focus-ring, 2px solid Highlight);\n outline-offset: -2px;\n }\n /* A small chevron after the header content; only the sorted column shows it. */\n .sort-indicator {\n flex: none;\n inline-size: 0.35em;\n block-size: 0.35em;\n margin-inline-start: 0.4em;\n /* Physical sides on purpose: the chevron is rotated, so it must not mirror in RTL. */\n border-right: 0.12em solid currentColor;\n border-bottom: 0.12em solid currentColor;\n visibility: hidden;\n }\n [aria-sort] .sort-indicator {\n visibility: visible;\n }\n [aria-sort='ascending'] .sort-indicator {\n transform: translateY(0.1em) rotate(-135deg);\n }\n [aria-sort='descending'] .sort-indicator {\n transform: translateY(-0.1em) rotate(45deg);\n }\n [data-align='end'] .sort-indicator {\n order: -1;\n margin-inline: 0 0.4em;\n }\n /*\n * Pinned columns: sticky inside the scroll container, with offsets from the\n * table model. Logical insets make RTL work without extra rules.\n */\n [data-pin] {\n position: sticky;\n z-index: 1;\n /* Visible so the edge shadow isn't clipped; slotted content still clips itself. */\n overflow: visible;\n }\n [data-pin='start'] {\n inset-inline-start: var(--_pin-offset);\n }\n [data-pin='end'] {\n inset-inline-end: var(--_pin-offset);\n }\n [part~='cell-pinned'] {\n background: var(--_row-surface);\n }\n /*\n * The edge shadow. --argus-pinned-shadow is written for a shadow falling\n * toward the end side; the start edge in RTL and the end edge in LTR mirror it.\n */\n [data-pin-edge]::after {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n box-shadow: var(\n --argus-pinned-shadow,\n 4px 0 6px -4px light-dark(rgb(0 0 0 / 0.2), rgb(0 0 0 / 0.6))\n );\n transform: scaleX(var(--_dir));\n }\n [data-pin='end'][data-pin-edge]::after {\n transform: scaleX(calc(-1 * var(--_dir)));\n }\n\n [data-align='center'] {\n justify-content: center;\n text-align: center;\n }\n [data-align='end'] {\n justify-content: flex-end;\n text-align: end;\n }\n ::slotted(*) {\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n [part~='empty'] {\n display: flex;\n align-items: center;\n justify-content: center;\n min-block-size: calc(100% - var(--_row-height));\n padding: var(--_pad);\n box-sizing: border-box;\n }\n\n /* Measures the resolved row height in px for the virtualizer. */\n .probe {\n position: absolute;\n inset-block-start: 0;\n inline-size: 0;\n block-size: var(--_row-height);\n visibility: hidden;\n pointer-events: none;\n }\n }\n`;\n"],"mappings":";;;;;;;AAOA,IAAa,aAAa,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "argus-table",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.1",
4
+ "description": "A framework-agnostic data table web component built with Lit and TanStack.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Joessst-Dev/argus-table.git",
9
+ "directory": "packages/table"
10
+ },
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./custom-elements.json": "./dist/custom-elements.json",
18
+ "./package.json": "./package.json"
19
+ },
20
+ "types": "./dist/index.d.ts",
21
+ "jsdelivr": "./dist/cdn/argus-table.js",
22
+ "unpkg": "./dist/cdn/argus-table.js",
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "sideEffects": [
29
+ "./dist/index.js",
30
+ "./dist/argus-table.js",
31
+ "./dist/cdn/argus-table.js"
32
+ ],
33
+ "dependencies": {
34
+ "@tanstack/lit-virtual": "^3.15.3",
35
+ "@tanstack/table-core": "9.3.1",
36
+ "lit": "^3.3.3"
37
+ },
38
+ "devDependencies": {
39
+ "@arethetypeswrong/cli": "^0.18.5",
40
+ "@custom-elements-manifest/analyzer": "^0.11.0",
41
+ "@size-limit/file": "^14.3.0",
42
+ "@vitest/browser-playwright": "^5.1.0",
43
+ "playwright": "1.63.0",
44
+ "publint": "^0.3.25",
45
+ "rollup": "~4.64.12",
46
+ "rollup-plugin-dts": "^6.5.1",
47
+ "size-limit": "^14.3.0",
48
+ "vite": "^8.3.5",
49
+ "vitest": "^5.1.0",
50
+ "@argus-table/core": "0.0.0"
51
+ },
52
+ "customElements": "dist/custom-elements.json",
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "scripts": {
57
+ "build": "vite build && vite build -c vite.cdn.config.ts && rollup -c rollup.dts.config.mjs && cem analyze && pnpm check-exports",
58
+ "check-exports": "node scripts/check-dist.mjs && publint --strict && attw --pack . --profile esm-only",
59
+ "size": "size-limit",
60
+ "typecheck": "tsc -p tsconfig.json --noEmit",
61
+ "lint": "eslint .",
62
+ "test": "vitest run"
63
+ }
6
64
  }