@glodon-aiot/react-components 0.0.0-20251106104234

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 (92) hide show
  1. package/README.git.md +73 -0
  2. package/README.lib.md +135 -0
  3. package/dist/aiot-react-components.js +20191 -0
  4. package/dist/aiot-react-components.umd.cjs +183 -0
  5. package/dist/es/Button/index.mjs +48 -0
  6. package/dist/es/Button/style.less.mjs +4 -0
  7. package/dist/es/ConfirmableButton/index.mjs +59 -0
  8. package/dist/es/Drawable/Drawable.mjs +220 -0
  9. package/dist/es/Drawable/LineElement.mjs +27 -0
  10. package/dist/es/Drawable/MarkerElement.mjs +39 -0
  11. package/dist/es/Drawable/PolygonElement.mjs +88 -0
  12. package/dist/es/Drawable/index.mjs +16 -0
  13. package/dist/es/Drawable/state.mjs +134 -0
  14. package/dist/es/ExpandablePannel/index.mjs +94 -0
  15. package/dist/es/ExpandablePannel/style.less.mjs +4 -0
  16. package/dist/es/GOSImageMap/DrawableImageMap.mjs +49 -0
  17. package/dist/es/GOSImageMap/ImageMap.mjs +39 -0
  18. package/dist/es/IconButton/index.mjs +23 -0
  19. package/dist/es/IconButton/style.less.mjs +4 -0
  20. package/dist/es/Iconfont/index.mjs +8 -0
  21. package/dist/es/ImageMap/index.mjs +297 -0
  22. package/dist/es/ImageMap/style.less.mjs +4 -0
  23. package/dist/es/MouseTip/constant.mjs +9 -0
  24. package/dist/es/MouseTip/index.mjs +54 -0
  25. package/dist/es/MouseTip/style.less.mjs +4 -0
  26. package/dist/es/MouseTip/utils.mjs +70 -0
  27. package/dist/es/PanoramaRecordPlayer/index.mjs +84 -0
  28. package/dist/es/PassMap/index.mjs +43 -0
  29. package/dist/es/PassMap/style.less.mjs +4 -0
  30. package/dist/es/TrackMap/PointTooltip.mjs +88 -0
  31. package/dist/es/TrackMap/TrackPoint.mjs +57 -0
  32. package/dist/es/TrackMap/index.mjs +375 -0
  33. package/dist/es/TrackMap/style.less.mjs +4 -0
  34. package/dist/es/Zoom/index.mjs +48 -0
  35. package/dist/es/components/Copy/index.mjs +44 -0
  36. package/dist/es/components/Copy/style.less.mjs +4 -0
  37. package/dist/es/components/Markdown/ATag/index.mjs +49 -0
  38. package/dist/es/components/Markdown/Code/index.mjs +69 -0
  39. package/dist/es/components/Markdown/Image/index.mjs +65 -0
  40. package/dist/es/components/Markdown/Video/index.mjs +22 -0
  41. package/dist/es/components/Markdown/index.mjs +85 -0
  42. package/dist/es/components/Markdown/style.less.mjs +4 -0
  43. package/dist/es/index.mjs +42 -0
  44. package/dist/es/useBimface/index.mjs +148 -0
  45. package/dist/es/utils/JSAsyncLoader.mjs +7 -0
  46. package/dist/es/utils/clipboard.mjs +38 -0
  47. package/dist/es/utils/markdown/index.mjs +29 -0
  48. package/dist/lib/index.js +2 -0
  49. package/dist/src/Button/index.d.ts +10 -0
  50. package/dist/src/ConfirmableButton/index.d.ts +16 -0
  51. package/dist/src/Drawable/Drawable.d.ts +32 -0
  52. package/dist/src/Drawable/LineElement.d.ts +8 -0
  53. package/dist/src/Drawable/MarkerElement.d.ts +10 -0
  54. package/dist/src/Drawable/MarkersMap.d.ts +7 -0
  55. package/dist/src/Drawable/PolygonElement.d.ts +10 -0
  56. package/dist/src/Drawable/index.d.ts +33 -0
  57. package/dist/src/Drawable/state.d.ts +49 -0
  58. package/dist/src/ExpandablePannel/index.d.ts +24 -0
  59. package/dist/src/GOSImageMap/DrawableImageMap.d.ts +8 -0
  60. package/dist/src/GOSImageMap/ImageMap.d.ts +8 -0
  61. package/dist/src/GOSImageMap/index.d.ts +2 -0
  62. package/dist/src/IconButton/index.d.ts +5 -0
  63. package/dist/src/Iconfont/CloudIconfont.d.ts +2 -0
  64. package/dist/src/Iconfont/EdgeIconfont.d.ts +2 -0
  65. package/dist/src/Iconfont/font_3929209_z3fhml098hr.d.ts +0 -0
  66. package/dist/src/Iconfont/font_edge.d.ts +0 -0
  67. package/dist/src/Iconfont/index.d.ts +2 -0
  68. package/dist/src/ImageMap/index.d.ts +40 -0
  69. package/dist/src/MouseTip/constant.d.ts +6 -0
  70. package/dist/src/MouseTip/index.d.ts +17 -0
  71. package/dist/src/MouseTip/types.d.ts +8 -0
  72. package/dist/src/MouseTip/utils.d.ts +8 -0
  73. package/dist/src/PanoramaRecordPlayer/index.d.ts +14 -0
  74. package/dist/src/PassMap/index.d.ts +11 -0
  75. package/dist/src/TrackMap/PointTooltip.d.ts +9 -0
  76. package/dist/src/TrackMap/TrackPoint.d.ts +19 -0
  77. package/dist/src/TrackMap/index.d.ts +82 -0
  78. package/dist/src/Zoom/index.d.ts +13 -0
  79. package/dist/src/components/Copy/index.d.ts +5 -0
  80. package/dist/src/components/Markdown/ATag/index.d.ts +2 -0
  81. package/dist/src/components/Markdown/Code/index.d.ts +2 -0
  82. package/dist/src/components/Markdown/Image/index.d.ts +2 -0
  83. package/dist/src/components/Markdown/Video/index.d.ts +2 -0
  84. package/dist/src/components/Markdown/index.d.ts +19 -0
  85. package/dist/src/index.d.ts +17 -0
  86. package/dist/src/useBimface/example.d.ts +2 -0
  87. package/dist/src/useBimface/index.d.ts +65 -0
  88. package/dist/src/utils/JSAsyncLoader.d.ts +2 -0
  89. package/dist/src/utils/clipboard.d.ts +11 -0
  90. package/dist/src/utils/markdown/index.d.ts +10 -0
  91. package/dist/style.css +1 -0
  92. package/package.json +138 -0
@@ -0,0 +1,48 @@
1
+ var d = Object.defineProperty, k = Object.defineProperties;
2
+ var f = Object.getOwnPropertyDescriptors;
3
+ var n = Object.getOwnPropertySymbols;
4
+ var u = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
5
+ var b = (o, t, r) => t in o ? d(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r, y = (o, t) => {
6
+ for (var r in t || (t = {}))
7
+ u.call(t, r) && b(o, r, t[r]);
8
+ if (n)
9
+ for (var r of n(t))
10
+ m.call(t, r) && b(o, r, t[r]);
11
+ return o;
12
+ }, a = (o, t) => k(o, f(t));
13
+ var i = (o, t) => {
14
+ var r = {};
15
+ for (var s in o)
16
+ u.call(o, s) && t.indexOf(s) < 0 && (r[s] = o[s]);
17
+ if (o != null && n)
18
+ for (var s of n(o))
19
+ t.indexOf(s) < 0 && m.call(o, s) && (r[s] = o[s]);
20
+ return r;
21
+ };
22
+ import { jsx as j } from "react/jsx-runtime";
23
+ import "./style.less.mjs";
24
+ const z = (o) => {
25
+ const e = o, {
26
+ primary: t = !1,
27
+ size: r = "medium",
28
+ backgroundColor: s,
29
+ label: c
30
+ } = e, l = i(e, [
31
+ "primary",
32
+ "size",
33
+ "backgroundColor",
34
+ "label"
35
+ ]), p = t ? "storybook-button--primary" : "storybook-button--secondary";
36
+ return j("button", a(y({
37
+ type: "button",
38
+ className: ["storybook-button", `storybook-button--${r}`, p].join(" "),
39
+ style: {
40
+ backgroundColor: s
41
+ }
42
+ }, l), {
43
+ children: c
44
+ }));
45
+ };
46
+ export {
47
+ z as Button
48
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,59 @@
1
+ var C = Object.defineProperty;
2
+ var l = Object.getOwnPropertySymbols;
3
+ var d = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
4
+ var a = (e, t, r) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, u = (e, t) => {
5
+ for (var r in t || (t = {}))
6
+ d.call(t, r) && a(e, r, t[r]);
7
+ if (l)
8
+ for (var r of l(t))
9
+ y.call(t, r) && a(e, r, t[r]);
10
+ return e;
11
+ };
12
+ import { jsx as o } from "react/jsx-runtime";
13
+ import { useState as h, useEffect as k } from "react";
14
+ import s from "antd/es/button";
15
+ import p from "antd/es/popconfirm";
16
+ const T = (e) => {
17
+ const {
18
+ name: t,
19
+ type: r,
20
+ style: x,
21
+ className: i,
22
+ children: m,
23
+ onConfirm: c
24
+ } = e, [f, n] = h(null);
25
+ return k(() => {
26
+ if (!e.confirm) {
27
+ n(null);
28
+ return;
29
+ }
30
+ if (e.confirm === !0) {
31
+ n({
32
+ text: `确认${t}吗?`
33
+ });
34
+ return;
35
+ }
36
+ n(e.confirm);
37
+ }, [e.confirm]), f ? o(p, {
38
+ rootClassName: "track-map-popconfirm",
39
+ okText: "确定",
40
+ cancelText: "取消",
41
+ title: f.text,
42
+ trigger: "click",
43
+ onConfirm: c,
44
+ children: o(s, {
45
+ className: i,
46
+ type: r,
47
+ style: u({}, x),
48
+ children: m || t
49
+ })
50
+ }) : o(s, {
51
+ className: i,
52
+ type: r,
53
+ onClick: c,
54
+ children: m || t
55
+ });
56
+ };
57
+ export {
58
+ T as default
59
+ };
@@ -0,0 +1,220 @@
1
+ var $ = Object.defineProperty, H = Object.defineProperties;
2
+ var U = Object.getOwnPropertyDescriptors;
3
+ var b = Object.getOwnPropertySymbols;
4
+ var V = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
5
+ var x = (r, t, i) => t in r ? $(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i, M = (r, t) => {
6
+ for (var i in t || (t = {}))
7
+ V.call(t, i) && x(r, i, t[i]);
8
+ if (b)
9
+ for (var i of b(t))
10
+ q.call(t, i) && x(r, i, t[i]);
11
+ return r;
12
+ }, C = (r, t) => H(r, U(t));
13
+ import { jsx as s, jsxs as F } from "react/jsx-runtime";
14
+ import { useSize as J } from "ahooks";
15
+ import { useMachine as Q } from "@xstate/react";
16
+ import Z from "lodash/size";
17
+ import { useState as _, useRef as ee, useEffect as f } from "react";
18
+ import { assign as k } from "xstate";
19
+ import { DrawableContext as ne } from "./index.mjs";
20
+ import Y from "./LineElement.mjs";
21
+ import I from "./MarkerElement.mjs";
22
+ import W from "./PolygonElement.mjs";
23
+ import { drawableMachine as te } from "./state.mjs";
24
+ function he(r) {
25
+ const {
26
+ state: t,
27
+ scale: i,
28
+ width: B,
29
+ height: G,
30
+ drawOptions: E,
31
+ lines: u,
32
+ polygons: p,
33
+ markers: g,
34
+ markRenderer: j,
35
+ onAddLine: w,
36
+ onAddPolygon: L,
37
+ onAddMarker: S,
38
+ onStateChange: y
39
+ } = r, [P, z] = _([]), [R, K] = _([]), [v, X] = _([]), c = ee(null), {
40
+ width: O,
41
+ height: N
42
+ } = J(c) || {};
43
+ function h({
44
+ x: e,
45
+ y: n
46
+ }) {
47
+ return {
48
+ x: e / i,
49
+ y: n / i
50
+ };
51
+ }
52
+ function A({
53
+ x: e,
54
+ y: n
55
+ }) {
56
+ return {
57
+ x: e * i,
58
+ y: n * i
59
+ };
60
+ }
61
+ const [l, a] = Q(te, {
62
+ actions: {
63
+ onAddMarker: k(({
64
+ markerPoint: e
65
+ }) => (S && e && S(h(e)), {
66
+ markerPoint: void 0,
67
+ movingPoint: void 0
68
+ })),
69
+ onAddLine: k((e) => (e.lineStart && e.lineEnd && w && w(h(e.lineStart), h(e.lineEnd)), {
70
+ lineEnd: void 0,
71
+ lineStart: void 0,
72
+ movingPoint: void 0
73
+ })),
74
+ onAddPolygon: k(({
75
+ polygonPoints: e
76
+ }) => (L && e && e.length > 2 && L(e.map(h)), {
77
+ polygonPoints: void 0,
78
+ movingPoint: void 0
79
+ }))
80
+ },
81
+ services: {}
82
+ });
83
+ f(() => {
84
+ var e;
85
+ z((e = u == null ? void 0 : u.map(({
86
+ id: n,
87
+ start: d,
88
+ end: o
89
+ }) => ({
90
+ id: n,
91
+ start: A(d),
92
+ end: A(o)
93
+ }))) != null ? e : []);
94
+ }, [u]), f(() => {
95
+ var e;
96
+ X((e = g == null ? void 0 : g.map((n) => C(M({}, n), {
97
+ point: A(n.point)
98
+ }))) != null ? e : []);
99
+ }, [g]), f(() => {
100
+ var e;
101
+ K((e = p == null ? void 0 : p.map(({
102
+ id: n,
103
+ points: d,
104
+ options: o
105
+ }) => ({
106
+ id: n,
107
+ points: d.map(A),
108
+ options: o
109
+ }))) != null ? e : []);
110
+ }, [p, i]), f(() => {
111
+ y && l.matches("idle") && y("viewOnly");
112
+ }, [l.value]), f(() => {
113
+ if (y)
114
+ switch (t) {
115
+ case "drawingLine":
116
+ a("START_DRAW_LINE");
117
+ break;
118
+ case "drawingPolygon":
119
+ a("START_DRAW_POLYGON");
120
+ break;
121
+ case "addingMarker":
122
+ a("START_ADD_MARKER");
123
+ break;
124
+ }
125
+ }, [t]);
126
+ const {
127
+ lineStart: D,
128
+ lineEnd: ie,
129
+ polygonPoints: T,
130
+ movingPoint: m
131
+ } = l.context;
132
+ return s(ne.Provider, {
133
+ value: {
134
+ options: E != null ? E : {}
135
+ },
136
+ children: s("div", {
137
+ ref: c,
138
+ className: "w-full h-full absolute left-0 top-0",
139
+ style: {
140
+ cursor: t === "viewOnly" ? void 0 : "crosshair",
141
+ width: B,
142
+ height: G
143
+ },
144
+ children: O && N && F("svg", {
145
+ viewBox: `0 0 ${O} ${N}`,
146
+ version: "1.1",
147
+ className: "absolute inset-0",
148
+ onClick: (e) => {
149
+ if (!c.current)
150
+ return;
151
+ const {
152
+ top: n,
153
+ left: d
154
+ } = c.current.getBoundingClientRect(), o = {
155
+ x: e.clientX - d,
156
+ y: e.clientY - n
157
+ };
158
+ l.matches("drawingLine") ? a(D === void 0 ? {
159
+ type: "ADD_LINE_START",
160
+ point: o
161
+ } : {
162
+ type: "ADD_LINE_END",
163
+ point: o
164
+ }) : l.matches("drawingPolygon") ? a({
165
+ type: "ADD_POLYGON_POINT",
166
+ point: o
167
+ }) : l.matches("addingMarker") && a({
168
+ type: "ADD_MARKER",
169
+ point: o
170
+ });
171
+ },
172
+ onMouseMove: (e) => {
173
+ if (!c.current)
174
+ return;
175
+ const {
176
+ top: n,
177
+ left: d
178
+ } = c.current.getBoundingClientRect(), o = {
179
+ x: e.clientX - d,
180
+ y: e.clientY - n
181
+ };
182
+ a({
183
+ type: "MOUSE_MOVE",
184
+ point: o
185
+ });
186
+ },
187
+ children: [P == null ? void 0 : P.map((e, n) => s(Y, M({}, e), n)), D && m && s(Y, {
188
+ start: D,
189
+ end: m
190
+ }), R == null ? void 0 : R.map(({
191
+ points: e,
192
+ options: n
193
+ }, d) => s(W, {
194
+ editing: !1,
195
+ points: e,
196
+ options: n
197
+ }, d)), Z(T) > 0 && m && s(W, {
198
+ editing: !0,
199
+ points: [...T, m],
200
+ onClose: (e) => {
201
+ a({
202
+ type: "DRAW_POLYGON_COMPLETE"
203
+ });
204
+ }
205
+ }), v == null ? void 0 : v.map((e) => s(I, {
206
+ marker: e,
207
+ markRenderer: j
208
+ })), l.matches("addingMarker") && m && s(I, {
209
+ marker: {
210
+ id: "addingMarker",
211
+ point: m
212
+ }
213
+ })]
214
+ })
215
+ })
216
+ });
217
+ }
218
+ export {
219
+ he as default
220
+ };
@@ -0,0 +1,27 @@
1
+ import { jsx as n, Fragment as m } from "react/jsx-runtime";
2
+ import { useContext as x } from "react";
3
+ import { DrawableContext as a } from "./index.mjs";
4
+ function c(s) {
5
+ const {
6
+ start: o,
7
+ end: r
8
+ } = s, {
9
+ options: {
10
+ lineColor: t,
11
+ lineWidth: e
12
+ }
13
+ } = x(a);
14
+ return n(m, {
15
+ children: n("line", {
16
+ x1: o.x,
17
+ y1: o.y,
18
+ x2: r.x,
19
+ y2: r.y,
20
+ stroke: t != null ? t : "#FF5500",
21
+ strokeWidth: e != null ? e : 2
22
+ })
23
+ });
24
+ }
25
+ export {
26
+ c as default
27
+ };
@@ -0,0 +1,39 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ function o(t) {
3
+ const {
4
+ markRenderer: r,
5
+ marker: n
6
+ } = t, {
7
+ point: {
8
+ x: l,
9
+ y: i
10
+ }
11
+ } = n;
12
+ return a("g", {
13
+ children: [e("line", {}), e("line", {}), e("circle", {
14
+ cx: l,
15
+ cy: i,
16
+ r: 1,
17
+ fill: "transparent"
18
+ }), e("foreignObject", {
19
+ x: l,
20
+ y: i,
21
+ width: 0,
22
+ height: 0,
23
+ fill: "green",
24
+ className: "relative overflow-visible",
25
+ children: e("div", {
26
+ className: "inline-flex absolute",
27
+ draggable: !0,
28
+ onDragStart: () => {
29
+ },
30
+ onDragEnd: () => {
31
+ },
32
+ children: r && r(n)
33
+ })
34
+ })]
35
+ });
36
+ }
37
+ export {
38
+ o as default
39
+ };
@@ -0,0 +1,88 @@
1
+ import { jsxs as $, Fragment as v, jsx as o } from "react/jsx-runtime";
2
+ import D from "lodash/first";
3
+ import F from "lodash/size";
4
+ import { useState as j, useContext as w } from "react";
5
+ import { DrawableContext as z } from "./index.mjs";
6
+ function N(S) {
7
+ const {
8
+ points: e,
9
+ editing: i,
10
+ options: l,
11
+ onClose: x
12
+ } = S, [b, y] = j(!1), {
13
+ options: {
14
+ polygon: c
15
+ }
16
+ } = w(z);
17
+ if (!i && F(e) <= 2)
18
+ return null;
19
+ const a = D(e), p = e.map(({
20
+ x: n,
21
+ y: r
22
+ }) => `${n},${r}`).join(" "), g = a ? `${p} ${a.x},${a.y}` : p, {
23
+ showVertexIndex: d,
24
+ vertexBgColor: f,
25
+ vertexTextColor: m
26
+ } = c != null ? c : {}, k = d ? 10 : 5, A = i || d, {
27
+ hideBorder: P,
28
+ backgroundColor: u
29
+ } = l != null ? l : {};
30
+ return $(v, {
31
+ children: [o("polygon", {
32
+ points: `${g}`,
33
+ fill: u != null ? u : "rgba(255, 66, 66, 0.15)"
34
+ }), !P && o("polyline", {
35
+ points: i ? p : g,
36
+ fill: "transparent",
37
+ stroke: "#FF5500",
38
+ strokeDasharray: "6 4",
39
+ strokeWidth: "2"
40
+ }), !P && (e == null ? void 0 : e.map(({
41
+ x: n,
42
+ y: r
43
+ }, h) => {
44
+ const s = h === F(e) - 1;
45
+ return o("g", {
46
+ style: {
47
+ zIndex: s ? 1 : 100,
48
+ cursor: "pointer",
49
+ pointerEvents: s ? "none" : "bounding-box"
50
+ },
51
+ onMouseEnter: (t) => {
52
+ s || y(!0);
53
+ },
54
+ onMouseLeave: (t) => {
55
+ y(!1);
56
+ },
57
+ onClick: (t) => {
58
+ t.stopPropagation();
59
+ },
60
+ onDoubleClick: (t) => {
61
+ t.stopPropagation(), x && x(h);
62
+ },
63
+ children: A && (!s || !b) && $(v, {
64
+ children: [o("circle", {
65
+ cx: n,
66
+ cy: r,
67
+ r: k,
68
+ fill: f != null ? f : "#FF5500"
69
+ }), d && o("text", {
70
+ x: n,
71
+ y: r,
72
+ "text-anchor": "middle",
73
+ fill: m != null ? m : "#fff",
74
+ dy: ".3em",
75
+ style: {
76
+ cursor: "pointer",
77
+ userSelect: "none"
78
+ },
79
+ children: h + 1
80
+ })]
81
+ })
82
+ });
83
+ }))]
84
+ });
85
+ }
86
+ export {
87
+ N as default
88
+ };
@@ -0,0 +1,16 @@
1
+ import { createContext as o } from "react";
2
+ function r(t, a, e) {
3
+ if (e)
4
+ return Math.abs(r(t, e) - r(a, e));
5
+ for (var n = Math.atan2(a.y - t.y, a.x - t.x); n < 0; )
6
+ n += 2 * Math.PI;
7
+ return n;
8
+ }
9
+ const l = o({
10
+ options: {}
11
+ });
12
+ l.displayName = "DrawableContext";
13
+ export {
14
+ l as DrawableContext,
15
+ r as calAngle
16
+ };
@@ -0,0 +1,134 @@
1
+ import { assign as a } from "@xstate/immer";
2
+ import { createMachine as o } from "xstate";
3
+ const d = o({
4
+ initial: "idle",
5
+ context: {},
6
+ states: {
7
+ idle: {
8
+ on: {
9
+ START_ADD_MARKER: {
10
+ target: "addingMarker"
11
+ },
12
+ START_DRAW_LINE: {
13
+ target: "drawingLine"
14
+ },
15
+ START_DRAW_POLYGON: {
16
+ target: "drawingPolygon"
17
+ }
18
+ }
19
+ },
20
+ addingMarker: {
21
+ on: {
22
+ RESET: {
23
+ target: "idle",
24
+ actions: a((n) => {
25
+ n.markerPoint = void 0;
26
+ })
27
+ },
28
+ ADD_MARKER: {
29
+ target: "drawCompleted",
30
+ actions: [a((n, {
31
+ point: t
32
+ }) => {
33
+ n.markerPoint = t;
34
+ }), "onAddMarker"]
35
+ },
36
+ MOUSE_MOVE: {
37
+ target: "addingMarker",
38
+ actions: a((n, {
39
+ point: t
40
+ }) => {
41
+ n.movingPoint = t;
42
+ })
43
+ }
44
+ }
45
+ },
46
+ drawingLine: {
47
+ on: {
48
+ ADD_LINE_START: {
49
+ target: "drawingLine",
50
+ actions: a((n, t) => {
51
+ n.lineStart = t.point;
52
+ })
53
+ },
54
+ ADD_LINE_END: {
55
+ target: "drawCompleted",
56
+ actions: [a((n, t) => {
57
+ n.lineEnd = t.point;
58
+ }), "onAddLine"]
59
+ },
60
+ MOUSE_MOVE: {
61
+ target: "drawingLine",
62
+ actions: a((n, {
63
+ point: t
64
+ }) => {
65
+ n.movingPoint = t;
66
+ })
67
+ },
68
+ RESET: {
69
+ target: "drawCompleted"
70
+ },
71
+ CANCEL: {
72
+ target: "drawCompleted"
73
+ }
74
+ }
75
+ // exit: assign((ctx) => {
76
+ // ctx.lineEnd = undefined
77
+ // ctx.lineStart = undefined
78
+ // }),
79
+ },
80
+ drawingPolygon: {
81
+ on: {
82
+ CANCEL: {
83
+ target: "canceled"
84
+ },
85
+ RESET: {
86
+ target: "idle",
87
+ actions: a((n) => {
88
+ n.polygonPoints = void 0;
89
+ })
90
+ },
91
+ ADD_POLYGON_POINT: {
92
+ target: "drawingPolygon",
93
+ actions: a((n, {
94
+ point: t
95
+ }) => {
96
+ var e;
97
+ n.polygonPoints = (e = n.polygonPoints) != null ? e : [], n.polygonPoints.push(t);
98
+ })
99
+ },
100
+ MOUSE_MOVE: {
101
+ target: "drawingPolygon",
102
+ actions: a((n, {
103
+ point: t
104
+ }) => {
105
+ n.movingPoint = t;
106
+ })
107
+ },
108
+ DRAW_POLYGON_COMPLETE: {
109
+ target: "drawCompleted",
110
+ actions: ["onAddPolygon"]
111
+ }
112
+ }
113
+ },
114
+ drawCompleted: {
115
+ always: {
116
+ target: "idle"
117
+ // actions: ['reset'],
118
+ // actions: assign((ctx) => {
119
+ // console.log('reset is done')
120
+ // // setTimeout(() => {
121
+ // // ctx.lineEnd = undefined
122
+ // // ctx.lineStart = undefined
123
+ // // ctx.markerPoint = undefined
124
+ // // ctx.polygonPoints = undefined
125
+ // // })
126
+ // }),
127
+ }
128
+ },
129
+ canceled: {}
130
+ }
131
+ });
132
+ export {
133
+ d as drawableMachine
134
+ };