@dxos/plugin-deck 0.6.12-main.78ddbdf → 0.6.12-main.89e9959

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.
@@ -27,6 +27,7 @@ import { Sidebar as MenuIcon } from "@phosphor-icons/react";
27
27
  import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2 } from "react";
28
28
  import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
29
29
  import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useOnTransition, useTranslation as useTranslation5 } from "@dxos/react-ui";
30
+ import { useAttended as useAttended3 } from "@dxos/react-ui-attention";
30
31
  import { Deck } from "@dxos/react-ui-deck";
31
32
  import { getSize } from "@dxos/react-ui-theme";
32
33
 
@@ -118,7 +119,7 @@ import React5 from "react";
118
119
  import { SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3 } from "@dxos/app-framework";
119
120
  import { useGraph as useGraph3 } from "@dxos/plugin-graph";
120
121
  import { Main } from "@dxos/react-ui";
121
- import { createAttendableAttributes, useAttendedIds } from "@dxos/react-ui-attention";
122
+ import { useAttended } from "@dxos/react-ui-attention";
122
123
  import { deckGrid } from "@dxos/react-ui-deck";
123
124
  import { mx as mx2 } from "@dxos/react-ui-theme";
124
125
 
@@ -129,17 +130,7 @@ import { useGraph as useGraph2 } from "@dxos/plugin-graph";
129
130
  import { Icon, Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
130
131
  import { PlankHeading } from "@dxos/react-ui-deck";
131
132
  import { TextTooltip } from "@dxos/react-ui-text-tooltip";
132
- var NodePlankHeading = ({
133
- node,
134
- id,
135
- layoutParts,
136
- layoutPart,
137
- // TODO(wittjosiah): Unused?
138
- layoutEntry,
139
- popoverAnchorId,
140
- pending,
141
- flatDeck
142
- }) => {
133
+ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pending, flatDeck }) => {
143
134
  const { t } = useTranslation(DECK_PLUGIN);
144
135
  const { graph } = useGraph2();
145
136
  const icon = node?.properties?.icon ?? "ph--placeholder--regular";
@@ -173,6 +164,7 @@ var NodePlankHeading = ({
173
164
  classNames: "pie-1 border-b border-separator"
174
165
  }, /* @__PURE__ */ React2.createElement(ActionRoot, null, node ? /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
175
166
  icon,
167
+ related: layoutPart === "complementary",
176
168
  attendableId,
177
169
  triggerLabel: t("actions menu label"),
178
170
  actions: graph.actions(node),
@@ -194,7 +186,8 @@ var NodePlankHeading = ({
194
186
  text: label,
195
187
  onlyWhenTruncating: true
196
188
  }, /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
197
- attendableId: node?.id,
189
+ attendableId,
190
+ related: layoutPart === "complementary",
198
191
  ...pending && {
199
192
  classNames: "text-description"
200
193
  }
@@ -316,13 +309,12 @@ var useLayout = () => useContext(LayoutContext) ?? raise(new Error("Missing Layo
316
309
  // packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
317
310
  var ComplementarySidebar = ({ context, layoutParts, flatDeck }) => {
318
311
  const { popoverAnchorId } = useLayout();
319
- const attended = useAttendedIds();
312
+ const attended = useAttended();
320
313
  const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${context}` : void 0;
321
314
  const { graph } = useGraph3();
322
315
  const node = useNode(graph, id);
323
- const complementaryAttrs = createAttendableAttributes(id?.split(SLUG_PATH_SEPARATOR2)[0] ?? "never");
324
316
  useNodeActionExpander(node);
325
- return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, complementaryAttrs, /* @__PURE__ */ React5.createElement("div", {
317
+ return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, null, /* @__PURE__ */ React5.createElement("div", {
326
318
  role: "none",
327
319
  className: mx2(deckGrid, "grid-cols-1 bs-full")
328
320
  }, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
@@ -335,7 +327,7 @@ var ComplementarySidebar = ({ context, layoutParts, flatDeck }) => {
335
327
  }), node && /* @__PURE__ */ React5.createElement(Surface3, {
336
328
  role: "article",
337
329
  data: {
338
- subject: node.data,
330
+ subject: node.properties.object,
339
331
  part: "complementary",
340
332
  popoverAnchorId
341
333
  },
@@ -407,7 +399,7 @@ import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction2, S
407
399
  import { debounce } from "@dxos/async";
408
400
  import { useGraph as useGraph5 } from "@dxos/plugin-graph";
409
401
  import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
410
- import { createAttendableAttributes as createAttendableAttributes2 } from "@dxos/react-ui-attention";
402
+ import { useAttendableAttributes } from "@dxos/react-ui-attention";
411
403
  import { Plank as NaturalPlank } from "@dxos/react-ui-deck";
412
404
  import { mainIntrinsicSize } from "@dxos/react-ui-theme";
413
405
 
@@ -427,7 +419,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
427
419
  const node = useNode(graph, entry.id);
428
420
  const rootElement = useRef(null);
429
421
  const resizeable = layoutMode === "deck";
430
- const attendableAttrs = createAttendableAttributes2(entry.id);
422
+ const attendableAttrs = useAttendableAttributes(entry.id);
431
423
  const coordinate = {
432
424
  part,
433
425
  entryId: entry.id
@@ -554,8 +546,10 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
554
546
  import React10, { useMemo } from "react";
555
547
  import { openIds, Surface as Surface7 } from "@dxos/app-framework";
556
548
  import { Main as Main2 } from "@dxos/react-ui";
557
- var Sidebar = ({ attention, layoutParts }) => {
549
+ import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
550
+ var Sidebar = ({ layoutParts }) => {
558
551
  const { layoutMode, popoverAnchorId } = useLayout();
552
+ const attended = useAttended2();
559
553
  const activeIds = useMemo(() => {
560
554
  if (layoutMode === "solo") {
561
555
  return new Set(layoutParts?.solo?.map((e) => e.id) ?? []);
@@ -570,11 +564,11 @@ var Sidebar = ({ attention, layoutParts }) => {
570
564
  const navigationData = useMemo(() => ({
571
565
  popoverAnchorId,
572
566
  activeIds,
573
- attended: attention.attended
567
+ attended
574
568
  }), [
575
569
  popoverAnchorId,
576
570
  activeIds,
577
- attention.attended
571
+ attended
578
572
  ]);
579
573
  return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React10.createElement(Surface7, {
580
574
  role: "navigation",
@@ -674,11 +668,12 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
674
668
  };
675
669
 
676
670
  // packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
677
- var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHintsFooter, slots, onDismissToast }) => {
671
+ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHintsFooter, slots, onDismissToast }) => {
678
672
  const context = useLayout();
679
673
  const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
680
674
  const { t } = useTranslation5(DECK_PLUGIN);
681
675
  const { plankSizing } = useDeckContext();
676
+ const attended = useAttended3();
682
677
  const searchPlugin = usePlugin("dxos.org/plugin/search");
683
678
  const fullScreenSlug = useMemo2(() => firstIdInPart(layoutParts, "fullScreen"), [
684
679
  layoutParts
@@ -687,7 +682,7 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
687
682
  const deckRef = useRef2(null);
688
683
  useEffect5(() => {
689
684
  const firstId = layoutMode === "solo" ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
690
- if (attention.attended.size === 0 && firstId) {
685
+ if (attended.length === 0 && firstId) {
691
686
  document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
692
687
  }
693
688
  }, []);
@@ -713,9 +708,7 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
713
708
  }, [
714
709
  layoutMode
715
710
  ]);
716
- const firstAttendedId = useMemo2(() => Array.from(attention.attended ?? [])[0], [
717
- attention.attended
718
- ]);
711
+ const firstAttendedId = attended[0];
719
712
  useEffect5(() => {
720
713
  if (layoutMode === "deck" && firstAttendedId) {
721
714
  }
@@ -799,7 +792,6 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
799
792
  })), /* @__PURE__ */ React13.createElement(Surface9, {
800
793
  role: "notch-end"
801
794
  })), /* @__PURE__ */ React13.createElement(Sidebar, {
802
- attention,
803
795
  layoutParts
804
796
  }), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
805
797
  context: "comments",
@@ -1410,9 +1402,6 @@ var DeckPlugin = ({ observability } = {}) => {
1410
1402
  }, props.children)),
1411
1403
  root: () => {
1412
1404
  return /* @__PURE__ */ React15.createElement(DeckLayout, {
1413
- attention: attentionPlugin?.provides.attention ?? {
1414
- attended: /* @__PURE__ */ new Set()
1415
- },
1416
1405
  layoutParts: location.values.active,
1417
1406
  showHintsFooter: settings.values.showFooter,
1418
1407
  overscroll: settings.values.overscroll,
@@ -1466,7 +1455,7 @@ var DeckPlugin = ({ observability } = {}) => {
1466
1455
  } else {
1467
1456
  log.warn("Invalid layout mode", intent?.data?.layoutMode, {
1468
1457
  F: __dxlog_file,
1469
- L: 411,
1458
+ L: 410,
1470
1459
  S: void 0,
1471
1460
  C: (f, a) => f(...a)
1472
1461
  });