@dxos/plugin-attention 0.6.12 → 0.6.13-main.09887cd
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.
- package/dist/lib/browser/{chunk-OH3BP6UG.mjs → chunk-56S77L6M.mjs} +1 -1
- package/dist/lib/browser/chunk-56S77L6M.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -7
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/node/{chunk-F2QM2H7J.cjs → chunk-VEMWITWY.cjs} +4 -4
- package/dist/lib/node/chunk-VEMWITWY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +6 -7
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/chunk-NWBDAVCK.mjs +14 -0
- package/dist/lib/node-esm/chunk-NWBDAVCK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +70 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/meta.mjs +10 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/types/src/AttentionPlugin.d.ts +3 -2
- package/dist/types/src/AttentionPlugin.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/AttentionPlugin.tsx +7 -13
- package/src/meta.ts +3 -1
- package/dist/lib/browser/chunk-OH3BP6UG.mjs.map +0 -7
- package/dist/lib/node/chunk-F2QM2H7J.cjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
meta_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-56S77L6M.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 {
|
|
11
|
+
import { RootAttentionProvider } 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: []
|
|
16
16
|
});
|
|
17
17
|
let graphPlugin;
|
|
18
18
|
return {
|
|
@@ -32,10 +32,9 @@ var AttentionPlugin = () => {
|
|
|
32
32
|
},
|
|
33
33
|
provides: {
|
|
34
34
|
attention,
|
|
35
|
-
context: (props) => /* @__PURE__ */ React.createElement(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
attention.attended = nextAttended;
|
|
35
|
+
context: (props) => /* @__PURE__ */ React.createElement(RootAttentionProvider, {
|
|
36
|
+
attention,
|
|
37
|
+
onChange: (nextAttended) => {
|
|
39
38
|
}
|
|
40
39
|
}, props.children)
|
|
41
40
|
}
|
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,WAAuC;AAE9C,
|
|
6
|
-
"names": ["effect", "React", "resolvePlugin", "parseGraphPlugin", "create", "Keyboard", "
|
|
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
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":
|
|
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}}}
|
|
@@ -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
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_VEMWITWY_exports = {};
|
|
20
|
+
__export(chunk_VEMWITWY_exports, {
|
|
21
21
|
ATTENTION_PLUGIN: () => ATTENTION_PLUGIN,
|
|
22
22
|
meta_default: () => meta_default
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_VEMWITWY_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-
|
|
35
|
+
//# sourceMappingURL=chunk-VEMWITWY.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ __export(node_exports, {
|
|
|
33
33
|
parseAttentionPlugin: () => parseAttentionPlugin
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(node_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_VEMWITWY = require("./chunk-VEMWITWY.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: []
|
|
47
47
|
});
|
|
48
48
|
let graphPlugin;
|
|
49
49
|
return {
|
|
50
|
-
meta:
|
|
50
|
+
meta: import_chunk_VEMWITWY.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,10 +63,9 @@ var AttentionPlugin = () => {
|
|
|
63
63
|
},
|
|
64
64
|
provides: {
|
|
65
65
|
attention,
|
|
66
|
-
context: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
attention.attended = nextAttended;
|
|
66
|
+
context: (props) => /* @__PURE__ */ import_react.default.createElement(import_react_ui_attention.RootAttentionProvider, {
|
|
67
|
+
attention,
|
|
68
|
+
onChange: (nextAttended) => {
|
|
70
69
|
}
|
|
71
70
|
}, props.children)
|
|
72
71
|
}
|
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAAuB;AACvB,mBAA8C;AAE9C,
|
|
6
|
-
"names": ["parseAttentionPlugin", "plugin", "provides", "attention", "undefined", "AttentionPlugin", "create", "attended", "
|
|
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"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.cjs
CHANGED
|
@@ -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: () =>
|
|
22
|
-
default: () =>
|
|
21
|
+
ATTENTION_PLUGIN: () => import_chunk_VEMWITWY.ATTENTION_PLUGIN,
|
|
22
|
+
default: () => import_chunk_VEMWITWY.meta_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(meta_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_chunk_VEMWITWY = require("./chunk-VEMWITWY.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-
|
|
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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-attention/src/meta.ts":{"bytes":
|
|
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}}}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +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-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}}}
|
|
@@ -0,0 +1,10 @@
|
|
|
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,6 +1,7 @@
|
|
|
1
|
-
import { type Plugin, type
|
|
1
|
+
import { type Plugin, type PluginDefinition } from '@dxos/app-framework';
|
|
2
|
+
import { type Attention } from '@dxos/react-ui-attention';
|
|
2
3
|
type AttentionProvides = {
|
|
3
|
-
attention: Attention
|
|
4
|
+
attention: Readonly<Attention>;
|
|
4
5
|
};
|
|
5
6
|
export type AttentionPluginProvides = AttentionProvides;
|
|
6
7
|
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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;;;;;AAE5D,wBAGuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-attention",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13-main.09887cd",
|
|
4
4
|
"description": "Plugin for attention",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"node": {
|
|
13
|
-
"
|
|
13
|
+
"require": "./dist/lib/node/index.cjs",
|
|
14
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
14
15
|
},
|
|
15
16
|
"types": "./dist/types/src/index.d.ts"
|
|
16
17
|
},
|
|
17
18
|
"./meta": {
|
|
18
19
|
"browser": "./dist/lib/browser/meta.mjs",
|
|
19
20
|
"node": {
|
|
20
|
-
"
|
|
21
|
+
"require": "./dist/lib/node/meta.cjs",
|
|
22
|
+
"default": "./dist/lib/node-esm/meta.mjs"
|
|
21
23
|
},
|
|
22
24
|
"types": "./dist/types/src/meta.d.ts"
|
|
23
25
|
}
|
|
@@ -36,11 +38,11 @@
|
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@preact/signals-core": "^1.6.0",
|
|
39
|
-
"@dxos/app-framework": "0.6.
|
|
40
|
-
"@dxos/echo-schema": "0.6.
|
|
41
|
-
"@dxos/echo-signals": "0.6.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
41
|
+
"@dxos/app-framework": "0.6.13-main.09887cd",
|
|
42
|
+
"@dxos/echo-schema": "0.6.13-main.09887cd",
|
|
43
|
+
"@dxos/echo-signals": "0.6.13-main.09887cd",
|
|
44
|
+
"@dxos/keyboard": "0.6.13-main.09887cd",
|
|
45
|
+
"@dxos/react-ui-attention": "0.6.13-main.09887cd"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@types/react": "~18.2.0",
|
|
@@ -48,8 +50,8 @@
|
|
|
48
50
|
"react-dom": "~18.2.0"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
53
|
+
"react": "~18.2.0",
|
|
54
|
+
"react-dom": "~18.2.0"
|
|
53
55
|
},
|
|
54
56
|
"publishConfig": {
|
|
55
57
|
"access": "public"
|
package/src/AttentionPlugin.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import React, { type PropsWithChildren } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type Plugin,
|
|
10
|
-
type Attention,
|
|
11
10
|
type GraphProvides,
|
|
12
11
|
resolvePlugin,
|
|
13
12
|
parseGraphPlugin,
|
|
@@ -15,12 +14,12 @@ import {
|
|
|
15
14
|
} from '@dxos/app-framework';
|
|
16
15
|
import { create, type ReactiveObject } from '@dxos/echo-schema';
|
|
17
16
|
import { Keyboard } from '@dxos/keyboard';
|
|
18
|
-
import {
|
|
17
|
+
import { type Attention, RootAttentionProvider } from '@dxos/react-ui-attention';
|
|
19
18
|
|
|
20
19
|
import meta from './meta';
|
|
21
20
|
|
|
22
21
|
type AttentionProvides = {
|
|
23
|
-
attention: Attention
|
|
22
|
+
attention: Readonly<Attention>;
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
export type AttentionPluginProvides = AttentionProvides;
|
|
@@ -29,10 +28,7 @@ export const parseAttentionPlugin = (plugin?: Plugin) =>
|
|
|
29
28
|
typeof (plugin?.provides as any).attention === 'object' ? (plugin as Plugin<AttentionPluginProvides>) : undefined;
|
|
30
29
|
|
|
31
30
|
export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> => {
|
|
32
|
-
const attention = create<Attention>({
|
|
33
|
-
attended: new Set(),
|
|
34
|
-
});
|
|
35
|
-
|
|
31
|
+
const attention = create<Attention>({ attended: [] });
|
|
36
32
|
let graphPlugin: Plugin<GraphProvides> | undefined;
|
|
37
33
|
|
|
38
34
|
return {
|
|
@@ -53,11 +49,9 @@ export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> =>
|
|
|
53
49
|
provides: {
|
|
54
50
|
attention,
|
|
55
51
|
context: (props: PropsWithChildren) => (
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
attention.attended = nextAttended;
|
|
60
|
-
|
|
52
|
+
<RootAttentionProvider
|
|
53
|
+
attention={attention}
|
|
54
|
+
onChange={(nextAttended) => {
|
|
61
55
|
// TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?
|
|
62
56
|
// if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {
|
|
63
57
|
// layout.values.scrollIntoView = undefined;
|
|
@@ -65,7 +59,7 @@ export const AttentionPlugin = (): PluginDefinition<AttentionPluginProvides> =>
|
|
|
65
59
|
}}
|
|
66
60
|
>
|
|
67
61
|
{props.children}
|
|
68
|
-
</
|
|
62
|
+
</RootAttentionProvider>
|
|
69
63
|
),
|
|
70
64
|
},
|
|
71
65
|
};
|
package/src/meta.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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
|
-
}
|