@dxos/lit-grid 0.8.4-main.fbb7a13 → 0.8.4-main.fcfe5033a5

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": "@dxos/lit-grid",
3
- "version": "0.8.4-main.fbb7a13",
3
+ "version": "0.8.4-main.fcfe5033a5",
4
4
  "description": "A grid Web Component using Lit",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -46,7 +46,7 @@
46
46
  "lit": "^3.3.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@dxos/random": "0.8.4-main.fbb7a13",
50
- "@dxos/test-utils": "0.8.4-main.fbb7a13"
49
+ "@dxos/random": "0.8.4-main.fcfe5033a5",
50
+ "@dxos/test-utils": "0.8.4-main.fcfe5033a5"
51
51
  }
52
52
  }
@@ -7,24 +7,24 @@ dx-grid-axis-resize-handle {
7
7
  background: transparent;
8
8
  z-index: 2;
9
9
  &:hover {
10
- background: var(--dx-grid-resizeHandleHover, var(--dx-hoverSurface));
10
+ background: var(--color-hover-surface);
11
11
  }
12
12
  &[data-dx-grid-axis='col'] {
13
13
  inset-block: 0;
14
14
  inset-inline-end: 0;
15
- inline-size: .5rem;
15
+ inline-size: 0.5rem;
16
16
  cursor: col-resize;
17
17
  }
18
18
  &[data-dx-grid-axis='row'] {
19
19
  inset-inline: 0;
20
20
  inset-block-end: 0;
21
- block-size: .5rem;
21
+ block-size: 0.5rem;
22
22
  cursor: row-resize;
23
23
  }
24
24
  &:focus {
25
25
  outline: none;
26
26
  }
27
27
  &:focus-visible {
28
- background: var(--dx-grid-resizeHandleFocus, var(--dx-accentSurface));
28
+ background: var(--color-accent-surface);
29
29
  }
30
30
  }
@@ -1,8 +1,10 @@
1
+ @reference "../../ui-theme/src/main.css";
2
+
1
3
  dx-grid-multiselect-cell {
2
4
  display: contents;
3
5
  }
4
6
 
