@dxos/plugin-masonry 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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/dist/lib/browser/{chunk-2QCFP5QL.mjs → chunk-S5JKAK4O.mjs} +3 -3
- package/dist/lib/browser/chunk-S5JKAK4O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-BNMIVM2K.mjs → react-surface-QKCNQ7HF.mjs} +11 -10
- package/dist/lib/browser/react-surface-QKCNQ7HF.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-6SGZVU7G.mjs → chunk-YNA44I6R.mjs} +3 -3
- package/dist/lib/node-esm/chunk-YNA44I6R.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +10 -9
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-OK33CG7H.mjs → react-surface-XG56AMA7.mjs} +11 -10
- package/dist/lib/node-esm/react-surface-XG56AMA7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/MasonryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/MasonryContainer.d.ts +1 -1
- package/dist/types/src/components/MasonryContainer.d.ts.map +1 -1
- package/dist/types/src/types/Masonry.d.ts +6 -6
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -27
- package/src/MasonryPlugin.tsx +6 -5
- package/src/capabilities/react-surface/react-surface.tsx +4 -3
- package/src/components/MasonryContainer.stories.tsx +1 -1
- package/src/components/MasonryContainer.tsx +5 -5
- package/src/types/Masonry.ts +4 -4
- package/dist/lib/browser/chunk-2QCFP5QL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BNMIVM2K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6SGZVU7G.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-OK33CG7H.mjs.map +0 -7
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.2244d791bb",
|
|
4
4
|
"description": "Masonry DXOS Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -39,43 +39,44 @@
|
|
|
39
39
|
"src"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/plugin-search": "0.8.4-main.
|
|
48
|
-
"@dxos/plugin-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/react-
|
|
51
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
42
|
+
"@dxos/app-framework": "0.8.4-main.2244d791bb",
|
|
43
|
+
"@dxos/effect": "0.8.4-main.2244d791bb",
|
|
44
|
+
"@dxos/echo": "0.8.4-main.2244d791bb",
|
|
45
|
+
"@dxos/app-toolkit": "0.8.4-main.2244d791bb",
|
|
46
|
+
"@dxos/operation": "0.8.4-main.2244d791bb",
|
|
47
|
+
"@dxos/plugin-search": "0.8.4-main.2244d791bb",
|
|
48
|
+
"@dxos/plugin-client": "0.8.4-main.2244d791bb",
|
|
49
|
+
"@dxos/plugin-space": "0.8.4-main.2244d791bb",
|
|
50
|
+
"@dxos/react-client": "0.8.4-main.2244d791bb",
|
|
51
|
+
"@dxos/react-ui": "0.8.4-main.2244d791bb",
|
|
52
|
+
"@dxos/react-ui-stack": "0.8.4-main.2244d791bb",
|
|
53
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.2244d791bb",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.4-main.2244d791bb",
|
|
55
|
+
"@dxos/schema": "0.8.4-main.2244d791bb",
|
|
56
|
+
"@dxos/types": "0.8.4-main.2244d791bb",
|
|
57
|
+
"@dxos/util": "0.8.4-main.2244d791bb",
|
|
58
|
+
"@dxos/react-ui-masonry": "0.8.4-main.2244d791bb"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@types/react": "~19.2.7",
|
|
61
62
|
"@types/react-dom": "~19.2.3",
|
|
62
|
-
"effect": "3.19.
|
|
63
|
+
"effect": "3.19.16",
|
|
63
64
|
"react": "~19.2.3",
|
|
64
65
|
"react-dom": "~19.2.3",
|
|
65
66
|
"vite": "7.1.9",
|
|
66
|
-
"@dxos/plugin-
|
|
67
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
68
|
-
"@dxos/random": "0.8.4-main.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
67
|
+
"@dxos/plugin-testing": "0.8.4-main.2244d791bb",
|
|
68
|
+
"@dxos/plugin-theme": "0.8.4-main.2244d791bb",
|
|
69
|
+
"@dxos/random": "0.8.4-main.2244d791bb",
|
|
70
|
+
"@dxos/plugin-preview": "0.8.4-main.2244d791bb",
|
|
71
|
+
"@dxos/ui-theme": "0.8.4-main.2244d791bb",
|
|
72
|
+
"@dxos/storybook-utils": "0.8.4-main.2244d791bb"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"effect": "3.19.
|
|
75
|
+
"effect": "3.19.16",
|
|
75
76
|
"react": "~19.2.3",
|
|
76
77
|
"react-dom": "~19.2.3",
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/ui
|
|
78
|
+
"@dxos/ui-theme": "0.8.4-main.2244d791bb",
|
|
79
|
+
"@dxos/react-ui": "0.8.4-main.2244d791bb"
|
|
79
80
|
},
|
|
80
81
|
"publishConfig": {
|
|
81
82
|
"access": "public"
|
package/src/MasonryPlugin.tsx
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
8
9
|
import { Type } from '@dxos/echo';
|
|
9
10
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
10
11
|
import { View } from '@dxos/schema';
|
|
@@ -15,9 +16,7 @@ import { translations } from './translations';
|
|
|
15
16
|
import { Masonry, MasonryAction } from './types';
|
|
16
17
|
|
|
17
18
|
export const MasonryPlugin = Plugin.define(meta).pipe(
|
|
18
|
-
|
|
19
|
-
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
20
|
-
Common.Plugin.addMetadataModule({
|
|
19
|
+
AppPlugin.addMetadataModule({
|
|
21
20
|
metadata: {
|
|
22
21
|
id: Type.getTypename(Masonry.Masonry),
|
|
23
22
|
metadata: {
|
|
@@ -32,6 +31,8 @@ export const MasonryPlugin = Plugin.define(meta).pipe(
|
|
|
32
31
|
},
|
|
33
32
|
},
|
|
34
33
|
}),
|
|
35
|
-
|
|
34
|
+
AppPlugin.addSchemaModule({ schema: [Masonry.Masonry] }),
|
|
35
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
36
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
36
37
|
Plugin.make,
|
|
37
38
|
);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
10
11
|
import { View } from '@dxos/schema';
|
|
11
12
|
|
|
@@ -15,8 +16,8 @@ import { Masonry } from '../../types';
|
|
|
15
16
|
|
|
16
17
|
export default Capability.makeModule(() =>
|
|
17
18
|
Effect.succeed(
|
|
18
|
-
Capability.contributes(
|
|
19
|
-
|
|
19
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
20
|
+
Surface.create({
|
|
20
21
|
id: meta.id,
|
|
21
22
|
role: ['article', 'section'],
|
|
22
23
|
filter: (data): data is { subject: Masonry.Masonry | View.View } =>
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Surface, useCapabilities } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
10
|
import { Filter, Obj, type Ref, Type } from '@dxos/echo';
|
|
11
11
|
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
12
12
|
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
@@ -21,13 +21,13 @@ export type MasonryContainerProps = {
|
|
|
21
21
|
|
|
22
22
|
export const MasonryContainer = ({
|
|
23
23
|
view: viewOrRef,
|
|
24
|
-
role,
|
|
24
|
+
role: _role,
|
|
25
25
|
}: {
|
|
26
26
|
view: View.View | Ref.Ref<View.View>;
|
|
27
27
|
role?: string;
|
|
28
28
|
}) => {
|
|
29
29
|
const [view] = useObject(viewOrRef);
|
|
30
|
-
const schemas = useCapabilities(
|
|
30
|
+
const schemas = useCapabilities(AppCapabilities.Schema);
|
|
31
31
|
const db = view && Obj.getDatabase(view);
|
|
32
32
|
const typename = view?.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
33
33
|
|
|
@@ -73,7 +73,7 @@ const Item = ({ data }: { data: any }) => {
|
|
|
73
73
|
<Card.Title>{Obj.getLabel(data)}</Card.Title>
|
|
74
74
|
<Card.Menu />
|
|
75
75
|
</Card.Toolbar>
|
|
76
|
-
<Surface role='card--content' limit={1} data={{ subject: data }} />
|
|
76
|
+
<Surface.Surface role='card--content' limit={1} data={{ subject: data }} />
|
|
77
77
|
</Card.Root>
|
|
78
78
|
);
|
|
79
79
|
};
|
package/src/types/Masonry.ts
CHANGED
|
@@ -17,8 +17,8 @@ export const Masonry = Schema.Struct({
|
|
|
17
17
|
Schema.Struct({
|
|
18
18
|
ids: Schema.Array(Obj.ID),
|
|
19
19
|
hidden: Schema.optional(Schema.Boolean),
|
|
20
|
-
})
|
|
21
|
-
).pipe(
|
|
20
|
+
}),
|
|
21
|
+
).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
22
22
|
// TODO(wittjosiah): Consider Masonry supporting not being just a view but referencing arbitrary data directly.
|
|
23
23
|
}).pipe(
|
|
24
24
|
Type.object({
|
|
@@ -51,8 +51,8 @@ export const MasonryV1 = Schema.Struct({
|
|
|
51
51
|
Schema.Struct({
|
|
52
52
|
ids: Schema.Array(Obj.ID),
|
|
53
53
|
hidden: Schema.optional(Schema.Boolean),
|
|
54
|
-
})
|
|
55
|
-
).pipe(Schema.
|
|
54
|
+
}),
|
|
55
|
+
).pipe(Schema.optional),
|
|
56
56
|
}).pipe(
|
|
57
57
|
Type.object({
|
|
58
58
|
typename: 'dxos.org/type/Masonry',
|
|
@@ -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 { Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nexport const Masonry = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Type.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 }).pipe(Schema.mutable),\n ).pipe(Schema.mutable, 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: 'dxos.org/type/Masonry',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\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//\n// V1\n//\n\nexport const MasonryV1 = Schema.Struct({\n arrangement: Schema.Array(\n Schema.Struct({\n ids: Schema.Array(Obj.ID),\n hidden: Schema.optional(Schema.Boolean),\n }).pipe(Schema.mutable),\n ).pipe(Schema.mutable, Schema.optional),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Masonry',\n version: '0.1.0',\n }),\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 registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAA;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,KAAKC,YAAY;AAC/B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAE9B,IAAMC,UAAiBC,cAAO;EACnCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEL,KAAKM,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,aAAoBC,aACXZ,cAAO;IACZa,KAAYD,aAAME,IAAIC,EAAE;IACxBC,QAAeZ,gBAAgBa,cAAO;EACxC,CAAA,EAAGd,KAAYe,cAAO,CAAA,EACtBf,KAAYe,gBAAST,oBAAoBC,IAAI,KAAA,GAAeN,eAAQ;AAExE,CAAA,EAAGD,KACDG,KAAKa,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBZ,IAAI;EAAC;CAAO,GAC5Ba,eAAeb,IAAI,IAAA,CAAA;AAYd,IAAMc,OAAO,CAAC,EAAEvB,MAAMU,cAAc,CAAA,GAAIN,KAAI,MAAa;AAC9D,SAAOS,IAAIU,KAAKzB,SAAS;IAAEE;IAAMI,MAAME,IAAIiB,KAAKnB,IAAAA;IAAOM;EAAY,CAAA;AACrE;AAMO,IAAMc,YAAmBzB,cAAO;EACrCW,aAAoBC,aACXZ,cAAO;IACZa,KAAYD,aAAME,IAAIC,EAAE;IACxBC,QAAeZ,gBAAgBa,cAAO;EACxC,CAAA,EAAGd,KAAYe,cAAO,CAAA,EACtBf,KAAYe,gBAAgBd,eAAQ;AACxC,CAAA,EAAGD,KACDG,KAAKa,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;;;AC3DF;;;;AAIA,YAAYK,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;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,gBAAQ;AAEnB,CAAA;",
|
|
6
|
-
"names": ["Schema", "Obj", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "Masonry", "Struct", "name", "String", "pipe", "optional", "view", "Type", "Ref", "View", "FormInputAnnotation", "set", "arrangement", "Array", "ids", "Obj", "ID", "hidden", "Boolean", "mutable", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "make", "MasonryV1", "Schema", "TypeInputOptionsAnnotation", "MasonryProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx", "../../../src/components/MasonryContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { View } from '@dxos/schema';\n\nimport { MasonryContainer } from '../../components/MasonryContainer';\nimport { meta } from '../../meta';\nimport { Masonry } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: meta.id,\n role: ['article', 'section'],\n filter: (data): data is { subject: Masonry.Masonry | View.View } =>\n Obj.instanceOf(Masonry.Masonry, data.subject) || Obj.instanceOf(View.View, data.subject),\n component: ({ data, role }) => {\n const view = Obj.instanceOf(View.View, data.subject) ? data.subject : data.subject.view;\n return <MasonryContainer view={view} role={role} />;\n },\n }),\n ]),\n ),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\nimport React, { useEffect, useState } from 'react';\n\nimport { Common } from '@dxos/app-framework';\nimport { Surface, useCapabilities } from '@dxos/app-framework/react';\nimport { Filter, Obj, type Ref, Type } from '@dxos/echo';\nimport { useGlobalFilteredObjects } from '@dxos/plugin-search';\nimport { useObject, useQuery } from '@dxos/react-client/echo';\nimport { Masonry as MasonryComponent } from '@dxos/react-ui-masonry';\nimport { Card } from '@dxos/react-ui-mosaic';\nimport { type View, getTypenameFromQuery } from '@dxos/schema';\n\nexport type MasonryContainerProps = {\n view: View.View;\n role?: string;\n};\n\nexport const MasonryContainer = ({\n view: viewOrRef,\n role,\n}: {\n view: View.View | Ref.Ref<View.View>;\n role?: string;\n}) => {\n const [view] = useObject(viewOrRef);\n const schemas = useCapabilities(Common.Capability.Schema);\n const db = view && Obj.getDatabase(view);\n const typename = view?.query ? getTypenameFromQuery(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 objects = useQuery(db, cardSchema ? Filter.type(cardSchema) : Filter.nothing());\n const filteredObjects = useGlobalFilteredObjects(objects);\n\n return (\n <MasonryComponent.Root\n items={filteredObjects}\n render={Item as any}\n classNames='is-full max-is-full bs-full max-bs-full overflow-y-auto p-4'\n />\n );\n};\n\nconst Item = ({ data }: { data: any }) => {\n return (\n <Card.Root>\n <Card.Toolbar>\n <span />\n <Card.Title>{Obj.getLabel(data)}</Card.Title>\n <Card.Menu />\n </Card.Toolbar>\n <Surface role='card--content' limit={1} data={{ subject: data }} />\n </Card.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,YAAW;AAElB,SAASC,YAAYC,UAAAA,eAAc;AACnC,SAASC,OAAAA,YAAW;AACpB,SAASC,YAAY;;;ACJrB,OAAOC,SAASC,WAAWC,gBAAgB;AAE3C,SAASC,cAAc;AACvB,SAASC,SAASC,uBAAuB;AACzC,SAASC,QAAQC,KAAeC,YAAY;AAC5C,SAASC,gCAAgC;AACzC,SAASC,WAAWC,gBAAgB;AACpC,SAASC,WAAWC,wBAAwB;AAC5C,SAASC,YAAY;AACrB,SAAoBC,4BAA4B;AAOzC,IAAMC,mBAAmB,CAAC,EAC/BC,MAAMC,WACNC,KAAI,MAIL;AACC,QAAM,CAACF,IAAAA,IAAQG,UAAUF,SAAAA;AACzB,QAAMG,UAAUC,gBAAgBC,OAAOC,WAAWC,MAAM;AACxD,QAAMC,KAAKT,QAAQU,IAAIC,YAAYX,IAAAA;AACnC,QAAMY,WAAWZ,MAAMa,QAAQC,qBAAqBd,KAAKa,MAAME,GAAG,IAAIC;AAEtE,QAAM,CAACC,YAAYC,aAAAA,IAAiBC,SAAAA;AAEpCC,YAAU,MAAA;AACR,UAAMC,eAAejB,QAAQkB,KAAI,EAAGC,KAAK,CAACC,WAAWC,KAAKC,YAAYF,MAAAA,MAAYZ,QAAAA;AAClF,QAAIS,cAAc;AAChBH,oBAAc,MAAMG,YAAAA;IACtB;AACA,QAAI,CAACA,gBAAgBT,YAAYH,IAAI;AACnC,YAAMI,QAAQJ,GAAGkB,eAAed,MAAM;QAAED;MAAS,CAAA;AACjD,YAAMgB,cAAcf,MAAMgB,UACxB,MAAA;AACE,cAAM,CAACL,MAAAA,IAAUX,MAAMiB;AACvB,YAAIN,QAAQ;AACVN,wBAAcM,MAAAA;QAChB;MACF,GACA;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ect", "useState", "Common", "Surface", "useCapabilities", "Filter", "Obj", "Type", "useGlobalFilteredObjects", "useObject", "useQuery", "Masonry", "MasonryComponent", "Card", "getTypenameFromQuery", "MasonryContainer", "view", "viewOrRef", "role", "useObject", "schemas", "useCapabilities", "Common", "Capability", "Schema", "db", "Obj", "getDatabase", "typename", "query", "getTypenameFromQuery", "ast", "undefined", "cardSchema", "setCardSchema", "useState", "useEffect", "staticSchema", "flat", "find", "schema", "Type", "getTypename", "schemaRegistry", "unsubscribe", "subscribe", "results", "fire", "objects", "useQuery", "Filter", "type", "nothing", "filteredObjects", "useGlobalFilteredObjects", "MasonryComponent", "Root", "items", "render", "Item", "classNames", "data", "Card", "Toolbar", "span", "Title", "getLabel", "Menu", "Surface", "limit", "subject", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Masonry", "subject", "View", "component", "view", "React", "MasonryContainer"]
|
|
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 { Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nexport const Masonry = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Type.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 }).pipe(Schema.mutable),\n ).pipe(Schema.mutable, 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: 'dxos.org/type/Masonry',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\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//\n// V1\n//\n\nexport const MasonryV1 = Schema.Struct({\n arrangement: Schema.Array(\n Schema.Struct({\n ids: Schema.Array(Obj.ID),\n hidden: Schema.optional(Schema.Boolean),\n }).pipe(Schema.mutable),\n ).pipe(Schema.mutable, Schema.optional),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Masonry',\n version: '0.1.0',\n }),\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 registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,KAAKC,YAAY;AAC/B,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAE9B,IAAMC,UAAiBC,cAAO;EACnCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEL,KAAKM,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,aAAoBC,aACXZ,cAAO;IACZa,KAAYD,aAAME,IAAIC,EAAE;IACxBC,QAAeZ,gBAAgBa,cAAO;EACxC,CAAA,EAAGd,KAAYe,cAAO,CAAA,EACtBf,KAAYe,gBAAST,oBAAoBC,IAAI,KAAA,GAAeN,eAAQ;AAExE,CAAA,EAAGD,KACDG,KAAKa,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBZ,IAAI;EAAC;CAAO,GAC5Ba,eAAeb,IAAI,IAAA,CAAA;AAYd,IAAMc,OAAO,CAAC,EAAEvB,MAAMU,cAAc,CAAA,GAAIN,KAAI,MAAa;AAC9D,SAAOS,IAAIU,KAAKzB,SAAS;IAAEE;IAAMI,MAAME,IAAIiB,KAAKnB,IAAAA;IAAOM;EAAY,CAAA;AACrE;AAMO,IAAMc,YAAmBzB,cAAO;EACrCW,aAAoBC,aACXZ,cAAO;IACZa,KAAYD,aAAME,IAAIC,EAAE;IACxBC,QAAeZ,gBAAgBa,cAAO;EACxC,CAAA,EAAGd,KAAYe,cAAO,CAAA,EACtBf,KAAYe,gBAAgBd,eAAQ;AACxC,CAAA,EAAGD,KACDG,KAAKa,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;;;AC3DF;;;;AAIA,YAAYK,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;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,gBAAQ;AAEnB,CAAA;",
|
|
6
|
-
"names": ["Schema", "Obj", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "Masonry", "Struct", "name", "String", "pipe", "optional", "view", "Type", "Ref", "View", "FormInputAnnotation", "set", "arrangement", "Array", "ids", "Obj", "ID", "hidden", "Boolean", "mutable", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "make", "MasonryV1", "Schema", "TypeInputOptionsAnnotation", "MasonryProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx", "../../../src/components/MasonryContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { View } from '@dxos/schema';\n\nimport { MasonryContainer } from '../../components/MasonryContainer';\nimport { meta } from '../../meta';\nimport { Masonry } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: meta.id,\n role: ['article', 'section'],\n filter: (data): data is { subject: Masonry.Masonry | View.View } =>\n Obj.instanceOf(Masonry.Masonry, data.subject) || Obj.instanceOf(View.View, data.subject),\n component: ({ data, role }) => {\n const view = Obj.instanceOf(View.View, data.subject) ? data.subject : data.subject.view;\n return <MasonryContainer view={view} role={role} />;\n },\n }),\n ]),\n ),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\nimport React, { useEffect, useState } from 'react';\n\nimport { Common } from '@dxos/app-framework';\nimport { Surface, useCapabilities } from '@dxos/app-framework/react';\nimport { Filter, Obj, type Ref, Type } from '@dxos/echo';\nimport { useGlobalFilteredObjects } from '@dxos/plugin-search';\nimport { useObject, useQuery } from '@dxos/react-client/echo';\nimport { Masonry as MasonryComponent } from '@dxos/react-ui-masonry';\nimport { Card } from '@dxos/react-ui-mosaic';\nimport { type View, getTypenameFromQuery } from '@dxos/schema';\n\nexport type MasonryContainerProps = {\n view: View.View;\n role?: string;\n};\n\nexport const MasonryContainer = ({\n view: viewOrRef,\n role,\n}: {\n view: View.View | Ref.Ref<View.View>;\n role?: string;\n}) => {\n const [view] = useObject(viewOrRef);\n const schemas = useCapabilities(Common.Capability.Schema);\n const db = view && Obj.getDatabase(view);\n const typename = view?.query ? getTypenameFromQuery(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 objects = useQuery(db, cardSchema ? Filter.type(cardSchema) : Filter.nothing());\n const filteredObjects = useGlobalFilteredObjects(objects);\n\n return (\n <MasonryComponent.Root\n items={filteredObjects}\n render={Item as any}\n classNames='is-full max-is-full bs-full max-bs-full overflow-y-auto p-4'\n />\n );\n};\n\nconst Item = ({ data }: { data: any }) => {\n return (\n <Card.Root>\n <Card.Toolbar>\n <span />\n <Card.Title>{Obj.getLabel(data)}</Card.Title>\n <Card.Menu />\n </Card.Toolbar>\n <Surface role='card--content' limit={1} data={{ subject: data }} />\n </Card.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,YAAW;AAElB,SAASC,YAAYC,UAAAA,eAAc;AACnC,SAASC,OAAAA,YAAW;AACpB,SAASC,YAAY;;;ACJrB,OAAOC,SAASC,WAAWC,gBAAgB;AAE3C,SAASC,cAAc;AACvB,SAASC,SAASC,uBAAuB;AACzC,SAASC,QAAQC,KAAeC,YAAY;AAC5C,SAASC,gCAAgC;AACzC,SAASC,WAAWC,gBAAgB;AACpC,SAASC,WAAWC,wBAAwB;AAC5C,SAASC,YAAY;AACrB,SA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KG,OAAK,MAAEvC,IAAIwC,SAASL,IAAAA,CAAAA,GAC1B,sBAAA,cAACC,KAAKK,MAAI,IAAA,CAAA,GAEZ,sBAAA,cAACC,SAAAA;IAAQlD,MAAK;IAAgBmD,OAAO;IAAGR,MAAM;MAAES,SAAST;IAAK;;AAGpE;;;AD/DA,IAAA,wBAAeU,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,QAAOJ,WAAWK,cAAc;EACrDD,QAAOE,cAAc;IACnBC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,SACPC,KAAIC,WAAWC,gBAAQA,SAASH,KAAKI,OAAO,KAAKH,KAAIC,WAAWG,KAAKA,MAAML,KAAKI,OAAO;IACzFE,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAE;AACxB,YAAMS,OAAON,KAAIC,WAAWG,KAAKA,MAAML,KAAKI,OAAO,IAAIJ,KAAKI,UAAUJ,KAAKI,QAAQG;AACnF,aAAO,gBAAAC,OAAA,cAACC,kBAAAA;QAAiBF;QAAYT;;IACvC;EACF,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capability", "Common", "Obj", "View", "React", "useEffect", "useState", "Common", "Surface", "useCapabilities", "Filter", "Obj", "Type", "useGlobalFilteredObjects", "useObject", "useQuery", "Masonry", "MasonryComponent", "Card", "getTypenameFromQuery", "MasonryContainer", "view", "viewOrRef", "role", "useObject", "schemas", "useCapabilities", "Common", "Capability", "Schema", "db", "Obj", "getDatabase", "typename", "query", "getTypenameFromQuery", "ast", "undefined", "cardSchema", "setCardSchema", "useState", "useEffect", "staticSchema", "flat", "find", "schema", "Type", "getTypename", "schemaRegistry", "unsubscribe", "subscribe", "results", "fire", "objects", "useQuery", "Filter", "type", "nothing", "filteredObjects", "useGlobalFilteredObjects", "MasonryComponent", "Root", "items", "render", "Item", "classNames", "data", "Card", "Toolbar", "span", "Title", "getLabel", "Menu", "Surface", "limit", "subject", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Masonry", "subject", "View", "component", "view", "React", "MasonryContainer"]
|
|
7
|
-
}
|