@dxos/plugin-masonry 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29

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 (94) hide show
  1. package/dist/lib/neutral/MasonryContainer-KP37NJFB.mjs +103 -0
  2. package/dist/lib/neutral/MasonryContainer-KP37NJFB.mjs.map +7 -0
  3. package/dist/lib/neutral/MasonryPlugin.mjs +26 -0
  4. package/dist/lib/neutral/MasonryPlugin.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +11 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/{browser/chunk-U46AGJ2D.mjs → neutral/chunk-E42CTC55.mjs} +2 -2
  8. package/dist/lib/{browser/chunk-U46AGJ2D.mjs.map → neutral/chunk-E42CTC55.mjs.map} +3 -3
  9. package/dist/lib/{browser/chunk-JYUFXVAU.mjs → neutral/chunk-YG4D3X6I.mjs} +11 -19
  10. package/dist/lib/neutral/chunk-YG4D3X6I.mjs.map +7 -0
  11. package/dist/lib/neutral/components/index.mjs +1 -0
  12. package/dist/lib/neutral/containers/index.mjs +9 -0
  13. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  14. package/dist/lib/neutral/create-object-WRCYV4HT.mjs +39 -0
  15. package/dist/lib/neutral/create-object-WRCYV4HT.mjs.map +7 -0
  16. package/dist/lib/neutral/index.mjs +14 -0
  17. package/dist/lib/neutral/meta.json +1 -0
  18. package/dist/lib/neutral/meta.mjs +8 -0
  19. package/dist/lib/neutral/plugin.mjs +12 -0
  20. package/dist/lib/neutral/plugin.mjs.map +7 -0
  21. package/dist/lib/{browser/react-surface-TJ6V3IKD.mjs → neutral/react-surface-367CTRTD.mjs} +14 -20
  22. package/dist/lib/neutral/react-surface-367CTRTD.mjs.map +7 -0
  23. package/dist/lib/neutral/translations.mjs +30 -0
  24. package/dist/lib/neutral/translations.mjs.map +7 -0
  25. package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
  26. package/dist/lib/neutral/types/index.mjs.map +7 -0
  27. package/dist/types/src/MasonryPlugin.d.ts +1 -0
  28. package/dist/types/src/MasonryPlugin.d.ts.map +1 -1
  29. package/dist/types/src/MasonryPlugin.test.d.ts +2 -0
  30. package/dist/types/src/MasonryPlugin.test.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  32. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/index.d.ts +8 -1
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  36. package/dist/types/src/containers/MasonryContainer/MasonryContainer.d.ts.map +1 -1
  37. package/dist/types/src/containers/MasonryContainer/MasonryContainer.stories.d.ts.map +1 -1
  38. package/dist/types/src/containers/MasonryContainer/index.d.ts +1 -2
  39. package/dist/types/src/containers/MasonryContainer/index.d.ts.map +1 -1
  40. package/dist/types/src/index.d.ts +1 -1
  41. package/dist/types/src/index.d.ts.map +1 -1
  42. package/dist/types/src/plugin.d.ts +3 -0
  43. package/dist/types/src/plugin.d.ts.map +1 -0
  44. package/dist/types/src/translations.d.ts +20 -18
  45. package/dist/types/src/translations.d.ts.map +1 -1
  46. package/dist/types/src/types/Masonry.d.ts +2 -8
  47. package/dist/types/src/types/Masonry.d.ts.map +1 -1
  48. package/dist/types/src/types/MasonryAction.d.ts.map +1 -1
  49. package/dist/types/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +79 -44
  51. package/src/MasonryPlugin.test.ts +26 -0
  52. package/src/MasonryPlugin.tsx +7 -24
  53. package/src/capabilities/create-object.ts +36 -0
  54. package/src/capabilities/index.ts +4 -1
  55. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +9 -7
  56. package/src/containers/MasonryContainer/MasonryContainer.stories.tsx +8 -10
  57. package/src/containers/MasonryContainer/MasonryContainer.tsx +56 -17
  58. package/src/containers/MasonryContainer/index.ts +1 -3
  59. package/src/index.ts +1 -2
  60. package/src/meta.ts +1 -1
  61. package/src/plugin.ts +9 -0
  62. package/src/translations.ts +12 -11
  63. package/src/types/Masonry.ts +8 -22
  64. package/src/types/MasonryAction.ts +1 -2
  65. package/dist/lib/browser/MasonryContainer-G5D7SXNF.mjs +0 -82
  66. package/dist/lib/browser/MasonryContainer-G5D7SXNF.mjs.map +0 -7
  67. package/dist/lib/browser/chunk-JYUFXVAU.mjs.map +0 -7
  68. package/dist/lib/browser/index.mjs +0 -76
  69. package/dist/lib/browser/index.mjs.map +0 -7
  70. package/dist/lib/browser/meta.json +0 -1
  71. package/dist/lib/browser/react-surface-TJ6V3IKD.mjs.map +0 -7
  72. package/dist/lib/node-esm/MasonryContainer-HB775HET.mjs +0 -83
  73. package/dist/lib/node-esm/MasonryContainer-HB775HET.mjs.map +0 -7
  74. package/dist/lib/node-esm/chunk-4PU4KL3A.mjs +0 -78
  75. package/dist/lib/node-esm/chunk-4PU4KL3A.mjs.map +0 -7
  76. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  77. package/dist/lib/node-esm/chunk-P6EZJITS.mjs +0 -21
  78. package/dist/lib/node-esm/chunk-P6EZJITS.mjs.map +0 -7
  79. package/dist/lib/node-esm/index.mjs +0 -77
  80. package/dist/lib/node-esm/index.mjs.map +0 -7
  81. package/dist/lib/node-esm/meta.json +0 -1
  82. package/dist/lib/node-esm/react-surface-A7GOFCCK.mjs +0 -43
  83. package/dist/lib/node-esm/react-surface-A7GOFCCK.mjs.map +0 -7
  84. package/dist/lib/node-esm/types/index.mjs +0 -11
  85. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  86. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  87. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  88. package/src/capabilities/react-surface/index.ts +0 -7
  89. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  90. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  91. /package/dist/lib/{browser/types → neutral/components}/index.mjs.map +0 -0
  92. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
  93. /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
  94. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-masonry",
