@wardic/dom 1.1.0 → 1.1.2
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/DomProjectionSystem.js +3 -3
- package/dist/DomProjectionSystem.js.map +1 -1
- package/dist/FlushGate.d.ts +6 -6
- package/dist/FlushGate.d.ts.map +1 -1
- package/dist/FlushGate.js +7 -5
- package/dist/FlushGate.js.map +1 -1
- package/dist/ReorderController.js +3 -3
- package/dist/ReorderController.js.map +1 -1
- package/dist/Report.d.ts +1 -1
- package/dist/Report.d.ts.map +1 -1
- package/dist/Report.js +3 -2
- package/dist/Report.js.map +1 -1
- package/dist/Style.d.ts +2 -1
- package/dist/Style.d.ts.map +1 -1
- package/dist/Style.js +3 -1
- package/dist/Style.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/batch-handoff.d.ts +25 -0
- package/dist/internal/batch-handoff.d.ts.map +1 -0
- package/dist/internal/batch-handoff.js +64 -0
- package/dist/internal/batch-handoff.js.map +1 -0
- package/dist/internal/gate-environment.d.ts +4 -0
- package/dist/internal/gate-environment.d.ts.map +1 -0
- package/dist/internal/gate-environment.js +21 -0
- package/dist/internal/gate-environment.js.map +1 -0
- package/dist/internal/projection.js +14 -14
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/reorder.d.ts +2 -2
- package/dist/internal/reorder.d.ts.map +1 -1
- package/dist/internal/reorder.js +2 -2
- package/dist/internal/reorder.js.map +1 -1
- package/dist/internal/starting-style.d.ts +0 -83
- package/dist/internal/starting-style.d.ts.map +1 -1
- package/dist/internal/starting-style.js +16 -143
- package/dist/internal/starting-style.js.map +1 -1
- package/dist/unstable/AppearAnimations.d.ts +191 -0
- package/dist/unstable/AppearAnimations.d.ts.map +1 -0
- package/dist/unstable/AppearAnimations.js +561 -0
- package/dist/unstable/AppearAnimations.js.map +1 -0
- package/dist/unstable/BatchMembers.d.ts +513 -0
- package/dist/unstable/BatchMembers.d.ts.map +1 -0
- package/dist/unstable/BatchMembers.js +2490 -0
- package/dist/unstable/BatchMembers.js.map +1 -0
- package/dist/unstable/DomValues.d.ts +25 -0
- package/dist/unstable/DomValues.d.ts.map +1 -0
- package/dist/unstable/DomValues.js +45 -0
- package/dist/unstable/DomValues.js.map +1 -0
- package/dist/unstable/DragConstraints.d.ts +48 -0
- package/dist/unstable/DragConstraints.d.ts.map +1 -0
- package/dist/unstable/DragConstraints.js +49 -0
- package/dist/unstable/DragConstraints.js.map +1 -0
- package/dist/unstable/DragControls.d.ts +50 -0
- package/dist/unstable/DragControls.d.ts.map +1 -0
- package/dist/unstable/DragControls.js +55 -0
- package/dist/unstable/DragControls.js.map +1 -0
- package/dist/unstable/DragDefaults.d.ts +34 -0
- package/dist/unstable/DragDefaults.d.ts.map +1 -0
- package/dist/unstable/DragDefaults.js +47 -0
- package/dist/unstable/DragDefaults.js.map +1 -0
- package/dist/unstable/DragTrack.d.ts +236 -0
- package/dist/unstable/DragTrack.d.ts.map +1 -0
- package/dist/unstable/DragTrack.js +646 -0
- package/dist/unstable/DragTrack.js.map +1 -0
- package/dist/unstable/DragTransition.d.ts +22 -0
- package/dist/unstable/DragTransition.d.ts.map +1 -0
- package/dist/unstable/DragTransition.js +31 -0
- package/dist/unstable/DragTransition.js.map +1 -0
- package/dist/unstable/ElementSetup.d.ts +144 -0
- package/dist/unstable/ElementSetup.d.ts.map +1 -0
- package/dist/unstable/ElementSetup.js +297 -0
- package/dist/unstable/ElementSetup.js.map +1 -0
- package/dist/unstable/Feature.d.ts +221 -0
- package/dist/unstable/Feature.d.ts.map +1 -0
- package/dist/unstable/Feature.js +281 -0
- package/dist/unstable/Feature.js.map +1 -0
- package/dist/unstable/GestureFeatures.d.ts +30 -0
- package/dist/unstable/GestureFeatures.d.ts.map +1 -0
- package/dist/unstable/GestureFeatures.js +32 -0
- package/dist/unstable/GestureFeatures.js.map +1 -0
- package/dist/unstable/GestureInfo.d.ts +61 -0
- package/dist/unstable/GestureInfo.d.ts.map +1 -0
- package/dist/unstable/GestureInfo.js +23 -0
- package/dist/unstable/GestureInfo.js.map +1 -0
- package/dist/unstable/Imperative.d.ts +214 -0
- package/dist/unstable/Imperative.d.ts.map +1 -0
- package/dist/unstable/Imperative.js +768 -0
- package/dist/unstable/Imperative.js.map +1 -0
- package/dist/unstable/Instant.d.ts +46 -0
- package/dist/unstable/Instant.d.ts.map +1 -0
- package/dist/unstable/Instant.js +49 -0
- package/dist/unstable/Instant.js.map +1 -0
- package/dist/unstable/LayoutGroup.d.ts +14 -0
- package/dist/unstable/LayoutGroup.d.ts.map +1 -0
- package/dist/unstable/LayoutGroup.js +31 -0
- package/dist/unstable/LayoutGroup.js.map +1 -0
- package/dist/unstable/LayoutMember.d.ts +127 -0
- package/dist/unstable/LayoutMember.d.ts.map +1 -0
- package/dist/unstable/LayoutMember.js +176 -0
- package/dist/unstable/LayoutMember.js.map +1 -0
- package/dist/unstable/LiveStyle.d.ts +171 -0
- package/dist/unstable/LiveStyle.d.ts.map +1 -0
- package/dist/unstable/LiveStyle.js +329 -0
- package/dist/unstable/LiveStyle.js.map +1 -0
- package/dist/unstable/MemberHold.d.ts +3 -0
- package/dist/unstable/MemberHold.d.ts.map +1 -0
- package/dist/unstable/MemberHold.js +223 -0
- package/dist/unstable/MemberHold.js.map +1 -0
- package/dist/unstable/OwnerScope.d.ts +16 -0
- package/dist/unstable/OwnerScope.d.ts.map +1 -0
- package/dist/unstable/OwnerScope.js +35 -0
- package/dist/unstable/OwnerScope.js.map +1 -0
- package/dist/unstable/PresenceController.d.ts +128 -0
- package/dist/unstable/PresenceController.d.ts.map +1 -0
- package/dist/unstable/PresenceController.js +1427 -0
- package/dist/unstable/PresenceController.js.map +1 -0
- package/dist/unstable/Press.d.ts +26 -0
- package/dist/unstable/Press.d.ts.map +1 -0
- package/dist/unstable/Press.js +19 -0
- package/dist/unstable/Press.js.map +1 -0
- package/dist/unstable/ServerInterpolators.d.ts +17 -0
- package/dist/unstable/ServerInterpolators.d.ts.map +1 -0
- package/dist/unstable/ServerInterpolators.js +20 -0
- package/dist/unstable/ServerInterpolators.js.map +1 -0
- package/dist/unstable/WardConfig.d.ts +567 -0
- package/dist/unstable/WardConfig.d.ts.map +1 -0
- package/dist/unstable/WardConfig.js +2 -0
- package/dist/unstable/WardConfig.js.map +1 -0
- package/dist/unstable/features/All.d.ts +24 -0
- package/dist/unstable/features/All.d.ts.map +1 -0
- package/dist/unstable/features/All.js +20 -0
- package/dist/unstable/features/All.js.map +1 -0
- package/dist/unstable/features/Colors.d.ts +12 -0
- package/dist/unstable/features/Colors.d.ts.map +1 -0
- package/dist/unstable/features/Colors.js +38 -0
- package/dist/unstable/features/Colors.js.map +1 -0
- package/dist/unstable/features/DomAnimation.d.ts +16 -0
- package/dist/unstable/features/DomAnimation.d.ts.map +1 -0
- package/dist/unstable/features/DomAnimation.js +19 -0
- package/dist/unstable/features/DomAnimation.js.map +1 -0
- package/dist/unstable/features/DomMax.d.ts +12 -0
- package/dist/unstable/features/DomMax.d.ts.map +1 -0
- package/dist/unstable/features/DomMax.js +14 -0
- package/dist/unstable/features/DomMax.js.map +1 -0
- package/dist/unstable/features/Drag.d.ts +5 -0
- package/dist/unstable/features/Drag.d.ts.map +1 -0
- package/dist/unstable/features/Drag.js +32 -0
- package/dist/unstable/features/Drag.js.map +1 -0
- package/dist/unstable/features/Focus.d.ts +5 -0
- package/dist/unstable/features/Focus.d.ts.map +1 -0
- package/dist/unstable/features/Focus.js +20 -0
- package/dist/unstable/features/Focus.js.map +1 -0
- package/dist/unstable/features/Hover.d.ts +5 -0
- package/dist/unstable/features/Hover.d.ts.map +1 -0
- package/dist/unstable/features/Hover.js +20 -0
- package/dist/unstable/features/Hover.js.map +1 -0
- package/dist/unstable/features/InView.d.ts +5 -0
- package/dist/unstable/features/InView.d.ts.map +1 -0
- package/dist/unstable/features/InView.js +20 -0
- package/dist/unstable/features/InView.js.map +1 -0
- package/dist/unstable/features/Input.d.ts +28 -0
- package/dist/unstable/features/Input.d.ts.map +1 -0
- package/dist/unstable/features/Input.js +31 -0
- package/dist/unstable/features/Input.js.map +1 -0
- package/dist/unstable/features/Keys.d.ts +95 -0
- package/dist/unstable/features/Keys.d.ts.map +1 -0
- package/dist/unstable/features/Keys.js +44 -0
- package/dist/unstable/features/Keys.js.map +1 -0
- package/dist/unstable/features/Layout.d.ts +43 -0
- package/dist/unstable/features/Layout.d.ts.map +1 -0
- package/dist/unstable/features/Layout.js +44 -0
- package/dist/unstable/features/Layout.js.map +1 -0
- package/dist/unstable/features/Pan.d.ts +5 -0
- package/dist/unstable/features/Pan.d.ts.map +1 -0
- package/dist/unstable/features/Pan.js +20 -0
- package/dist/unstable/features/Pan.js.map +1 -0
- package/dist/unstable/features/Press.d.ts +13 -0
- package/dist/unstable/features/Press.d.ts.map +1 -0
- package/dist/unstable/features/Press.js +10 -0
- package/dist/unstable/features/Press.js.map +1 -0
- package/dist/unstable/features/Scroll.d.ts +20 -0
- package/dist/unstable/features/Scroll.d.ts.map +1 -0
- package/dist/unstable/features/Scroll.js +34 -0
- package/dist/unstable/features/Scroll.js.map +1 -0
- package/dist/unstable/features/TimelineKeys.d.ts +7 -0
- package/dist/unstable/features/TimelineKeys.d.ts.map +1 -0
- package/dist/unstable/features/TimelineKeys.js +103 -0
- package/dist/unstable/features/TimelineKeys.js.map +1 -0
- package/package.json +4 -3
- package/src/DomProjectionSystem.ts +3 -3
- package/src/FlushGate.ts +11 -9
- package/src/ReorderController.ts +3 -3
- package/src/Report.ts +3 -7
- package/src/Style.ts +4 -1
- package/src/index.ts +1 -1
- package/src/internal/batch-handoff.ts +75 -0
- package/src/internal/gate-environment.ts +21 -0
- package/src/internal/projection.ts +14 -14
- package/src/internal/reorder.ts +4 -4
- package/src/internal/starting-style.ts +5 -204
- package/src/unstable/AppearAnimations.ts +837 -0
- package/src/unstable/BatchMembers.ts +3085 -0
- package/src/unstable/DomValues.ts +53 -0
- package/src/unstable/DragConstraints.ts +107 -0
- package/src/unstable/DragControls.ts +98 -0
- package/src/unstable/DragDefaults.ts +57 -0
- package/src/unstable/DragTrack.ts +959 -0
- package/src/unstable/DragTransition.ts +46 -0
- package/src/unstable/ElementSetup.ts +411 -0
- package/src/unstable/Feature.ts +494 -0
- package/src/unstable/GestureFeatures.ts +38 -0
- package/src/unstable/GestureInfo.ts +85 -0
- package/src/unstable/Imperative.ts +1037 -0
- package/src/unstable/Instant.ts +93 -0
- package/src/unstable/LayoutGroup.ts +36 -0
- package/src/unstable/LayoutMember.ts +319 -0
- package/src/unstable/LiveStyle.ts +497 -0
- package/src/unstable/MemberHold.ts +211 -0
- package/src/unstable/OwnerScope.ts +35 -0
- package/src/unstable/PresenceController.ts +1747 -0
- package/src/unstable/Press.ts +43 -0
- package/src/unstable/ServerInterpolators.ts +39 -0
- package/src/unstable/WardConfig.ts +704 -0
- package/src/unstable/features/All.ts +39 -0
- package/src/unstable/features/Colors.ts +40 -0
- package/src/unstable/features/DomAnimation.ts +19 -0
- package/src/unstable/features/DomMax.ts +14 -0
- package/src/unstable/features/Drag.ts +34 -0
- package/src/unstable/features/Focus.ts +21 -0
- package/src/unstable/features/Hover.ts +21 -0
- package/src/unstable/features/InView.ts +21 -0
- package/src/unstable/features/Input.ts +37 -0
- package/src/unstable/features/Keys.ts +124 -0
- package/src/unstable/features/Layout.ts +75 -0
- package/src/unstable/features/Pan.ts +21 -0
- package/src/unstable/features/Press.ts +21 -0
- package/src/unstable/features/Scroll.ts +35 -0
- package/src/unstable/features/TimelineKeys.ts +115 -0
- package/dist/internal/gate.d.ts +0 -199
- package/dist/internal/gate.d.ts.map +0 -1
- package/dist/internal/gate.js +0 -570
- package/dist/internal/gate.js.map +0 -1
- package/dist/internal/report.d.ts +0 -30
- package/dist/internal/report.d.ts.map +0 -1
- package/dist/internal/report.js +0 -60
- package/dist/internal/report.js.map +0 -1
- package/dist/internal/runner.d.ts +0 -22
- package/dist/internal/runner.d.ts.map +0 -1
- package/dist/internal/runner.js +0 -62
- package/dist/internal/runner.js.map +0 -1
- package/src/internal/gate.ts +0 -706
- package/src/internal/report.ts +0 -69
- package/src/internal/runner.ts +0 -78
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Batch member's element's hold on the groups a Wardic element on it takes from its Batch (#665's
|
|
3
|
+
* PR 4, ADR-0069 decision 17, Q52–Q54): the latest driver. Its spine makes one as it first finds its
|
|
4
|
+
* element a member's, through what `createBatch` provides here: an app with no Batch ships none of it.
|
|
5
|
+
*
|
|
6
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
// Unstable: ADR-0071, decision 5. #672 (Q14): the filler half of solid's `member-hold.ts` (its slot is core's
|
|
11
|
+
// Spine's), moved to dom beside the Batch for every DOM binding's `createBatch`.
|
|
12
|
+
// ADR-0070, *Amendment (#665)*: only members pay. A spine reads one module slot a Retarget while no
|
|
13
|
+
// Batch has been made, and a WeakMap after; this module's code is reached through `provideBatchHolds`,
|
|
14
|
+
// which only `createBatch` calls.
|
|
15
|
+
import * as BaseValue from "@wardic/core/BaseValue";
|
|
16
|
+
import * as Arr from "effect/Array";
|
|
17
|
+
import { constFalse } from "effect/Function";
|
|
18
|
+
import * as Iter from "effect/Iterable";
|
|
19
|
+
import * as Predicate from "effect/Predicate";
|
|
20
|
+
import * as Rec from "effect/Record";
|
|
21
|
+
import * as BatchMembers from "./BatchMembers.js";
|
|
22
|
+
import * as Spine from "@wardic/core/unstable/Spine";
|
|
23
|
+
// What a hold works its spine with (#746): here, not in the spine, so an app with no Batch ships none
|
|
24
|
+
// of it (ADR-0070's *Note (#746)*). Functions over the host, not closures: a hold makes none of its own.
|
|
25
|
+
/** Whether a leg still runs on a key `which` picks. */
|
|
26
|
+
// Per held group at a leg's end or a Batch change (#665): statements.
|
|
27
|
+
const anyRunning = (host, which) => {
|
|
28
|
+
let runs = false;
|
|
29
|
+
Iter.forEach(host.owners, ([key, running]) => {
|
|
30
|
+
if (Predicate.isUndefined(running))
|
|
31
|
+
return;
|
|
32
|
+
if (running.done)
|
|
33
|
+
return;
|
|
34
|
+
if (which(key))
|
|
35
|
+
runs = true;
|
|
36
|
+
});
|
|
37
|
+
return runs;
|
|
38
|
+
};
|
|
39
|
+
/** The keys `which` picks given up by the legs drawing them, each leg drawing the rest from then on. */
|
|
40
|
+
// Setting a visited key is safe in a Map's iteration.
|
|
41
|
+
const giveUpKeys = (host, which) => {
|
|
42
|
+
Iter.forEach(host.owners, ([key, running]) => {
|
|
43
|
+
if (Predicate.isUndefined(running))
|
|
44
|
+
return;
|
|
45
|
+
if (which(key))
|
|
46
|
+
host.giveUp(key, running);
|
|
47
|
+
});
|
|
48
|
+
host.keepTheRest();
|
|
49
|
+
};
|
|
50
|
+
/** `key`'s speed at `now`, per second. */
|
|
51
|
+
const velocityOf = (host, key, now) => Spine.velocityAt(host.snapshot, host.owners.get(key), key, now);
|
|
52
|
+
/** `key` the spine's no more: out of the keys it drove and those it returns. */
|
|
53
|
+
const forgetKey = (host, key) => {
|
|
54
|
+
host.driven.delete(key);
|
|
55
|
+
host.returning().delete(key);
|
|
56
|
+
};
|
|
57
|
+
/** Holds made from now on (`createBatch`, as it's called): a Batch's members can be Wardic elements. */
|
|
58
|
+
// #672 (Q14): the slot is the spine's; this fills it with the Batch's holds.
|
|
59
|
+
export const provideBatchHolds = () => Spine.provideMemberHolds(BATCH_HOLDS);
|
|
60
|
+
/** A Batch member's element's {@link Spine.MemberHold}. */
|
|
61
|
+
const makeMemberHold = (host) => {
|
|
62
|
+
const { element, gate, id, snapshot } = host;
|
|
63
|
+
// The groups it holds now, each with the Batch's keys in it; the member it took them from; and whether
|
|
64
|
+
// a drag holds `x`/`y`, from its first read or write to its hand-back.
|
|
65
|
+
const held = new Map();
|
|
66
|
+
let takenFrom;
|
|
67
|
+
let dragging = false;
|
|
68
|
+
/** A transform key the Batch doesn't draw (`rotate` on an `{ x, y }` Batch): its `transform` would drop it. */
|
|
69
|
+
const undrawnBy = (batchKeys) => (key) => {
|
|
70
|
+
if (BatchMembers.batchGroupOf(key) !== "transform")
|
|
71
|
+
return false;
|
|
72
|
+
return !Arr.contains(batchKeys, key);
|
|
73
|
+
};
|
|
74
|
+
/** Whether a transform key the Batch doesn't draw has a leg running, or is off its identity. */
|
|
75
|
+
// Per held transform at a leg's end or a Batch change (#665): statements.
|
|
76
|
+
const holdsUndrawn = (batchKeys) => {
|
|
77
|
+
const undrawn = undrawnBy(batchKeys);
|
|
78
|
+
if (anyRunning(host, undrawn))
|
|
79
|
+
return true;
|
|
80
|
+
return Arr.some(Rec.keys(snapshot.values), (key) => {
|
|
81
|
+
if (!undrawn(key))
|
|
82
|
+
return false;
|
|
83
|
+
return snapshot.values[key] !== BaseValue.TRANSFORM_IDENTITY[key];
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
/** Whether it keeps the transform: a drag holds it, or a transform key the Batch doesn't draw. */
|
|
87
|
+
const keepsTransform = (batchKeys) => {
|
|
88
|
+
if (dragging)
|
|
89
|
+
return true;
|
|
90
|
+
return holdsUndrawn(batchKeys);
|
|
91
|
+
};
|
|
92
|
+
/** `group` given back: its legs give its keys up, the gate draws it no more (what's drawn kept), and its Batch keys' values and speeds. */
|
|
93
|
+
const surrender = (group) => {
|
|
94
|
+
const batchKeys = held.get(group);
|
|
95
|
+
if (Predicate.isUndefined(batchKeys))
|
|
96
|
+
return undefined;
|
|
97
|
+
held.delete(group);
|
|
98
|
+
const now = snapshot.now();
|
|
99
|
+
const values = {};
|
|
100
|
+
const velocities = {};
|
|
101
|
+
Arr.forEach(batchKeys, (key) => {
|
|
102
|
+
values[key] = snapshot.values[key];
|
|
103
|
+
velocities[key] = velocityOf(host, key, now);
|
|
104
|
+
});
|
|
105
|
+
const inGroup = (key) => BatchMembers.batchGroupOf(key) === group;
|
|
106
|
+
giveUpKeys(host, inGroup);
|
|
107
|
+
const keys = Arr.filter(Rec.keys(snapshot.values), inGroup);
|
|
108
|
+
// Left as drawn as it drops out: the Batch's writer draws it from its next step. A group's name is its property's.
|
|
109
|
+
gate.release(id, keys, undefined, [group]);
|
|
110
|
+
Arr.forEach(keys, (key) => {
|
|
111
|
+
delete snapshot.values[key];
|
|
112
|
+
forgetKey(host, key);
|
|
113
|
+
});
|
|
114
|
+
return { values, velocities };
|
|
115
|
+
};
|
|
116
|
+
const holder = {
|
|
117
|
+
surrender,
|
|
118
|
+
keepsThrough: (group) => {
|
|
119
|
+
if (group !== "transform")
|
|
120
|
+
return false;
|
|
121
|
+
const batchKeys = held.get(group);
|
|
122
|
+
if (Predicate.isUndefined(batchKeys))
|
|
123
|
+
return false;
|
|
124
|
+
return keepsTransform(batchKeys);
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
/** `group` taken from the Batch of `entry`, its element's member (Q53): seeded at the member's values and speeds, drawn by the gate from now on. */
|
|
128
|
+
const claim = (entry, group) => {
|
|
129
|
+
if (held.has(group))
|
|
130
|
+
return;
|
|
131
|
+
const given = entry.binding.yieldGroup(entry.member, group, holder);
|
|
132
|
+
if (Predicate.isUndefined(given))
|
|
133
|
+
return;
|
|
134
|
+
held.set(group, given.keys);
|
|
135
|
+
snapshot.values = { ...snapshot.values, ...given.values };
|
|
136
|
+
snapshot.velocities = { ...snapshot.velocities, ...given.velocities };
|
|
137
|
+
const now = snapshot.now();
|
|
138
|
+
Arr.forEach(given.keys, (seeded) => {
|
|
139
|
+
snapshot.drawnAt[seeded] = now;
|
|
140
|
+
});
|
|
141
|
+
gate.write(id, given.values);
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Its element's member now, what it holds kept only if it's the one it took them from: an element
|
|
145
|
+
* another member's, or its Batch's no more, holds nothing of its old one.
|
|
146
|
+
*/
|
|
147
|
+
const memberNow = () => {
|
|
148
|
+
const entry = BatchMembers.memberEntryOf(element);
|
|
149
|
+
if (entry === takenFrom)
|
|
150
|
+
return entry;
|
|
151
|
+
held.clear();
|
|
152
|
+
takenFrom = entry;
|
|
153
|
+
return entry;
|
|
154
|
+
};
|
|
155
|
+
/** Each group it holds and `keeps` doesn't, back to the member's Batch, from where it is. Deleting the visited entry is safe in a Map's iteration. */
|
|
156
|
+
const giveBack = (keeps) => {
|
|
157
|
+
if (held.size === 0)
|
|
158
|
+
return;
|
|
159
|
+
const entry = memberNow();
|
|
160
|
+
if (Predicate.isUndefined(entry))
|
|
161
|
+
return;
|
|
162
|
+
Iter.forEach(held, ([group, batchKeys]) => {
|
|
163
|
+
if (keeps(group, batchKeys))
|
|
164
|
+
return;
|
|
165
|
+
const back = surrender(group);
|
|
166
|
+
if (Predicate.isNotUndefined(back))
|
|
167
|
+
entry.binding.reclaim(entry.member, group, back);
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
/** Whether `group` stays its own at a leg's end: a leg runs on it, or it's the transform it keeps (Q54). */
|
|
171
|
+
const stays = (group, batchKeys) => {
|
|
172
|
+
if (anyRunning(host, (key) => BatchMembers.batchGroupOf(key) === group))
|
|
173
|
+
return true;
|
|
174
|
+
if (group !== "transform")
|
|
175
|
+
return false;
|
|
176
|
+
return keepsTransform(batchKeys);
|
|
177
|
+
};
|
|
178
|
+
return {
|
|
179
|
+
retarget: (t, dragged) => {
|
|
180
|
+
const entry = memberNow();
|
|
181
|
+
if (Predicate.isUndefined(entry))
|
|
182
|
+
return;
|
|
183
|
+
if (dragged)
|
|
184
|
+
claim(entry, "transform");
|
|
185
|
+
// Per key of a member's Retarget: statements.
|
|
186
|
+
Arr.forEach(Rec.keys(t), (key) => {
|
|
187
|
+
const group = BatchMembers.batchGroupOf(key);
|
|
188
|
+
if (Predicate.isUndefined(group))
|
|
189
|
+
return;
|
|
190
|
+
if (held.has(group))
|
|
191
|
+
return;
|
|
192
|
+
const drawn = entry.binding.drawnValueOf(entry.member, key);
|
|
193
|
+
if (Predicate.isUndefined(drawn))
|
|
194
|
+
return;
|
|
195
|
+
if (t[key] === drawn) {
|
|
196
|
+
delete t[key];
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
claim(entry, group);
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
settle: () => giveBack(stays),
|
|
203
|
+
drag: (on) => {
|
|
204
|
+
if (on) {
|
|
205
|
+
dragging = true;
|
|
206
|
+
if (held.has("transform"))
|
|
207
|
+
return;
|
|
208
|
+
const entry = memberNow();
|
|
209
|
+
if (Predicate.isNotUndefined(entry))
|
|
210
|
+
claim(entry, "transform");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (!dragging)
|
|
214
|
+
return;
|
|
215
|
+
dragging = false;
|
|
216
|
+
giveBack(stays);
|
|
217
|
+
},
|
|
218
|
+
dispose: () => giveBack(constFalse),
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
/** The Batch's holds, which `provideBatchHolds` gives the spine's slot: one record, made once. */
|
|
222
|
+
const BATCH_HOLDS = { isMember: BatchMembers.isMemberElement, make: makeMemberHold };
|
|
223
|
+
//# sourceMappingURL=MemberHold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberHold.js","sourceRoot":"","sources":["../../src/unstable/MemberHold.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,8GAA8G;AAC9G,iFAAiF;AACjF,oGAAoG;AACpG,uGAAuG;AACvG,kCAAkC;AAClC,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AAEpD,sGAAsG;AACtG,yGAAyG;AAEz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AK,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7B,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;YACX,IAAI,EAAE,EAAE,CAAC;gBACP,QAAQ,GAAG,IAAI,CAAA;gBACf,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;oBAAE,OAAM;gBACjC,MAAM,KAAK,GAAG,SAAS,EAAE,CAAA;gBACzB,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC;oBAAE,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;gBAC9D,OAAM;YACR,CAAC;YACD,IAAI,CAAC,QAAQ;gBAAE,OAAM;YACrB,QAAQ,GAAG,KAAK,CAAA;YAChB,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;KACpC,CAAA;AACH,CAAC,CAAA;AAED,kGAAkG;AAClG,MAAM,WAAW,GAAsB,EAAE,QAAQ,EAAE,YAAY,CAAC,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Scope from "effect/Scope";
|
|
2
|
+
import type * as WardicServices from "@wardic/core/unstable/WardicServices";
|
|
3
|
+
/**
|
|
4
|
+
* A Scope for one owner's work on `runtime`: a child of the runtime's, so the runtime's disposal closes
|
|
5
|
+
* it if its owner hasn't. Its finalizers run in reverse order, as a Scope's do.
|
|
6
|
+
*/
|
|
7
|
+
export declare const open: (runtime: {
|
|
8
|
+
readonly scope: Scope.Scope;
|
|
9
|
+
}) => Scope.Closeable;
|
|
10
|
+
/**
|
|
11
|
+
* Closes `scope` now, synchronously, on `runtime`. A finalizer that fails is logged and reported as
|
|
12
|
+
* `label` (`Report.failure`), never thrown: the rest of the binding's cleanup that closes it still runs. A
|
|
13
|
+
* Scope the runtime's disposal already closed is left as it is.
|
|
14
|
+
*/
|
|
15
|
+
export declare const close: <R>(runtime: WardicServices.Runner<R>, scope: Scope.Closeable, label: string) => void;
|
|
16
|
+
//# sourceMappingURL=OwnerScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnerScope.d.ts","sourceRoot":"","sources":["../../src/unstable/OwnerScope.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK,cAAc,MAAM,sCAAsC,CAAA;AAE3E;;;GAGG;AAEH,eAAO,MAAM,IAAI,YAAa;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAA;CAAE,KAAG,KAAK,CAAC,SAA0D,CAAA;AAEhI;;;;GAIG;AAGH,eAAO,MAAM,KAAK,GAAI,CAAC,WAAW,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,SAAS,MAAM,KAAG,IAInG,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Scopes a binding opens on its provider's runtime, for an element's or a hook's work: each a child
|
|
3
|
+
* of the runtime's own, so one nothing closed ends with the runtime, and closed with its owner without
|
|
4
|
+
* throwing into the cleanup that closes it. Every binding's.
|
|
5
|
+
*
|
|
6
|
+
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
// Unstable: ADR-0071, decision 5. #672: solid's `owner-scope.ts`, moved to dom for every DOM binding's
|
|
11
|
+
// elements, hooks and Features, on a Runner (PR5-Q1).
|
|
12
|
+
import * as Report from "../Report.js";
|
|
13
|
+
import * as Exit from "effect/Exit";
|
|
14
|
+
import * as Scope from "effect/Scope";
|
|
15
|
+
/**
|
|
16
|
+
* A Scope for one owner's work on `runtime`: a child of the runtime's, so the runtime's disposal closes
|
|
17
|
+
* it if its owner hasn't. Its finalizers run in reverse order, as a Scope's do.
|
|
18
|
+
*/
|
|
19
|
+
// #618 (L1): no detached `Scope.makeUnsafe()`. A child closed first takes itself off its parent.
|
|
20
|
+
export const open = (runtime) => Scope.forkUnsafe(runtime.scope, "sequential");
|
|
21
|
+
/**
|
|
22
|
+
* Closes `scope` now, synchronously, on `runtime`. A finalizer that fails is logged and reported as
|
|
23
|
+
* `label` (`Report.failure`), never thrown: the rest of the binding's cleanup that closes it still runs. A
|
|
24
|
+
* Scope the runtime's disposal already closed is left as it is.
|
|
25
|
+
*/
|
|
26
|
+
// #618 (decision 5): `runtime.runSync(Scope.close(…))` threw a failed finalizer's cause into Solid's
|
|
27
|
+
// cleanup, which skipped the rest of it.
|
|
28
|
+
export const close = (runtime, scope, label) => {
|
|
29
|
+
if (scope.state._tag === "Closed")
|
|
30
|
+
return;
|
|
31
|
+
const exit = runtime.runSyncExit(Scope.close(scope, Exit.void));
|
|
32
|
+
if (Exit.isFailure(exit))
|
|
33
|
+
runtime.runFork(Report.failure(label, exit.cause));
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=OwnerScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnerScope.js","sourceRoot":"","sources":["../../src/unstable/OwnerScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,uGAAuG;AACvG,sDAAsD;AACtD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC;;;GAGG;AACH,iGAAiG;AACjG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAwC,EAAmB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;AAEhI;;;;GAIG;AACH,qGAAqG;AACrG,yCAAyC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAI,OAAiC,EAAE,KAAsB,EAAE,KAAa,EAAQ,EAAE;IACzG,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAM;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/D,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AAC9E,CAAC,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type * as DefaultTransition from "@wardic/core/DefaultTransition";
|
|
2
|
+
import type * as ReducedMotion from "@wardic/core/ReducedMotion";
|
|
3
|
+
import * as Renderer from "@wardic/core/Renderer";
|
|
4
|
+
import * as ProjectionSystem from "../ProjectionSystem.ts";
|
|
5
|
+
import type * as CorePresenceRecord from "@wardic/core/unstable/PresenceRecord";
|
|
6
|
+
import type * as WardicServices from "@wardic/core/unstable/WardicServices";
|
|
7
|
+
/** A child's live presence registration ({@link CorePresenceRecord.PresenceRecord}), its Subject an element. */
|
|
8
|
+
export type PresenceRecord = CorePresenceRecord.PresenceRecord<Element>;
|
|
9
|
+
/** The value `<AnimatePresence>` publishes to descendant `createWard` spines ({@link CorePresenceRecord.PresenceContextValue}), over elements. */
|
|
10
|
+
export type PresenceContextValue = CorePresenceRecord.PresenceContextValue<Element>;
|
|
11
|
+
/** What a presence hook registers ({@link CorePresenceRecord.PresenceWatch}), its Subject an element. */
|
|
12
|
+
export type PresenceWatch = CorePresenceRecord.PresenceWatch<Element>;
|
|
13
|
+
/** Where a presence's `popLayout` pins a leaver (#442, Motion's `anchorX` and `anchorY`): its default, the inline start and the top. */
|
|
14
|
+
export interface PopAnchors {
|
|
15
|
+
readonly x: "left" | "right";
|
|
16
|
+
readonly y: "top" | "bottom";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* How a presence's children enter while others exit, Motion's `mode`: `"sync"`, at
|
|
20
|
+
* once, beside the leavers; `"wait"`, once every leaver is gone; `"popLayout"`, at once, each leaver
|
|
21
|
+
* popped out of the flow where it was.
|
|
22
|
+
*/
|
|
23
|
+
export type PresenceMode = "sync" | "wait" | "popLayout";
|
|
24
|
+
/** What a presence reads from its provider and its props. */
|
|
25
|
+
export interface PresenceOptions {
|
|
26
|
+
readonly runtime: WardicServices.Runner<WardicServices.WardicServices>;
|
|
27
|
+
/** The Environment's Renderer (ADR-0003), read once by the provider (#618, M1): what a retained node's values commit through. */
|
|
28
|
+
readonly renderer: Renderer.Renderer["Service"];
|
|
29
|
+
/** The provider's projection system once its `layout` Feature is built (#511), read at each use. */
|
|
30
|
+
readonly projection: () => ProjectionSystem.Shape | undefined;
|
|
31
|
+
/** Whether reduced motion applies now (ADR-0029), read at each exit. */
|
|
32
|
+
readonly reducedMotion: () => boolean;
|
|
33
|
+
readonly positionalKeys: ReducedMotion.PositionalKeys["Service"];
|
|
34
|
+
/** What an exit's key with no transition of its own runs on (ADR-0051). */
|
|
35
|
+
readonly defaultTransition: DefaultTransition.DefaultTransition["Service"];
|
|
36
|
+
/** The presence's `initial` prop: `false` starts the child present at its first render at its `animate` (#134). */
|
|
37
|
+
readonly initial: () => boolean | undefined;
|
|
38
|
+
/** What its binding hears of its exits (#257); left out, nothing is told. */
|
|
39
|
+
readonly events?: PresenceEvents | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Its `custom` prop (#277, Motion's), read as a child leaves: what the child's dynamic exit resolves
|
|
42
|
+
* with, over the child's own. Left out, the child's own.
|
|
43
|
+
*/
|
|
44
|
+
readonly custom?: (() => unknown) | undefined;
|
|
45
|
+
/** Its `mode` prop (#277), read at each change: left out, or `undefined`, `"sync"`. */
|
|
46
|
+
readonly mode?: (() => PresenceMode | undefined) | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Its `anchorX` and `anchorY` props (#442, Motion's), read as `popLayout` measures a leaver: the
|
|
49
|
+
* edges it's pinned by. Left out, or `undefined`, the inline start (`"left"`) and the top.
|
|
50
|
+
*/
|
|
51
|
+
readonly anchorX?: (() => PopAnchors["x"] | undefined) | undefined;
|
|
52
|
+
readonly anchorY?: (() => PopAnchors["y"] | undefined) | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Its `presenceAffectsLayout` prop (#442, Motion's), read at each change: whether the projection is
|
|
55
|
+
* told when its children move (a child entering, a leaver popped or removed), so a `layout` sibling
|
|
56
|
+
* animates into or out of the space. Left out, or `undefined`, `true`.
|
|
57
|
+
*/
|
|
58
|
+
readonly presenceAffectsLayout?: (() => boolean | undefined) | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The children `mode="wait"` held may go on the page now: the binding renders its children again,
|
|
61
|
+
* through {@link PresenceController.shown}. Left out, a held child stays held.
|
|
62
|
+
*/
|
|
63
|
+
readonly release?: (() => void) | undefined;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A presence's exits, told to its binding (#257, ADR-0046): Motion's `onExitComplete`, or a presence
|
|
67
|
+
* handle (Solid 2's). A child that leaves exits; a child with no record (not a Wardic element) leaves at
|
|
68
|
+
* once, its exit starting and ending together, as Motion's does.
|
|
69
|
+
*/
|
|
70
|
+
export interface PresenceEvents {
|
|
71
|
+
/** A child left, and its exit starts. */
|
|
72
|
+
readonly exitStart: () => void;
|
|
73
|
+
/** Whether any child is exiting, at each change: on at an exit's start, off once none is left. */
|
|
74
|
+
readonly exiting: (exiting: boolean) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Every exiting child has animated out and been removed, the last by completing (Motion's
|
|
77
|
+
* `onExitComplete`). Not when the last ended by an interrupt: a re-entry, or the teardown.
|
|
78
|
+
*/
|
|
79
|
+
readonly exitComplete: () => void;
|
|
80
|
+
}
|
|
81
|
+
/** A presence's work, driven by its binding. */
|
|
82
|
+
export interface PresenceController {
|
|
83
|
+
/** What its children's wards register with. */
|
|
84
|
+
readonly context: PresenceContextValue;
|
|
85
|
+
/** The presence has mounted: a child that enters from now on animates in (#134). */
|
|
86
|
+
readonly mounted: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* The children present now, after a change (a node, a flat array of them, or none): each that left
|
|
89
|
+
* is retained in its place and exits. Called after the binding's framework has applied the change.
|
|
90
|
+
*/
|
|
91
|
+
readonly present: (current: unknown) => void;
|
|
92
|
+
/**
|
|
93
|
+
* What goes on the page of what the children resolved to (#277): all of it, but under `mode="wait"`,
|
|
94
|
+
* while a child exits or is leaving in this change, each child entering is held off it until the
|
|
95
|
+
* last leaver is gone ({@link PresenceOptions.release}). Called where the binding renders, before
|
|
96
|
+
* the change is applied; {@link present} is then told what it showed.
|
|
97
|
+
*/
|
|
98
|
+
readonly shown: (resolved: unknown) => unknown;
|
|
99
|
+
/**
|
|
100
|
+
* `propagate` (#277's PR 5c): every child present leaves, as if the change took them all, and
|
|
101
|
+
* `done` is called once none is left (at once with none).
|
|
102
|
+
*/
|
|
103
|
+
readonly leaveAll: (done: () => void) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Where its children are: the parent node of the last it had (#277's PR 5c), what a parent
|
|
106
|
+
* presence finds it inside. `undefined` before it had one.
|
|
107
|
+
*/
|
|
108
|
+
readonly anchor: () => Element | undefined;
|
|
109
|
+
/** The presence's teardown: every exit in flight interrupted, every retained node removed. */
|
|
110
|
+
readonly teardown: () => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* {@link PresenceEvents} as Motion's (#257, Solid 1's): only its `onExitComplete`, read when it's called. One
|
|
114
|
+
* that throws is reported (`wardic.presence: onExitComplete failed`), and the presence goes on.
|
|
115
|
+
*/
|
|
116
|
+
export declare const exitCompleteEvents: (runtime: WardicServices.Runner<WardicServices.WardicServices>, onExitComplete: () => (() => void) | undefined) => PresenceEvents;
|
|
117
|
+
/** A presence's work: see the module. */
|
|
118
|
+
export declare const makePresence: (options: PresenceOptions) => PresenceController;
|
|
119
|
+
/**
|
|
120
|
+
* `propagate` (#277's PR 5c, ADR-0048, Motion's): a presence inside another's child registers with
|
|
121
|
+
* that one as a hook that holds it. When the child leaves, every child of this presence leaves, and
|
|
122
|
+
* the parent's child goes once they've all gone. Its own disposal comes first (Solid disposes the
|
|
123
|
+
* leaving child before its presence hears of it), so its teardown waits a microtask for that word.
|
|
124
|
+
* Without `propagate`, or a presence above, its teardown runs at its disposal, as before. Returns
|
|
125
|
+
* what its disposal runs.
|
|
126
|
+
*/
|
|
127
|
+
export declare const propagateTo: (parent: PresenceContextValue | undefined, propagate: boolean, presence: PresenceController) => (() => void);
|
|
128
|
+
//# sourceMappingURL=PresenceController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresenceController.d.ts","sourceRoot":"","sources":["../../src/unstable/PresenceController.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,KAAK,iBAAiB,MAAM,gCAAgC,CAAA;AAKxE,OAAO,KAAK,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAKjD,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAiB1D,OAAO,KAAK,KAAK,kBAAkB,MAAM,sCAAsC,CAAA;AAE/E,OAAO,KAAK,KAAK,cAAc,MAAM,sCAAsC,CAAA;AAK3E,gHAAgH;AAChH,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AAEvE,kJAAkJ;AAClJ,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;AAEnF,yGAAyG;AACzG,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;AAoQrE,wIAAwI;AACxI,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,EAA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