5
- .dx-grid__cell__multiselect{
7
+ .dx-grid__cell__multiselect {
6
8
  display: flex;
7
9
  flex-flow: row nowrap;
8
10
  gap: 2px;
@@ -14,19 +16,19 @@ dx-grid-multiselect-cell {
14
16
  white-space: nowrap;
15
17
  text-overflow: ellipsis;
16
18
  &.dx-grid__cell__multiselect__value {
17
- @apply bs-full border border-separator text-xs font-semibold pli-2 plb-0.5 rounded cursor-default text-neutral-800 dark:text-neutral-150
19
+ @apply h-full border border-separator text-xs font-semibold px-2 py-0.5 rounded cursor-default text-neutral-800 dark:text-neutral-200;
18
20
  }
19
21
  &.dx-grid__cell__multiselect__placeholder {
20
22
  @apply text-description;
21
23
  }
22
24
  }
23
- & > .dx-grid__cell__multiselect__separator{
25
+ & > .dx-grid__cell__multiselect__separator {
24
26
  flex: 1 0 0;
25
27
  }
26
28
  & > svg {
27
29
  flex: 0 0 auto;
28
- margin-block: .25em;
30
+ margin-block: 0.25em;
29
31
  inline-size: 1em;
30
32
  block-size: 1em;
31
33
  }
32
- }
34
+ }
@@ -3,15 +3,13 @@
3
3
  //
4
4
 
5
5
  import '@dxos-theme';
6
-
7
6
  import './dx-grid.ts';
8
7
  import './dx-grid.pcss';
9
-
10
8
  import './dx-grid-multiselect-cell.ts';
11
9
 
12
10
  import { html, nothing } from 'lit';
13
11
 
14
- import { faker } from '@dxos/random';
12
+ import { random } from '@dxos/random';
15
13
 
16
14
  import { defaultRowSize } from './defs.js';
17
15
  import { type DxGridFrozenPlane, type DxGridPlaneCells, type DxGridProps } from './types';
@@ -39,7 +37,7 @@ const initialLabels = {
39
37
  '0,0': { value: '', resizeHandle: 'col' },
40
38
  },
41
39
  frozenColsStart: [...Array(64)].reduce((acc, _, i) => {
42
- acc[`0,${i}`] = { value: rowToA1Notation(i), className: 'text-end pie-1', resizeHandle: 'row' };
40
+ acc[`0,${i}`] = { value: rowToA1Notation(i), className: 'text-end pe-1', resizeHandle: 'row' };
43
41
  return acc;
44
42
  }, {}),
45
43
  frozenRowsStart: [...Array(12)].reduce((acc, _, i) => {
@@ -53,7 +51,7 @@ Basic.args = {
53
51
  grid: {
54
52
  '1,1': {
55
53
  // end: '8,1',
56
- value: faker.lorem.paragraphs(5),
54
+ value: random.lorem.paragraphs(5),
57
55
  },
58
56
  '2,2': {
59
57
  value: '',
package/src/dx-grid.pcss CHANGED
@@ -4,10 +4,14 @@
4
4
  @layer dx-tokens {
5
5
  :root {
6
6
  --dx-grid-cell-padding-block: 0.2rem;
7
- --dx-grid-cell-content-padding-block: calc(var(--dx-grid-cell-padding-block) - var(--dx-gridFocusIndicatorWidth));
7
+ --dx-grid-cell-content-padding-block: calc(
8
+ var(--dx-grid-cell-padding-block) - var(--dx-grid-focus-indicator-width)
9
+ );
8
10
  --dx-grid-cell-editor-padding-block: var(--dx-grid-cell-content-padding-block);
9
11
  --dx-grid-cell-padding-inline: 0.25rem;
10
- --dx-grid-cell-content-padding-inline: calc(var(--dx-grid-cell-padding-inline) - var(--dx-gridFocusIndicatorWidth));
12
+ --dx-grid-cell-content-padding-inline: calc(
13
+ var(--dx-grid-cell-padding-inline) - var(--dx-grid-focus-indicator-width)
14
+ );
11
15
  --dx-grid-cell-editor-padding-inline: var(--dx-grid-cell-content-padding-inline);
12
16
  }
13
17
  }
@@ -33,8 +37,6 @@
33
37
 
34
38
  touch-action: none;
35
39
  user-select: none;
36
-
37
- background: var(--dx-grid-lines, var(--dx-gridLine));
38
40
  }
39
41
 
40
42
  .dx-grid__plane--frozen-row,
@@ -54,7 +56,7 @@
54
56
  position: absolute;
55
57
  inset: 0;
56
58
  pointer-events: none;
57
- border: var(--dx-gridFocusIndicatorWidth) solid var(--dx-gridFocusIndicatorColor);
59
+ border: var(--dx-grid-focus-indicator-width) solid var(--color-grid-focus-indicator);
58
60
  }
59
61
  }
60
62
 
@@ -67,15 +69,19 @@
67
69
  }
68
70
 
69
71
  .dx-grid {
70
- --dx-grid-cell-surface: var(--dx-grid-base, var(--dx-baseSurface));
72
+ --grid-cell-surface: var(--color-grid-surface);
71
73
 
72
74
  [role='gridcell'],
73
75
  [role='columnheader'],
74
76
  [role='rowheader'] {
75
- background: var(--dx-grid-cell-surface);
77
+ background: var(--grid-cell-surface);
76
78
  cursor: pointer;
77
79
  position: relative;
78
80
 
81
+ /** TODO(burdon): It this performant? */
82
+ border-right: 1px solid var(--color-grid-line);
83
+ border-bottom: 1px solid var(--color-grid-line);
84
+
79
85
  &[aria-readonly='true'] {
80
86
  cursor: default;
81
87
  }
@@ -98,10 +104,11 @@
98
104
  white-space: nowrap;
99
105
  block-size: 100%;
100
106
  position: relative;
101
- border: var(--dx-gridFocusIndicatorWidth) solid transparent;
107
+ border: var(--dx-grid-focus-indicator-width) solid transparent;
102
108
  border-radius: 2px;
103
109
 
104
- &:has(.dx-tag), &:has(dx-tag-picker-item) {
110
+ &:has(.dx-tag),
111
+ &:has(dx-tag-picker-item) {
105
112
  text-overflow: clip;
106
113
  line-height: 0;
107
114
  --dx-grid-cell-content-padding-inline: 1px;
@@ -110,7 +117,7 @@
110
117
  }
111
118
 
112
119
  &.dx-grid__cell--commented {
113
- background: var(--dx-grid-commented, var(--dx-gridCommented));
120
+ background: var(--color-grid-comment);
114
121
  }
115
122
  }
116
123
 
@@ -119,10 +126,11 @@
119
126
  [role='columnheader'],
120
127
  [role='rowheader'] {
121
128
  &[aria-selected] {
122
- --dx-grid-cell-surface: var(--dx-gridSelectionOverlay);
129
+ --grid-cell-surface: var(--color-grid-selection-overlay);
123
130
 
124
131
  &:focus:not([aria-readonly='true']),
125
- &:focus-visible, &:focus-within {
132
+ &:focus-visible,
133
+ &:focus-within {
126
134
  & > .dx-grid__cell__content {
127
135
  background: transparent;
128
136
  }
@@ -140,7 +148,7 @@
140
148
  }
141
149
 
142
150
  &:has(.dx-grid__row--cta__cell:hover) .dx-grid__row--cta__cell {
143
- background: var(--dx-hoverOverlay);
151
+ background: var(--color-grid-hover-overlay);
144
152
  }
145
153
  }
146
154
 
@@ -149,7 +157,7 @@
149
157
  [role='gridcell'],
150
158
  [role='columnheader'],
151
159
  [role='rowheader'] {
152
- &:not([data-focus-unfurl="false"]):not(.dx-grid__cell--no-focus-unfurl) {
160
+ &:not([data-focus-unfurl='false']):not(.dx-grid__cell--no-focus-unfurl) {
153
161
  &:focus,
154
162
  &:focus-within {
155
163
  & > .dx-grid__cell__content {
@@ -171,17 +179,17 @@
171
179
 
172
180
  z-index: 1;
173
181
 
174
- background: var(--dx-grid-cell-surface);
182
+ background: var(--grid-cell-surface);
175
183
  }
176
184
 
177
185
  &:not([aria-readonly='true']) > .dx-grid__cell__content {
178
- border-color: var(--dx-gridFocusIndicatorColor);
186
+ border-color: var(--color-grid-focus-indicator);
179
187
  }
180
188
  }
181
189
  }
182
190
 
183
191
  &:focus-visible > .dx-grid__cell__content {
184
- border-color: var(--dx-gridFocusIndicatorColor);
192
+ border-color: var(--color-grid-focus-indicator);
185
193
  }
186
194
  }
187
195
  }
@@ -192,8 +200,8 @@
192
200
  hyphens: auto;
193
201
  overflow-wrap: break-word;
194
202
 
195
- background: var(--dx-grid-base, var(--dx-baseSurface));
196
- border: var(--dx-gridFocusIndicatorWidth) solid var(--dx-gridFocusIndicatorColor);
203
+ background: var(--dx-grid-base, var(--color-base-surface));
204
+ border: var(--dx-grid-focus-indicator-width) solid var(--color-grid-focus-indicator);
197
205
  border-radius: 2px;
198
206
 
199
207
  --dx-grid-cell-editor-max-block-size: min(12em, 50vh);
@@ -204,7 +212,8 @@
204
212
  inline-size: min-content;
205
213
  max-inline-size: var(--dx-grid-cell-editor-max-inline-size);
206
214
 
207
- &:has(.dx-tag), &:has(dx-tag-picker-item) {
215
+ &:has(.dx-tag),
216
+ &:has(dx-tag-picker-item) {
208
217
  text-overflow: clip;
209
218
  line-height: 0;
210
219
  --dx-grid-cell-editor-padding-inline: 1px;
@@ -218,7 +227,7 @@
218
227
  [role='columnheader'],
219
228
  [role='rowheader'] {
220
229
  &[data-dx-active]:not([aria-readonly='true']) > .dx-grid__cell__content {
221
- border-color: var(--dx-gridFocusIndicatorColor);
230
+ border-color: var(--color-grid-focus-indicator);
222
231
  }
223
232
  }
224
233
  }
@@ -246,7 +255,7 @@
246
255
  inline-size: 0;
247
256
  block-size: 0;
248
257
  border-inline-start: 0.5em solid transparent;
249
- border-block-start: 0.5em solid var(--dx-warningText);
258
+ border-block-start: 0.5em solid var(--color-warning-text);
250
259
  z-index: 1;
251
260
  }
252
261
  }
package/src/dx-grid.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import './dx-grid-axis-resize-handle';
6
+
5
7
  import { LitElement, html, nothing } from 'lit';
6
8
  import { customElement, property, state } from 'lit/decorators.js';
7
9
  import { type Ref, createRef, ref } from 'lit/directives/ref.js';
@@ -9,7 +11,6 @@ import { styleMap } from 'lit/directives/style-map.js';
9
11
  import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
10
12
 
11
13
  import { defaultColSize, defaultRowSize, focusUnfurlDefault } from './defs';
12
- import './dx-grid-axis-resize-handle';
13
14
  import {
14
15
  DxAxisResize,
15
16
  type DxAxisResizeInternal,
@@ -1476,9 +1477,7 @@ export class DxGrid extends LitElement {
1476
1477
  .split(' ')
1477
1478
  .filter((value) => value)
1478
1479
  .map(
1479
- // TODO(burdon): Consistent camelCase?
1480
- (activeRef) =>
1481
- `[data-refs~="${activeRef}"] { background: var(--dx-grid-commented-active, var(--dx-gridCommentedActive)) !important; }`,
1480
+ (activeRef) => `[data-refs~="${activeRef}"] { background: var(--color-grid-comment-active) !important; }`,
1482
1481
  )
1483
1482
  .join('\n')}
1484
1483
  </style>
@@ -10,7 +10,7 @@ export default defineConfig({
10
10
  ...e2ePreset(import.meta.dirname),
11
11
  // TODO(wittjosiah): Avoid hard-coding ports.
12
12
  webServer: {
13
- command: 'moon run storybook-lit:serve-e2e -- --port=9002',
13
+ command: 'pnpm storybook dev --ci --quiet --port=9002 --config-dir=.storybook',
14
14
  port: 9002,
15
15
  reuseExistingServer: false,
16
16
  },