@dxos/plugin-attention 0.6.13-main.548ca8d → 0.6.13-staging.1e988a3

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.
@@ -9,4 +9,4 @@ export {
9
9
  ATTENTION_PLUGIN,
10
10
  meta_default
11
11
  };
12
- //# sourceMappingURL=chunk-56S77L6M.mjs.map
12
+ //# sourceMappingURL=chunk-OH3BP6UG.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';\n\nexport default {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n};\n"],
5
+ "mappings": ";AAIO,IAAMA,mBAAmB;AAEhC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
+ "names": ["ATTENTION_PLUGIN", "id", "name"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  meta_default
3
- } from "./chunk-56S77L6M.mjs";
3
+ } from "./chunk-OH3BP6UG.mjs";
4
4
 
5
5
  // packages/plugins/plugin-attention/src/AttentionPlugin.tsx
6
6
  import { effect } from "@preact/signals-core";
@@ -8,11 +8,11 @@ import React from "react";
8
8
  import { resolvePlugin, parseGraphPlugin } from "@dxos/app-framework";
9
9
  import { create } from "@dxos/echo-schema";
10
10
  import { Keyboard } from "@dxos/keyboard";
11
- import { RootAttentionProvider } from "@dxos/react-ui-attention";
11
+ import { AttentionProvider } from "@dxos/react-ui-attention";
12
12
  var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