3
- "version": "0.8.4-main.c85a9c8dae",
3
+ "version": "0.8.4-main.dfabb4ec29",
4
4
  "description": "Masonry DXOS Surface plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,72 +12,107 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#components": {
22
+ "source": "./src/components/index.ts",
23
+ "types": "./dist/types/src/components/index.d.ts",
24
+ "default": "./dist/lib/neutral/components/index.mjs"
25
+ },
26
+ "#containers": {
27
+ "source": "./src/containers/index.ts",
28
+ "types": "./dist/types/src/containers/index.d.ts",
29
+ "default": "./dist/lib/neutral/containers/index.mjs"
30
+ },
31
+ "#meta": {
32
+ "source": "./src/meta.ts",
33
+ "types": "./dist/types/src/meta.d.ts",
34
+ "default": "./dist/lib/neutral/meta.mjs"
35
+ },
36
+ "#plugin": {
37
+ "source": "./src/MasonryPlugin.tsx",
38
+ "types": "./dist/types/src/MasonryPlugin.d.ts",
39
+ "default": "./dist/lib/neutral/MasonryPlugin.mjs"
40
+ },
41
+ "#translations": {
42
+ "source": "./src/translations.ts",
43
+ "types": "./dist/types/src/translations.d.ts",
44
+ "default": "./dist/lib/neutral/translations.mjs"
45
+ },
46
+ "#types": {
47
+ "source": "./src/types/index.ts",
48
+ "types": "./dist/types/src/types/index.d.ts",
49
+ "default": "./dist/lib/neutral/types/index.mjs"
50
+ }
51
+ },
15
52
  "exports": {
16
53
  ".": {
17
54
  "source": "./src/index.ts",
18
55
  "types": "./dist/types/src/index.d.ts",
19
- "browser": "./dist/lib/browser/index.mjs",
20
- "node": "./dist/lib/node-esm/index.mjs"
56
+ "default": "./dist/lib/neutral/index.mjs"
21
57
  },
22
- "./types": {
23
- "source": "./src/types/index.ts",
24
- "types": "./dist/types/src/types/index.d.ts",
25
- "browser": "./dist/lib/browser/types/index.mjs",
26
- "node": "./dist/lib/node-esm/types/index.mjs"
58
+ "./plugin": {
59
+ "source": "./src/plugin.ts",
60
+ "types": "./dist/types/src/plugin.d.ts",
61
+ "default": "./dist/lib/neutral/plugin.mjs"
62
+ },
63
+ "./translations": {
64
+ "source": "./src/translations.ts",
65
+ "types": "./dist/types/src/translations.d.ts",
66
+ "default": "./dist/lib/neutral/translations.mjs"
27
67
  }
28
68
  },
29
69
  "types": "dist/types/src/index.d.ts",
30
- "typesVersions": {
31
- "*": {
32
- "types": [
33
- "dist/types/src/types/index.d.ts"
34
- ]
35
- }
36
- },
37
70
  "files": [
38
71
  "dist",
39
72
  "src"
40
73
  ],
41
74
  "dependencies": {
42
- "@dxos/app-framework": "0.8.4-main.c85a9c8dae",
43
- "@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
44
- "@dxos/echo": "0.8.4-main.c85a9c8dae",
45
- "@dxos/operation": "0.8.4-main.c85a9c8dae",
46
- "@dxos/effect": "0.8.4-main.c85a9c8dae",
47
- "@dxos/plugin-client": "0.8.4-main.c85a9c8dae",
48
- "@dxos/plugin-space": "0.8.4-main.c85a9c8dae",
49
- "@dxos/plugin-search": "0.8.4-main.c85a9c8dae",
50
- "@dxos/react-client": "0.8.4-main.c85a9c8dae",
51
- "@dxos/react-ui-mosaic": "0.8.4-main.c85a9c8dae",
52
- "@dxos/schema": "0.8.4-main.c85a9c8dae",
53
- "@dxos/types": "0.8.4-main.c85a9c8dae",
54
- "@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
55
- "@dxos/util": "0.8.4-main.c85a9c8dae",
56
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
57
- "@dxos/react-ui-form": "0.8.4-main.c85a9c8dae",
58
- "@dxos/react-ui-masonry": "0.8.4-main.c85a9c8dae",
59
- "@dxos/react-ui-menu": "0.8.4-main.c85a9c8dae"
75
+ "@dxos/app-framework": "0.8.4-main.dfabb4ec29",
76
+ "@dxos/app-toolkit": "0.8.4-main.dfabb4ec29",
77
+ "@dxos/effect": "0.8.4-main.dfabb4ec29",
78
+ "@dxos/echo": "0.8.4-main.dfabb4ec29",
79
+ "@dxos/plugin-client": "0.8.4-main.dfabb4ec29",
80
+ "@dxos/plugin-search": "0.8.4-main.dfabb4ec29",
81
+ "@dxos/react-client": "0.8.4-main.dfabb4ec29",
82
+ "@dxos/plugin-space": "0.8.4-main.dfabb4ec29",
83
+ "@dxos/react-ui-masonry": "0.8.4-main.dfabb4ec29",
84
+ "@dxos/react-ui-list": "0.8.4-main.dfabb4ec29",
85
+ "@dxos/react-ui-mosaic": "0.8.4-main.dfabb4ec29",
86
+ "@dxos/react-ui-search": "0.8.4-main.dfabb4ec29",
87
+ "@dxos/react-ui-stack": "0.8.4-main.dfabb4ec29",
88
+ "@dxos/react-ui-form": "0.8.4-main.dfabb4ec29",
89
+ "@dxos/react-ui-menu": "0.8.4-main.dfabb4ec29",
90
+ "@dxos/compute": "0.8.4-main.dfabb4ec29",
91
+ "@dxos/schema": "0.8.4-main.dfabb4ec29",
92
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29",
93
+ "@dxos/util": "0.8.4-main.dfabb4ec29",
94
+ "@dxos/types": "0.8.4-main.dfabb4ec29"
60
95
  },
61
96
  "devDependencies": {
62
97
  "@types/react": "~19.2.7",
63
98
  "@types/react-dom": "~19.2.3",
64
- "effect": "3.19.16",
99
+ "effect": "3.20.0",
65
100
  "react": "~19.2.3",
66
101
  "react-dom": "~19.2.3",
67
- "vite": "^7.1.11",
68
- "@dxos/plugin-preview": "0.8.4-main.c85a9c8dae",
69
- "@dxos/plugin-testing": "0.8.4-main.c85a9c8dae",
70
- "@dxos/plugin-theme": "0.8.4-main.c85a9c8dae",
71
- "@dxos/random": "0.8.4-main.c85a9c8dae",
72
- "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
73
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
102
+ "vite": "^8.0.10",
103
+ "@dxos/plugin-testing": "0.8.4-main.dfabb4ec29",
104
+ "@dxos/random": "0.8.4-main.dfabb4ec29",
105
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
106
+ "@dxos/storybook-utils": "0.8.4-main.dfabb4ec29",
107
+ "@dxos/plugin-preview": "0.8.4-main.dfabb4ec29",
108
+ "@dxos/plugin-theme": "0.8.4-main.dfabb4ec29"
74
109
  },
75
110
  "peerDependencies": {
76
- "effect": "3.19.16",
111
+ "effect": "3.20.0",
77
112
  "react": "~19.2.3",
78
113
  "react-dom": "~19.2.3",
79
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
80
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
114
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
115
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29"
81
116
  },
82
117
  "publishConfig": {
83
118
  "access": "public"
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import { ClientPlugin } from '@dxos/plugin-client/plugin';
8
+ import { createComposerTestApp } from '@dxos/plugin-testing/harness';
9
+
10
+ import { MasonryPlugin } from '#plugin';
11
+
12
+ import { meta } from './meta';
13
+
14
+ const moduleId = (name: string) => `${meta.id}.module.${name}`;
15
+
16
+ describe('MasonryPlugin', () => {
17
+ test('modules activate on the expected events', async ({ expect }) => {
18
+ await using harness = await createComposerTestApp({
19
+ plugins: [ClientPlugin({}), MasonryPlugin()],
20
+ });
21
+
22
+ expect(harness.manager.getActive()).toEqual(
23
+ expect.arrayContaining([moduleId('CreateObject'), moduleId('schema'), moduleId('ReactSurface')]),
24
+ );
25
+ });
26
+ });
@@ -2,37 +2,20 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Effect from 'effect/Effect';
6
-
7
5
  import { Plugin } from '@dxos/app-framework';
8
6
  import { AppPlugin } from '@dxos/app-toolkit';
9
- import { Type } from '@dxos/echo';
10
- import { type CreateObject } from '@dxos/plugin-space/types';
11
- import { ViewModel } from '@dxos/schema';
12
7
 
13
- import { ReactSurface } from './capabilities';
14
- import { meta } from './meta';
15
- import { translations } from './translations';
16
- import { Masonry, MasonryAction } from './types';
8
+ import { CreateObject, ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
+ import { Masonry } from '#types';
17
12
 
18
13
  export const MasonryPlugin = Plugin.define(meta).pipe(
19
- AppPlugin.addMetadataModule({
20
- metadata: {
21
- id: Type.getTypename(Masonry.Masonry),
22
- metadata: {
23
- icon: 'ph--wall--regular',
24
- iconHue: 'green',
25
- inputSchema: MasonryAction.MasonryProps,
26
- createObject: ((props, { db }) =>
27
- Effect.promise(async () => {
28
- const { view } = await ViewModel.makeFromDatabase({ db, typename: props.typename });
29
- return Masonry.make({ name: props.name, view });
30
- })) satisfies CreateObject,
31
- },
32
- },
33
- }),
14
+ AppPlugin.addCreateObjectModule({ activate: CreateObject }),
34
15
  AppPlugin.addSchemaModule({ schema: [Masonry.Masonry] }),
35
16
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
36
17
  AppPlugin.addTranslationsModule({ translations }),
37
18
  Plugin.make,
38
19
  );
20
+
21
+ export default MasonryPlugin;
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/compute';
9
+ import { Type } from '@dxos/echo';
10
+ import { SpaceOperation } from '@dxos/plugin-space';
11
+ import { SpaceCapabilities } from '@dxos/plugin-space';
12
+ import { ViewModel } from '@dxos/schema';
13
+
14
+ import { Masonry, MasonryAction } from '#types';
15
+
16
+ export default Capability.makeModule(
17
+ Effect.fnUntraced(function* () {
18
+ return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
19
+ id: Type.getTypename(Masonry.Masonry),
20
+ inputSchema: MasonryAction.MasonryProps,
21
+ createObject: (props, options) =>
22
+ Effect.gen(function* () {
23
+ const object = yield* Effect.promise(async () => {
24
+ const { view } = await ViewModel.makeFromDatabase({ db: options.db, typename: props.typename });
25
+ return Masonry.make({ name: props.name, view });
26
+ });
27
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
28
+ object,
29
+ target: options.target,
30
+ hidden: true,
31
+ targetNodeId: options.targetNodeId,
32
+ });
33
+ }),
34
+ });
35
+ }),
36
+ );
@@ -2,4 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
8
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -7,21 +7,23 @@ import React from 'react';
7
7
 
