@dxos/plugin-attention 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/lib/browser/chunk-55HTXC2G.mjs +39 -0
  2. package/dist/lib/browser/chunk-55HTXC2G.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-BDLH2DQU.mjs +41 -0
  4. package/dist/lib/browser/chunk-BDLH2DQU.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  6. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +49 -67
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/operations/index.mjs +13 -0
  11. package/dist/lib/browser/operations/index.mjs.map +7 -0
  12. package/dist/lib/browser/select-HQCLOXD6.mjs +49 -0
  13. package/dist/lib/browser/select-HQCLOXD6.mjs.map +7 -0
  14. package/dist/lib/browser/types/index.mjs +8 -4
  15. package/dist/lib/node-esm/chunk-GWUE2YCZ.mjs +43 -0
  16. package/dist/lib/node-esm/chunk-GWUE2YCZ.mjs.map +7 -0
  17. package/dist/lib/node-esm/chunk-HQWPPQXC.mjs +40 -0
  18. package/dist/lib/node-esm/chunk-HQWPPQXC.mjs.map +7 -0
  19. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  20. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +49 -67
  22. package/dist/lib/node-esm/index.mjs.map +4 -4
  23. package/dist/lib/node-esm/meta.json +1 -1
  24. package/dist/lib/node-esm/operations/index.mjs +14 -0
  25. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  26. package/dist/lib/node-esm/select-GLRAU6S2.mjs +50 -0
  27. package/dist/lib/node-esm/select-GLRAU6S2.mjs.map +7 -0
  28. package/dist/lib/node-esm/types/index.mjs +8 -4
  29. package/dist/types/src/AttentionPlugin.d.ts +2 -1
  30. package/dist/types/src/AttentionPlugin.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/index.d.ts +6 -5
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/keyboard.d.ts +3 -2
  34. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  36. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/react-context.d.ts +4 -2
  38. package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
  39. package/dist/types/src/index.d.ts +2 -5
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/meta.d.ts +2 -3
  42. package/dist/types/src/meta.d.ts.map +1 -1
  43. package/dist/types/src/operations/definitions.d.ts +23 -0
  44. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  45. package/dist/types/src/operations/index.d.ts +4 -0
  46. package/dist/types/src/operations/index.d.ts.map +1 -0
  47. package/dist/types/src/operations/select.d.ts +5 -0
  48. package/dist/types/src/operations/select.d.ts.map +1 -0
  49. package/dist/types/src/types/capabilities.d.ts +7 -0
  50. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  51. package/dist/types/src/types/events.d.ts +5 -0
  52. package/dist/types/src/types/events.d.ts.map +1 -0
  53. package/dist/types/src/types/index.d.ts +2 -0
  54. package/dist/types/src/types/index.d.ts.map +1 -1
  55. package/dist/types/src/types/types.d.ts +3 -3
  56. package/dist/types/src/types/types.d.ts.map +1 -1
  57. package/dist/types/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +35 -16
  59. package/src/AttentionPlugin.ts +38 -38
  60. package/src/capabilities/index.ts +8 -6
  61. package/src/capabilities/keyboard.ts +15 -16
  62. package/src/capabilities/operation-handler.ts +16 -0
  63. package/src/capabilities/react-context.tsx +29 -25
  64. package/src/index.ts +2 -6
  65. package/src/meta.ts +8 -5
  66. package/src/operations/definitions.ts +25 -0
  67. package/src/operations/index.ts +9 -0
  68. package/src/operations/select.ts +43 -0
  69. package/src/types/capabilities.ts +13 -0
  70. package/src/types/events.ts +11 -0
  71. package/src/types/index.ts +2 -0
  72. package/src/types/types.ts +4 -4
  73. package/dist/lib/browser/chunk-DF2PBRKK.mjs +0 -12
  74. package/dist/lib/browser/chunk-DF2PBRKK.mjs.map +0 -7
  75. package/dist/lib/browser/chunk-LRNGQJHD.mjs +0 -16
  76. package/dist/lib/browser/chunk-LRNGQJHD.mjs.map +0 -7
  77. package/dist/lib/browser/chunk-WOQAO42V.mjs +0 -25
  78. package/dist/lib/browser/chunk-WOQAO42V.mjs.map +0 -7
  79. package/dist/lib/browser/intent-resolver-E7G6R755.mjs +0 -51
  80. package/dist/lib/browser/intent-resolver-E7G6R755.mjs.map +0 -7
  81. package/dist/lib/browser/keyboard-JTQ2RGL7.mjs +0 -28
  82. package/dist/lib/browser/keyboard-JTQ2RGL7.mjs.map +0 -7
  83. package/dist/lib/browser/react-context-IUBFXFFZ.mjs +0 -29
  84. package/dist/lib/browser/react-context-IUBFXFFZ.mjs.map +0 -7
  85. package/dist/lib/node-esm/chunk-K3STXVKU.mjs +0 -17
  86. package/dist/lib/node-esm/chunk-K3STXVKU.mjs.map +0 -7
  87. package/dist/lib/node-esm/chunk-MS46IMND.mjs +0 -26
  88. package/dist/lib/node-esm/chunk-MS46IMND.mjs.map +0 -7
  89. package/dist/lib/node-esm/chunk-YUJM7ABN.mjs +0 -14
  90. package/dist/lib/node-esm/chunk-YUJM7ABN.mjs.map +0 -7
  91. package/dist/lib/node-esm/intent-resolver-ELLJ67CV.mjs +0 -52
  92. package/dist/lib/node-esm/intent-resolver-ELLJ67CV.mjs.map +0 -7
  93. package/dist/lib/node-esm/keyboard-S7SW6XBY.mjs +0 -29
  94. package/dist/lib/node-esm/keyboard-S7SW6XBY.mjs.map +0 -7
  95. package/dist/lib/node-esm/react-context-2RSEVMNC.mjs +0 -30
  96. package/dist/lib/node-esm/react-context-2RSEVMNC.mjs.map +0 -7
  97. package/dist/types/src/capabilities/capabilities.d.ts +0 -6
  98. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  99. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  100. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  101. package/dist/types/src/events.d.ts +0 -4
  102. package/dist/types/src/events.d.ts.map +0 -1
  103. package/src/capabilities/capabilities.ts +0 -13
  104. package/src/capabilities/intent-resolver.ts +0 -43
  105. package/src/events.ts +0 -11
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@dxos/plugin-attention",
3
- "version": "0.8.4-main.f5c0578",
3
+ "version": "0.8.4-main.fcfe5033a5",
4
4
  "description": "Plugin for attention",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
10
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": "./src/capabilities/index.ts",
17
+ "#meta": "./src/meta.ts",
18
+ "#operations": "./src/operations/index.ts",
19
+ "#types": "./src/types/index.ts"
20
+ },
11
21
  "exports": {
12
22
  ".": {
13
23
  "source": "./src/index.ts",
@@ -15,6 +25,12 @@
15
25
  "browser": "./dist/lib/browser/index.mjs",
16
26
  "node": "./dist/lib/node-esm/index.mjs"
17
27
  },
28
+ "./operations": {
29
+ "source": "./src/operations/index.ts",
30
+ "types": "./dist/types/src/operations/index.d.ts",
31
+ "browser": "./dist/lib/browser/operations/index.mjs",
32
+ "node": "./dist/lib/node-esm/operations/index.mjs"
33
+ },
18
34
  "./types": {
19
35
  "source": "./src/types/index.ts",
20
36
  "types": "./dist/types/src/types/index.d.ts",
@@ -27,6 +43,9 @@
27
43
  "*": {
28
44
  "types": [
29
45
  "dist/types/src/types/index.d.ts"
46
+ ],
47
+ "operations": [
48
+ "dist/types/src/operations/index.d.ts"
30
49
  ]
31
50
  }
32
51
  },
@@ -35,25 +54,25 @@
35
54
  "src"
36
55
  ],
37
56
  "dependencies": {
38
- "@preact-signals/safe-react": "^0.9.0",
39
- "@preact/signals-core": "^1.9.0",
40
- "effect": "3.17.7",
41
- "@dxos/app-framework": "0.8.4-main.f5c0578",
42
- "@dxos/echo": "0.8.4-main.f5c0578",
43
- "@dxos/echo-schema": "0.8.4-main.f5c0578",
44
- "@dxos/echo-signals": "0.8.4-main.f5c0578",
45
- "@dxos/keyboard": "0.8.4-main.f5c0578",
46
- "@dxos/react-ui-attention": "0.8.4-main.f5c0578"
57
+ "effect": "3.20.0",
58
+ "@dxos/app-framework": "0.8.4-main.fcfe5033a5",
59
+ "@dxos/app-toolkit": "0.8.4-main.fcfe5033a5",
60
+ "@dxos/keyboard": "0.8.4-main.fcfe5033a5",
61
+ "@dxos/echo": "0.8.4-main.fcfe5033a5",
62
+ "@dxos/plugin-graph": "0.8.4-main.fcfe5033a5",
63
+ "@dxos/react-ui-attention": "0.8.4-main.fcfe5033a5",
64
+ "@dxos/operation": "0.8.4-main.fcfe5033a5",
65
+ "@dxos/util": "0.8.4-main.fcfe5033a5"
47
66
  },
48
67
  "devDependencies": {
49
- "@types/react": "~18.2.0",
50
- "react": "~18.2.0",
51
- "react-dom": "~18.2.0"
68
+ "@types/react": "~19.2.7",
69
+ "react": "~19.2.3",
70
+ "react-dom": "~19.2.3"
52
71
  },
53
72
  "peerDependencies": {
54
- "effect": "^3.13.3",
55
- "react": "~18.2.0",
56
- "react-dom": "~18.2.0"
73
+ "effect": "3.20.0",
74
+ "react": "~19.2.3",
75
+ "react-dom": "~19.2.3"
57
76
  },