13
13
  var AttentionPlugin = () => {
14
14
  const attention = create({
15
- attended: []
15
+ attended: /* @__PURE__ */ new Set()
16
16
  });
17
17
  let graphPlugin;
18
18
  return {
@@ -32,9 +32,10 @@ var AttentionPlugin = () => {
32
32
  },
33
33
  provides: {
34
34
  attention,
35
- context: (props) => /* @__PURE__ */ React.createElement(RootAttentionProvider, {
36
- attention,
37
- onChange: (nextAttended) => {
35
+ context: (props) => /* @__PURE__ */ React.createElement(AttentionProvider, {
36
+ attended: attention.attended,
37
+ onChangeAttend: (nextAttended) => {
38
+ attention.attended = nextAttended;
38
39
  }
39
40
  }, props.children)
40
41
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { create, type ReactiveObject } from '@dxos/echo-schema';\nimport { Keyboard } from '@dxos/keyboard';\nimport { type Attention, RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: Readonly<Attention>;\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 = create<Attention>({ attended: [] });\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async (plugins: any) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.attended ?? [])[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 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: ReactiveObject<Attention>) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return [...(attention.attended ?? [])];\n },\n get currentSpace() {\n for (const id of attention.attended ?? []) {\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,cAAmC;AAC5C,SAASC,gBAAgB;AACzB,SAAyBC,6BAA6B;AAU/C,IAAMC,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,YAAYG,OAAkB;IAAEC,UAAU,CAAA;EAAG,CAAA;AACnD,MAAIC;AAEJ,SAAO;IACLC;IACAC,OAAO,OAAOC,YAAAA;AACZH,oBAAcI,cAAcD,SAASE,gBAAAA;AAErCC,aAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKd,UAAUI,YAAY,CAAA,CAAE,EAAE,CAAA;AAChD,cAAMW,OAAOH,MAAMP,aAAaN,SAASiB,MAAMC,QAAQ;UAAEC,QAAQN;QAAG,CAAA;AACpE,YAAIG,MAAM;AACRI,mBAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcvB,SAAAA;IAChB;IACAD,UAAU;MACRC;MACAwB,SAAS,CAACC,UACR,sBAAA,cAACC,uBAAAA;QACC1B;QACA2B,UAAU,CAACC,iBAAAA;QAKX;SAECH,MAAMI,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMN,gBAAgB,CAACvB,cAAAA;AACpB8B,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAAS/B,YAAY;IACvC,IAAII,WAAW;AACb,aAAO;WAAKJ,UAAUI,YAAY,CAAA;;IACpC;IACA,IAAI4B,eAAe;AACjB,iBAAWpB,MAAMZ,UAAUI,YAAY,CAAA,GAAI;AACzC,cAAM,CAAC6B,SAASC,QAAAA,IAAYtB,GAAGuB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;;;AC7EA,IAAA,cAAeI;",
6
- "names": ["effect", "React", "resolvePlugin", "parseGraphPlugin", "create", "Keyboard", "RootAttentionProvider", "parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "context", "props", "RootAttentionProvider", "onChange", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length", "AttentionPlugin"]
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 Attention,\n type GraphProvides,\n resolvePlugin,\n parseGraphPlugin,\n type PluginDefinition,\n} from '@dxos/app-framework';\nimport { create, type ReactiveObject } from '@dxos/echo-schema';\nimport { Keyboard } from '@dxos/keyboard';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: Attention;\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 = create<Attention>({\n attended: new Set(),\n });\n\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async (plugins: any) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.attended ?? [])[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 context: (props: PropsWithChildren) => (\n <AttentionProvider\n attended={attention.attended}\n onChangeAttend={(nextAttended) => {\n attention.attended = nextAttended;\n\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 </AttentionProvider>\n ),\n },\n };\n};\n\nconst setupDevtools = (attention: ReactiveObject<Attention>) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return [...(attention.attended ?? [])];\n },\n get currentSpace() {\n for (const id of attention.attended ?? []) {\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,SAIEC,eACAC,wBAEK;AACP,SAASC,cAAmC;AAC5C,SAASC,gBAAgB;AACzB,SAASC,yBAAyB;AAU3B,IAAMC,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,YAAYG,OAAkB;IAClCC,UAAU,oBAAIC,IAAAA;EAChB,CAAA;AAEA,MAAIC;AAEJ,SAAO;IACLC;IACAC,OAAO,OAAOC,YAAAA;AACZH,oBAAcI,cAAcD,SAASE,gBAAAA;AAErCC,aAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKf,UAAUI,YAAY,CAAA,CAAE,EAAE,CAAA;AAChD,cAAMY,OAAOH,MAAMP,aAAaP,SAASkB,MAAMC,QAAQ;UAAEC,QAAQN;QAAG,CAAA;AACpE,YAAIG,MAAM;AACRI,mBAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcxB,SAAAA;IAChB;IACAD,UAAU;MACRC;MACAyB,SAAS,CAACC,UACR,sBAAA,cAACC,mBAAAA;QACCvB,UAAUJ,UAAUI;QACpBwB,gBAAgB,CAACC,iBAAAA;AACf7B,oBAAUI,WAAWyB;QAMvB;SAECH,MAAMI,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMN,gBAAgB,CAACxB,cAAAA;AACpB+B,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAAShC,YAAY;IACvC,IAAII,WAAW;AACb,aAAO;WAAKJ,UAAUI,YAAY,CAAA;;IACpC;IACA,IAAI6B,eAAe;AACjB,iBAAWpB,MAAMb,UAAUI,YAAY,CAAA,GAAI;AACzC,cAAM,CAAC8B,SAASC,QAAAA,IAAYtB,GAAGuB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;;;ACnFA,IAAA,cAAeI;",
6
+ "names": ["effect", "React", "resolvePlugin", "parseGraphPlugin", "create", "Keyboard", "AttentionProvider", "parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "Set", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "context", "props", "AttentionProvider", "onChangeAttend", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length", "AttentionPlugin"]
7
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":8327,"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/echo-schema","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":4543},"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/echo-schema","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":1619},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":1937},"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":865,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/AttentionPlugin.tsx":{"bytes":8551,"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/echo-schema","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":4656},"packages/plugins/plugin-attention/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/browser/chunk-OH3BP6UG.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/echo-schema","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":1704},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":2022},"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-OH3BP6UG.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-OH3BP6UG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":383},"packages/plugins/plugin-attention/dist/lib/browser/chunk-OH3BP6UG.mjs":{"imports":[],"exports":["ATTENTION_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytesInOutput":120}},"bytes":261}}}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ATTENTION_PLUGIN,
3
3
  meta_default