8
8
  import { Capabilities, Capability } from '@dxos/app-framework';
9
9
  import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
10
11
  import { Obj } from '@dxos/echo';
11
12
  import { View } from '@dxos/echo';
12
13
 
13
- import { MasonryContainer } from '../../containers';
14
- import { meta } from '../../meta';
15
- import { Masonry } from '../../types';
14
+ import { MasonryContainer } from '#containers';
15
+ import { Masonry } from '#types';
16
16
 
17
17
  export default Capability.makeModule(() =>
18
18
  Effect.succeed(
19
19
  Capability.contributes(Capabilities.ReactSurface, [
20
20
  Surface.create({
21
- id: meta.id,
22
- role: ['article', 'section'],
23
- filter: (data): data is { subject: Masonry.Masonry | View.View } =>
24
- Obj.instanceOf(Masonry.Masonry, data.subject) || Obj.instanceOf(View.View, data.subject),
21
+ id: 'root',
22
+ // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
23
+ filter: AppSurface.oneOf(
24
+ AppSurface.object(AppSurface.Article, [Masonry.Masonry, View.View]),
25
+ AppSurface.object(AppSurface.Section, [Masonry.Masonry, View.View]),
26
+ ),
25
27
  component: ({ data, role }) => {
26
28
  const view = Obj.instanceOf(View.View, data.subject) ? data.subject : data.subject.view;
27
29
  return <MasonryContainer view={view} role={role} />;
@@ -8,21 +8,21 @@ import React from 'react';
8
8
 
9
9
  import { withPluginManager } from '@dxos/app-framework/testing';
10
10
  import { View } from '@dxos/echo';
11
- import { ClientPlugin } from '@dxos/plugin-client';
12
- import { PreviewPlugin } from '@dxos/plugin-preview';
11
+ import { ClientPlugin } from '@dxos/plugin-client/plugin';
12
+ import { initializeIdentity } from '@dxos/plugin-client/testing';
13
+ import { PreviewPlugin } from '@dxos/plugin-preview/testing';
13
14
  import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
14
- import { faker } from '@dxos/random';
15
+ import { random } from '@dxos/random';
15
16
  import { Filter, useObject, useQuery, useSpaces } from '@dxos/react-client/echo';
16
- import { withLayout, withTheme } from '@dxos/react-ui/testing';
17
17
  import { ViewModel } from '@dxos/schema';
18
18
  import { createObjectFactory } from '@dxos/schema/testing';
19
19
  import { Organization } from '@dxos/types';
20
20
 
21
- import { Masonry } from '../../types';
21
+ import { Masonry } from '#types';
22
22
 
23
23
  import { MasonryContainer } from './MasonryContainer';
24
24
 
25
- faker.seed(0);
25
+ random.seed(0);
26
26
 
27
27
  const StorybookMasonry = () => {
28
28
  const spaces = useSpaces();
@@ -38,8 +38,6 @@ const meta = {
38
38
  component: StorybookMasonry,
39
39
  render: () => <StorybookMasonry />,
40
40
  decorators: [
41
- withTheme(),
42
- withLayout({ layout: 'fullscreen' }),
43
41
  withPluginManager({
44
42
  plugins: [
45
43
  ...corePlugins(),
@@ -48,7 +46,7 @@ const meta = {
48
46
  types: [Organization.Organization, View.View, Masonry.Masonry],
49
47
  onClientInitialized: ({ client }) =>
50
48
  Effect.gen(function* () {
51
- yield* Effect.promise(() => client.halo.createIdentity());
49
+ yield* initializeIdentity(client);
52
50
  const space = yield* Effect.promise(() => client.spaces.create());
53
51
  yield* Effect.promise(() => space.waitUntilReady());
54
52
  const { view } = yield* Effect.promise(() =>
@@ -59,7 +57,7 @@ const meta = {
59
57
  );
60
58
  const masonry = Masonry.make({ view });
61
59
  space.db.add(masonry);
62
- const factory = createObjectFactory(space.db, faker as any);
60
+ const factory = createObjectFactory(space.db, random as any);
63
61
  yield* Effect.promise(() => factory([{ type: Organization.Organization, count: 64 }]));
64
62
  }),
65
63
  }),
@@ -2,20 +2,23 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Function from 'effect/Function';
6
+ import * as Option from 'effect/Option';
5
7
  import type * as Schema from 'effect/Schema';
6
- import React, { useEffect, useState } from 'react';
8
+ import React, { useEffect, useMemo, useState } from 'react';
7
9
 
8
10
  import { Surface, useCapabilities } from '@dxos/app-framework/ui';
9
11
  import { AppCapabilities } from '@dxos/app-toolkit';
10
- import { useObjectMenuItems, useObjectNavigate } from '@dxos/app-toolkit/ui';
11
- import { Filter, Obj, type Ref, Type } from '@dxos/echo';
12
+ import { AppSurface, useObjectMenuItems } from '@dxos/app-toolkit/ui';
13
+ import { Annotation, Filter, Obj, Query, type Ref, Type } from '@dxos/echo';
12
14
  import { type View } from '@dxos/echo';
13
- import { useGlobalFilteredObjects } from '@dxos/plugin-search';
14
15
  import { useObject, useQuery } from '@dxos/react-client/echo';
15
- import { Card, Toolbar } from '@dxos/react-ui';
16
+ import { Card, Panel, Toolbar } from '@dxos/react-ui';
16
17
  import { Masonry as MasonryComponent } from '@dxos/react-ui-masonry';
17
18
  import { Menu } from '@dxos/react-ui-menu';
18
- import { getTypenameFromQuery } from '@dxos/schema';
19
+ import { SearchList, useSearchListResults } from '@dxos/react-ui-search';
20
+ import { getTagFromQuery, getTypenameFromQuery } from '@dxos/schema';
21
+ import { isNonNullable } from '@dxos/util';
19
22
 
20
23
  export type MasonryContainerProps = {
21
24
  view: View.View;
@@ -33,6 +36,7 @@ export const MasonryContainer = ({
33
36
  const schemas = useCapabilities(AppCapabilities.Schema);
34
37
  const db = view && Obj.getDatabase(view);
35
38
  const typename = view?.query ? getTypenameFromQuery(view.query.ast) : undefined;
39
+ const tag = view?.query ? getTagFromQuery(view.query.ast) : undefined;
36
40
 
37
41
  const [cardSchema, setCardSchema] = useState<Schema.Schema.AnyNoContext>();
38
42
 
@@ -56,35 +60,70 @@ export const MasonryContainer = ({
56
60
  }
57
61
  }, [schemas, typename, db]);
58
62
 
59
- const objects = useQuery(db, cardSchema ? Filter.type(cardSchema) : Filter.nothing());
60
- const filteredObjects = useGlobalFilteredObjects(objects);
63
+ const query = useMemo(() => {
64
+ const baseFilter = cardSchema ? Filter.type(cardSchema) : Filter.nothing();
65
+ return tag ? Query.select(baseFilter).select(Filter.tag(tag)) : Query.select(baseFilter);
66
+ }, [cardSchema, tag]);
67
+ const objects = useQuery(db, query);
68
+
69
+ const sortedObjects = useMemo(
70
+ () =>
71
+ objects.filter(isNonNullable).toSorted((a, b) => (Obj.getLabel(a) ?? '').localeCompare(Obj.getLabel(b) ?? '')),
72
+ [objects],
73
+ );
74
+
75
+ const { results, handleSearch } = useSearchListResults({
76
+ items: sortedObjects,
77
+ extract: (obj) => Obj.getLabel(obj) ?? '',
78
+ });
61
79
 
62
80
  return (
63
- <MasonryComponent.Root
64
- items={filteredObjects}
65
- render={Item as any}
66
- classNames='w-full max-w-full h-full max-h-full overflow-y-auto p-4'
67
- />
81
+ <MasonryComponent.Root Tile={Item}>
82
+ <SearchList.Root onSearch={handleSearch}>
83
+ <Panel.Root>
84
+ <Panel.Toolbar asChild>
85
+ <Toolbar.Root>
86
+ <SearchList.Input placeholder='Search...' />
87
+ </Toolbar.Root>
88
+ </Panel.Toolbar>
89
+ <Panel.Content>
90
+ <MasonryComponent.Content>
91
+ <MasonryComponent.Viewport items={results} getId={(data: any) => data?.id} />
92
+ </MasonryComponent.Content>
93
+ </Panel.Content>
94
+ </Panel.Root>
95
+ </SearchList.Root>
96
+ </MasonryComponent.Root>
68
97
  );
69
98
  };
70
99
 
71
100
  const Item = ({ data }: { data: any }) => {
72
101
  const objectMenuItems = useObjectMenuItems(data);
73
- const handleNavigate = useObjectNavigate(data);
102
+ const icon = Function.pipe(
103
+ Obj.getSchema(data),
104
+ Option.fromNullable,
105
+ Option.flatMap(Annotation.IconAnnotation.get),
106
+ Option.map(({ icon }) => icon),
107
+ Option.getOrElse(() => 'ph--placeholder--regular'),
108
+ );
74
109
 
75
110
  return (
76
111
  <Menu.Root>
77
112
  <Card.Root>
78
113
  <Card.Toolbar>
79
- <span />
80
- <Card.Title onClick={handleNavigate}>{Obj.getLabel(data)}</Card.Title>
114
+ <Card.Icon icon={icon} />
115
+ <Card.Title>{Obj.getLabel(data)}</Card.Title>
81
116
  {/* TODO(wittjosiah): Reconcile with Card.Menu. */}
82
117
  <Menu.Trigger asChild disabled={!objectMenuItems?.length}>
83
118
  <Toolbar.IconButton iconOnly variant='ghost' icon='ph--dots-three-vertical--regular' label='Actions' />
84
119
  </Menu.Trigger>
85
120
  <Menu.Content items={objectMenuItems} />
86
121
  </Card.Toolbar>
87
- <Surface.Surface role='card--content' limit={1} data={{ subject: data }} />
122
+ <Surface.Surface
123
+ type={AppSurface.Card}
124
+ limit={1}
125
+ data={{ subject: data } satisfies AppSurface.ObjectCardData}
126
+ />
88
127
  </Card.Root>
89
128
  </Menu.Root>
90
129
  );
@@ -2,6 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { MasonryContainer } from './MasonryContainer';
6
-
7
- export default MasonryContainer;
5
+ export { MasonryContainer as default } from './MasonryContainer';
package/src/index.ts CHANGED
@@ -3,5 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './meta';
6
-
7
- export * from './MasonryPlugin';
6
+ export * from './types';
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
8
  export const meta: Plugin.Meta = {
9
- id: 'dxos.org/plugin/masonry',
9
+ id: 'org.dxos.plugin.masonry',
10
10
  name: 'Masonry',
11
11
  description: trim`
12
12
  Responsive grid layout that displays query results in an adaptive masonry pattern.
package/src/plugin.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const MasonryPlugin = Plugin.lazy(meta, () => import('#plugin'));
@@ -5,24 +5,25 @@
5
5
  import { Type } from '@dxos/echo';
6
6
  import { type Resource } from '@dxos/react-ui';
7
7
 
8
- import { meta } from './meta';
9
- import { Masonry } from './types';
8
+ import { meta } from '#meta';
9
+ import { Masonry } from '#types';
10
10
 
11
11
  export const translations = [
12
12
  {
13
13
  'en-US': {
14
14
  [Type.getTypename(Masonry.Masonry)]: {
15
- 'typename label': 'Masonry',
16
- 'typename label_zero': 'Masonries',
17
- 'typename label_one': 'Masonry',
18
- 'typename label_other': 'Masonries',
19
- 'object name placeholder': 'New masonry',
20
- 'rename object label': 'Rename masonry',
21
- 'delete object label': 'Delete masonry',
22
- 'object deleted label': 'Masonry deleted',
15
+ 'typename.label': 'Masonry',
16
+ 'typename.label_zero': 'Masonries',
17
+ 'typename.label_one': 'Masonry',
18
+ 'typename.label_other': 'Masonries',
19
+ 'object-name.placeholder': 'New masonry',
20
+ 'add-object.label': 'Add masonry',
21
+ 'rename-object.label': 'Rename masonry',
22
+ 'delete-object.label': 'Delete masonry',
23
+ 'object-deleted.label': 'Masonry deleted',
23
24
  },
24
25
  [meta.id]: {
25
- 'plugin name': 'Masonry',
26
+ 'plugin.name': 'Masonry',
26
27
  },
27
28
  },
28
29
  },
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { Obj, Ref, Type } from '@dxos/echo';
7
+ import { Annotation, Obj, Ref, Type } from '@dxos/echo';
8
8
  import { View } from '@dxos/echo';
9
9
  import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
10
10
  import { ViewAnnotation } from '@dxos/schema';
@@ -23,11 +23,15 @@ export const Masonry = Schema.Struct({
23
23
  // TODO(wittjosiah): Consider Masonry supporting not being just a view but referencing arbitrary data directly.
24
24
  }).pipe(
25
25
  Type.object({
26
- typename: 'dxos.org/type/Masonry',
27
- version: '0.2.0',
26
+ typename: 'org.dxos.type.masonry',
27
+ version: '0.1.0',
28
28
  }),
29
29
  LabelAnnotation.set(['name']),
30
- ViewAnnotation.set(true),
30
+ ViewAnnotation.set(['view']),
31
+ Annotation.IconAnnotation.set({
32
+ icon: 'ph--wall--regular',
33
+ hue: 'green',
34
+ }),
31
35
  );
32
36
 
33
37
  export interface Masonry extends Schema.Schema.Type<typeof Masonry> {}
@@ -42,21 +46,3 @@ type MakeProps = Omit<Partial<Obj.MakeProps<typeof Masonry>>, 'view'> & {
42
46
  export const make = ({ name, arrangement = [], view }: MakeProps): Masonry => {
43
47
  return Obj.make(Masonry, { name, view: Ref.make(view), arrangement });
44
48
  };
45
-
46
- //
47
- // V1
48
- //
49
-
50
- export const MasonryV1 = Schema.Struct({
51
- arrangement: Schema.Array(
52
- Schema.Struct({
53
- ids: Schema.Array(Obj.ID),
54
- hidden: Schema.optional(Schema.Boolean),
55
- }),
56
- ).pipe(Schema.optional),
57
- }).pipe(
58
- Type.object({
59
- typename: 'dxos.org/type/Masonry',
60
- version: '0.1.0',
61
- }),
62
- );
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';
7
+ import { TypeInputOptionsAnnotation } from '@dxos/plugin-space';
8
8
 
9
9
  export const MasonryProps = Schema.Struct({
10
10
  name: Schema.optional(Schema.String),
@@ -14,7 +14,6 @@ export const MasonryProps = Schema.Struct({
14
14
  TypeInputOptionsAnnotation.set({
15
15
  location: ['database', 'runtime'],
16
16
  kind: ['user'],
17
- registered: ['registered'],
18
17
  }),
19
18
  Schema.optional,
20
19
  ),