@dxos/react-ui-table 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393

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 (100) hide show
  1. package/dist/lib/browser/{chunk-BF54SSNL.mjs → chunk-4URYOFDL.mjs} +8 -9
  2. package/dist/lib/browser/chunk-4URYOFDL.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  4. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-G5EDJPD2.mjs → chunk-YDXPC7HA.mjs} +14 -70
  6. package/dist/lib/browser/chunk-YDXPC7HA.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +20 -86
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/testing/index.mjs +5 -3
  11. package/dist/lib/browser/testing/index.mjs.map +3 -3
  12. package/dist/lib/browser/translations.mjs +36 -0
  13. package/dist/lib/browser/translations.mjs.map +7 -0
  14. package/dist/lib/browser/types/index.mjs +2 -1
  15. package/dist/lib/node-esm/{chunk-ZZ3SYTIL.mjs → chunk-2AN3QQ3D.mjs} +14 -70
  16. package/dist/lib/node-esm/chunk-2AN3QQ3D.mjs.map +7 -0
  17. package/dist/lib/node-esm/{chunk-SIRDIPHZ.mjs → chunk-B2SZYAEC.mjs} +8 -9
  18. package/dist/lib/node-esm/chunk-B2SZYAEC.mjs.map +7 -0
  19. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  20. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +20 -86
  22. package/dist/lib/node-esm/index.mjs.map +4 -4
  23. package/dist/lib/node-esm/meta.json +1 -1
  24. package/dist/lib/node-esm/testing/index.mjs +5 -3
  25. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  26. package/dist/lib/node-esm/translations.mjs +37 -0
  27. package/dist/lib/node-esm/translations.mjs.map +7 -0
  28. package/dist/lib/node-esm/types/index.mjs +2 -1
  29. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
  30. package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
  31. package/dist/types/src/components/Table/DynamicTable.d.ts +1 -2
  32. package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
  33. package/dist/types/src/components/Table/DynamicTable.stories.d.ts +19 -19
  34. package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
  35. package/dist/types/src/components/Table/Relations.stories.d.ts +82 -82
  36. package/dist/types/src/components/Table/Relations.stories.d.ts.map +1 -1
  37. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  38. package/dist/types/src/components/Table/Table.d.ts +2 -2
  39. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  40. package/dist/types/src/components/Table/Table.stories.d.ts +82 -82
  41. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Table/TableContent.d.ts +1 -1
  43. package/dist/types/src/components/Table/TableToolbar.d.ts +1 -1
  44. package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts.map +1 -1
  45. package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -1
  46. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  47. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts +19 -19
  48. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
  49. package/dist/types/src/components/testing.d.ts.map +1 -1
  50. package/dist/types/src/hooks/useAddRow.d.ts.map +1 -1
  51. package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -1
  52. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  53. package/dist/types/src/index.d.ts +0 -2
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/src/model/modal-controller.d.ts.map +1 -1
  56. package/dist/types/src/model/selection-model.d.ts +1 -1
  57. package/dist/types/src/model/selection-model.d.ts.map +1 -1
  58. package/dist/types/src/model/table-model.d.ts +4 -5
  59. package/dist/types/src/model/table-model.d.ts.map +1 -1
  60. package/dist/types/src/model/table-presentation.d.ts.map +1 -1
  61. package/dist/types/src/playwright/TableManager.d.ts.map +1 -1
  62. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  63. package/dist/types/src/testing/useTestTableModel.d.ts.map +1 -1
  64. package/dist/types/src/translations.d.ts +19 -19
  65. package/dist/types/src/translations.d.ts.map +1 -1
  66. package/dist/types/src/types/Table.d.ts +1 -2
  67. package/dist/types/src/types/Table.d.ts.map +1 -1
  68. package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
  69. package/dist/types/src/util/query-ast.d.ts.map +1 -1
  70. package/dist/types/src/util/schema.d.ts.map +1 -1
  71. package/dist/types/src/util/signals.d.ts.map +1 -1
  72. package/dist/types/src/util/sort.d.ts.map +1 -1
  73. package/dist/types/src/util/table-buttons.d.ts +20 -20
  74. package/dist/types/src/util/table-buttons.d.ts.map +1 -1
  75. package/dist/types/src/util/table-controls.d.ts +4 -4
  76. package/dist/types/src/util/table-controls.d.ts.map +1 -1
  77. package/dist/types/src/util/tag.d.ts.map +1 -1
  78. package/dist/types/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +47 -43
  80. package/src/components/Table/ColumnActionsMenu.tsx +2 -1
  81. package/src/components/Table/DynamicTable.stories.tsx +4 -3
  82. package/src/components/Table/DynamicTable.tsx +3 -4
  83. package/src/components/Table/Relations.stories.tsx +4 -4
  84. package/src/components/Table/RowActionsMenu.tsx +3 -2
  85. package/src/components/Table/Table.stories.tsx +7 -6
  86. package/src/components/Table/TableToolbar.tsx +1 -1
  87. package/src/components/TableCellEditor/CellValidationMessage.tsx +1 -2
  88. package/src/components/TableCellEditor/FormCellEditor.tsx +2 -1
  89. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +3 -3
  90. package/src/index.ts +0 -4
  91. package/src/model/table-model.ts +7 -8
  92. package/src/model/table-presentation.ts +3 -4
  93. package/src/testing/useTestTableModel.ts +2 -2
  94. package/src/types/Table.ts +2 -3
  95. package/src/util/dynamic-table.test.ts +2 -2
  96. package/src/util/dynamic-table.ts +3 -4
  97. package/dist/lib/browser/chunk-BF54SSNL.mjs.map +0 -7
  98. package/dist/lib/browser/chunk-G5EDJPD2.mjs.map +0 -7
  99. package/dist/lib/node-esm/chunk-SIRDIPHZ.mjs.map +0 -7
  100. package/dist/lib/node-esm/chunk-ZZ3SYTIL.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-table",
