@dxos/plugin-stack 0.7.4 → 0.7.5-labs.071a3e2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/lib/browser/StackMain-RKYIGXZ7.mjs +296 -0
  2. package/dist/lib/browser/StackMain-RKYIGXZ7.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-DS5KGEJG.mjs → chunk-WTGFKPPQ.mjs} +3 -3
  4. package/dist/lib/browser/chunk-WTGFKPPQ.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +79 -236
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/node/StackMain-6XIWVZUN.cjs +310 -0
  9. package/dist/lib/node/StackMain-6XIWVZUN.cjs.map +7 -0
  10. package/dist/lib/node/{chunk-PA5PRDM6.cjs → chunk-CZCFFT2J.cjs} +7 -7
  11. package/dist/lib/node/chunk-CZCFFT2J.cjs.map +7 -0
  12. package/dist/lib/node/index.cjs +80 -231
  13. package/dist/lib/node/index.cjs.map +4 -4
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node-esm/StackMain-NAW7ZBKW.mjs +297 -0
  16. package/dist/lib/node-esm/StackMain-NAW7ZBKW.mjs.map +7 -0
  17. package/dist/lib/node-esm/{chunk-JEQMG2E2.mjs → chunk-SJU6TPRI.mjs} +3 -3
  18. package/dist/lib/node-esm/chunk-SJU6TPRI.mjs.map +7 -0
  19. package/dist/lib/node-esm/index.mjs +79 -236
  20. package/dist/lib/node-esm/index.mjs.map +4 -4
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/types/src/StackPlugin.d.ts +1 -3
  23. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  24. package/dist/types/src/components/StackMain.d.ts.map +1 -1
  25. package/dist/types/src/components/StackSection.d.ts.map +1 -1
  26. package/dist/types/src/components/index.d.ts +1 -2
  27. package/dist/types/src/components/index.d.ts.map +1 -1
  28. package/dist/types/src/index.d.ts +1 -3
  29. package/dist/types/src/index.d.ts.map +1 -1
  30. package/dist/types/src/meta.d.ts +1 -2
  31. package/dist/types/src/meta.d.ts.map +1 -1
  32. package/dist/types/src/types/stack.d.ts +6 -12
  33. package/dist/types/src/types/stack.d.ts.map +1 -1
  34. package/dist/types/src/types/types.d.ts +2 -17
  35. package/dist/types/src/types/types.d.ts.map +1 -1
  36. package/dist/types/tsconfig.tsbuildinfo +1 -0
  37. package/package.json +24 -33
  38. package/src/StackPlugin.tsx +53 -73
  39. package/src/components/StackMain.tsx +75 -79
  40. package/src/components/StackSection.tsx +3 -5
  41. package/src/components/StackSettings.tsx +3 -3
  42. package/src/components/index.ts +0 -1
  43. package/src/index.ts +1 -6
  44. package/src/meta.ts +1 -1
  45. package/src/types/types.ts +2 -31
  46. package/dist/lib/browser/StackMain-4D4J4IRK.mjs +0 -391
  47. package/dist/lib/browser/StackMain-4D4J4IRK.mjs.map +0 -7
  48. package/dist/lib/browser/chunk-DS5KGEJG.mjs.map +0 -7
  49. package/dist/lib/browser/meta.mjs +0 -11
  50. package/dist/lib/browser/meta.mjs.map +0 -7
  51. package/dist/lib/node/StackMain-V7C55NCF.cjs +0 -403
  52. package/dist/lib/node/StackMain-V7C55NCF.cjs.map +0 -7
  53. package/dist/lib/node/chunk-PA5PRDM6.cjs.map +0 -7
  54. package/dist/lib/node/meta.cjs +0 -32
  55. package/dist/lib/node/meta.cjs.map +0 -7
  56. package/dist/lib/node-esm/StackMain-5I43UWGF.mjs +0 -392
  57. package/dist/lib/node-esm/StackMain-5I43UWGF.mjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-JEQMG2E2.mjs.map +0 -7
  59. package/dist/lib/node-esm/meta.mjs +0 -12
  60. package/dist/lib/node-esm/meta.mjs.map +0 -7
  61. package/dist/types/src/components/AddSection.d.ts +0 -6
  62. package/dist/types/src/components/AddSection.d.ts.map +0 -1
  63. package/dist/types/src/components/AddSectionDialog.d.ts +0 -14
  64. package/dist/types/src/components/AddSectionDialog.d.ts.map +0 -1
  65. package/src/components/AddSection.tsx +0 -102
  66. package/src/components/AddSectionDialog.tsx +0 -128
@@ -5,15 +5,8 @@
5
5
  import { type IconProps } from '@phosphor-icons/react';
6
6
  import { type FC } from 'react';
7
7
 
8
- import type {
9
- Intent,
10
- MetadataRecordsProvides,
11
- SettingsProvides,
12
- SurfaceProvides,
13
- TranslationsProvides,
14
- } from '@dxos/app-framework';
15
- import { type SchemaProvides } from '@dxos/plugin-space';
16
8
  import { type CollectionType } from '@dxos/plugin-space/types';
9
+ import { type ReactiveEchoObject } from '@dxos/react-client/echo';
17
10
  import { type Label } from '@dxos/react-ui';
18
11
  import { type StackItemSize } from '@dxos/react-ui-stack';
19
12
 
@@ -31,8 +24,6 @@ export type StackSectionView = {
31
24
  custom?: Record<string, any>;
32
25
  };
33
26
 
