@dxos/plugin-masonry 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/{browser/MasonryContainer-4JARBSYY.mjs → neutral/MasonryContainer-QF3OCAHU.mjs} +9 -14
- package/dist/lib/neutral/MasonryContainer-QF3OCAHU.mjs.map +7 -0
- package/dist/lib/neutral/MasonryPlugin.mjs +26 -0
- package/dist/lib/neutral/MasonryPlugin.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/{browser/chunk-ANLADCDB.mjs → neutral/chunk-HDBVJK6S.mjs} +6 -5
- package/dist/lib/neutral/chunk-HDBVJK6S.mjs.map +7 -0
- package/dist/lib/{browser/chunk-7W5GV4MG.mjs → neutral/chunk-RAEY5T7G.mjs} +2 -1
- package/dist/lib/neutral/chunk-RAEY5T7G.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +1 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-WRCYV4HT.mjs +39 -0
- package/dist/lib/neutral/create-object-WRCYV4HT.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +14 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-F5SETG6J.mjs → neutral/react-surface-7CZHE3XA.mjs} +15 -22
- package/dist/lib/neutral/react-surface-7CZHE3XA.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +30 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/MasonryPlugin.d.ts +1 -0
- package/dist/types/src/MasonryPlugin.d.ts.map +1 -1
- package/dist/types/src/MasonryPlugin.test.d.ts +2 -0
- package/dist/types/src/MasonryPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/containers/MasonryContainer/MasonryContainer.d.ts +1 -2
- package/dist/types/src/containers/MasonryContainer/MasonryContainer.d.ts.map +1 -1
- package/dist/types/src/containers/MasonryContainer/MasonryContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/MasonryContainer/index.d.ts +1 -2
- package/dist/types/src/containers/MasonryContainer/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +20 -20
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Masonry.d.ts +3 -4
- package/dist/types/src/types/Masonry.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +78 -44
- package/src/MasonryPlugin.test.ts +26 -0
- package/src/MasonryPlugin.tsx +7 -36
- package/src/capabilities/create-object.ts +36 -0
- package/src/capabilities/index.ts +4 -1
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +10 -9
- package/src/containers/MasonryContainer/MasonryContainer.stories.tsx +8 -8
- package/src/containers/MasonryContainer/MasonryContainer.tsx +16 -11
- package/src/containers/MasonryContainer/index.ts +1 -3
- package/src/index.ts +1 -2
- package/src/meta.ts +1 -0
- package/src/plugin.ts +9 -0
- package/src/translations.ts +12 -12
- package/src/types/Masonry.ts +2 -3
- package/src/types/MasonryAction.ts +1 -1
- package/dist/lib/browser/MasonryContainer-4JARBSYY.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W5GV4MG.mjs.map +0 -7
- package/dist/lib/browser/chunk-ANLADCDB.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -88
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-F5SETG6J.mjs.map +0 -7
- package/dist/lib/node-esm/MasonryContainer-VZH4BF2E.mjs +0 -107
- package/dist/lib/node-esm/MasonryContainer-VZH4BF2E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CCWUD5KF.mjs +0 -21
- package/dist/lib/node-esm/chunk-CCWUD5KF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GHHWMU6E.mjs +0 -68
- package/dist/lib/node-esm/chunk-GHHWMU6E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/index.mjs +0 -89
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-XGVTHG4O.mjs +0 -43
- package/dist/lib/node-esm/react-surface-XGVTHG4O.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -11
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- /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.
|
|
3
|
+
"version": "0.8.4-main.8baae0fced",
|
|
4
4
|
"description": "Masonry DXOS Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,56 +8,90 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
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
|
-
"
|
|
20
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
56
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
21
57
|
},
|
|
22
|
-
"./
|
|
23
|
-
"source": "./src/
|
|
24
|
-
"types": "./dist/types/src/
|
|
25
|
-
"
|
|
26
|
-
|
|
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.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/effect": "0.8.4-main.
|
|
46
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/plugin-
|
|
49
|
-
"@dxos/plugin-
|
|
50
|
-
"@dxos/react-
|
|
51
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/react-ui-
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/util": "0.8.4-main.
|
|
60
|
-
"@dxos/
|
|
75
|
+
"@dxos/app-framework": "0.8.4-main.8baae0fced",
|
|
76
|
+
"@dxos/echo": "0.8.4-main.8baae0fced",
|
|
77
|
+
"@dxos/app-toolkit": "0.8.4-main.8baae0fced",
|
|
78
|
+
"@dxos/effect": "0.8.4-main.8baae0fced",
|
|
79
|
+
"@dxos/plugin-client": "0.8.4-main.8baae0fced",
|
|
80
|
+
"@dxos/compute": "0.8.4-main.8baae0fced",
|
|
81
|
+
"@dxos/plugin-search": "0.8.4-main.8baae0fced",
|
|
82
|
+
"@dxos/plugin-space": "0.8.4-main.8baae0fced",
|
|
83
|
+
"@dxos/react-client": "0.8.4-main.8baae0fced",
|
|
84
|
+
"@dxos/react-ui": "0.8.4-main.8baae0fced",
|
|
85
|
+
"@dxos/react-ui-form": "0.8.4-main.8baae0fced",
|
|
86
|
+
"@dxos/react-ui-list": "0.8.4-main.8baae0fced",
|
|
87
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.8baae0fced",
|
|
88
|
+
"@dxos/react-ui-menu": "0.8.4-main.8baae0fced",
|
|
89
|
+
"@dxos/react-ui-search": "0.8.4-main.8baae0fced",
|
|
90
|
+
"@dxos/react-ui-stack": "0.8.4-main.8baae0fced",
|
|
91
|
+
"@dxos/types": "0.8.4-main.8baae0fced",
|
|
92
|
+
"@dxos/util": "0.8.4-main.8baae0fced",
|
|
93
|
+
"@dxos/schema": "0.8.4-main.8baae0fced",
|
|
94
|
+
"@dxos/react-ui-masonry": "0.8.4-main.8baae0fced"
|
|
61
95
|
},
|
|
62
96
|
"devDependencies": {
|
|
63
97
|
"@types/react": "~19.2.7",
|
|
@@ -65,20 +99,20 @@
|
|
|
65
99
|
"effect": "3.20.0",
|
|
66
100
|
"react": "~19.2.3",
|
|
67
101
|
"react-dom": "~19.2.3",
|
|
68
|
-
"vite": "^
|
|
69
|
-
"@dxos/plugin-
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
102
|
+
"vite": "^8.0.13",
|
|
103
|
+
"@dxos/plugin-preview": "0.8.4-main.8baae0fced",
|
|
104
|
+
"@dxos/plugin-testing": "0.8.4-main.8baae0fced",
|
|
105
|
+
"@dxos/plugin-theme": "0.8.4-main.8baae0fced",
|
|
106
|
+
"@dxos/random": "0.8.4-main.8baae0fced",
|
|
107
|
+
"@dxos/storybook-utils": "0.8.4-main.8baae0fced",
|
|
108
|
+
"@dxos/ui-theme": "0.8.4-main.8baae0fced"
|
|
75
109
|
},
|
|
76
110
|
"peerDependencies": {
|
|
77
111
|
"effect": "3.20.0",
|
|
78
112
|
"react": "~19.2.3",
|
|
79
113
|
"react-dom": "~19.2.3",
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/ui
|
|
114
|
+
"@dxos/ui-theme": "0.8.4-main.8baae0fced",
|
|
115
|
+
"@dxos/react-ui": "0.8.4-main.8baae0fced"
|
|
82
116
|
},
|
|
83
117
|
"publishConfig": {
|
|
84
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
|
+
});
|
package/src/MasonryPlugin.tsx
CHANGED
|
@@ -2,49 +2,20 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import * as Option from 'effect/Option';
|
|
8
|
-
|
|
9
5
|
import { Plugin } from '@dxos/app-framework';
|
|
10
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
11
|
-
import { Annotation, Type } from '@dxos/echo';
|
|
12
|
-
import { Operation } from '@dxos/operation';
|
|
13
|
-
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
|
-
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
15
|
-
import { ViewModel } from '@dxos/schema';
|
|
16
7
|
|
|
17
|
-
import { ReactSurface } from '
|
|
18
|
-
import { meta } from '
|
|
19
|
-
import { translations } from '
|
|
20
|
-
import { Masonry
|
|
8
|
+
import { CreateObject, ReactSurface } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
import { Masonry } from '#types';
|
|
21
12
|
|
|
22
13
|
export const MasonryPlugin = Plugin.define(meta).pipe(
|
|
23
|
-
AppPlugin.
|
|
24
|
-
metadata: {
|
|
25
|
-
id: Type.getTypename(Masonry.Masonry),
|
|
26
|
-
metadata: {
|
|
27
|
-
icon: Annotation.IconAnnotation.get(Masonry.Masonry).pipe(Option.getOrThrow).icon,
|
|
28
|
-
iconHue: Annotation.IconAnnotation.get(Masonry.Masonry).pipe(Option.getOrThrow).hue ?? 'white',
|
|
29
|
-
inputSchema: MasonryAction.MasonryProps,
|
|
30
|
-
createObject: ((props, options) =>
|
|
31
|
-
Effect.gen(function* () {
|
|
32
|
-
const object = yield* Effect.promise(async () => {
|
|
33
|
-
const { view } = await ViewModel.makeFromDatabase({ db: options.db, typename: props.typename });
|
|
34
|
-
return Masonry.make({ name: props.name, view });
|
|
35
|
-
});
|
|
36
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
37
|
-
object,
|
|
38
|
-
target: options.target,
|
|
39
|
-
hidden: true,
|
|
40
|
-
targetNodeId: options.targetNodeId,
|
|
41
|
-
});
|
|
42
|
-
})) satisfies CreateObject,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
14
|
+
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
46
15
|
AppPlugin.addSchemaModule({ schema: [Masonry.Masonry] }),
|
|
47
16
|
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
48
17
|
AppPlugin.addTranslationsModule({ translations }),
|
|
49
18
|
Plugin.make,
|
|
50
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
|
-
|
|
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,22 @@ 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 {
|
|
11
|
-
import { View } from '@dxos/echo';
|
|
10
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { Obj, View } from '@dxos/echo';
|
|
12
12
|
|
|
13
|
-
import { MasonryContainer } from '
|
|
14
|
-
import {
|
|
15
|
-
import { Masonry } from '../../types';
|
|
13
|
+
import { MasonryContainer } from '#containers';
|
|
14
|
+
import { Masonry } from '#types';
|
|
16
15
|
|
|
17
16
|
export default Capability.makeModule(() =>
|
|
18
17
|
Effect.succeed(
|
|
19
18
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
20
19
|
Surface.create({
|
|
21
|
-
id:
|
|
22
|
-
|
|
23
|
-
filter: (
|
|
24
|
-
|
|
20
|
+
id: 'root',
|
|
21
|
+
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
22
|
+
filter: AppSurface.oneOf(
|
|
23
|
+
AppSurface.object(AppSurface.Article, [Masonry.Masonry, View.View]),
|
|
24
|
+
AppSurface.object(AppSurface.Section, [Masonry.Masonry, View.View]),
|
|
25
|
+
),
|
|
25
26
|
component: ({ data, role }) => {
|
|
26
27
|
const view = Obj.instanceOf(View.View, data.subject) ? data.subject : data.subject.view;
|
|
27
28
|
return <MasonryContainer view={view} role={role} />;
|
|
@@ -7,22 +7,22 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { View } from '@dxos/echo';
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
|
+
import { Filter, View } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
12
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
13
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
14
14
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { random } from '@dxos/random';
|
|
16
|
+
import { useObject, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
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 '
|
|
21
|
+
import { Masonry } from '#types';
|
|
22
22
|
|
|
23
23
|
import { MasonryContainer } from './MasonryContainer';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
random.seed(0);
|
|
26
26
|
|
|
27
27
|
const StorybookMasonry = () => {
|
|
28
28
|
const spaces = useSpaces();
|
|
@@ -57,7 +57,7 @@ const meta = {
|
|
|
57
57
|
);
|
|
58
58
|
const masonry = Masonry.make({ view });
|
|
59
59
|
space.db.add(masonry);
|
|
60
|
-
const factory = createObjectFactory(space.db,
|
|
60
|
+
const factory = createObjectFactory(space.db, random as any);
|
|
61
61
|
yield* Effect.promise(() => factory([{ type: Organization.Organization, count: 64 }]));
|
|
62
62
|
}),
|
|
63
63
|
}),
|
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Function from 'effect/Function';
|
|
6
6
|
import * as Option from 'effect/Option';
|
|
7
|
-
import type * as Schema from 'effect/Schema';
|
|
8
7
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
8
|
|
|
10
9
|
import { Surface, useCapabilities } from '@dxos/app-framework/ui';
|
|
11
10
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
-
import { useObjectMenuItems } from '@dxos/app-toolkit/ui';
|
|
13
|
-
import { Annotation, Filter, Obj, Query, type Ref, Type } from '@dxos/echo';
|
|
14
|
-
import { type View } from '@dxos/echo';
|
|
11
|
+
import { AppSurface, useObjectMenuItems, useSchemaFilter } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Annotation, Filter, Obj, Query, type Ref, Type, type View } from '@dxos/echo';
|
|
15
13
|
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
16
14
|
import { Card, Panel, Toolbar } from '@dxos/react-ui';
|
|
17
15
|
import { Masonry as MasonryComponent } from '@dxos/react-ui-masonry';
|
|
@@ -38,7 +36,7 @@ export const MasonryContainer = ({
|
|
|
38
36
|
const typename = view?.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
39
37
|
const tag = view?.query ? getTagFromQuery(view.query.ast) : undefined;
|
|
40
38
|
|
|
41
|
-
const [cardSchema, setCardSchema] = useState<
|
|
39
|
+
const [cardSchema, setCardSchema] = useState<Type.AnyEntity>();
|
|
42
40
|
|
|
43
41
|
useEffect(() => {
|
|
44
42
|
const staticSchema = schemas.flat().find((schema) => Type.getTypename(schema) === typename);
|
|
@@ -60,10 +58,11 @@ export const MasonryContainer = ({
|
|
|
60
58
|
}
|
|
61
59
|
}, [schemas, typename, db]);
|
|
62
60
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const baseFilter = useSchemaFilter(cardSchema);
|
|
62
|
+
const query = useMemo(
|
|
63
|
+
() => (tag ? Query.select(baseFilter).select(Filter.tag(tag)) : Query.select(baseFilter)),
|
|
64
|
+
[baseFilter, tag],
|
|
65
|
+
);
|
|
67
66
|
const objects = useQuery(db, query);
|
|
68
67
|
|
|
69
68
|
const sortedObjects = useMemo(
|
|
@@ -87,7 +86,9 @@ export const MasonryContainer = ({
|
|
|
87
86
|
</Toolbar.Root>
|
|
88
87
|
</Panel.Toolbar>
|
|
89
88
|
<Panel.Content>
|
|
90
|
-
<MasonryComponent.Content
|
|
89
|
+
<MasonryComponent.Content>
|
|
90
|
+
<MasonryComponent.Viewport items={results} getId={(data: any) => data?.id} />
|
|
91
|
+
</MasonryComponent.Content>
|
|
91
92
|
</Panel.Content>
|
|
92
93
|
</Panel.Root>
|
|
93
94
|
</SearchList.Root>
|
|
@@ -117,7 +118,11 @@ const Item = ({ data }: { data: any }) => {
|
|
|
117
118
|
</Menu.Trigger>
|
|
118
119
|
<Menu.Content items={objectMenuItems} />
|
|
119
120
|
</Card.Toolbar>
|
|
120
|
-
<Surface.Surface
|
|
121
|
+
<Surface.Surface
|
|
122
|
+
type={AppSurface.Card}
|
|
123
|
+
limit={1}
|
|
124
|
+
data={{ subject: data } satisfies AppSurface.ObjectCardData}
|
|
125
|
+
/>
|
|
121
126
|
</Card.Root>
|
|
122
127
|
</Menu.Root>
|
|
123
128
|
);
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { trim } from '@dxos/util';
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'org.dxos.plugin.masonry',
|
|
10
10
|
name: 'Masonry',
|
|
11
|
+
author: 'DXOS',
|
|
11
12
|
description: trim`
|
|
12
13
|
Responsive grid layout that displays query results in an adaptive masonry pattern.
|
|
13
14
|
Visualize collections of cards, images, or mixed content that automatically adjusts to available screen space.
|
package/src/plugin.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
import { Type } from '@dxos/echo';
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { Masonry } from '
|
|
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
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'typename
|
|
19
|
-
'object
|
|
20
|
-
'add
|
|
21
|
-
'rename
|
|
22
|
-
'delete
|
|
23
|
-
'object
|
|
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',
|
|
24
24
|
},
|
|
25
25
|
[meta.id]: {
|
|
26
|
-
'plugin
|
|
26
|
+
'plugin.name': 'Masonry',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
},
|
package/src/types/Masonry.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { View } from '@dxos/echo';
|
|
7
|
+
import { Annotation, Obj, Ref, Type, View } from '@dxos/echo';
|
|
9
8
|
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
10
9
|
import { ViewAnnotation } from '@dxos/schema';
|
|
11
10
|
|
|
@@ -27,7 +26,7 @@ export const Masonry = Schema.Struct({
|
|
|
27
26
|
version: '0.1.0',
|
|
28
27
|
}),
|
|
29
28
|
LabelAnnotation.set(['name']),
|
|
30
|
-
ViewAnnotation.set(
|
|
29
|
+
ViewAnnotation.set(['view']),
|
|
31
30
|
Annotation.IconAnnotation.set({
|
|
32
31
|
icon: 'ph--wall--regular',
|
|
33
32
|
hue: 'green',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space
|
|
7
|
+
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space';
|
|
8
8
|
|
|
9
9
|
export const MasonryProps = Schema.Struct({
|
|
10
10
|
name: Schema.optional(Schema.String),
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/MasonryContainer/MasonryContainer.tsx", "../../../src/containers/MasonryContainer/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\nimport type * as Schema from 'effect/Schema';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { Surface, useCapabilities } from '@dxos/app-framework/ui';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { useObjectMenuItems } from '@dxos/app-toolkit/ui';\nimport { Annotation, Filter, Obj, Query, type Ref, Type } from '@dxos/echo';\nimport { type View } from '@dxos/echo';\nimport { useObject, useQuery } from '@dxos/react-client/echo';\nimport { Card, Panel, Toolbar } from '@dxos/react-ui';\nimport { Masonry as MasonryComponent } from '@dxos/react-ui-masonry';\nimport { Menu } from '@dxos/react-ui-menu';\nimport { SearchList, useSearchListResults } from '@dxos/react-ui-search';\nimport { getTagFromQuery, getTypenameFromQuery } from '@dxos/schema';\nimport { isNonNullable } from '@dxos/util';\n\nexport type MasonryContainerProps = {\n view: View.View;\n role?: string;\n};\n\nexport const MasonryContainer = ({\n view: viewOrRef,\n role: _role,\n}: {\n view: View.View | Ref.Ref<View.View>;\n role?: string;\n}) => {\n const [view] = useObject(viewOrRef);\n const schemas = useCapabilities(AppCapabilities.Schema);\n const db = view && Obj.getDatabase(view);\n const typename = view?.query ? getTypenameFromQuery(view.query.ast) : undefined;\n const tag = view?.query ? getTagFromQuery(view.query.ast) : undefined;\n\n const [cardSchema, setCardSchema] = useState<Schema.Schema.AnyNoContext>();\n\n useEffect(() => {\n const staticSchema = schemas.flat().find((schema) => Type.getTypename(schema) === typename);\n if (staticSchema) {\n setCardSchema(() => staticSchema);\n }\n if (!staticSchema && typename && db) {\n const query = db.schemaRegistry.query({ typename });\n const unsubscribe = query.subscribe(\n () => {\n const [schema] = query.results;\n if (schema) {\n setCardSchema(schema);\n }\n },\n { fire: true },\n );\n return unsubscribe;\n }\n }, [schemas, typename, db]);\n\n const query = useMemo(() => {\n const baseFilter = cardSchema ? Filter.type(cardSchema) : Filter.nothing();\n return tag ? Query.select(baseFilter).select(Filter.tag(tag)) : Query.select(baseFilter);\n }, [cardSchema, tag]);\n const objects = useQuery(db, query);\n\n const sortedObjects = useMemo(\n () =>\n objects.filter(isNonNullable).toSorted((a, b) => (Obj.getLabel(a) ?? '').localeCompare(Obj.getLabel(b) ?? '')),\n [objects],\n );\n\n const { results, handleSearch } = useSearchListResults({\n items: sortedObjects,\n extract: (obj) => Obj.getLabel(obj) ?? '',\n });\n\n return (\n <MasonryComponent.Root Tile={Item}>\n <SearchList.Root onSearch={handleSearch}>\n <Panel.Root>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <SearchList.Input placeholder='Search...' />\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <MasonryComponent.Content items={results} getId={(data: any) => data?.id} />\n </Panel.Content>\n </Panel.Root>\n </SearchList.Root>\n </MasonryComponent.Root>\n );\n};\n\nconst Item = ({ data }: { data: any }) => {\n const objectMenuItems = useObjectMenuItems(data);\n const icon = Function.pipe(\n Obj.getSchema(data),\n Option.fromNullable,\n Option.flatMap(Annotation.IconAnnotation.get),\n Option.map(({ icon }) => icon),\n Option.getOrElse(() => 'ph--placeholder--regular'),\n );\n\n return (\n <Menu.Root>\n <Card.Root>\n <Card.Toolbar>\n <Card.Icon icon={icon} />\n <Card.Title>{Obj.getLabel(data)}</Card.Title>\n {/* TODO(wittjosiah): Reconcile with Card.Menu. */}\n <Menu.Trigger asChild disabled={!objectMenuItems?.length}>\n <Toolbar.IconButton iconOnly variant='ghost' icon='ph--dots-three-vertical--regular' label='Actions' />\n </Menu.Trigger>\n <Menu.Content items={objectMenuItems} />\n </Card.Toolbar>\n <Surface.Surface role='card--content' limit={1} data={{ subject: data }} />\n </Card.Root>\n </Menu.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { MasonryContainer } from './MasonryContainer';\n\nexport default MasonryContainer;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,cAAc;AAC1B,YAAYC,YAAY;AAExB,OAAOC,SAASC,WAAWC,SAASC,gBAAgB;AAEpD,SAASC,SAASC,uBAAuB;AACzC,SAASC,uBAAuB;AAChC,SAASC,0BAA0B;AACnC,SAASC,YAAYC,QAAQC,KAAKC,OAAiBC,YAAY;AAE/D,SAASC,WAAWC,gBAAgB;AACpC,SAASC,MAAMC,OAAOC,eAAe;AACrC,SAASC,WAAWC,wBAAwB;AAC5C,SAASC,YAAY;AACrB,SAASC,YAAYC,4BAA4B;AACjD,SAASC,iBAAiBC,4BAA4B;AACtD,SAASC,qBAAqB;AAOvB,IAAMC,mBAAmB,CAAC,EAC/BC,MAAMC,WACNC,MAAMC,MAAK,MAIZ;AACC,QAAM,CAACH,IAAAA,IAAQI,UAAUH,SAAAA;AACzB,QAAMI,UAAUC,gBAAgBC,gBAAgBC,MAAM;AACtD,QAAMC,KAAKT,QAAQU,IAAIC,YAAYX,IAAAA;AACnC,QAAMY,WAAWZ,MAAMa,QAAQC,qBAAqBd,KAAKa,MAAME,GAAG,IAAIC;AACtE,QAAMC,MAAMjB,MAAMa,QAAQK,gBAAgBlB,KAAKa,MAAME,GAAG,IAAIC;AAE5D,QAAM,CAACG,YAAYC,aAAAA,IAAiBC,SAAAA;AAEpCC,YAAU,MAAA;AACR,UAAMC,eAAelB,QAAQmB,KAAI,EAAGC,KAAK,CAACC,WAAWC,KAAKC,YAAYF,MAAAA,MAAYd,QAAAA;AAClF,QAAIW,cAAc;AAChBH,oBAAc,MAAMG,YAAAA;IACtB;AACA,QAAI,CAACA,gBAAgBX,YAAYH,IAAI;AACnC,YAAMI,SAAQJ,GAAGoB,eAAehB,MAAM;QAAED;MAAS,CAAA;AACjD,YAAMkB,cAAcjB,OAAMkB,UACxB,MAAA;AACE,cAAM,CAACL,MAAAA,IAAUb,OAAMmB;AACvB,YAAIN,QAAQ;AACVN,wBAAcM,MAAAA;QAChB;MACF,GACA;QAAEO,MAAM;MAAK,CAAA;AAEf,aAAOH;IACT;EACF,GAAG;IAACzB;IAASO;IAAUH;GAAG;AAE1B,QAAMI,QAAQqB,QAAQ,MAAA;AACpB,UAAMC,aAAahB,aAAaiB,OAAOC,KAAKlB,UAAAA,IAAciB,OAAOE,QAAO;AACxE,WAAOrB,MAAMsB,MAAMC,OAAOL,UAAAA,EAAYK,OAAOJ,OAAOnB,IAAIA,GAAAA,CAAAA,IAAQsB,MAAMC,OAAOL,UAAAA;EAC/E,GAAG;IAAChB;IAAYF;GAAI;AACpB,QAAMwB,UAAUC,SAASjC,IAAII,KAAAA;AAE7B,QAAM8B,gBAAgBT,QACpB,MACEO,QAAQG,OAAOC,aAAAA,EAAeC,SAAS,CAACC,GAAGC,OAAOtC,IAAIuC,SAASF,CAAAA,KAAM,IAAIG,cAAcxC,IAAIuC,SAASD,CAAAA,KAAM,EAAA,CAAA,GAC5G;IAACP;GAAQ;AAGX,QAAM,EAAET,SAASmB,aAAY,IAAKC,qBAAqB;IACrDC,OAAOV;IACPW,SAAS,CAACC,QAAQ7C,IAAIuC,SAASM,GAAAA,KAAQ;EACzC,CAAA;AAEA,SACE,sBAAA,cAACC,iBAAiBC,MAAI;IAACC,MAAMC;KAC3B,sBAAA,cAACC,WAAWH,MAAI;IAACI,UAAUV;KACzB,sBAAA,cAACW,MAAML,MAAI,MACT,sBAAA,cAACK,MAAMC,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACD,QAAQN,MAAI,MACX,sBAAA,cAACG,WAAWK,OAAK;IAACC,aAAY;QAGlC,sBAAA,cAACJ,MAAMK,SAAO,MACZ,sBAAA,cAACX,iBAAiBW,SAAO;IAACd,OAAOrB;IAASoC,OAAO,CAACC,SAAcA,MAAMC;;AAMlF;AAEA,IAAMX,OAAO,CAAC,EAAEU,KAAI,MAAiB;AACnC,QAAME,kBAAkBC,mBAAmBH,IAAAA;AAC3C,QAAMI,OAAgBC,cACpBhE,IAAIiE,UAAUN,IAAAA,GACPO,qBACAC,eAAQC,WAAWC,eAAeC,GAAG,GACrCC,WAAI,CAAC,EAAER,MAAAA,MAAI,MAAOA,KAAAA,GAClBS,iBAAU,MAAM,0BAAA,CAAA;AAGzB,SACE,sBAAA,cAACC,KAAK1B,MAAI,MACR,sBAAA,cAAC2B,KAAK3B,MAAI,MACR,sBAAA,cAAC2B,KAAKrB,SAAO,MACX,sBAAA,cAACqB,KAAKC,MAAI;IAACZ;MACX,sBAAA,cAACW,KAAKE,OAAK,MAAE5E,IAAIuC,SAASoB,IAAAA,CAAAA,GAE1B,sBAAA,cAACc,KAAKI,SAAO;IAACvB,SAAAA;IAAQwB,UAAU,CAACjB,iBAAiBkB;KAChD,sBAAA,cAAC1B,QAAQ2B,YAAU;IAACC,UAAAA;IAASC,SAAQ;IAAQnB,MAAK;IAAmCoB,OAAM;OAE7F,sBAAA,cAACV,KAAKhB,SAAO;IAACd,OAAOkB;OAEvB,sBAAA,cAACuB,QAAQA,SAAO;IAAC5F,MAAK;IAAgB6F,OAAO;IAAG1B,MAAM;MAAE2B,SAAS3B;IAAK;;AAI9E;;;ACrHA,IAAA,2BAAe4B;",
|
|
6
|
-
"names": ["Function", "Option", "React", "useEffect", "useMemo", "useState", "Surface", "useCapabilities", "AppCapabilities", "useObjectMenuItems", "Annotation", "Filter", "Obj", "Query", "Type", "useObject", "useQuery", "Card", "Panel", "Toolbar", "Masonry", "MasonryComponent", "Menu", "SearchList", "useSearchListResults", "getTagFromQuery", "getTypenameFromQuery", "isNonNullable", "MasonryContainer", "view", "viewOrRef", "role", "_role", "useObject", "schemas", "useCapabilities", "AppCapabilities", "Schema", "db", "Obj", "getDatabase", "typename", "query", "getTypenameFromQuery", "ast", "undefined", "tag", "getTagFromQuery", "cardSchema", "setCardSchema", "useState", "useEffect", "staticSchema", "flat", "find", "schema", "Type", "getTypename", "schemaRegistry", "unsubscribe", "subscribe", "results", "fire", "useMemo", "baseFilter", "Filter", "type", "nothing", "Query", "select", "objects", "useQuery", "sortedObjects", "filter", "isNonNullable", "toSorted", "a", "b", "getLabel", "localeCompare", "handleSearch", "useSearchListResults", "items", "extract", "obj", "MasonryComponent", "Root", "Tile", "Item", "SearchList", "onSearch", "Panel", "Toolbar", "asChild", "Input", "placeholder", "Content", "getId", "data", "id", "objectMenuItems", "useObjectMenuItems", "icon", "pipe", "getSchema", "fromNullable", "flatMap", "Annotation", "IconAnnotation", "get", "map", "getOrElse", "Menu", "Card", "Icon", "Title", "Trigger", "disabled", "length", "IconButton", "iconOnly", "variant", "label", "Surface", "limit", "subject", "MasonryContainer"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.masonry',\n name: 'Masonry',\n description: trim`\n Responsive grid layout that displays query results in an adaptive masonry pattern.\n Visualize collections of cards, images, or mixed content that automatically adjusts to available screen space.\n `,\n icon: 'ph--wall--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-masonry',\n screenshots: [],\n};\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa,CAAA;AACf;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Masonry.ts", "../../../src/types/MasonryAction.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport const Masonry = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n arrangement: Schema.Array(\n Schema.Struct({\n ids: Schema.Array(Obj.ID),\n hidden: Schema.optional(Schema.Boolean),\n }),\n ).pipe(FormInputAnnotation.set(false), Schema.optional),\n // TODO(wittjosiah): Consider Masonry supporting not being just a view but referencing arbitrary data directly.\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.masonry',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--wall--regular',\n hue: 'green',\n }),\n);\n\nexport interface Masonry extends Schema.Schema.Type<typeof Masonry> {}\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Masonry>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a masonry as a view of a data set.\n */\nexport const make = ({ name, arrangement = [], view }: MakeProps): Masonry => {\n return Obj.make(Masonry, { name, view: Ref.make(view), arrangement });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\n\nexport const MasonryProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select card type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n }),\n Schema.optional,\n ),\n});\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,KAAKC,KAAKC,YAAY;AAC3C,SAASC,YAAY;AACrB,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,sBAAsB;AAExB,IAAMC,UAAiBC,cAAO;EACnCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEJ,KAAKK,oBAAoBC,IAAI,KAAA,CAAA;EAEtDC,aAAoBC,aACXX,cAAO;IACZY,KAAYD,aAAME,IAAIC,EAAE;IACxBC,QAAeX,gBAAgBY,cAAO;EACxC,CAAA,CAAA,EACAb,KAAKK,oBAAoBC,IAAI,KAAA,GAAeL,eAAQ;AAExD,CAAA,EAAGD,KACDc,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBZ,IAAI;EAAC;CAAO,GAC5Ba,eAAeb,IAAI,IAAA,GACnBc,WAAWC,eAAef,IAAI;EAC5BgB,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAYK,IAAMC,OAAO,CAAC,EAAE1B,MAAMS,cAAc,CAAA,GAAIL,KAAI,MAAa;AAC9D,SAAOQ,IAAIc,KAAK5B,SAAS;IAAEE;IAAMI,MAAMC,IAAIqB,KAAKtB,IAAAA;IAAOK;EAAY,CAAA;AACrE;;;AC/CA;;;;AAIA,YAAYkB,aAAY;AAExB,SAASC,kCAAkC;AAEpC,IAAMC,eAAsBC,eAAO;EACxCC,MAAaC,iBAAgBC,cAAM;;EAEnCC,UAAiBD,eAAOE,KACfC,oBAAY;IAAEC,OAAO;EAAmB,CAAA,GAC/CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;EACT,CAAA,GACOT,gBAAQ;AAEnB,CAAA;",
|
|
6
|
-
"names": ["Schema", "Annotation", "Obj", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Masonry", "Struct", "name", "String", "pipe", "optional", "view", "Ref", "View", "FormInputAnnotation", "set", "arrangement", "Array", "ids", "Obj", "ID", "hidden", "Boolean", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "make", "Schema", "TypeInputOptionsAnnotation", "MasonryProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind"]
|
|
7
|
-
}
|