@sincpro/web-composer 1.2.0 → 1.4.0
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/README.md +47 -0
- package/dist/domain/index.d.ts +3 -2
- package/dist/domain/index.js +3 -2
- package/dist/domain/layout.d.ts +3 -0
- package/dist/domain/layout.js +7 -0
- package/dist/domain/phone.d.ts +18 -0
- package/dist/domain/phone.js +22 -0
- package/dist/domain/registry.d.ts +18 -5
- package/dist/domain/workspace.d.ts +13 -1
- package/dist/domain/workspace.js +23 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/shell/Composer.d.ts +7 -1
- package/dist/shell/Composer.js +65 -7
- package/dist/shell/Modal.d.ts +3 -2
- package/dist/shell/Modal.js +16 -6
- package/dist/shell/PanelHost.d.ts +3 -1
- package/dist/shell/PanelHost.js +6 -8
- package/dist/shell/RecordLink.d.ts +4 -1
- package/dist/shell/RecordLink.js +3 -3
- package/dist/shell/copy.d.ts +3 -0
- package/dist/shell/copy.js +2 -0
- package/dist/shell/skin.d.ts +5 -0
- package/dist/shell/styles.js +15 -1
- package/dist/state/agent.d.ts +66 -0
- package/dist/state/agent.js +222 -0
- package/dist/state/api.d.ts +4 -1
- package/dist/state/api.js +22 -11
- package/dist/state/drag.d.ts +1 -1
- package/dist/state/drag.js +3 -3
- package/dist/state/testing.d.ts +41 -0
- package/dist/state/testing.js +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Surface, } from "../domain/index.js";
|
|
2
|
+
const NO_CRUMBS = [];
|
|
3
|
+
const NO_REFS = [];
|
|
4
|
+
export function createTestApi(self, options = {}) {
|
|
5
|
+
const calls = [];
|
|
6
|
+
const pending = [];
|
|
7
|
+
const crumbs = options.crumbs ?? NO_CRUMBS;
|
|
8
|
+
const selection = options.selection ?? NO_REFS;
|
|
9
|
+
const record = (method) => (...args) => {
|
|
10
|
+
calls.push({ method, args });
|
|
11
|
+
};
|
|
12
|
+
const api = {
|
|
13
|
+
self,
|
|
14
|
+
surface: options.surface ?? Surface.Page,
|
|
15
|
+
over: options.over ?? null,
|
|
16
|
+
context: {
|
|
17
|
+
focused: () => self,
|
|
18
|
+
selection: () => selection,
|
|
19
|
+
subscribe: () => () => undefined,
|
|
20
|
+
},
|
|
21
|
+
open: record("open"),
|
|
22
|
+
navigate: record("navigate"),
|
|
23
|
+
replace: record("replace"),
|
|
24
|
+
setParams: record("setParams"),
|
|
25
|
+
back: record("back"),
|
|
26
|
+
expand: record("expand"),
|
|
27
|
+
close: record("close"),
|
|
28
|
+
focus: record("focus"),
|
|
29
|
+
crumbs: () => crumbs,
|
|
30
|
+
setTitle: record("setTitle"),
|
|
31
|
+
setDirty: record("setDirty"),
|
|
32
|
+
select: record("select"),
|
|
33
|
+
pick: (ref, onPick, pickOptions) => {
|
|
34
|
+
calls.push({ method: "pick", args: [ref, onPick, pickOptions] });
|
|
35
|
+
pending.push(onPick);
|
|
36
|
+
},
|
|
37
|
+
answer: record("answer"),
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
api,
|
|
41
|
+
calls,
|
|
42
|
+
callsTo: (method) => calls.filter((c) => c.method === method),
|
|
43
|
+
respond: (value) => pending.pop()?.(value),
|
|
44
|
+
};
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-composer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The Sincpro workspace for React: one page with its breadcrumb, a peek, side panels and windows, and ⌘K — all over references, never data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|