@dxos/plugin-attention 0.7.5-main.9cb18ac → 0.7.5-main.9d2a38b

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-TBISRVXA.mjs +20 -0
  2. package/dist/lib/browser/chunk-TBISRVXA.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +50 -45
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/keyboard-QID5LXKS.mjs +26 -0
  6. package/dist/lib/browser/keyboard-QID5LXKS.mjs.map +7 -0
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/react-context-YJB443IX.mjs +24 -0
  9. package/dist/lib/browser/react-context-YJB443IX.mjs.map +7 -0
  10. package/dist/lib/node/{chunk-VEMWITWY.cjs → chunk-5B4YWZQ5.cjs} +14 -7
  11. package/dist/lib/node/chunk-5B4YWZQ5.cjs.map +7 -0
  12. package/dist/lib/node/index.cjs +42 -40
  13. package/dist/lib/node/index.cjs.map +4 -4
  14. package/dist/lib/node/keyboard-ZALVEHH3.cjs +42 -0
  15. package/dist/lib/node/keyboard-ZALVEHH3.cjs.map +7 -0
  16. package/dist/lib/node/meta.json +1 -1
  17. package/dist/lib/node/react-context-JOSQYVWS.cjs +49 -0
  18. package/dist/lib/node/react-context-JOSQYVWS.cjs.map +7 -0
  19. package/dist/lib/node-esm/chunk-EMYCEZDW.mjs +22 -0
  20. package/dist/lib/node-esm/chunk-EMYCEZDW.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +50 -45
  22. package/dist/lib/node-esm/index.mjs.map +4 -4
  23. package/dist/lib/node-esm/keyboard-SZNNVXFG.mjs +27 -0
  24. package/dist/lib/node-esm/keyboard-SZNNVXFG.mjs.map +7 -0
  25. package/dist/lib/node-esm/meta.json +1 -1
  26. package/dist/lib/node-esm/react-context-6RDXU5HM.mjs +25 -0
  27. package/dist/lib/node-esm/react-context-6RDXU5HM.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 +5 -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 +7 -16
  46. package/src/AttentionPlugin.ts +52 -0
  47. package/src/capabilities/capabilities.ts +12 -0
  48. package/src/capabilities/index.ts +10 -0
  49. package/src/capabilities/keyboard.ts +25 -0
  50. package/src/capabilities/react-context.tsx +33 -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,49 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var react_context_JOSQYVWS_exports = {};
30
+ __export(react_context_JOSQYVWS_exports, {
31
+ default: () => react_context_default
32
+ });
33
+ module.exports = __toCommonJS(react_context_JOSQYVWS_exports);
34
+ var import_chunk_5B4YWZQ5 = require("./chunk-5B4YWZQ5.cjs");
35
+ var import_react = __toESM(require("react"));
36
+ var import_app_framework = require("@dxos/app-framework");
37
+ var import_react_ui_attention = require("@dxos/react-ui-attention");
38
+ var react_context_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.ReactContext, {
39
+ id: import_chunk_5B4YWZQ5.ATTENTION_PLUGIN,
40
+ context: (props) => {
41
+ const attention = (0, import_app_framework.useCapability)(import_chunk_5B4YWZQ5.AttentionCapabilities.Attention);
42
+ return /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.RootAttentionProvider, {
43
+ attention,
44
+ onChange: (nextAttended) => {
45
+ }
46
+ }, props.children);
47
+ }
48
+ });
49
+ //# sourceMappingURL=react-context-JOSQYVWS.cjs.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 as AppCapabilities, contributes, useCapability } from '@dxos/app-framework';\nimport { RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities } from './capabilities';\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(AppCapabilities.ReactContext, {\n id: ATTENTION_PLUGIN,\n context: (props: PropsWithChildren) => {\n const attention = useCapability(AttentionCapabilities.Attention);\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 {props.children}\n </RootAttentionProvider>\n );\n },\n });\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA8C;AAE9C,2BAA4E;AAC5E,gCAAsC;AAKtC,IAAA,wBAAe,UACbA,kCAAYC,qBAAAA,aAAgBC,cAAc;EACxCC,IAAIC;EACJC,SAAS,CAACC,UAAAA;AACR,UAAMC,gBAAYC,oCAAcC,4CAAsBC,SAAS;AAE/D,WACE,6BAAAC,QAAA,cAACC,iDAAAA;MACCL;MACAM,UAAU,CAACC,iBAAAA;MAKX;OAECR,MAAMS,QAAQ;EAGrB;AACF,CAAA;",
6
+ "names": ["contributes", "AppCapabilities", "ReactContext", "id", "ATTENTION_PLUGIN", "context", "props", "attention", "useCapability", "AttentionCapabilities", "Attention", "React", "RootAttentionProvider", "onChange", "nextAttended", "children"]
7
+ }
@@ -0,0 +1,22 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/plugin-attention/src/meta.ts
4
+ var ATTENTION_PLUGIN = "dxos.org/plugin/attention";
5
+ var meta = {
6
+ id: ATTENTION_PLUGIN,
7
+ name: "Attention"
8
+ };
9
+
10
+ // packages/plugins/plugin-attention/src/capabilities/capabilities.ts
11
+ import { defineCapability } from "@dxos/app-framework";
12
+ var AttentionCapabilities;
13
+ (function(AttentionCapabilities2) {
14
+ AttentionCapabilities2.Attention = defineCapability(`${ATTENTION_PLUGIN}/capability/attention`);
15
+ })(AttentionCapabilities || (AttentionCapabilities = {}));
16
+
17
+ export {
18
+ ATTENTION_PLUGIN,
19
+ meta,
20
+ AttentionCapabilities
21
+ };
22
+ //# sourceMappingURL=chunk-EMYCEZDW.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 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}\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;AACxG,GAFiBH,0BAAAA,wBAAAA,CAAAA,EAAAA;",
6
+ "names": ["ATTENTION_PLUGIN", "meta", "id", "name", "defineCapability", "AttentionCapabilities", "Attention", "defineCapability", "ATTENTION_PLUGIN"]
7
+ }
@@ -1,48 +1,54 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
- meta_default
4
- } from "./chunk-NWBDAVCK.mjs";
3
+ ATTENTION_PLUGIN,
4
+ AttentionCapabilities,
5
+ meta
6
+ } from "./chunk-EMYCEZDW.mjs";
5
7
 
6
- // packages/plugins/plugin-attention/src/AttentionPlugin.tsx
7
- import { effect } from "@preact/signals-core";
8
- import React from "react";
9
- import { resolvePlugin, parseGraphPlugin } from "@dxos/app-framework";
10
- import { Keyboard } from "@dxos/keyboard";
11
- import { AttentionManager, RootAttentionProvider } from "@dxos/react-ui-attention";
12
- var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
13
- var AttentionPlugin = () => {
14
- const attention = new AttentionManager();
15
- let graphPlugin;
16
- return {
17
- meta: meta_default,
18
- ready: async ({ plugins }) => {
19
- graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
20
- effect(() => {
21
- const id = Array.from(attention.current)[0];
22
- const path = id && graphPlugin?.provides.graph.getPath({
23
- target: id
24
- });
25
- if (path) {
26
- Keyboard.singleton.setCurrentContext(path.join("/"));
27
- }
28
- });
8
+ // packages/plugins/plugin-attention/src/index.ts
9
+ export * from "@dxos/react-ui-attention";
10
+
11
+ // packages/plugins/plugin-attention/src/AttentionPlugin.ts
12
+ import { defineModule, definePlugin, Events, contributes, allOf } from "@dxos/app-framework";
13
+ import { AttentionManager } from "@dxos/react-ui-attention";
14
+
15
+ // packages/plugins/plugin-attention/src/capabilities/index.ts
16
+ import { lazy } from "@dxos/app-framework";
17
+ var Keyboard = lazy(() => import("./keyboard-SZNNVXFG.mjs"));
18
+ var ReactContext = lazy(() => import("./react-context-6RDXU5HM.mjs"));
19
+
20
+ // packages/plugins/plugin-attention/src/events.ts
21
+ import { defineEvent } from "@dxos/app-framework";
22
+ var AttentionEvents;
23
+ (function(AttentionEvents2) {
24
+ AttentionEvents2.AttentionReady = defineEvent(`${ATTENTION_PLUGIN}/event/attention-ready`);
25
+ })(AttentionEvents || (AttentionEvents = {}));
26
+
27
+ // packages/plugins/plugin-attention/src/AttentionPlugin.ts
28
+ var AttentionPlugin = () => definePlugin(meta, [
29
+ defineModule({
30
+ id: `${meta.id}/module/attention`,
31
+ activatesOn: Events.Startup,
32
+ activatesAfter: [
33
+ AttentionEvents.AttentionReady
34
+ ],
35
+ activate: () => {
36
+ const attention = new AttentionManager();
29
37
  setupDevtools(attention);
30
- },
31
- provides: {
32
- attention: {
33
- get attended() {
34
- return attention.current;
35
- },
36
- getAttention: attention.get
37
- },
38
- context: (props) => /* @__PURE__ */ React.createElement(RootAttentionProvider, {
39
- attention,
40
- onChange: (nextAttended) => {
41
- }
42
- }, props.children)
38
+ return contributes(AttentionCapabilities.Attention, attention);
43
39
  }
44
- };
45
- };
40
+ }),
41
+ defineModule({
42
+ id: `${meta.id}/module/react-context`,
43
+ activatesOn: Events.Startup,
44
+ activate: ReactContext
45
+ }),
46
+ defineModule({
47
+ id: `${meta.id}/module/keyboard`,
48
+ activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),
49
+ activate: Keyboard
50
+ })
51
+ ]);
46
52
  var setupDevtools = (attention) => {
47
53
  globalThis.composer ??= {};
48
54
  globalThis.composer.attention = {
@@ -59,12 +65,11 @@ var setupDevtools = (attention) => {
59
65
  }
60
66
  };
61
67
  };
