@fluentui/react-positioning 9.18.1 → 9.18.3

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 (52) hide show
  1. package/CHANGELOG.md +21 -2
  2. package/README.md +11 -9
  3. package/dist/index.d.ts +18 -18
  4. package/lib/hooks/useSafeZoneArea/SafeZoneArea.js +156 -0
  5. package/lib/hooks/useSafeZoneArea/SafeZoneArea.js.map +1 -0
  6. package/lib/{SafeZoneArea.styles.js → hooks/useSafeZoneArea/SafeZoneArea.styles.js} +2 -4
  7. package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.js.map +1 -0
  8. package/lib/hooks/useSafeZoneArea/computeOutsideClipPath.js +27 -0
  9. package/lib/hooks/useSafeZoneArea/computeOutsideClipPath.js.map +1 -0
  10. package/lib/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js +25 -0
  11. package/lib/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js.map +1 -0
  12. package/lib/hooks/useSafeZoneArea/getMouseAnchor.js +51 -0
  13. package/lib/hooks/useSafeZoneArea/getMouseAnchor.js.map +1 -0
  14. package/lib/hooks/useSafeZoneArea/getRectCorners.js +24 -0
  15. package/lib/hooks/useSafeZoneArea/getRectCorners.js.map +1 -0
  16. package/lib/hooks/useSafeZoneArea/pointsToSvgPath.js +7 -0
  17. package/lib/hooks/useSafeZoneArea/pointsToSvgPath.js.map +1 -0
  18. package/lib/hooks/useSafeZoneArea/types.js +5 -0
  19. package/lib/hooks/useSafeZoneArea/types.js.map +1 -0
  20. package/lib/{useSafeZoneArea.js → hooks/useSafeZoneArea/useSafeZoneArea.js} +6 -4
  21. package/lib/hooks/useSafeZoneArea/useSafeZoneArea.js.map +1 -0
  22. package/lib/index.js +1 -1
  23. package/lib/index.js.map +1 -1
  24. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.js +168 -0
  25. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.js.map +1 -0
  26. package/lib-commonjs/{SafeZoneArea.styles.js → hooks/useSafeZoneArea/SafeZoneArea.styles.js} +1 -5
  27. package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.js.map +1 -0
  28. package/lib-commonjs/hooks/useSafeZoneArea/computeOutsideClipPath.js +33 -0
  29. package/lib-commonjs/hooks/useSafeZoneArea/computeOutsideClipPath.js.map +1 -0
  30. package/lib-commonjs/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js +35 -0
  31. package/lib-commonjs/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js.map +1 -0
  32. package/lib-commonjs/hooks/useSafeZoneArea/getMouseAnchor.js +62 -0
  33. package/lib-commonjs/hooks/useSafeZoneArea/getMouseAnchor.js.map +1 -0
  34. package/lib-commonjs/hooks/useSafeZoneArea/getRectCorners.js +34 -0
  35. package/lib-commonjs/hooks/useSafeZoneArea/getRectCorners.js.map +1 -0
  36. package/lib-commonjs/hooks/useSafeZoneArea/pointsToSvgPath.js +17 -0
  37. package/lib-commonjs/hooks/useSafeZoneArea/pointsToSvgPath.js.map +1 -0
  38. package/lib-commonjs/hooks/useSafeZoneArea/types.js +8 -0
  39. package/lib-commonjs/hooks/useSafeZoneArea/types.js.map +1 -0
  40. package/lib-commonjs/{useSafeZoneArea.js → hooks/useSafeZoneArea/useSafeZoneArea.js} +6 -4
  41. package/lib-commonjs/hooks/useSafeZoneArea/useSafeZoneArea.js.map +1 -0
  42. package/lib-commonjs/index.js +1 -1
  43. package/lib-commonjs/index.js.map +1 -1
  44. package/package.json +3 -3
  45. package/lib/SafeZoneArea.js +0 -309
  46. package/lib/SafeZoneArea.js.map +0 -1
  47. package/lib/SafeZoneArea.styles.js.map +0 -1
  48. package/lib/useSafeZoneArea.js.map +0 -1
  49. package/lib-commonjs/SafeZoneArea.js +0 -319
  50. package/lib-commonjs/SafeZoneArea.js.map +0 -1
  51. package/lib-commonjs/SafeZoneArea.styles.js.map +0 -1
  52. package/lib-commonjs/useSafeZoneArea.js.map +0 -1
@@ -1,319 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- SafeZoneArea: function() {
13
- return SafeZoneArea;
14
- },
15
- createSafeZoneAreaStateStore: function() {
16
- return createSafeZoneAreaStateStore;
17
- }
18
- });
19
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
20
- const _react = require("@griffel/react");
21
- const _reactutilities = require("@fluentui/react-utilities");
22
- const _react1 = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
23
- const _shim = require("use-sync-external-store/shim");
24
- const _SafeZoneAreastyles = require("./SafeZoneArea.styles");
25
- function createSafeZoneAreaStateStore() {
26
- let isActive = false;
27
- const listeners = [];
28
- return {
29
- isActive () {
30
- return isActive;
31
- },
32
- toggleActive (newIsActive) {
33
- if (isActive === newIsActive) {
34
- return;
35
- }
36
- isActive = newIsActive;
37
- listeners.forEach((listener)=>listener(isActive));
38
- },
39
- subscribe (listener) {
40
- listeners.push(listener);
41
- return ()=>{
42
- const index = listeners.indexOf(listener);
43
- if (index > -1) {
44
- listeners.splice(index, 1);
45
- }
46
- };
47
- }
48
- };
49
- }
50
- const SafeZoneArea = /*#__PURE__*/ _react1.memo((props)=>{
51
- const { debug, onMouseEnter, onMouseMove, onMouseLeave, stateStore } = props;
52
- const clipPathId = (0, _reactutilities.useId)();
53
- const styles = (0, _SafeZoneAreastyles.useStyles)();
54
- const active = (0, _shim.useSyncExternalStore)(stateStore.subscribe, stateStore.isActive);
55
- const svgRef = _react1.useRef(null);
56
- _react1.useImperativeHandle(props.imperativeRef, ()=>({
57
- updateSVG ({ containerPlacementSide, containerRect, mouseCoordinates, targetRect }) {
58
- const svgEl = svgRef.current;
59
- if (!svgEl) {
60
- return;
61
- }
62
- const trianglePathEl = svgEl.children.item(0);
63
- const debugRectEl = svgEl.children.item(2);
64
- const clipPathEl = svgEl.children.item(1);
65
- const clipPathRect = clipPathEl.firstElementChild;
66
- const SIZE_MULTIPLIER = 0.9;
67
- let svgStyle;
68
- let tringlePoints = [];
69
- let clipPoints = [];
70
- switch(containerPlacementSide){
71
- case 'top':
72
- svgStyle = {
73
- width: `${containerRect.width}px`,
74
- height: `${targetRect.bottom - containerRect.bottom}px`,
75
- transform: `translate(${containerRect.left}px, ${containerRect.bottom}px)`
76
- };
77
- tringlePoints = [
78
- [
79
- containerRect.width,
80
- 0
81
- ],
82
- [
83
- mouseCoordinates.x - containerRect.left,
84
- (mouseCoordinates.y - containerRect.bottom) / SIZE_MULTIPLIER
85
- ],
86
- [
87
- 0,
88
- 0
89
- ]
90
- ];
91
- clipPoints = [
92
- [
93
- 0,
94
- 0
95
- ],
96
- [
97
- 0,
98
- targetRect.bottom - containerRect.bottom
99
- ],
100
- [
101
- targetRect.left - containerRect.left,
102
- targetRect.bottom - containerRect.bottom
103
- ],
104
- [
105
- targetRect.left - containerRect.left,
106
- targetRect.top - containerRect.bottom
107
- ],
108
- [
109
- targetRect.right - containerRect.left,
110
- targetRect.top - containerRect.bottom
111
- ],
112
- [
113
- targetRect.right - containerRect.left,
114
- targetRect.bottom - containerRect.bottom
115
- ],
116
- [
117
- containerRect.width,
118
- targetRect.bottom - containerRect.bottom
119
- ],
120
- [
121
- containerRect.width,
122
- 0
123
- ]
124
- ];
125
- break;
126
- case 'bottom':
127
- svgStyle = {
128
- width: `${containerRect.width}px`,
129
- height: `${containerRect.top - targetRect.top}px`,
130
- transform: `translate(${containerRect.left}px, ${targetRect.top}px)`
131
- };
132
- tringlePoints = [
133
- [
134
- containerRect.width,
135
- containerRect.top - targetRect.top
136
- ],
137
- [
138
- mouseCoordinates.x - containerRect.left,
139
- (mouseCoordinates.y - targetRect.top) * SIZE_MULTIPLIER
140
- ],
141
- [
142
- 0,
143
- containerRect.top - targetRect.top
144
- ]
145
- ];
146
- clipPoints = [
147
- [
148
- 0,
149
- 0
150
- ],
151
- [
152
- 0,
153
- containerRect.top - targetRect.top
154
- ],
155
- [
156
- containerRect.width,
157
- containerRect.top - targetRect.top
158
- ],
159
- [
160
- containerRect.width,
161
- 0
162
- ],
163
- [
164
- targetRect.right - containerRect.left,
165
- 0
166
- ],
167
- [
168
- targetRect.right - containerRect.left,
169
- targetRect.height
170
- ],
171
- [
172
- targetRect.left - containerRect.left,
173
- targetRect.height
174
- ],
175
- [
176
- targetRect.left - containerRect.left,
177
- 0
178
- ]
179
- ];
180
- break;
181
- case 'left':
182
- svgStyle = {
183
- width: `${targetRect.right - containerRect.right}px`,
184
- height: `${containerRect.height}px`,
185
- transform: `translate(${containerRect.right}px, ${containerRect.top}px)`
186
- };
187
- tringlePoints = [
188
- [
189
- (mouseCoordinates.x - containerRect.right) / SIZE_MULTIPLIER,
190
- mouseCoordinates.y - containerRect.top
191
- ],
192
- [
193
- 0,
194
- containerRect.height
195
- ],
196
- [
197
- 0,
198
- 0
199
- ]
200
- ];
201
- clipPoints = [
202
- [
203
- 0,
204
- 0
205
- ],
206
- [
207
- 0,
208
- containerRect.height
209
- ],
210
- [
211
- targetRect.right - containerRect.right,
212
- containerRect.height
213
- ],
214
- [
215
- targetRect.right - containerRect.right,
216
- targetRect.bottom - containerRect.top
217
- ],
218
- [
219
- targetRect.left - containerRect.right,
220
- targetRect.bottom - containerRect.top
221
- ],
222
- [
223
- targetRect.left - containerRect.right,
224
- targetRect.top - containerRect.top
225
- ],
226
- [
227
- targetRect.right - containerRect.right,
228
- targetRect.top - containerRect.top
229
- ],
230
- [
231
- targetRect.right - containerRect.right,
232
- 0
233
- ]
234
- ];
235
- break;
236
- default:
237
- svgStyle = {
238
- width: `${containerRect.left - targetRect.left}px`,
239
- height: `${containerRect.height}px`,
240
- transform: `translate(${targetRect.left}px, ${containerRect.top}px)`
241
- };
242
- tringlePoints = [
243
- [
244
- (mouseCoordinates.x - targetRect.left) * SIZE_MULTIPLIER,
245
- mouseCoordinates.y - containerRect.y
246
- ],
247
- [
248
- containerRect.left - targetRect.left,
249
- containerRect.height
250
- ],
251
- [
252
- containerRect.left - targetRect.left,
253
- 0
254
- ]
255
- ];
256
- clipPoints = [
257
- [
258
- 0,
259
- 0
260
- ],
261
- [
262
- 0,
263
- targetRect.top - containerRect.top
264
- ],
265
- [
266
- targetRect.width,
267
- targetRect.top - containerRect.top
268
- ],
269
- [
270
- targetRect.width,
271
- targetRect.bottom - containerRect.top
272
- ],
273
- [
274
- 0,
275
- targetRect.bottom - containerRect.top
276
- ],
277
- [
278
- 0,
279
- containerRect.height
280
- ],
281
- [
282
- containerRect.left - targetRect.left,
283
- containerRect.height
284
- ],
285
- [
286
- containerRect.left - targetRect.left,
287
- 0
288
- ]
289
- ];
290
- break;
291
- }
292
- const trianglePath = `M ${tringlePoints.flatMap((p)=>p).join(' ')} z`;
293
- const clipPath = `M ${clipPoints.flatMap((p)=>p).join(' ')} z`;
294
- Object.assign(svgEl.style, svgStyle);
295
- trianglePathEl.setAttributeNS(null, 'd', trianglePath);
296
- clipPathRect.setAttributeNS(null, 'd', clipPath);
297
- debugRectEl === null || debugRectEl === void 0 ? void 0 : debugRectEl.setAttributeNS(null, 'd', clipPath);
298
- }
299
- }), []);
300
- return /*#__PURE__*/ _react1.createElement("div", {
301
- className: (0, _react.mergeClasses)(styles.wrapper, active && styles.wrapperActive),
302
- "data-safe-zone": ""
303
- }, active ? /*#__PURE__*/ _react1.createElement("svg", {
304
- "aria-hidden": true,
305
- className: styles.svg,
306
- xmlns: "http://www.w3.org/2000/svg",
307
- ref: svgRef
308
- }, /*#__PURE__*/ _react1.createElement("path", {
309
- className: (0, _react.mergeClasses)(styles.triangle, debug && styles.triangleDebug),
310
- clipPath: `url(#${clipPathId})`,
311
- onMouseEnter: onMouseEnter,
312
- onMouseMove: onMouseMove,
313
- onMouseLeave: onMouseLeave
314
- }), /*#__PURE__*/ _react1.createElement("clipPath", {
315
- id: clipPathId
316
- }, /*#__PURE__*/ _react1.createElement("path", null)), debug && /*#__PURE__*/ _react1.createElement("path", {
317
- className: styles.rectDebug
318
- })) : null);
319
- });
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/SafeZoneArea.tsx"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport { useId } from '@fluentui/react-utilities';\nimport type { Side as PlacementSide } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nimport { useStyles } from './SafeZoneArea.styles';\n\nexport type SafeZoneAreaImperativeHandle = {\n updateSVG: (options: {\n containerPlacementSide: PlacementSide;\n containerRect: DOMRect;\n targetRect: DOMRect;\n mouseCoordinates: { x: number; y: number };\n }) => void;\n};\n\nexport type SafeZoneAreaProps = {\n /** Enables debug mode: makes drawn shapes visible. */\n debug: boolean;\n\n /** A reference to the SafeZoneArea imperative handle. */\n imperativeRef: React.Ref<SafeZoneAreaImperativeHandle>;\n\n // eslint-disable-next-line @nx/workspace-consistent-callback-type\n onMouseEnter: (e: React.MouseEvent) => void;\n // eslint-disable-next-line @nx/workspace-consistent-callback-type\n onMouseMove: (e: React.MouseEvent) => void;\n // eslint-disable-next-line @nx/workspace-consistent-callback-type\n onMouseLeave: (e: React.MouseEvent) => void;\n\n stateStore: ReturnType<typeof createSafeZoneAreaStateStore>;\n};\n\nexport function createSafeZoneAreaStateStore() {\n let isActive = false;\n const listeners: ((value: boolean) => void)[] = [];\n\n return {\n isActive() {\n return isActive;\n },\n toggleActive(newIsActive: boolean) {\n if (isActive === newIsActive) {\n return;\n }\n\n isActive = newIsActive;\n listeners.forEach(listener => listener(isActive));\n },\n\n subscribe(listener: (value: boolean) => void) {\n listeners.push(listener);\n\n return () => {\n const index = listeners.indexOf(listener);\n\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n },\n };\n}\n\n/**\n * A component that renders a safe zone area with SVG shapes. Uses `useSyncExternalStore` to manage its active state\n * to avoid causing re-renders in `useSafeZoneArea()` as the hook might be used in host components like `Menu`.\n *\n * Draws two shapes:\n * - a triangle that points to the target element which is an actual safe zone\n * - a rectangle for a clip path that clips out the target element\n *\n * @internal\n */\nexport const SafeZoneArea = React.memo((props: SafeZoneAreaProps) => {\n const { debug, onMouseEnter, onMouseMove, onMouseLeave, stateStore } = props;\n\n const clipPathId = useId();\n const styles = useStyles();\n\n const active = useSyncExternalStore(stateStore.subscribe, stateStore.isActive);\n const svgRef = React.useRef<SVGSVGElement>(null);\n\n React.useImperativeHandle(\n props.imperativeRef,\n () => ({\n updateSVG({ containerPlacementSide, containerRect, mouseCoordinates, targetRect }) {\n const svgEl = svgRef.current;\n\n if (!svgEl) {\n return;\n }\n\n const trianglePathEl = svgEl.children.item(0) as SVGPathElement;\n const debugRectEl = svgEl.children.item(2) as SVGPathElement | null;\n const clipPathEl = svgEl.children.item(1) as SVGClipPathElement;\n const clipPathRect = clipPathEl.firstElementChild as SVGRectElement;\n\n const SIZE_MULTIPLIER = 0.9;\n\n let svgStyle: Partial<CSSStyleDeclaration>;\n\n let tringlePoints: [number, number][] = [];\n let clipPoints: [number, number][] = [];\n\n switch (containerPlacementSide) {\n case 'top':\n svgStyle = {\n width: `${containerRect.width}px`,\n height: `${targetRect.bottom - containerRect.bottom}px`,\n transform: `translate(${containerRect.left}px, ${containerRect.bottom}px)`,\n };\n\n tringlePoints = [\n [containerRect.width, 0],\n [mouseCoordinates.x - containerRect.left, (mouseCoordinates.y - containerRect.bottom) / SIZE_MULTIPLIER],\n [0, 0],\n ];\n clipPoints = [\n [0, 0],\n [0, targetRect.bottom - containerRect.bottom],\n [targetRect.left - containerRect.left, targetRect.bottom - containerRect.bottom],\n [targetRect.left - containerRect.left, targetRect.top - containerRect.bottom],\n [targetRect.right - containerRect.left, targetRect.top - containerRect.bottom],\n [targetRect.right - containerRect.left, targetRect.bottom - containerRect.bottom],\n [containerRect.width, targetRect.bottom - containerRect.bottom],\n [containerRect.width, 0],\n ];\n\n break;\n\n case 'bottom':\n svgStyle = {\n width: `${containerRect.width}px`,\n height: `${containerRect.top - targetRect.top}px`,\n transform: `translate(${containerRect.left}px, ${targetRect.top}px)`,\n };\n\n tringlePoints = [\n [containerRect.width, containerRect.top - targetRect.top],\n [mouseCoordinates.x - containerRect.left, (mouseCoordinates.y - targetRect.top) * SIZE_MULTIPLIER],\n [0, containerRect.top - targetRect.top],\n ];\n clipPoints = [\n [0, 0],\n [0, containerRect.top - targetRect.top],\n [containerRect.width, containerRect.top - targetRect.top],\n [containerRect.width, 0],\n [targetRect.right - containerRect.left, 0],\n [targetRect.right - containerRect.left, targetRect.height],\n [targetRect.left - containerRect.left, targetRect.height],\n [targetRect.left - containerRect.left, 0],\n ];\n\n break;\n\n case 'left':\n svgStyle = {\n width: `${targetRect.right - containerRect.right}px`,\n height: `${containerRect.height}px`,\n transform: `translate(${containerRect.right}px, ${containerRect.top}px)`,\n };\n\n tringlePoints = [\n [(mouseCoordinates.x - containerRect.right) / SIZE_MULTIPLIER, mouseCoordinates.y - containerRect.top],\n [0, containerRect.height],\n [0, 0],\n ];\n clipPoints = [\n [0, 0],\n [0, containerRect.height],\n [targetRect.right - containerRect.right, containerRect.height],\n [targetRect.right - containerRect.right, targetRect.bottom - containerRect.top],\n [targetRect.left - containerRect.right, targetRect.bottom - containerRect.top],\n [targetRect.left - containerRect.right, targetRect.top - containerRect.top],\n [targetRect.right - containerRect.right, targetRect.top - containerRect.top],\n [targetRect.right - containerRect.right, 0],\n ];\n\n break;\n\n default:\n svgStyle = {\n width: `${containerRect.left - targetRect.left}px`,\n height: `${containerRect.height}px`,\n transform: `translate(${targetRect.left}px, ${containerRect.top}px)`,\n };\n\n tringlePoints = [\n [(mouseCoordinates.x - targetRect.left) * SIZE_MULTIPLIER, mouseCoordinates.y - containerRect.y],\n [containerRect.left - targetRect.left, containerRect.height],\n [containerRect.left - targetRect.left, 0],\n ];\n clipPoints = [\n [0, 0],\n [0, targetRect.top - containerRect.top],\n [targetRect.width, targetRect.top - containerRect.top],\n [targetRect.width, targetRect.bottom - containerRect.top],\n [0, targetRect.bottom - containerRect.top],\n [0, containerRect.height],\n [containerRect.left - targetRect.left, containerRect.height],\n [containerRect.left - targetRect.left, 0],\n ];\n\n break;\n }\n\n const trianglePath = `M ${tringlePoints.flatMap(p => p).join(' ')} z`;\n const clipPath = `M ${clipPoints.flatMap(p => p).join(' ')} z`;\n\n Object.assign(svgEl.style, svgStyle);\n\n trianglePathEl.setAttributeNS(null, 'd', trianglePath);\n clipPathRect.setAttributeNS(null, 'd', clipPath);\n debugRectEl?.setAttributeNS(null, 'd', clipPath);\n },\n }),\n [],\n );\n\n return (\n <div className={mergeClasses(styles.wrapper, active && styles.wrapperActive)} data-safe-zone=\"\">\n {active ? (\n <svg aria-hidden className={styles.svg} xmlns=\"http://www.w3.org/2000/svg\" ref={svgRef}>\n <path\n className={mergeClasses(styles.triangle, debug && styles.triangleDebug)}\n clipPath={`url(#${clipPathId})`}\n onMouseEnter={onMouseEnter}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n />\n <clipPath id={clipPathId}>\n <path />\n </clipPath>\n\n {debug && <path className={styles.rectDebug} />}\n </svg>\n ) : null}\n </div>\n );\n});\n"],"names":["SafeZoneArea","createSafeZoneAreaStateStore","isActive","listeners","toggleActive","newIsActive","forEach","listener","subscribe","push","index","indexOf","splice","React","memo","props","debug","onMouseEnter","onMouseMove","onMouseLeave","stateStore","clipPathId","useId","styles","useStyles","active","useSyncExternalStore","svgRef","useRef","useImperativeHandle","imperativeRef","updateSVG","containerPlacementSide","containerRect","mouseCoordinates","targetRect","svgEl","current","trianglePathEl","children","item","debugRectEl","clipPathEl","clipPathRect","firstElementChild","SIZE_MULTIPLIER","svgStyle","tringlePoints","clipPoints","width","height","bottom","transform","left","x","y","top","right","trianglePath","flatMap","p","join","clipPath","Object","assign","style","setAttributeNS","createElement","div","className","mergeClasses","wrapper","wrapperActive","data-safe-zone","svg","aria-hidden","xmlns","ref","path","triangle","triangleDebug","id","rectDebug"],"rangeMappings":";;;;;;;;;;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cA;sBAEhBN,QAAAsD,aAAA,CAACL,YAAAA;QAASmB,IAAI5D;qBACZR,QAAAsD,aAAA,CAACW,QAAAA,QAGF9D,SAAAA,WAAAA,GAASH,QAAAsD,aAAA,CAACW,QAAAA;QAAKT,WAAW9C,OAAO2D,SAAS;UAE3C;AAGV"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["SafeZoneArea.styles.js"],"sourcesContent":["import { makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const useStyles = makeStyles({\n wrapper: {\n display: 'none',\n height: 0,\n width: 0,\n pointerEvents: 'none'\n },\n wrapperActive: {\n display: 'block'\n },\n svg: {\n fill: 'transparent',\n pointerEvents: 'none',\n position: 'fixed',\n top: 0,\n left: 0\n },\n triangle: {\n pointerEvents: 'auto'\n },\n triangleDebug: {\n cursor: 'crosshair',\n fill: `color-mix(in srgb, ${tokens.colorPaletteGreenBackground3} 20%, transparent)`,\n stroke: `color-mix(in srgb, ${tokens.colorPaletteGreenBackground3} 60%, transparent)`,\n strokeWidth: '2px'\n },\n rectDebug: {\n fill: `color-mix(in srgb, ${tokens.colorPaletteRedBackground3} 20%, transparent)`\n }\n});\n"],"names":["useStyles","__styles","wrapper","mc9l5x","Bqenvij","a9b677","Bkecrkj","wrapperActive","svg","Bkfmm31","qhf8xq","Bhzewxz","oyh7mz","triangle","triangleDebug","Bceei9c","ojy3ng","Be5yapy","rectDebug","d"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEaA;;;eAAAA;;;uBAFc;AAEpB,MAAMA,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;IAAA;IAAAC,eAAA;QAAAJ,QAAA;IAAA;IAAAK,KAAA;QAAAC,SAAA;QAAAH,SAAA;QAAAI,QAAA;QAAAC,SAAA;QAAAC,QAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,UAAA;QAAAP,SAAA;IAAA;IAAAQ,eAAA;QAAAC,SAAA;QAAAN,SAAA;QAAAO,QAAA;QAAAC,SAAA;IAAA;IAAAC,WAAA;QAAAT,SAAA;IAAA;AAAA,GAAA;IAAAU,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/useSafeZoneArea.tsx"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { Placement } from '@floating-ui/dom';\nimport * as React from 'react';\n\nimport { createSafeZoneAreaStateStore, type SafeZoneAreaImperativeHandle, SafeZoneArea } from './SafeZoneArea';\nimport { parseFloatingUIPlacement } from './utils';\n\nexport type SafeBufferAreaOptions = {\n /** Enables debug mode: makes drawn shapes visible. */\n debug?: boolean;\n\n /** Disables the safe zone area. */\n disabled?: boolean;\n\n /** The time in milliseconds to wait before clearing the safe zone. */\n timeout?: number;\n\n /** Called when the mouse enters the safe zone. */\n onSafeZoneEnter?: (e: React.MouseEvent) => void;\n\n /** Called when the mouse moves within the safe zone. */\n onSafeZoneMove?: (e: React.MouseEvent) => void;\n\n /** Called when the mouse leaves the safe zone. */\n onSafeZoneLeave?: (e: React.MouseEvent) => void;\n\n /** Called when the safe zone times out, even if a cursor is still over a safe zone. */\n onSafeZoneTimeout?: () => void;\n};\n\nexport function useSafeZoneArea({\n debug = false,\n disabled = false,\n\n onSafeZoneEnter,\n onSafeZoneMove,\n onSafeZoneLeave,\n onSafeZoneTimeout,\n\n timeout = 1500,\n}: SafeBufferAreaOptions = {}) {\n const [stateStore] = React.useState(createSafeZoneAreaStateStore);\n const { targetDocument } = useFluent_unstable();\n\n const safeZoneAreaRef = React.useRef<SafeZoneAreaImperativeHandle>(null);\n const containerRef = React.useRef<HTMLElement>(null);\n const targetRef = React.useRef<HTMLElement>(null);\n\n const timeoutIdRef = React.useRef<number | null>(null);\n const mouseMoveIdRef = React.useRef<number | null>(null);\n\n const mouseCoordinatesRef = React.useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n\n const containerListenerRef = React.useMemo(() => {\n if (disabled) {\n return () => {\n // do nothing\n };\n }\n\n let containerEl: HTMLElement | null = null;\n\n function onContainerMouseEnter() {\n const targetWindow = targetDocument?.defaultView;\n\n if (!targetWindow) {\n return;\n }\n\n if (timeoutIdRef.current) {\n targetWindow.clearTimeout(timeoutIdRef.current);\n timeoutIdRef.current = null;\n }\n\n stateStore.toggleActive(false);\n }\n\n return (el: HTMLElement | null) => {\n if (el === null) {\n containerEl?.removeEventListener('mouseenter', onContainerMouseEnter);\n }\n\n containerEl = el;\n el?.addEventListener('mouseenter', onContainerMouseEnter);\n };\n }, [disabled, stateStore, targetDocument]);\n\n const targetListenerRef = React.useMemo(() => {\n if (disabled) {\n return () => {\n // do nothing\n };\n }\n\n let targetEl: HTMLElement | null = null;\n\n function onTargetMouseMove(e: MouseEvent) {\n mouseCoordinatesRef.current = { x: e.clientX, y: e.clientY };\n\n if (timeoutIdRef.current) {\n targetDocument?.defaultView?.clearTimeout(timeoutIdRef.current);\n timeoutIdRef.current = null;\n }\n\n if (!stateStore.isActive()) {\n stateStore.toggleActive(true);\n }\n }\n\n return (el: HTMLElement | null) => {\n if (el === null) {\n const targetWindow = targetDocument?.defaultView;\n\n if (targetWindow) {\n if (mouseMoveIdRef.current) {\n targetWindow.cancelAnimationFrame(mouseMoveIdRef.current);\n mouseMoveIdRef.current = null;\n }\n\n if (timeoutIdRef.current) {\n targetWindow.clearTimeout(timeoutIdRef.current);\n timeoutIdRef.current = null;\n }\n }\n\n targetEl?.removeEventListener('mousemove', onTargetMouseMove);\n }\n\n targetEl = el;\n el?.addEventListener('mousemove', onTargetMouseMove);\n };\n }, [disabled, stateStore, targetDocument]);\n\n const onSvgMouseEnter = useEventCallback((e: React.MouseEvent) => {\n onSafeZoneEnter?.(e);\n\n const targetWindow = targetDocument?.defaultView;\n\n if (!targetWindow) {\n return;\n }\n\n if (timeoutIdRef.current) {\n targetWindow.clearTimeout(timeoutIdRef.current);\n timeoutIdRef.current = null;\n }\n\n // React 17 still uses pooled synthetic events\n e.persist();\n\n timeoutIdRef.current = targetWindow.setTimeout(() => {\n stateStore.toggleActive(false);\n onSafeZoneTimeout?.();\n }, timeout);\n });\n\n const onSvgMouseMove = useEventCallback((e: React.MouseEvent) => {\n onSafeZoneMove?.(e);\n });\n\n const onSvgMouseLeave = useEventCallback((e: React.MouseEvent) => {\n onSafeZoneLeave?.(e);\n });\n\n React.useEffect(() => {\n return stateStore.subscribe(isActive => {\n if (isActive) {\n function updateSVGs() {\n const containerEl = containerRef.current;\n const targetEl = targetRef.current;\n const targetWindow = targetDocument?.defaultView;\n\n if (containerEl && targetEl) {\n safeZoneAreaRef.current?.updateSVG({\n containerPlacementSide: parseFloatingUIPlacement(containerEl.dataset.popperPlacement as Placement).side,\n containerRect: containerEl.getBoundingClientRect(),\n mouseCoordinates: mouseCoordinatesRef.current,\n targetRect: targetEl.getBoundingClientRect(),\n });\n }\n\n if (targetWindow) {\n mouseMoveIdRef.current = targetWindow.requestAnimationFrame(updateSVGs);\n }\n }\n\n updateSVGs();\n return;\n }\n\n if (mouseMoveIdRef.current) {\n targetDocument?.defaultView?.cancelAnimationFrame(mouseMoveIdRef.current);\n mouseMoveIdRef.current = null;\n }\n });\n }, [stateStore, targetDocument]);\n\n return {\n containerRef: useMergedRefs(containerRef, containerListenerRef),\n targetRef: useMergedRefs(targetRef, targetListenerRef),\n\n elementToRender: React.useMemo(\n () =>\n disabled ? null : (\n <SafeZoneArea\n debug={debug}\n onMouseEnter={onSvgMouseEnter}\n onMouseMove={onSvgMouseMove}\n onMouseLeave={onSvgMouseLeave}\n imperativeRef={safeZoneAreaRef}\n stateStore={stateStore}\n />\n ),\n [disabled, debug, onSvgMouseEnter, onSvgMouseMove, onSvgMouseLeave, stateStore],\n ),\n };\n}\n"],"names":["useSafeZoneArea","debug","disabled","onSafeZoneEnter","onSafeZoneMove","onSafeZoneLeave","onSafeZoneTimeout","timeout","stateStore","React","useState","createSafeZoneAreaStateStore","targetDocument","useFluent_unstable","safeZoneAreaRef","useRef","containerRef","targetRef","timeoutIdRef","mouseMoveIdRef","mouseCoordinatesRef","x","y","containerListenerRef","useMemo","containerEl","onContainerMouseEnter","targetWindow","defaultView","current","clearTimeout","toggleActive","el","removeEventListener","addEventListener","targetListenerRef","targetEl","onTargetMouseMove","e","clientX","clientY","isActive","cancelAnimationFrame","onSvgMouseEnter","useEventCallback","persist","setTimeout","onSvgMouseMove","onSvgMouseLeave","useEffect","subscribe","updateSVGs","updateSVG","containerPlacementSide","parseFloatingUIPlacement","dataset","popperPlacement","side","containerRect","getBoundingClientRect","mouseCoordinates","targetRect","requestAnimationFrame","useMergedRefs","elementToRender","createElement","SafeZoneArea","onMouseEnter","onMouseMove","onMouseLeave","imperativeRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BgBA;;;eAAAA;;;;qCA/BmB;gCACa;iEAEzB;8BAEuE;uBACrD;AAyBlC,SAASA,gBAAgB,EAC9BC,QAAQ,KAAK,EACbC,WAAW,KAAK,EAEhBC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EAEjBC,UAAU,IAAI,EACQ,GAAG,CAAC,CAAC;IAC3B,MAAM,CAACC,WAAW,GAAGC,OAAMC,QAAQ,CAACC,0CAAAA;IACpC,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uC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