34
- // TODO(wittjosiah): Creators/choosers likely aren't stack-specific.
35
- // Also distinct from graph actions though, output should be inserted into current view rather than navigated to.
36
27
  type StackSectionAction = {
37
28
  id: string;
38
29
  testId: string;
@@ -49,29 +40,9 @@ export type StackSectionMetadata = {
49
40
 
50
41
  export type StackSectionItem = {
51
42
  id: string;
52
- object: CollectionType['objects'][number];
43
+ object: ReactiveEchoObject<any>;
53
44
  view: StackSectionView;
54
45
  metadata: StackSectionMetadata;
55
46
  };
56
47
 
57
- export type StackSectionCreator = StackSectionAction & {
58
- intent: Intent | Intent[];
59
- };
60
-
61
- export type StackProvides = {
62
- stack: {
63
- creators?: StackSectionCreator[];
64
- };
65
- };
66
-
67
- export type StackState = {
68
- creators: StackSectionCreator[];
69
- };
70
-
71
48
  export type StackSettingsProps = { separation: boolean };
72
-
73
- export type StackPluginProvides = SurfaceProvides &
74
- MetadataRecordsProvides &
75
- SettingsProvides<StackSettingsProps> &
76
- TranslationsProvides &
77
- SchemaProvides & { stack: StackState };
@@ -1,391 +0,0 @@
1
- import {
2
- STACK_PLUGIN
3
- } from "./chunk-DS5KGEJG.mjs";
4
- import {
5
- StackViewType
6
- } from "./chunk-L34RFJ2L.mjs";
7
-
8
- // packages/plugins/plugin-stack/src/components/StackMain.tsx
9
- import { Plus } from "@phosphor-icons/react";
10
- import React4, { useEffect, useMemo, useState as useState2 } from "react";
11
- import { LayoutAction, NavigationAction, parseMetadataResolverPlugin, useIntentDispatcher as useIntentDispatcher2, useResolvePlugin } from "@dxos/app-framework";
12
- import { create, getType, fullyQualifiedId } from "@dxos/client/echo";
13
- import { useGraph } from "@dxos/plugin-graph";
14
- import { SpaceAction } from "@dxos/plugin-space";
15
- import { Button, toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
16
- import { AttentionProvider } from "@dxos/react-ui-attention";
17
- import { Stack } from "@dxos/react-ui-stack";
18
- import { nonNullable } from "@dxos/util";
19
-
20
- // packages/plugins/plugin-stack/src/components/AddSection.tsx
21
- import { useArrowNavigationGroup } from "@fluentui/react-tabster";
22
- import React, { useCallback } from "react";
23
- import { usePlugin, useIntentDispatcher } from "@dxos/app-framework";
24
- import { toLocalizedString, useTranslation } from "@dxos/react-ui";
25
- import { getSize, mx } from "@dxos/react-ui-theme";
26
- var CreatorTile = ({ Icon: Icon2, label, testId, handleAdd }) => {
27
- const onClick = useCallback((_) => handleAdd(), [
28
- handleAdd
29
- ]);
30
- const onKeyDown = useCallback((event) => {
31
- if (event.key === "Enter" || event.key === " ") {
32
- event.preventDefault();
33
- handleAdd();
34
- }
35
- }, [
36
- handleAdd
37
- ]);
38
- return /* @__PURE__ */ React.createElement("div", {
39
- role: "button",
40
- "aria-label": label,
41
- tabIndex: 0,
42
- className: mx("flex items-center w-[10rem] h-16 overflow-hidden", "border rounded-md border-separator shadow-sm hover:bg-hoverSurface cursor-pointer"),
43
- onClick,
44
- onKeyDown,
45
- "data-testid": testId
46
- }, /* @__PURE__ */ React.createElement("div", {
47
- className: "flex h-full w-12 items-center justify-center bg-scrim shrink-0 border-r border-separator"
48
- }, /* @__PURE__ */ React.createElement(Icon2, {
49
- weight: "thin",
50
- className: getSize(6)
51
- })), /* @__PURE__ */ React.createElement("div", {
52
- className: "overflow-hidden items-center p-2 px-3"
53
- }, /* @__PURE__ */ React.createElement("span", {
54
- className: "capitalize"
55
- }, label)));
56
- };
57
- var AddSection = ({ collection }) => {
58
- const domAttributes = useArrowNavigationGroup({
59
- axis: "grid"
60
- });
61
- const dispatch = useIntentDispatcher();
62
- const { t } = useTranslation(STACK_PLUGIN);
63
- const stackPlugin = usePlugin(STACK_PLUGIN);
64
- const stackCreators = stackPlugin?.provides?.stack.creators ?? [];
65
- const handleAdd = useCallback(async (creator) => {
66
- const { data: section } = await dispatch(creator.intent) ?? {};
67
- collection.objects = [
68
- section
69
- ];
70
- const stack = collection.views[StackViewType.typename];
71
- if (stack) {
72
- stack.sections[section.id] = {};
73
- }
74
- }, [
75
- collection,
76
- dispatch
77
- ]);
78
- if (stackCreators.length === 0) {
79
- return null;
80
- }
81
- return /* @__PURE__ */ React.createElement("div", {
82
- ...domAttributes,
83
- role: "none",
84
- className: "flex flex-wrap items-center p-8 gap-4"
85
- }, stackCreators.map((creator) => {
86
- const { id, type, icon, testId } = creator;
87
- return /* @__PURE__ */ React.createElement(CreatorTile, {
88
- key: id,
89
- label: toLocalizedString(type, t),
90
- testId,
91
- Icon: icon,
92
- handleAdd: () => handleAdd(creator)
93
- });
94
- }));
95
- };
96
-
97
- // packages/plugins/plugin-stack/src/components/StackContext.tsx
98
- import { createContext, useContext } from "react";
99
- var StackContext = /* @__PURE__ */ createContext({
100
- onCollapse: () => {
101
- },
102
- onNavigate: async () => {
103
- },
104
- onDelete: async () => {
105
- },
106
- onAdd: () => {
107
- }
108
- });
109
- var useStack = () => useContext(StackContext);
110
-
111
- // packages/plugins/plugin-stack/src/components/StackSection.tsx
112
- import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
113
- import React3, { useState } from "react";
114
- import { Surface } from "@dxos/app-framework";
115
- import { DropdownMenu, Icon, useTranslation as useTranslation2, IconButton } from "@dxos/react-ui";
116
- import { useAttendableAttributes } from "@dxos/react-ui-attention";
117
- import { StackItem } from "@dxos/react-ui-stack";
118
- import { mx as mx2, getSize as getSize2, textBlockWidth } from "@dxos/react-ui-theme";
119
-
120
- // packages/plugins/plugin-stack/src/components/CaretDownUp.tsx
121
- import React2 from "react";
122
- var CaretDownUp = ({ children, ...props }) => {
123
- return /* @__PURE__ */ React2.createElement("svg", {
124
- xmlns: "http://www.w3.org/2000/svg",
125
- viewBox: "0 0 256 256",
126
- ...props
127
- }, /* @__PURE__ */ React2.createElement("rect", {
128
- width: "256",
129
- height: "256",
130
- fill: "none"
131
- }), /* @__PURE__ */ React2.createElement("polyline", {
132
- points: "80 224 128 176 176 224",
133
- fill: "none",
134
- stroke: "currentColor",
135
- strokeLinecap: "round",
136
- strokeLinejoin: "round",
137
- strokeWidth: "16"
138
- }), /* @__PURE__ */ React2.createElement("polyline", {
139
- points: "80 32 128 80 176 32",
140
- fill: "none",
141
- stroke: "currentColor",
142
- strokeLinecap: "round",
143
- strokeLinejoin: "round",
144
- strokeWidth: "16"
145
- }), children);
146
- };
147
-
148
- // packages/plugins/plugin-stack/src/components/StackSection.tsx
149
- var sectionActionDimensions = "m-1 p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min";
150
- var StackSection = ({ id, view, object, metadata: { icon = "ph--placeholder--regular" } }) => {
151
- const { t } = useTranslation2(STACK_PLUGIN);
152
- const { onNavigate, onAdd, onCollapse, onDelete } = useStack();
153
- const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
154
- const attendableAttrs = useAttendableAttributes(id);
155
- return /* @__PURE__ */ React3.createElement(CollapsiblePrimitive.Root, {
156
- asChild: true,
157
- open: !view.collapsed,
158
- onOpenChange: (nextOpen) => onCollapse?.(id, !nextOpen)
159
- }, /* @__PURE__ */ React3.createElement(StackItem.Root, {
160
- item: {
161
- id
162
- },
163
- role: "section",
164
- ...attendableAttrs,
165
- classNames: "border-be border-separator"
166
- }, /* @__PURE__ */ React3.createElement(StackItem.Heading, {
167
- classNames: "attention-surface border-ie !border-separator"
168
- }, /* @__PURE__ */ React3.createElement("span", {
169
- className: "sr-only"
170
- }, view.title), /* @__PURE__ */ React3.createElement("div", {
171
- role: "none",
172
- className: "sticky -block-start-px bg-[--sticky-bg]"
173
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Root, {
174
- open: optionsMenuOpen,
175
- onOpenChange: setOptionsMenuOpen
176
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Trigger, {
177
- asChild: true
178
- }, /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement(Icon, {
179
- icon,
180
- size: 5,
181
- classNames: "transition-opacity"
182
- }))), /* @__PURE__ */ React3.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Content, {
183
- style: {
184
- zIndex: 70
185
- }
186
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Viewport, null, view.collapsed ? /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
187
- onClick: () => onNavigate(id),
188
- "data-testid": "section.navigate-to"
189
- }, /* @__PURE__ */ React3.createElement(Icon, {
190
- icon: "ph--arrow-square-out--regular",
191
- size: 5
192
- }), /* @__PURE__ */ React3.createElement("span", {
193
- className: "mis-2 grow"
194
- }, t("navigate to section label"))) : /* @__PURE__ */ React3.createElement(CollapsiblePrimitive.Trigger, {
195
- asChild: true
196
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Item, null, /* @__PURE__ */ React3.createElement(CaretDownUp, {
197
- className: getSize2(5)
198
- }), /* @__PURE__ */ React3.createElement("span", {
199
- className: "mis-2 grow"
200
- }, t("collapse label")))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
201
- onClick: () => onAdd(id, "before"),
202
- "data-testid": "section.add-before"
203
- }, /* @__PURE__ */ React3.createElement(Icon, {
204
- icon: "ph--arrow-line-up--regular",
205
- size: 5
206
- }), /* @__PURE__ */ React3.createElement("span", {
207
- className: "mis-2 grow"
208
- }, t("add section before label"))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
209
- onClick: () => onAdd(id, "after"),
210
- "data-testid": "section.add-after"
211
- }, /* @__PURE__ */ React3.createElement(Icon, {
212
- icon: "ph--arrow-line-down--regular",
213
- size: 5
214
- }), /* @__PURE__ */ React3.createElement("span", {
215
- className: "mis-2 grow"
216
- }, t("add section after label"))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
217
- onClick: () => onDelete(id),
218
- "data-testid": "section.remove"
219
- }, /* @__PURE__ */ React3.createElement(Icon, {
220
- icon: "ph--trash--regular",
221
- size: 5
222
- }), /* @__PURE__ */ React3.createElement("span", {
223
- className: "mis-2 grow"
224
- }, t("remove section label")))), /* @__PURE__ */ React3.createElement(DropdownMenu.Arrow, null)))), view.collapsed ? /* @__PURE__ */ React3.createElement(CollapsiblePrimitive.Trigger, {
225
- asChild: true
226
- }, /* @__PURE__ */ React3.createElement(IconButton, {
227
- iconOnly: true,
228
- tooltipZIndex: "70",
229
- variant: "ghost",
230
- label: t("expand label"),
231
- icon: "ph--caret-up-down--regular",
232
- classNames: sectionActionDimensions
233
- })) : /* @__PURE__ */ React3.createElement(IconButton, {
234
- iconOnly: true,
235
- tooltipZIndex: "70",
236
- variant: "ghost",
237
- onClick: () => onNavigate(id),
238
- label: t("navigate to section label"),
239
- icon: "ph--arrow-square-out--regular",
240
- "data-testid": "section.navigate-to",
241
- classNames: sectionActionDimensions
242
- }))), /* @__PURE__ */ React3.createElement(CollapsiblePrimitive.Content, null, /* @__PURE__ */ React3.createElement(Surface, {
243
- role: "section",
244
- data: {
245
- object
246
- },
247
- limit: 1,
248
- placeholder: /* @__PURE__ */ React3.createElement(React3.Fragment, null)
249
- })), view.collapsed && /* @__PURE__ */ React3.createElement(StackItem.Content, {
250
- toolbar: false,
251
- classNames: "attention-surface"
252
- }, /* @__PURE__ */ React3.createElement("h2", {
253
- className: mx2("flex items-center p-4 font-medium is-full", textBlockWidth)
254
- }, view.title))));
255
- };
256
-
257
- // packages/plugins/plugin-stack/src/components/StackMain.tsx
258
- var StackMain = ({ id, collection }) => {
259
- const dispatch = useIntentDispatcher2();
260
- const { graph } = useGraph();
261
- const { t } = useTranslation3(STACK_PLUGIN);
262
- const metadataPlugin = useResolvePlugin(parseMetadataResolverPlugin);
263
- const defaultStack = useMemo(() => create(StackViewType, {
264
- sections: {}
265
- }), [
266
- collection
267
- ]);
268
- const stack = collection.views[StackViewType.typename] ?? defaultStack;
269
- const [collapsedSections, setCollapsedSections] = useState2({});
270
- useEffect(() => {
271
- if (!collection.views[StackViewType.typename]) {
272
- collection.views[StackViewType.typename] = stack;
273
- }
274
- }, [
275
- collection,
276
- stack
277
- ]);
278
- const items = collection.objects.filter(nonNullable).map((object) => {
279
- const metadata = metadataPlugin?.provides.metadata.resolver(getType(object)?.objectId ?? "never");
280
- const view = {
281
- ...stack.sections[object.id],
282
- collapsed: collapsedSections[fullyQualifiedId(object)],
283
- title: object?.title ?? toLocalizedString2(graph.findNode(fullyQualifiedId(object))?.properties.label, t)
284
- };
285
- return {
286
- id: fullyQualifiedId(object),
287
- object,
288
- metadata,
289
- view
290
- };
291
- }) ?? [];
292
- const handleDelete = async (id2) => {
293
- const index = collection.objects.filter(nonNullable).findIndex((section) => fullyQualifiedId(section) === id2);
294
- if (index >= 0) {
295
- await dispatch({
296
- action: SpaceAction.REMOVE_OBJECTS,
297
- data: {
298
- objects: [
299
- collection.objects[index]
300
- ],
301
- collection
302
- }
303
- });
304
- }
305
- };
306
- const handleAdd = (id2, position) => {
307
- void dispatch?.({
308
- action: LayoutAction.SET_LAYOUT,
309
- data: {
310
- element: "dialog",
311
- component: `${STACK_PLUGIN}/AddSectionDialog`,
312
- subject: {
313
- path: id2,
314
- position,
315
- collection
316
- }
317
- }
318
- });
319
- };
320
- const handleNavigate = async (id2) => {
321
- await dispatch([
322
- {
323
- action: NavigationAction.OPEN,
324
- data: {
325
- activeParts: {
326
- main: [
327
- id2
328
- ]
329
- }
330
- }
331
- },
332
- {
333
- action: LayoutAction.SCROLL_INTO_VIEW,
334
- data: {
335
- id: id2
336
- }
337
- }
338
- ]);
339
- };
340
- const handleCollapse = (id2, collapsed) => {
341
- setCollapsedSections((prev) => ({
342
- ...prev,
343
- [id2]: collapsed
344
- }));
345
- };
346
- return /* @__PURE__ */ React4.createElement(AttentionProvider, {
347
- id
348
- }, /* @__PURE__ */ React4.createElement(StackContext.Provider, {
349
- value: {
350
- onCollapse: handleCollapse,
351
- onNavigate: handleNavigate,
352
- onDelete: handleDelete,
353
- onAdd: handleAdd
354
- }
355
- }, /* @__PURE__ */ React4.createElement(Stack, {
356
- orientation: "vertical",
357
- size: "intrinsic",
358
- separators: false,
359
- id,
360
- "data-testid": "main.stack"
361
- }, items.map((item) => /* @__PURE__ */ React4.createElement(StackSection, {
362
- key: item.id,
363
- ...item
364
- }))), items.length === 0 ? /* @__PURE__ */ React4.createElement(AddSection, {
365
- collection
366
- }) : /* @__PURE__ */ React4.createElement("div", {
367
- role: "none",
368
- className: "flex mlb-2 pli-2 justify-center"
369
- }, /* @__PURE__ */ React4.createElement(Button, {
370
- "data-testid": "stack.createSection",
371
- classNames: "gap-2",
372
- onClick: () => dispatch?.({
373
- action: LayoutAction.SET_LAYOUT,
374
- data: {
375
- element: "dialog",
376
- component: "dxos.org/plugin/stack/AddSectionDialog",
377
- subject: {
378
- position: "afterAll",
379
- collection
380
- }
381
- }
382
- })
383
- }, /* @__PURE__ */ React4.createElement(Plus, null), /* @__PURE__ */ React4.createElement("span", {
384
- className: "sr-only"
385
- }, t("add section label"))))));
386
- };
387
- var StackMain_default = StackMain;
388
- export {
389
- StackMain_default as default
390
- };
391
- //# sourceMappingURL=StackMain-4D4J4IRK.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/StackMain.tsx", "../../../src/components/AddSection.tsx", "../../../src/components/StackContext.tsx", "../../../src/components/StackSection.tsx", "../../../src/components/CaretDownUp.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plus } from '@phosphor-icons/react';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport {\n LayoutAction,\n NavigationAction,\n parseMetadataResolverPlugin,\n useIntentDispatcher,\n useResolvePlugin,\n} from '@dxos/app-framework';\nimport { create, getType, fullyQualifiedId } from '@dxos/client/echo';\nimport { useGraph } from '@dxos/plugin-graph';\nimport { SpaceAction } from '@dxos/plugin-space';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Button, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\nimport { Stack } from '@dxos/react-ui-stack';\nimport { nonNullable } from '@dxos/util';\n\nimport { AddSection } from './AddSection';\nimport { StackContext } from './StackContext';\nimport { StackSection } from './StackSection';\nimport { STACK_PLUGIN } from '../meta';\nimport {\n StackViewType,\n type CollapsedSections,\n type StackSectionMetadata,\n type StackSectionView,\n type StackSectionItem,\n type AddSectionPosition,\n} from '../types';\n\ntype StackMainProps = {\n id: string;\n collection: CollectionType;\n};\n\nconst StackMain = ({ id, collection }: StackMainProps) => {\n const dispatch = useIntentDispatcher();\n const { graph } = useGraph();\n const { t } = useTranslation(STACK_PLUGIN);\n const metadataPlugin = useResolvePlugin(parseMetadataResolverPlugin);\n const defaultStack = useMemo(() => create(StackViewType, { sections: {} }), [collection]);\n const stack = (collection.views[StackViewType.typename] as StackViewType) ?? defaultStack;\n const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});\n\n useEffect(() => {\n if (!collection.views[StackViewType.typename]) {\n collection.views[StackViewType.typename] = stack;\n }\n }, [collection, stack]);\n\n const items =\n collection.objects\n // TODO(wittjosiah): Should the database handle this differently?\n // TODO(wittjosiah): Render placeholders for missing objects so they can be removed from the stack?\n .filter(nonNullable)\n .map((object) => {\n const metadata = metadataPlugin?.provides.metadata.resolver(\n getType(object)?.objectId ?? 'never',\n ) as StackSectionMetadata;\n const view = {\n ...stack.sections[object.id],\n collapsed: collapsedSections[fullyQualifiedId(object)],\n title:\n (object as any)?.title ?? toLocalizedString(graph.findNode(fullyQualifiedId(object))?.properties.label, t),\n } as StackSectionView;\n return { id: fullyQualifiedId(object), object, metadata, view } satisfies StackSectionItem;\n }) ?? [];\n\n const handleDelete = async (id: string) => {\n const index = collection.objects.filter(nonNullable).findIndex((section) => fullyQualifiedId(section) === id);\n if (index >= 0) {\n await dispatch({\n action: SpaceAction.REMOVE_OBJECTS,\n data: { objects: [collection.objects[index]], collection },\n });\n\n // TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.\n // delete stack.sections[Path.last(path)];\n }\n };\n\n const handleAdd = (id: string, position: AddSectionPosition) => {\n void dispatch?.({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: `${STACK_PLUGIN}/AddSectionDialog`,\n subject: { path: id, position, collection },\n },\n });\n };\n\n const handleNavigate = async (id: string) => {\n await dispatch([\n {\n action: NavigationAction.OPEN,\n data: { activeParts: { main: [id] } },\n },\n {\n action: LayoutAction.SCROLL_INTO_VIEW,\n data: { id },\n },\n ]);\n };\n\n const handleCollapse = (id: string, collapsed: boolean) => {\n setCollapsedSections((prev) => ({ ...prev, [id]: collapsed }));\n };\n\n return (\n <AttentionProvider id={id}>\n <StackContext.Provider\n value={{\n onCollapse: handleCollapse,\n onNavigate: handleNavigate,\n onDelete: handleDelete,\n onAdd: handleAdd,\n }}\n >\n <Stack orientation='vertical' size='intrinsic' separators={false} id={id} data-testid='main.stack'>\n {items.map((item) => (\n <StackSection key={item.id} {...item} />\n ))}\n </Stack>\n\n {items.length === 0 ? (\n <AddSection collection={collection} />\n ) : (\n <div role='none' className='flex mlb-2 pli-2 justify-center'>\n <Button\n data-testid='stack.createSection'\n classNames='gap-2'\n onClick={() =>\n dispatch?.({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/stack/AddSectionDialog',\n subject: { position: 'afterAll', collection },\n },\n })\n }\n >\n <Plus />\n <span className='sr-only'>{t('add section label')}</span>\n </Button>\n </div>\n )}\n </StackContext.Provider>\n </AttentionProvider>\n );\n};\n\nexport default StackMain;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { type IconProps } from '@phosphor-icons/react';\nimport React, { type FC, type KeyboardEvent, type MouseEvent, useCallback } from 'react';\n\nimport { usePlugin, useIntentDispatcher } from '@dxos/app-framework';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackSectionCreator, type StackPluginProvides } from '../types';\n\nconst CreatorTile = ({\n Icon,\n label,\n testId,\n handleAdd,\n}: {\n Icon: FC<IconProps>;\n testId: string;\n label: string;\n handleAdd: () => void;\n}) => {\n const onClick = useCallback((_: MouseEvent<HTMLDivElement>) => handleAdd(), [handleAdd]);\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleAdd();\n }\n },\n [handleAdd],\n );\n\n return (\n <div\n role='button'\n aria-label={label}\n tabIndex={0}\n className={mx(\n 'flex items-center w-[10rem] h-16 overflow-hidden',\n 'border rounded-md border-separator shadow-sm hover:bg-hoverSurface cursor-pointer',\n )}\n onClick={onClick}\n onKeyDown={onKeyDown}\n data-testid={testId}\n >\n <div className='flex h-full w-12 items-center justify-center bg-scrim shrink-0 border-r border-separator'>\n <Icon weight='thin' className={getSize(6)} />\n </div>\n <div className='overflow-hidden items-center p-2 px-3'>\n <span className='capitalize'>{label}</span>\n </div>\n </div>\n );\n};\n\nexport const AddSection = ({ collection }: { collection: CollectionType }) => {\n const domAttributes = useArrowNavigationGroup({ axis: 'grid' });\n const dispatch = useIntentDispatcher();\n const { t } = useTranslation(STACK_PLUGIN);\n\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const stackCreators = stackPlugin?.provides?.stack.creators ?? [];\n\n const handleAdd = useCallback(\n async (creator: StackSectionCreator) => {\n const { data: section } = (await dispatch(creator.intent)) ?? {};\n collection.objects = [section];\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[section.id] = {};\n }\n },\n [collection, dispatch],\n );\n\n if (stackCreators.length === 0) {\n return null;\n }\n\n return (\n <div {...domAttributes} role='none' className='flex flex-wrap items-center p-8 gap-4'>\n {stackCreators.map((creator) => {\n const { id, type, icon, testId } = creator;\n return (\n <CreatorTile\n key={id}\n label={toLocalizedString(type, t)}\n testId={testId}\n Icon={icon}\n handleAdd={() => handleAdd(creator)}\n />\n );\n })}\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type AddSectionPosition } from '../types';\n\nexport type StackContextValue = {\n onCollapse: (id: string, collapsed: boolean) => void;\n onNavigate: (id: string) => Promise<void>;\n onDelete: (id: string) => Promise<void>;\n onAdd: (id: string, position: AddSectionPosition) => void;\n};\n\nexport const StackContext = createContext<StackContextValue>({\n onCollapse: () => {},\n onNavigate: async () => {},\n onDelete: async () => {},\n onAdd: () => {},\n});\n\nexport const useStack = () => useContext(StackContext);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport React, { useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { DropdownMenu, Icon, useTranslation, IconButton } from '@dxos/react-ui';\nimport { useAttendableAttributes } from '@dxos/react-ui-attention';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx, getSize, textBlockWidth } from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { useStack } from './StackContext';\nimport { STACK_PLUGIN } from '../meta';\nimport { type StackSectionItem } from '../types';\n\nconst sectionActionDimensions = 'm-1 p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min';\n\nexport const StackSection = ({\n id,\n view,\n object,\n metadata: { icon = 'ph--placeholder--regular' },\n}: StackSectionItem) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const { onNavigate, onAdd, onCollapse, onDelete } = useStack();\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const attendableAttrs = useAttendableAttributes(id);\n\n return (\n <CollapsiblePrimitive.Root asChild open={!view.collapsed} onOpenChange={(nextOpen) => onCollapse?.(id, !nextOpen)}>\n <StackItem.Root item={{ id }} role='section' {...attendableAttrs} classNames='border-be border-separator'>\n <StackItem.Heading classNames='attention-surface border-ie !border-separator'>\n <span className='sr-only'>{view.title}</span>\n <div role='none' className='sticky -block-start-px bg-[--sticky-bg]'>\n <DropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: setOptionsMenuOpen,\n }}\n >\n <DropdownMenu.Trigger asChild>\n <StackItem.SigilButton>\n <Icon icon={icon} size={5} classNames='transition-opacity' />\n </StackItem.SigilButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content style={{ zIndex: 70 }}>\n <DropdownMenu.Viewport>\n {view.collapsed ? (\n <DropdownMenu.Item onClick={() => onNavigate(id)} data-testid='section.navigate-to'>\n <Icon icon='ph--arrow-square-out--regular' size={5} />\n <span className='mis-2 grow'>{t('navigate to section label')}</span>\n </DropdownMenu.Item>\n ) : (\n <CollapsiblePrimitive.Trigger asChild>\n <DropdownMenu.Item>\n <CaretDownUp className={getSize(5)} />\n <span className='mis-2 grow'>{t('collapse label')}</span>\n </DropdownMenu.Item>\n </CollapsiblePrimitive.Trigger>\n )}\n <DropdownMenu.Item onClick={() => onAdd(id, 'before')} data-testid='section.add-before'>\n <Icon icon='ph--arrow-line-up--regular' size={5} />\n <span className='mis-2 grow'>{t('add section before label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onAdd(id, 'after')} data-testid='section.add-after'>\n <Icon icon='ph--arrow-line-down--regular' size={5} />\n <span className='mis-2 grow'>{t('add section after label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onDelete(id)} data-testid='section.remove'>\n <Icon icon='ph--trash--regular' size={5} />\n <span className='mis-2 grow'>{t('remove section label')}</span>\n </DropdownMenu.Item>\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n {view.collapsed ? (\n <CollapsiblePrimitive.Trigger asChild>\n <IconButton\n iconOnly\n tooltipZIndex='70'\n variant='ghost'\n label={t('expand label')}\n icon='ph--caret-up-down--regular'\n classNames={sectionActionDimensions}\n />\n </CollapsiblePrimitive.Trigger>\n ) : (\n <IconButton\n iconOnly\n tooltipZIndex='70'\n variant='ghost'\n onClick={() => onNavigate(id)}\n label={t('navigate to section label')}\n icon='ph--arrow-square-out--regular'\n data-testid='section.navigate-to'\n classNames={sectionActionDimensions}\n />\n )}\n </div>\n </StackItem.Heading>\n <CollapsiblePrimitive.Content>\n <Surface role='section' data={{ object }} limit={1} placeholder={<></>} />\n </CollapsiblePrimitive.Content>\n {view.collapsed && (\n <StackItem.Content toolbar={false} classNames='attention-surface'>\n <h2 className={mx('flex items-center p-4 font-medium is-full', textBlockWidth)}>{view.title}</h2>\n </StackItem.Content>\n )}\n </StackItem.Root>\n </CollapsiblePrimitive.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentPropsWithoutRef } from 'react';\n\nexport const CaretDownUp = ({ children, ...props }: ComponentPropsWithoutRef<'svg'>) => {\n return (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' {...props}>\n <rect width='256' height='256' fill='none' />\n <polyline\n points='80 224 128 176 176 224'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n <polyline\n points='80 32 128 80 176 32'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n {children}\n </svg>\n );\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,YAAY;AACrB,OAAOC,UAASC,WAAWC,SAASC,YAAAA,iBAAgB;AAEpD,SACEC,cACAC,kBACAC,6BACAC,uBAAAA,sBACAC,wBACK;AACP,SAASC,QAAQC,SAASC,wBAAwB;AAClD,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,SAASC,QAAQC,qBAAAA,oBAAmBC,kBAAAA,uBAAsB;AAC1D,SAASC,yBAAyB;AAClC,SAASC,aAAa;AACtB,SAASC,mBAAmB;;;ACjB5B,SAASC,+BAA+B;AAExC,OAAOC,SAAuDC,mBAAmB;AAEjF,SAASC,WAAWC,2BAA2B;AAE/C,SAASC,mBAAmBC,sBAAsB;AAClD,SAASC,SAASC,UAAU;AAK5B,IAAMC,cAAc,CAAC,EACnBC,MAAAA,OACAC,OACAC,QACAC,UAAS,MAMV;AACC,QAAMC,UAAUC,YAAY,CAACC,MAAkCH,UAAAA,GAAa;IAACA;GAAU;AACvF,QAAMI,YAAYF,YAChB,CAACG,UAAAA;AACC,QAAIA,MAAMC,QAAQ,WAAWD,MAAMC,QAAQ,KAAK;AAC9CD,YAAME,eAAc;AACpBP,gBAAAA;IACF;EACF,GACA;IAACA;GAAU;AAGb,SACE,sBAAA,cAACQ,OAAAA;IACCC,MAAK;IACLC,cAAYZ;IACZa,UAAU;IACVC,WAAWC,GACT,oDACA,mFAAA;IAEFZ;IACAG;IACAU,eAAaf;KAEb,sBAAA,cAACS,OAAAA;IAAII,WAAU;KACb,sBAAA,cAACf,OAAAA;IAAKkB,QAAO;IAAOH,WAAWI,QAAQ,CAAA;OAEzC,sBAAA,cAACR,OAAAA;IAAII,WAAU;KACb,sBAAA,cAACK,QAAAA;IAAKL,WAAU;KAAcd,KAAAA,CAAAA,CAAAA;AAItC;AAEO,IAAMoB,aAAa,CAAC,EAAEC,WAAU,MAAkC;AACvE,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KAAKjF;IAAK,GAAGiF;QAInCzD,MAAM4D,WAAW,IAChB,gBAAAjB,OAAA,cAACkB,YAAAA;IAAWpF;OAEZ,gBAAAkE,OAAA,cAACmB,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAArB,OAAA,cAACsB,QAAAA;IACCT,eAAY;IACZU,YAAW;IACXC,SAAS,MACPzF,WAAW;MACT6C,QAAQM,aAAaC;MACrBJ,MAAM;QACJK,SAAS;QACTC,WAAW;QACXC,SAAS;UAAEL,UAAU;UAAYnD;QAAW;MAC9C;IACF,CAAA;KAGF,gBAAAkE,OAAA,cAACyB,MAAAA,IAAAA,GACD,gBAAAzB,OAAA,cAAC0B,QAAAA;IAAKL,WAAU;KAAWlF,EAAE,mBAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAO3C;AAEA,IAAA,oBAAeP;",
6
- "names": ["Plus", "React", "useEffect", "useMemo", "useState", "LayoutAction", "NavigationAction", "parseMetadataResolverPlugin", "useIntentDispatcher", "useResolvePlugin", "create", "getType", "fullyQualifiedId", "useGraph", "SpaceAction", "Button", "toLocalizedString", "useTranslation", "AttentionProvider", "Stack", "nonNullable", "useArrowNavigationGroup", "React", "useCallback", "usePlugin", "useIntentDispatcher", "toLocalizedString", "useTranslation", "getSize", "mx", "CreatorTile", "Icon", "label", "testId", "handleAdd", "onClick", "useCallback", "_", "onKeyDown", "event", "key", "preventDefault", "div", "role", "aria-label", "tabIndex", "className", "mx", "data-testid", "weight", "getSize", "span", "AddSection", "collection", "domAttributes", "useArrowNavigationGroup", "axis", "dispatch", "useIntentDispatcher", "t", "useTranslation", "STACK_PLUGIN", "stackPlugin", "usePlugin", "stackCreators", "provides", "stack", "creators", "creator", "data", "section", "intent", "objects", "views", "StackViewType", "typename", "sections", "id", "length", "map", "type", "icon", "toLocalizedString", "createContext", "useContext", "StackContext", "createContext", "onCollapse", "onNavigate", "onDelete", "onAdd", "useStack", "useContext", "CollapsiblePrimitive", "React", "useState", "Surface", "DropdownMenu", "Icon", "useTranslation", "IconButton", "useAttendableAttributes", "StackItem", "mx", "getSize", "textBlockWidth", "React", "CaretDownUp", "children", "props", "React", "svg", "xmlns", "viewBox", "rect", "width", "height", "fill", "polyline", "points", "stroke", "strokeLinecap", "strokeLinejoin", "strokeWidth", "sectionActionDimensions", "StackSection", "id", "view", "object", "metadata", "icon", "t", "useTranslation", "STACK_PLUGIN", "onNavigate", "onAdd", "onCollapse", "onDelete", "useStack", "optionsMenuOpen", "setOptionsMenuOpen", "useState", "attendableAttrs", "useAttendableAttributes", "React", "Root", "asChild", "open", "collapsed", "onOpenChange", "nextOpen", "StackItem", "item", "role", "classNames", "Heading", "span", "className", "title", "div", "DropdownMenu", "Trigger", "SigilButton", "Icon", "size", "Portal", "Content", "style", "zIndex", "Viewport", "Item", "onClick", "data-testid", "CaretDownUp", "getSize", "Arrow", "IconButton", "iconOnly", "tooltipZIndex", "variant", "label", "Surface", "data", "limit", "placeholder", "toolbar", "h2", "mx", "textBlockWidth", "StackMain", "id", "collection", "dispatch", "useIntentDispatcher", "graph", "useGraph", "t", "useTranslation", "STACK_PLUGIN", "metadataPlugin", "useResolvePlugin", "parseMetadataResolverPlugin", "defaultStack", "useMemo", "create", "StackViewType", "sections", "stack", "views", "typename", "collapsedSections", "setCollapsedSections", "useState", "useEffect", "items", "objects", "filter", "nonNullable", "map", "object", "metadata", "provides", "resolver", "getType", "objectId", "view", "collapsed", "fullyQualifiedId", "title", "toLocalizedString", "findNode", "properties", "label", "handleDelete", "index", "findIndex", "section", "action", "SpaceAction", "REMOVE_OBJECTS", "data", "handleAdd", "position", "LayoutAction", "SET_LAYOUT", "element", "component", "subject", "path", "handleNavigate", "NavigationAction", "OPEN", "activeParts", "main", "SCROLL_INTO_VIEW", "handleCollapse", "prev", "React", "AttentionProvider", "StackContext", "Provider", "value", "onCollapse", "onNavigate", "onDelete", "onAdd", "Stack", "orientation", "size", "separators", "data-testid", "item", "StackSection", "key", "length", "AddSection", "div", "role", "className", "Button", "classNames", "onClick", "Plus", "span"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const STACK_PLUGIN = 'dxos.org/plugin/stack';\nexport const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';\n\nexport default {\n id: STACK_PLUGIN,\n // TODO(wittjosiah): Prevents \"stacks\" language from being exposed to users in settings panel.\n // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.\n name: 'Collections',\n description: 'View collections of objects within the deck.',\n icon: 'ph--stack-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,eAAe;AACrB,IAAMC,qBAAqB;AAElC,IAAA,eAAe;EACbC,IAAIF;;;EAGJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;AACV;",
6
- "names": ["STACK_PLUGIN", "SECTION_IDENTIFIER", "id", "name", "description", "icon", "source"]
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- SECTION_IDENTIFIER,
3
- STACK_PLUGIN,
4
- meta_default
5
- } from "./chunk-DS5KGEJG.mjs";
6
- export {
7
- SECTION_IDENTIFIER,
8
- STACK_PLUGIN,
9
- meta_default as default
10
- };
11
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }