@floegence/floe-webapp-core 0.36.75 → 0.36.76
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/components/workbench/WorkbenchCanvas.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.js +34 -25
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +18 -12
- package/dist/components/workbench/WorkbenchSurface.d.ts +6 -0
- package/dist/components/workbench/WorkbenchSurface.js +198 -161
- package/dist/components/workbench/WorkbenchWidget.d.ts +1 -0
- package/dist/components/workbench/WorkbenchWidget.js +183 -176
- package/dist/utils/uiFirstSelection.d.ts +2 -0
- package/dist/utils/uiFirstSelection.js +49 -45
- package/package.json +1 -1
|
@@ -13,6 +13,8 @@ export interface CreateUIFirstSelectionOptions<T, M = undefined> {
|
|
|
13
13
|
committed: Accessor<T>;
|
|
14
14
|
commit: (value: T, metadata: M | undefined) => void;
|
|
15
15
|
equals?: (left: T, right: T) => boolean;
|
|
16
|
+
/** Run the deferred commit even when the requested value already equals canonical state. */
|
|
17
|
+
commitEqualRequests?: boolean;
|
|
16
18
|
onEvent?: (event: UIFirstSelectionEvent<T, M>) => void;
|
|
17
19
|
scheduleAfterPaint?: (callback: () => void) => void;
|
|
18
20
|
}
|
|
@@ -1,66 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { deferAfterPaint as
|
|
3
|
-
function
|
|
1
|
+
import { untrack as p, createSignal as v, createEffect as x, onCleanup as C } from "solid-js";
|
|
2
|
+
import { deferAfterPaint as E } from "./defer.js";
|
|
3
|
+
function w() {
|
|
4
4
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
function b(a) {
|
|
7
|
+
const m = a.equals ?? Object.is, u = a.scheduleAfterPaint ?? E;
|
|
8
|
+
let o = p(a.committed);
|
|
9
|
+
const [A, i] = v(o, { equals: m }), [q, d] = v(!1);
|
|
10
|
+
let c = null, g = 1, r = !1, f = !1;
|
|
11
|
+
const s = (t, n) => {
|
|
12
|
+
const e = w();
|
|
13
|
+
a.onEvent?.({
|
|
14
|
+
phase: t,
|
|
15
|
+
value: n.value,
|
|
16
|
+
metadata: n.metadata,
|
|
17
|
+
transactionId: n.id,
|
|
18
|
+
startedAt: n.startedAt,
|
|
19
|
+
timestamp: e,
|
|
20
|
+
elapsedMs: Math.max(0, e - n.startedAt)
|
|
19
21
|
});
|
|
20
|
-
}, l = (
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, P = (
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
22
|
+
}, l = (t) => {
|
|
23
|
+
const n = c;
|
|
24
|
+
c = null, f = !1, d(!1), n && s("cancelled", n), t && !r && i(() => a.committed());
|
|
25
|
+
}, P = (t, n) => {
|
|
26
|
+
if (r) return;
|
|
27
|
+
if (c && l(!1), f = !1, i(() => t), m(t, a.committed()) && !a.commitEqualRequests) {
|
|
26
28
|
d(!1);
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
const
|
|
30
|
-
id:
|
|
31
|
-
value:
|
|
32
|
-
metadata:
|
|
33
|
-
startedAt:
|
|
31
|
+
const e = {
|
|
32
|
+
id: g,
|
|
33
|
+
value: t,
|
|
34
|
+
metadata: n,
|
|
35
|
+
startedAt: w(),
|
|
34
36
|
committing: !1
|
|
35
37
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
g += 1, c = e, d(!0), s("requested", e), u(() => {
|
|
39
|
+
r || c !== e || (s("intent_presented", e), s("commit_started", e), e.committing = !0, a.commit(e.value, e.metadata), e.committing = !1, !(r || c !== e) && (s("committed", e), u(() => {
|
|
40
|
+
r || c !== e || (s("content_presented", e), c = null, d(!1), i(() => a.committed()));
|
|
39
41
|
})));
|
|
40
42
|
});
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
+
}, h = (t, n) => {
|
|
44
|
+
r || (l(!1), f = !1, i(() => t), m(t, a.committed()) || a.commit(t, n), i(() => a.committed()));
|
|
43
45
|
};
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
return x(() => {
|
|
47
|
+
const t = a.committed(), n = !m(t, o);
|
|
48
|
+
o = t;
|
|
49
|
+
const e = c;
|
|
50
|
+
e && e.committing && m(t, e.value) || (e && n && !m(t, e.value) && l(!1), (!c || !m(t, c.value)) && (f = !1, i(() => t)));
|
|
51
|
+
}), C(() => {
|
|
52
|
+
r = !0, l(!1);
|
|
49
53
|
}), {
|
|
50
|
-
visual:
|
|
51
|
-
committed:
|
|
52
|
-
pending:
|
|
53
|
-
preview: (
|
|
54
|
-
|
|
54
|
+
visual: A,
|
|
55
|
+
committed: a.committed,
|
|
56
|
+
pending: q,
|
|
57
|
+
preview: (t) => {
|
|
58
|
+
r || c || (f = !0, i(() => t));
|
|
55
59
|
},
|
|
56
60
|
resetPreview: () => {
|
|
57
|
-
|
|
61
|
+
r || !f || c || (f = !1, i(() => a.committed()));
|
|
58
62
|
},
|
|
59
63
|
request: P,
|
|
60
|
-
commitNow:
|
|
64
|
+
commitNow: h,
|
|
61
65
|
cancel: () => l(!0)
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
export {
|
|
65
|
-
|
|
69
|
+
b as createUIFirstSelection
|
|
66
70
|
};
|