62
-
63
- // packages/plugins/plugin-attention/src/index.ts
64
- var src_default = AttentionPlugin;
65
68
  export {
69
+ ATTENTION_PLUGIN,
70
+ AttentionCapabilities,
71
+ AttentionEvents,
66
72
  AttentionPlugin,
67
- src_default as default,
68
- parseAttentionPlugin
73
+ meta
69
74
  };
70
75
  //# 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 } 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 setupDevtools(attention);\n return contributes(AttentionCapabilities.Attention, attention);\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,wBAAwB;;;ACDjC,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;AACtBC,oBAAcF,SAAAA;AACd,aAAOG,YAAYC,sBAAsBC,WAAWL,SAAAA;IACtD;EACF,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBI,UAAUO;EACZ,CAAA;EACAf,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAac,MAAMb,OAAOc,eAAeX,gBAAgBC,cAAc;IACvEC,UAAUU;EACZ,CAAA;CACD;AAEH,IAAMP,gBAAgB,CAACF,cAAAA;AACpBU,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASX,YAAY;IACvC,IAAIY,WAAW;AACb,aAAOZ,UAAUa;IACnB;IACA,IAAIC,eAAe;AACjB,iBAAWtB,MAAMQ,UAAUa,SAAS;AAClC,cAAM,CAACE,SAASC,QAAAA,IAAYxB,GAAGyB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;",
6
+ "names": ["defineModule", "definePlugin", "Events", "contributes", "allOf", "AttentionManager", "lazy", "Keyboard", "lazy", "ReactContext", "defineEvent", "AttentionEvents", "AttentionReady", "defineEvent", "ATTENTION_PLUGIN", "AttentionPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesAfter", "AttentionEvents", "AttentionReady", "activate", "attention", "AttentionManager", "setupDevtools", "contributes", "AttentionCapabilities", "Attention", "ReactContext", "allOf", "AppGraphReady", "Keyboard", "globalThis", "composer", "attended", "current", "currentSpace", "spaceId", "objectId", "split", "length"]
7
7
  }
@@ -0,0 +1,27 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ AttentionCapabilities
4
+ } from "./chunk-EMYCEZDW.mjs";
5
+
6
+ // packages/plugins/plugin-attention/src/capabilities/keyboard.ts
7
+ import { effect } from "@preact/signals-core";
8
+ import { Capabilities as AppCapabilities, contributes } from "@dxos/app-framework";
9
+ import { Keyboard } from "@dxos/keyboard";
10
+ var keyboard_default = (context) => {
11
+ const { graph } = context.requestCapability(AppCapabilities.AppGraph);
12
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
13
+ const unsubscribe = effect(() => {
14
+ const id = Array.from(attention.current)[0];
15
+ const path = id && graph.getPath({
16
+ target: id
17
+ });
18
+ if (path) {
19
+ Keyboard.singleton.setCurrentContext(path.join("/"));
20
+ }
21
+ });
22
+ return contributes(AppCapabilities.Null, null, () => unsubscribe());
23
+ };
24
+ export {
25
+ keyboard_default as default
26
+ };
27
+ //# sourceMappingURL=keyboard-SZNNVXFG.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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4714},"packages/plugins/plugin-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-NWBDAVCK.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":2076},"packages/plugins/plugin-attention/dist/lib/node-esm/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-attention/dist/lib/node-esm/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-NWBDAVCK.mjs","kind":"import-statement"}],"exports":["ATTENTION_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-attention/src/meta.ts","inputs":{},"bytes":259},"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-NWBDAVCK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":464},"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-NWBDAVCK.mjs":{"imports":[],"exports":["ATTENTION_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytesInOutput":120}},"bytes":354}}}
1
+ {"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":1010,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/capabilities/capabilities.ts":{"bytes":1497,"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":3768,"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":6105,"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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4213},"packages/plugins/plugin-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-EMYCEZDW.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/node-esm/keyboard-SZNNVXFG.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/react-context-6RDXU5HM.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":1235},"packages/plugins/plugin-attention/src/capabilities/index.ts":{"bytesInOutput":177},"packages/plugins/plugin-attention/src/events.ts":{"bytesInOutput":243}},"bytes":2307},"packages/plugins/plugin-attention/dist/lib/node-esm/keyboard-SZNNVXFG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1789},"packages/plugins/plugin-attention/dist/lib/node-esm/keyboard-SZNNVXFG.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-EMYCEZDW.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":989},"packages/plugins/plugin-attention/dist/lib/node-esm/react-context-6RDXU5HM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1852},"packages/plugins/plugin-attention/dist/lib/node-esm/react-context-6RDXU5HM.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-EMYCEZDW.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":553}},"bytes":901},"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-EMYCEZDW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1104},"packages/plugins/plugin-attention/dist/lib/node-esm/chunk-EMYCEZDW.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":277}},"bytes":711}}}
@@ -0,0 +1,25 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ ATTENTION_PLUGIN,
4
+ AttentionCapabilities
5
+ } from "./chunk-EMYCEZDW.mjs";
6
+
7
+ // packages/plugins/plugin-attention/src/capabilities/react-context.tsx
8
+ import React from "react";
9
+ import { Capabilities as AppCapabilities, contributes, useCapability } from "@dxos/app-framework";
10
+ import { RootAttentionProvider } from "@dxos/react-ui-attention";
11
+ var react_context_default = () => contributes(AppCapabilities.ReactContext, {
12
+ id: ATTENTION_PLUGIN,
13
+ context: (props) => {
14
+ const attention = useCapability(AttentionCapabilities.Attention);
15
+ return /* @__PURE__ */ React.createElement(RootAttentionProvider, {
16
+ attention,
17
+ onChange: (nextAttended) => {
18
+ }
19
+ }, props.children);
20
+ }
21
+ });
22
+ export {
23
+ react_context_default as default
24
+ };
25
+ //# sourceMappingURL=react-context-6RDXU5HM.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 as AppCapabilities, contributes, useCapability } from '@dxos/app-framework';\nimport { RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities } from './capabilities';\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(AppCapabilities.ReactContext, {\n id: ATTENTION_PLUGIN,\n context: (props: PropsWithChildren) => {\n const attention = useCapability(AttentionCapabilities.Attention);\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 {props.children}\n </RootAttentionProvider>\n );\n },\n });\n"],
5
+ "mappings": ";;;;;;;AAIA,OAAOA,WAAuC;AAE9C,SAASC,gBAAgBC,iBAAiBC,aAAaC,qBAAqB;AAC5E,SAASC,6BAA6B;AAKtC,IAAA,wBAAe,MACbC,YAAYC,gBAAgBC,cAAc;EACxCC,IAAIC;EACJC,SAAS,CAACC,UAAAA;AACR,UAAMC,YAAYC,cAAcC,sBAAsBC,SAAS;AAE/D,WACE,sBAAA,cAACC,uBAAAA;MACCJ;MACAK,UAAU,CAACC,iBAAAA;MAKX;OAECP,MAAMQ,QAAQ;EAGrB;AACF,CAAA;",
6
+ "names": ["React", "Capabilities", "AppCapabilities", "contributes", "useCapability", "RootAttentionProvider", "contributes", "AppCapabilities", "ReactContext", "id", "ATTENTION_PLUGIN", "context", "props", "attention", "useCapability", "AttentionCapabilities", "Attention", "RootAttentionProvider", "onChange", "nextAttended", "children"]
7
+ }
@@ -1,13 +1,2 @@
1
- import { type Plugin, type PluginDefinition } from '@dxos/app-framework';
2
- import { type Attention } from '@dxos/react-ui-attention';
3
- type AttentionProvides = {
4
- attention: {
5
- attended: Readonly<string[]>;
6
- getAttention: (path: string[]) => Attention;
7
- };
8
- };
9
- export type AttentionPluginProvides = AttentionProvides;
10
- export declare const parseAttentionPlugin: (plugin?: Plugin) => Plugin<AttentionProvides> | undefined;
11
- export declare const AttentionPlugin: () => PluginDefinition<AttentionPluginProvides>;
12
- export {};
1
+ export declare const AttentionPlugin: () => import("@dxos/app-framework").Plugin;
13
2
  //# sourceMappingURL=AttentionPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttentionPlugin.d.ts","sourceRoot":"","sources":["../../../src/AttentionPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,MAAM,EAIX,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,0BAA0B,CAAC;AAInG,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE;QACT,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAS,CAAC;KAC7C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAExD,eAAO,MAAM,oBAAoB,YAAa,MAAM,0CAC+D,CAAC;AAEpH,eAAO,MAAM,eAAe,QAAO,gBAAgB,CAAC,uBAAuB,CAyC1E,CAAC"}
1
+ {"version":3,"file":"AttentionPlugin.d.ts","sourceRoot":"","sources":["../../../src/AttentionPlugin.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,4CAsBxB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type AttentionManager } from '@dxos/react-ui-attention';
2
+ export declare namespace AttentionCapabilities {
3
+ const Attention: import("@dxos/app-framework").InterfaceDef<AttentionManager>;
4
+ }
5
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/capabilities.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,yBAAiB,qBAAqB,CAAC;IAC9B,MAAM,SAAS,8DAAiF,CAAC;CACzG"}
@@ -0,0 +1,8 @@
1
+ export declare const Keyboard: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<import("@dxos/app-framework").Capability<null>>;
2
+ export declare const ReactContext: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<Readonly<{
3
+ id: string;
4
+ dependsOn?: string[];
5
+ context: import("react").FC<import("react").PropsWithChildren>;
6
+ }>>>;
7
+ export * from './capabilities';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,+HAAmC,CAAC;AACzD,eAAO,MAAM,YAAY;;;;IAAwC,CAAC;AAElE,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type PluginsContext } from '@dxos/app-framework';
2
+ declare const _default: (context: PluginsContext) => import("@dxos/app-framework").Capability<null>;
3
+ export default _default;
4
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/keyboard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;kCAK/E,cAAc;AAAvC,wBAaE"}
@@ -0,0 +1,8 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ declare const _default: () => import("@dxos/app-framework").Capability<Readonly<{
3
+ id: string;
4
+ dependsOn?: string[];
5
+ context: React.FC<PropsWithChildren>;
6
+ }>>;
7
+ export default _default;
8
+ //# sourceMappingURL=react-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-context.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-context.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;;;;;;AAQtD,wBAoBK"}
@@ -0,0 +1,4 @@
1
+ export declare namespace AttentionEvents {
2
+ const AttentionReady: import("@dxos/app-framework").ActivationEvent;
3
+ }
4
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/events.ts"],"names":[],"mappings":"AAQA,yBAAiB,eAAe,CAAC;IACxB,MAAM,cAAc,+CAA2D,CAAC;CACxF"}
@@ -1,4 +1,6 @@
1
- import { AttentionPlugin } from './AttentionPlugin';
2
- export default AttentionPlugin;
1
+ export * from '@dxos/react-ui-attention';
3
2
  export * from './AttentionPlugin';
3
+ export { AttentionCapabilities } from './capabilities';
4
+ export * from './events';
5
+ export * from './meta';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAe,eAAe,CAAC;AAE/B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
@@ -1,7 +1,6 @@
1
1
  export declare const ATTENTION_PLUGIN = "dxos.org/plugin/attention";
2
- declare const _default: {
2
+ export declare const meta: {
3
3
  id: string;
4
4
  name: string;
5
5
  };
6
- export default _default;
7
6
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;;;;;AAE5D,wBAGuB"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAE5D,eAAO,MAAM,IAAI;;;CAGK,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.2"}
1
+ {"version":"5.7.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-attention",
3
- "version": "0.7.5-main.9cb18ac",
3
+ "version": "0.7.5-main.9d2a38b",
4
4
  "description": "Plugin for attention",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,20 +12,11 @@
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs",
14
14
  "node": "./dist/lib/node-esm/index.mjs"
15
- },
16
- "./meta": {
17
- "types": "./dist/types/src/meta.d.ts",
18
- "browser": "./dist/lib/browser/meta.mjs",
19
- "node": "./dist/lib/node-esm/meta.mjs"
20
15
  }
21
16
  },
