@dxos/plugin-attention 0.7.5-main.499c70c → 0.7.5-main.5ae2ba8

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 (65) hide show
  1. package/dist/lib/browser/chunk-QGHCD7NY.mjs +21 -0
  2. package/dist/lib/browser/chunk-QGHCD7NY.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +54 -45
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/keyboard-DOWPJCCR.mjs +26 -0
  6. package/dist/lib/browser/keyboard-DOWPJCCR.mjs.map +7 -0
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/react-context-VM7VC5YD.mjs +27 -0
  9. package/dist/lib/browser/react-context-VM7VC5YD.mjs.map +7 -0
  10. package/dist/lib/node/{chunk-VEMWITWY.cjs → chunk-5HIEAHDF.cjs} +15 -7
  11. package/dist/lib/node/chunk-5HIEAHDF.cjs.map +7 -0
  12. package/dist/lib/node/index.cjs +46 -40
  13. package/dist/lib/node/index.cjs.map +4 -4
  14. package/dist/lib/node/keyboard-YGKVKJJI.cjs +42 -0
  15. package/dist/lib/node/keyboard-YGKVKJJI.cjs.map +7 -0
  16. package/dist/lib/node/meta.json +1 -1
  17. package/dist/lib/node/react-context-L6PLLZNC.cjs +52 -0
  18. package/dist/lib/node/react-context-L6PLLZNC.cjs.map +7 -0
  19. package/dist/lib/node-esm/chunk-6NERFJ2M.mjs +23 -0
  20. package/dist/lib/node-esm/chunk-6NERFJ2M.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +54 -45
  22. package/dist/lib/node-esm/index.mjs.map +4 -4
  23. package/dist/lib/node-esm/keyboard-JQ7DYGIG.mjs +27 -0
  24. package/dist/lib/node-esm/keyboard-JQ7DYGIG.mjs.map +7 -0
  25. package/dist/lib/node-esm/meta.json +1 -1
  26. package/dist/lib/node-esm/react-context-5SBZKQ6J.mjs +28 -0
  27. package/dist/lib/node-esm/react-context-5SBZKQ6J.mjs.map +7 -0
  28. package/dist/types/src/AttentionPlugin.d.ts +1 -12
  29. package/dist/types/src/AttentionPlugin.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/capabilities.d.ts +6 -0
  31. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/index.d.ts +8 -0
  33. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/keyboard.d.ts +4 -0
  35. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-context.d.ts +8 -0
  37. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  38. package/dist/types/src/events.d.ts +4 -0
  39. package/dist/types/src/events.d.ts.map +1 -0
  40. package/dist/types/src/index.d.ts +4 -2
  41. package/dist/types/src/index.d.ts.map +1 -1
  42. package/dist/types/src/meta.d.ts +1 -2
  43. package/dist/types/src/meta.d.ts.map +1 -1
  44. package/dist/types/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +8 -16
  46. package/src/AttentionPlugin.ts +56 -0
  47. package/src/capabilities/capabilities.ts +13 -0
  48. package/src/capabilities/index.ts +10 -0
  49. package/src/capabilities/keyboard.ts +25 -0
  50. package/src/capabilities/react-context.tsx +34 -0
  51. package/src/events.ts +11 -0
  52. package/src/index.ts +4 -3
  53. package/src/meta.ts +1 -1
  54. package/dist/lib/browser/chunk-56S77L6M.mjs +0 -12
  55. package/dist/lib/browser/chunk-56S77L6M.mjs.map +0 -7
  56. package/dist/lib/browser/meta.mjs +0 -9
  57. package/dist/lib/browser/meta.mjs.map +0 -7
  58. package/dist/lib/node/chunk-VEMWITWY.cjs.map +0 -7
  59. package/dist/lib/node/meta.cjs +0 -30
  60. package/dist/lib/node/meta.cjs.map +0 -7
  61. package/dist/lib/node-esm/chunk-NWBDAVCK.mjs +0 -14
  62. package/dist/lib/node-esm/chunk-NWBDAVCK.mjs.map +0 -7
  63. package/dist/lib/node-esm/meta.mjs +0 -10
  64. package/dist/lib/node-esm/meta.mjs.map +0 -7
  65. package/src/AttentionPlugin.tsx +0 -91
@@ -0,0 +1,21 @@
1
+ // packages/plugins/plugin-attention/src/meta.ts
2
+ var ATTENTION_PLUGIN = "dxos.org/plugin/attention";
3
+ var meta = {
4
+ id: ATTENTION_PLUGIN,
5
+ name: "Attention"
6
+ };
7
+
8
+ // packages/plugins/plugin-attention/src/capabilities/capabilities.ts
9
+ import { defineCapability } from "@dxos/app-framework";
10
+ var AttentionCapabilities;
11
+ (function(AttentionCapabilities2) {
12
+ AttentionCapabilities2.Attention = defineCapability(`${ATTENTION_PLUGIN}/capability/attention`);
13
+ AttentionCapabilities2.Selection = defineCapability(`${ATTENTION_PLUGIN}/capability/selection`);
14
+ })(AttentionCapabilities || (AttentionCapabilities = {}));
15
+
16
+ export {
17
+ ATTENTION_PLUGIN,
18
+ meta,
19
+ AttentionCapabilities
20
+ };
21
+ //# sourceMappingURL=chunk-QGHCD7NY.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../src/capabilities/capabilities.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';\n\nexport const meta = {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n} satisfies PluginMeta;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type SelectionManager, type AttentionManager } from '@dxos/react-ui-attention';\n\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport namespace AttentionCapabilities {\n export const Attention = defineCapability<AttentionManager>(`${ATTENTION_PLUGIN}/capability/attention`);\n export const Selection = defineCapability<SelectionManager>(`${ATTENTION_PLUGIN}/capability/selection`);\n}\n"],
5
+ "mappings": ";AAMO,IAAMA,mBAAmB;AAEzB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;AACR;;;ACPA,SAASC,wBAAwB;;UAKhBC,wBAAAA;yBACFC,YAAYC,iBAAmC,GAAGC,gBAAAA,uBAAuC;yBACzFC,YAAYF,iBAAmC,GAAGC,gBAAAA,uBAAuC;AACxG,GAHiBH,0BAAAA,wBAAAA,CAAAA,EAAAA;",
6
+ "names": ["ATTENTION_PLUGIN", "meta", "id", "name", "defineCapability", "AttentionCapabilities", "Attention", "defineCapability", "ATTENTION_PLUGIN", "Selection"]
7
+ }
@@ -1,47 +1,57 @@
1
1
  import {
2
- meta_default
3
- } from "./chunk-56S77L6M.mjs";
2
+ ATTENTION_PLUGIN,
3
+ AttentionCapabilities,
4
+ meta
5
+ } from "./chunk-QGHCD7NY.mjs";
4
6
 
