@dxos/plugin-preview 0.8.2-main.2f9c567 → 0.8.2-main.36232bc
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/index.mjs +31 -53
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +31 -55
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +31 -53
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/Preview.stories.d.ts +11 -17
- package/dist/types/src/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ContactCard.d.ts +3 -3
- package/dist/types/src/components/ContactCard.d.ts.map +1 -1
- package/dist/types/src/components/OrganizationCard.d.ts +2 -2
- package/dist/types/src/components/OrganizationCard.d.ts.map +1 -1
- package/dist/types/src/components/ProjectCard.d.ts +2 -2
- package/dist/types/src/components/ProjectCard.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +20 -21
- package/src/Preview.stories.tsx +4 -10
- package/src/PreviewPlugin.tsx +22 -31
- package/src/components/ContactCard.tsx +4 -5
- package/src/components/OrganizationCard.tsx +5 -6
- package/src/components/ProjectCard.tsx +4 -8
- package/src/types.ts +1 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1296,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1296,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":3274,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytes":9227,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytes":5532,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytes":2743,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/index.ts":{"bytes":732,"imports":[{"path":"packages/plugins/plugin-preview/src/components/ContactCard.tsx","kind":"import-statement","original":"./ContactCard"},{"path":"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx","kind":"import-statement","original":"./OrganizationCard"},{"path":"packages/plugins/plugin-preview/src/components/ProjectCard.tsx","kind":"import-statement","original":"./ProjectCard"}],"format":"esm"},"packages/plugins/plugin-preview/src/translations.ts":{"bytes":1091,"imports":[{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytes":27057,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"@dxos/react-ui-table","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-preview/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-preview/src/index.ts":{"bytes":681,"imports":[{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/plugin-preview/src/PreviewPlugin.tsx","kind":"import-statement","original":"./PreviewPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-preview/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24138},"packages/plugins/plugin-preview/dist/lib/node-esm/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"@dxos/react-ui-table","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["PREVIEW_PLUGIN","PreviewPlugin","meta","previewCard","previewChrome","previewProse","previewTitle"],"entryPoint":"packages/plugins/plugin-preview/src/index.ts","inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytesInOutput":216},"packages/plugins/plugin-preview/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/types.ts":{"bytesInOutput":266},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytesInOutput":6691},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytesInOutput":2668},"packages/plugins/plugin-preview/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytesInOutput":1584},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytesInOutput":633},"packages/plugins/plugin-preview/src/translations.ts":{"bytesInOutput":152}},"bytes":12930}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
2
|
import { type Meta } from '@storybook/react';
|
|
3
3
|
import React, { type FC } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Contact, Organization, Project } from '@dxos/schema';
|
|
5
5
|
type StoryProps = {
|
|
6
6
|
Component: FC<{
|
|
7
7
|
subject: any;
|
|
@@ -13,8 +13,8 @@ declare const meta: Meta<StoryProps>;
|
|
|
13
13
|
export default meta;
|
|
14
14
|
export declare const ContactWithImage: {
|
|
15
15
|
args: {
|
|
16
|
-
Component: ({ children, classNames,
|
|
17
|
-
onOrgClick?: (org:
|
|
16
|
+
Component: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
17
|
+
onOrgClick?: (org: Organization) => void;
|
|
18
18
|
}) => React.JSX.Element;
|
|
19
19
|
icon: string;
|
|
20
20
|
subject: Omit<{
|
|
@@ -27,7 +27,7 @@ export declare const ContactWithImage: {
|
|
|
27
27
|
readonly id: string;
|
|
28
28
|
description?: string | undefined;
|
|
29
29
|
name?: string | undefined;
|
|
30
|
-
status?: "
|
|
30
|
+
status?: "first" | "second" | "third" | "fourth" | undefined;
|
|
31
31
|
image?: string | undefined;
|
|
32
32
|
website?: string | undefined;
|
|
33
33
|
}> | undefined;
|
|
@@ -135,49 +135,45 @@ export declare const ContactWithImage: {
|
|
|
135
135
|
} & {
|
|
136
136
|
id: string;
|
|
137
137
|
};
|
|
138
|
-
role: string;
|
|
139
138
|
};
|
|
140
139
|
};
|
|
141
140
|
export declare const ContactNoImage: {
|
|
142
141
|
args: {
|
|
143
|
-
Component: ({ children, classNames,
|
|
144
|
-
onOrgClick?: (org:
|
|
142
|
+
Component: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
143
|
+
onOrgClick?: (org: Organization) => void;
|
|
145
144
|
}) => React.JSX.Element;
|
|
146
145
|
icon: string;
|
|
147
146
|
subject: any;
|
|
148
|
-
role: string;
|
|
149
147
|
};
|
|
150
148
|
};
|
|
151
149
|
export declare const OrganizationWithImage: {
|
|
152
150
|
args: {
|
|
153
|
-
Component: ({ children, classNames, subject: { name, image, description, website },
|
|
151
|
+
Component: ({ children, classNames, subject: { name, image, description, website }, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
154
152
|
icon: string;
|
|
155
153
|
subject: Omit<{
|
|
156
154
|
readonly id: string;
|
|
157
155
|
image?: string | undefined;
|
|
158
|
-
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
159
156
|
name?: string | undefined;
|
|
160
157
|
description?: string | undefined;
|
|
158
|
+
status?: "first" | "second" | "third" | "fourth" | undefined;
|
|
161
159
|
website?: string | undefined;
|
|
162
160
|
}, "id"> & {
|
|
163
161
|
id?: string;
|
|
164
162
|
} & {
|
|
165
163
|
id: string;
|
|
166
164
|
};
|
|
167
|
-
role: string;
|
|
168
165
|
};
|
|
169
166
|
};
|
|
170
167
|
export declare const OrganizationNoImage: {
|
|
171
168
|
args: {
|
|
172
|
-
Component: ({ children, classNames, subject: { name, image, description, website },
|
|
169
|
+
Component: ({ children, classNames, subject: { name, image, description, website }, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
173
170
|
icon: string;
|
|
174
171
|
subject: any;
|
|
175
|
-
role: string;
|
|
176
172
|
};
|
|
177
173
|
};
|
|
178
174
|
export declare const ProjectWithImage: {
|
|
179
175
|
args: {
|
|
180
|
-
Component: ({ classNames,
|
|
176
|
+
Component: ({ classNames, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
181
177
|
icon: string;
|
|
182
178
|
subject: Omit<{
|
|
183
179
|
readonly id: string;
|
|
@@ -189,15 +185,13 @@ export declare const ProjectWithImage: {
|
|
|
189
185
|
} & {
|
|
190
186
|
id: string;
|
|
191
187
|
};
|
|
192
|
-
role: string;
|
|
193
188
|
};
|
|
194
189
|
};
|
|
195
190
|
export declare const ProjectNoImage: {
|
|
196
191
|
args: {
|
|
197
|
-
Component: ({ classNames,
|
|
192
|
+
Component: ({ classNames, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
198
193
|
icon: string;
|
|
199
194
|
subject: any;
|
|
200
|
-
role: string;
|
|
201
195
|
};
|
|
202
196
|
};
|
|
203
197
|
//# sourceMappingURL=Preview.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../src/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../src/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ9D,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,EAAE,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAoB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2CpB,eAAO,MAAM,gBAAgB;;;sBA5EyB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DA2Hq0+M,KAAM,qBAAqB;+BAlFzx+M,KAAM,eAAe,YAAW,KAAM,qBACjK;;;;4DAiF2+/M,KAAM,qBAAqB;+BA7D5+/M,KAAM,eAEjC,YAGC,KAAE,qBAAqB;;;;4DAwDukhN,KAAM,qBAAqB;+BA3BrnhN,KAAO,eAAc,YAE1B,KAEE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAlBvB,CAAC;AAEF,eAAO,MAAM,cAAc;;;sBApF2B,CAAA;;;;;CA0FrD,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAMjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;CAM/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAM5B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewPlugin.d.ts","sourceRoot":"","sources":["../../../src/PreviewPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreviewPlugin.d.ts","sourceRoot":"","sources":["../../../src/PreviewPlugin.tsx"],"names":[],"mappings":"AA8DA,eAAO,MAAM,aAAa,4CA8ItB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Contact, type Organization } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ContactCard: ({ children, classNames,
|
|
5
|
-
onOrgClick?: (org:
|
|
4
|
+
export declare const ContactCard: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: PreviewProps<Contact> & {
|
|
5
|
+
onOrgClick?: (org: Organization) => void;
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
7
|
//# sourceMappingURL=ContactCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ContactCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"ContactCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ContactCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,YAAY,EAA0D,MAAM,UAAU,CAAC;AAErG,eAAO,MAAM,WAAW,8FAKrB,YAAY,CAAC,OAAO,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,sBAmDtE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Organization } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const OrganizationCard: ({ children, classNames, subject: { name, image, description, website },
|
|
4
|
+
export declare const OrganizationCard: ({ children, classNames, subject: { name, image, description, website }, }: PreviewProps<Organization>) => React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=OrganizationCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationCard.d.ts","sourceRoot":"","sources":["../../../../src/components/OrganizationCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"OrganizationCard.d.ts","sourceRoot":"","sources":["../../../../src/components/OrganizationCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,YAAY,EAA0D,MAAM,UAAU,CAAC;AAErG,eAAO,MAAM,gBAAgB,8EAI1B,YAAY,CAAC,YAAY,CAAC,sBAwB5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Project } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ProjectCard: ({ classNames,
|
|
4
|
+
export declare const ProjectCard: ({ classNames, subject: { name, image, description } }: PreviewProps<Project>) => React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=ProjectCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ProjectCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"ProjectCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ProjectCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,KAAK,YAAY,EAA6B,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,WAAW,0DAA2D,YAAY,CAAC,OAAO,CAAC,sBAQvG,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { type PropsWithChildren } from 'react';
|
|
|
2
2
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
3
|
export type PreviewProps<T extends object> = PropsWithChildren<ThemedClassName<{
|
|
4
4
|
subject: T;
|
|
5
|
-
role: string;
|
|
6
5
|
}>>;
|
|
7
6
|
/**
|
|
8
7
|
* <Card.Root>
|
|
@@ -16,9 +15,7 @@ export type PreviewProps<T extends object> = PropsWithChildren<ThemedClassName<{
|
|
|
16
15
|
* </Card.Body>
|
|
17
16
|
* </Card.Root>
|
|
18
17
|
*/
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const defaultCard = "";
|
|
21
|
-
export declare const kanbanCardWithoutPoster = "pbs-[--rail-action]";
|
|
18
|
+
export declare const previewCard = "popover-max-width rounded-lg overflow-hidden";
|
|
22
19
|
export declare const previewTitle = "text-lg font-medium line-clamp-2";
|
|
23
20
|
export declare const previewProse = "pli-3 mlb-3";
|
|
24
21
|
export declare const previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,CAC5D,eAAe,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,CAC5D,eAAe,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC,CACH,CAAC;AAQF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAC1E,eAAO,MAAM,YAAY,qCAAqC,CAAC;AAC/D,eAAO,MAAM,YAAY,gBAAgB,CAAC;AAC1C,eAAO,MAAM,aAAa,4FAA4F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-preview",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.36232bc",
|
|
4
4
|
"description": "Preview plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,33 +23,32 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"@dxos/async": "0.8.2-main.
|
|
28
|
-
"@dxos/client": "0.8.2-main.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
36
|
-
"@dxos/react-ui-
|
|
37
|
-
"@dxos/react-ui-
|
|
38
|
-
"@dxos/react-ui-
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/react-ui-
|
|
41
|
-
"@dxos/schema": "0.8.2-main.
|
|
42
|
-
"@dxos/util": "0.8.2-main.2f9c567"
|
|
26
|
+
"@dxos/app-framework": "0.8.2-main.36232bc",
|
|
27
|
+
"@dxos/async": "0.8.2-main.36232bc",
|
|
28
|
+
"@dxos/client": "0.8.2-main.36232bc",
|
|
29
|
+
"@dxos/echo-schema": "0.8.2-main.36232bc",
|
|
30
|
+
"@dxos/keys": "0.8.2-main.36232bc",
|
|
31
|
+
"@dxos/lit-ui": "0.8.2-main.36232bc",
|
|
32
|
+
"@dxos/plugin-client": "0.8.2-main.36232bc",
|
|
33
|
+
"@dxos/log": "0.8.2-main.36232bc",
|
|
34
|
+
"@dxos/react-client": "0.8.2-main.36232bc",
|
|
35
|
+
"@dxos/react-ui": "0.8.2-main.36232bc",
|
|
36
|
+
"@dxos/react-ui-form": "0.8.2-main.36232bc",
|
|
37
|
+
"@dxos/react-ui-editor": "0.8.2-main.36232bc",
|
|
38
|
+
"@dxos/react-ui-theme": "0.8.2-main.36232bc",
|
|
39
|
+
"@dxos/util": "0.8.2-main.36232bc",
|
|
40
|
+
"@dxos/react-ui-table": "0.8.2-main.36232bc",
|
|
41
|
+
"@dxos/schema": "0.8.2-main.36232bc"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"effect": "3.
|
|
44
|
+
"effect": "3.13.3",
|
|
46
45
|
"react": "~18.2.0",
|
|
47
46
|
"react-dom": "~18.2.0",
|
|
48
47
|
"vite": "5.4.7",
|
|
49
|
-
"@dxos/random": "0.8.2-main.
|
|
48
|
+
"@dxos/random": "0.8.2-main.36232bc"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"effect": "
|
|
51
|
+
"effect": "3.13.3",
|
|
53
52
|
"react": "~18.2.0",
|
|
54
53
|
"react-dom": "~18.2.0"
|
|
55
54
|
},
|
package/src/Preview.stories.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { create } from '@dxos/echo-schema';
|
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { makeRef } from '@dxos/react-client/echo';
|
|
13
13
|
import { Icon, Popover } from '@dxos/react-ui';
|
|
14
|
-
import {
|
|
14
|
+
import { Contact, Organization, Project } from '@dxos/schema';
|
|
15
15
|
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
16
16
|
|
|
17
17
|
import { ContactCard, OrganizationCard, ProjectCard } from './components';
|
|
@@ -52,7 +52,7 @@ export default meta;
|
|
|
52
52
|
const omitImage = ({ image, ...rest }: any) => rest;
|
|
53
53
|
|
|
54
54
|
const data = (() => {
|
|
55
|
-
const organization = create(
|
|
55
|
+
const organization = create(Organization, {
|
|
56
56
|
name: faker.company.name(),
|
|
57
57
|
image:
|
|
58
58
|
'https://plus.unsplash.com/premium_photo-1672116452571-896980a801c8?q=80&w=2671&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
@@ -60,7 +60,7 @@ const data = (() => {
|
|
|
60
60
|
description: faker.lorem.paragraph(),
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const contact = create(
|
|
63
|
+
const contact = create(Contact, {
|
|
64
64
|
fullName: faker.person.fullName(),
|
|
65
65
|
image:
|
|
66
66
|
'https://plus.unsplash.com/premium_photo-1664536392779-049ba8fde933?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
@@ -81,7 +81,7 @@ const data = (() => {
|
|
|
81
81
|
],
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
const project = create(
|
|
84
|
+
const project = create(Project, {
|
|
85
85
|
name: faker.person.fullName(),
|
|
86
86
|
image: 'https://dxos.network/dxos-logotype-blue.png',
|
|
87
87
|
description: faker.lorem.paragraph(),
|
|
@@ -95,7 +95,6 @@ export const ContactWithImage = {
|
|
|
95
95
|
Component: ContactCard,
|
|
96
96
|
icon: 'ph--user--regular',
|
|
97
97
|
subject: data.contact,
|
|
98
|
-
role: 'popover',
|
|
99
98
|
},
|
|
100
99
|
};
|
|
101
100
|
|
|
@@ -104,7 +103,6 @@ export const ContactNoImage = {
|
|
|
104
103
|
Component: ContactCard,
|
|
105
104
|
icon: 'ph--user--regular',
|
|
106
105
|
subject: omitImage(data.contact),
|
|
107
|
-
role: 'popover',
|
|
108
106
|
},
|
|
109
107
|
};
|
|
110
108
|
|
|
@@ -113,7 +111,6 @@ export const OrganizationWithImage = {
|
|
|
113
111
|
Component: OrganizationCard,
|
|
114
112
|
icon: 'ph--building-office--regular',
|
|
115
113
|
subject: data.organization,
|
|
116
|
-
role: 'popover',
|
|
117
114
|
},
|
|
118
115
|
};
|
|
119
116
|
|
|
@@ -122,7 +119,6 @@ export const OrganizationNoImage = {
|
|
|
122
119
|
Component: OrganizationCard,
|
|
123
120
|
icon: 'ph--building-office--regular',
|
|
124
121
|
subject: omitImage(data.organization),
|
|
125
|
-
role: 'popover',
|
|
126
122
|
},
|
|
127
123
|
};
|
|
128
124
|
|
|
@@ -131,7 +127,6 @@ export const ProjectWithImage = {
|
|
|
131
127
|
Component: ProjectCard,
|
|
132
128
|
icon: 'ph--building--regular',
|
|
133
129
|
subject: data.project,
|
|
134
|
-
role: 'popover',
|
|
135
130
|
},
|
|
136
131
|
};
|
|
137
132
|
|
|
@@ -140,6 +135,5 @@ export const ProjectNoImage = {
|
|
|
140
135
|
Component: ProjectCard,
|
|
141
136
|
icon: 'ph--building--regular',
|
|
142
137
|
subject: omitImage(data.project),
|
|
143
|
-
role: 'popover',
|
|
144
138
|
},
|
|
145
139
|
};
|
package/src/PreviewPlugin.tsx
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
getSpace,
|
|
26
26
|
isEchoObject,
|
|
27
27
|
parseId,
|
|
28
|
-
type
|
|
28
|
+
type ReactiveEchoObject,
|
|
29
29
|
type Space,
|
|
30
30
|
} from '@dxos/client/echo';
|
|
31
31
|
import { isInstanceOf } from '@dxos/echo-schema';
|
|
@@ -38,12 +38,11 @@ import { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-edit
|
|
|
38
38
|
import { Form } from '@dxos/react-ui-form';
|
|
39
39
|
import { TableType } from '@dxos/react-ui-table';
|
|
40
40
|
import { descriptionMessage } from '@dxos/react-ui-theme';
|
|
41
|
-
import {
|
|
41
|
+
import { Contact, Organization, Project } from '@dxos/schema';
|
|
42
42
|
|
|
43
43
|
import { ContactCard, OrganizationCard, ProjectCard } from './components';
|
|
44
44
|
import { meta, PREVIEW_PLUGIN } from './meta';
|
|
45
45
|
import translations from './translations';
|
|
46
|
-
import { kanbanCardWithoutPoster } from './types';
|
|
47
46
|
|
|
48
47
|
const customEventOptions = { capture: true, passive: false };
|
|
49
48
|
|
|
@@ -71,7 +70,7 @@ export const PreviewPlugin = () =>
|
|
|
71
70
|
defineModule({
|
|
72
71
|
id: `${meta.id}/module/schema`,
|
|
73
72
|
activatesOn: ClientEvents.SetupSchema,
|
|
74
|
-
activate: () => [contributes(ClientCapabilities.Schema, [
|
|
73
|
+
activate: () => [contributes(ClientCapabilities.Schema, [Contact, Organization])],
|
|
75
74
|
}),
|
|
76
75
|
defineModule({
|
|
77
76
|
id: `${meta.id}/module/preview-popover`,
|
|
@@ -127,16 +126,16 @@ export const PreviewPlugin = () =>
|
|
|
127
126
|
//
|
|
128
127
|
createSurface({
|
|
129
128
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
130
|
-
role:
|
|
131
|
-
filter: (data): data is { subject:
|
|
132
|
-
component: ({ data
|
|
129
|
+
role: 'popover',
|
|
130
|
+
filter: (data): data is { subject: Contact } => isInstanceOf(Contact, data.subject),
|
|
131
|
+
component: ({ data }) => {
|
|
133
132
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
134
133
|
const handleOrgClick = useCallback(
|
|
135
|
-
async (org:
|
|
134
|
+
async (org: Organization) => {
|
|
136
135
|
const space = getSpace(org);
|
|
137
136
|
const tablesQuery = await space?.db.query(Filter.schema(TableType)).run();
|
|
138
137
|
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
139
|
-
return table.view?.target?.query?.typename ===
|
|
138
|
+
return table.view?.target?.query?.typename === Organization.typename;
|
|
140
139
|
});
|
|
141
140
|
await dispatch(
|
|
142
141
|
createIntent(LayoutAction.UpdatePopover, {
|
|
@@ -160,28 +159,27 @@ export const PreviewPlugin = () =>
|
|
|
160
159
|
[dispatch],
|
|
161
160
|
);
|
|
162
161
|
return (
|
|
163
|
-
<ContactCard subject={data.subject} onOrgClick={handleOrgClick}
|
|
164
|
-
|
|
162
|
+
<ContactCard subject={data.subject} onOrgClick={handleOrgClick}>
|
|
163
|
+
<Surface role='related' data={data} />
|
|
165
164
|
</ContactCard>
|
|
166
165
|
);
|
|
167
166
|
},
|
|
168
167
|
}),
|
|
169
168
|
createSurface({
|
|
170
169
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
171
|
-
role:
|
|
172
|
-
filter: (data): data is { subject:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
{role === 'popover' && <Surface role='related' data={data} />}
|
|
170
|
+
role: 'popover',
|
|
171
|
+
filter: (data): data is { subject: Organization } => isInstanceOf(Organization, data.subject),
|
|
172
|
+
component: ({ data }) => (
|
|
173
|
+
<OrganizationCard subject={data.subject}>
|
|
174
|
+
<Surface role='related' data={data} />
|
|
177
175
|
</OrganizationCard>
|
|
178
176
|
),
|
|
179
177
|
}),
|
|
180
178
|
createSurface({
|
|
181
179
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
182
|
-
role:
|
|
183
|
-
filter: (data): data is { subject:
|
|
184
|
-
component: ({ data
|
|
180
|
+
role: 'popover',
|
|
181
|
+
filter: (data): data is { subject: Project } => isInstanceOf(Project, data.subject),
|
|
182
|
+
component: ({ data }) => <ProjectCard subject={data.subject} />,
|
|
185
183
|
}),
|
|
186
184
|
|
|
187
185
|
//
|
|
@@ -189,24 +187,17 @@ export const PreviewPlugin = () =>
|
|
|
189
187
|
//
|
|
190
188
|
createSurface({
|
|
191
189
|
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
192
|
-
role:
|
|
190
|
+
role: 'popover',
|
|
193
191
|
position: 'fallback',
|
|
194
|
-
filter: (data): data is { subject:
|
|
195
|
-
component: ({ data
|
|
192
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),
|
|
193
|
+
component: ({ data }) => {
|
|
196
194
|
const schema = getSchema(data.subject);
|
|
197
195
|
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
198
196
|
if (!schema) {
|
|
199
197
|
return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;
|
|
200
198
|
}
|
|
201
199
|
|
|
202
|
-
return
|
|
203
|
-
<Form
|
|
204
|
-
schema={schema}
|
|
205
|
-
values={data.subject}
|
|
206
|
-
readonly
|
|
207
|
-
{...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}
|
|
208
|
-
/>
|
|
209
|
-
);
|
|
200
|
+
return <Form schema={schema} values={data.subject} readonly />;
|
|
210
201
|
},
|
|
211
202
|
}),
|
|
212
203
|
]),
|
|
@@ -6,20 +6,19 @@ import React, { Fragment } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Icon, Avatar, Button } from '@dxos/react-ui';
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
import { type
|
|
9
|
+
import { type Contact, type Organization } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { type PreviewProps,
|
|
11
|
+
import { type PreviewProps, previewCard, previewTitle, previewProse, previewChrome } from '../types';
|
|
12
12
|
|
|
13
13
|
export const ContactCard = ({
|
|
14
14
|
children,
|
|
15
15
|
classNames,
|
|
16
|
-
role,
|
|
17
16
|
subject: { fullName, image, organization, emails },
|
|
18
17
|
onOrgClick,
|
|
19
|
-
}: PreviewProps<
|
|
18
|
+
}: PreviewProps<Contact> & { onOrgClick?: (org: Organization) => void }) => {
|
|
20
19
|
const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;
|
|
21
20
|
return (
|
|
22
|
-
<div role='none' className={mx(
|
|
21
|
+
<div role='none' className={mx(previewCard, classNames)}>
|
|
23
22
|
<Avatar.Root>
|
|
24
23
|
<div role='group' className={mx(previewProse, 'grid gap-3 grid-cols-[min-content_1fr]')}>
|
|
25
24
|
<Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />
|
|
@@ -6,22 +6,21 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Icon } from '@dxos/react-ui';
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
import { type
|
|
9
|
+
import { type Organization } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { type PreviewProps,
|
|
11
|
+
import { type PreviewProps, previewCard, previewTitle, previewProse, previewChrome } from '../types';
|
|
12
12
|
|
|
13
13
|
export const OrganizationCard = ({
|
|
14
14
|
children,
|
|
15
15
|
classNames,
|
|
16
16
|
subject: { name, image, description, website },
|
|
17
|
-
|
|
18
|
-
}: PreviewProps<DataType.Organization>) => {
|
|
17
|
+
}: PreviewProps<Organization>) => {
|
|
19
18
|
return (
|
|
20
|
-
<div role='none' className={mx(
|
|
19
|
+
<div role='none' className={mx(previewCard, classNames)}>
|
|
21
20
|
{image ? (
|
|
22
21
|
<img className='aspect-video object-cover is-full bs-auto' src={image} alt={name} />
|
|
23
22
|
) : (
|
|
24
|
-
<div role='image' className='grid aspect-video place-items-center bg-
|
|
23
|
+
<div role='image' className='grid aspect-video place-items-center bg-groupSurface text-subdued'>
|
|
25
24
|
<Icon icon='ph--building-office--regular' size={10} />
|
|
26
25
|
</div>
|
|
27
26
|
)}
|
|
@@ -5,17 +5,13 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { mx } from '@dxos/react-ui-theme';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Project } from '@dxos/schema';
|
|
9
9
|
|
|
10
|
-
import { type PreviewProps,
|
|
10
|
+
import { type PreviewProps, previewCard, previewTitle } from '../types';
|
|
11
11
|
|
|
12
|
-
export const ProjectCard = ({
|
|
13
|
-
classNames,
|
|
14
|
-
role,
|
|
15
|
-
subject: { name, image, description },
|
|
16
|
-
}: PreviewProps<DataType.Project>) => {
|
|
12
|
+
export const ProjectCard = ({ classNames, subject: { name, image, description } }: PreviewProps<Project>) => {
|
|
17
13
|
return (
|
|
18
|
-
<div role='none' className={mx(
|
|
14
|
+
<div role='none' className={mx(previewCard, classNames)}>
|
|
19
15
|
{image && <img className='is-full bs-auto' src={image} alt={name} />}
|
|
20
16
|
<h2 className={mx(previewTitle, 'pli-3 mlb-3')}>{name}</h2>
|
|
21
17
|
{description && <p className='pli-3 line-clamp-2 mlb-3'>{description}</p>}
|
package/src/types.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { type ThemedClassName } from '@dxos/react-ui';
|
|
|
10
10
|
export type PreviewProps<T extends object> = PropsWithChildren<
|
|
11
11
|
ThemedClassName<{
|
|
12
12
|
subject: T;
|
|
13
|
-
role: string;
|
|
14
13
|
}>
|
|
15
14
|
>;
|
|
16
15
|
|
|
@@ -32,9 +31,7 @@ export type PreviewProps<T extends object> = PropsWithChildren<
|
|
|
32
31
|
* </Card.Body>
|
|
33
32
|
* </Card.Root>
|
|
34
33
|
*/
|
|
35
|
-
export const
|
|
36
|
-
export const defaultCard = '';
|
|
37
|
-
export const kanbanCardWithoutPoster = 'pbs-[--rail-action]';
|
|
34
|
+
export const previewCard = 'popover-max-width rounded-lg overflow-hidden';
|
|
38
35
|
export const previewTitle = 'text-lg font-medium line-clamp-2';
|
|
39
36
|
export const previewProse = 'pli-3 mlb-3';
|
|
40
37
|
export const previewChrome = 'pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full';
|