@1agh/maude 0.19.1 → 0.20.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 (49) hide show
  1. package/package.json +9 -9
  2. package/plugins/design/dev-server/annotations-context-toolbar.tsx +112 -38
  3. package/plugins/design/dev-server/annotations-layer.tsx +204 -95
  4. package/plugins/design/dev-server/artboard-marquee.tsx +8 -4
  5. package/plugins/design/dev-server/bin/asset-sweep.sh +180 -0
  6. package/plugins/design/dev-server/bin/visual-sanity.sh +221 -0
  7. package/plugins/design/dev-server/canvas-lib.tsx +506 -30
  8. package/plugins/design/dev-server/canvas-shell.tsx +352 -20
  9. package/plugins/design/dev-server/client/hmr.mjs +28 -0
  10. package/plugins/design/dev-server/commands/annotation-strokes-command.ts +127 -0
  11. package/plugins/design/dev-server/commands/equal-spacing-command.ts +28 -0
  12. package/plugins/design/dev-server/commands/move-artboards-command.ts +158 -0
  13. package/plugins/design/dev-server/comments-overlay.tsx +12 -4
  14. package/plugins/design/dev-server/contextual-toolbar.tsx +241 -0
  15. package/plugins/design/dev-server/dist/client.bundle.js +3 -3
  16. package/plugins/design/dev-server/dist/runtime/motion.js +165 -0
  17. package/plugins/design/dev-server/dist/runtime/motion_react.js +409 -0
  18. package/plugins/design/dev-server/equal-spacing-detector.ts +98 -0
  19. package/plugins/design/dev-server/equal-spacing-handles.tsx +289 -0
  20. package/plugins/design/dev-server/handoff.ts +24 -0
  21. package/plugins/design/dev-server/http.ts +27 -0
  22. package/plugins/design/dev-server/input-router.tsx +52 -2
  23. package/plugins/design/dev-server/marquee-overlay.tsx +282 -0
  24. package/plugins/design/dev-server/runtime-bundle.ts +7 -0
  25. package/plugins/design/dev-server/test/annotation-strokes-command.test.ts +149 -0
  26. package/plugins/design/dev-server/test/annotations-layer.test.ts +44 -0
  27. package/plugins/design/dev-server/test/canvas-lib-motion.test.ts +131 -0
  28. package/plugins/design/dev-server/test/equal-spacing-detector.test.ts +93 -0
  29. package/plugins/design/dev-server/test/input-router.test.ts +87 -1
  30. package/plugins/design/dev-server/test/marquee-overlay.test.ts +94 -0
  31. package/plugins/design/dev-server/test/move-artboards-command.test.ts +108 -0
  32. package/plugins/design/dev-server/test/undo-stack.test.ts +211 -0
  33. package/plugins/design/dev-server/test/use-cursor-modifiers.test.ts +59 -0
  34. package/plugins/design/dev-server/test/use-keyboard-discipline.test.ts +27 -0
  35. package/plugins/design/dev-server/test/use-undo-stack.test.tsx +193 -0
  36. package/plugins/design/dev-server/undo-hud.tsx +95 -0
  37. package/plugins/design/dev-server/undo-stack.ts +240 -0
  38. package/plugins/design/dev-server/use-artboard-drag.tsx +6 -3
  39. package/plugins/design/dev-server/use-cursor-modifiers.tsx +122 -0
  40. package/plugins/design/dev-server/use-keyboard-discipline.tsx +125 -0
  41. package/plugins/design/dev-server/use-undo-stack.tsx +355 -0
  42. package/plugins/design/templates/_shell.html +17 -6
  43. package/plugins/design/templates/design-system-inspiration/SUB-AGENT-PROMPTS.md +245 -0
  44. package/plugins/design/templates/design-system-inspiration/_MAPPING.md +2 -2
  45. package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +129 -0
  46. package/plugins/design/templates/design-system-inspiration/core/preview/_motion-readme.md.tpl +63 -0
  47. package/plugins/design/templates/design-system-inspiration/core/preview/motion.css.tpl +106 -0
  48. package/plugins/design/templates/design-system-inspiration/core/preview/motion.tsx.tpl +208 -0
  49. /package/plugins/design/templates/design-system-inspiration/core/preview/{motion.html → .archive/motion.html} +0 -0
@@ -0,0 +1,165 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+
16
+ // ../../../node_modules/.pnpm/motion@11.18.2_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/motion/dist/es/motion/lib/index.mjs
17
+ var exports_lib = {};
18
+ __export(exports_lib, {
19
+ wrap: () => wrap,
20
+ transform: () => transform,
21
+ time: () => time,
22
+ sync: () => sync,
23
+ steps: () => steps,
24
+ stagger: () => stagger,
25
+ spring: () => spring,
26
+ scrollInfo: () => scrollInfo,
27
+ scroll: () => scroll,
28
+ reverseEasing: () => reverseEasing,
29
+ progress: () => progress,
30
+ pipe: () => pipe,
31
+ noop: () => noop,
32
+ motionValue: () => motionValue,
33
+ mix: () => mix,
34
+ mirrorEasing: () => mirrorEasing,
35
+ keyframes: () => keyframes,
36
+ isDragActive: () => isDragActive,
37
+ invariant: () => invariant,
38
+ interpolate: () => interpolate,
39
+ inertia: () => inertia,
40
+ inView: () => inView,
41
+ frameSteps: () => frameSteps,
42
+ frameData: () => frameData,
43
+ frame: () => frame,
44
+ easeOut: () => easeOut,
45
+ easeInOut: () => easeInOut,
46
+ easeIn: () => easeIn,
47
+ distance2D: () => distance2D,
48
+ distance: () => distance,
49
+ delay: () => delayInSeconds,
50
+ cubicBezier: () => cubicBezier,
51
+ createScopedAnimate: () => createScopedAnimate,
52
+ clamp: () => clamp,
53
+ circOut: () => circOut,
54
+ circInOut: () => circInOut,
55
+ circIn: () => circIn,
56
+ cancelSync: () => cancelSync,
57
+ cancelFrame: () => cancelFrame,
58
+ backOut: () => backOut,
59
+ backInOut: () => backInOut,
60
+ backIn: () => backIn,
61
+ anticipate: () => anticipate,
62
+ animateMini: () => animateMini,
63
+ animate: () => animate,
64
+ MotionValue: () => MotionValue
65
+ });
66
+
67
+ // synth:/home/runner/work/maude/maude/plugins/design/dev-server/.runtime-bundle-motion-entry.tsx
68
+ var {
69
+ MotionValue: MotionValue2,
70
+ animate: animate2,
71
+ animateMini: animateMini2,
72
+ anticipate: anticipate2,
73
+ backIn: backIn2,
74
+ backInOut: backInOut2,
75
+ backOut: backOut2,
76
+ cancelFrame: cancelFrame2,
77
+ cancelSync: cancelSync2,
78
+ circIn: circIn2,
79
+ circInOut: circInOut2,
80
+ circOut: circOut2,
81
+ clamp: clamp2,
82
+ createScopedAnimate: createScopedAnimate2,
83
+ cubicBezier: cubicBezier2,
84
+ delay,
85
+ distance: distance2,
86
+ distance2D: distance2D2,
87
+ easeIn: easeIn2,
88
+ easeInOut: easeInOut2,
89
+ easeOut: easeOut2,
90
+ frame: frame2,
91
+ frameData: frameData2,
92
+ frameSteps: frameSteps2,
93
+ inView: inView2,
94
+ inertia: inertia2,
95
+ interpolate: interpolate2,
96
+ invariant: invariant2,
97
+ isDragActive: isDragActive2,
98
+ keyframes: keyframes2,
99
+ mirrorEasing: mirrorEasing2,
100
+ mix: mix2,
101
+ motionValue: motionValue2,
102
+ noop: noop2,
103
+ pipe: pipe2,
104
+ progress: progress2,
105
+ reverseEasing: reverseEasing2,
106
+ scroll: scroll2,
107
+ scrollInfo: scrollInfo2,
108
+ spring: spring2,
109
+ stagger: stagger2,
110
+ steps: steps2,
111
+ sync: sync2,
112
+ time: time2,
113
+ transform: transform2,
114
+ wrap: wrap2
115
+ } = exports_lib;
116
+ var __runtime_bundle_motion_entry_default = exports_lib;
117
+ export {
118
+ wrap2 as wrap,
119
+ transform2 as transform,
120
+ time2 as time,
121
+ sync2 as sync,
122
+ steps2 as steps,
123
+ stagger2 as stagger,
124
+ spring2 as spring,
125
+ scrollInfo2 as scrollInfo,
126
+ scroll2 as scroll,
127
+ reverseEasing2 as reverseEasing,
128
+ progress2 as progress,
129
+ pipe2 as pipe,
130
+ noop2 as noop,
131
+ motionValue2 as motionValue,
132
+ mix2 as mix,
133
+ mirrorEasing2 as mirrorEasing,
134
+ keyframes2 as keyframes,
135
+ isDragActive2 as isDragActive,
136
+ invariant2 as invariant,
137
+ interpolate2 as interpolate,
138
+ inertia2 as inertia,
139
+ inView2 as inView,
140
+ frameSteps2 as frameSteps,
141
+ frameData2 as frameData,
142
+ frame2 as frame,
143
+ easeOut2 as easeOut,
144
+ easeInOut2 as easeInOut,
145
+ easeIn2 as easeIn,
146
+ distance2D2 as distance2D,
147
+ distance2 as distance,
148
+ delay,
149
+ __runtime_bundle_motion_entry_default as default,
150
+ cubicBezier2 as cubicBezier,
151
+ createScopedAnimate2 as createScopedAnimate,
152
+ clamp2 as clamp,
153
+ circOut2 as circOut,
154
+ circInOut2 as circInOut,
155
+ circIn2 as circIn,
156
+ cancelSync2 as cancelSync,
157
+ cancelFrame2 as cancelFrame,
158
+ backOut2 as backOut,
159
+ backInOut2 as backInOut,
160
+ backIn2 as backIn,
161
+ anticipate2 as anticipate,
162
+ animateMini2 as animateMini,
163
+ animate2 as animate,
164
+ MotionValue2 as MotionValue
165
+ };
@@ -0,0 +1,409 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+
16
+ // ../../../node_modules/.pnpm/motion@11.18.2_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/motion/dist/es/motion/lib/react.mjs
17
+ var exports_react = {};
18
+ __export(exports_react, {
19
+ wrap: () => wrap,
20
+ visualElementStore: () => visualElementStore,
21
+ useWillChange: () => useWillChange,
22
+ useViewportScroll: () => useViewportScroll,
23
+ useVelocity: () => useVelocity,
24
+ useUnmountEffect: () => useUnmountEffect,
25
+ useTransform: () => useTransform,
26
+ useTime: () => useTime,
27
+ useSpring: () => useSpring,
28
+ useScroll: () => useScroll,
29
+ useResetProjection: () => useResetProjection,
30
+ useReducedMotionConfig: () => useReducedMotionConfig,
31
+ useReducedMotion: () => useReducedMotion,
32
+ usePresence: () => usePresence,
33
+ useMotionValueEvent: () => useMotionValueEvent,
34
+ useMotionValue: () => useMotionValue,
35
+ useMotionTemplate: () => useMotionTemplate,
36
+ useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect,
37
+ useIsPresent: () => useIsPresent,
38
+ useInstantTransition: () => useInstantTransition,
39
+ useInstantLayoutTransition: () => useInstantLayoutTransition,
40
+ useInView: () => useInView,
41
+ useForceUpdate: () => useForceUpdate,
42
+ useElementScroll: () => useElementScroll,
43
+ useDragControls: () => useDragControls,
44
+ useDomEvent: () => useDomEvent,
45
+ useDeprecatedInvertedScale: () => useInvertedScale,
46
+ useDeprecatedAnimatedState: () => useAnimatedState,
47
+ useCycle: () => useCycle,
48
+ useAnimationFrame: () => useAnimationFrame,
49
+ useAnimationControls: () => useAnimationControls,
50
+ useAnimation: () => useAnimation,
51
+ useAnimateMini: () => useAnimateMini,
52
+ useAnimate: () => useAnimate,
53
+ unwrapMotionComponent: () => unwrapMotionComponent,
54
+ transform: () => transform,
55
+ time: () => time,
56
+ sync: () => sync,
57
+ steps: () => steps,
58
+ startOptimizedAppearAnimation: () => startOptimizedAppearAnimation,
59
+ stagger: () => stagger,
60
+ spring: () => spring,
61
+ scrollInfo: () => scrollInfo,
62
+ scroll: () => scroll,
63
+ reverseEasing: () => reverseEasing,
64
+ resolveMotionValue: () => resolveMotionValue,
65
+ px: () => px,
66
+ progress: () => progress,
67
+ pipe: () => pipe,
68
+ optimizedAppearDataAttribute: () => optimizedAppearDataAttribute,
69
+ noop: () => noop,
70
+ motionValue: () => motionValue,
71
+ motion: () => motion,
72
+ mix: () => mix,
73
+ mirrorEasing: () => mirrorEasing,
74
+ makeUseVisualState: () => makeUseVisualState,
75
+ m: () => m,
76
+ keyframes: () => keyframes,
77
+ isValidMotionProp: () => isValidMotionProp,
78
+ isMotionValue: () => isMotionValue,
79
+ isMotionComponent: () => isMotionComponent,
80
+ isDragActive: () => isDragActive,
81
+ isBrowser: () => isBrowser,
82
+ invariant: () => invariant,
83
+ interpolate: () => interpolate,
84
+ inertia: () => inertia,
85
+ inView: () => inView,
86
+ frameSteps: () => frameSteps,
87
+ frameData: () => frameData,
88
+ frame: () => frame,
89
+ findSpring: () => findSpring,
90
+ filterProps: () => filterProps,
91
+ easeOut: () => easeOut,
92
+ easeInOut: () => easeInOut,
93
+ easeIn: () => easeIn,
94
+ domMin: () => domMin,
95
+ domMax: () => domMax,
96
+ domAnimation: () => domAnimation,
97
+ distance2D: () => distance2D,
98
+ distance: () => distance,
99
+ disableInstantTransitions: () => disableInstantTransitions,
100
+ delay: () => delay,
101
+ cubicBezier: () => cubicBezier,
102
+ createScopedAnimate: () => createScopedAnimate,
103
+ createRendererMotionComponent: () => createRendererMotionComponent,
104
+ createBox: () => createBox,
105
+ complex: () => complex,
106
+ color: () => color,
107
+ clamp: () => clamp,
108
+ circOut: () => circOut,
109
+ circInOut: () => circInOut,
110
+ circIn: () => circIn,
111
+ cancelSync: () => cancelSync,
112
+ cancelFrame: () => cancelFrame,
113
+ calcLength: () => calcLength,
114
+ buildTransform: () => buildTransform,
115
+ backOut: () => backOut,
116
+ backInOut: () => backInOut,
117
+ backIn: () => backIn,
118
+ anticipate: () => anticipate,
119
+ animations: () => animations,
120
+ animationControls: () => animationControls,
121
+ animateVisualElement: () => animateVisualElement,
122
+ animateValue: () => animateValue,
123
+ animateMini: () => animateMini,
124
+ animate: () => animate,
125
+ addScaleCorrector: () => addScaleCorrector,
126
+ addPointerInfo: () => addPointerInfo,
127
+ addPointerEvent: () => addPointerEvent,
128
+ VisualElement: () => VisualElement,
129
+ SwitchLayoutGroupContext: () => SwitchLayoutGroupContext,
130
+ Reorder: () => namespace,
131
+ PresenceContext: () => PresenceContext,
132
+ MotionValue: () => MotionValue,
133
+ MotionGlobalConfig: () => MotionGlobalConfig,
134
+ MotionContext: () => MotionContext,
135
+ MotionConfigContext: () => MotionConfigContext,
136
+ MotionConfig: () => MotionConfig,
137
+ LazyMotion: () => LazyMotion,
138
+ LayoutGroupContext: () => LayoutGroupContext,
139
+ LayoutGroup: () => LayoutGroup,
140
+ FlatTree: () => FlatTree,
141
+ DragControls: () => DragControls,
142
+ DeprecatedLayoutGroupContext: () => DeprecatedLayoutGroupContext,
143
+ AnimateSharedLayout: () => AnimateSharedLayout,
144
+ AnimatePresence: () => AnimatePresence,
145
+ AcceleratedAnimation: () => AcceleratedAnimation
146
+ });
147
+ "use client";
148
+
149
+ // synth:/home/runner/work/maude/maude/plugins/design/dev-server/.runtime-bundle-motion_react-entry.tsx
150
+ var {
151
+ AcceleratedAnimation: AcceleratedAnimation2,
152
+ AnimatePresence: AnimatePresence2,
153
+ AnimateSharedLayout: AnimateSharedLayout2,
154
+ DeprecatedLayoutGroupContext: DeprecatedLayoutGroupContext2,
155
+ DragControls: DragControls2,
156
+ FlatTree: FlatTree2,
157
+ LayoutGroup: LayoutGroup2,
158
+ LayoutGroupContext: LayoutGroupContext2,
159
+ LazyMotion: LazyMotion2,
160
+ MotionConfig: MotionConfig2,
161
+ MotionConfigContext: MotionConfigContext2,
162
+ MotionContext: MotionContext2,
163
+ MotionGlobalConfig: MotionGlobalConfig2,
164
+ MotionValue: MotionValue2,
165
+ PresenceContext: PresenceContext2,
166
+ Reorder,
167
+ SwitchLayoutGroupContext: SwitchLayoutGroupContext2,
168
+ VisualElement: VisualElement2,
169
+ addPointerEvent: addPointerEvent2,
170
+ addPointerInfo: addPointerInfo2,
171
+ addScaleCorrector: addScaleCorrector2,
172
+ animate: animate2,
173
+ animateMini: animateMini2,
174
+ animateValue: animateValue2,
175
+ animateVisualElement: animateVisualElement2,
176
+ animationControls: animationControls2,
177
+ animations: animations2,
178
+ anticipate: anticipate2,
179
+ backIn: backIn2,
180
+ backInOut: backInOut2,
181
+ backOut: backOut2,
182
+ buildTransform: buildTransform2,
183
+ calcLength: calcLength2,
184
+ cancelFrame: cancelFrame2,
185
+ cancelSync: cancelSync2,
186
+ circIn: circIn2,
187
+ circInOut: circInOut2,
188
+ circOut: circOut2,
189
+ clamp: clamp2,
190
+ color: color2,
191
+ complex: complex2,
192
+ createBox: createBox2,
193
+ createRendererMotionComponent: createRendererMotionComponent2,
194
+ createScopedAnimate: createScopedAnimate2,
195
+ cubicBezier: cubicBezier2,
196
+ delay: delay2,
197
+ disableInstantTransitions: disableInstantTransitions2,
198
+ distance: distance2,
199
+ distance2D: distance2D2,
200
+ domAnimation: domAnimation2,
201
+ domMax: domMax2,
202
+ domMin: domMin2,
203
+ easeIn: easeIn2,
204
+ easeInOut: easeInOut2,
205
+ easeOut: easeOut2,
206
+ filterProps: filterProps2,
207
+ findSpring: findSpring2,
208
+ frame: frame2,
209
+ frameData: frameData2,
210
+ frameSteps: frameSteps2,
211
+ inView: inView2,
212
+ inertia: inertia2,
213
+ interpolate: interpolate2,
214
+ invariant: invariant2,
215
+ isBrowser: isBrowser2,
216
+ isDragActive: isDragActive2,
217
+ isMotionComponent: isMotionComponent2,
218
+ isMotionValue: isMotionValue2,
219
+ isValidMotionProp: isValidMotionProp2,
220
+ keyframes: keyframes2,
221
+ m: m2,
222
+ makeUseVisualState: makeUseVisualState2,
223
+ mirrorEasing: mirrorEasing2,
224
+ mix: mix2,
225
+ motion: motion2,
226
+ motionValue: motionValue2,
227
+ noop: noop2,
228
+ optimizedAppearDataAttribute: optimizedAppearDataAttribute2,
229
+ pipe: pipe2,
230
+ progress: progress2,
231
+ px: px2,
232
+ resolveMotionValue: resolveMotionValue2,
233
+ reverseEasing: reverseEasing2,
234
+ scroll: scroll2,
235
+ scrollInfo: scrollInfo2,
236
+ spring: spring2,
237
+ stagger: stagger2,
238
+ startOptimizedAppearAnimation: startOptimizedAppearAnimation2,
239
+ steps: steps2,
240
+ sync: sync2,
241
+ time: time2,
242
+ transform: transform2,
243
+ unwrapMotionComponent: unwrapMotionComponent2,
244
+ useAnimate: useAnimate2,
245
+ useAnimateMini: useAnimateMini2,
246
+ useAnimation: useAnimation2,
247
+ useAnimationControls: useAnimationControls2,
248
+ useAnimationFrame: useAnimationFrame2,
249
+ useCycle: useCycle2,
250
+ useDeprecatedAnimatedState,
251
+ useDeprecatedInvertedScale,
252
+ useDomEvent: useDomEvent2,
253
+ useDragControls: useDragControls2,
254
+ useElementScroll: useElementScroll2,
255
+ useForceUpdate: useForceUpdate2,
256
+ useInView: useInView2,
257
+ useInstantLayoutTransition: useInstantLayoutTransition2,
258
+ useInstantTransition: useInstantTransition2,
259
+ useIsPresent: useIsPresent2,
260
+ useIsomorphicLayoutEffect: useIsomorphicLayoutEffect2,
261
+ useMotionTemplate: useMotionTemplate2,
262
+ useMotionValue: useMotionValue2,
263
+ useMotionValueEvent: useMotionValueEvent2,
264
+ usePresence: usePresence2,
265
+ useReducedMotion: useReducedMotion2,
266
+ useReducedMotionConfig: useReducedMotionConfig2,
267
+ useResetProjection: useResetProjection2,
268
+ useScroll: useScroll2,
269
+ useSpring: useSpring2,
270
+ useTime: useTime2,
271
+ useTransform: useTransform2,
272
+ useUnmountEffect: useUnmountEffect2,
273
+ useVelocity: useVelocity2,
274
+ useViewportScroll: useViewportScroll2,
275
+ useWillChange: useWillChange2,
276
+ visualElementStore: visualElementStore2,
277
+ wrap: wrap2
278
+ } = exports_react;
279
+ var __runtime_bundle_motion_react_entry_default = exports_react;
280
+ export {
281
+ wrap2 as wrap,
282
+ visualElementStore2 as visualElementStore,
283
+ useWillChange2 as useWillChange,
284
+ useViewportScroll2 as useViewportScroll,
285
+ useVelocity2 as useVelocity,
286
+ useUnmountEffect2 as useUnmountEffect,
287
+ useTransform2 as useTransform,
288
+ useTime2 as useTime,
289
+ useSpring2 as useSpring,
290
+ useScroll2 as useScroll,
291
+ useResetProjection2 as useResetProjection,
292
+ useReducedMotionConfig2 as useReducedMotionConfig,
293
+ useReducedMotion2 as useReducedMotion,
294
+ usePresence2 as usePresence,
295
+ useMotionValueEvent2 as useMotionValueEvent,
296
+ useMotionValue2 as useMotionValue,
297
+ useMotionTemplate2 as useMotionTemplate,
298
+ useIsomorphicLayoutEffect2 as useIsomorphicLayoutEffect,
299
+ useIsPresent2 as useIsPresent,
300
+ useInstantTransition2 as useInstantTransition,
301
+ useInstantLayoutTransition2 as useInstantLayoutTransition,
302
+ useInView2 as useInView,
303
+ useForceUpdate2 as useForceUpdate,
304
+ useElementScroll2 as useElementScroll,
305
+ useDragControls2 as useDragControls,
306
+ useDomEvent2 as useDomEvent,
307
+ useDeprecatedInvertedScale,
308
+ useDeprecatedAnimatedState,
309
+ useCycle2 as useCycle,
310
+ useAnimationFrame2 as useAnimationFrame,
311
+ useAnimationControls2 as useAnimationControls,
312
+ useAnimation2 as useAnimation,
313
+ useAnimateMini2 as useAnimateMini,
314
+ useAnimate2 as useAnimate,
315
+ unwrapMotionComponent2 as unwrapMotionComponent,
316
+ transform2 as transform,
317
+ time2 as time,
318
+ sync2 as sync,
319
+ steps2 as steps,
320
+ startOptimizedAppearAnimation2 as startOptimizedAppearAnimation,
321
+ stagger2 as stagger,
322
+ spring2 as spring,
323
+ scrollInfo2 as scrollInfo,
324
+ scroll2 as scroll,
325
+ reverseEasing2 as reverseEasing,
326
+ resolveMotionValue2 as resolveMotionValue,
327
+ px2 as px,
328
+ progress2 as progress,
329
+ pipe2 as pipe,
330
+ optimizedAppearDataAttribute2 as optimizedAppearDataAttribute,
331
+ noop2 as noop,
332
+ motionValue2 as motionValue,
333
+ motion2 as motion,
334
+ mix2 as mix,
335
+ mirrorEasing2 as mirrorEasing,
336
+ makeUseVisualState2 as makeUseVisualState,
337
+ m2 as m,
338
+ keyframes2 as keyframes,
339
+ isValidMotionProp2 as isValidMotionProp,
340
+ isMotionValue2 as isMotionValue,
341
+ isMotionComponent2 as isMotionComponent,
342
+ isDragActive2 as isDragActive,
343
+ isBrowser2 as isBrowser,
344
+ invariant2 as invariant,
345
+ interpolate2 as interpolate,
346
+ inertia2 as inertia,
347
+ inView2 as inView,
348
+ frameSteps2 as frameSteps,
349
+ frameData2 as frameData,
350
+ frame2 as frame,
351
+ findSpring2 as findSpring,
352
+ filterProps2 as filterProps,
353
+ easeOut2 as easeOut,
354
+ easeInOut2 as easeInOut,
355
+ easeIn2 as easeIn,
356
+ domMin2 as domMin,
357
+ domMax2 as domMax,
358
+ domAnimation2 as domAnimation,
359
+ distance2D2 as distance2D,
360
+ distance2 as distance,
361
+ disableInstantTransitions2 as disableInstantTransitions,
362
+ delay2 as delay,
363
+ __runtime_bundle_motion_react_entry_default as default,
364
+ cubicBezier2 as cubicBezier,
365
+ createScopedAnimate2 as createScopedAnimate,
366
+ createRendererMotionComponent2 as createRendererMotionComponent,
367
+ createBox2 as createBox,
368
+ complex2 as complex,
369
+ color2 as color,
370
+ clamp2 as clamp,
371
+ circOut2 as circOut,
372
+ circInOut2 as circInOut,
373
+ circIn2 as circIn,
374
+ cancelSync2 as cancelSync,
375
+ cancelFrame2 as cancelFrame,
376
+ calcLength2 as calcLength,
377
+ buildTransform2 as buildTransform,
378
+ backOut2 as backOut,
379
+ backInOut2 as backInOut,
380
+ backIn2 as backIn,
381
+ anticipate2 as anticipate,
382
+ animations2 as animations,
383
+ animationControls2 as animationControls,
384
+ animateVisualElement2 as animateVisualElement,
385
+ animateValue2 as animateValue,
386
+ animateMini2 as animateMini,
387
+ animate2 as animate,
388
+ addScaleCorrector2 as addScaleCorrector,
389
+ addPointerInfo2 as addPointerInfo,
390
+ addPointerEvent2 as addPointerEvent,
391
+ VisualElement2 as VisualElement,
392
+ SwitchLayoutGroupContext2 as SwitchLayoutGroupContext,
393
+ Reorder,
394
+ PresenceContext2 as PresenceContext,
395
+ MotionValue2 as MotionValue,
396
+ MotionGlobalConfig2 as MotionGlobalConfig,
397
+ MotionContext2 as MotionContext,
398
+ MotionConfigContext2 as MotionConfigContext,
399
+ MotionConfig2 as MotionConfig,
400
+ LazyMotion2 as LazyMotion,
401
+ LayoutGroupContext2 as LayoutGroupContext,
402
+ LayoutGroup2 as LayoutGroup,
403
+ FlatTree2 as FlatTree,
404
+ DragControls2 as DragControls,
405
+ DeprecatedLayoutGroupContext2 as DeprecatedLayoutGroupContext,
406
+ AnimateSharedLayout2 as AnimateSharedLayout,
407
+ AnimatePresence2 as AnimatePresence,
408
+ AcceleratedAnimation2 as AcceleratedAnimation
409
+ };
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @file equal-spacing-detector.ts — T27 (Wave 3)
3
+ * @scope plugins/design/dev-server/equal-spacing-detector.ts
4
+ * @purpose Pure detector for Figma "Smart Selection" pink-dot affordance
5
+ * (Rasmus Andersson 2018). Given 3+ rects on a single axis,
6
+ * returns the equal gap + the screen-coord midpoints between
7
+ * adjacent pairs IF all pairwise gaps are within `tolerancePx`
8
+ * of each other. Returns `null` when the rects are not equally
9
+ * distributed.
10
+ *
11
+ * Pure / DOM-free / framework-free — same convention as
12
+ * `computeSnap` in `use-snap-guides.tsx`. The overlay layer
13
+ * consumes the result and paints the pink dots.
14
+ *
15
+ * Coordinate space is the caller's choice — pass screen-space
16
+ * rects for live overlay rendering, or world-space rects for
17
+ * distribute-command verification. The math is uniform either
18
+ * way; only the unit of `tolerancePx` differs.
19
+ */
20
+
21
+ import type { Rect } from './use-snap-guides.tsx';
22
+
23
+ export type SpacingAxis = 'x' | 'y';
24
+
25
+ export interface EqualSpacingResult {
26
+ axis: SpacingAxis;
27
+ /** The gap measured between adjacent rects (post-sort by leading edge).
28
+ * Caller renders this in the distance pill above each pink dot. */
29
+ gapPx: number;
30
+ /** Midpoint coords between consecutive rects. Length = rects.length - 1.
31
+ * Each entry is in caller's coord space; renderers anchor pink dots here. */
32
+ midpoints: Array<{ x: number; y: number }>;
33
+ }
34
+
35
+ interface DetectOptions {
36
+ /** How close gaps must be to count as "equal", in caller's unit (default 1). */
37
+ tolerancePx?: number;
38
+ }
39
+
40
+ /**
41
+ * Detect equal spacing along one axis. Returns `null` when:
42
+ * - fewer than 3 rects (2 rects trivially have "equal" spacing — undefined).
43
+ * - any pairwise gap differs from the median by more than `tolerancePx`.
44
+ * - rects overlap on the spacing axis (gap < 0 anywhere).
45
+ *
46
+ * The midpoint y (for axis='x') or x (for axis='y') is the average of the
47
+ * adjacent rects' center on the perpendicular axis — this places the pink
48
+ * dot vertically centered between the two siblings, which is where the
49
+ * distance pill anchors above.
50
+ */
51
+ export function detectEqualSpacing(
52
+ rects: Rect[],
53
+ axis: SpacingAxis,
54
+ opts: DetectOptions = {}
55
+ ): EqualSpacingResult | null {
56
+ if (rects.length < 3) return null;
57
+ const tol = opts.tolerancePx ?? 1;
58
+
59
+ // Sort by leading edge on the spacing axis.
60
+ const sorted = [...rects].sort((a, b) => (axis === 'x' ? a.x - b.x : a.y - b.y));
61
+
62
+ // Compute pairwise gaps + midpoints.
63
+ const gaps: number[] = [];
64
+ const midpoints: Array<{ x: number; y: number }> = [];
65
+ for (let i = 1; i < sorted.length; i++) {
66
+ const prev = sorted[i - 1];
67
+ const cur = sorted[i];
68
+ if (!prev || !cur) return null;
69
+ if (axis === 'x') {
70
+ const gap = cur.x - (prev.x + prev.w);
71
+ if (gap < 0) return null; // overlap; not a distributed set
72
+ gaps.push(gap);
73
+ midpoints.push({
74
+ x: prev.x + prev.w + gap / 2,
75
+ y: (prev.y + prev.h / 2 + (cur.y + cur.h / 2)) / 2,
76
+ });
77
+ } else {
78
+ const gap = cur.y - (prev.y + prev.h);
79
+ if (gap < 0) return null;
80
+ gaps.push(gap);
81
+ midpoints.push({
82
+ x: (prev.x + prev.w / 2 + (cur.x + cur.w / 2)) / 2,
83
+ y: prev.y + prev.h + gap / 2,
84
+ });
85
+ }
86
+ }
87
+
88
+ // All gaps must be within tolerance of each other. Use the median as anchor
89
+ // to be robust against a single outlier — though if any gap is outside the
90
+ // band we return null, so median vs mean is academic here.
91
+ const sortedGaps = [...gaps].sort((a, b) => a - b);
92
+ const median = sortedGaps[Math.floor(sortedGaps.length / 2)] ?? 0;
93
+ for (const g of gaps) {
94
+ if (Math.abs(g - median) > tol) return null;
95
+ }
96
+
97
+ return { axis, gapPx: median, midpoints };
98
+ }