5
- // packages/plugins/plugin-attention/src/AttentionPlugin.tsx
6
- import { effect } from "@preact/signals-core";
7
- import React from "react";
8
- import { resolvePlugin, parseGraphPlugin } from "@dxos/app-framework";
9
- import { Keyboard } from "@dxos/keyboard";
10
- import { AttentionManager, RootAttentionProvider } from "@dxos/react-ui-attention";
11
- var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
12
- var AttentionPlugin = () => {
13
- const attention = new AttentionManager();
14
- let graphPlugin;
15
- return {
16
- meta: meta_default,
17
- ready: async ({ plugins }) => {
18
- graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
19
- effect(() => {
20
- const id = Array.from(attention.current)[0];
21
- const path = id && graphPlugin?.provides.graph.getPath({
22
- target: id
23
- });
24
- if (path) {
25
- Keyboard.singleton.setCurrentContext(path.join("/"));
26
- }
27
- });
7
+ // packages/plugins/plugin-attention/src/index.ts
8
+ export * from "@dxos/react-ui-attention";
9
+
10
+ // packages/plugins/plugin-attention/src/AttentionPlugin.ts
11
+ import { defineModule, definePlugin, Events, contributes, allOf } from "@dxos/app-framework";
12
+ import { AttentionManager, SelectionManager } from "@dxos/react-ui-attention";
13
+
14
+ // packages/plugins/plugin-attention/src/capabilities/index.ts
15
+ import { lazy } from "@dxos/app-framework";
16
+ var Keyboard = lazy(() => import("./keyboard-DOWPJCCR.mjs"));
17
+ var ReactContext = lazy(() => import("./react-context-VM7VC5YD.mjs"));
18
+
19
+ // packages/plugins/plugin-attention/src/events.ts
20
+ import { defineEvent } from "@dxos/app-framework";
21
+ var AttentionEvents;
22
+ (function(AttentionEvents2) {
23
+ AttentionEvents2.AttentionReady = defineEvent(`${ATTENTION_PLUGIN}/event/attention-ready`);
24
+ })(AttentionEvents || (AttentionEvents = {}));
25
+
26
+ // packages/plugins/plugin-attention/src/AttentionPlugin.ts
27
+ var AttentionPlugin = () => definePlugin(meta, [
28
+ defineModule({
29
+ id: `${meta.id}/module/attention`,
30
+ activatesOn: Events.Startup,
31
+ activatesAfter: [
32
+ AttentionEvents.AttentionReady
33
+ ],
34
+ activate: () => {
35
+ const attention = new AttentionManager();
36
+ const selection = new SelectionManager();
28
37
  setupDevtools(attention);
29
- },
30
- provides: {
31
- attention: {
32
- get attended() {
33
- return attention.current;
34
- },
35
- getAttention: attention.get
36
- },
37
- context: (props) => /* @__PURE__ */ React.createElement(RootAttentionProvider, {
38
- attention,
39
- onChange: (nextAttended) => {
40
- }
41
- }, props.children)
38
+ return [
39
+ contributes(AttentionCapabilities.Attention, attention),
40
+ contributes(AttentionCapabilities.Selection, selection)
41
+ ];
42
42
  }
43
- };
44
- };
43
+ }),
44
+ defineModule({
45
+ id: `${meta.id}/module/react-context`,
46
+ activatesOn: Events.Startup,
47
+ activate: ReactContext
48
+ }),
49
+ defineModule({
50
+ id: `${meta.id}/module/keyboard`,
51
+ activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),
52
+ activate: Keyboard
53
+ })
54
+ ]);
45
55
  var setupDevtools = (attention) => {
46
56
  globalThis.composer ??= {};
47
57
  globalThis.composer.attention = {
@@ -58,12 +68,11 @@ var setupDevtools = (attention) => {
58
68
  }
59
69
  };
60
70
  };
61
-
62
- // packages/plugins/plugin-attention/src/index.ts
63
- var src_default = AttentionPlugin;
64
71
  export {
72
+ ATTENTION_PLUGIN,
73
+ AttentionCapabilities,
74
+ AttentionEvents,
65
75
  AttentionPlugin,
66
- src_default as default,
67
- parseAttentionPlugin
76
+ meta
68
77
  };
69
78
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/AttentionPlugin.tsx", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport React, { type PropsWithChildren } from 'react';\n\nimport {\n type Plugin,\n type GraphProvides,\n resolvePlugin,\n parseGraphPlugin,\n type PluginDefinition,\n} from '@dxos/app-framework';\nimport { Keyboard } from '@dxos/keyboard';\nimport { type Attention, AttentionManager, RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: {\n attended: Readonly<string[]>;\n getAttention: (path: string[]) => Attention;\n };\n};\n\nexport type AttentionPluginProvides = AttentionProvides;\n\nexport const parseAttentionPlugin = (plugin?: Plugin) =>\n typeof (plugin?.provides as any).attention === 'object' ? (plugin as Plugin<AttentionPluginProvides>) : undefined;\n\nexport const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> => {\n const attention = new AttentionManager();\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async ({ plugins }) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.current)[0];\n const path = id && graphPlugin?.provides.graph.getPath({ target: id });\n if (path) {\n Keyboard.singleton.setCurrentContext(path.join('/'));\n }\n });\n\n setupDevtools(attention);\n },\n provides: {\n attention: {\n get attended() {\n return attention.current;\n },\n getAttention: attention.get,\n },\n context: (props: PropsWithChildren) => (\n <RootAttentionProvider\n attention={attention}\n onChange={(nextAttended) => {\n // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?\n // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {\n // layout.values.scrollIntoView = undefined;\n // }\n }}\n >\n {props.children}\n </RootAttentionProvider>\n ),\n },\n };\n};\n\nconst setupDevtools = (attention: AttentionManager) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return attention.current;\n },\n get currentSpace() {\n for (const id of attention.current) {\n const [spaceId, objectId] = id.split(':');\n if (spaceId && objectId && spaceId.length === 33) {\n return spaceId;\n }\n }\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AttentionPlugin } from './AttentionPlugin';\n\nexport default AttentionPlugin;\n\nexport * from './AttentionPlugin';\n"],
5
- "mappings": ";;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,WAAuC;AAE9C,SAGEC,eACAC,wBAEK;AACP,SAASC,gBAAgB;AACzB,SAAyBC,kBAAkBC,6BAA6B;AAajE,IAAMC,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,YAAY,IAAIG,iBAAAA;AACtB,MAAIC;AAEJ,SAAO;IACLC;IACAC,OAAO,OAAO,EAAEC,QAAO,MAAE;AACvBH,oBAAcI,cAAcD,SAASE,gBAAAA;AAErCC,aAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKb,UAAUc,OAAO,EAAE,CAAA;AACzC,cAAMC,OAAOJ,MAAMP,aAAaL,SAASiB,MAAMC,QAAQ;UAAEC,QAAQP;QAAG,CAAA;AACpE,YAAII,MAAM;AACRI,mBAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcvB,SAAAA;IAChB;IACAD,UAAU;MACRC,WAAW;QACT,IAAIwB,WAAW;AACb,iBAAOxB,UAAUc;QACnB;QACAW,cAAczB,UAAU0B;MAC1B;MACAC,SAAS,CAACC,UACR,sBAAA,cAACC,uBAAAA;QACC7B;QACA8B,UAAU,CAACC,iBAAAA;QAKX;SAECH,MAAMI,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMT,gBAAgB,CAACvB,cAAAA;AACpBiC,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASlC,YAAY;IACvC,IAAIwB,WAAW;AACb,aAAOxB,UAAUc;IACnB;IACA,IAAIqB,eAAe;AACjB,iBAAWxB,MAAMX,UAAUc,SAAS;AAClC,cAAM,CAACsB,SAASC,QAAAA,IAAY1B,GAAG2B,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;;;ACpFA,IAAA,cAAeI;",
6
- "names": ["effect", "React", "resolvePlugin", "parseGraphPlugin", "Keyboard", "AttentionManager", "RootAttentionProvider", "parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "AttentionManager", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "current", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "attended", "getAttention", "get", "context", "props", "RootAttentionProvider", "onChange", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length", "AttentionPlugin"]
3
+ "sources": ["../../../src/index.ts", "../../../src/AttentionPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/events.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@dxos/react-ui-attention';\n\nexport * from './AttentionPlugin';\nexport { AttentionCapabilities } from './capabilities';\nexport * from './events';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineModule, definePlugin, Events, contributes, allOf } from '@dxos/app-framework';\nimport { AttentionManager, SelectionManager } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities, Keyboard, ReactContext } from './capabilities';\nimport { AttentionEvents } from './events';\nimport { meta } from './meta';\n\nexport const AttentionPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/attention`,\n activatesOn: Events.Startup,\n activatesAfter: [AttentionEvents.AttentionReady],\n activate: () => {\n const attention = new AttentionManager();\n const selection = new SelectionManager();\n setupDevtools(attention);\n return [\n contributes(AttentionCapabilities.Attention, attention),\n contributes(AttentionCapabilities.Selection, selection),\n ];\n },\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/keyboard`,\n activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),\n activate: Keyboard,\n }),\n ]);\n\nconst setupDevtools = (attention: AttentionManager) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return attention.current;\n },\n get currentSpace() {\n for (const id of attention.current) {\n const [spaceId, objectId] = id.split(':');\n if (spaceId && objectId && spaceId.length === 33) {\n return spaceId;\n }\n }\n },\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Keyboard = lazy(() => import('./keyboard'));\nexport const ReactContext = lazy(() => import('./react-context'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineEvent } from '@dxos/app-framework';\n\nimport { ATTENTION_PLUGIN } from './meta';\n\nexport namespace AttentionEvents {\n export const AttentionReady = defineEvent(`${ATTENTION_PLUGIN}/event/attention-ready`);\n}\n"],
5
+ "mappings": ";;;;;;;AAIA,cAAc;;;ACAd,SAASA,cAAcC,cAAcC,QAAQC,aAAaC,aAAa;AACvE,SAASC,kBAAkBC,wBAAwB;;;ACDnD,SAASC,YAAY;AAEd,IAAMC,WAAWC,KAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,eAAeD,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ACH9C,SAASE,mBAAmB;;UAIXC,kBAAAA;mBACFC,iBAAiBC,YAAY,GAAGC,gBAAAA,wBAAwC;AACvF,GAFiBH,oBAAAA,kBAAAA,CAAAA,EAAAA;;;AFGV,IAAMI,kBAAkB,MAC7BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,gBAAgB;MAACC,gBAAgBC;;IACjCC,UAAU,MAAA;AACR,YAAMC,YAAY,IAAIC,iBAAAA;AACtB,YAAMC,YAAY,IAAIC,iBAAAA;AACtBC,oBAAcJ,SAAAA;AACd,aAAO;QACLK,YAAYC,sBAAsBC,WAAWP,SAAAA;QAC7CK,YAAYC,sBAAsBE,WAAWN,SAAAA;;IAEjD;EACF,CAAA;EACAX,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBI,UAAUU;EACZ,CAAA;EACAlB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaiB,MAAMhB,OAAOiB,eAAed,gBAAgBC,cAAc;IACvEC,UAAUa;EACZ,CAAA;CACD;AAEH,IAAMR,gBAAgB,CAACJ,cAAAA;AACpBa,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASd,YAAY;IACvC,IAAIe,WAAW;AACb,aAAOf,UAAUgB;IACnB;IACA,IAAIC,eAAe;AACjB,iBAAWzB,MAAMQ,UAAUgB,SAAS;AAClC,cAAM,CAACE,SAASC,QAAAA,IAAY3B,GAAG4B,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;",
6
+ "names": ["defineModule", "definePlugin", "Events", "contributes", "allOf", "AttentionManager", "SelectionManager", "lazy", "Keyboard", "lazy", "ReactContext", "defineEvent", "AttentionEvents", "AttentionReady", "defineEvent", "ATTENTION_PLUGIN", "AttentionPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesAfter", "AttentionEvents", "AttentionReady", "activate", "attention", "AttentionManager", "selection", "SelectionManager", "setupDevtools", "contributes", "AttentionCapabilities", "Attention", "Selection", "ReactContext", "allOf", "AppGraphReady", "Keyboard", "globalThis", "composer", "attended", "current", "currentSpace", "spaceId", "objectId", "split", "length"]
7
7
  }
@@ -0,0 +1,26 @@
1
+ import {
2
+ AttentionCapabilities
3
+ } from "./chunk-QGHCD7NY.mjs";
4
+
5
+ // packages/plugins/plugin-attention/src/capabilities/keyboard.ts
6
+ import { effect } from "@preact/signals-core";
7
+ import { Capabilities as AppCapabilities, contributes } from "@dxos/app-framework";
8
+ import { Keyboard } from "@dxos/keyboard";
9
+ var keyboard_default = (context) => {
10
+ const { graph } = context.requestCapability(AppCapabilities.AppGraph);
11
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
12
+ const unsubscribe = effect(() => {
13
+ const id = Array.from(attention.current)[0];
14
+ const path = id && graph.getPath({
15
+ target: id
16
+ });
17
+ if (path) {
18
+ Keyboard.singleton.setCurrentContext(path.join("/"));
19
+ }
20
+ });
21
+ return contributes(AppCapabilities.Null, null, () => unsubscribe());
22
+ };
23
+ export {
24
+ keyboard_default as default
25
+ };
26
+ //# sourceMappingURL=keyboard-DOWPJCCR.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/keyboard.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\n\nimport { Capabilities as AppCapabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Keyboard } from '@dxos/keyboard';\n\nimport { AttentionCapabilities } from './capabilities';\n\nexport default (context: PluginsContext) => {\n const { graph } = context.requestCapability(AppCapabilities.AppGraph);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n\n const unsubscribe = effect(() => {\n const id = Array.from(attention.current)[0];\n const path = id && graph.getPath({ target: id });\n if (path) {\n Keyboard.singleton.setCurrentContext(path.join('/'));\n }\n });\n\n return contributes(AppCapabilities.Null, null, () => unsubscribe());\n};\n"],
5
+ "mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,gBAAgBC,iBAAiBC,mBAAwC;AAClF,SAASC,gBAAgB;AAIzB,IAAA,mBAAe,CAACC,YAAAA;AACd,QAAM,EAAEC,MAAK,IAAKD,QAAQE,kBAAkBC,gBAAgBC,QAAQ;AACpE,QAAMC,YAAYL,QAAQE,kBAAkBI,sBAAsBC,SAAS;AAE3E,QAAMC,cAAcC,OAAO,MAAA;AACzB,UAAMC,KAAKC,MAAMC,KAAKP,UAAUQ,OAAO,EAAE,CAAA;AACzC,UAAMC,OAAOJ,MAAMT,MAAMc,QAAQ;MAAEC,QAAQN;IAAG,CAAA;AAC9C,QAAII,MAAM;AACRG,eAASC,UAAUC,kBAAkBL,KAAKM,KAAK,GAAA,CAAA;IACjD;EACF,CAAA;AAEA,SAAOC,YAAYlB,gBAAgBmB,MAAM,MAAM,MAAMd,YAAAA,CAAAA;AACvD;",
6
+ "names": ["effect", "Capabilities", "AppCapabilities", "contributes", "Keyboard", "context", "graph", "requestCapability", "AppCapabilities", "AppGraph", "attention", "AttentionCapabilities", "Attention", "unsubscribe", "effect", "id", "Array", "from", "current", "path", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "contributes", "Null"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":973,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/AttentionPlugin.tsx":{"bytes":8611,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-attention/src/index.ts":{"bytes":821,"imports":[{"path":"packages/plugins/plugin-attention/src/AttentionPlugin.tsx","kind":"import-statement","original":"./AttentionPlugin"},{"path":"packages/plugins/plugin-attention/src/AttentionPlugin.tsx","kind":"import-statement","original":"./AttentionPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-attention/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4713},"packages/plugins/plugin-attention/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-56S77L6M.mjs","kind":"import-statement"},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true}],"exports":["AttentionPlugin","default","parseAttentionPlugin"],"entryPoint":"packages/plugins/plugin-attention/src/index.ts","inputs":{"packages/plugins/plugin-attention/src/AttentionPlugin.tsx":{"bytesInOutput":1666},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":1984},"packages/plugins/plugin-attention/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-attention/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-56S77L6M.mjs","kind":"import-statement"}],"exports":["ATTENTION_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-attention/src/meta.ts","inputs":{},"bytes":167},"packages/plugins/plugin-attention/dist/lib/browser/chunk-56S77L6M.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":462},"packages/plugins/plugin-attention/dist/lib/browser/chunk-56S77L6M.mjs":{"imports":[],"exports":["ATTENTION_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytesInOutput":120}},"bytes":261}}}
1
+ {"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":1010,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/capabilities/capabilities.ts":{"bytes":1857,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-attention/src/capabilities/keyboard.ts":{"bytes":3380,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"}],"format":"esm"},"packages/plugins/plugin-attention/src/capabilities/react-context.tsx":{"bytes":4255,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-attention/src/capabilities/index.ts":{"bytes":1147,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-attention/src/capabilities/keyboard.ts","kind":"dynamic-import","original":"./keyboard"},{"path":"packages/plugins/plugin-attention/src/capabilities/react-context.tsx","kind":"dynamic-import","original":"./react-context"}],"format":"esm"},"packages/plugins/plugin-attention/src/events.ts":{"bytes":1295,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-attention/src/AttentionPlugin.ts":{"bytes":6694,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-attention/src/events.ts","kind":"import-statement","original":"./events"},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-attention/src/index.ts":{"bytes":1020,"imports":[{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/src/AttentionPlugin.ts","kind":"import-statement","original":"./AttentionPlugin"},{"path":"packages/plugins/plugin-attention/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-attention/src/events.ts","kind":"import-statement","original":"./events"},{"path":"packages/plugins/plugin-attention/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-attention/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4523},"packages/plugins/plugin-attention/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-QGHCD7NY.mjs","kind":"import-statement"},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-attention/dist/lib/browser/keyboard-DOWPJCCR.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-attention/dist/lib/browser/react-context-VM7VC5YD.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["ATTENTION_PLUGIN","AttentionCapabilities","AttentionEvents","AttentionPlugin","meta"],"entryPoint":"packages/plugins/plugin-attention/src/index.ts","inputs":{"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":42},"packages/plugins/plugin-attention/src/AttentionPlugin.ts":{"bytesInOutput":1384},"packages/plugins/plugin-attention/src/capabilities/index.ts":{"bytesInOutput":177},"packages/plugins/plugin-attention/src/events.ts":{"bytesInOutput":243}},"bytes":2364},"packages/plugins/plugin-attention/dist/lib/browser/keyboard-DOWPJCCR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1788},"packages/plugins/plugin-attention/dist/lib/browser/keyboard-DOWPJCCR.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-QGHCD7NY.mjs","kind":"import-statement"},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-attention/src/capabilities/keyboard.ts","inputs":{"packages/plugins/plugin-attention/src/capabilities/keyboard.ts":{"bytesInOutput":677}},"bytes":897},"packages/plugins/plugin-attention/dist/lib/browser/react-context-VM7VC5YD.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2098},"packages/plugins/plugin-attention/dist/lib/browser/react-context-VM7VC5YD.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-QGHCD7NY.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-attention/src/capabilities/react-context.tsx","inputs":{"packages/plugins/plugin-attention/src/capabilities/react-context.tsx":{"bytesInOutput":701}},"bytes":957},"packages/plugins/plugin-attention/dist/lib/browser/chunk-QGHCD7NY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1287},"packages/plugins/plugin-attention/dist/lib/browser/chunk-QGHCD7NY.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["ATTENTION_PLUGIN","AttentionCapabilities","meta"],"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytesInOutput":112},"packages/plugins/plugin-attention/src/capabilities/capabilities.ts":{"bytesInOutput":376}},"bytes":717}}}
@@ -0,0 +1,27 @@
1
+ import {
2
+ ATTENTION_PLUGIN,
3
+ AttentionCapabilities
4
+ } from "./chunk-QGHCD7NY.mjs";
5
+
6
+ // packages/plugins/plugin-attention/src/capabilities/react-context.tsx
7
+ import React from "react";
8
+ import { Capabilities, contributes, useCapability } from "@dxos/app-framework";
9
+ import { RootAttentionProvider, SelectionProvider } from "@dxos/react-ui-attention";
10
+ var react_context_default = () => contributes(Capabilities.ReactContext, {
11
+ id: ATTENTION_PLUGIN,
12
+ context: (props) => {
13
+ const attention = useCapability(AttentionCapabilities.Attention);
14
+ const selection = useCapability(AttentionCapabilities.Selection);
15
+ return /* @__PURE__ */ React.createElement(RootAttentionProvider, {
16
+ attention,
17
+ onChange: (nextAttended) => {
18
+ }
19
+ }, /* @__PURE__ */ React.createElement(SelectionProvider, {
20
+ selection
21
+ }, props.children));
22
+ }
23
+ });
24
+ export {
25
+ react_context_default as default
26
+ };
27
+ //# sourceMappingURL=react-context-VM7VC5YD.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/react-context.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Capabilities, contributes, useCapability } from '@dxos/app-framework';\nimport { RootAttentionProvider, SelectionProvider } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities } from './capabilities';\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactContext, {\n id: ATTENTION_PLUGIN,\n context: (props: PropsWithChildren) => {\n const attention = useCapability(AttentionCapabilities.Attention);\n const selection = useCapability(AttentionCapabilities.Selection);\n\n return (\n <RootAttentionProvider\n attention={attention}\n onChange={(nextAttended) => {\n // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?\n // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {\n // layout.values.scrollIntoView = undefined;\n // }\n }}\n >\n <SelectionProvider selection={selection}>{props.children}</SelectionProvider>\n </RootAttentionProvider>\n );\n },\n });\n"],
5
+ "mappings": ";;;;;;AAIA,OAAOA,WAAuC;AAE9C,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,uBAAuBC,yBAAyB;AAKzD,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,IAAIC;EACJC,SAAS,CAACC,UAAAA;AACR,UAAMC,YAAYC,cAAcC,sBAAsBC,SAAS;AAC/D,UAAMC,YAAYH,cAAcC,sBAAsBG,SAAS;AAE/D,WACE,sBAAA,cAACC,uBAAAA;MACCN;MACAO,UAAU,CAACC,iBAAAA;MAKX;OAEA,sBAAA,cAACC,mBAAAA;MAAkBL;OAAuBL,MAAMW,QAAQ,CAAA;EAG9D;AACF,CAAA;",
6
+ "names": ["React", "Capabilities", "contributes", "useCapability", "RootAttentionProvider", "SelectionProvider", "contributes", "Capabilities", "ReactContext", "id", "ATTENTION_PLUGIN", "context", "props", "attention", "useCapability", "AttentionCapabilities", "Attention", "selection", "Selection", "RootAttentionProvider", "onChange", "nextAttended", "SelectionProvider", "children"]
7
+ }
@@ -16,20 +16,28 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_VEMWITWY_exports = {};
20
- __export(chunk_VEMWITWY_exports, {
19
+ var chunk_5HIEAHDF_exports = {};
20
+ __export(chunk_5HIEAHDF_exports, {
21
21
  ATTENTION_PLUGIN: () => ATTENTION_PLUGIN,
22
- meta_default: () => meta_default
22
+ AttentionCapabilities: () => AttentionCapabilities,
23
+ meta: () => meta
23
24
  });
24
- module.exports = __toCommonJS(chunk_VEMWITWY_exports);
25
+ module.exports = __toCommonJS(chunk_5HIEAHDF_exports);
26
+ var import_app_framework = require("@dxos/app-framework");
25
27
  var ATTENTION_PLUGIN = "dxos.org/plugin/attention";
26
- var meta_default = {
28
+ var meta = {
27
29
  id: ATTENTION_PLUGIN,
28
30
  name: "Attention"
29
31
  };
32
+ var AttentionCapabilities;
33
+ (function(AttentionCapabilities2) {
34
+ AttentionCapabilities2.Attention = (0, import_app_framework.defineCapability)(`${ATTENTION_PLUGIN}/capability/attention`);
35
+ AttentionCapabilities2.Selection = (0, import_app_framework.defineCapability)(`${ATTENTION_PLUGIN}/capability/selection`);
36
+ })(AttentionCapabilities || (AttentionCapabilities = {}));
30
37
  // Annotate the CommonJS export names for ESM import in node:
31
38
  0 && (module.exports = {
32
39
  ATTENTION_PLUGIN,
33
- meta_default
40
+ AttentionCapabilities,
41
+ meta
34
42
  });
35
- //# sourceMappingURL=chunk-VEMWITWY.cjs.map
43
+ //# sourceMappingURL=chunk-5HIEAHDF.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../src/capabilities/capabilities.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';\n\nexport const meta = {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n} satisfies PluginMeta;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type SelectionManager, type AttentionManager } from '@dxos/react-ui-attention';\n\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport namespace AttentionCapabilities {\n export const Attention = defineCapability<AttentionManager>(`${ATTENTION_PLUGIN}/capability/attention`);\n export const Selection = defineCapability<SelectionManager>(`${ATTENTION_PLUGIN}/capability/selection`);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;ACIA,2BAAiC;ADE1B,IAAMA,mBAAmB;AAEzB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;AACR;;UCFiBC,wBAAAA;yBACFC,gBAAYC,uCAAmC,GAAGN,gBAAAA,uBAAuC;yBACzFO,gBAAYD,uCAAmC,GAAGN,gBAAAA,uBAAuC;AACxG,GAHiBI,0BAAAA,wBAAAA,CAAAA,EAAAA;",
6
+ "names": ["ATTENTION_PLUGIN", "meta", "id", "name", "AttentionCapabilities", "Attention", "defineCapability", "Selection"]
7
+ }
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -28,51 +29,53 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
30
  var node_exports = {};
30
31
  __export(node_exports, {
32
+ ATTENTION_PLUGIN: () => import_chunk_5HIEAHDF.ATTENTION_PLUGIN,
33
+ AttentionCapabilities: () => import_chunk_5HIEAHDF.AttentionCapabilities,
34
+ AttentionEvents: () => AttentionEvents,
31
35
  AttentionPlugin: () => AttentionPlugin,
32
- default: () => src_default,
33
- parseAttentionPlugin: () => parseAttentionPlugin
36
+ meta: () => import_chunk_5HIEAHDF.meta
34
37
  });
35
38
  module.exports = __toCommonJS(node_exports);
36
- var import_chunk_VEMWITWY = require("./chunk-VEMWITWY.cjs");
37
- var import_signals_core = require("@preact/signals-core");
38
- var import_react = __toESM(require("react"));
39
+ var import_chunk_5HIEAHDF = require("./chunk-5HIEAHDF.cjs");
40
+ __reExport(node_exports, require("@dxos/react-ui-attention"), module.exports);
39
41
  var import_app_framework = require("@dxos/app-framework");
40
- var import_keyboard = require("@dxos/keyboard");
41
42
  var import_react_ui_attention = require("@dxos/react-ui-attention");
42
- var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
43
- var AttentionPlugin = () => {
44
- const attention = new import_react_ui_attention.AttentionManager();
45
- let graphPlugin;
46
- return {
47
- meta: import_chunk_VEMWITWY.meta_default,
48
- ready: async ({ plugins }) => {
49
- graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
50
- (0, import_signals_core.effect)(() => {
51
- const id = Array.from(attention.current)[0];
52
- const path = id && graphPlugin?.provides.graph.getPath({
53
- target: id
54
- });
55
- if (path) {
56
- import_keyboard.Keyboard.singleton.setCurrentContext(path.join("/"));
57
- }
58
- });
43
+ var import_app_framework2 = require("@dxos/app-framework");
44
+ var import_app_framework3 = require("@dxos/app-framework");
45
+ var Keyboard = (0, import_app_framework2.lazy)(() => import("./keyboard-YGKVKJJI.cjs"));
46
+ var ReactContext = (0, import_app_framework2.lazy)(() => import("./react-context-L6PLLZNC.cjs"));
47
+ var AttentionEvents;
48
+ (function(AttentionEvents2) {
49
+ AttentionEvents2.AttentionReady = (0, import_app_framework3.defineEvent)(`${import_chunk_5HIEAHDF.ATTENTION_PLUGIN}/event/attention-ready`);
50
+ })(AttentionEvents || (AttentionEvents = {}));
51
+ var AttentionPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_5HIEAHDF.meta, [
52
+ (0, import_app_framework.defineModule)({
53
+ id: `${import_chunk_5HIEAHDF.meta.id}/module/attention`,
54
+ activatesOn: import_app_framework.Events.Startup,
55
+ activatesAfter: [
56
+ AttentionEvents.AttentionReady
57
+ ],
58
+ activate: () => {
59
+ const attention = new import_react_ui_attention.AttentionManager();
60
+ const selection = new import_react_ui_attention.SelectionManager();
59
61
  setupDevtools(attention);
60
- },
61
- provides: {
62
- attention: {
63
- get attended() {
64
- return attention.current;
65
- },
66
- getAttention: attention.get
67
- },
68
- context: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.RootAttentionProvider, {
69
- attention,
70
- onChange: (nextAttended) => {
71
- }
72
- }, props.children)
62
+ return [
63
+ (0, import_app_framework.contributes)(import_chunk_5HIEAHDF.AttentionCapabilities.Attention, attention),
64
+ (0, import_app_framework.contributes)(import_chunk_5HIEAHDF.AttentionCapabilities.Selection, selection)
65
+ ];
73
66
  }
74
- };
75
- };
67
+ }),
68
+ (0, import_app_framework.defineModule)({
69
+ id: `${import_chunk_5HIEAHDF.meta.id}/module/react-context`,
70
+ activatesOn: import_app_framework.Events.Startup,
71
+ activate: ReactContext
72
+ }),
73
+ (0, import_app_framework.defineModule)({
74
+ id: `${import_chunk_5HIEAHDF.meta.id}/module/keyboard`,
75
+ activatesOn: (0, import_app_framework.allOf)(import_app_framework.Events.AppGraphReady, AttentionEvents.AttentionReady),
76
+ activate: Keyboard
77
+ })
78
+ ]);
76
79
  var setupDevtools = (attention) => {
77
80
  globalThis.composer ??= {};
78
81
  globalThis.composer.attention = {
@@ -89,10 +92,13 @@ var setupDevtools = (attention) => {
89
92
  }
90
93
  };
91
94
  };
92
- var src_default = AttentionPlugin;
93
95
  // Annotate the CommonJS export names for ESM import in node:
94
96
  0 && (module.exports = {
97
+ ATTENTION_PLUGIN,
98
+ AttentionCapabilities,
99
+ AttentionEvents,
95
100
  AttentionPlugin,
96
- parseAttentionPlugin
101
+ meta,
102
+ ...require("@dxos/react-ui-attention")
97
103
  });
98
104
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/AttentionPlugin.tsx", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport React, { type PropsWithChildren } from 'react';\n\nimport {\n type Plugin,\n type GraphProvides,\n resolvePlugin,\n parseGraphPlugin,\n type PluginDefinition,\n} from '@dxos/app-framework';\nimport { Keyboard } from '@dxos/keyboard';\nimport { type Attention, AttentionManager, RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: {\n attended: Readonly<string[]>;\n getAttention: (path: string[]) => Attention;\n };\n};\n\nexport type AttentionPluginProvides = AttentionProvides;\n\nexport const parseAttentionPlugin = (plugin?: Plugin) =>\n typeof (plugin?.provides as any).attention === 'object' ? (plugin as Plugin<AttentionPluginProvides>) : undefined;\n\nexport const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> => {\n const attention = new AttentionManager();\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async ({ plugins }) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.current)[0];\n const path = id && graphPlugin?.provides.graph.getPath({ target: id });\n if (path) {\n Keyboard.singleton.setCurrentContext(path.join('/'));\n }\n });\n\n setupDevtools(attention);\n },\n provides: {\n attention: {\n get attended() {\n return attention.current;\n },\n getAttention: attention.get,\n },\n context: (props: PropsWithChildren) => (\n <RootAttentionProvider\n attention={attention}\n onChange={(nextAttended) => {\n // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?\n // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {\n // layout.values.scrollIntoView = undefined;\n // }\n }}\n >\n {props.children}\n </RootAttentionProvider>\n ),\n },\n };\n};\n\nconst setupDevtools = (attention: AttentionManager) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return attention.current;\n },\n get currentSpace() {\n for (const id of attention.current) {\n const [spaceId, objectId] = id.split(':');\n if (spaceId && objectId && spaceId.length === 33) {\n return spaceId;\n }\n }\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AttentionPlugin } from './AttentionPlugin';\n\nexport default AttentionPlugin;\n\nexport * from './AttentionPlugin';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAAuB;AACvB,mBAA8C;AAE9C,2BAMO;AACP,sBAAyB;AACzB,gCAAwE;AAajE,IAAMA,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,YAAY,IAAIG,2CAAAA;AACtB,MAAIC;AAEJ,SAAO;IACLC,MAAAA;IACAC,OAAO,OAAO,EAAEC,QAAO,MAAE;AACvBH,wBAAcI,oCAAcD,SAASE,qCAAAA;AAErCC,sCAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKb,UAAUc,OAAO,EAAE,CAAA;AACzC,cAAMC,OAAOJ,MAAMP,aAAaL,SAASiB,MAAMC,QAAQ;UAAEC,QAAQP;QAAG,CAAA;AACpE,YAAII,MAAM;AACRI,mCAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcvB,SAAAA;IAChB;IACAD,UAAU;MACRC,WAAW;QACT,IAAIwB,WAAW;AACb,iBAAOxB,UAAUc;QACnB;QACAW,cAAczB,UAAU0B;MAC1B;MACAC,SAAS,CAACC,UACR,6BAAAC,QAAA,cAACC,iDAAAA;QACC9B;QACA+B,UAAU,CAACC,iBAAAA;QAKX;SAECJ,MAAMK,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMV,gBAAgB,CAACvB,cAAAA;AACpBkC,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASnC,YAAY;IACvC,IAAIwB,WAAW;AACb,aAAOxB,UAAUc;IACnB;IACA,IAAIsB,eAAe;AACjB,iBAAWzB,MAAMX,UAAUc,SAAS;AAClC,cAAM,CAACuB,SAASC,QAAAA,IAAY3B,GAAG4B,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;ACpFA,IAAA,cAAenC;",
6
- "names": ["parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "AttentionManager", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "current", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "attended", "getAttention", "get", "context", "props", "React", "RootAttentionProvider", "onChange", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length"]
3
+ "sources": ["../../../src/index.ts", "../../../src/AttentionPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/events.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@dxos/react-ui-attention';\n\nexport * from './AttentionPlugin';\nexport { AttentionCapabilities } from './capabilities';\nexport * from './events';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineModule, definePlugin, Events, contributes, allOf } from '@dxos/app-framework';\nimport { AttentionManager, SelectionManager } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities, Keyboard, ReactContext } from './capabilities';\nimport { AttentionEvents } from './events';\nimport { meta } from './meta';\n\nexport const AttentionPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/attention`,\n activatesOn: Events.Startup,\n activatesAfter: [AttentionEvents.AttentionReady],\n activate: () => {\n const attention = new AttentionManager();\n const selection = new SelectionManager();\n setupDevtools(attention);\n return [\n contributes(AttentionCapabilities.Attention, attention),\n contributes(AttentionCapabilities.Selection, selection),\n ];\n },\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/keyboard`,\n activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),\n activate: Keyboard,\n }),\n ]);\n\nconst setupDevtools = (attention: AttentionManager) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return attention.current;\n },\n get currentSpace() {\n for (const id of attention.current) {\n const [spaceId, objectId] = id.split(':');\n if (spaceId && objectId && spaceId.length === 33) {\n return spaceId;\n }\n }\n },\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Keyboard = lazy(() => import('./keyboard'));\nexport const ReactContext = lazy(() => import('./react-context'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineEvent } from '@dxos/app-framework';\n\nimport { ATTENTION_PLUGIN } from './meta';\n\nexport namespace AttentionEvents {\n export const AttentionReady = defineEvent(`${ATTENTION_PLUGIN}/event/attention-ready`);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAc;ACAd,2BAAuE;AACvE,gCAAmD;ACDnD,IAAAA,wBAAqB;ACArB,IAAAA,wBAA4B;ADErB,IAAMC,eAAWC,4BAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,mBAAeD,4BAAK,MAAM,OAAO,8BAAA,CAAA;;UCC7BE,kBAAAA;mBACFC,qBAAiBC,mCAAY,GAAGC,sCAAAA,wBAAwC;AACvF,GAFiBH,oBAAAA,kBAAAA,CAAAA,EAAAA;AFGV,IAAMI,kBAAkB,UAC7BC,mCAAaC,4BAAM;MACjBC,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOC;IACpBC,gBAAgB;MAACZ,gBAAgBC;;IACjCY,UAAU,MAAA;AACR,YAAMC,YAAY,IAAIC,2CAAAA;AACtB,YAAMC,YAAY,IAAIC,2CAAAA;AACtBC,oBAAcJ,SAAAA;AACd,aAAO;YACLK,kCAAYC,4CAAsBC,WAAWP,SAAAA;YAC7CK,kCAAYC,4CAAsBE,WAAWN,SAAAA;;IAEjD;EACF,CAAA;MACAT,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOC;IACpBE,UAAUd;EACZ,CAAA;MACAQ,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,iBAAac,4BAAMb,4BAAOc,eAAexB,gBAAgBC,cAAc;IACvEY,UAAUhB;EACZ,CAAA;CACD;AAEH,IAAMqB,gBAAgB,CAACJ,cAAAA;AACpBW,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASZ,YAAY;IACvC,IAAIa,WAAW;AACb,aAAOb,UAAUc;IACnB;IACA,IAAIC,eAAe;AACjB,iBAAWrB,MAAMM,UAAUc,SAAS;AAClC,cAAM,CAACE,SAASC,QAAAA,IAAYvB,GAAGwB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;",
6
+ "names": ["import_app_framework", "Keyboard", "lazy", "ReactContext", "AttentionEvents", "AttentionReady", "defineEvent", "ATTENTION_PLUGIN", "AttentionPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesAfter", "activate", "attention", "AttentionManager", "selection", "SelectionManager", "setupDevtools", "contributes", "AttentionCapabilities", "Attention", "Selection", "allOf", "AppGraphReady", "globalThis", "composer", "attended", "current", "currentSpace", "spaceId", "objectId", "split", "length"]
7
7
  }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var keyboard_YGKVKJJI_exports = {};
20
+ __export(keyboard_YGKVKJJI_exports, {
21
+ default: () => keyboard_default
22
+ });
23
+ module.exports = __toCommonJS(keyboard_YGKVKJJI_exports);
24
+ var import_chunk_5HIEAHDF = require("./chunk-5HIEAHDF.cjs");
25
+ var import_signals_core = require("@preact/signals-core");
26
+ var import_app_framework = require("@dxos/app-framework");
27
+ var import_keyboard = require("@dxos/keyboard");
28
+ var keyboard_default = (context) => {
29
+ const { graph } = context.requestCapability(import_app_framework.Capabilities.AppGraph);
30
+ const attention = context.requestCapability(import_chunk_5HIEAHDF.AttentionCapabilities.Attention);
31
+ const unsubscribe = (0, import_signals_core.effect)(() => {
32
+ const id = Array.from(attention.current)[0];
33
+ const path = id && graph.getPath({
34
+ target: id
35
+ });
36
+ if (path) {
37
+ import_keyboard.Keyboard.singleton.setCurrentContext(path.join("/"));
38
+ }
39
+ });
40
+ return (0, import_app_framework.contributes)(import_app_framework.Capabilities.Null, null, () => unsubscribe());
41
+ };
42
+ //# sourceMappingURL=keyboard-YGKVKJJI.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/keyboard.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\n\nimport { Capabilities as AppCapabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Keyboard } from '@dxos/keyboard';\n\nimport { AttentionCapabilities } from './capabilities';\n\nexport default (context: PluginsContext) => {\n const { graph } = context.requestCapability(AppCapabilities.AppGraph);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n\n const unsubscribe = effect(() => {\n const id = Array.from(attention.current)[0];\n const path = id && graph.getPath({ target: id });\n if (path) {\n Keyboard.singleton.setCurrentContext(path.join('/'));\n }\n });\n\n return contributes(AppCapabilities.Null, null, () => unsubscribe());\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAAuB;AAEvB,2BAAkF;AAClF,sBAAyB;AAIzB,IAAA,mBAAe,CAACA,YAAAA;AACd,QAAM,EAAEC,MAAK,IAAKD,QAAQE,kBAAkBC,qBAAAA,aAAgBC,QAAQ;AACpE,QAAMC,YAAYL,QAAQE,kBAAkBI,4CAAsBC,SAAS;AAE3E,QAAMC,kBAAcC,4BAAO,MAAA;AACzB,UAAMC,KAAKC,MAAMC,KAAKP,UAAUQ,OAAO,EAAE,CAAA;AACzC,UAAMC,OAAOJ,MAAMT,MAAMc,QAAQ;MAAEC,QAAQN;IAAG,CAAA;AAC9C,QAAII,MAAM;AACRG,+BAASC,UAAUC,kBAAkBL,KAAKM,KAAK,GAAA,CAAA;IACjD;EACF,CAAA;AAEA,aAAOC,kCAAYlB,qBAAAA,aAAgBmB,MAAM,MAAM,MAAMd,YAAAA,CAAAA;AACvD;",
6
+ "names": ["context", "graph", "requestCapability", "AppCapabilities", "AppGraph", "attention", "AttentionCapabilities", "Attention", "unsubscribe", "effect", "id", "Array", "from", "current", "path", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "contributes", "Null"]
7
+ }