22
17
  "types": "dist/types/src/index.d.ts",
23
18
  "typesVersions": {
24
- "*": {
25
- "meta": [
26
- "dist/types/src/meta.d.ts"
27
- ]
28
- }
19
+ "*": {}
29
20
  },
30
21
  "files": [
31
22
  "dist",
@@ -33,11 +24,11 @@
33
24
  ],
34
25
  "dependencies": {
35
26
  "@preact/signals-core": "^1.6.0",
36
- "@dxos/app-framework": "0.7.5-main.9cb18ac",
37
- "@dxos/echo-schema": "0.7.5-main.9cb18ac",
38
- "@dxos/keyboard": "0.7.5-main.9cb18ac",
39
- "@dxos/echo-signals": "0.7.5-main.9cb18ac",
40
- "@dxos/react-ui-attention": "0.7.5-main.9cb18ac"
27
+ "@dxos/app-framework": "0.7.5-main.9d2a38b",
28
+ "@dxos/echo-schema": "0.7.5-main.9d2a38b",
29
+ "@dxos/keyboard": "0.7.5-main.9d2a38b",
30
+ "@dxos/echo-signals": "0.7.5-main.9d2a38b",
31
+ "@dxos/react-ui-attention": "0.7.5-main.9d2a38b"
41
32
  },
42
33
  "devDependencies": {
43
34
  "@types/react": "~18.2.0",
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineModule, definePlugin, Events, contributes, allOf } from '@dxos/app-framework';
6
+ import { AttentionManager } from '@dxos/react-ui-attention';
7
+
8
+ import { AttentionCapabilities, Keyboard, ReactContext } from './capabilities';
9
+ import { AttentionEvents } from './events';
10
+ import { meta } from './meta';
11
+
12
+ export const AttentionPlugin = () =>
13
+ definePlugin(meta, [
14
+ defineModule({
15
+ id: `${meta.id}/module/attention`,
16
+ activatesOn: Events.Startup,
17
+ activatesAfter: [AttentionEvents.AttentionReady],
18
+ activate: () => {
19
+ const attention = new AttentionManager();
20
+ setupDevtools(attention);
21
+ return contributes(AttentionCapabilities.Attention, attention);
22
+ },
23
+ }),
24
+ defineModule({
25
+ id: `${meta.id}/module/react-context`,
26
+ activatesOn: Events.Startup,
27
+ activate: ReactContext,
28
+ }),
29
+ defineModule({
30
+ id: `${meta.id}/module/keyboard`,
31
+ activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),
32
+ activate: Keyboard,
33
+ }),
34
+ ]);
35
+
36
+ const setupDevtools = (attention: AttentionManager) => {
37
+ (globalThis as any).composer ??= {};
38
+
39
+ (globalThis as any).composer.attention = {
40
+ get attended() {
41
+ return attention.current;
42
+ },
43
+ get currentSpace() {
44
+ for (const id of attention.current) {
45
+ const [spaceId, objectId] = id.split(':');
46
+ if (spaceId && objectId && spaceId.length === 33) {
47
+ return spaceId;
48
+ }
49
+ }
50
+ },
51
+ };
52
+ };
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineCapability } from '@dxos/app-framework';
6
+ import { type AttentionManager } from '@dxos/react-ui-attention';
7
+
8
+ import { ATTENTION_PLUGIN } from '../meta';
9
+
10
+ export namespace AttentionCapabilities {
11
+ export const Attention = defineCapability<AttentionManager>(`${ATTENTION_PLUGIN}/capability/attention`);
12
+ }
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { lazy } from '@dxos/app-framework';
6
+
7
+ export const Keyboard = lazy(() => import('./keyboard'));
8
+ export const ReactContext = lazy(() => import('./react-context'));
9
+
10
+ export * from './capabilities';