@wardic/foldkit 0.0.0-stage → 1.3.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.
Files changed (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -2
  3. package/THIRD_PARTY_NOTICES.md +145 -0
  4. package/dist/AnimationControls.d.ts +37 -0
  5. package/dist/AnimationControls.d.ts.map +1 -0
  6. package/dist/AnimationControls.js +37 -0
  7. package/dist/AnimationControls.js.map +1 -0
  8. package/dist/AnimationScope.d.ts +20 -0
  9. package/dist/AnimationScope.d.ts.map +1 -0
  10. package/dist/AnimationScope.js +20 -0
  11. package/dist/AnimationScope.js.map +1 -0
  12. package/dist/DragControls.d.ts +25 -0
  13. package/dist/DragControls.d.ts.map +1 -0
  14. package/dist/DragControls.js +21 -0
  15. package/dist/DragControls.js.map +1 -0
  16. package/dist/Features.d.ts +36 -0
  17. package/dist/Features.d.ts.map +1 -0
  18. package/dist/Features.js +44 -0
  19. package/dist/Features.js.map +1 -0
  20. package/dist/Ward.d.ts +301 -0
  21. package/dist/Ward.d.ts.map +1 -0
  22. package/dist/Ward.js +6 -0
  23. package/dist/Ward.js.map +1 -0
  24. package/dist/Wardic.d.ts +363 -0
  25. package/dist/Wardic.d.ts.map +1 -0
  26. package/dist/Wardic.js +85 -0
  27. package/dist/Wardic.js.map +1 -0
  28. package/dist/index.d.ts +15 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +20 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/internal/builder.d.ts +8 -0
  33. package/dist/internal/builder.d.ts.map +1 -0
  34. package/dist/internal/builder.js +242 -0
  35. package/dist/internal/builder.js.map +1 -0
  36. package/dist/internal/commands.d.ts +143 -0
  37. package/dist/internal/commands.d.ts.map +1 -0
  38. package/dist/internal/commands.js +242 -0
  39. package/dist/internal/commands.js.map +1 -0
  40. package/dist/internal/delivery.d.ts +44 -0
  41. package/dist/internal/delivery.d.ts.map +1 -0
  42. package/dist/internal/delivery.js +85 -0
  43. package/dist/internal/delivery.js.map +1 -0
  44. package/dist/internal/dev.d.ts +10 -0
  45. package/dist/internal/dev.d.ts.map +1 -0
  46. package/dist/internal/dev.js +10 -0
  47. package/dist/internal/dev.js.map +1 -0
  48. package/dist/internal/dev.production.d.ts +8 -0
  49. package/dist/internal/dev.production.d.ts.map +1 -0
  50. package/dist/internal/dev.production.js +8 -0
  51. package/dist/internal/dev.production.js.map +1 -0
  52. package/dist/internal/drag.d.ts +66 -0
  53. package/dist/internal/drag.d.ts.map +1 -0
  54. package/dist/internal/drag.js +71 -0
  55. package/dist/internal/drag.js.map +1 -0
  56. package/dist/internal/element.d.ts +59 -0
  57. package/dist/internal/element.d.ts.map +1 -0
  58. package/dist/internal/element.js +582 -0
  59. package/dist/internal/element.js.map +1 -0
  60. package/dist/internal/gestures.d.ts +62 -0
  61. package/dist/internal/gestures.d.ts.map +1 -0
  62. package/dist/internal/gestures.js +109 -0
  63. package/dist/internal/gestures.js.map +1 -0
  64. package/dist/internal/hydrate.d.ts +5 -0
  65. package/dist/internal/hydrate.d.ts.map +1 -0
  66. package/dist/internal/hydrate.js +27 -0
  67. package/dist/internal/hydrate.js.map +1 -0
  68. package/dist/internal/keys.d.ts +21 -0
  69. package/dist/internal/keys.d.ts.map +1 -0
  70. package/dist/internal/keys.js +12 -0
  71. package/dist/internal/keys.js.map +1 -0
  72. package/dist/internal/layout.d.ts +29 -0
  73. package/dist/internal/layout.d.ts.map +1 -0
  74. package/dist/internal/layout.js +88 -0
  75. package/dist/internal/layout.js.map +1 -0
  76. package/dist/internal/mount.d.ts +22 -0
  77. package/dist/internal/mount.d.ts.map +1 -0
  78. package/dist/internal/mount.js +152 -0
  79. package/dist/internal/mount.js.map +1 -0
  80. package/dist/internal/presence.d.ts +33 -0
  81. package/dist/internal/presence.d.ts.map +1 -0
  82. package/dist/internal/presence.js +338 -0
  83. package/dist/internal/presence.js.map +1 -0
  84. package/dist/internal/reactivity.d.ts +15 -0
  85. package/dist/internal/reactivity.d.ts.map +1 -0
  86. package/dist/internal/reactivity.js +26 -0
  87. package/dist/internal/reactivity.js.map +1 -0
  88. package/dist/internal/reorder.d.ts +47 -0
  89. package/dist/internal/reorder.d.ts.map +1 -0
  90. package/dist/internal/reorder.js +250 -0
  91. package/dist/internal/reorder.js.map +1 -0
  92. package/dist/internal/scope.d.ts +28 -0
  93. package/dist/internal/scope.d.ts.map +1 -0
  94. package/dist/internal/scope.js +44 -0
  95. package/dist/internal/scope.js.map +1 -0
  96. package/dist/internal/server.d.ts +13 -0
  97. package/dist/internal/server.d.ts.map +1 -0
  98. package/dist/internal/server.js +13 -0
  99. package/dist/internal/server.js.map +1 -0
  100. package/dist/internal/server.node.d.ts +8 -0
  101. package/dist/internal/server.node.d.ts.map +1 -0
  102. package/dist/internal/server.node.js +8 -0
  103. package/dist/internal/server.node.js.map +1 -0
  104. package/dist/internal/services.d.ts +231 -0
  105. package/dist/internal/services.d.ts.map +1 -0
  106. package/dist/internal/services.js +350 -0
  107. package/dist/internal/services.js.map +1 -0
  108. package/dist/internal/tree.d.ts +71 -0
  109. package/dist/internal/tree.d.ts.map +1 -0
  110. package/dist/internal/tree.js +207 -0
  111. package/dist/internal/tree.js.map +1 -0
  112. package/dist/internal/variant-node.d.ts +62 -0
  113. package/dist/internal/variant-node.d.ts.map +1 -0
  114. package/dist/internal/variant-node.js +279 -0
  115. package/dist/internal/variant-node.js.map +1 -0
  116. package/dist/internal/view-transition.d.ts +10 -0
  117. package/dist/internal/view-transition.d.ts.map +1 -0
  118. package/dist/internal/view-transition.js +36 -0
  119. package/dist/internal/view-transition.js.map +1 -0
  120. package/dist/internal/walk.d.ts +26 -0
  121. package/dist/internal/walk.d.ts.map +1 -0
  122. package/dist/internal/walk.js +162 -0
  123. package/dist/internal/walk.js.map +1 -0
  124. package/package.json +99 -4
  125. package/src/AnimationControls.ts +46 -0
  126. package/src/AnimationScope.ts +19 -0
  127. package/src/DragControls.ts +27 -0
  128. package/src/Features.ts +45 -0
  129. package/src/Ward.ts +434 -0
  130. package/src/Wardic.ts +410 -0
  131. package/src/index.ts +20 -0
  132. package/src/internal/builder.ts +262 -0
  133. package/src/internal/commands.ts +359 -0
  134. package/src/internal/delivery.ts +116 -0
  135. package/src/internal/dev.production.ts +7 -0
  136. package/src/internal/dev.ts +9 -0
  137. package/src/internal/drag.ts +136 -0
  138. package/src/internal/element.ts +668 -0
  139. package/src/internal/gestures.ts +184 -0
  140. package/src/internal/hydrate.ts +29 -0
  141. package/src/internal/keys.ts +19 -0
  142. package/src/internal/layout.ts +109 -0
  143. package/src/internal/mount.ts +181 -0
  144. package/src/internal/presence.ts +362 -0
  145. package/src/internal/reactivity.ts +45 -0
  146. package/src/internal/reorder.ts +313 -0
  147. package/src/internal/scope.ts +60 -0
  148. package/src/internal/server.node.ts +7 -0
  149. package/src/internal/server.ts +12 -0
  150. package/src/internal/services.ts +508 -0
  151. package/src/internal/tree.ts +230 -0
  152. package/src/internal/variant-node.ts +352 -0
  153. package/src/internal/view-transition.ts +43 -0
  154. package/src/internal/walk.ts +211 -0
@@ -0,0 +1,668 @@
1
+ /**
2
+ * A mounted `w.*` element (ADR-0071): its spine on the shared one (core's `unstable/Spine`), registered
3
+ * with its Provider's gate at insert, inside the patch (P2); its place in the variant tree, by DOM
4
+ * ancestry (`tree.ts`); its Starting style, rendered by the view, switched to the user's style in its
5
+ * first commit, as a Solid element's is (ADR-0034); its callbacks as Messages (decision 23); and its
6
+ * **Delivery** (decision 20): each later render's config reaches it through its `wardic` property's
7
+ * setter, where it Retargets when the targets resolve differently from the last ones (#470).
8
+ *
9
+ * @module
10
+ */
11
+ import type * as Values from "@wardic/core/Values"
12
+ import type * as DragConstraints from "@wardic/dom/unstable/DragConstraints"
13
+ import * as DomRenderer from "@wardic/dom/DomRenderer"
14
+ import type * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
15
+ import type * as CoreConfig from "@wardic/core/unstable/Config"
16
+ import * as AnimationControls from "@wardic/core/unstable/AnimationControls"
17
+ import * as PresenceRecord from "@wardic/core/unstable/PresenceRecord"
18
+ import * as Spine from "@wardic/core/unstable/Spine"
19
+ import * as VariantTree from "@wardic/core/unstable/VariantTree"
20
+ import * as WardicConfigValue from "@wardic/core/unstable/WardicConfigValue"
21
+ import type * as FlushGate from "@wardic/dom/FlushGate"
22
+ import * as Report from "@wardic/dom/Report"
23
+ import * as Style from "@wardic/dom/Style"
24
+ import * as AppearAnimations from "@wardic/dom/unstable/AppearAnimations"
25
+ import * as DragDefaults from "@wardic/dom/unstable/DragDefaults"
26
+ import * as DragTransition from "@wardic/dom/unstable/DragTransition"
27
+ import * as ElementSetup from "@wardic/dom/unstable/ElementSetup"
28
+ import * as Feature from "@wardic/dom/unstable/Feature"
29
+ import * as Imperative from "@wardic/dom/unstable/Imperative"
30
+ import * as Keys from "@wardic/dom/unstable/features/Keys"
31
+ import * as LiveStyle from "@wardic/dom/unstable/LiveStyle"
32
+ import type * as WardConfig from "@wardic/dom/unstable/WardConfig"
33
+ import * as Arr from "effect/Array"
34
+ import * as Bool from "effect/Boolean"
35
+ import * as Cause from "effect/Cause"
36
+ import * as Equal from "effect/Equal"
37
+ import { constFalse, constUndefined, constVoid, identity } from "effect/Function"
38
+ import * as MutableRef from "effect/MutableRef"
39
+ import * as Option from "effect/Option"
40
+ import * as Predicate from "effect/Predicate"
41
+ import type * as AtomRegistry from "effect/reactivity/AtomRegistry"
42
+ import * as Rec from "effect/Record"
43
+ import * as UndefinedOr from "effect/UndefinedOr"
44
+ import type * as Ward from "../Ward.ts"
45
+ import { deliveredTo, hintFrameUnless, installSetter, patchTouched } from "./delivery.ts"
46
+ import { dragOf, type SpineDragOptions } from "./drag.ts"
47
+ import { gesturesOf } from "./gestures.ts"
48
+ import { reactivity, recheck } from "./reactivity.ts"
49
+ import { mounted as scopeMounted } from "./scope.ts"
50
+ import { layoutOf } from "./layout.ts"
51
+ import { nearestPresence } from "./presence.ts"
52
+ import { groupDelivered, reorderItemOf } from "./reorder.ts"
53
+ import { hydrationMounted, type Provider, reducedMotionUnder, type State } from "./services.ts"
54
+ import { configValueOf, dropNode, layoutGroupOf, nodeOf, startUnder } from "./tree.ts"
55
+ import { DEV } from "@wardic/foldkit/internal/dev"
56
+
57
+ /** An element's config as the spine reads it: what the view delivered, with its merged `style`. */
58
+ export type Config = Ward.Config<unknown> & WardConfig.SpineConfig
59
+
60
+ /** No config: an element the view gave nothing, which rests where it is. */
61
+ const NO_CONFIG: Config = {}
62
+
63
+ /** The config delivered to an element, or none. */
64
+ export const configOf = (delivered: unknown): Config => {
65
+ if (Predicate.isUndefined(delivered)) return NO_CONFIG
66
+ return delivered as Config
67
+ }
68
+
69
+ /** What a Retarget throwing inside the patch is reported as: contained at the binding's edge (decision 13), the element left where it is. */
70
+ const RETARGET_FAILED = "wardic.retarget: a w.* element's Retarget failed; it stays where it is"
71
+
72
+ // Module state (#460, Q7): an id counter, only ever compared for distinctness.
73
+ let ids = 0
74
+
75
+ /** An element's registered projection node, as the projection system hands it back. */
76
+ type LayoutNode = ReturnType<ProjectionSystem.Shape["register"]>
77
+
78
+ /**
79
+ * Development's diagnostics for the spine (#746, ADR-0067 *Amendment (#746)*, decision 6): given under
80
+ * `DEV` alone, so a production build ships none of their code.
81
+ */
82
+ const devDiagnostics = (): Spine.SpineDiagnostics | undefined => {
83
+ if (DEV) return ElementSetup.SPINE_DIAGNOSTICS
84
+ return undefined
85
+ }
86
+
87
+ /**
88
+ * The element's Starting style, rendered by the view: the user's `style` with its `initial` on top,
89
+ * projected together, so a transform key of each joins one `transform` (#791, Q7); a Live value at
90
+ * what it reads through `registry` now; its Transform template under the renderer's key (#443). What
91
+ * `w.*` and the bundle render in their one `h.Style`, stringified for Foldkit's style module. A Variant
92
+ * child's inherited `initial` comes with `inherited`, the context its ancestor provides, and a child a
93
+ * `w.Presence({ initial: false })` holds at its `Animate` with `held` (#134): the walk at the
94
+ * `w.Provider()` element's build gives both (#794, Q7), and its Mount writes them for an element with
95
+ * no Provider element above.
96
+ */
97
+ export const startingStyleOf = (tag: string | undefined, config: Config, registry: () => AtomRegistry.AtomRegistry, inherited?: VariantTree.WardicVariantContextValue, held = false): Style.Style =>
98
+ startingStyleFrom(tag, config, registry, Spine.startOf(AnimationControls.uncontrolledOf(config), inherited, held, reactivity.untrack))
99
+
100
+ /** The element's Starting style (above) drawn from `start`, its own: what the walk draws beside its Appear entry, which reads `start` too (#794, PR 2). */
101
+ export const startingStyleFrom = (tag: string | undefined, config: Config, registry: () => AtomRegistry.AtomRegistry, start: Spine.Start): Style.Style =>
102
+ Style.starting(tag, ElementSetup.drawnAtRest({ ...(liveValuesOf(config.style, registry) as Values.Values), ...start.initialValues }, false, config.transformTemplate)).style
103
+
104
+ /** The user's `style` with each Live value read now (#130): what a Starting style is projected from. */
105
+ const liveValuesOf = (style: Config["style"], registry: () => AtomRegistry.AtomRegistry): Readonly<Record<string, unknown>> =>
106
+ Rec.map(styleRecordOf(style), (value) => LiveStyle.readLive(value, registry, reactivity.untrack))
107
+
108
+ /** The user's `style` as a record: what `w.Style` and `h.Style` gave, merged by the builder. */
109
+ const styleRecordOf = (style: Config["style"]): Readonly<Record<string, unknown>> => {
110
+ if (Predicate.isUndefined(style)) return {}
111
+ if (Predicate.isString(style)) return {}
112
+ return style as Readonly<Record<string, unknown>>
113
+ }
114
+
115
+ /** `patch`'s values as Foldkit's style module takes them: strings. */
116
+ export const stringified = (patch: Style.Style): Record<string, string> => Rec.map(patch, (value) => String(value))
117
+
118
+ /**
119
+ * Switch the element from its Starting style to the user's, in its first commit (ADR-0034): each key the
120
+ * Starting style set is put back to the user's projected value, or removed, so the gate reads that as
121
+ * the key's own value and restores it when it lets the key go. Foldkit's style module rewrites a key
122
+ * only when the view changes it, so the switch holds until the view does.
123
+ */
124
+ const switchToUserStyle = (element: HTMLElement, tag: string, starting: ReadonlyArray<string>, config: Config, registry: () => AtomRegistry.AtomRegistry): void => {
125
+ const user = Style.starting(tag, liveValuesOf(config.style, registry)).style
126
+ Arr.forEach(starting, (key) => {
127
+ UndefinedOr.match(user[key], {
128
+ onUndefined: () => element.style.removeProperty(key),
129
+ onDefined: (value) => element.style.setProperty(key, String(value)),
130
+ })
131
+ })
132
+ }
133
+
134
+ /** Write `starting` on the element now: a Variant child's inherited Starting style, inside the patch, before paint (P2). */
135
+ const writeStartingStyle = (element: HTMLElement, starting: Style.Style): void => {
136
+ Arr.forEach(Rec.keys(starting), (key) => {
137
+ element.style.setProperty(key, String(starting[key]))
138
+ })
139
+ }
140
+
141
+ /** What a callback's handler becomes for the spine or a presence: a function told what the callback is. */
142
+ export type Dispatch = <Args extends ReadonlyArray<unknown>>(handler: Ward.Callback<unknown, Args>) => (...args: Args) => void
143
+
144
+ /** A {@link Dispatch} through `offer`, a Mount's queue, silenced while DevTools replay has the view (decision 34), whose history the Messages would change. */
145
+ export const dispatchUnlessPaused = (paused: () => boolean, offer: (message: unknown) => void): Dispatch =>
146
+ dispatcherOf((message) => {
147
+ if (paused()) return
148
+ offer(message)
149
+ })
150
+
151
+ /** What sends a callback's Message (decision 23) through `offer`: a Message as it is; a function's answer, an `Option.none()` sending nothing. */
152
+ export const dispatcherOf =
153
+ (offer: (message: unknown) => void): Dispatch =>
154
+ <Args extends ReadonlyArray<unknown>>(handler: Ward.Callback<unknown, Args>) =>
155
+ (...args: Args) => {
156
+ if (Bool.not(Predicate.isFunction(handler))) {
157
+ offer(handler)
158
+ return
159
+ }
160
+ const out = (handler as (...args: Args) => unknown)(...args)
161
+ if (Option.isOption(out)) {
162
+ Option.match(out, { onNone: constVoid, onSome: offer })
163
+ return
164
+ }
165
+ offer(out)
166
+ }
167
+
168
+ /** A `viewport` as dom reads it: Foldkit's, its `root` resolved into an accessor (`viewportRootOf`). */
169
+ export interface ViewportResolved extends Pick<Ward.ViewportOptions, "once" | "margin" | "amount"> {
170
+ readonly root?: (() => Element | undefined) | undefined
171
+ }
172
+
173
+ /**
174
+ * An element's config as its spine, its gestures and its drag read it: the delivered one, its callbacks
175
+ * as the spine's functions (`onUpdate` the Atom's setter, the animation and layout callbacks' Messages
176
+ * sent), its viewport and its drag constraints resolved.
177
+ */
178
+ export type View = Omit<Config, "viewport" | "onUpdate" | "dragConstraints"> &
179
+ Pick<CoreConfig.SpineConfig, "onUpdate"> &
180
+ Pick<WardConfig.WardConfig, "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "dragConstraints"> & { readonly viewport?: ViewportResolved | undefined }
181
+
182
+ /** How an attribute names an element under the view (#793, Q7 and Q16): `"parent"`, the element's parent, or a selector. */
183
+ type ElementRef = "parent" | string
184
+
185
+ /**
186
+ * The element `ref` names (above): the element's parent, or the selector's first match under the
187
+ * `w.Provider()` element, else the document. What a viewport's `root` and a `DragConstraints` container
188
+ * are read as: as the recognizer starts, and at each measure.
189
+ */
190
+ const elementUnder = (provider: Provider, element: Element, ref: ElementRef): Element | undefined => {
191
+ if (ref === "parent") return Option.getOrUndefined(Option.fromNullOr(element.parentElement))
192
+ const under: ParentNode = UndefinedOr.match(provider.root, { onUndefined: (): ParentNode => document, onDefined: identity })
193
+ return Option.getOrUndefined(Option.fromNullOr(under.querySelector(ref)))
194
+ }
195
+
196
+ /** `DragConstraints` as dom reads them (Q7): `"parent"` or a selector as the container's accessor; a box or `false` as they are. */
197
+ const dragConstraintsOf = (provider: Provider, element: Element, constraints: Ward.DragConstraints): DragConstraints.WardicDragConstraints => {
198
+ if (Predicate.isString(constraints)) return () => elementUnder(provider, element, constraints)
199
+ return constraints
200
+ }
201
+
202
+ const spineViewOf = (config: Config, value: WardicConfigValue.WardicConfigValue | undefined, dispatch: Dispatch, registry: AtomRegistry.AtomRegistry, provider: Provider, element: Element): View => {
203
+ const { viewport: given, dragConstraints: constraints, ...configured } = WardicConfigValue.withConfigTransition(config, value)
204
+ // Its viewport as dom reads it (#793, Q16): the root resolved as the recognizer starts.
205
+ const viewport = UndefinedOr.match(given, {
206
+ onUndefined: () => ({}),
207
+ onDefined: (v): { readonly viewport: ViewportResolved } => ({
208
+ viewport: { once: v.once, margin: v.margin, amount: v.amount, ...UndefinedOr.match(v.root, { onUndefined: () => ({}), onDefined: (root) => ({ root: () => elementUnder(provider, element, root) }) }) },
209
+ }),
210
+ })
211
+ const dragConstraints = UndefinedOr.match(constraints, { onUndefined: () => ({}), onDefined: (c) => ({ dragConstraints: dragConstraintsOf(provider, element, c) }) })
212
+ const base: View = { ...configured, ...viewport, ...dragConstraints }
213
+ const start = config.animationStart
214
+ const complete = config.animationComplete
215
+ const update = config.onUpdate
216
+ const layoutStart = config.layoutAnimationStart
217
+ const layoutComplete = config.layoutAnimationComplete
218
+ if (Predicate.isUndefined(start) && Predicate.isUndefined(complete) && Predicate.isUndefined(update) && Predicate.isUndefined(layoutStart) && Predicate.isUndefined(layoutComplete)) return base
219
+ const view: View = {
220
+ ...base,
221
+ ...UndefinedOr.match(start, { onUndefined: () => ({}), onDefined: (handler) => ({ onAnimationStart: dispatch(handler) }) }),
222
+ ...UndefinedOr.match(complete, { onUndefined: () => ({}), onDefined: (handler) => ({ onAnimationComplete: dispatch(handler) }) }),
223
+ ...UndefinedOr.match(update, { onUndefined: () => ({}), onDefined: (atom) => ({ onUpdate: (latest: Ward.Latest) => registry.set(atom, { ...latest }) }) }),
224
+ // Motion's onLayoutAnimationStart / onLayoutAnimationComplete (decision 23), as Messages, told nothing.
225
+ ...UndefinedOr.match(layoutStart, { onUndefined: () => ({}), onDefined: (handler) => ({ onLayoutAnimationStart: () => dispatch(handler)(undefined) }) }),
226
+ ...UndefinedOr.match(layoutComplete, { onUndefined: () => ({}), onDefined: (handler) => ({ onLayoutAnimationComplete: () => dispatch(handler)(undefined) }) }),
227
+ }
228
+ return view
229
+ }
230
+
231
+ /** The `StartsDrag` element's listener (#793, Q8): installed once a delivery gives `startsDrag`, reading the controls at each down. */
232
+ interface StartsDrag {
233
+ readonly check: () => void
234
+ readonly dispose: () => void
235
+ }
236
+
237
+ /** The `StartsDrag` element's listener (above): nothing on an element whose deliveries never give `startsDrag`. */
238
+ const startsDragOf = (element: HTMLElement, config: () => Config): StartsDrag => {
239
+ const installed = MutableRef.make(false)
240
+ const onDown = (event: PointerEvent): void => {
241
+ UndefinedOr.map(config().startsDrag, (starts) => starts.controls.start(event, starts.options))
242
+ }
243
+ return {
244
+ check: () => {
245
+ if (MutableRef.get(installed)) return
246
+ if (Predicate.isUndefined(config().startsDrag)) return
247
+ MutableRef.set(installed, true)
248
+ element.addEventListener("pointerdown", onDown)
249
+ },
250
+ dispose: () => {
251
+ if (MutableRef.get(installed)) element.removeEventListener("pointerdown", onDown)
252
+ },
253
+ }
254
+ }
255
+
256
+ /** Follow `config`'s `text` Atom on the element, writing `textContent` outside the patch (decision 16); the stop. */
257
+ const followText = (element: HTMLElement, atom: Config["text"], registry: AtomRegistry.AtomRegistry): (() => void) => {
258
+ if (Predicate.isUndefined(atom)) return constVoid
259
+ return registry.subscribe(
260
+ atom,
261
+ (value) => {
262
+ element.textContent = String(value)
263
+ },
264
+ { immediate: true },
265
+ )
266
+ }
267
+
268
+ /**
269
+ * Mount a `w.*` element on `provider`: its spine, its gate registration, its place in the tree and its
270
+ * Delivery's setter. `paused` says whether DevTools replay has the view (decision 34): every animation
271
+ * lands at once under it. `offer` sends a callback's Message through the element's Mount Stream.
272
+ * `root` is the Handle's app-wide config. Under a `w.Presence` (decision 29) the element is enrolled
273
+ * with it and starts in the presence's next delivery, after take-overs and holds are decided; else it
274
+ * starts once its nearest `w.*` ancestor has, or now at the top (#848: Foldkit mounts a child before
275
+ * its parent, and a tree mounted by one patch starts top-down this way, its Variant children's stagger
276
+ * slots set with every sibling registered). Returns the release: the element's teardown, run at its
277
+ * Mount's destroy, before Foldkit removes it.
278
+ */
279
+ export const mountElement = (provider: Provider, state: State, element: HTMLElement, paused: () => boolean, offer: (message: unknown) => void, root: WardicConfigValue.WardicConfigValue | undefined): (() => void) => {
280
+ const tag = element.localName
281
+ // Its callbacks' Messages (decision 23): none under replay (decision 34), whose history they'd change.
282
+ const dispatch = dispatchUnlessPaused(paused, offer)
283
+ // Its place in the tree (decision 21): its node, made by its first child's Mount or here, and the
284
+ // nearest `w.Config` above it (decision 22).
285
+ const node = nodeOf(element)
286
+ const inherited = node.inherited
287
+ const configValue = configValueOf(element, root)
288
+ const registry = provider.atoms
289
+ const registryNow = (): AtomRegistry.AtomRegistry => registry
290
+ const id = `wardic-foldkit-${ids++}`
291
+ let config = configOf(deliveredTo(element))
292
+ // Its Animation controls (#433; #798, Q4): the ones it mounted with, kept; each change they make is its
293
+ // `animate` entry as the spine reads it, the node's configured form, its Variant children following.
294
+ const controls = AnimationControls.controlsOf(config.animate)
295
+ const viewOf = (): View => spineViewOf(node.configured(config), configValue, dispatch, registry, provider, element)
296
+ let view = viewOf()
297
+ const configNow = (): View => view
298
+ // The nearest `w.Presence` above it (decision 29), told its key now, before that presence decides what it shows (#286).
299
+ const presence = nearestPresence(provider, state, element)
300
+ const context = UndefinedOr.map(presence, (p) => p.context)
301
+ UndefinedOr.map(context, (ctx) => UndefinedOr.map(ctx.made, (made) => made(element, config.key, Predicate.isNotUndefined(config.layoutId))))
302
+
303
+ const begin = (): (() => void) => {
304
+ // Its Live values in `style` (#130, ADR-0043): routed keys the spine follows through the gate.
305
+ const live = LiveStyle.createLiveStyle({ registry: registryNow, onDroppedTransform: droppedTransformWarning(provider, id), reactivity, ownValues: provider.valueReads.ownValues })
306
+ live.css(config.style)
307
+ // Where it starts (ADR-0003), read once: the config the view rendered it with, its inherited `initial`
308
+ // included (#50), at its `animate` under a presence's `initial: false` (#134).
309
+ const start = Spine.startOf(view, inherited, PresenceRecord.presenceBlocksInitial(context), reactivity.untrack)
310
+ const snapshot = Spine.snapshotOf(start)
311
+ // Its Transform template (#443), drawn with its first write: the one at mount, then each other one.
312
+ const templateAtMount = config.transformTemplate
313
+ // The keys its Starting style set, switched to the user's in its first commit. A Variant child's
314
+ // inherited Starting style wasn't rendered by the view: written now, inside the patch (P2). So is a
315
+ // child of a `w.Presence({ initial: false })`: the view rendered it at its `Animate` (the walk at a
316
+ // Provider element's build, #794), where only the presence's first render starts it there (#134).
317
+ const starting = Style.starting(tag, ElementSetup.drawnAtRest(start.initialValues, false, templateAtMount)).style
318
+ if (Bool.or(Predicate.isNotUndefined(inherited), UndefinedOr.match(presence, { onUndefined: constFalse, onDefined: (p) => p.holds() }))) writeStartingStyle(element, starting)
319
+ const startingKeys = Rec.keys(starting)
320
+ // Its Appear animation, when it hydrates one the server rendered (ADR-0044 decision 6; #794, Q10):
321
+ // found by the slot its inline `animation` names, which the hydration render kept, taken over by its
322
+ // first Retarget that starts, as far in as the CSS has got, and removed in its first commit, the
323
+ // Handoff. Asked at every mount, a string read: an element a client render made names no slot. One
324
+ // found keeps hydration's window open until that commit, so no render in between strips the slot.
325
+ const handoff = Option.getOrUndefined(AppearAnimations.handoffOf(element))
326
+ const released = hydrationMounted(state, Predicate.isNotUndefined(handoff))
327
+ const sink: FlushGate.Sink = ElementSetup.releasingAppear(
328
+ Spine.withOnUpdate(
329
+ {
330
+ target: element,
331
+ beforeFirstCommit: () => {
332
+ switchToUserStyle(element, tag, startingKeys, config, registryNow)
333
+ released()
334
+ },
335
+ },
336
+ view.onUpdate,
337
+ configNow,
338
+ ),
339
+ handoff,
340
+ element,
341
+ )
342
+ const unregister = provider.gate.register(id, sink, ElementSetup.registeredValuesOf(templateAtMount))
343
+ // The user's style now, for its Base values (ADR-0022): the config's, as the view last delivered it.
344
+ const styleNow = (): object | string | undefined => config.style
345
+ const links = ElementSetup.startLinksOf(element, styleNow, live)
346
+ // Reduced motion (ADR-0029) and skipped animations (#468) under its nearest `w.Config`, read at each Retarget.
347
+ const reducedMotion = reducedMotionUnder(provider, configValue)
348
+ const skipped = WardicConfigValue.skipAnimationsOf(configValue)
349
+ const skipAnimations = (): boolean => paused() || skipped()
350
+ // Where its drag's and its pan's points are (#793, Q9): its nearest `w.Config`'s `transformPagePoint`, read at each down.
351
+ const pagePoint = (): WardConfig.WardicTransformPoint | undefined => UndefinedOr.match(configValue, { onUndefined: constUndefined, onDefined: (v) => v.transformPagePoint() })
352
+ // Its presence record (ADR-0007): what its presence drives its exit with after Foldkit removes it,
353
+ // resolved from its `Exit` as it leaves; the presence owns the registration. And where it starts when
354
+ // it takes over from a leaver under its key (#286).
355
+ const exitConfig = { current: Spine.exitConfigOf(view, inherited) }
356
+ const record = UndefinedOr.map(context, (ctx) => {
357
+ const rec = Spine.presenceRecordOf(element, start, (custom, inheritedNames) => Spine.exitTargetOf(exitConfig.current, custom, snapshot, inheritedNames), links, Spine.presenceTreeOf(view), snapshot, reducedMotion, skipAnimations)
358
+ ctx.register(rec)
359
+ return rec
360
+ })
361
+ const taken = PresenceRecord.presenceSeedOf(context, element)
362
+ const recordFrame = Spine.recordFrameOf(record)
363
+ // Its gestures (#793; decision 23): each started as a delivery wants it, its entry in the Override
364
+ // stack re-resolved as it flips, and its Variant children told through the port's watches (#291).
365
+ const gestures = gesturesOf({
366
+ provider,
367
+ element,
368
+ config: configNow,
369
+ dispatch,
370
+ onChange: () => {
371
+ retarget()
372
+ recheck()
373
+ },
374
+ id,
375
+ pagePoint,
376
+ // A Reorder item's keys are its Keyboard reorder's (ADR-0037): its press starts from no key.
377
+ keysTaken: () => Predicate.isNotUndefined(MutableRef.get(item)),
378
+ })
379
+ node.bindGestures(gestures.states)
380
+ // A Reorder item (decision 28): joined to the group above it, which decides its drag's axis and hears
381
+ // its samples; its keyboard lift turns `WhileDrag` on. Joined now, or as a load brings the Features (Q15).
382
+ const item = MutableRef.make(reorderItemOf(provider, element, id, () => config, dispatch, gestures.lift))
383
+ // Its spine's options, with what its drag writes as its track starts (ADR-0004; #793, PR 2): its
384
+ // axis, its track and whether it drives a layout node, which the spine reads where it uses them.
385
+ // The axis is seeded from the config at mount too, as Solid's: the spine registers its drag hook (a
386
+ // Batch member's hold, #665) at make from it, so a `Drag` a later render adds registers none.
387
+ const spineOptions: Spine.ElementSpineOptions & SpineDragOptions = {
388
+ runtime: provider.runtime,
389
+ gate: provider.gate,
390
+ id,
391
+ element,
392
+ tag,
393
+ config: configNow,
394
+ parent: inherited,
395
+ canStart: node.canStart,
396
+ extraDelay: node.extraDelay,
397
+ onFrame: node.onFrame,
398
+ byName: node.names,
399
+ reducedMotion,
400
+ skipAnimations,
401
+ positionalKeys: provider.positionalKeys,
402
+ defaultTransition: provider.defaultTransition,
403
+ ownValues: provider.valueReads.ownValues,
404
+ measuredPairs: provider.valueReads.measuredPairs,
405
+ variableValues: provider.valueReads.variableValues,
406
+ start,
407
+ snapshot,
408
+ reuse: Spine.makeReuse(),
409
+ links,
410
+ styleNow,
411
+ live,
412
+ builtFeatures: provider.registry.built,
413
+ presence: record,
414
+ projected: false,
415
+ dragAxis: DragDefaults.dragAxisOf(view, { dragAxis: UndefinedOr.map(MutableRef.get(item), (joined) => joined.dragAxis) }),
416
+ drag: undefined,
417
+ handoff,
418
+ // Motion's onAnimationStart / onAnimationComplete (decision 23), as Messages through `dispatch`.
419
+ animation: Spine.animationCallbacks(provider.runtime, id),
420
+ diagnostics: devDiagnostics(),
421
+ }
422
+ const spine = Spine.makeElementSpine(spineOptions)
423
+ UndefinedOr.map(taken, (seed) => spine.seed(seed))
424
+ // The `StartsDrag` element (Q8): its downs start its controls' drags, from the first delivery that gives them.
425
+ const startsDrag = startsDragOf(element, () => config)
426
+ // Its Animation scope (#798, Q7 and Q9): the scope's element from now, and the animations started in it stopped at its release.
427
+ const releaseScope = UndefinedOr.match(config.animationScope, { onUndefined: () => constVoid, onDefined: (scope) => scopeMounted(scope, element) })
428
+ // Its layout (ADR-0009, ADR-0010; decision 30): one projection node for `Layout`, `LayoutId`,
429
+ // `LayoutScroll` or `LayoutRoot`, on the provider's layout, built at the first; and, with a layout
430
+ // built, its values by element, for a twin's flight to follow (ADR-0012 *Amendment (#137)*). Each
431
+ // joined at mount, or as a load brings the Feature (#793, Q15).
432
+ // Its config as dom's layout code reads it: the layout keys alone.
433
+ const wardConfig = (): WardConfig.WardConfig => view as WardConfig.WardConfig
434
+ const builtProjection = (): ProjectionSystem.Shape | undefined => Keys.projectionIn(provider.registry.built())
435
+ const layoutNode = MutableRef.make<LayoutNode | undefined>(undefined)
436
+ const unregisterValues = MutableRef.make<(() => void) | undefined>(undefined)
437
+ const joinLayout = (): void => {
438
+ if (Bool.and(Predicate.isUndefined(MutableRef.get(layoutNode)), Feature.wantsLayoutNode(wardConfig()))) {
439
+ MutableRef.set(layoutNode, UndefinedOr.map(layoutOf(provider, state), (made) =>
440
+ made.projection.register(
441
+ made.nodes.registrationOf(
442
+ made.nodes.optionsOf({
443
+ id,
444
+ element,
445
+ config: wardConfig,
446
+ parent: inherited,
447
+ snapshot,
448
+ // What its release runs on (ADR-0016, *Amendment (#140)*; Q10): the element's drag transition, read now.
449
+ dragTransition: DragTransition.dragTransitionOf(view.dragElastic, view.dragTransition),
450
+ // Raised while dragged as a Reorder item (ADR-0020), over the rest.
451
+ raiseWhileDragged: Predicate.isNotUndefined(MutableRef.get(item)),
452
+ taken,
453
+ layoutGroup: layoutGroupOf(element),
454
+ reducedMotion,
455
+ skipAnimations,
456
+ heldTransform: ElementSetup.heldTransformFor(snapshot, templateAtMount, () => view.transformTemplate),
457
+ }),
458
+ ),
459
+ )))
460
+ registerItemNode()
461
+ }
462
+ if (Predicate.isUndefined(MutableRef.get(unregisterValues))) MutableRef.set(unregisterValues, UndefinedOr.map(builtProjection(), (projection) => projection.registerValues(element, () => snapshot.values)))
463
+ }
464
+ /** A Reorder item's node, registered with its group once both are there (ADR-0020): its box, its drag offset and its lift. */
465
+ const registerItemNode = (): void => {
466
+ UndefinedOr.map(MutableRef.get(layoutNode), (made) => UndefinedOr.map(MutableRef.get(item), (joined) => joined.onLayoutHandle(made)))
467
+ }
468
+ /** The item joined as a load brings the Features (Q15): its group made by it if its own Mount hasn't, its node registered. */
469
+ const joinItem = (): void => {
470
+ if (Predicate.isNotUndefined(MutableRef.get(item))) return
471
+ MutableRef.set(item, reorderItemOf(provider, element, id, () => config, dispatch, gestures.lift))
472
+ registerItemNode()
473
+ }
474
+ joinLayout()
475
+ // Its drag (ADR-0004; #793, PR 2): dom's track, started as a delivery wants it, driving the layout
476
+ // node it has then; its samples and its hold on `x`/`y` to the gestures, its release's end too.
477
+ const drag = dragOf({
478
+ provider,
479
+ element,
480
+ id,
481
+ config: configNow,
482
+ snapshot,
483
+ recordFrame,
484
+ live,
485
+ spine: spineOptions,
486
+ layoutNode: () => MutableRef.get(layoutNode),
487
+ // A Reorder item's axis at each gesture's start, and its samples to its group before the callbacks (ADR-0020).
488
+ itemAxis: () => UndefinedOr.map(MutableRef.get(item), (joined) => joined.dragAxis),
489
+ pagePoint,
490
+ skipAnimations,
491
+ onDragging: gestures.dragHeld,
492
+ onSample: (sample) => {
493
+ UndefinedOr.map(MutableRef.get(item), (joined) => joined.onDragSample(sample))
494
+ gestures.dragged(sample)
495
+ },
496
+ onReleaseEnd: gestures.released,
497
+ })
498
+ // A load's Features arriving (Q15): what the element wants of them starts then; an item joins its
499
+ // group first, and a `layout` from the same load makes its node before the drag's track drives it (#582).
500
+ const stopRechecks = provider.onFeatures(() => {
501
+ joinItem()
502
+ joinLayout()
503
+ drag.check()
504
+ gestures.check()
505
+ })
506
+ // Its `LayoutDependency`, compared per delivery as Motion's `prevProps.layoutDependency !==` is: a
507
+ // change asks for the node's measure, or, on an element with no node (a group's), the whole tree's.
508
+ let dependency = config.layoutDependency
509
+ const dependencyChanged = (): void => {
510
+ const next = config.layoutDependency
511
+ if (Equal.equals(dependency, next)) return
512
+ dependency = next
513
+ const ask = (): void => {
514
+ UndefinedOr.match(MutableRef.get(layoutNode), {
515
+ onDefined: (node) => node.notify(),
516
+ onUndefined: () => UndefinedOr.map(builtProjection(), (projection) => projection.notify()),
517
+ })
518
+ }
519
+ // A View Transition's render (decision 33): the pass it asks for is an Instant change of the layout.
520
+ if (state.transitioning) {
521
+ state.transitioning = false
522
+ UndefinedOr.match(builtProjection(), { onUndefined: ask, onDefined: (projection) => projection.instant(ask) })
523
+ return
524
+ }
525
+ ask()
526
+ }
527
+ // The Override stack resolved (ADR-0007), compared by value (#470): a delivery that resolves the same
528
+ // targets tells nothing, as a `transition` change alone doesn't in Motion; a gesture's flip
529
+ // re-resolves it with the entries on now.
530
+ let last: Spine.Resolution | undefined
531
+ const retarget = (): void => {
532
+ const next = Spine.resolutionOf(view, inherited, start.initialLink, gestures.active(), snapshot, node.change())
533
+ if (Predicate.isNotUndefined(last) && Spine.sameResolution(last, next)) return
534
+ last = next
535
+ spine.retarget(next)
536
+ }
537
+ // Its Delivery (decision 20): each render's fresh config, inside the patch, Retargets at once (#791, Q14),
538
+ // after the binding's hint (decision 32), so the Retarget's legs take their first step in this frame.
539
+ // A defect there is Foldkit's patch's otherwise, which would stop the whole app (decision 13): reported,
540
+ // and the element stays where it is.
541
+ const uninstall = installSetter(element, (delivered) => {
542
+ config = configOf(delivered)
543
+ if (DEV) warnChangedControls(provider, id, controls, config)
544
+ view = viewOf()
545
+ // A Reorder group's values that changed (decision 28): its controller told, before the pass that lays the items out in them.
546
+ groupDelivered(element)
547
+ exitConfig.current = Spine.exitConfigOf(view, inherited)
548
+ patchTouched()
549
+ hintFrameUnless(provider.loop, paused)
550
+ try {
551
+ live.css(config.style)
552
+ dependencyChanged()
553
+ // A gesture this render wants starts now (ADR-0047 decision 5): a callback added later starts its recognizer, a `Drag` its track.
554
+ drag.check()
555
+ gestures.check()
556
+ startsDrag.check()
557
+ retarget()
558
+ } catch (error) {
559
+ provider.runtime.runFork(Report.failure(RETARGET_FAILED, Cause.die(error)))
560
+ }
561
+ })
562
+ // Its Live values followed from its first routed key on (#130), its text (decision 16), and its
563
+ // Transform template after the one at mount (#443), which its presence record draws its exit through.
564
+ spine.follow({ resolved: () => UndefinedOr.match(last, { onUndefined: () => Spine.NO_VALUES, onDefined: (resolution) => resolution.resolved }), dragging: gestures.dragging })
565
+ const unfollowText = followText(element, config.text, registry)
566
+ const unfollowTemplate = UndefinedOr.match(templateAtMount, {
567
+ onUndefined: () => constVoid,
568
+ onDefined: (template) => {
569
+ recordFrame(ElementSetup.registeredValuesOf(template) as Values.Values)
570
+ return ElementSetup.followTemplate(template, () => view.transformTemplate, reactivity.watch, (next) => {
571
+ provider.gate.write(id, { ...snapshot.values, [DomRenderer.TEMPLATE_KEY]: next })
572
+ recordFrame({ [DomRenderer.TEMPLATE_KEY]: next } as unknown as Values.Values)
573
+ })
574
+ },
575
+ })
576
+ // Its Imperative animations (#433) go through its spine while it's mounted.
577
+ const unregisterAnimatable = Imperative.registerAnimatable(element, spine)
578
+ // What a Variant child hears without a delivery of its own (P17): the name its ancestor hands down and
579
+ // the gestures it hands on (#291), as one trigger key, and its `when` gate opening, re-checked once a
580
+ // patch, at each settle that changes a gate (decision 17) and at each gesture flip above it.
581
+ let unwatch: () => void = constVoid
582
+ if (Predicate.isNotUndefined(node.names)) {
583
+ const unwatchName = UndefinedOr.match(inherited, {
584
+ onUndefined: () => constVoid,
585
+ // Its ancestor's Controls change is a trigger too (#433), even to the same name.
586
+ onDefined: (parentContext) => {
587
+ const inheritedChange = VariantTree.controlsChangeOf(undefined, parentContext)
588
+ return reactivity.watch(() => VariantTree.triggerKeyOf(parentContext.variant(), VariantTree.handDownFrom(parentContext), inheritedChange()), retarget)
589
+ },
590
+ })
591
+ const unwatchGate = reactivity.watch(node.canStart, (open) => {
592
+ if (Bool.and(open, Predicate.isNotUndefined(last))) spine.retarget(UndefinedOr.getOrThrow(last))
593
+ })
594
+ unwatch = () => {
595
+ unwatchName()
596
+ unwatchGate()
597
+ }
598
+ }
599
+ // Its Animation controls reach it from its mount to its release (#798, Q4): each change sets its
600
+ // entry, re-resolves it on the change's override and tells the watches, its Variant children's
601
+ // triggers among them; their stop ends its legs where they are.
602
+ const unsubscribe = UndefinedOr.match(controls, {
603
+ onUndefined: () => constVoid,
604
+ onDefined: (c) =>
605
+ AnimationControls.subscribe(
606
+ c,
607
+ AnimationControls.controlledElement(
608
+ (change) => {
609
+ node.setChange(change)
610
+ view = viewOf()
611
+ retarget()
612
+ recheck()
613
+ },
614
+ { custom: () => config.custom, snapshot },
615
+ spine.stop,
616
+ ),
617
+ ),
618
+ })
619
+ // Its drag and its gestures wanted at mount, then its first Retarget: from `initial` to `animate`.
620
+ drag.check()
621
+ gestures.check()
622
+ startsDrag.check()
623
+ retarget()
624
+ return () => {
625
+ unsubscribe()
626
+ released()
627
+ unwatch()
628
+ unfollowText()
629
+ unfollowTemplate()
630
+ unregisterAnimatable()
631
+ uninstall()
632
+ stopRechecks()
633
+ releaseScope()
634
+ startsDrag.dispose()
635
+ UndefinedOr.map(MutableRef.get(item), (joined) => joined.dispose())
636
+ drag.dispose()
637
+ gestures.dispose()
638
+ UndefinedOr.map(MutableRef.get(layoutNode), (node) => node.dispose())
639
+ UndefinedOr.map(MutableRef.get(unregisterValues), (unregister) => unregister())
640
+ spine.dispose()
641
+ unregister()
642
+ dropNode(element)
643
+ }
644
+ }
645
+ return UndefinedOr.match(presence, { onUndefined: () => startUnder(element, begin), onDefined: (p) => p.enroll(element, begin) })
646
+ }
647
+
648
+ /** Development's word on a render giving an element other controls, or values in their place (#798, Q17): it keeps the ones it mounted with. */
649
+ const CONTROLS_CHANGED =
650
+ "wardic.controls: a w.* element's Animation controls are read at its mount, and a later render gave it other controls, or values in their place: it keeps the ones it mounted with. Key the element, so the new ones mount with it."
651
+
652
+ /** Development's word on the reverse (the review's note): controls given to an element that mounted with none don't reach it. */
653
+ const CONTROLS_LATE = "wardic.controls: a w.* element mounted without Animation controls, and a later render gave it some: they don't reach it. Key the element, so they mount with it."
654
+
655
+ /** Say the word, once an element, when a delivery's `animate` isn't what it mounted with: other controls, values in their place, or controls where there were none. */
656
+ const warnChangedControls = (provider: Provider, id: string, controls: AnimationControls.WardicAnimationControls | undefined, config: Config): void => {
657
+ const word = UndefinedOr.match(controls, {
658
+ onUndefined: () => Bool.match(AnimationControls.isAnimationControls(config.animate), { onTrue: () => CONTROLS_LATE, onFalse: constUndefined }),
659
+ onDefined: (mounted) => Bool.match(config.animate === mounted, { onTrue: constUndefined, onFalse: () => CONTROLS_CHANGED }),
660
+ })
661
+ UndefinedOr.map(word, (message) => provider.registry.warnOnce(`controls:${id}`, message))
662
+ }
663
+
664
+ /** In development alone (#746), what warns once that a `transform` string gave way to `style`'s transform keys. */
665
+ const droppedTransformWarning = (provider: Provider, id: string): (() => void) | undefined => {
666
+ if (DEV) return () => ElementSetup.warnDroppedTransform(provider.runtime, id)
667
+ return undefined
668
+ }