4
- } from "./chunk-56S77L6M.mjs";
4
+ } from "./chunk-OH3BP6UG.mjs";
5
5
  export {
6
6
  ATTENTION_PLUGIN,
7
7
  meta_default as default
@@ -16,12 +16,12 @@ 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_F2QM2H7J_exports = {};
20
+ __export(chunk_F2QM2H7J_exports, {
21
21
  ATTENTION_PLUGIN: () => ATTENTION_PLUGIN,
22
22
  meta_default: () => meta_default
23
23
  });
24
- module.exports = __toCommonJS(chunk_VEMWITWY_exports);
24
+ module.exports = __toCommonJS(chunk_F2QM2H7J_exports);
25
25
  var ATTENTION_PLUGIN = "dxos.org/plugin/attention";
26
26
  var meta_default = {
27
27
  id: ATTENTION_PLUGIN,
@@ -32,4 +32,4 @@ var meta_default = {
32
32
  ATTENTION_PLUGIN,
33
33
  meta_default
34
34
  });
35
- //# sourceMappingURL=chunk-VEMWITWY.cjs.map
35
+ //# sourceMappingURL=chunk-F2QM2H7J.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';\n\nexport default {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAMA,mBAAmB;AAEhC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
+ "names": ["ATTENTION_PLUGIN", "id", "name"]
7
+ }
@@ -33,7 +33,7 @@ __export(node_exports, {
33
33
  parseAttentionPlugin: () => parseAttentionPlugin
34
34
  });
35
35
  module.exports = __toCommonJS(node_exports);
36
- var import_chunk_VEMWITWY = require("./chunk-VEMWITWY.cjs");
36
+ var import_chunk_F2QM2H7J = require("./chunk-F2QM2H7J.cjs");
37
37
  var import_signals_core = require("@preact/signals-core");
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_app_framework = require("@dxos/app-framework");
@@ -43,11 +43,11 @@ var import_react_ui_attention = require("@dxos/react-ui-attention");
43
43
  var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