3
- "version": "0.8.4-main.422d1c7879",
3
+ "version": "0.8.4-main.4f23b4e393",
4
4
  "description": "A table component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,13 +12,10 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": false,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#translations": "./src/translations.ts"
17
+ },
15
18
  "exports": {
16
- "./deprecated": {
17
- "source": "./src/deprecated/index.ts",
18
- "types": "./dist/types/src/deprecated/index.d.ts",
19
- "browser": "./dist/lib/browser/deprecated/index.mjs",
20
- "node": "./dist/lib/node-esm/deprecated/index.mjs"
21
- },
22
19
  ".": {
23
20
  "source": "./src/index.ts",
24
21
  "types": "./dist/types/src/index.d.ts",
@@ -31,6 +28,12 @@
31
28
  "browser": "./dist/lib/browser/testing/index.mjs",
32
29
  "node": "./dist/lib/node-esm/testing/index.mjs"
33
30
  },
31
+ "./translations": {
32
+ "source": "./src/translations.ts",
33
+ "types": "./dist/types/src/translations.d.ts",
34
+ "browser": "./dist/lib/browser/translations.mjs",
35
+ "node": "./dist/lib/node-esm/translations.mjs"
36
+ },
34
37
  "./types": {
35
38
  "source": "./src/types/index.ts",
36
39
  "types": "./dist/types/src/types/index.d.ts",
@@ -46,7 +49,7 @@
46
49
  "dependencies": {
47
50
  "@codemirror/autocomplete": "^6.19.0",
48
51
  "@codemirror/state": "^6.5.2",
49
- "@codemirror/view": "^6.38.4",
52
+ "@codemirror/view": "^6.38.5",
50
53
  "@effect-atom/atom-react": "^0.5.0",
51
54
  "@fluentui/react-tabster": "9.26.11",
52
55
  "@radix-ui/react-context": "1.1.1",
@@ -55,31 +58,32 @@
55
58
  "@radix-ui/react-use-controllable-state": "1.1.0",
56
59
  "date-fns": "^3.6.0",
57
60
  "lodash.orderby": "^4.6.0",
58
- "@dxos/context": "0.8.4-main.422d1c7879",
59
- "@dxos/async": "0.8.4-main.422d1c7879",
60
- "@dxos/debug": "0.8.4-main.422d1c7879",
61
- "@dxos/echo": "0.8.4-main.422d1c7879",
62
- "@dxos/effect": "0.8.4-main.422d1c7879",
63
- "@dxos/invariant": "0.8.4-main.422d1c7879",
64
- "@dxos/keys": "0.8.4-main.422d1c7879",
65
- "@dxos/echo-atom": "0.8.4-main.422d1c7879",
66
- "@dxos/lit-grid": "0.8.4-main.422d1c7879",
67
- "@dxos/log": "0.8.4-main.422d1c7879",
68
- "@dxos/react-ui-attention": "0.8.4-main.422d1c7879",
69
- "@dxos/react-client": "0.8.4-main.422d1c7879",
70
- "@dxos/random": "0.8.4-main.422d1c7879",
71
- "@dxos/react-ui-components": "0.8.4-main.422d1c7879",
72
- "@dxos/react-ui-form": "0.8.4-main.422d1c7879",
73
- "@dxos/react-ui-editor": "0.8.4-main.422d1c7879",
74
- "@dxos/react-ui-grid": "0.8.4-main.422d1c7879",
75
- "@dxos/react-ui-search": "0.8.4-main.422d1c7879",
76
- "@dxos/react-ui-menu": "0.8.4-main.422d1c7879",
77
- "@dxos/react-ui-stack": "0.8.4-main.422d1c7879",
78
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.422d1c7879",
79
- "@dxos/schema": "0.8.4-main.422d1c7879",
80
- "@dxos/ui-types": "0.8.4-main.422d1c7879",
81
- "@dxos/util": "0.8.4-main.422d1c7879",
82
- "@dxos/types": "0.8.4-main.422d1c7879"
61
+ "@dxos/async": "0.8.4-main.4f23b4e393",
62
+ "@dxos/context": "0.8.4-main.4f23b4e393",
63
+ "@dxos/debug": "0.8.4-main.4f23b4e393",
64
+ "@dxos/echo": "0.8.4-main.4f23b4e393",
65
+ "@dxos/effect": "0.8.4-main.4f23b4e393",
66
+ "@dxos/echo-atom": "0.8.4-main.4f23b4e393",
67
+ "@dxos/keys": "0.8.4-main.4f23b4e393",
68
+ "@dxos/lit-grid": "0.8.4-main.4f23b4e393",
69
+ "@dxos/invariant": "0.8.4-main.4f23b4e393",
70
+ "@dxos/log": "0.8.4-main.4f23b4e393",
71
+ "@dxos/random": "0.8.4-main.4f23b4e393",
72
+ "@dxos/react-ui-components": "0.8.4-main.4f23b4e393",
73
+ "@dxos/react-ui-editor": "0.8.4-main.4f23b4e393",
74
+ "@dxos/react-ui-form": "0.8.4-main.4f23b4e393",
75
+ "@dxos/react-client": "0.8.4-main.4f23b4e393",
76
+ "@dxos/react-ui-grid": "0.8.4-main.4f23b4e393",
77
+ "@dxos/react-ui-menu": "0.8.4-main.4f23b4e393",
78
+ "@dxos/react-ui-stack": "0.8.4-main.4f23b4e393",
79
+ "@dxos/react-ui-list": "0.8.4-main.4f23b4e393",
80
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.4f23b4e393",
81
+ "@dxos/react-ui-search": "0.8.4-main.4f23b4e393",
82
+ "@dxos/schema": "0.8.4-main.4f23b4e393",
83
+ "@dxos/types": "0.8.4-main.4f23b4e393",
84
+ "@dxos/ui-types": "0.8.4-main.4f23b4e393",
85
+ "@dxos/util": "0.8.4-main.4f23b4e393",
86
+ "@dxos/react-ui-attention": "0.8.4-main.4f23b4e393"
83
87
  },
84
88
  "devDependencies": {
85
89
  "@effect/platform": "0.94.4",
@@ -90,14 +94,14 @@
90
94
  "fast-check": "^3.19.0",
91
95
  "react": "~19.2.3",
92
96
  "react-dom": "~19.2.3",
93
- "vite": "^7.1.11",
94
- "@dxos/lit-ui": "0.8.4-main.422d1c7879",
95
- "@dxos/random": "0.8.4-main.422d1c7879",
96
- "@dxos/react-client": "0.8.4-main.422d1c7879",
97
- "@dxos/react-ui": "0.8.4-main.422d1c7879",
98
- "@dxos/storybook-utils": "0.8.4-main.422d1c7879",
99
- "@dxos/test-utils": "0.8.4-main.422d1c7879",
100
- "@dxos/ui-theme": "0.8.4-main.422d1c7879"
97
+ "vite": "^8.0.10",
98
+ "@dxos/random": "0.8.4-main.4f23b4e393",
99
+ "@dxos/lit-ui": "0.8.4-main.4f23b4e393",
100
+ "@dxos/react-client": "0.8.4-main.4f23b4e393",
101
+ "@dxos/react-ui": "0.8.4-main.4f23b4e393",
102
+ "@dxos/storybook-utils": "0.8.4-main.4f23b4e393",
103
+ "@dxos/ui-theme": "0.8.4-main.4f23b4e393",
104
+ "@dxos/test-utils": "0.8.4-main.4f23b4e393"
101
105
  },
102
106
  "peerDependencies": {
103
107
  "@effect-atom/atom-react": "^0.5.0",
@@ -105,8 +109,8 @@
105
109
  "effect": "3.20.0",
106
110
  "react": "~19.2.3",
107
111
  "react-dom": "~19.2.3",
108
- "@dxos/ui-theme": "0.8.4-main.422d1c7879",
109
- "@dxos/react-ui": "0.8.4-main.422d1c7879"
112
+ "@dxos/ui-theme": "0.8.4-main.4f23b4e393",
113
+ "@dxos/react-ui": "0.8.4-main.4f23b4e393"
110
114
  },
111
115
  "publishConfig": {
112
116
  "access": "public"
@@ -7,8 +7,9 @@ import React from 'react';
7
7
 
8
8
  import { DropdownMenu, useTranslation } from '@dxos/react-ui';
9
9
 
10
+ import { translationKey } from '#translations';
11
+
10
12
  import { type ModalController, type TableModel } from '../../model';
11
- import { translationKey } from '../../translations';
12
13
 
13
14
  export type ColumnActionsMenuProps = {
14
15
  model: TableModel;
@@ -6,18 +6,19 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import type * as Types from 'effect/Types';
7
7
  import React, { useMemo, useState } from 'react';
8
8
 
9
- import { type JsonSchema, Obj } from '@dxos/echo';
9
+ import { Filter, type JsonSchema, Obj } from '@dxos/echo';
10
10
  import { Format } from '@dxos/echo/internal';
11
11
  import { random } from '@dxos/random';
12
- import { Filter, useQuery, useSchema } from '@dxos/react-client/echo';
12
+ import { useQuery, useSchema } from '@dxos/react-client/echo';
13
13
  import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
14
14
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
15
15
  import { type SchemaPropertyDefinition } from '@dxos/schema';
16
16
  import { TestSchema } from '@dxos/schema/testing';
17
17
  import { withRegistry } from '@dxos/storybook-utils';
18
18
 
19
+ import { translations } from '#translations';
20
+
19
21
  import { type TableFeatures } from '../../model';
20
- import { translations } from '../../translations';
21
22
  import { DynamicTable } from './DynamicTable';
22
23
 
23
24
  random.seed(0);
@@ -6,8 +6,7 @@ import { RegistryContext } from '@effect-atom/atom-react';
6
6
  import type * as Types from 'effect/Types';
7
7
  import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
8
8
 
9
- import { type Type } from '@dxos/echo';
10
- import { type JsonSchema } from '@dxos/echo';
9
+ import { type JsonSchema, type Type } from '@dxos/echo';
11
10
  import { type ThemedClassName, useDefaultValue } from '@dxos/react-ui';
12
11
  import { type ProjectionModel } from '@dxos/schema';
13
12
  import { mx } from '@dxos/ui-theme';
@@ -96,8 +95,8 @@ export const DynamicTable = <T extends Type.AnyEntity = Type.AnyEntity>({
96
95
  }, [registry, model]);
97
96
 
98
97
  return (
99
- <div role='none' className={mx('dx-expander grid', classNames)}>
100
- <div role='none' className='grid min-h-0 overflow-hidden'>
98
+ <div className={mx('dx-expander grid', classNames)}>
99
+ <div className='grid min-h-0 overflow-hidden'>
101
100
  <Table.Root ref={tableRef}>
102
101
  <Table.Content model={model} presentation={presentation} ignoreAttention onRowClick={onRowClick} />
103
102
  </Table.Root>
@@ -7,14 +7,13 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
7
  import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
8
8
  import { expect, userEvent, waitFor, within } from 'storybook/test';
9
9
 
10
- import { Obj, Type } from '@dxos/echo';
11
- import { View } from '@dxos/echo';
10
+ import { Obj, Type, View } from '@dxos/echo';
12
11
  import { invariant } from '@dxos/invariant';
13
12
  import { type DxGrid } from '@dxos/lit-grid';
14
13
  import { random } from '@dxos/random';
15
14
  import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
16
15
  import { useAsyncEffect } from '@dxos/react-ui';
17
- import { translations as formTranslations } from '@dxos/react-ui-form';
16
+ import { translations as formTranslations } from '@dxos/react-ui-form/translations';
18
17
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
19
18
  import { ViewModel } from '@dxos/schema';
20
19
  import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
@@ -22,9 +21,10 @@ import { withRegistry } from '@dxos/storybook-utils';
22
21
  import { Organization, Person } from '@dxos/types';
23
22
  import '@dxos/lit-ui/dx-tag-picker.pcss';
24
23
 
24
+ import { translations } from '#translations';
25
+
25
26
  import { useProjectionModel, useTableModel } from '../../hooks';
26
27
  import { type TableFeatures, TablePresentation, type TableRow } from '../../model';
27
- import { translations } from '../../translations';
28
28
  import { Table } from '../../types';
29
29
  import { Table as TableComponent } from './Table';
30
30
 
@@ -7,8 +7,9 @@ import React from 'react';
7
7
 
8
8
  import { DropdownMenu, toLocalizedString, useTranslation } from '@dxos/react-ui';
9
9
 
10
+ import { translationKey } from '#translations';
11
+
10
12
  import { type ModalController, type TableModel } from '../../model';
11
- import { translationKey } from '../../translations';
12
13
 
13
14
  type RowActionsMenuProps = { model: TableModel; modals: ModalController };
14
15
 
@@ -47,7 +48,7 @@ export const RowActionsMenu = ({ model, modals }: RowActionsMenuProps) => {
47
48
  {/* Default actions */}
48
49
  {model.features.dataEditable !== false && (
49
50
  <DropdownMenu.Item data-testid='row-menu-delete' onClick={() => model.deleteRow(state.rowIndex)}>
50
- {t(hasSelection ? 'bulk delete row label' : 'delete row label')}
51
+ {t(hasSelection ? 'bulk-delete-row.label' : 'delete-row.label')}
51
52
  </DropdownMenu.Item>
52
53
  )}
53
54
  </DropdownMenu.Viewport>
@@ -6,23 +6,24 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import * as Schema from 'effect/Schema';
7
7
  import React, { useCallback } from 'react';
8
8
 
9
- import { Annotation, type Database, Format, Obj, type QueryAST, Ref, Type } from '@dxos/echo';
10
- import { View } from '@dxos/echo';
9
+ import { Annotation, type Database, Format, Obj, type QueryAST, Ref, Type, View } from '@dxos/echo';
11
10
  import { type Mutable, PropertyMetaAnnotationId } from '@dxos/echo/internal';
12
11
  import { invariant } from '@dxos/invariant';
13
12
  import { random } from '@dxos/random';
14
13
  import { PublicKey } from '@dxos/react-client';
15
14
  import { withClientProvider } from '@dxos/react-client/testing';
16
15
  import { Panel, ScrollArea } from '@dxos/react-ui';
17
- import { ViewEditor, translations as formTranslations } from '@dxos/react-ui-form';
16
+ import { ViewEditor } from '@dxos/react-ui-form';
17
+ import { translations as formTranslations } from '@dxos/react-ui-form/translations';
18
18
  import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
19
19
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
20
20
  import { ViewModel, getSchemaFromPropertyDefinitions, getTypenameFromQuery } from '@dxos/schema';
21
21
  import { TestSchema, createObjectFactory } from '@dxos/schema/testing';
22
22
  import { withRegistry } from '@dxos/storybook-utils';
23
23
 
24
+ import { translations } from '#translations';
25
+
24
26
  import { useTestTableModel } from '../../testing';
25
- import { translations } from '../../translations';
26
27
  import { Table } from '../../types';
27
28
  import { Table as TableComponent } from './Table';
28
29
 
@@ -73,7 +74,7 @@ const StoryViewEditor = ({
73
74
  invariant(Type.isMutable(schema));
74
75
  schema.updateTypename(getTypenameFromQuery(newQuery));
75
76
  invariant(view);
76
- Obj.change(view, (view) => {
77
+ Obj.update(view, (view) => {
77
78
  view.query.ast = newQuery as Mutable<typeof newQuery>;
78
79
  });
79
80
  },
@@ -171,7 +172,7 @@ const meta = {
171
172
  const [schema] = await space.db.schemaRegistry.register([Example]);
172
173
  const { view, jsonSchema } = await ViewModel.makeFromDatabase({ db: space.db, typename: schema.typename });
173
174
  const table = Table.make({ view, jsonSchema });
174
- Obj.change(view, (view) => {
175
+ Obj.update(view, (view) => {
175
176
  view.projection.fields = [
176
177
  view.projection.fields.find((field) => field.path === 'name')!,
177
178
  ...view.projection.fields.filter((field) => field.path !== 'name'),
@@ -18,7 +18,7 @@ import {
18
18
  } from '@dxos/react-ui-menu';
19
19
  import { composable, composableProps } from '@dxos/ui-theme';
20
20
 
21
- import { translationKey } from '../../translations';
21
+ import { translationKey } from '#translations';
22
22
 
23
23
  export type TableToolbarActionProperties = { type: TableToolbarActionType };
24
24
 
@@ -23,11 +23,10 @@ export const CellValidationMessage = ({
23
23
  }
24
24
 
25
25
  const bgClass = variant === 'error' ? 'bg-error-surface' : 'bg-warning-surface';
26
- const textClass = variant === 'error' ? 'text-error-surface-text' : 'text-warning-surface-text';
26
+ const textClass = variant === 'error' ? 'text-error-foreground' : 'text-warning-foreground';
27
27
 
28
28
  return (
29
29
  <div
30
- role='none'
31
30
  className={`absolute ${bgClass} ${textClass} rounded-h-sm text-xs p-1`}
32
31
  style={{
33
32
  ...{ '--dx-grid-cell-width': `${box?.inlineSize ?? 200}px` },
@@ -14,8 +14,9 @@ import { parseCellIndex, useGridContext } from '@dxos/react-ui-grid';
14
14
  import { type FieldProjection } from '@dxos/schema';
15
15
  import { getDeep, isTruthy, setDeep } from '@dxos/util';
16
16
 
17
+ import { translationKey } from '#translations';
18
+
17
19
  import { type ModalController, type TableModel, type TableRow } from '../../model';
18
- import { translationKey } from '../../translations';
19
20
  import { narrowSchema } from '../../util';
20
21
 
21
22
  const createOptionLabel: Label = ['create-new-object.label', { ns: translationKey }];
@@ -5,8 +5,7 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
- import { Obj } from '@dxos/echo';
9
- import { View } from '@dxos/echo';
8
+ import { Obj, View } from '@dxos/echo';
10
9
  import { random } from '@dxos/random';
11
10
  import { withClientProvider } from '@dxos/react-client/testing';
12
11
  import { Grid, type GridEditing, defaultRowSize } from '@dxos/react-ui-grid';
@@ -14,8 +13,9 @@ import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
13
  import { ViewModel } from '@dxos/schema';
15
14
  import { Task } from '@dxos/types';
16
15
 
16
+ import { translations } from '#translations';
17
+
17
18
  import { useTestTableModel } from '../../testing';
18
- import { translations } from '../../translations';
19
19
  import { Table } from '../../types';
20
20
  import { TableCellEditor } from './TableCellEditor';
21
21
 
package/src/index.ts CHANGED
@@ -2,11 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { translations } from './translations';
6
-
7
5
  export * from './components';
8
6
  export * from './hooks';
9
7
  export * from './model';
10
8
  export * from './util';
11
-
12
- export { translations };
@@ -5,8 +5,7 @@
5
5
  import { Atom, type Registry } from '@effect-atom/atom-react';
6
6
 
7
7
  import { Resource } from '@dxos/context';
8
- import { type Database, Format, Obj, Order, Query, type QueryAST, Ref } from '@dxos/echo';
9
- import { type View } from '@dxos/echo';
8
+ import { type Database, Format, Obj, Order, Query, type QueryAST, Ref, type View } from '@dxos/echo';
10
9
  import { type JsonProp, type JsonSchemaType, type Mutable, toEffectSchema } from '@dxos/echo/internal';
11
10
  import { getSnapshot } from '@dxos/echo/internal';
12
11
  import { getValue, setValue } from '@dxos/effect';
@@ -38,7 +37,7 @@ export type FieldSortType = {
38
37
  import { type SelectionMode, SelectionModel } from './selection-model';
39
38
 
40
39
  /**
41
- * Callback type for wrapping mutations in Obj.change().
40
+ * Callback type for wrapping mutations in Obj.update().
42
41
  * Contains separate callbacks for table object and row mutations.
43
42
  */
44
43
  export type TableChangeCallback<T extends TableRow> = {
@@ -53,10 +52,10 @@ export type TableChangeCallback<T extends TableRow> = {
53
52
  * Use this when the table and rows are stored in the ECHO database.
54
53
  */
55
54
  export const createEchoChangeCallback = <T extends TableRow>(table: Table.Table): TableChangeCallback<T> => ({
56
- table: (mutate) => Obj.change(table, (table) => mutate(table as unknown as Table.Table)),
55
+ table: (mutate) => Obj.update(table, (table) => mutate(table as unknown as Table.Table)),
57
56
  row: (row, mutate) => {
58
57
  if (Obj.isObject(row)) {
59
- Obj.change(row, (row) => mutate(row as T));
58
+ Obj.update(row, (row) => mutate(row as T));
60
59
  } else {
61
60
  mutate(row);
62
61
  }
@@ -112,7 +111,7 @@ export type TableModelProps<T extends TableRow = TableRow> = {
112
111
  projection: ProjectionModel;
113
112
  db?: Database.Database;
114
113
  /**
115
- * Callbacks to wrap mutations in Obj.change().
114
+ * Callbacks to wrap mutations in Obj.update().
116
115
  * Use createEchoChangeCallback() for ECHO-backed objects or createDirectChangeCallback() for plain objects.
117
116
  */
118
117
  change?: TableChangeCallback<T>;
@@ -894,13 +893,13 @@ export class TableModel<T extends TableRow = TableRow> extends Resource {
894
893
  if (field) {
895
894
  // Persist sort to view.query.ast
896
895
  const newQuery = baseQuery.orderBy(Order.property<any>(field.path as string, inMemorySort.direction));
897
- Obj.change(view, (view) => {
896
+ Obj.update(view, (view) => {
898
897
  view.query.ast = newQuery.ast as Mutable<typeof newQuery.ast>;
899
898
  });
900
899
  }
901
900
  } else {
902
901
  // Clear sort from view.query.ast
903
- Obj.change(view, (view) => {
902
+ Obj.update(view, (view) => {
904
903
  view.query.ast = baseQuery.ast as Mutable<typeof baseQuery.ast>;
905
904
  });
906
905
  }
@@ -5,8 +5,7 @@
5
5
  import { Atom, type Registry } from '@effect-atom/atom-react';
6
6
  import * as Predicate from 'effect/Predicate';
7
7
 
8
- import { Obj } from '@dxos/echo';
9
- import { type View } from '@dxos/echo';
8
+ import { Obj, type View } from '@dxos/echo';
10
9
  import { Format, TypeEnum, getValue } from '@dxos/echo/internal';
11
10
  import { cellClassesForFieldType, formatForDisplay } from '@dxos/react-ui-form';
12
11
  import {
@@ -473,8 +472,8 @@ export const cellClassesForRowSelection = (selected: boolean, selectionMode: Sel
473
472
 
474
473
  switch (selectionMode) {
475
474
  case 'single':
476
- return ['dx-grid__cell--no-focus-unfurl !bg-current-surface hover:bg-hover-surface cursor-pointer!'];
475
+ return ['dx-grid__cell--no-focus-unfurl bg-current-surface! hover:bg-hover-surface cursor-pointer!'];
477
476
  case 'multiple':
478
- return ['!bg-grid-cell-selected'];
477
+ return ['bg-grid-cell-selected!'];
479
478
  }
480
479
  };
@@ -5,10 +5,10 @@
5
5
  import { RegistryContext } from '@effect-atom/atom-react';
6
6
  import { type RefObject, useCallback, useContext, useMemo, useRef } from 'react';
7
7
 
8
- import { type Database, type Type } from '@dxos/echo';
8
+ import { type Database, Filter, type Type } from '@dxos/echo';
9
9
  import { isMutable } from '@dxos/echo/internal';
10
10
  import { random } from '@dxos/random';
11
- import { Filter, useQuery, useSchema } from '@dxos/react-client/echo';
11
+ import { useQuery, useSchema } from '@dxos/react-client/echo';
12
12
  import { useClientStory } from '@dxos/react-client/testing';
13
13
  import { useGlobalFilteredObjects } from '@dxos/react-ui-search';
14
14
  import { type ProjectionModel, getTypenameFromQuery } from '@dxos/schema';
@@ -6,8 +6,7 @@ import * as Match from 'effect/Match';
6
6
  import * as Schema from 'effect/Schema';
7
7
  import * as SchemaAST from 'effect/SchemaAST';
8
8
 
9
- import { Annotation, JsonSchema, Obj, Ref, Type } from '@dxos/echo';
10
- import { View } from '@dxos/echo';
9
+ import { Annotation, JsonSchema, Obj, Ref, Type, View } from '@dxos/echo';
11
10
  import { FormInputAnnotation, type JsonPath, type JsonSchemaType, LabelAnnotation } from '@dxos/echo/internal';
12
11
  import { ViewAnnotation } from '@dxos/schema';
13
12
 
@@ -27,7 +26,7 @@ export const Table = Schema.Struct({
27
26
  version: '0.1.0',
28
27
  }),
29
28
  LabelAnnotation.set(['name']),
30
- ViewAnnotation.set(true),
29
+ ViewAnnotation.set(['view']),
31
30
  Annotation.IconAnnotation.set({
32
31
  icon: 'ph--table--regular',
33
32
  hue: 'green',
@@ -12,7 +12,7 @@ import { type TablePropertyDefinition, getBaseSchema, makeDynamicTable } from '.
12
12
  describe('makeDynamicTable', () => {
13
13
  /**
14
14
  * Base case: plain jsonSchema (not from Echo / JsonSchema.toJsonSchema). Does not exercise the path
15
- * where projection or schema are reactive, so this does not reproduce the Obj.change regression.
15
+ * where projection or schema are reactive, so this does not reproduce the Obj.update regression.
16
16
  * Confirms makeDynamicTable + setProperties (title) works with plain objects.
17
17
  */
18
18
  test('makeDynamicTable with plain jsonSchema and properties with title does not throw', () => {
@@ -44,7 +44,7 @@ describe('makeDynamicTable', () => {
44
44
 
45
45
  /**
46
46
  * Regression test for the path where jsonSchema comes from getBaseSchema(typename, properties).
47
- * That path uses Echo (ViewModel.make, JsonSchema.toJsonSchema); mutations must run inside Obj.change and on a
47
+ * That path uses Echo (ViewModel.make, JsonSchema.toJsonSchema); mutations must run inside Obj.update and on a
48
48
  * cloned schema. This test ensures that flow does not throw.
49
49
  */
50
50
  test('makeDynamicTable with jsonSchema from getBaseSchema(typename, properties) and properties with title does not throw', () => {
@@ -5,8 +5,7 @@
5
5
  import { type Registry } from '@effect-atom/atom-react';
6
6
  import type * as Types from 'effect/Types';
7
7
 
8
- import { Filter, JsonSchema, Obj, Order, Query, type QueryAST, Ref, Type } from '@dxos/echo';
9
- import { type View } from '@dxos/echo';
8
+ import { Filter, JsonSchema, Obj, Order, Query, type QueryAST, Ref, Type, type View } from '@dxos/echo';
10
9
  import {
11
10
  ProjectionModel,
12
11
  type SchemaPropertyDefinition,
@@ -93,7 +92,7 @@ const setProperties = (
93
92
  const field = projection.getFields().find((field) => field.path === property.name);
94
93
  if (field) {
95
94
  if (property.size !== undefined) {
96
- Obj.change(table, (table) => {
95
+ Obj.update(table, (table) => {
97
96
  table.sizes[field.path] = property.size!;
98
97
  });
99
98
  }
@@ -111,7 +110,7 @@ const setProperties = (
111
110
  const currentQuery = Query.fromAst(Obj.getSnapshot(view).query.ast);
112
111
  // Use any type parameter since we're working with dynamic field paths
113
112
  const newQuery = currentQuery.orderBy(Order.property<any>(field.path as string, property.sort));
114
- Obj.change(view, (view) => {
113
+ Obj.update(view, (view) => {
115
114
  // Type assertion needed because Query AST types have some variance issues.
116
115
  view.query.ast = newQuery.ast as typeof view.query.ast;
117
116
  });
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/Table.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, JsonSchema, Obj, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, type JsonPath, type JsonSchemaType, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport const Table = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n sizes: Schema.Record({\n // TODO(wittjosiah): Should be JsonPath.\n key: Schema.String,\n value: Schema.Number,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.table',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--table--regular',\n hue: 'green',\n }),\n);\n\nexport interface Table extends Schema.Schema.Type<typeof Table> {}\n\ntype MakeProps = {\n name?: string;\n sizes?: Record<string, number>;\n view: View.View;\n /** Required to auto-size columns. */\n jsonSchema?: JsonSchemaType;\n};\n\n/**\n * Make a table as a view of a data set.\n */\nexport const make = ({ name, sizes = {}, view, jsonSchema }: MakeProps): Table => {\n const table = Obj.make(Table, { name, view: Ref.make(view), sizes } as Obj.MakeProps<typeof Table>);\n\n // Preset sizes.\n if (jsonSchema) {\n const schema = JsonSchema.toEffectSchema(jsonSchema);\n const properties = SchemaAST.getPropertySignatures(schema.ast);\n for (const property of properties) {\n const name = property.name.toString() as JsonPath;\n if (sizes?.[name]) {\n table.sizes[name] = sizes[name];\n continue;\n }\n\n Match.type<SchemaAST.AST>().pipe(\n Match.when({ _tag: 'BooleanKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.when({ _tag: 'NumberKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.orElse(() => {\n // Noop.\n }),\n )(property.type);\n }\n }\n\n return table;\n};\n"],
5
- "mappings": ";;;;;;;AAAA;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAE3B,SAASC,YAAYC,YAAYC,KAAKC,KAAKC,YAAY;AACvD,SAASC,YAAY;AACrB,SAASC,qBAAyDC,uBAAuB;AACzF,SAASC,sBAAsB;AAExB,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEJ,KAAKK,oBAAoBC,IAAI,KAAA,CAAA;EAEtDC,OAAcC,cAAO;;IAEnBC,KAAYV;IACZW,OAAcC;EAChB,CAAA,EAAGX,KAAYY,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGN,KACDa,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBX,IAAI;EAAC;CAAO,GAC5BY,eAAeZ,IAAI,IAAA,GACnBa,WAAWC,eAAed,IAAI;EAC5Be,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAgBK,IAAMC,OAAO,CAAC,EAAEzB,MAAMS,QAAQ,CAAC,GAAGL,MAAMsB,WAAU,MAAa;AACpE,QAAMC,QAAQC,IAAIH,KAAK3B,OAAO;IAAEE;IAAMI,MAAMC,IAAIoB,KAAKrB,IAAAA;IAAOK;EAAM,CAAA;AAGlE,MAAIiB,YAAY;AACd,UAAMG,SAASC,WAAWC,eAAeL,UAAAA;AACzC,UAAMM,aAAuBC,gCAAsBJ,OAAOK,GAAG;AAC7D,eAAWC,YAAYH,YAAY;AACjC,YAAMhC,QAAOmC,SAASnC,KAAKoC,SAAQ;AACnC,UAAI3B,QAAQT,KAAAA,GAAO;AACjB2B,cAAMlB,MAAMT,KAAAA,IAAQS,MAAMT,KAAAA;AAC1B;MACF;AAEAqC,MAAMC,WAAI,EAAkBpC,KACpBqC,WAAK;QAAEC,MAAM;MAAiB,GAAG,MAAA;AACrCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMuC,WAAK;QAAEC,MAAM;MAAgB,GAAG,MAAA;AACpCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMyC,aAAO,MAAA;MAEb,CAAA,CAAA,EACAN,SAASG,IAAI;IACjB;EACF;AAEA,SAAOX;AACT;",
6
- "names": ["Match", "Schema", "SchemaAST", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Table", "Struct", "name", "String", "pipe", "optional", "view", "Ref", "View", "FormInputAnnotation", "set", "sizes", "Record", "key", "value", "Number", "mutable", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "make", "jsonSchema", "table", "Obj", "schema", "JsonSchema", "toEffectSchema", "properties", "getPropertySignatures", "ast", "property", "toString", "Match", "type", "when", "_tag", "orElse"]
7
- }