@dxos/plugin-attention 0.10.0 → 0.11.1
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/AttentionPlugin.mjs +50 -0
- package/dist/lib/AttentionPlugin.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +9 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-keyboard.mjs +16 -0
- package/dist/lib/chunk-keyboard.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-QWYNIPK3.mjs → chunk-meta.mjs} +13 -20
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/{neutral/operation-handler-O5PDEBTC.mjs → chunk-operation-handler.mjs} +7 -7
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-react-context.mjs +26 -0
- package/dist/lib/chunk-react-context.mjs.map +1 -0
- package/dist/lib/chunk-select.mjs +48 -0
- package/dist/lib/chunk-select.mjs.map +1 -0
- package/dist/lib/index.mjs +3 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/operations.mjs +7 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/testing.mjs +2 -0
- package/dist/lib/types.mjs +34 -0
- package/dist/lib/types.mjs.map +1 -0
- package/dist/types/src/capabilities/keyboard.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +1 -1
- package/dist/types/src/stories/SelectionState.stories.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +3 -3
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/src/AttentionPlugin.ts +4 -4
- package/src/operations/select.ts +7 -7
- package/src/stories/SelectionState.stories.tsx +5 -11
- package/src/types/capabilities.ts +3 -3
- package/src/types/types.ts +2 -2
- package/dist/lib/neutral/AttentionPlugin.mjs +0 -9
- package/dist/lib/neutral/AttentionPlugin.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -11
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BJDXKPRR.mjs +0 -63
- package/dist/lib/neutral/chunk-BJDXKPRR.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KYZ6BP6Z.mjs +0 -41
- package/dist/lib/neutral/chunk-KYZ6BP6Z.mjs.map +0 -7
- package/dist/lib/neutral/chunk-QWYNIPK3.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VO5BJP5D.mjs +0 -8
- package/dist/lib/neutral/chunk-VO5BJP5D.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -15
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/keyboard-LFMKJ3H7.mjs +0 -17
- package/dist/lib/neutral/keyboard-LFMKJ3H7.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -7
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/operation-handler-O5PDEBTC.mjs.map +0 -7
- package/dist/lib/neutral/operations/index.mjs +0 -7
- package/dist/lib/neutral/operations/index.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -15
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/react-context-G6G3ZRFI.mjs +0 -26
- package/dist/lib/neutral/react-context-G6G3ZRFI.mjs.map +0 -7
- package/dist/lib/neutral/select-AR23P2VZ.mjs +0 -68
- package/dist/lib/neutral/select-AR23P2VZ.mjs.map +0 -7
- package/dist/lib/neutral/testing.mjs +0 -7
- package/dist/lib/neutral/testing.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -11
- package/dist/lib/neutral/types/index.mjs.map +0 -7
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-QWYNIPK3.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AttentionOperationHandlerSet
|
|
6
|
-
} from "./chunk-VO5BJP5D.mjs";
|
|
7
|
-
|
|
8
|
-
// src/plugin.ts
|
|
9
|
-
import { Plugin } from "@dxos/app-framework";
|
|
10
|
-
var AttentionPlugin = Plugin.lazy(meta, () => import("#plugin"));
|
|
11
|
-
export {
|
|
12
|
-
AttentionOperationHandlerSet,
|
|
13
|
-
AttentionPlugin
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const AttentionPlugin = Plugin.lazy(meta, () => import('#plugin'));\n\nexport { AttentionOperationHandlerSet } from './operations';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,cAAc;AAIhB,IAAMC,kBAAkBC,OAAOC,KAAKC,MAAM,MAAM,OAAO,SAAA,CAAA;",
|
|
6
|
-
"names": ["Plugin", "AttentionPlugin", "Plugin", "lazy", "meta"]
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/capabilities/react-context.tsx
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
5
|
-
import { useCapability } from "@dxos/app-framework/ui";
|
|
6
|
-
import { RootAttentionProvider, ViewStateProvider } from "@dxos/react-ui-attention";
|
|
7
|
-
import { meta } from "#meta";
|
|
8
|
-
import { AttentionCapabilities } from "#types";
|
|
9
|
-
var react_context_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactContext, {
|
|
10
|
-
id: meta.profile.key,
|
|
11
|
-
context: (props) => {
|
|
12
|
-
const attention = useCapability(AttentionCapabilities.Attention);
|
|
13
|
-
const viewState = useCapability(AttentionCapabilities.ViewState);
|
|
14
|
-
return /* @__PURE__ */ React.createElement(RootAttentionProvider, {
|
|
15
|
-
attention,
|
|
16
|
-
onChange: (nextAttended) => {
|
|
17
|
-
}
|
|
18
|
-
}, /* @__PURE__ */ React.createElement(ViewStateProvider, {
|
|
19
|
-
manager: viewState
|
|
20
|
-
}, props.children));
|
|
21
|
-
}
|
|
22
|
-
})));
|
|
23
|
-
export {
|
|
24
|
-
react_context_default as default
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=react-context-G6G3ZRFI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-context.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { useCapability } from '@dxos/app-framework/ui';\nimport { RootAttentionProvider, ViewStateProvider } from '@dxos/react-ui-attention';\n\nimport { meta } from '#meta';\nimport { AttentionCapabilities } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactContext, {\n id: meta.profile.key,\n context: (props: PropsWithChildren) => {\n const attention = useCapability(AttentionCapabilities.Attention);\n const viewState = useCapability(AttentionCapabilities.ViewState);\n\n return (\n <RootAttentionProvider\n attention={attention}\n onChange={(nextAttended) => {\n // TODO(Zan): Workout why this was in deck plugin. It didn't seem to work?\n // if (layout.values.scrollIntoView && nextAttended.has(layout.values.scrollIntoView)) {\n // layout.values.scrollIntoView = undefined;\n // }\n }}\n >\n <ViewStateProvider manager={viewState}>{props.children}</ViewStateProvider>\n </RootAttentionProvider>\n );\n },\n }),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAuC;AAE9C,SAASC,cAAcC,kBAAkB;AACzC,SAASC,qBAAqB;AAC9B,SAASC,uBAAuBC,yBAAyB;AAEzD,SAASC,YAAY;AACrB,SAASC,6BAA6B;AAEtC,IAAA,wBAAeL,WAAWM,WAAW,MAC5BC,eACLP,WAAWQ,YAAYT,aAAaU,cAAc;EAChDC,IAAIN,KAAKO,QAAQC;EACjBC,SAAS,CAACC,UAAAA;AACR,UAAMC,YAAYd,cAAcI,sBAAsBW,SAAS;AAC/D,UAAMC,YAAYhB,cAAcI,sBAAsBa,SAAS;AAE/D,WACE,sBAAA,cAAChB,uBAAAA;MACCa;MACAI,UAAU,CAACC,iBAAAA;MAKX;OAEA,sBAAA,cAACjB,mBAAAA;MAAkBkB,SAASJ;OAAYH,MAAMQ,QAAQ,CAAA;EAG5D;AACF,CAAA,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capabilities", "Capability", "useCapability", "RootAttentionProvider", "ViewStateProvider", "meta", "AttentionCapabilities", "makeModule", "succeed", "contributes", "ReactContext", "id", "profile", "key", "context", "props", "attention", "Attention", "viewState", "ViewState", "onChange", "nextAttended", "manager", "children"]
|
|
7
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AttentionCapabilities
|
|
3
|
-
} from "./chunk-KYZ6BP6Z.mjs";
|
|
4
|
-
|
|
5
|
-
// src/operations/select.ts
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Match from "effect/Match";
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
10
|
-
import { Operation } from "@dxos/compute";
|
|
11
|
-
import { selectionAspect } from "@dxos/react-ui-attention";
|
|
12
|
-
var handler = LayoutOperation.Select.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
|
|
13
|
-
const viewState = yield* Capability.get(AttentionCapabilities.ViewState);
|
|
14
|
-
Match.value(input.subject).pipe(Match.when({
|
|
15
|
-
mode: "single",
|
|
16
|
-
id: void 0
|
|
17
|
-
}, () => {
|
|
18
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
19
|
-
mode: "single"
|
|
20
|
-
});
|
|
21
|
-
}), Match.when({
|
|
22
|
-
mode: "single"
|
|
23
|
-
}, (s) => {
|
|
24
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
25
|
-
mode: "single",
|
|
26
|
-
id: s.id
|
|
27
|
-
});
|
|
28
|
-
}), Match.when({
|
|
29
|
-
mode: "multi"
|
|
30
|
-
}, (s) => {
|
|
31
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
32
|
-
mode: "multi",
|
|
33
|
-
ids: [
|
|
34
|
-
...s.ids
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
}), Match.when({
|
|
38
|
-
mode: "range",
|
|
39
|
-
from: void 0,
|
|
40
|
-
to: void 0
|
|
41
|
-
}, () => {
|
|
42
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
43
|
-
mode: "range"
|
|
44
|
-
});
|
|
45
|
-
}), Match.when({
|
|
46
|
-
mode: "range"
|
|
47
|
-
}, (s) => {
|
|
48
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
49
|
-
mode: "range",
|
|
50
|
-
from: s.from,
|
|
51
|
-
to: s.to
|
|
52
|
-
});
|
|
53
|
-
}), Match.when({
|
|
54
|
-
mode: "multi-range"
|
|
55
|
-
}, (s) => {
|
|
56
|
-
viewState.set(selectionAspect, input.contextId, {
|
|
57
|
-
mode: "multi-range",
|
|
58
|
-
ranges: [
|
|
59
|
-
...s.ranges
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
}), Match.exhaustive);
|
|
63
|
-
})));
|
|
64
|
-
var select_default = handler;
|
|
65
|
-
export {
|
|
66
|
-
select_default as default
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=select-AR23P2VZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/select.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Match from 'effect/Match';\n\nimport { Capability } from '@dxos/app-framework';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\nimport { selectionAspect } from '@dxos/react-ui-attention';\n\nimport { AttentionCapabilities } from '../types';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.Select> = LayoutOperation.Select.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n const viewState = yield* Capability.get(AttentionCapabilities.ViewState);\n Match.value(input.subject).pipe(\n Match.when({ mode: 'single', id: undefined }, () => {\n viewState.set(selectionAspect, input.contextId, { mode: 'single' });\n }),\n Match.when({ mode: 'single' }, (s) => {\n viewState.set(selectionAspect, input.contextId, { mode: 'single', id: s.id });\n }),\n Match.when({ mode: 'multi' }, (s) => {\n viewState.set(selectionAspect, input.contextId, { mode: 'multi', ids: [...s.ids] });\n }),\n Match.when({ mode: 'range', from: undefined, to: undefined }, () => {\n viewState.set(selectionAspect, input.contextId, { mode: 'range' });\n }),\n Match.when({ mode: 'range' }, (s) => {\n viewState.set(selectionAspect, input.contextId, { mode: 'range', from: s.from, to: s.to });\n }),\n Match.when({ mode: 'multi-range' }, (s) => {\n viewState.set(selectionAspect, input.contextId, { mode: 'multi-range', ranges: [...s.ranges] });\n }),\n Match.exhaustive,\n );\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAIhC,IAAMC,UAAgEC,gBAAgBC,OAAOC,KAC3FC,UAAUC,YACDC,kB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e", "Operation", "withHandler", "fnUntraced", "input", "viewState", "Capability", "get", "AttentionCapabilities", "ViewState", "Match", "value", "subject", "when", "mode", "id", "undefined", "set", "selectionAspect", "contextId", "s", "ids", "from", "to", "ranges", "exhaustive"]
|
|
7
|
-
}
|