58
77
  "publishConfig": {
59
78
  "access": "public"
@@ -2,45 +2,45 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Events, allOf, contributes, defineModule, definePlugin } from '@dxos/app-framework';
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { ActivationEvent, ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
8
+ import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
6
9
  import { AttentionManager, SelectionManager } from '@dxos/react-ui-attention';
7
10
 
8
- import { AttentionCapabilities, IntentResolver, Keyboard, ReactContext } from './capabilities';
9
- import { AttentionEvents } from './events';
10
- import { meta } from './meta';
11
+ import { Keyboard, OperationHandler, ReactContext } from '#capabilities';
12
+ import { meta } from '#meta';
13
+ import { AttentionEvents } from '#types';
14
+ import { AttentionCapabilities } from '#types';
11
15
 
12
- export const AttentionPlugin = () =>
13
- definePlugin(meta, [
14
- defineModule({
15
- id: `${meta.id}/module/attention`,
16
- activatesOn: Events.Startup,
17
- activatesAfter: [AttentionEvents.AttentionReady],
18
- activate: () => {
19
- const attention = new AttentionManager();
20
- const selection = new SelectionManager();
16
+ export const AttentionPlugin = Plugin.define(meta).pipe(
17
+ AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
18
+ Plugin.addModule({
19
+ id: 'attention',
20
+ activatesOn: ActivationEvents.Startup,
21
+ firesAfterActivation: [AttentionEvents.AttentionReady],
22
+ activate: () =>
23
+ Effect.gen(function* () {
24
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
25
+ const attention = new AttentionManager(registry);
26
+ const selection = new SelectionManager(registry);
21
27
  setupDevtools(attention);
22
28
  return [
23
- contributes(AttentionCapabilities.Attention, attention),
24
- contributes(AttentionCapabilities.Selection, selection),
29
+ Capability.contributes(AttentionCapabilities.Attention, attention),
30
+ Capability.contributes(AttentionCapabilities.Selection, selection),
25
31
  ];
26
- },
27
- }),
28
- defineModule({
29
- id: `${meta.id}/module/react-context`,
30
- activatesOn: Events.Startup,
31
- activate: ReactContext,
32
- }),
33
- defineModule({
34
- id: `${meta.id}/module/keyboard`,
35
- activatesOn: allOf(Events.AppGraphReady, AttentionEvents.AttentionReady),
36
- activate: Keyboard,
37
- }),
38
- defineModule({
39
- id: `${meta.id}/module/intent-resolver`,
40
- activatesOn: Events.SetupIntentResolver,
41
- activate: IntentResolver,
42
- }),
43
- ]);
32
+ }),
33
+ }),
34
+ Plugin.addModule({
35
+ activatesOn: ActivationEvents.Startup,
36
+ activate: ReactContext,
37
+ }),
38
+ Plugin.addModule({
39
+ activatesOn: ActivationEvent.allOf(AppActivationEvents.AppGraphReady, AttentionEvents.AttentionReady),
40
+ activate: Keyboard,
41
+ }),
42
+ Plugin.make,
43
+ );
44
44
 
45
45
  const setupDevtools = (attention: AttentionManager) => {
46
46
  (globalThis as any).composer ??= {};
@@ -50,13 +50,13 @@ const setupDevtools = (attention: AttentionManager) => {
50
50
  return attention;
51
51
  },
52
52
  get attended() {
53
- return attention.current;
53
+ return attention.getCurrent();
54
54
  },
55
55
  get currentSpace() {
56
- for (const id of attention.current) {
57
- const [spaceId, objectId] = id.split(':');
58
- if (spaceId && objectId && spaceId.length === 33) {
59
- return spaceId;
56
+ for (const id of attention.getCurrent()) {
57
+ const segments = id.split('/');
58
+ if (segments.length > 1 && segments[1].length === 33) {
59
+ return segments[1];
60
60
  }
61
61
  }
62
62
  },
@@ -2,10 +2,12 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
+ import { OperationHandlerSet } from '@dxos/operation';
6
7
 
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
8
- export const Keyboard = lazy(() => import('./keyboard'));
9
- export const ReactContext = lazy(() => import('./react-context'));
10
-
11
- export * from './capabilities';
8
+ export const Keyboard = Capability.lazy('Keyboard', () => import('./keyboard'));
9
+ export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
10
+ 'OperationHandler',
11
+ () => import('./operation-handler'),
12
+ );
13
+ export const ReactContext = Capability.lazy('ReactContext', () => import('./react-context'));
@@ -2,25 +2,24 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { effect } from '@preact/signals-core';
6
- import { Option } from 'effect';
5
+ import * as Effect from 'effect/Effect';
7
6
 
8
- import { Capabilities as AppCapabilities, type PluginContext, contributes } from '@dxos/app-framework';
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
8
  import { Keyboard } from '@dxos/keyboard';
10
9
 
11
- import { AttentionCapabilities } from './capabilities';
10
+ import { AttentionCapabilities } from '#types';
12
11
 
13
- export default (context: PluginContext) => {
14
- const { graph } = context.getCapability(AppCapabilities.AppGraph);
15
- const attention = context.getCapability(AttentionCapabilities.Attention);
12
+ export default Capability.makeModule(
13
+ Effect.fnUntraced(function* () {
14
+ const attention = yield* Capability.get(AttentionCapabilities.Attention);
16
15
 
17
- const unsubscribe = effect(() => {
18
- const id = Array.from(attention.current)[0];
19
- const path = id && graph.getPath({ target: id }).pipe(Option.getOrNull);
20
- if (path) {
21
- Keyboard.singleton.setCurrentContext(path.join('/'));
22
- }
23
- });
16
+ const unsubscribe = attention.subscribeCurrent((current) => {
17
+ const id = current[0];
18
+ if (id) {
19
+ Keyboard.singleton.setCurrentContext(id);
20
+ }
21
+ });
24
22
 
25
- return contributes(AppCapabilities.Null, null, () => unsubscribe());
26
- };
23
+ return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => unsubscribe()));
24
+ }),
25
+ );
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
8
+ import type { OperationHandlerSet } from '@dxos/operation';
9
+
10
+ import { AttentionOperationHandlerSet } from '#operations';
11
+
12
+ export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
13
+ Effect.fnUntraced(function* () {
14
+ return Capability.contributes(Capabilities.OperationHandler, AttentionOperationHandlerSet);
15
+ }),
16
+ );
@@ -2,34 +2,38 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import React, { type PropsWithChildren } from 'react';
6
7
 
7
- import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { useCapability } from '@dxos/app-framework/ui';
8
10
  import { RootAttentionProvider, SelectionProvider } from '@dxos/react-ui-attention';
9
11
 
10
- import { ATTENTION_PLUGIN } from '../meta';
12
+ import { meta } from '#meta';
13
+ import { AttentionCapabilities } from '#types';
11
14
 