44
44
  var AttentionPlugin = () => {
45
45
  const attention = (0, import_echo_schema.create)({
46
- attended: []
46
+ attended: /* @__PURE__ */ new Set()
47
47
  });
48
48
  let graphPlugin;
49
49
  return {
50
- meta: import_chunk_VEMWITWY.meta_default,
50
+ meta: import_chunk_F2QM2H7J.meta_default,
51
51
  ready: async (plugins) => {
52
52
  graphPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseGraphPlugin);
53
53
  (0, import_signals_core.effect)(() => {
@@ -63,9 +63,10 @@ var AttentionPlugin = () => {
63
63
  },
64
64
  provides: {
65
65
  attention,
66
- context: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.RootAttentionProvider, {
67
- attention,
68
- onChange: (nextAttended) => {
66
+ context: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.AttentionProvider, {
67
+ attended: attention.attended,
68
+ onChangeAttend: (nextAttended) => {
69
+ attention.attended = nextAttended;
69
70
  }
70
71
  }, props.children)
71
72
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { create, type ReactiveObject } from '@dxos/echo-schema';\nimport { Keyboard } from '@dxos/keyboard';\nimport { type Attention, RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: Readonly<Attention>;\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 = create<Attention>({ attended: [] });\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async (plugins: any) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.attended ?? [])[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 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: ReactiveObject<Attention>) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return [...(attention.attended ?? [])];\n },\n get currentSpace() {\n for (const id of attention.attended ?? []) {\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,yBAA4C;AAC5C,sBAAyB;AACzB,gCAAsD;AAU/C,IAAMA,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,gBAAYG,2BAAkB;IAAEC,UAAU,CAAA;EAAG,CAAA;AACnD,MAAIC;AAEJ,SAAO;IACLC,MAAAA;IACAC,OAAO,OAAOC,YAAAA;AACZH,wBAAcI,oCAAcD,SAASE,qCAAAA;AAErCC,sCAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKd,UAAUI,YAAY,CAAA,CAAE,EAAE,CAAA;AAChD,cAAMW,OAAOH,MAAMP,aAAaN,SAASiB,MAAMC,QAAQ;UAAEC,QAAQN;QAAG,CAAA;AACpE,YAAIG,MAAM;AACRI,mCAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcvB,SAAAA;IAChB;IACAD,UAAU;MACRC;MACAwB,SAAS,CAACC,UACR,6BAAAC,QAAA,cAACC,iDAAAA;QACC3B;QACA4B,UAAU,CAACC,iBAAAA;QAKX;SAECJ,MAAMK,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMP,gBAAgB,CAACvB,cAAAA;AACpB+B,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAAShC,YAAY;IACvC,IAAII,WAAW;AACb,aAAO;WAAKJ,UAAUI,YAAY,CAAA;;IACpC;IACA,IAAI6B,eAAe;AACjB,iBAAWrB,MAAMZ,UAAUI,YAAY,CAAA,GAAI;AACzC,cAAM,CAAC8B,SAASC,QAAAA,IAAYvB,GAAGwB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;AC7EA,IAAA,cAAehC;",
6
- "names": ["parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "context", "props", "React", "RootAttentionProvider", "onChange", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length"]
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 Attention,\n type GraphProvides,\n resolvePlugin,\n parseGraphPlugin,\n type PluginDefinition,\n} from '@dxos/app-framework';\nimport { create, type ReactiveObject } from '@dxos/echo-schema';\nimport { Keyboard } from '@dxos/keyboard';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: Attention;\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 = create<Attention>({\n attended: new Set(),\n });\n\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async (plugins: any) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.attended ?? [])[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 context: (props: PropsWithChildren) => (\n <AttentionProvider\n attended={attention.attended}\n onChangeAttend={(nextAttended) => {\n attention.attended = nextAttended;\n\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 </AttentionProvider>\n ),\n },\n };\n};\n\nconst setupDevtools = (attention: ReactiveObject<Attention>) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return [...(attention.attended ?? [])];\n },\n get currentSpace() {\n for (const id of attention.attended ?? []) {\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,2BAOO;AACP,yBAA4C;AAC5C,sBAAyB;AACzB,gCAAkC;AAU3B,IAAMA,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,gBAAYG,2BAAkB;IAClCC,UAAU,oBAAIC,IAAAA;EAChB,CAAA;AAEA,MAAIC;AAEJ,SAAO;IACLC,MAAAA;IACAC,OAAO,OAAOC,YAAAA;AACZH,wBAAcI,oCAAcD,SAASE,qCAAAA;AAErCC,sCAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKf,UAAUI,YAAY,CAAA,CAAE,EAAE,CAAA;AAChD,cAAMY,OAAOH,MAAMP,aAAaP,SAASkB,MAAMC,QAAQ;UAAEC,QAAQN;QAAG,CAAA;AACpE,YAAIG,MAAM;AACRI,mCAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcxB,SAAAA;IAChB;IACAD,UAAU;MACRC;MACAyB,SAAS,CAACC,UACR,6BAAAC,QAAA,cAACC,6CAAAA;QACCxB,UAAUJ,UAAUI;QACpByB,gBAAgB,CAACC,iBAAAA;AACf9B,oBAAUI,WAAW0B;QAMvB;SAECJ,MAAMK,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMP,gBAAgB,CAACxB,cAAAA;AACpBgC,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAASjC,YAAY;IACvC,IAAII,WAAW;AACb,aAAO;WAAKJ,UAAUI,YAAY,CAAA;;IACpC;IACA,IAAI8B,eAAe;AACjB,iBAAWrB,MAAMb,UAAUI,YAAY,CAAA,GAAI;AACzC,cAAM,CAAC+B,SAASC,QAAAA,IAAYvB,GAAGwB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;ACnFA,IAAA,cAAejC;",
6
+ "names": ["parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "Set", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "context", "props", "React", "AttentionProvider", "onChangeAttend", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length"]
7
7
  }
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var meta_exports = {};
20
20
  __export(meta_exports, {
21
- ATTENTION_PLUGIN: () => import_chunk_VEMWITWY.ATTENTION_PLUGIN,
22
- default: () => import_chunk_VEMWITWY.meta_default
21
+ ATTENTION_PLUGIN: () => import_chunk_F2QM2H7J.ATTENTION_PLUGIN,
22
+ default: () => import_chunk_F2QM2H7J.meta_default
23
23
  });
24
24
  module.exports = __toCommonJS(meta_exports);
25
- var import_chunk_VEMWITWY = require("./chunk-VEMWITWY.cjs");
25
+ var import_chunk_F2QM2H7J = require("./chunk-F2QM2H7J.cjs");
26
26
  // Annotate the CommonJS export names for ESM import in node:
27
27
  0 && (module.exports = {
28
28
  ATTENTION_PLUGIN
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["meta.cjs"],
4
- "sourcesContent": ["import {\n ATTENTION_PLUGIN,\n meta_default\n} from \"./chunk-VEMWITWY.cjs\";\nexport {\n ATTENTION_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
4
+ "sourcesContent": ["import {\n ATTENTION_PLUGIN,\n meta_default\n} from \"./chunk-F2QM2H7J.cjs\";\nexport {\n ATTENTION_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
6
6
  "names": []
7
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":8327,"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/echo-schema","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/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4543},"packages/plugins/plugin-attention/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node/chunk-VEMWITWY.cjs","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/echo-schema","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":1619},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":1937},"packages/plugins/plugin-attention/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-attention/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node/chunk-VEMWITWY.cjs","kind":"import-statement"}],"exports":["ATTENTION_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-attention/src/meta.ts","inputs":{},"bytes":167},"packages/plugins/plugin-attention/dist/lib/node/chunk-VEMWITWY.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":462},"packages/plugins/plugin-attention/dist/lib/node/chunk-VEMWITWY.cjs":{"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":865,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/AttentionPlugin.tsx":{"bytes":8551,"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/echo-schema","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/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4656},"packages/plugins/plugin-attention/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node/chunk-F2QM2H7J.cjs","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/echo-schema","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":1704},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":2022},"packages/plugins/plugin-attention/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-attention/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-attention/dist/lib/node/chunk-F2QM2H7J.cjs","kind":"import-statement"}],"exports":["ATTENTION_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-attention/src/meta.ts","inputs":{},"bytes":167},"packages/plugins/plugin-attention/dist/lib/node/chunk-F2QM2H7J.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":383},"packages/plugins/plugin-attention/dist/lib/node/chunk-F2QM2H7J.cjs":{"imports":[],"exports":["ATTENTION_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytesInOutput":120}},"bytes":261}}}
@@ -1,7 +1,6 @@
1
- import { type Plugin, type PluginDefinition } from '@dxos/app-framework';
2
- import { type Attention } from '@dxos/react-ui-attention';
1
+ import { type Plugin, type Attention, type PluginDefinition } from '@dxos/app-framework';
3
2
  type AttentionProvides = {
4
- attention: Readonly<Attention>;
3
+ attention: Attention;
5
4
  };
6
5
  export type AttentionPluginProvides = AttentionProvides;
7
6
  export declare const parseAttentionPlugin: (plugin?: Plugin) => Plugin<AttentionProvides> | undefined;
@@ -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;AAG7B,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,0BAA0B,CAAC;AAIjF,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CAChC,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,CAoC1E,CAAC"}
1
+ {"version":3,"file":"AttentionPlugin.d.ts","sourceRoot":"","sources":["../../../src/AttentionPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,SAAS,EAId,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAO7B,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB,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 +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":"AAIA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;;;;;AAE5D,wBAGE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-attention",
3
- "version": "0.6.13-main.548ca8d",
3
+ "version": "0.6.13-staging.1e988a3",
4
4
  "description": "Plugin for attention",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,16 +10,14 @@
10
10
  ".": {
11
11
  "browser": "./dist/lib/browser/index.mjs",
12
12
  "node": {
13
- "require": "./dist/lib/node/index.cjs",
14
- "default": "./dist/lib/node-esm/index.mjs"
13
+ "default": "./dist/lib/node/index.cjs"
15
14
  },
16
15
  "types": "./dist/types/src/index.d.ts"
17
16
  },
18
17
  "./meta": {
19
18
  "browser": "./dist/lib/browser/meta.mjs",
20
19
  "node": {
21
- "require": "./dist/lib/node/meta.cjs",
22
- "default": "./dist/lib/node-esm/meta.mjs"
20
+ "default": "./dist/lib/node/meta.cjs"
23
21
  },
24
22
  "types": "./dist/types/src/meta.d.ts"
25
23
  }
@@ -38,11 +36,11 @@
38
36
  ],
39
37
  "dependencies": {
40
38
  "@preact/signals-core": "^1.6.0",
41
- "@dxos/app-framework": "0.6.13-main.548ca8d",
42
- "@dxos/echo-schema": "0.6.13-main.548ca8d",
43
- "@dxos/keyboard": "0.6.13-main.548ca8d",
44
- "@dxos/react-ui-attention": "0.6.13-main.548ca8d",
45
- "@dxos/echo-signals": "0.6.13-main.548ca8d"
39
+ "@dxos/app-framework": "0.6.13-staging.1e988a3",
40
+ "@dxos/echo-schema": "0.6.13-staging.1e988a3",
41
+ "@dxos/keyboard": "0.6.13-staging.1e988a3",
42
+ "@dxos/echo-signals": "0.6.13-staging.1e988a3",
43
+ "@dxos/react-ui-attention": "0.6.13-staging.1e988a3"
46
44
  },
47
45
  "devDependencies": {
48
46
  "@types/react": "~18.2.0",
@@ -50,8 +48,8 @@
50
48
  "react-dom": "~18.2.0"
51
49
  },
52
50
  "peerDependencies": {
53
- "react": "~18.2.0",
54
- "react-dom": "~18.2.0"
51
+ "react": "^18.0.0",
52
+ "react-dom": "^18.0.0"
55
53
  },
56
54
  "publishConfig": {
57
55
  "access": "public"
@@ -7,6 +7,7 @@ import React, { type PropsWithChildren } from 'react';
7
7
 
8
8
  import {
9
9
  type Plugin,
10
+ type Attention,
10
11
  type GraphProvides,
11
12
  resolvePlugin,
12
13
  parseGraphPlugin,
@@ -14,12 +15,12 @@ import {
14
15
  } from '@dxos/app-framework';
15
16
  import { create, type ReactiveObject } from '@dxos/echo-schema';
16
17
  import { Keyboard } from '@dxos/keyboard';
17
- import { type Attention, RootAttentionProvider } from '@dxos/react-ui-attention';
18
+ import { AttentionProvider } from '@dxos/react-ui-attention';
18
19
 
19
20
  import meta from './meta';
20
21
 
21
22
  type AttentionProvides = {
22
- attention: Readonly<Attention>;
23
+ attention: Attention;
23
24
  };
24
25
 
25
26
  export type AttentionPluginProvides = AttentionProvides;
@@ -28,7 +29,10 @@ export const parseAttentionPlugin = (plugin?: Plugin) =>
28
29
  typeof (plugin?.provides as any).attention === 'object' ? (plugin as Plugin<AttentionPluginProvides>) : undefined;
29
30
 
30
31
  export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> => {
31
- const attention = create<Attention>({ attended: [] });
32
+ const attention = create<Attention>({
33
+ attended: new Set(),
34
+ });
35
+
32
36
  let graphPlugin: Plugin<GraphProvides> | undefined;
33
37
 
34
38
  return {
@@ -49,9 +53,11 @@ export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> =>
49
53
  provides: {
50
54
  attention,
51
55
  context: (props: PropsWithChildren) => (
52
- <RootAttentionProvider
53
- attention={attention}
54
- onChange={(nextAttended) => {
56
+ <AttentionProvider
57
+ attended={attention.attended}
58
+ onChangeAttend={(nextAttended) => {
59
+ attention.attended = nextAttended;
60
+
55
61
  // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?
56
62
  // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {
57
63
  // layout.values.scrollIntoView = undefined;
@@ -59,7 +65,7 @@ export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> =>
59
65
  }}
60
66
  >
61
67
  {props.children}
62
- </RootAttentionProvider>
68
+ </AttentionProvider>
63
69
  ),
64
70
  },
65
71
  };
package/src/meta.ts CHANGED
@@ -2,11 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
6
-
7
5
  export const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';
8
6
 
9
7
  export default {
10
8
  id: ATTENTION_PLUGIN,
11
9
  name: 'Attention',
12
- } satisfies PluginMeta;
10
+ };
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.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 default {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,mBAAmB;AAEhC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
- "names": ["ATTENTION_PLUGIN", "id", "name"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.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 default {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,mBAAmB;AAEhC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
- "names": ["ATTENTION_PLUGIN", "id", "name"]
7
- }
@@ -1,14 +0,0 @@
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_default = {
6
- id: ATTENTION_PLUGIN,
7
- name: "Attention"
8
- };
9
-
10
- export {
11
- ATTENTION_PLUGIN,
12
- meta_default
13
- };
14
- //# sourceMappingURL=chunk-NWBDAVCK.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.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 default {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";;;AAMO,IAAMA,mBAAmB;AAEhC,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
- "names": ["ATTENTION_PLUGIN", "id", "name"]
7
- }
@@ -1,70 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- meta_default
4
- } from "./chunk-NWBDAVCK.mjs";
5
-
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 { create } from "@dxos/echo-schema";
11
- import { Keyboard } from "@dxos/keyboard";
12
- import { RootAttentionProvider } from "@dxos/react-ui-attention";
13
- var parseAttentionPlugin = (plugin) => typeof (plugin?.provides).attention === "object" ? plugin : void 0;
14
- var AttentionPlugin = () => {
15
- const attention = create({
16
- attended: []
17
- });
18
- let graphPlugin;
19
- return {
20
- meta: meta_default,
21
- ready: async (plugins) => {
22
- graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
23
- effect(() => {
24
- const id = Array.from(attention.attended ?? [])[0];
25
- const path = id && graphPlugin?.provides.graph.getPath({
26
- target: id
27
- });
28
- if (path) {
29
- Keyboard.singleton.setCurrentContext(path.join("/"));
30
- }
31
- });
32
- setupDevtools(attention);
33
- },
34
- provides: {
35
- attention,
36
- context: (props) => /* @__PURE__ */ React.createElement(RootAttentionProvider, {
37
- attention,
38
- onChange: (nextAttended) => {
39
- }
40
- }, props.children)
41
- }
42
- };
43
- };
44
- var setupDevtools = (attention) => {
45
- globalThis.composer ??= {};
46
- globalThis.composer.attention = {
47
- get attended() {
48
- return [
49
- ...attention.attended ?? []
50
- ];
51
- },
52
- get currentSpace() {
53
- for (const id of attention.attended ?? []) {
54
- const [spaceId, objectId] = id.split(":");
55
- if (spaceId && objectId && spaceId.length === 33) {
56
- return spaceId;
57
- }
58
- }
59
- }
60
- };
61
- };
62
-
63
- // packages/plugins/plugin-attention/src/index.ts
64
- var src_default = AttentionPlugin;
65
- export {
66
- AttentionPlugin,
67
- src_default as default,
68
- parseAttentionPlugin
69
- };
70
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
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 { create, type ReactiveObject } from '@dxos/echo-schema';\nimport { Keyboard } from '@dxos/keyboard';\nimport { type Attention, RootAttentionProvider } from '@dxos/react-ui-attention';\n\nimport meta from './meta';\n\ntype AttentionProvides = {\n attention: Readonly<Attention>;\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 = create<Attention>({ attended: [] });\n let graphPlugin: Plugin<GraphProvides> | undefined;\n\n return {\n meta,\n ready: async (plugins: any) => {\n graphPlugin = resolvePlugin(plugins, parseGraphPlugin);\n\n effect(() => {\n const id = Array.from(attention.attended ?? [])[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 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: ReactiveObject<Attention>) => {\n (globalThis as any).composer ??= {};\n\n (globalThis as any).composer.attention = {\n get attended() {\n return [...(attention.attended ?? [])];\n },\n get currentSpace() {\n for (const id of attention.attended ?? []) {\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,cAAmC;AAC5C,SAASC,gBAAgB;AACzB,SAAyBC,6BAA6B;AAU/C,IAAMC,uBAAuB,CAACC,WACnC,QAAQA,QAAQC,UAAiBC,cAAc,WAAYF,SAA6CG;AAEnG,IAAMC,kBAAkB,MAAA;AAC7B,QAAMF,YAAYG,OAAkB;IAAEC,UAAU,CAAA;EAAG,CAAA;AACnD,MAAIC;AAEJ,SAAO;IACLC;IACAC,OAAO,OAAOC,YAAAA;AACZH,oBAAcI,cAAcD,SAASE,gBAAAA;AAErCC,aAAO,MAAA;AACL,cAAMC,KAAKC,MAAMC,KAAKd,UAAUI,YAAY,CAAA,CAAE,EAAE,CAAA;AAChD,cAAMW,OAAOH,MAAMP,aAAaN,SAASiB,MAAMC,QAAQ;UAAEC,QAAQN;QAAG,CAAA;AACpE,YAAIG,MAAM;AACRI,mBAASC,UAAUC,kBAAkBN,KAAKO,KAAK,GAAA,CAAA;QACjD;MACF,CAAA;AAEAC,oBAAcvB,SAAAA;IAChB;IACAD,UAAU;MACRC;MACAwB,SAAS,CAACC,UACR,sBAAA,cAACC,uBAAAA;QACC1B;QACA2B,UAAU,CAACC,iBAAAA;QAKX;SAECH,MAAMI,QAAQ;IAGrB;EACF;AACF;AAEA,IAAMN,gBAAgB,CAACvB,cAAAA;AACpB8B,aAAmBC,aAAa,CAAC;AAEjCD,aAAmBC,SAAS/B,YAAY;IACvC,IAAII,WAAW;AACb,aAAO;WAAKJ,UAAUI,YAAY,CAAA;;IACpC;IACA,IAAI4B,eAAe;AACjB,iBAAWpB,MAAMZ,UAAUI,YAAY,CAAA,GAAI;AACzC,cAAM,CAAC6B,SAASC,QAAAA,IAAYtB,GAAGuB,MAAM,GAAA;AACrC,YAAIF,WAAWC,YAAYD,QAAQG,WAAW,IAAI;AAChD,iBAAOH;QACT;MACF;IACF;EACF;AACF;;;AC7EA,IAAA,cAAeI;",
6
- "names": ["effect", "React", "resolvePlugin", "parseGraphPlugin", "create", "Keyboard", "RootAttentionProvider", "parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "graphPlugin", "meta", "ready", "plugins", "resolvePlugin", "parseGraphPlugin", "effect", "id", "Array", "from", "path", "graph", "getPath", "target", "Keyboard", "singleton", "setCurrentContext", "join", "setupDevtools", "context", "props", "RootAttentionProvider", "onChange", "nextAttended", "children", "globalThis", "composer", "currentSpace", "spaceId", "objectId", "split", "length", "AttentionPlugin"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":973,"imports":[],"format":"esm"},"packages/plugins/plugin-attention/src/AttentionPlugin.tsx":{"bytes":8327,"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/echo-schema","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":4544},"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/echo-schema","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":1619},"packages/plugins/plugin-attention/src/index.ts":{"bytesInOutput":35}},"bytes":2029},"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,10 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- ATTENTION_PLUGIN,
4
- meta_default
5
- } from "./chunk-NWBDAVCK.mjs";
6
- export {
7
- ATTENTION_PLUGIN,
8
- meta_default as default
9
- };
10
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }