sanity-plugin-hotspot-array 5.0.4 → 5.0.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/Spot.tsx","../src/plugin.tsx","../src/ImageHotspotArray.tsx"],"mappings":";;UA0EiB,mBAAA;EAAA,CAAsC,GAAA;AAAA;EACrD,KAAA,EAAO,WAAA,CAAY,aAAA;EACnB,UAAA,EAAY,gBAAA;EACZ,aAAA,EAAe,qBAAA;AAAA;AAAA,UCvEA,mBAAA;EAAA,CAAsC,GAAA;AAAA;EACrD,QAAA;EACA,SAAA;EACA,eAAA;EACA,OAAA,GAAU,aAAA,CAAc,mBAAA,CAAoB,aAAA;AAAA;AAAA;EAAA,UAI3B,YAAA;IACf,YAAA,GAAe,mBAAmB;EAAA;AAAA;AAAA,cAIzB,uBAAA,mBAAuB,MAAA;AAAA,KCYxB,WAAA;EAAA,CAA8B,GAAA;AAAA;EACxC,IAAA;EACA,KAAA;EACA,CAAA;EACA,CAAA;AAAA,IACE,aAAa;AAAA,iBAED,iBAAA,CACd,KAAA,EAAO,wBAAA,CAAyB,WAAA;EAAgB,mBAAA,EAAqB,mBAAA;AAAA,IACpE,SAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/Spot.tsx","../src/plugin.tsx","../src/ImageHotspotArray.tsx"],"mappings":";;UA0EiB,oBAAoB;GAAkB;;EACrD,OAAO,YAAY;EACnB,YAAY;EACZ,eAAe;;UCvEA,oBAAoB;GAAkB;;EACrD;EACA;EACA;EACA,UAAU,cAAc,oBAAoB;;;YAI3B;IACf,eAAe;;;cAIN,0CAAuB;KCYxB,YAAY;GAAkB;;EACxC;EACA;EACA;EACA;IACE;iBAEY,kBACd,OAAO,yBAAyB;EAAgB,qBAAqB;IACpE"}
package/dist/index.js CHANGED
@@ -1,377 +1,389 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
1
  import { c } from "react/compiler-runtime";
3
2
  import { getImageDimensions } from "@sanity/asset-utils";
4
3
  import { createImageUrlBuilder } from "@sanity/image-url";
5
- import { Card, Text, Box, Tooltip, Flex, Stack } from "@sanity/ui";
4
+ import { Box, Card, Flex, Stack, Text, Tooltip } from "@sanity/ui";
6
5
  import { randomKey } from "@sanity/util/content";
7
6
  import get from "lodash-es/get.js";
8
- import { useState, useEffect, useRef, useMemo } from "react";
9
- import { useClient, useFormValue, useResolveInitialValueForType, PatchEvent, setIfMissing, insert, set, definePlugin } from "sanity";
10
- import { useMotionValue, motion } from "motion/react";
7
+ import { useEffect, useMemo, useRef, useState } from "react";
8
+ import { PatchEvent, definePlugin, insert, set, setIfMissing, useClient, useFormValue, useResolveInitialValueForType } from "sanity";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { motion, useMotionValue } from "motion/react";
11
11
  function Feedback(t0) {
12
- const $ = c(2), {
13
- children
14
- } = t0;
15
- let t1;
16
- return $[0] !== children ? (t1 = /* @__PURE__ */ jsx(Card, { padding: 4, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsx(Text, { children }) }), $[0] = children, $[1] = t1) : t1 = $[1], t1;
12
+ let $ = c(2), { children } = t0, t1;
13
+ return $[0] === children ? t1 = $[1] : (t1 = /* @__PURE__ */ jsx(Card, {
14
+ padding: 4,
15
+ radius: 2,
16
+ shadow: 1,
17
+ tone: "caution",
18
+ children: /* @__PURE__ */ jsx(Text, { children })
19
+ }), $[0] = children, $[1] = t1), t1;
17
20
  }
18
21
  const dragStyle = {
19
- width: "1.4rem",
20
- height: "1.4rem",
21
- position: "absolute",
22
- boxSizing: "border-box",
23
- top: 0,
24
- left: 0,
25
- margin: "-0.7rem 0 0 -0.7rem",
26
- cursor: "pointer",
27
- display: "flex",
28
- justifyContent: "center",
29
- alignItems: "center",
30
- borderRadius: "50%",
31
- background: "#000",
32
- color: "white"
22
+ width: "1.4rem",
23
+ height: "1.4rem",
24
+ position: "absolute",
25
+ boxSizing: "border-box",
26
+ top: 0,
27
+ left: 0,
28
+ margin: "-0.7rem 0 0 -0.7rem",
29
+ cursor: "pointer",
30
+ display: "flex",
31
+ justifyContent: "center",
32
+ alignItems: "center",
33
+ borderRadius: "50%",
34
+ background: "#000",
35
+ color: "white"
33
36
  }, dragStyleWhileDrag = {
34
- background: "rgba(0, 0, 0, 0.1)",
35
- border: "1px solid #fff",
36
- cursor: "none"
37
+ background: "rgba(0, 0, 0, 0.1)",
38
+ border: "1px solid #fff",
39
+ cursor: "none"
37
40
  }, dragStyleWhileHover = {
38
- background: "rgba(0, 0, 0, 0.1)",
39
- border: "1px solid #fff"
41
+ background: "rgba(0, 0, 0, 0.1)",
42
+ border: "1px solid #fff"
40
43
  }, dotStyle = {
41
- position: "absolute",
42
- left: "50%",
43
- top: "50%",
44
- height: "0.2rem",
45
- width: "0.2rem",
46
- margin: "-0.1rem 0 0 -0.1rem",
47
- background: "#fff",
48
- visibility: "hidden",
49
- borderRadius: "50%",
50
- // make sure pointer events only run on the parent
51
- pointerEvents: "none"
52
- }, dotStyleWhileActive = {
53
- visibility: "visible"
54
- }, labelStyle = {
55
- color: "white",
56
- fontSize: "0.7rem",
57
- fontWeight: 600,
58
- lineHeight: "1"
59
- }, labelStyleWhileActive = {
60
- visibility: "hidden"
61
- }, round = (num) => Math.round(num * 100) / 100;
44
+ position: "absolute",
45
+ left: "50%",
46
+ top: "50%",
47
+ height: "0.2rem",
48
+ width: "0.2rem",
49
+ margin: "-0.1rem 0 0 -0.1rem",
50
+ background: "#fff",
51
+ visibility: "hidden",
52
+ borderRadius: "50%",
53
+ pointerEvents: "none"
54
+ }, dotStyleWhileActive = { visibility: "visible" }, labelStyle = {
55
+ color: "white",
56
+ fontSize: "0.7rem",
57
+ fontWeight: 600,
58
+ lineHeight: "1"
59
+ }, labelStyleWhileActive = { visibility: "hidden" }, round = (num) => Math.round(num * 100) / 100;
62
60
  function Spot(t0) {
63
- const $ = c(67), {
64
- value,
65
- bounds,
66
- update,
67
- hotspotDescriptionPath,
68
- tooltip: TooltipComponent,
69
- index,
70
- schemaType,
71
- renderPreview
72
- } = t0, [isDragging, setIsDragging] = useState(!1), [isHovering, setIsHovering] = useState(!1), t1 = bounds.width * (value.x / 100);
73
- let t2;
74
- $[0] !== t1 ? (t2 = round(t1), $[0] = t1, $[1] = t2) : t2 = $[1];
75
- const x = useMotionValue(t2), t3 = bounds.height * (value.y / 100);
76
- let t4;
77
- $[2] !== t3 ? (t4 = round(t3), $[2] = t3, $[3] = t4) : t4 = $[3];
78
- const y = useMotionValue(t4);
79
- let t5;
80
- $[4] !== bounds.height || $[5] !== bounds.width || $[6] !== value.x || $[7] !== value.y || $[8] !== x || $[9] !== y ? (t5 = () => {
81
- x.set(round(bounds.width * (value.x / 100))), y.set(round(bounds.height * (value.y / 100)));
82
- }, $[4] = bounds.height, $[5] = bounds.width, $[6] = value.x, $[7] = value.y, $[8] = x, $[9] = y, $[10] = t5) : t5 = $[10];
83
- let t6;
84
- $[11] !== bounds || $[12] !== value || $[13] !== x || $[14] !== y ? (t6 = [x, y, value, bounds], $[11] = bounds, $[12] = value, $[13] = x, $[14] = y, $[15] = t6) : t6 = $[15], useEffect(t5, t6);
85
- let t7;
86
- $[16] !== bounds.height || $[17] !== bounds.width || $[18] !== update || $[19] !== value._key || $[20] !== x || $[21] !== y ? (t7 = () => {
87
- setIsDragging(!1);
88
- const currentX = x.get(), currentY = y.get(), newX = round(currentX * 100 / bounds.width), newY = round(currentY * 100 / bounds.height), safeX = Math.max(0, Math.min(100, newX)), safeY = Math.max(0, Math.min(100, newY));
89
- update(value._key, safeX, safeY);
90
- }, $[16] = bounds.height, $[17] = bounds.width, $[18] = update, $[19] = value._key, $[20] = x, $[21] = y, $[22] = t7) : t7 = $[22];
91
- const handleDragEnd = t7;
92
- let t8;
93
- $[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = () => setIsDragging(!0), $[23] = t8) : t8 = $[23];
94
- const handleDragStart = t8;
95
- let t9;
96
- $[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = () => setIsHovering(!0), $[24] = t9) : t9 = $[24];
97
- const handleHoverStart = t9;
98
- let t10;
99
- $[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setIsHovering(!1), $[25] = t10) : t10 = $[25];
100
- const handleHoverEnd = t10;
101
- if (!x || !y)
102
- return null;
103
- let t11;
104
- $[26] !== isDragging ? (t11 = isDragging && {
105
- ...dragStyleWhileDrag
106
- }, $[26] = isDragging, $[27] = t11) : t11 = $[27];
107
- let t12;
108
- $[28] !== isHovering ? (t12 = isHovering && {
109
- ...dragStyleWhileHover
110
- }, $[28] = isHovering, $[29] = t12) : t12 = $[29];
111
- let t13;
112
- $[30] !== t11 || $[31] !== t12 || $[32] !== x || $[33] !== y ? (t13 = {
113
- ...dragStyle,
114
- x,
115
- y,
116
- ...t11,
117
- ...t12
118
- }, $[30] = t11, $[31] = t12, $[32] = x, $[33] = y, $[34] = t13) : t13 = $[34];
119
- let t14;
120
- $[35] !== TooltipComponent || $[36] !== hotspotDescriptionPath || $[37] !== renderPreview || $[38] !== schemaType || $[39] !== value ? (t14 = TooltipComponent && typeof TooltipComponent == "function" ? /* @__PURE__ */ jsx(TooltipComponent, { value, renderPreview, schemaType }) : /* @__PURE__ */ jsx(Box, { padding: 2, style: {
121
- maxWidth: 200,
122
- pointerEvents: "none"
123
- }, children: /* @__PURE__ */ jsx(Text, { textOverflow: "ellipsis", children: hotspotDescriptionPath ? get(value, hotspotDescriptionPath) : `${value.x}% x ${value.y}%` }) }), $[35] = TooltipComponent, $[36] = hotspotDescriptionPath, $[37] = renderPreview, $[38] = schemaType, $[39] = value, $[40] = t14) : t14 = $[40];
124
- let t15;
125
- $[41] !== isDragging || $[42] !== isHovering ? (t15 = (isDragging || isHovering) && {
126
- ...dotStyleWhileActive
127
- }, $[41] = isDragging, $[42] = isHovering, $[43] = t15) : t15 = $[43];
128
- let t16;
129
- $[44] !== t15 ? (t16 = /* @__PURE__ */ jsx(Box, { style: {
130
- ...dotStyle,
131
- ...t15
132
- } }), $[44] = t15, $[45] = t16) : t16 = $[45];
133
- let t17;
134
- $[46] !== isDragging || $[47] !== isHovering ? (t17 = (isDragging || isHovering) && {
135
- ...labelStyleWhileActive
136
- }, $[46] = isDragging, $[47] = isHovering, $[48] = t17) : t17 = $[48];
137
- let t18;
138
- $[49] !== t17 ? (t18 = {
139
- ...labelStyle,
140
- ...t17
141
- }, $[49] = t17, $[50] = t18) : t18 = $[50];
142
- const t19 = index + 1;
143
- let t20;
144
- $[51] !== t18 || $[52] !== t19 ? (t20 = /* @__PURE__ */ jsx("div", { style: t18, children: t19 }), $[51] = t18, $[52] = t19, $[53] = t20) : t20 = $[53];
145
- let t21;
146
- $[54] !== t16 || $[55] !== t20 ? (t21 = /* @__PURE__ */ jsxs("div", { children: [
147
- t16,
148
- t20
149
- ] }), $[54] = t16, $[55] = t20, $[56] = t21) : t21 = $[56];
150
- let t22;
151
- $[57] !== isDragging || $[58] !== t14 || $[59] !== t21 || $[60] !== value._key ? (t22 = /* @__PURE__ */ jsx(Tooltip, { disabled: isDragging, portal: !0, content: t14, children: t21 }, value._key), $[57] = isDragging, $[58] = t14, $[59] = t21, $[60] = value._key, $[61] = t22) : t22 = $[61];
152
- let t23;
153
- return $[62] !== bounds || $[63] !== handleDragEnd || $[64] !== t13 || $[65] !== t22 ? (t23 = /* @__PURE__ */ jsx(motion.div, { drag: !0, dragConstraints: bounds, dragElastic: 0, dragMomentum: !1, onDragEnd: handleDragEnd, onDragStart: handleDragStart, onHoverStart: handleHoverStart, onHoverEnd: handleHoverEnd, style: t13, children: t22 }), $[62] = bounds, $[63] = handleDragEnd, $[64] = t13, $[65] = t22, $[66] = t23) : t23 = $[66], t23;
61
+ let $ = c(67), { value, bounds, update, hotspotDescriptionPath, tooltip: TooltipComponent, index, schemaType, renderPreview } = t0, [isDragging, setIsDragging] = useState(!1), [isHovering, setIsHovering] = useState(!1), t1 = bounds.width * (value.x / 100), t2;
62
+ $[0] === t1 ? t2 = $[1] : (t2 = round(t1), $[0] = t1, $[1] = t2);
63
+ let x = useMotionValue(t2), t3 = bounds.height * (value.y / 100), t4;
64
+ $[2] === t3 ? t4 = $[3] : (t4 = round(t3), $[2] = t3, $[3] = t4);
65
+ let y = useMotionValue(t4), t5;
66
+ $[4] !== bounds.height || $[5] !== bounds.width || $[6] !== value.x || $[7] !== value.y || $[8] !== x || $[9] !== y ? (t5 = () => {
67
+ x.set(round(bounds.width * (value.x / 100))), y.set(round(bounds.height * (value.y / 100)));
68
+ }, $[4] = bounds.height, $[5] = bounds.width, $[6] = value.x, $[7] = value.y, $[8] = x, $[9] = y, $[10] = t5) : t5 = $[10];
69
+ let t6;
70
+ $[11] !== bounds || $[12] !== value || $[13] !== x || $[14] !== y ? (t6 = [
71
+ x,
72
+ y,
73
+ value,
74
+ bounds
75
+ ], $[11] = bounds, $[12] = value, $[13] = x, $[14] = y, $[15] = t6) : t6 = $[15], useEffect(t5, t6);
76
+ let t7;
77
+ $[16] !== bounds.height || $[17] !== bounds.width || $[18] !== update || $[19] !== value._key || $[20] !== x || $[21] !== y ? (t7 = () => {
78
+ setIsDragging(!1);
79
+ let currentX = x.get(), currentY = y.get(), newX = round(currentX * 100 / bounds.width), newY = round(currentY * 100 / bounds.height), safeX = Math.max(0, Math.min(100, newX)), safeY = Math.max(0, Math.min(100, newY));
80
+ update(value._key, safeX, safeY);
81
+ }, $[16] = bounds.height, $[17] = bounds.width, $[18] = update, $[19] = value._key, $[20] = x, $[21] = y, $[22] = t7) : t7 = $[22];
82
+ let handleDragEnd = t7, t8;
83
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => setIsDragging(!0), $[23] = t8) : t8 = $[23];
84
+ let handleDragStart = t8, t9;
85
+ $[24] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => setIsHovering(!0), $[24] = t9) : t9 = $[24];
86
+ let handleHoverStart = t9, t10;
87
+ $[25] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setIsHovering(!1), $[25] = t10) : t10 = $[25];
88
+ let handleHoverEnd = t10;
89
+ if (!x || !y) return null;
90
+ let t11;
91
+ $[26] === isDragging ? t11 = $[27] : (t11 = isDragging && { ...dragStyleWhileDrag }, $[26] = isDragging, $[27] = t11);
92
+ let t12;
93
+ $[28] === isHovering ? t12 = $[29] : (t12 = isHovering && { ...dragStyleWhileHover }, $[28] = isHovering, $[29] = t12);
94
+ let t13;
95
+ $[30] !== t11 || $[31] !== t12 || $[32] !== x || $[33] !== y ? (t13 = {
96
+ ...dragStyle,
97
+ x,
98
+ y,
99
+ ...t11,
100
+ ...t12
101
+ }, $[30] = t11, $[31] = t12, $[32] = x, $[33] = y, $[34] = t13) : t13 = $[34];
102
+ let t14;
103
+ $[35] !== TooltipComponent || $[36] !== hotspotDescriptionPath || $[37] !== renderPreview || $[38] !== schemaType || $[39] !== value ? (t14 = TooltipComponent && typeof TooltipComponent == "function" ? /* @__PURE__ */ jsx(TooltipComponent, {
104
+ value,
105
+ renderPreview,
106
+ schemaType
107
+ }) : /* @__PURE__ */ jsx(Box, {
108
+ padding: 2,
109
+ style: {
110
+ maxWidth: 200,
111
+ pointerEvents: "none"
112
+ },
113
+ children: /* @__PURE__ */ jsx(Text, {
114
+ textOverflow: "ellipsis",
115
+ children: hotspotDescriptionPath ? get(value, hotspotDescriptionPath) : `${value.x}% x ${value.y}%`
116
+ })
117
+ }), $[35] = TooltipComponent, $[36] = hotspotDescriptionPath, $[37] = renderPreview, $[38] = schemaType, $[39] = value, $[40] = t14) : t14 = $[40];
118
+ let t15;
119
+ $[41] !== isDragging || $[42] !== isHovering ? (t15 = (isDragging || isHovering) && { ...dotStyleWhileActive }, $[41] = isDragging, $[42] = isHovering, $[43] = t15) : t15 = $[43];
120
+ let t16;
121
+ $[44] === t15 ? t16 = $[45] : (t16 = /* @__PURE__ */ jsx(Box, { style: {
122
+ ...dotStyle,
123
+ ...t15
124
+ } }), $[44] = t15, $[45] = t16);
125
+ let t17;
126
+ $[46] !== isDragging || $[47] !== isHovering ? (t17 = (isDragging || isHovering) && { ...labelStyleWhileActive }, $[46] = isDragging, $[47] = isHovering, $[48] = t17) : t17 = $[48];
127
+ let t18;
128
+ $[49] === t17 ? t18 = $[50] : (t18 = {
129
+ ...labelStyle,
130
+ ...t17
131
+ }, $[49] = t17, $[50] = t18);
132
+ let t19 = index + 1, t20;
133
+ $[51] !== t18 || $[52] !== t19 ? (t20 = /* @__PURE__ */ jsx("div", {
134
+ style: t18,
135
+ children: t19
136
+ }), $[51] = t18, $[52] = t19, $[53] = t20) : t20 = $[53];
137
+ let t21;
138
+ $[54] !== t16 || $[55] !== t20 ? (t21 = /* @__PURE__ */ jsxs("div", { children: [t16, t20] }), $[54] = t16, $[55] = t20, $[56] = t21) : t21 = $[56];
139
+ let t22;
140
+ $[57] !== isDragging || $[58] !== t14 || $[59] !== t21 || $[60] !== value._key ? (t22 = /* @__PURE__ */ jsx(Tooltip, {
141
+ disabled: isDragging,
142
+ portal: !0,
143
+ content: t14,
144
+ children: t21
145
+ }, value._key), $[57] = isDragging, $[58] = t14, $[59] = t21, $[60] = value._key, $[61] = t22) : t22 = $[61];
146
+ let t23;
147
+ return $[62] !== bounds || $[63] !== handleDragEnd || $[64] !== t13 || $[65] !== t22 ? (t23 = /* @__PURE__ */ jsx(motion.div, {
148
+ drag: !0,
149
+ dragConstraints: bounds,
150
+ dragElastic: 0,
151
+ dragMomentum: !1,
152
+ onDragEnd: handleDragEnd,
153
+ onDragStart: handleDragStart,
154
+ onHoverStart: handleHoverStart,
155
+ onHoverEnd: handleHoverEnd,
156
+ style: t13,
157
+ children: t22
158
+ }), $[62] = bounds, $[63] = handleDragEnd, $[64] = t13, $[65] = t22, $[66] = t23) : t23 = $[66], t23;
154
159
  }
160
+ const imageHotspotArrayPlugin = definePlugin({
161
+ name: "image-hotspot-array",
162
+ form: { components: { input: (props) => {
163
+ if (props.schemaType.jsonType === "array" && props.schemaType.options?.imageHotspot) {
164
+ let imageHotspotOptions = props.schemaType.options?.imageHotspot;
165
+ if (imageHotspotOptions) return /* @__PURE__ */ jsx(ImageHotspotArray, {
166
+ ...props,
167
+ imageHotspotOptions
168
+ });
169
+ }
170
+ return props.renderDefault(props);
171
+ } } }
172
+ });
173
+ /**
174
+ * Run effect only when component is unmounted.
175
+ *
176
+ * @param effect Effector to run on unmount
177
+ */
155
178
  function useUnmountEffect(effect) {
156
- const $ = c(5), effectRef = useRef(effect);
157
- let t0, t1;
158
- $[0] !== effect ? (t0 = () => {
159
- effectRef.current = effect;
160
- }, t1 = [effect], $[0] = effect, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1);
161
- let t2, t3;
162
- $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = () => () => effectRef.current(), t3 = [], $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), useEffect(t2, t3);
179
+ let $ = c(5), effectRef = useRef(effect), t0, t1;
180
+ $[0] === effect ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
181
+ effectRef.current = effect;
182
+ }, t1 = [effect], $[0] = effect, $[1] = t0, $[2] = t1), useEffect(t0, t1);
183
+ let t2, t3;
184
+ $[3] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => () => effectRef.current(), t3 = [], $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), useEffect(t2, t3);
163
185
  }
186
+ /**
187
+ * Makes passed function debounced, otherwise acts like `useCallback`.
188
+ *
189
+ * @param callback Function that will be debounced.
190
+ * @param deps Dependencies list when to update callback. It also replaces invoked
191
+ * callback for scheduled debounced invocations.
192
+ * @param delay Debounce delay.
193
+ * @param maxWait The maximum time `callback` is allowed to be delayed before
194
+ * it's invoked. 0 means no max wait.
195
+ */
164
196
  function useDebouncedCallback(callback, deps, delay, maxWait = 0) {
165
- const timeout = useRef(void 0), waitTimeout = useRef(void 0), cb = useRef(callback), lastCall = useRef(void 0), clear = () => {
166
- timeout.current && (clearTimeout(timeout.current), timeout.current = void 0), waitTimeout.current && (clearTimeout(waitTimeout.current), waitTimeout.current = void 0);
167
- };
168
- return useUnmountEffect(clear), useEffect(() => {
169
- cb.current = callback;
170
- }, deps), useMemo(() => {
171
- const execute = () => {
172
- if (clear(), !lastCall.current) return;
173
- const context = lastCall.current;
174
- lastCall.current = void 0, cb.current.apply(context.this, context.args);
175
- }, wrapped = function(...args) {
176
- timeout.current && clearTimeout(timeout.current), lastCall.current = {
177
- args,
178
- this: this
179
- }, timeout.current = setTimeout(execute, delay), maxWait > 0 && !waitTimeout.current && (waitTimeout.current = setTimeout(execute, maxWait));
180
- };
181
- return Object.defineProperties(wrapped, {
182
- length: {
183
- value: callback.length
184
- },
185
- name: {
186
- value: `${callback.name || "anonymous"}__debounced__${delay}`
187
- }
188
- }), wrapped;
189
- }, [delay, maxWait, ...deps]);
197
+ let timeout = useRef(void 0), waitTimeout = useRef(void 0), cb = useRef(callback), lastCall = useRef(void 0), clear = () => {
198
+ timeout.current &&= (clearTimeout(timeout.current), void 0), waitTimeout.current &&= (clearTimeout(waitTimeout.current), void 0);
199
+ };
200
+ return useUnmountEffect(clear), useEffect(() => {
201
+ cb.current = callback;
202
+ }, deps), useMemo(() => {
203
+ let execute = () => {
204
+ /* istanbul ignore next */
205
+ if (clear(), !lastCall.current) return;
206
+ let context = lastCall.current;
207
+ lastCall.current = void 0, cb.current.apply(context.this, context.args);
208
+ }, wrapped = function(...args) {
209
+ timeout.current && clearTimeout(timeout.current), lastCall.current = {
210
+ args,
211
+ this: this
212
+ }, timeout.current = setTimeout(execute, delay), maxWait > 0 && !waitTimeout.current && (waitTimeout.current = setTimeout(execute, maxWait));
213
+ };
214
+ return Object.defineProperties(wrapped, {
215
+ length: { value: callback.length },
216
+ name: { value: `${callback.name || "anonymous"}__debounced__${delay}` }
217
+ }), wrapped;
218
+ }, [
219
+ delay,
220
+ maxWait,
221
+ ...deps
222
+ ]);
190
223
  }
191
224
  const isBrowser = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
192
225
  let observerSingleton;
193
226
  function getResizeObserver() {
194
- if (!isBrowser) return;
195
- if (observerSingleton) return observerSingleton;
196
- const callbacks = /* @__PURE__ */ new Map(), observer = new ResizeObserver((entries) => {
197
- for (const entry of entries) callbacks.get(entry.target)?.forEach((cb) => setTimeout(() => {
198
- cb(entry);
199
- }, 0));
200
- });
201
- return observerSingleton = {
202
- observer,
203
- subscribe(target, callback) {
204
- let cbs = callbacks.get(target);
205
- cbs || (cbs = /* @__PURE__ */ new Set(), callbacks.set(target, cbs), observer.observe(target)), cbs.add(callback);
206
- },
207
- unsubscribe(target, callback) {
208
- const cbs = callbacks.get(target);
209
- cbs && (cbs.delete(callback), cbs.size === 0 && (callbacks.delete(target), observer.unobserve(target)));
210
- }
211
- }, observerSingleton;
227
+ if (!isBrowser) return;
228
+ if (observerSingleton) return observerSingleton;
229
+ let callbacks = /* @__PURE__ */ new Map(), observer = new ResizeObserver((entries) => {
230
+ for (let entry of entries) callbacks.get(entry.target)?.forEach((cb) => setTimeout(() => {
231
+ cb(entry);
232
+ }, 0));
233
+ });
234
+ return observerSingleton = {
235
+ observer,
236
+ subscribe(target, callback) {
237
+ let cbs = callbacks.get(target);
238
+ cbs || (cbs = /* @__PURE__ */ new Set(), callbacks.set(target, cbs), observer.observe(target)), cbs.add(callback);
239
+ },
240
+ unsubscribe(target, callback) {
241
+ let cbs = callbacks.get(target);
242
+ /* istanbul ignore else */
243
+ cbs && (cbs.delete(callback), cbs.size === 0 && (callbacks.delete(target), observer.unobserve(target)));
244
+ }
245
+ }, observerSingleton;
212
246
  }
247
+ /**
248
+ * Invokes a callback whenever ResizeObserver detects a change to target's size.
249
+ *
250
+ * @param target React reference or Element to track.
251
+ * @param callback Callback that will be invoked on resize.
252
+ * @param enabled Whether resize observer is enabled or not.
253
+ */
213
254
  function useResizeObserver(target, callback, enabled = !0) {
214
- const ro = enabled && getResizeObserver(), cb = useRef(callback);
215
- useEffect(() => {
216
- cb.current = callback;
217
- }, [callback]);
218
- const tgt = target && "current" in target ? target.current : target;
219
- useEffect(() => {
220
- const _tgt = target && "current" in target ? target.current : target;
221
- if (!ro || !_tgt) return;
222
- let subscribed = !0;
223
- const handler = (...args) => {
224
- subscribed && cb.current(...args);
225
- };
226
- return ro.subscribe(_tgt, handler), () => {
227
- subscribed = !1, ro.unsubscribe(_tgt, handler);
228
- };
229
- }, [tgt, ro]);
255
+ let ro = enabled && getResizeObserver(), cb = useRef(callback);
256
+ useEffect(() => {
257
+ cb.current = callback;
258
+ }, [callback]), useEffect(() => {
259
+ let _tgt = target && "current" in target ? target.current : target;
260
+ if (!ro || !_tgt) return;
261
+ let subscribed = !0, handler = (...args) => {
262
+ /* istanbul ignore else */
263
+ subscribed && cb.current(...args);
264
+ };
265
+ return ro.subscribe(_tgt, handler), () => {
266
+ subscribed = !1, ro.unsubscribe(_tgt, handler);
267
+ };
268
+ }, [target && "current" in target ? target.current : target, ro]);
230
269
  }
231
270
  const imageStyle = {
232
- width: "100%",
233
- height: "auto"
271
+ width: "100%",
272
+ height: "auto"
234
273
  }, VALID_ROOT_PATHS = ["document", "parent"];
235
274
  function ImageHotspotArray(props) {
236
- const $ = c(49), {
237
- value,
238
- onChange,
239
- imageHotspotOptions,
240
- schemaType,
241
- renderPreview
242
- } = props;
243
- let t0;
244
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
245
- apiVersion: "2022-01-01"
246
- }, $[0] = t0) : t0 = $[0];
247
- const sanityClient = useClient(t0), pathRoot = VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot ?? "") ? imageHotspotOptions.pathRoot : "document";
248
- let t1;
249
- $[1] !== pathRoot || $[2] !== props.path ? (t1 = pathRoot === "document" ? [] : props.path.slice(0, -1), $[1] = pathRoot, $[2] = props.path, $[3] = t1) : t1 = $[3];
250
- const rootObject = useFormValue(t1), resolveInitialValueForType = useResolveInitialValueForType();
251
- let t2;
252
- $[4] !== resolveInitialValueForType ? (t2 = async (type) => resolveInitialValueForType(type, {}).then(_temp).catch(_temp2), $[4] = resolveInitialValueForType, $[5] = t2) : t2 = $[5];
253
- const resolveInitialValue = t2;
254
- let t3;
255
- $[6] !== imageHotspotOptions.imagePath || $[7] !== rootObject ? (t3 = imageHotspotOptions.imagePath ? get(rootObject, imageHotspotOptions.imagePath) : rootObject, $[6] = imageHotspotOptions.imagePath, $[7] = rootObject, $[8] = t3) : t3 = $[8];
256
- const hotspotImage = t3;
257
- let t4;
258
- if ($[9] !== hotspotImage || $[10] !== sanityClient) {
259
- bb0: {
260
- const builder = createImageUrlBuilder(sanityClient).dataset(sanityClient.config().dataset ?? ""), urlFor = (source) => builder.image(source);
261
- if (hotspotImage?.asset?._ref) {
262
- let t52;
263
- $[12] !== hotspotImage.asset._ref ? (t52 = getImageDimensions(hotspotImage.asset._ref), $[12] = hotspotImage.asset._ref, $[13] = t52) : t52 = $[13];
264
- const {
265
- aspectRatio
266
- } = t52;
267
- let t62;
268
- $[14] !== aspectRatio ? (t62 = Math.round(1200 / aspectRatio), $[14] = aspectRatio, $[15] = t62) : t62 = $[15];
269
- const height = t62, url = urlFor(hotspotImage).width(1200).url();
270
- let t72;
271
- $[16] !== height || $[17] !== url ? (t72 = {
272
- width: 1200,
273
- height,
274
- url
275
- }, $[16] = height, $[17] = url, $[18] = t72) : t72 = $[18], t4 = t72;
276
- break bb0;
277
- }
278
- t4 = null;
279
- }
280
- $[9] = hotspotImage, $[10] = sanityClient, $[11] = t4;
281
- } else
282
- t4 = $[11];
283
- const displayImage = t4;
284
- let t5;
285
- $[19] !== imageHotspotOptions.descriptionPath || $[20] !== onChange || $[21] !== resolveInitialValue || $[22] !== schemaType.of[0] ? (t5 = async (event) => {
286
- const spotType = schemaType.of[0];
287
- if (!spotType)
288
- return;
289
- const {
290
- nativeEvent,
291
- currentTarget
292
- } = event, x = Number((nativeEvent.offsetX * 100 / currentTarget.width).toFixed(2)), y = Number((nativeEvent.offsetY * 100 / currentTarget.height).toFixed(2)), description = `New Hotspot at ${x}% x ${y}%`, initialValues = await resolveInitialValue(spotType.type), newRow = {
293
- _key: randomKey(12),
294
- _type: spotType.name,
295
- ...initialValues,
296
- x,
297
- y
298
- };
299
- imageHotspotOptions?.descriptionPath && (newRow[imageHotspotOptions.descriptionPath] = description), onChange(PatchEvent.from([setIfMissing([]), insert([newRow], "after", [-1])]));
300
- }, $[19] = imageHotspotOptions.descriptionPath, $[20] = onChange, $[21] = resolveInitialValue, $[22] = schemaType.of[0], $[23] = t5) : t5 = $[23];
301
- const handleHotspotImageClick = t5;
302
- let t6;
303
- $[24] !== onChange ? (t6 = (key, x_0, y_0) => {
304
- onChange(PatchEvent.from([set(x_0, [{
305
- _key: key
306
- }, "x"]), set(y_0, [{
307
- _key: key
308
- }, "y"])]));
309
- }, $[24] = onChange, $[25] = t6) : t6 = $[25];
310
- const handleHotspotMove = t6, hotspotImageRef = useRef(null), [imageRect, setImageRect] = useState();
311
- let t7, t8;
312
- $[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t7 = (e) => setImageRect(e.contentRect), t8 = [setImageRect], $[26] = t7, $[27] = t8) : (t7 = $[26], t8 = $[27]), useResizeObserver(hotspotImageRef, useDebouncedCallback(t7, t8, 200));
313
- let t9;
314
- $[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = [2, 2, 3], $[28] = t9) : t9 = $[28];
315
- let t10;
316
- $[29] !== displayImage || $[30] !== handleHotspotImageClick || $[31] !== handleHotspotMove || $[32] !== imageHotspotOptions.descriptionPath || $[33] !== imageHotspotOptions.imagePath || $[34] !== imageHotspotOptions.tooltip || $[35] !== imageRect || $[36] !== renderPreview || $[37] !== schemaType.of[0] || $[38] !== value ? (t10 = displayImage?.url ? /* @__PURE__ */ jsxs("div", { style: {
317
- position: "relative"
318
- }, children: [
319
- imageRect && (value?.length ?? 0) > 0 && value?.map((spot, index) => /* @__PURE__ */ jsx(Spot, { index, value: spot, bounds: imageRect, update: handleHotspotMove, hotspotDescriptionPath: imageHotspotOptions?.descriptionPath, tooltip: imageHotspotOptions?.tooltip, renderPreview, schemaType: schemaType.of[0] }, spot._key)),
320
- /* @__PURE__ */ jsx(Card, { __unstable_checkered: !0, shadow: 1, children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: /* @__PURE__ */ jsx("img", { ref: hotspotImageRef, src: displayImage.url, width: displayImage.width, height: displayImage.height, alt: "", style: imageStyle, onClick: handleHotspotImageClick }) }) })
321
- ] }) : /* @__PURE__ */ jsx(Feedback, { children: imageHotspotOptions.imagePath ? /* @__PURE__ */ jsxs(Fragment, { children: [
322
- "No Hotspot image found at path ",
323
- /* @__PURE__ */ jsx("code", { children: imageHotspotOptions.imagePath })
324
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
325
- "Define a path in this field using to the image field in this document at",
326
- " ",
327
- /* @__PURE__ */ jsx("code", { children: "options.hotspotImagePath" })
328
- ] }) }), $[29] = displayImage, $[30] = handleHotspotImageClick, $[31] = handleHotspotMove, $[32] = imageHotspotOptions.descriptionPath, $[33] = imageHotspotOptions.imagePath, $[34] = imageHotspotOptions.tooltip, $[35] = imageRect, $[36] = renderPreview, $[37] = schemaType.of[0], $[38] = value, $[39] = t10) : t10 = $[39];
329
- let t11;
330
- $[40] !== imageHotspotOptions.pathRoot ? (t11 = imageHotspotOptions.pathRoot && !VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot) && /* @__PURE__ */ jsxs(Feedback, { children: [
331
- 'The supplied imageHotspotPathRoot "',
332
- imageHotspotOptions.pathRoot,
333
- '" is not valid, falling back to "document". Available values are "',
334
- VALID_ROOT_PATHS.join(", "),
335
- '".'
336
- ] }), $[40] = imageHotspotOptions.pathRoot, $[41] = t11) : t11 = $[41];
337
- const t12 = props;
338
- let t13;
339
- $[42] !== props.renderDefault || $[43] !== t12 ? (t13 = props.renderDefault(t12), $[42] = props.renderDefault, $[43] = t12, $[44] = t13) : t13 = $[44];
340
- let t14;
341
- return $[45] !== t10 || $[46] !== t11 || $[47] !== t13 ? (t14 = /* @__PURE__ */ jsxs(Stack, { gap: t9, children: [
342
- t10,
343
- t11,
344
- t13
345
- ] }), $[45] = t10, $[46] = t11, $[47] = t13, $[48] = t14) : t14 = $[48], t14;
346
- }
347
- function _temp2() {
275
+ let $ = c(49), { value, onChange, imageHotspotOptions, schemaType, renderPreview } = props, t0;
276
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "2022-01-01" }, $[0] = t0) : t0 = $[0];
277
+ let sanityClient = useClient(t0), pathRoot = VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot ?? "") ? imageHotspotOptions.pathRoot : "document", t1;
278
+ $[1] !== pathRoot || $[2] !== props.path ? (t1 = pathRoot === "document" ? [] : props.path.slice(0, -1), $[1] = pathRoot, $[2] = props.path, $[3] = t1) : t1 = $[3];
279
+ let rootObject = useFormValue(t1), resolveInitialValueForType = useResolveInitialValueForType(), t2;
280
+ $[4] === resolveInitialValueForType ? t2 = $[5] : (t2 = async (type) => resolveInitialValueForType(type, {}).then(_temp).catch(_temp2), $[4] = resolveInitialValueForType, $[5] = t2);
281
+ let resolveInitialValue = t2, t3;
282
+ $[6] !== imageHotspotOptions.imagePath || $[7] !== rootObject ? (t3 = imageHotspotOptions.imagePath ? get(rootObject, imageHotspotOptions.imagePath) : rootObject, $[6] = imageHotspotOptions.imagePath, $[7] = rootObject, $[8] = t3) : t3 = $[8];
283
+ let hotspotImage = t3, t4;
284
+ if ($[9] !== hotspotImage || $[10] !== sanityClient) {
285
+ bb0: {
286
+ let builder = createImageUrlBuilder(sanityClient).dataset(sanityClient.config().dataset ?? ""), urlFor = (source) => builder.image(source);
287
+ if (hotspotImage?.asset?._ref) {
288
+ let t5;
289
+ $[12] === hotspotImage.asset._ref ? t5 = $[13] : (t5 = getImageDimensions(hotspotImage.asset._ref), $[12] = hotspotImage.asset._ref, $[13] = t5);
290
+ let { aspectRatio } = t5, t6;
291
+ $[14] === aspectRatio ? t6 = $[15] : (t6 = Math.round(1200 / aspectRatio), $[14] = aspectRatio, $[15] = t6);
292
+ let height = t6, url = urlFor(hotspotImage).width(1200).url(), t7;
293
+ $[16] !== height || $[17] !== url ? (t7 = {
294
+ width: 1200,
295
+ height,
296
+ url
297
+ }, $[16] = height, $[17] = url, $[18] = t7) : t7 = $[18], t4 = t7;
298
+ break bb0;
299
+ }
300
+ t4 = null;
301
+ }
302
+ $[9] = hotspotImage, $[10] = sanityClient, $[11] = t4;
303
+ } else t4 = $[11];
304
+ let displayImage = t4, t5;
305
+ $[19] !== imageHotspotOptions.descriptionPath || $[20] !== onChange || $[21] !== resolveInitialValue || $[22] !== schemaType.of[0] ? (t5 = async (event) => {
306
+ let spotType = schemaType.of[0];
307
+ if (!spotType) return;
308
+ let { nativeEvent, currentTarget } = event, x = Number((nativeEvent.offsetX * 100 / currentTarget.width).toFixed(2)), y = Number((nativeEvent.offsetY * 100 / currentTarget.height).toFixed(2)), description = `New Hotspot at ${x}% x ${y}%`, initialValues = await resolveInitialValue(spotType.type), newRow = {
309
+ _key: randomKey(12),
310
+ _type: spotType.name,
311
+ ...initialValues,
312
+ x,
313
+ y
314
+ };
315
+ imageHotspotOptions?.descriptionPath && (newRow[imageHotspotOptions.descriptionPath] = description), onChange(PatchEvent.from([setIfMissing([]), insert([newRow], "after", [-1])]));
316
+ }, $[19] = imageHotspotOptions.descriptionPath, $[20] = onChange, $[21] = resolveInitialValue, $[22] = schemaType.of[0], $[23] = t5) : t5 = $[23];
317
+ let handleHotspotImageClick = t5, t6;
318
+ $[24] === onChange ? t6 = $[25] : (t6 = (key, x_0, y_0) => {
319
+ onChange(PatchEvent.from([set(x_0, [{ _key: key }, "x"]), set(y_0, [{ _key: key }, "y"])]));
320
+ }, $[24] = onChange, $[25] = t6);
321
+ let handleHotspotMove = t6, hotspotImageRef = useRef(null), [imageRect, setImageRect] = useState(), t7, t8;
322
+ $[26] === Symbol.for("react.memo_cache_sentinel") ? (t7 = (e) => setImageRect(e.contentRect), t8 = [setImageRect], $[26] = t7, $[27] = t8) : (t7 = $[26], t8 = $[27]), useResizeObserver(hotspotImageRef, useDebouncedCallback(t7, t8, 200));
323
+ let t9;
324
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t9 = [
325
+ 2,
326
+ 2,
327
+ 3
328
+ ], $[28] = t9) : t9 = $[28];
329
+ let t10;
330
+ $[29] !== displayImage || $[30] !== handleHotspotImageClick || $[31] !== handleHotspotMove || $[32] !== imageHotspotOptions.descriptionPath || $[33] !== imageHotspotOptions.imagePath || $[34] !== imageHotspotOptions.tooltip || $[35] !== imageRect || $[36] !== renderPreview || $[37] !== schemaType.of[0] || $[38] !== value ? (t10 = displayImage?.url ? /* @__PURE__ */ jsxs("div", {
331
+ style: { position: "relative" },
332
+ children: [imageRect && (value?.length ?? 0) > 0 && value?.map((spot, index) => /* @__PURE__ */ jsx(Spot, {
333
+ index,
334
+ value: spot,
335
+ bounds: imageRect,
336
+ update: handleHotspotMove,
337
+ hotspotDescriptionPath: imageHotspotOptions?.descriptionPath,
338
+ tooltip: imageHotspotOptions?.tooltip,
339
+ renderPreview,
340
+ schemaType: schemaType.of[0]
341
+ }, spot._key)), /* @__PURE__ */ jsx(Card, {
342
+ __unstable_checkered: !0,
343
+ shadow: 1,
344
+ children: /* @__PURE__ */ jsx(Flex, {
345
+ align: "center",
346
+ justify: "center",
347
+ children: /* @__PURE__ */ jsx("img", {
348
+ ref: hotspotImageRef,
349
+ src: displayImage.url,
350
+ width: displayImage.width,
351
+ height: displayImage.height,
352
+ alt: "",
353
+ style: imageStyle,
354
+ onClick: handleHotspotImageClick
355
+ })
356
+ })
357
+ })]
358
+ }) : /* @__PURE__ */ jsx(Feedback, { children: imageHotspotOptions.imagePath ? /* @__PURE__ */ jsxs(Fragment, { children: ["No Hotspot image found at path ", /* @__PURE__ */ jsx("code", { children: imageHotspotOptions.imagePath })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
359
+ "Define a path in this field using to the image field in this document at",
360
+ " ",
361
+ /* @__PURE__ */ jsx("code", { children: "options.hotspotImagePath" })
362
+ ] }) }), $[29] = displayImage, $[30] = handleHotspotImageClick, $[31] = handleHotspotMove, $[32] = imageHotspotOptions.descriptionPath, $[33] = imageHotspotOptions.imagePath, $[34] = imageHotspotOptions.tooltip, $[35] = imageRect, $[36] = renderPreview, $[37] = schemaType.of[0], $[38] = value, $[39] = t10) : t10 = $[39];
363
+ let t11;
364
+ $[40] === imageHotspotOptions.pathRoot ? t11 = $[41] : (t11 = imageHotspotOptions.pathRoot && !VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot) && /* @__PURE__ */ jsxs(Feedback, { children: [
365
+ "The supplied imageHotspotPathRoot \"",
366
+ imageHotspotOptions.pathRoot,
367
+ "\" is not valid, falling back to \"document\". Available values are \"",
368
+ VALID_ROOT_PATHS.join(", "),
369
+ "\"."
370
+ ] }), $[40] = imageHotspotOptions.pathRoot, $[41] = t11);
371
+ let t12 = props, t13;
372
+ $[42] !== props.renderDefault || $[43] !== t12 ? (t13 = props.renderDefault(t12), $[42] = props.renderDefault, $[43] = t12, $[44] = t13) : t13 = $[44];
373
+ let t14;
374
+ return $[45] !== t10 || $[46] !== t11 || $[47] !== t13 ? (t14 = /* @__PURE__ */ jsxs(Stack, {
375
+ gap: t9,
376
+ children: [
377
+ t10,
378
+ t11,
379
+ t13
380
+ ]
381
+ }), $[45] = t10, $[46] = t11, $[47] = t13, $[48] = t14) : t14 = $[48], t14;
348
382
  }
383
+ function _temp2() {}
349
384
  function _temp(initialValue) {
350
- return initialValue;
385
+ return initialValue;
351
386
  }
352
- const imageHotspotArrayPlugin = definePlugin({
353
- name: "image-hotspot-array",
354
- form: {
355
- components: {
356
- input: (props) => {
357
- if (props.schemaType.jsonType === "array" && props.schemaType.options?.imageHotspot) {
358
- const imageHotspotOptions = props.schemaType.options?.imageHotspot;
359
- if (imageHotspotOptions)
360
- return /* @__PURE__ */ jsx(
361
- ImageHotspotArray,
362
- {
363
- ...props,
364
- imageHotspotOptions
365
- }
366
- );
367
- }
368
- return props.renderDefault(props);
369
- }
370
- }
371
- }
372
- });
373
- export {
374
- ImageHotspotArray,
375
- imageHotspotArrayPlugin
376
- };
377
- //# sourceMappingURL=index.js.map
387
+ export { ImageHotspotArray, imageHotspotArrayPlugin };
388
+
389
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Feedback.tsx","../src/Spot.tsx","../src/useDebouncedCallback.ts","../src/useResizeObserver.ts","../src/ImageHotspotArray.tsx","../src/plugin.tsx"],"sourcesContent":["import {Card, Text} from '@sanity/ui'\n\nexport default function Feedback({children}: {children: React.ReactNode}): React.JSX.Element {\n return (\n <Card padding={4} radius={2} shadow={1} tone=\"caution\">\n <Text>{children}</Text>\n </Card>\n )\n}\n","import {Box, Text, Tooltip} from '@sanity/ui'\nimport get from 'lodash-es/get.js'\nimport {motion, useMotionValue} from 'motion/react'\nimport {\n type ComponentType,\n type CSSProperties,\n type ReactNode,\n useCallback,\n useEffect,\n useState,\n} from 'react'\nimport {type ObjectSchemaType, type RenderPreviewCallback} from 'sanity'\n\nimport {type FnHotspotMove, type HotspotItem} from './ImageHotspotArray'\n\nconst dragStyle: CSSProperties = {\n width: '1.4rem',\n height: '1.4rem',\n position: 'absolute',\n boxSizing: 'border-box',\n top: 0,\n left: 0,\n margin: '-0.7rem 0 0 -0.7rem',\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: '50%',\n background: '#000',\n color: 'white',\n}\n\nconst dragStyleWhileDrag: CSSProperties = {\n background: 'rgba(0, 0, 0, 0.1)',\n border: '1px solid #fff',\n cursor: 'none',\n}\n\nconst dragStyleWhileHover: CSSProperties = {\n background: 'rgba(0, 0, 0, 0.1)',\n border: '1px solid #fff',\n}\n\nconst dotStyle: CSSProperties = {\n position: 'absolute',\n left: '50%',\n top: '50%',\n height: '0.2rem',\n width: '0.2rem',\n margin: '-0.1rem 0 0 -0.1rem',\n background: '#fff',\n visibility: 'hidden',\n borderRadius: '50%',\n // make sure pointer events only run on the parent\n pointerEvents: 'none',\n}\n\nconst dotStyleWhileActive: CSSProperties = {\n visibility: 'visible',\n}\n\nconst labelStyle: CSSProperties = {\n color: 'white',\n fontSize: '0.7rem',\n fontWeight: 600,\n lineHeight: '1',\n}\n\nconst labelStyleWhileActive: CSSProperties = {\n visibility: 'hidden',\n}\n\nconst round = (num: number) => Math.round(num * 100) / 100\n\nexport interface HotspotTooltipProps<HotspotFields = {[key: string]: unknown}> {\n value: HotspotItem<HotspotFields>\n schemaType: ObjectSchemaType\n renderPreview: RenderPreviewCallback\n}\n\ninterface HotspotProps<HotspotFields = {[key: string]: unknown}> {\n value: HotspotItem\n bounds: DOMRectReadOnly\n update: FnHotspotMove\n hotspotDescriptionPath?: string\n tooltip?: ComponentType<HotspotTooltipProps<HotspotFields>>\n index: number\n schemaType: ObjectSchemaType\n renderPreview: RenderPreviewCallback\n}\n\nexport default function Spot({\n value,\n bounds,\n update,\n hotspotDescriptionPath,\n tooltip: TooltipComponent,\n index,\n schemaType,\n renderPreview,\n}: HotspotProps): ReactNode {\n const [isDragging, setIsDragging] = useState(false)\n const [isHovering, setIsHovering] = useState(false)\n\n // x/y are stored as % but need to be converted to px\n const x = useMotionValue(round(bounds.width * (value.x / 100)))\n const y = useMotionValue(round(bounds.height * (value.y / 100)))\n\n /**\n * update x/y if the bounds change when resizing the window\n */\n useEffect(() => {\n x.set(round(bounds.width * (value.x / 100)))\n y.set(round(bounds.height * (value.y / 100)))\n }, [x, y, value, bounds])\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false)\n\n // get current values for x/y in px\n const currentX = x.get()\n const currentY = y.get()\n\n // Which we need to convert back to `%` to patch the document\n const newX = round((currentX * 100) / bounds.width)\n const newY = round((currentY * 100) / bounds.height)\n\n // Don't go below 0 or above 100\n const safeX = Math.max(0, Math.min(100, newX))\n const safeY = Math.max(0, Math.min(100, newY))\n\n update(value._key, safeX, safeY)\n }, [x, y, value, update, bounds])\n const handleDragStart = useCallback(() => setIsDragging(true), [])\n\n const handleHoverStart = useCallback(() => setIsHovering(true), [])\n const handleHoverEnd = useCallback(() => setIsHovering(false), [])\n\n if (!x || !y) {\n return null\n }\n\n return (\n <motion.div\n drag\n dragConstraints={bounds}\n dragElastic={0}\n dragMomentum={false}\n onDragEnd={handleDragEnd}\n onDragStart={handleDragStart}\n onHoverStart={handleHoverStart}\n onHoverEnd={handleHoverEnd}\n style={{\n ...dragStyle,\n x,\n y,\n ...(isDragging && {...dragStyleWhileDrag}),\n ...(isHovering && {...dragStyleWhileHover}),\n }}\n >\n <Tooltip\n key={value._key}\n disabled={isDragging}\n portal\n content={\n TooltipComponent && typeof TooltipComponent === 'function' ? (\n <TooltipComponent value={value} renderPreview={renderPreview} schemaType={schemaType} />\n ) : (\n <Box padding={2} style={{maxWidth: 200, pointerEvents: `none`}}>\n <Text textOverflow=\"ellipsis\">\n {hotspotDescriptionPath\n ? // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- the configured descriptionPath is expected to point to a string field\n (get(value, hotspotDescriptionPath) as string)\n : `${value.x}% x ${value.y}%`}\n </Text>\n </Box>\n )\n }\n >\n <div>\n {/* Dot */}\n <Box\n style={{\n ...dotStyle,\n ...((isDragging || isHovering) && {...dotStyleWhileActive}),\n }}\n />\n {/* Label */}\n <div\n style={{\n ...labelStyle,\n ...((isDragging || isHovering) && {...labelStyleWhileActive}),\n }}\n >\n {index + 1}\n </div>\n </div>\n </Tooltip>\n </motion.div>\n )\n}\n","// copied from react-hookz/web\n// https://github.com/react-hookz/web/blob/579a445fcc9f4f4bb5b9d5e670b2e57448b4ee50/src/useDebouncedCallback/index.ts\nimport {type DependencyList, useEffect, useMemo, useRef} from 'react'\n\n/**\n * Run effect only when component is unmounted.\n *\n * @param effect Effector to run on unmount\n */\nfunction useUnmountEffect(effect: CallableFunction): void {\n const effectRef = useRef(effect)\n useEffect(() => {\n effectRef.current = effect\n }, [effect])\n useEffect(() => () => effectRef.current(), [])\n}\n\nexport type DebouncedFunction<Fn extends (...args: any[]) => any> = (\n this: ThisParameterType<Fn>,\n ...args: Parameters<Fn>\n) => void\n\n/**\n * Makes passed function debounced, otherwise acts like `useCallback`.\n *\n * @param callback Function that will be debounced.\n * @param deps Dependencies list when to update callback. It also replaces invoked\n * \tcallback for scheduled debounced invocations.\n * @param delay Debounce delay.\n * @param maxWait The maximum time `callback` is allowed to be delayed before\n * it's invoked. 0 means no max wait.\n */\nexport function useDebouncedCallback<Fn extends (...args: any[]) => any>(\n callback: Fn,\n deps: DependencyList,\n delay: number,\n maxWait = 0,\n): DebouncedFunction<Fn> {\n const timeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const waitTimeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const cb = useRef(callback)\n const lastCall = useRef<{args: Parameters<Fn>; this: ThisParameterType<Fn>}>(undefined)\n\n const clear = () => {\n if (timeout.current) {\n clearTimeout(timeout.current)\n timeout.current = undefined\n }\n\n if (waitTimeout.current) {\n clearTimeout(waitTimeout.current)\n waitTimeout.current = undefined\n }\n }\n\n // Cancel scheduled execution on unmount\n useUnmountEffect(clear)\n\n useEffect(() => {\n cb.current = callback\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps)\n\n // oxlint-disable react/react-compiler\n return useMemo(() => {\n const execute = () => {\n clear()\n\n // Barely possible to test this line\n /* istanbul ignore next */\n if (!lastCall.current) return\n\n const context = lastCall.current\n lastCall.current = undefined\n\n cb.current.apply(context.this, context.args)\n }\n\n const wrapped = function (this, ...args) {\n if (timeout.current) {\n clearTimeout(timeout.current)\n }\n\n lastCall.current = {args, this: this}\n\n // Plan regular execution\n timeout.current = setTimeout(execute, delay)\n\n // Plan maxWait execution if required\n if (maxWait > 0 && !waitTimeout.current) {\n waitTimeout.current = setTimeout(execute, maxWait)\n }\n } as DebouncedFunction<Fn>\n\n Object.defineProperties(wrapped, {\n length: {value: callback.length},\n name: {value: `${callback.name || 'anonymous'}__debounced__${delay}`},\n })\n\n return wrapped\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [delay, maxWait, ...deps])\n // oxlint-enable react/react-compiler\n}\n","// copied from react-hookz/web\n// https://github.com/react-hookz/web/blob/579a445fcc9f4f4bb5b9d5e670b2e57448b4ee50/src/useResizeObserver/index.ts\nimport {type RefObject, useEffect, useRef} from 'react'\n\nconst isBrowser =\n typeof window !== 'undefined' &&\n typeof navigator !== 'undefined' &&\n typeof document !== 'undefined'\n\nexport type UseResizeObserverCallback = (entry: ResizeObserverEntry) => void\n\ntype ResizeObserverSingleton = {\n observer: ResizeObserver\n subscribe: (target: Element, callback: UseResizeObserverCallback) => void\n unsubscribe: (target: Element, callback: UseResizeObserverCallback) => void\n}\n\nlet observerSingleton: ResizeObserverSingleton\n\nfunction getResizeObserver(): ResizeObserverSingleton | undefined {\n if (!isBrowser) return undefined\n\n if (observerSingleton) return observerSingleton\n\n const callbacks = new Map<Element, Set<UseResizeObserverCallback>>()\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries)\n callbacks.get(entry.target)?.forEach((cb) =>\n setTimeout(() => {\n cb(entry)\n }, 0),\n )\n })\n\n observerSingleton = {\n observer,\n subscribe(target, callback) {\n let cbs = callbacks.get(target)\n\n if (!cbs) {\n // If target has no observers yet - register it\n cbs = new Set<UseResizeObserverCallback>()\n callbacks.set(target, cbs)\n observer.observe(target)\n }\n\n // As Set is duplicate-safe - simply add callback on each call\n cbs.add(callback)\n },\n unsubscribe(target, callback) {\n const cbs = callbacks.get(target)\n\n // Else branch should never occur in case of normal execution\n // because callbacks map is hidden in closure - it is impossible to\n // simulate situation with non-existent `cbs` Set\n /* istanbul ignore else */\n if (cbs) {\n // Remove current observer\n cbs.delete(callback)\n\n if (cbs.size === 0) {\n // If no observers left unregister target completely\n callbacks.delete(target)\n observer.unobserve(target)\n }\n }\n },\n }\n\n return observerSingleton\n}\n\n/**\n * Invokes a callback whenever ResizeObserver detects a change to target's size.\n *\n * @param target React reference or Element to track.\n * @param callback Callback that will be invoked on resize.\n * @param enabled Whether resize observer is enabled or not.\n */\nexport function useResizeObserver<T extends Element>(\n target: RefObject<T | null>,\n callback: UseResizeObserverCallback,\n enabled = true,\n): void {\n const ro = enabled && getResizeObserver()\n const cb = useRef(callback)\n useEffect(() => {\n cb.current = callback\n }, [callback])\n\n const tgt = target && 'current' in target ? target.current : target\n\n useEffect(() => {\n // This secondary target resolve required for case when we receive ref object, which, most\n // likely, contains null during render stage, but already populated with element during\n // effect stage.\n\n const _tgt = target && 'current' in target ? target.current : target\n\n if (!ro || !_tgt) return undefined\n\n // As unsubscription in internals of our ResizeObserver abstraction can\n // happen a bit later than effect cleanup invocation - we need a marker,\n // that this handler should not be invoked anymore\n let subscribed = true\n\n const handler: UseResizeObserverCallback = (...args) => {\n // It is reinsurance for the highly asynchronous invocations, almost\n // impossible to achieve in tests, thus excluding from LOC\n /* istanbul ignore else */\n if (subscribed) {\n cb.current(...args)\n }\n }\n\n ro.subscribe(_tgt, handler)\n\n return () => {\n subscribed = false\n ro.unsubscribe(_tgt, handler)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tgt, ro])\n}\n","import {getImageDimensions} from '@sanity/asset-utils'\nimport {createImageUrlBuilder} from '@sanity/image-url'\nimport {Card, Flex, Stack} from '@sanity/ui'\nimport {randomKey} from '@sanity/util/content'\nimport get from 'lodash-es/get.js'\nimport {type MouseEvent, type ReactNode, useCallback, useMemo, useRef, useState} from 'react'\nimport {\n type ArrayOfObjectsInputProps,\n type ImageValue,\n insert,\n type ObjectSchemaType,\n PatchEvent,\n set,\n setIfMissing,\n useClient,\n useFormValue,\n useResolveInitialValueForType,\n} from 'sanity'\n\nimport Feedback from './Feedback'\nimport {type ImageHotspotOptions} from './plugin'\nimport Spot from './Spot'\nimport {useDebouncedCallback} from './useDebouncedCallback'\nimport {useResizeObserver} from './useResizeObserver'\n\nconst imageStyle = {width: `100%`, height: `auto`}\n\nconst VALID_ROOT_PATHS = ['document', 'parent']\n\nexport type FnHotspotMove = (key: string, x: number, y: number) => void\n\nexport type HotspotItem<HotspotFields = {[key: string]: unknown}> = {\n _key: string\n _type: string\n x: number\n y: number\n} & HotspotFields\n\nexport function ImageHotspotArray(\n props: ArrayOfObjectsInputProps<HotspotItem> & {imageHotspotOptions: ImageHotspotOptions},\n): ReactNode {\n const {value, onChange, imageHotspotOptions, schemaType, renderPreview} = props\n\n const sanityClient = useClient({apiVersion: '2022-01-01'})\n\n const imageHotspotPathRoot = useMemo(() => {\n const pathRoot = VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot ?? '')\n ? imageHotspotOptions.pathRoot\n : 'document'\n return pathRoot === 'document' ? [] : props.path.slice(0, -1)\n }, [imageHotspotOptions.pathRoot, props.path])\n\n const rootObject = useFormValue(imageHotspotPathRoot)\n\n const resolveInitialValueForType = useResolveInitialValueForType()\n const resolveInitialValue = useCallback(\n async (type: ObjectSchemaType) => {\n return resolveInitialValueForType(type, {})\n .then((initialValue) => {\n return initialValue\n })\n .catch(() => {\n return undefined\n })\n },\n [resolveInitialValueForType],\n )\n\n /**\n * Finding the image from the imageHotspotPathRoot (defaults to document),\n * using the path from the hotspot's `options` field\n *\n * when changes in imageHotspotPathRoot (e.g. document) occur,\n * check if there are any changes to the hotspotImage and update the reference\n */\n const hotspotImage = useMemo(() => {\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- the configured imagePath is expected to point to an image field\n return (\n imageHotspotOptions.imagePath ? get(rootObject, imageHotspotOptions.imagePath) : rootObject\n ) as ImageValue | undefined\n }, [rootObject, imageHotspotOptions.imagePath])\n\n const displayImage = useMemo(() => {\n const builder = createImageUrlBuilder(sanityClient).dataset(sanityClient.config().dataset ?? '')\n const urlFor = (source: ImageValue) => builder.image(source)\n\n if (hotspotImage?.asset?._ref) {\n const {aspectRatio} = getImageDimensions(hotspotImage.asset._ref)\n const width = 1200\n const height = Math.round(width / aspectRatio)\n const url = urlFor(hotspotImage).width(width).url()\n\n return {width, height, url}\n }\n\n return null\n }, [hotspotImage, sanityClient])\n\n const handleHotspotImageClick = useCallback(\n async (event: MouseEvent<HTMLImageElement>) => {\n const spotType = schemaType.of[0]\n if (!spotType) {\n return\n }\n\n const {nativeEvent, currentTarget} = event\n\n // Calculate the x/y percentage of the click position\n const x = Number(((nativeEvent.offsetX * 100) / currentTarget.width).toFixed(2))\n const y = Number(((nativeEvent.offsetY * 100) / currentTarget.height).toFixed(2))\n const description = `New Hotspot at ${x}% x ${y}%`\n\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- hotspot arrays contain a single object type\n const initialValues = await resolveInitialValue(spotType.type as ObjectSchemaType)\n\n const newRow: HotspotItem = {\n _key: randomKey(12),\n _type: spotType.name,\n ...initialValues,\n x,\n y,\n }\n\n if (imageHotspotOptions?.descriptionPath) {\n newRow[imageHotspotOptions.descriptionPath] = description\n }\n\n onChange(PatchEvent.from([setIfMissing([]), insert([newRow], 'after', [-1])]))\n },\n [imageHotspotOptions, onChange, resolveInitialValue, schemaType],\n )\n\n const handleHotspotMove: FnHotspotMove = useCallback(\n (key, x, y) => {\n onChange(\n PatchEvent.from([\n // Set the `x` value of this array key item\n set(x, [{_key: key}, 'x']),\n // Set the `y` value of this array key item\n set(y, [{_key: key}, 'y']),\n ]),\n )\n },\n [onChange],\n )\n\n const hotspotImageRef = useRef<HTMLImageElement | null>(null)\n\n const [imageRect, setImageRect] = useState<DOMRectReadOnly>()\n\n useResizeObserver<HTMLImageElement>(\n hotspotImageRef,\n useDebouncedCallback(\n (e: ResizeObserverEntry) => setImageRect(e.contentRect),\n [setImageRect],\n 200,\n ),\n )\n\n return (\n <Stack gap={[2, 2, 3]}>\n {displayImage?.url ? (\n <div style={{position: `relative`}}>\n {imageRect &&\n (value?.length ?? 0) > 0 &&\n value?.map((spot, index) => (\n <Spot\n index={index}\n key={spot._key}\n value={spot}\n bounds={imageRect}\n update={handleHotspotMove}\n hotspotDescriptionPath={imageHotspotOptions?.descriptionPath}\n tooltip={imageHotspotOptions?.tooltip}\n renderPreview={renderPreview}\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- hotspot arrays contain a single object type\n schemaType={schemaType.of[0] as ObjectSchemaType}\n />\n ))}\n\n <Card __unstable_checkered shadow={1}>\n <Flex align=\"center\" justify=\"center\">\n {/* oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- hotspots are placed via pointer coordinates, which have no keyboard equivalent */}\n <img\n ref={hotspotImageRef}\n src={displayImage.url}\n width={displayImage.width}\n height={displayImage.height}\n alt=\"\"\n style={imageStyle}\n onClick={handleHotspotImageClick}\n />\n </Flex>\n </Card>\n </div>\n ) : (\n <Feedback>\n {imageHotspotOptions.imagePath ? (\n <>\n No Hotspot image found at path <code>{imageHotspotOptions.imagePath}</code>\n </>\n ) : (\n <>\n Define a path in this field using to the image field in this document at{' '}\n <code>options.hotspotImagePath</code>\n </>\n )}\n </Feedback>\n )}\n {imageHotspotOptions.pathRoot && !VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot) && (\n <Feedback>\n The supplied imageHotspotPathRoot &quot;{imageHotspotOptions.pathRoot}&quot; is not valid,\n falling back to &quot;document&quot;. Available values are &quot;\n {VALID_ROOT_PATHS.join(', ')}&quot;.\n </Feedback>\n )}\n {/* oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- renderDefault expects the base input props */}\n {props.renderDefault(props as unknown as ArrayOfObjectsInputProps)}\n </Stack>\n )\n}\n","import {type ComponentType} from 'react'\nimport {type ArrayOfObjectsInputProps, definePlugin} from 'sanity'\n\nimport {type HotspotItem, ImageHotspotArray} from './ImageHotspotArray'\nimport {type HotspotTooltipProps} from './Spot'\n\nexport interface ImageHotspotOptions<HotspotFields = {[key: string]: unknown}> {\n pathRoot?: 'document' | 'parent'\n imagePath: string\n descriptionPath?: string\n tooltip?: ComponentType<HotspotTooltipProps<HotspotFields>>\n}\n\ndeclare module 'sanity' {\n export interface ArrayOptions {\n imageHotspot?: ImageHotspotOptions\n }\n}\n\nexport const imageHotspotArrayPlugin = definePlugin({\n name: 'image-hotspot-array',\n form: {\n components: {\n input: (props) => {\n if (props.schemaType.jsonType === 'array' && props.schemaType.options?.imageHotspot) {\n const imageHotspotOptions = props.schemaType.options?.imageHotspot\n if (imageHotspotOptions) {\n return (\n <ImageHotspotArray\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- narrowed by the jsonType/options checks above\n {...(props as unknown as ArrayOfObjectsInputProps<HotspotItem>)}\n imageHotspotOptions={imageHotspotOptions}\n />\n )\n }\n }\n return props.renderDefault(props)\n },\n },\n },\n})\n"],"names":["Feedback","t0","$","_c","children","t1","dragStyle","width","height","position","boxSizing","top","left","margin","cursor","display","justifyContent","alignItems","borderRadius","background","color","dragStyleWhileDrag","border","dragStyleWhileHover","dotStyle","visibility","pointerEvents","dotStyleWhileActive","labelStyle","fontSize","fontWeight","lineHeight","labelStyleWhileActive","round","num","Math","Spot","value","bounds","update","hotspotDescriptionPath","tooltip","TooltipComponent","index","schemaType","renderPreview","isDragging","setIsDragging","useState","isHovering","setIsHovering","x","t2","useMotionValue","t3","y","t4","t5","set","t6","useEffect","t7","_key","currentX","get","currentY","newX","newY","safeX","max","min","safeY","handleDragEnd","t8","for","handleDragStart","t9","handleHoverStart","t10","handleHoverEnd","t11","t12","t13","t14","maxWidth","t15","t16","t17","t18","t19","t20","t21","t22","t23","useUnmountEffect","effect","effectRef","useRef","current","Symbol","useDebouncedCallback","callback","deps","delay","maxWait","timeout","undefined","waitTimeout","cb","lastCall","clear","clearTimeout","useMemo","execute","context","apply","this","args","wrapped","setTimeout","Object","defineProperties","length","name","isBrowser","window","navigator","document","observerSingleton","getResizeObserver","callbacks","Map","observer","ResizeObserver","entries","entry","target","forEach","subscribe","cbs","Set","observe","add","unsubscribe","delete","size","unobserve","useResizeObserver","enabled","ro","tgt","_tgt","subscribed","handler","imageStyle","VALID_ROOT_PATHS","ImageHotspotArray","props","onChange","imageHotspotOptions","apiVersion","sanityClient","useClient","pathRoot","includes","path","slice","rootObject","useFormValue","resolveInitialValueForType","useResolveInitialValueForType","type","then","_temp","catch","_temp2","resolveInitialValue","imagePath","hotspotImage","bb0","builder","createImageUrlBuilder","dataset","config","urlFor","source","image","asset","_ref","getImageDimensions","aspectRatio","url","displayImage","descriptionPath","of","event","spotType","nativeEvent","currentTarget","Number","offsetX","toFixed","offsetY","description","initialValues","newRow","randomKey","_type","PatchEvent","from","setIfMissing","insert","handleHotspotImageClick","key","x_0","y_0","handleHotspotMove","hotspotImageRef","imageRect","setImageRect","e","contentRect","map","spot","join","renderDefault","initialValue","imageHotspotArrayPlugin","definePlugin","form","components","input","jsonType","options","imageHotspot"],"mappings":";;;;;;;;;;AAEA,SAAeA,SAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAkB;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAAuC,MAAAI;AAAA,SAAAH,SAAAE,YAEpEC,KAAA,oBAAC,MAAA,EAAc,SAAA,GAAW,QAAA,GAAW,QAAA,GAAQ,MAAA,WAC3C,UAAA,oBAAC,MAAA,EAAMD,SAAAA,CAAS,EAAA,CAClB,GAAOF,OAAAE,UAAAF,OAAAG,MAAAA,KAAAH,EAAA,CAAA,GAFPG;AAEO;ACSX,MAAMC,YAA2B;AAAA,EAC/BC,OAAO;AAAA,EACPC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,WAAW;AAAA,EACXC,KAAK;AAAA,EACLC,MAAM;AAAA,EACNC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,SAAS;AAAA,EACTC,gBAAgB;AAAA,EAChBC,YAAY;AAAA,EACZC,cAAc;AAAA,EACdC,YAAY;AAAA,EACZC,OAAO;AACT,GAEMC,qBAAoC;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AAMC,0BAA0BC,aAAa;AAAA,EAClDzG,MAAM;AAAA,EACN0G,MAAM;AAAA,IACJC,YAAY;AAAA,MACVC,OAAQ1E,CAAAA,UAAU;AAChB,YAAIA,MAAMjH,WAAW4L,aAAa,WAAW3E,MAAMjH,WAAW6L,SAASC,cAAc;AACnF,gBAAM3E,sBAAsBF,MAAMjH,WAAW6L,SAASC;AACtD,cAAI3E;AACF,mBACE;AAAA,cAAC;AAAA,cAAA;AAAA,gBAEC,GAAKF;AAAAA,gBACL;AAAA,cAAA;AAAA,YAAA;AAAA,QAIR;AACA,eAAOA,MAAMoE,cAAcpE,KAAK;AAAA,MAClC;AAAA,IAAA;AAAA,EACF;AAEJ,CAAC;"}
1
+ {"version":3,"file":"index.js","names":["Card","Text","Feedback","t0","$","_c","children","t1","Box","Text","Tooltip","get","motion","useMotionValue","ComponentType","CSSProperties","ReactNode","useCallback","useEffect","useState","ObjectSchemaType","RenderPreviewCallback","FnHotspotMove","HotspotItem","dragStyle","width","height","position","boxSizing","top","left","margin","cursor","display","justifyContent","alignItems","borderRadius","background","color","dragStyleWhileDrag","border","dragStyleWhileHover","dotStyle","visibility","pointerEvents","dotStyleWhileActive","labelStyle","fontSize","fontWeight","lineHeight","labelStyleWhileActive","round","num","Math","HotspotTooltipProps","key","value","HotspotFields","schemaType","renderPreview","HotspotProps","bounds","DOMRectReadOnly","update","hotspotDescriptionPath","tooltip","index","Spot","t0","$","_c","TooltipComponent","isDragging","setIsDragging","isHovering","setIsHovering","t1","x","t2","t3","y","t4","t5","set","t6","t7","_key","currentX","currentY","newX","newY","safeX","max","min","safeY","handleDragEnd","t8","Symbol","for","handleDragStart","t9","handleHoverStart","t10","handleHoverEnd","t11","t12","t13","t14","maxWidth","t15","t16","t17","t18","t19","t20","t21","t22","t23","ComponentType","ArrayOfObjectsInputProps","definePlugin","HotspotItem","ImageHotspotArray","HotspotTooltipProps","ImageHotspotOptions","key","pathRoot","imagePath","descriptionPath","tooltip","HotspotFields","ArrayOptions","imageHotspot","imageHotspotArrayPlugin","name","form","components","input","props","schemaType","jsonType","options","imageHotspotOptions","renderDefault","DependencyList","useEffect","useMemo","useRef","useUnmountEffect","effect","$","_c","effectRef","t0","t1","current","t2","t3","Symbol","for","DebouncedFunction","args","this","ThisParameterType","Fn","Parameters","useDebouncedCallback","callback","deps","delay","maxWait","timeout","ReturnType","setTimeout","undefined","waitTimeout","cb","lastCall","clear","clearTimeout","execute","context","apply","wrapped","Object","defineProperties","length","value","name","RefObject","useEffect","useRef","isBrowser","window","navigator","document","UseResizeObserverCallback","entry","ResizeObserverEntry","ResizeObserverSingleton","observer","ResizeObserver","subscribe","target","Element","callback","unsubscribe","observerSingleton","getResizeObserver","undefined","callbacks","Map","Set","entries","get","forEach","cb","setTimeout","cbs","set","observe","add","delete","size","unobserve","useResizeObserver","T","enabled","ro","current","tgt","_tgt","subscribed","handler","args","getImageDimensions","createImageUrlBuilder","Card","Flex","Stack","randomKey","get","MouseEvent","ReactNode","useCallback","useMemo","useRef","useState","ArrayOfObjectsInputProps","ImageValue","insert","ObjectSchemaType","PatchEvent","set","setIfMissing","useClient","useFormValue","useResolveInitialValueForType","Feedback","ImageHotspotOptions","Spot","useDebouncedCallback","useResizeObserver","imageStyle","width","height","VALID_ROOT_PATHS","FnHotspotMove","key","x","y","HotspotItem","_key","_type","HotspotFields","ImageHotspotArray","props","$","_c","value","onChange","imageHotspotOptions","schemaType","renderPreview","t0","Symbol","for","apiVersion","sanityClient","pathRoot","includes","t1","path","slice","imageHotspotPathRoot","rootObject","resolveInitialValueForType","t2","type","then","_temp","catch","_temp2","resolveInitialValue","t3","imagePath","hotspotImage","t4","bb0","builder","dataset","config","urlFor","source","image","asset","_ref","t5","aspectRatio","t6","Math","round","url","t7","displayImage","descriptionPath","of","event","spotType","nativeEvent","currentTarget","Number","offsetX","toFixed","offsetY","description","initialValues","newRow","name","from","handleHotspotImageClick","x_0","y_0","handleHotspotMove","hotspotImageRef","imageRect","setImageRect","t8","e","contentRect","t9","t10","tooltip","position","length","map","spot","index","t11","join","t12","t13","renderDefault","t14","initialValue"],"sources":["../src/Feedback.tsx","../src/Spot.tsx","../src/plugin.tsx","../src/useDebouncedCallback.ts","../src/useResizeObserver.ts","../src/ImageHotspotArray.tsx"],"sourcesContent":["import {Card, Text} from '@sanity/ui'\n\nexport default function Feedback({children}: {children: React.ReactNode}): React.JSX.Element {\n return (\n <Card padding={4} radius={2} shadow={1} tone=\"caution\">\n <Text>{children}</Text>\n </Card>\n )\n}\n","import {Box, Text, Tooltip} from '@sanity/ui'\nimport get from 'lodash-es/get.js'\nimport {motion, useMotionValue} from 'motion/react'\nimport {\n type ComponentType,\n type CSSProperties,\n type ReactNode,\n useCallback,\n useEffect,\n useState,\n} from 'react'\nimport {type ObjectSchemaType, type RenderPreviewCallback} from 'sanity'\n\nimport {type FnHotspotMove, type HotspotItem} from './ImageHotspotArray'\n\nconst dragStyle: CSSProperties = {\n width: '1.4rem',\n height: '1.4rem',\n position: 'absolute',\n boxSizing: 'border-box',\n top: 0,\n left: 0,\n margin: '-0.7rem 0 0 -0.7rem',\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: '50%',\n background: '#000',\n color: 'white',\n}\n\nconst dragStyleWhileDrag: CSSProperties = {\n background: 'rgba(0, 0, 0, 0.1)',\n border: '1px solid #fff',\n cursor: 'none',\n}\n\nconst dragStyleWhileHover: CSSProperties = {\n background: 'rgba(0, 0, 0, 0.1)',\n border: '1px solid #fff',\n}\n\nconst dotStyle: CSSProperties = {\n position: 'absolute',\n left: '50%',\n top: '50%',\n height: '0.2rem',\n width: '0.2rem',\n margin: '-0.1rem 0 0 -0.1rem',\n background: '#fff',\n visibility: 'hidden',\n borderRadius: '50%',\n // make sure pointer events only run on the parent\n pointerEvents: 'none',\n}\n\nconst dotStyleWhileActive: CSSProperties = {\n visibility: 'visible',\n}\n\nconst labelStyle: CSSProperties = {\n color: 'white',\n fontSize: '0.7rem',\n fontWeight: 600,\n lineHeight: '1',\n}\n\nconst labelStyleWhileActive: CSSProperties = {\n visibility: 'hidden',\n}\n\nconst round = (num: number) => Math.round(num * 100) / 100\n\nexport interface HotspotTooltipProps<HotspotFields = {[key: string]: unknown}> {\n value: HotspotItem<HotspotFields>\n schemaType: ObjectSchemaType\n renderPreview: RenderPreviewCallback\n}\n\ninterface HotspotProps<HotspotFields = {[key: string]: unknown}> {\n value: HotspotItem\n bounds: DOMRectReadOnly\n update: FnHotspotMove\n hotspotDescriptionPath?: string\n tooltip?: ComponentType<HotspotTooltipProps<HotspotFields>>\n index: number\n schemaType: ObjectSchemaType\n renderPreview: RenderPreviewCallback\n}\n\nexport default function Spot({\n value,\n bounds,\n update,\n hotspotDescriptionPath,\n tooltip: TooltipComponent,\n index,\n schemaType,\n renderPreview,\n}: HotspotProps): ReactNode {\n const [isDragging, setIsDragging] = useState(false)\n const [isHovering, setIsHovering] = useState(false)\n\n // x/y are stored as % but need to be converted to px\n const x = useMotionValue(round(bounds.width * (value.x / 100)))\n const y = useMotionValue(round(bounds.height * (value.y / 100)))\n\n /**\n * update x/y if the bounds change when resizing the window\n */\n useEffect(() => {\n x.set(round(bounds.width * (value.x / 100)))\n y.set(round(bounds.height * (value.y / 100)))\n }, [x, y, value, bounds])\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false)\n\n // get current values for x/y in px\n const currentX = x.get()\n const currentY = y.get()\n\n // Which we need to convert back to `%` to patch the document\n const newX = round((currentX * 100) / bounds.width)\n const newY = round((currentY * 100) / bounds.height)\n\n // Don't go below 0 or above 100\n const safeX = Math.max(0, Math.min(100, newX))\n const safeY = Math.max(0, Math.min(100, newY))\n\n update(value._key, safeX, safeY)\n }, [x, y, value, update, bounds])\n const handleDragStart = useCallback(() => setIsDragging(true), [])\n\n const handleHoverStart = useCallback(() => setIsHovering(true), [])\n const handleHoverEnd = useCallback(() => setIsHovering(false), [])\n\n if (!x || !y) {\n return null\n }\n\n return (\n <motion.div\n drag\n dragConstraints={bounds}\n dragElastic={0}\n dragMomentum={false}\n onDragEnd={handleDragEnd}\n onDragStart={handleDragStart}\n onHoverStart={handleHoverStart}\n onHoverEnd={handleHoverEnd}\n style={{\n ...dragStyle,\n x,\n y,\n ...(isDragging && {...dragStyleWhileDrag}),\n ...(isHovering && {...dragStyleWhileHover}),\n }}\n >\n <Tooltip\n key={value._key}\n disabled={isDragging}\n portal\n content={\n TooltipComponent && typeof TooltipComponent === 'function' ? (\n <TooltipComponent value={value} renderPreview={renderPreview} schemaType={schemaType} />\n ) : (\n <Box padding={2} style={{maxWidth: 200, pointerEvents: `none`}}>\n <Text textOverflow=\"ellipsis\">\n {hotspotDescriptionPath\n ? // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- the configured descriptionPath is expected to point to a string field\n (get(value, hotspotDescriptionPath) as string)\n : `${value.x}% x ${value.y}%`}\n </Text>\n </Box>\n )\n }\n >\n <div>\n {/* Dot */}\n <Box\n style={{\n ...dotStyle,\n ...((isDragging || isHovering) && {...dotStyleWhileActive}),\n }}\n />\n {/* Label */}\n <div\n style={{\n ...labelStyle,\n ...((isDragging || isHovering) && {...labelStyleWhileActive}),\n }}\n >\n {index + 1}\n </div>\n </div>\n </Tooltip>\n </motion.div>\n )\n}\n","import {type ComponentType} from 'react'\nimport {type ArrayOfObjectsInputProps, definePlugin} from 'sanity'\n\nimport {type HotspotItem, ImageHotspotArray} from './ImageHotspotArray'\nimport {type HotspotTooltipProps} from './Spot'\n\nexport interface ImageHotspotOptions<HotspotFields = {[key: string]: unknown}> {\n pathRoot?: 'document' | 'parent'\n imagePath: string\n descriptionPath?: string\n tooltip?: ComponentType<HotspotTooltipProps<HotspotFields>>\n}\n\ndeclare module 'sanity' {\n export interface ArrayOptions {\n imageHotspot?: ImageHotspotOptions\n }\n}\n\nexport const imageHotspotArrayPlugin = definePlugin({\n name: 'image-hotspot-array',\n form: {\n components: {\n input: (props) => {\n if (props.schemaType.jsonType === 'array' && props.schemaType.options?.imageHotspot) {\n const imageHotspotOptions = props.schemaType.options?.imageHotspot\n if (imageHotspotOptions) {\n return (\n <ImageHotspotArray\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- narrowed by the jsonType/options checks above\n {...(props as unknown as ArrayOfObjectsInputProps<HotspotItem>)}\n imageHotspotOptions={imageHotspotOptions}\n />\n )\n }\n }\n return props.renderDefault(props)\n },\n },\n },\n})\n","// copied from react-hookz/web\n// https://github.com/react-hookz/web/blob/579a445fcc9f4f4bb5b9d5e670b2e57448b4ee50/src/useDebouncedCallback/index.ts\nimport {type DependencyList, useEffect, useMemo, useRef} from 'react'\n\n/**\n * Run effect only when component is unmounted.\n *\n * @param effect Effector to run on unmount\n */\nfunction useUnmountEffect(effect: CallableFunction): void {\n const effectRef = useRef(effect)\n useEffect(() => {\n effectRef.current = effect\n }, [effect])\n useEffect(() => () => effectRef.current(), [])\n}\n\nexport type DebouncedFunction<Fn extends (...args: any[]) => any> = (\n this: ThisParameterType<Fn>,\n ...args: Parameters<Fn>\n) => void\n\n/**\n * Makes passed function debounced, otherwise acts like `useCallback`.\n *\n * @param callback Function that will be debounced.\n * @param deps Dependencies list when to update callback. It also replaces invoked\n * \tcallback for scheduled debounced invocations.\n * @param delay Debounce delay.\n * @param maxWait The maximum time `callback` is allowed to be delayed before\n * it's invoked. 0 means no max wait.\n */\nexport function useDebouncedCallback<Fn extends (...args: any[]) => any>(\n callback: Fn,\n deps: DependencyList,\n delay: number,\n maxWait = 0,\n): DebouncedFunction<Fn> {\n const timeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const waitTimeout = useRef<ReturnType<typeof setTimeout>>(undefined)\n const cb = useRef(callback)\n const lastCall = useRef<{args: Parameters<Fn>; this: ThisParameterType<Fn>}>(undefined)\n\n const clear = () => {\n if (timeout.current) {\n clearTimeout(timeout.current)\n timeout.current = undefined\n }\n\n if (waitTimeout.current) {\n clearTimeout(waitTimeout.current)\n waitTimeout.current = undefined\n }\n }\n\n // Cancel scheduled execution on unmount\n useUnmountEffect(clear)\n\n useEffect(() => {\n cb.current = callback\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps)\n\n // oxlint-disable react/react-compiler\n return useMemo(() => {\n const execute = () => {\n clear()\n\n // Barely possible to test this line\n /* istanbul ignore next */\n if (!lastCall.current) return\n\n const context = lastCall.current\n lastCall.current = undefined\n\n cb.current.apply(context.this, context.args)\n }\n\n const wrapped = function (this, ...args) {\n if (timeout.current) {\n clearTimeout(timeout.current)\n }\n\n lastCall.current = {args, this: this}\n\n // Plan regular execution\n timeout.current = setTimeout(execute, delay)\n\n // Plan maxWait execution if required\n if (maxWait > 0 && !waitTimeout.current) {\n waitTimeout.current = setTimeout(execute, maxWait)\n }\n } as DebouncedFunction<Fn>\n\n Object.defineProperties(wrapped, {\n length: {value: callback.length},\n name: {value: `${callback.name || 'anonymous'}__debounced__${delay}`},\n })\n\n return wrapped\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [delay, maxWait, ...deps])\n // oxlint-enable react/react-compiler\n}\n","// copied from react-hookz/web\n// https://github.com/react-hookz/web/blob/579a445fcc9f4f4bb5b9d5e670b2e57448b4ee50/src/useResizeObserver/index.ts\nimport {type RefObject, useEffect, useRef} from 'react'\n\nconst isBrowser =\n typeof window !== 'undefined' &&\n typeof navigator !== 'undefined' &&\n typeof document !== 'undefined'\n\nexport type UseResizeObserverCallback = (entry: ResizeObserverEntry) => void\n\ntype ResizeObserverSingleton = {\n observer: ResizeObserver\n subscribe: (target: Element, callback: UseResizeObserverCallback) => void\n unsubscribe: (target: Element, callback: UseResizeObserverCallback) => void\n}\n\nlet observerSingleton: ResizeObserverSingleton\n\nfunction getResizeObserver(): ResizeObserverSingleton | undefined {\n if (!isBrowser) return undefined\n\n if (observerSingleton) return observerSingleton\n\n const callbacks = new Map<Element, Set<UseResizeObserverCallback>>()\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries)\n callbacks.get(entry.target)?.forEach((cb) =>\n setTimeout(() => {\n cb(entry)\n }, 0),\n )\n })\n\n observerSingleton = {\n observer,\n subscribe(target, callback) {\n let cbs = callbacks.get(target)\n\n if (!cbs) {\n // If target has no observers yet - register it\n cbs = new Set<UseResizeObserverCallback>()\n callbacks.set(target, cbs)\n observer.observe(target)\n }\n\n // As Set is duplicate-safe - simply add callback on each call\n cbs.add(callback)\n },\n unsubscribe(target, callback) {\n const cbs = callbacks.get(target)\n\n // Else branch should never occur in case of normal execution\n // because callbacks map is hidden in closure - it is impossible to\n // simulate situation with non-existent `cbs` Set\n /* istanbul ignore else */\n if (cbs) {\n // Remove current observer\n cbs.delete(callback)\n\n if (cbs.size === 0) {\n // If no observers left unregister target completely\n callbacks.delete(target)\n observer.unobserve(target)\n }\n }\n },\n }\n\n return observerSingleton\n}\n\n/**\n * Invokes a callback whenever ResizeObserver detects a change to target's size.\n *\n * @param target React reference or Element to track.\n * @param callback Callback that will be invoked on resize.\n * @param enabled Whether resize observer is enabled or not.\n */\nexport function useResizeObserver<T extends Element>(\n target: RefObject<T | null>,\n callback: UseResizeObserverCallback,\n enabled = true,\n): void {\n const ro = enabled && getResizeObserver()\n const cb = useRef(callback)\n useEffect(() => {\n cb.current = callback\n }, [callback])\n\n const tgt = target && 'current' in target ? target.current : target\n\n useEffect(() => {\n // This secondary target resolve required for case when we receive ref object, which, most\n // likely, contains null during render stage, but already populated with element during\n // effect stage.\n\n const _tgt = target && 'current' in target ? target.current : target\n\n if (!ro || !_tgt) return undefined\n\n // As unsubscription in internals of our ResizeObserver abstraction can\n // happen a bit later than effect cleanup invocation - we need a marker,\n // that this handler should not be invoked anymore\n let subscribed = true\n\n const handler: UseResizeObserverCallback = (...args) => {\n // It is reinsurance for the highly asynchronous invocations, almost\n // impossible to achieve in tests, thus excluding from LOC\n /* istanbul ignore else */\n if (subscribed) {\n cb.current(...args)\n }\n }\n\n ro.subscribe(_tgt, handler)\n\n return () => {\n subscribed = false\n ro.unsubscribe(_tgt, handler)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tgt, ro])\n}\n","import {getImageDimensions} from '@sanity/asset-utils'\nimport {createImageUrlBuilder} from '@sanity/image-url'\nimport {Card, Flex, Stack} from '@sanity/ui'\nimport {randomKey} from '@sanity/util/content'\nimport get from 'lodash-es/get.js'\nimport {type MouseEvent, type ReactNode, useCallback, useMemo, useRef, useState} from 'react'\nimport {\n type ArrayOfObjectsInputProps,\n type ImageValue,\n insert,\n type ObjectSchemaType,\n PatchEvent,\n set,\n setIfMissing,\n useClient,\n useFormValue,\n useResolveInitialValueForType,\n} from 'sanity'\n\nimport Feedback from './Feedback'\nimport {type ImageHotspotOptions} from './plugin'\nimport Spot from './Spot'\nimport {useDebouncedCallback} from './useDebouncedCallback'\nimport {useResizeObserver} from './useResizeObserver'\n\nconst imageStyle = {width: `100%`, height: `auto`}\n\nconst VALID_ROOT_PATHS = ['document', 'parent']\n\nexport type FnHotspotMove = (key: string, x: number, y: number) => void\n\nexport type HotspotItem<HotspotFields = {[key: string]: unknown}> = {\n _key: string\n _type: string\n x: number\n y: number\n} & HotspotFields\n\nexport function ImageHotspotArray(\n props: ArrayOfObjectsInputProps<HotspotItem> & {imageHotspotOptions: ImageHotspotOptions},\n): ReactNode {\n const {value, onChange, imageHotspotOptions, schemaType, renderPreview} = props\n\n const sanityClient = useClient({apiVersion: '2022-01-01'})\n\n const imageHotspotPathRoot = useMemo(() => {\n const pathRoot = VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot ?? '')\n ? imageHotspotOptions.pathRoot\n : 'document'\n return pathRoot === 'document' ? [] : props.path.slice(0, -1)\n }, [imageHotspotOptions.pathRoot, props.path])\n\n const rootObject = useFormValue(imageHotspotPathRoot)\n\n const resolveInitialValueForType = useResolveInitialValueForType()\n const resolveInitialValue = useCallback(\n async (type: ObjectSchemaType) => {\n return resolveInitialValueForType(type, {})\n .then((initialValue) => {\n return initialValue\n })\n .catch(() => {\n return undefined\n })\n },\n [resolveInitialValueForType],\n )\n\n /**\n * Finding the image from the imageHotspotPathRoot (defaults to document),\n * using the path from the hotspot's `options` field\n *\n * when changes in imageHotspotPathRoot (e.g. document) occur,\n * check if there are any changes to the hotspotImage and update the reference\n */\n const hotspotImage = useMemo(() => {\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- the configured imagePath is expected to point to an image field\n return (\n imageHotspotOptions.imagePath ? get(rootObject, imageHotspotOptions.imagePath) : rootObject\n ) as ImageValue | undefined\n }, [rootObject, imageHotspotOptions.imagePath])\n\n const displayImage = useMemo(() => {\n const builder = createImageUrlBuilder(sanityClient).dataset(sanityClient.config().dataset ?? '')\n const urlFor = (source: ImageValue) => builder.image(source)\n\n if (hotspotImage?.asset?._ref) {\n const {aspectRatio} = getImageDimensions(hotspotImage.asset._ref)\n const width = 1200\n const height = Math.round(width / aspectRatio)\n const url = urlFor(hotspotImage).width(width).url()\n\n return {width, height, url}\n }\n\n return null\n }, [hotspotImage, sanityClient])\n\n const handleHotspotImageClick = useCallback(\n async (event: MouseEvent<HTMLImageElement>) => {\n const spotType = schemaType.of[0]\n if (!spotType) {\n return\n }\n\n const {nativeEvent, currentTarget} = event\n\n // Calculate the x/y percentage of the click position\n const x = Number(((nativeEvent.offsetX * 100) / currentTarget.width).toFixed(2))\n const y = Number(((nativeEvent.offsetY * 100) / currentTarget.height).toFixed(2))\n const description = `New Hotspot at ${x}% x ${y}%`\n\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- hotspot arrays contain a single object type\n const initialValues = await resolveInitialValue(spotType.type as ObjectSchemaType)\n\n const newRow: HotspotItem = {\n _key: randomKey(12),\n _type: spotType.name,\n ...initialValues,\n x,\n y,\n }\n\n if (imageHotspotOptions?.descriptionPath) {\n newRow[imageHotspotOptions.descriptionPath] = description\n }\n\n onChange(PatchEvent.from([setIfMissing([]), insert([newRow], 'after', [-1])]))\n },\n [imageHotspotOptions, onChange, resolveInitialValue, schemaType],\n )\n\n const handleHotspotMove: FnHotspotMove = useCallback(\n (key, x, y) => {\n onChange(\n PatchEvent.from([\n // Set the `x` value of this array key item\n set(x, [{_key: key}, 'x']),\n // Set the `y` value of this array key item\n set(y, [{_key: key}, 'y']),\n ]),\n )\n },\n [onChange],\n )\n\n const hotspotImageRef = useRef<HTMLImageElement | null>(null)\n\n const [imageRect, setImageRect] = useState<DOMRectReadOnly>()\n\n useResizeObserver<HTMLImageElement>(\n hotspotImageRef,\n useDebouncedCallback(\n (e: ResizeObserverEntry) => setImageRect(e.contentRect),\n [setImageRect],\n 200,\n ),\n )\n\n return (\n <Stack gap={[2, 2, 3]}>\n {displayImage?.url ? (\n <div style={{position: `relative`}}>\n {imageRect &&\n (value?.length ?? 0) > 0 &&\n value?.map((spot, index) => (\n <Spot\n index={index}\n key={spot._key}\n value={spot}\n bounds={imageRect}\n update={handleHotspotMove}\n hotspotDescriptionPath={imageHotspotOptions?.descriptionPath}\n tooltip={imageHotspotOptions?.tooltip}\n renderPreview={renderPreview}\n // oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- hotspot arrays contain a single object type\n schemaType={schemaType.of[0] as ObjectSchemaType}\n />\n ))}\n\n <Card __unstable_checkered shadow={1}>\n <Flex align=\"center\" justify=\"center\">\n {/* oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- hotspots are placed via pointer coordinates, which have no keyboard equivalent */}\n <img\n ref={hotspotImageRef}\n src={displayImage.url}\n width={displayImage.width}\n height={displayImage.height}\n alt=\"\"\n style={imageStyle}\n onClick={handleHotspotImageClick}\n />\n </Flex>\n </Card>\n </div>\n ) : (\n <Feedback>\n {imageHotspotOptions.imagePath ? (\n <>\n No Hotspot image found at path <code>{imageHotspotOptions.imagePath}</code>\n </>\n ) : (\n <>\n Define a path in this field using to the image field in this document at{' '}\n <code>options.hotspotImagePath</code>\n </>\n )}\n </Feedback>\n )}\n {imageHotspotOptions.pathRoot && !VALID_ROOT_PATHS.includes(imageHotspotOptions.pathRoot) && (\n <Feedback>\n The supplied imageHotspotPathRoot &quot;{imageHotspotOptions.pathRoot}&quot; is not valid,\n falling back to &quot;document&quot;. Available values are &quot;\n {VALID_ROOT_PATHS.join(', ')}&quot;.\n </Feedback>\n )}\n {/* oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- renderDefault expects the base input props */}\n {props.renderDefault(props as unknown as ArrayOfObjectsInputProps)}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAeE,SAAAC,IAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAAkB,EAAAC,aAAAH,IAAuCI;CAI7D,OAJ6DH,EAAA,OAAAE,WAI7DC,KAAAH,EAAA,MAFPG,KAAA,oBAAC,MAAD;EAAe,SAAA;EAAW,QAAA;EAAW,QAAA;EAAQ,MAAA;YAC3C,oBAAC,MAAD,EAAOD,SAAF,CAAA;CADF,CAAA,GAEEF,EAAA,KAAAE,UAAAF,EAAA,KAAAG,KAFPA;AAEO;ACSX,MAAMiB,YAA2B;CAC/BC,OAAO;CACPC,QAAQ;CACRC,UAAU;CACVC,WAAW;CACXC,KAAK;CACLC,MAAM;CACNC,QAAQ;CACRC,QAAQ;CACRC,SAAS;CACTC,gBAAgB;CAChBC,YAAY;CACZC,cAAc;CACdC,YAAY;CACZC,OAAO;AACT,GAEMC,qBAAoC;CACxCF,YAAY;CACZG,QAAQ;CACRR,QAAQ;AACV,GAEMS,sBAAqC;CACzCJ,YAAY;CACZG,QAAQ;AACV,GAEME,WAA0B;CAC9Bf,UAAU;CACVG,MAAM;CACND,KAAK;CACLH,QAAQ;CACRD,OAAO;CACPM,QAAQ;CACRM,YAAY;CACZM,YAAY;CACZP,cAAc;CAEdQ,eAAe;AACjB,GAEMC,sBAAqC,EACzCF,YAAY,UACd,GAEMG,aAA4B;CAChCR,OAAO;CACPS,UAAU;CACVC,YAAY;CACZC,YAAY;AACd,GAEMC,wBAAuC,EAC3CP,YAAY,SACd,GAEMQ,SAASC,QAAgBC,KAAKF,MAAMC,MAAM,GAAG,IAAI;AAmBvD,SA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AQAG;EAzDG;KA0DEpF,EAAA,MAAA0E,KAAA1E,EAAA,MAAAiF,KAAAjF,EAAA,MAAAoF,KAAApF,EAAA,MAAAsF,OAAAA,MAAAtF,EAAA,KA1DRsF;AA0DQ;AApLL,SAAA7D,SAAA,CAAA;AAAA,SAAAF,MAAAgE,cAAA;CAAA,OAqBUA;AAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-hotspot-array",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "A configurable Custom Input for Arrays that will add and update items by clicking on an Image",
5
5
  "keywords": [
6
6
  "sanity",
@@ -29,15 +29,16 @@
29
29
  "dependencies": {
30
30
  "@sanity/asset-utils": "^2.3.0",
31
31
  "@sanity/image-url": "^2.1.1",
32
- "@sanity/ui": "^3.3.0",
32
+ "@sanity/ui": "^3.3.5",
33
33
  "@sanity/util": "^6.3.0",
34
34
  "lodash-es": "^4.18.1",
35
35
  "motion": "^12.42.2"
36
36
  },
37
37
  "devDependencies": {
38
- "@sanity/pkg-utils": "^10.9.0",
38
+ "@sanity/tsconfig": "^2.2.0",
39
+ "@sanity/tsdown-config": "^0.13.1",
39
40
  "@types/lodash-es": "^4.17.12",
40
- "@types/node": "^24.13.2",
41
+ "@types/node": "^24.13.3",
41
42
  "@types/react": "^19.2.17",
42
43
  "@types/react-dom": "^19.2.3",
43
44
  "babel-plugin-react-compiler": "^1.0.0",
@@ -45,8 +46,7 @@
45
46
  "react-dom": "^19.2.7",
46
47
  "sanity": "^6.3.0",
47
48
  "styled-components": "^6.4.3",
48
- "@repo/package.config": "0.0.0",
49
- "@repo/tsconfig": "0.0.0"
49
+ "tsdown": "^0.22.5"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^19.2",
@@ -57,6 +57,6 @@
57
57
  "node": ">=20.19 <22 || >=22.12"
58
58
  },
59
59
  "scripts": {
60
- "build": "pkg build --strict --check --clean"
60
+ "build": "tsdown"
61
61
  }
62
62
  }