12
- import { AttentionCapabilities } from './capabilities';
15
+ export default Capability.makeModule(() =>
16
+ Effect.succeed(
17
+ Capability.contributes(Capabilities.ReactContext, {
18
+ id: meta.id,
19
+ context: (props: PropsWithChildren) => {
20
+ const attention = useCapability(AttentionCapabilities.Attention);
21
+ const selection = useCapability(AttentionCapabilities.Selection);
13
22
 
14
- export default () =>
15
- contributes(Capabilities.ReactContext, {
16
- id: ATTENTION_PLUGIN,
17
- context: (props: PropsWithChildren) => {
18
- const attention = useCapability(AttentionCapabilities.Attention);
19
- const selection = useCapability(AttentionCapabilities.Selection);
20
-
21
- return (
22
- <RootAttentionProvider
23
- attention={attention}
24
- onChange={(nextAttended) => {
25
- // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?
26
- // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {
27
- // layout.values.scrollIntoView = undefined;
28
- // }
29
- }}
30
- >
31
- <SelectionProvider selection={selection}>{props.children}</SelectionProvider>
32
- </RootAttentionProvider>
33
- );
34
- },
35
- });
23
+ return (
24
+ <RootAttentionProvider
25
+ attention={attention}
26
+ onChange={(nextAttended) => {
27
+ // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?
28
+ // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {
29
+ // layout.values.scrollIntoView = undefined;
30
+ // }
31
+ }}
32
+ >
33
+ <SelectionProvider selection={selection}>{props.children}</SelectionProvider>
34
+ </RootAttentionProvider>
35
+ );
36
+ },
37
+ }),
38
+ ),
39
+ );
package/src/index.ts CHANGED
@@ -2,9 +2,5 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from '@dxos/react-ui-attention';
6
-
7
- export * from './AttentionPlugin';
8
- export { AttentionCapabilities } from './capabilities';
9
- export * from './events';
10
- export * from './meta';
5
+ export { AttentionPlugin } from './AttentionPlugin';
6
+ export { meta } from './meta';
package/src/meta.ts CHANGED
@@ -2,11 +2,14 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const ATTENTION_PLUGIN = 'dxos.org/plugin/attention';
8
-
9
- export const meta: PluginMeta = {
10
- id: ATTENTION_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.attention',
11
10
  name: 'Attention',
11
+ description: trim`
12
+ Track and manage focused attention on objects across your workspace.
13
+ Highlight items requiring action and coordinate team focus on priority work.
14
+ `,
12
15
  };
@@ -0,0 +1,25 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/operation';
9
+ import { SelectionSchema } from '@dxos/react-ui-attention';
10
+
11
+ import { meta } from '#meta';
12
+
13
+ export const Select = Operation.make({
14
+ meta: {
15
+ key: `${meta.id}.operation.select`,
16
+ name: 'Select',
17
+ description: 'Select items in an attention context.',
18
+ },
19
+ services: [Capability.Service],
20
+ input: Schema.Struct({
21
+ contextId: Schema.String.annotations({ description: 'The id of the attention context.' }),
22
+ selection: SelectionSchema.annotations({ description: 'The selection to apply.' }),
23
+ }),
24
+ output: Schema.Void,
25
+ });
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/operation';
6
+
7
+ export * as AttentionOperation from './definitions';
8
+
9
+ export const AttentionOperationHandlerSet = OperationHandlerSet.lazy(() => import('./select'));
@@ -0,0 +1,43 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Match from 'effect/Match';
7
+
8
+ import { Capability } from '@dxos/app-framework';
9
+ import { Operation } from '@dxos/operation';
10
+
11
+ import { AttentionCapabilities } from '../types';
12
+ import { Select } from './definitions';
13
+
14
+ const handler: Operation.WithHandler<typeof Select> = Select.pipe(
15
+ Operation.withHandler(
16
+ Effect.fnUntraced(function* (input) {
17
+ const selection = yield* Capability.get(AttentionCapabilities.Selection);
18
+ Match.value(input.selection).pipe(
19
+ Match.when({ mode: 'single', id: undefined }, () => {
20
+ selection.clearSelection(input.contextId);
21
+ }),
22
+ Match.when({ mode: 'single' }, (s) => {
23
+ selection.updateSingle(input.contextId, s.id!);
24
+ }),
25
+ Match.when({ mode: 'multi' }, (s) => {
26
+ selection.updateMulti(input.contextId, s.ids);
27
+ }),
28
+ Match.when({ mode: 'range', from: undefined, to: undefined }, () => {
29
+ selection.clearSelection(input.contextId);
30
+ }),
31
+ Match.when({ mode: 'range' }, (s) => {
32
+ selection.updateRange(input.contextId, s.from!, s.to!);
33
+ }),
34
+ Match.when({ mode: 'multi-range' }, (s) => {
35
+ selection.updateMultiRange(input.contextId, s.ranges);
36
+ }),
37
+ Match.exhaustive,
38
+ );
39
+ }),
40
+ ),
41
+ );
42
+
43
+ export default handler;
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+ import { type AttentionManager, type SelectionManager } from '@dxos/react-ui-attention';
7
+
8
+ import { meta } from '#meta';
9
+
10
+ export namespace AttentionCapabilities {
11
+ export const Attention = Capability.make<AttentionManager>(`${meta.id}.capability.attention`);
12
+ export const Selection = Capability.make<SelectionManager>(`${meta.id}.capability.selection`);
13
+ }
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { ActivationEvent } from '@dxos/app-framework';
6
+
7
+ import { meta } from '#meta';
8
+
9
+ export namespace AttentionEvents {
10
+ export const AttentionReady = ActivationEvent.make(`${meta.id}.event.attention-ready`);
11
+ }
@@ -2,4 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ export * from './capabilities';
6
+ export * from './events';
5
7
  export * from './types';
@@ -2,16 +2,16 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { SelectionSchema } from '@dxos/react-ui-attention';
8
8
 
9
- import { ATTENTION_PLUGIN } from '../meta';
9
+ import { meta } from '#meta';
10
10
 
11
11
  export namespace AttentionAction {
12
- const ATTENTION_ACTION = `${ATTENTION_PLUGIN}/action`;
12
+ const ATTENTION_ACTION = `${meta.id}.action`;
13
13
 
14
- export class Select extends Schema.TaggedClass<Select>()(`${ATTENTION_ACTION}/select`, {
14
+ export class Select extends Schema.TaggedClass<Select>()(`${ATTENTION_ACTION}.select`, {
15
15
  input: Schema.Struct({
16
16
  contextId: Schema.String,
17
17
  selection: SelectionSchema,
@@ -1,12 +0,0 @@
1
- // src/meta.ts
2
- var ATTENTION_PLUGIN = "dxos.org/plugin/attention";
3
- var meta = {
4
- id: ATTENTION_PLUGIN,
5
- name: "Attention"
6
- };
7
-
8
- export {
9
- ATTENTION_PLUGIN,
10
- meta
11
- };
12
- //# sourceMappingURL=chunk-DF2PBRKK.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 const meta: PluginMeta = {\n id: ATTENTION_PLUGIN,\n name: 'Attention',\n};\n"],
5
- "mappings": ";AAMO,IAAMA,mBAAmB;AAEzB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;",
6
- "names": ["ATTENTION_PLUGIN", "meta", "id", "name"]
7
- }
@@ -1,16 +0,0 @@
1
- import {
2
- ATTENTION_PLUGIN
3
- } from "./chunk-DF2PBRKK.mjs";
4
-
5
- // src/capabilities/capabilities.ts
6
- import { defineCapability } from "@dxos/app-framework";
7
- (function(AttentionCapabilities2) {
8
- AttentionCapabilities2.Attention = defineCapability(`${ATTENTION_PLUGIN}/capability/attention`);
9
- AttentionCapabilities2.Selection = defineCapability(`${ATTENTION_PLUGIN}/capability/selection`);
10
- })(AttentionCapabilities || (AttentionCapabilities = {}));
11
- var AttentionCapabilities;
12
-
13
- export {
14
- AttentionCapabilities
15
- };
16
- //# sourceMappingURL=chunk-LRNGQJHD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/capabilities.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type AttentionManager, type SelectionManager } from '@dxos/react-ui-attention';\n\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport namespace AttentionCapabilities {\n export const Attention = defineCapability<AttentionManager>(`${ATTENTION_PLUGIN}/capability/attention`);\n export const Selection = defineCapability<SelectionManager>(`${ATTENTION_PLUGIN}/capability/selection`);\n}\n"],
5
- "mappings": ";;;;;AAIA,SAASA,wBAAwB;UAKhBC,wBAAAA;yBACFC,YAAYC,iBAAmC,GAAGC,gBAAAA,uBAAuC;yBACzFC,YAAYF,iBAAmC,GAAGC,gBAAAA,uBAAuC;AACxG,GAHiBH,0BAAAA,wBAAAA,CAAAA,EAAAA;;",
6
- "names": ["defineCapability", "AttentionCapabilities", "Attention", "defineCapability", "ATTENTION_PLUGIN", "Selection"]
7
- }
@@ -1,25 +0,0 @@
1
- import {
2
- ATTENTION_PLUGIN
3
- } from "./chunk-DF2PBRKK.mjs";
4
-
5
- // src/types/types.ts
6
- import { Schema } from "effect";
7
- import { SelectionSchema } from "@dxos/react-ui-attention";
8
- (function(AttentionAction2) {
9
- const ATTENTION_ACTION = `${ATTENTION_PLUGIN}/action`;
10
- class Select extends Schema.TaggedClass()(`${ATTENTION_ACTION}/select`, {
11
- input: Schema.Struct({
12
- contextId: Schema.String,
13
- selection: SelectionSchema
14
- }),
15
- output: Schema.Void
16
- }) {
17
- }
18
- AttentionAction2.Select = Select;
19
- })(AttentionAction || (AttentionAction = {}));
20
- var AttentionAction;
21
-
22
- export {
23
- AttentionAction
24
- };
25
- //# sourceMappingURL=chunk-WOQAO42V.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { SelectionSchema } from '@dxos/react-ui-attention';\n\nimport { ATTENTION_PLUGIN } from '../meta';\n\nexport namespace AttentionAction {\n const ATTENTION_ACTION = `${ATTENTION_PLUGIN}/action`;\n\n export class Select extends Schema.TaggedClass<Select>()(`${ATTENTION_ACTION}/select`, {\n input: Schema.Struct({\n contextId: Schema.String,\n selection: SelectionSchema,\n }),\n output: Schema.Void,\n }) {}\n}\n"],
5
- "mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,uBAAuB;UAIfC,kBAAAA;AACf,QAAMC,mBAAmB,GAAGC,gBAAAA;EAErB,MAAMC,eAAeC,OAAOC,YAAW,EAAW,GAAGJ,gBAAAA,WAA2B;IACrFK,OAAOF,OAAOG,OAAO;MACnBC,WAAWJ,OAAOK;MAClBC,WAAWC;IACb,CAAA;IACAC,QAAQR,OAAOS;EACjB,CAAA,EAAA;EAAI;mBANSV,SAAAA;AAOf,GAViBH,oBAAAA,kBAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "SelectionSchema", "AttentionAction", "ATTENTION_ACTION", "ATTENTION_PLUGIN", "Select", "Schema", "TaggedClass", "input", "Struct", "contextId", "String", "selection", "SelectionSchema", "output", "Void"]
7
- }
@@ -1,51 +0,0 @@
1
- import {
2
- AttentionAction
3
- } from "./chunk-WOQAO42V.mjs";
4
- import {
5
- AttentionCapabilities
6
- } from "./chunk-LRNGQJHD.mjs";
7
- import "./chunk-DF2PBRKK.mjs";
8
-
9
- // src/capabilities/intent-resolver.ts
10
- import { Match } from "effect";
11
- import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
12
- var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
13
- createResolver({
14
- intent: AttentionAction.Select,
15
- resolve: (data) => {
16
- const selection = context.getCapability(AttentionCapabilities.Selection);
17
- Match.type().pipe(Match.when({
18
- mode: "single",
19
- id: void 0
20
- }, () => {
21
- selection.clearSelection(data.contextId);
22
- }), Match.when({
23
- mode: "single"
24
- }, (s) => {
25
- selection.updateSingle(data.contextId, s.id);
26
- }), Match.when({
27
- mode: "multi"
28
- }, (s) => {
29
- selection.updateMulti(data.contextId, s.ids);
30
- }), Match.when({
31
- mode: "range",
32
- from: void 0,
33
- to: void 0
34
- }, () => {
35
- selection.clearSelection(data.contextId);
36
- }), Match.when({
37
- mode: "range"
38
- }, (s) => {
39
- selection.updateRange(data.contextId, s.from, s.to);
40
- }), Match.when({
41
- mode: "multi-range"
42
- }, (s) => {
43
- selection.updateMultiRange(data.contextId, s.ranges);
44
- }), Match.exhaustive)(data.selection);
45
- }
46
- })
47
- ]);
48
- export {
49
- intent_resolver_default as default
50
- };
51
- //# sourceMappingURL=intent-resolver-E7G6R755.mjs.map