scorer-ui-kit 3.0.0-beta.7 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +14 -11
  2. package/dist/Alerts/atom/AlertBar.d.ts.map +1 -1
  3. package/dist/Alerts/atom/Notification.d.ts.map +1 -1
  4. package/dist/Alerts/atom/Tooltip.d.ts +1 -1
  5. package/dist/Alerts/atom/Tooltip.d.ts.map +1 -1
  6. package/dist/Alerts/index.d.ts +1 -1
  7. package/dist/Alerts/index.d.ts.map +1 -1
  8. package/dist/CameraPanels/atoms/MediaStream.d.ts.map +1 -1
  9. package/dist/CameraPanels/atoms/PanelMetaData.d.ts.map +1 -1
  10. package/dist/CameraPanels/index.d.ts +3 -3
  11. package/dist/CameraPanels/index.d.ts.map +1 -1
  12. package/dist/CameraPanels/molecules/CameraPanel.d.ts.map +1 -1
  13. package/dist/CameraPanels/organisms/CameraPanels.d.ts.map +1 -1
  14. package/dist/Filters/FilterTypes.d.ts +4 -4
  15. package/dist/Filters/FilterTypes.d.ts.map +1 -1
  16. package/dist/Filters/atoms/DateTimeBlock.d.ts.map +1 -1
  17. package/dist/Filters/atoms/FilterButton.d.ts.map +1 -1
  18. package/dist/Filters/atoms/FilterDropHandler.d.ts +2 -1
  19. package/dist/Filters/atoms/FilterDropHandler.d.ts.map +1 -1
  20. package/dist/Filters/atoms/FilterDropdownContainer.d.ts.map +1 -1
  21. package/dist/Filters/atoms/FooterControls.d.ts.map +1 -1
  22. package/dist/Filters/atoms/LoadingBox.d.ts.map +1 -1
  23. package/dist/Filters/atoms/ToggleButton.d.ts +2 -2
  24. package/dist/Filters/atoms/ToggleButton.d.ts.map +1 -1
  25. package/dist/Filters/index.d.ts +8 -8
  26. package/dist/Filters/index.d.ts.map +1 -1
  27. package/dist/Filters/molecules/DatePicker.d.ts +2 -2
  28. package/dist/Filters/molecules/DatePicker.d.ts.map +1 -1
  29. package/dist/Filters/molecules/DropdownDatePicker.d.ts.map +1 -1
  30. package/dist/Filters/molecules/FilterDropdown.d.ts +1 -1
  31. package/dist/Filters/molecules/FilterDropdown.d.ts.map +1 -1
  32. package/dist/Filters/molecules/FilterInputs.d.ts.map +1 -1
  33. package/dist/Filters/molecules/FilterLayout.d.ts.map +1 -1
  34. package/dist/Filters/molecules/FiltersResults.d.ts +1 -1
  35. package/dist/Filters/molecules/FiltersResults.d.ts.map +1 -1
  36. package/dist/Filters/molecules/SortDropdown.d.ts +1 -1
  37. package/dist/Filters/molecules/SortDropdown.d.ts.map +1 -1
  38. package/dist/Filters/organisms/FilterBar.d.ts +1 -1
  39. package/dist/Filters/organisms/FilterBar.d.ts.map +1 -1
  40. package/dist/Form/Form.d.ts.map +1 -1
  41. package/dist/Form/atoms/Button.d.ts +1 -1
  42. package/dist/Form/atoms/Button.d.ts.map +1 -1
  43. package/dist/Form/atoms/ButtonWithIcon.d.ts +1 -1
  44. package/dist/Form/atoms/ButtonWithIcon.d.ts.map +1 -1
  45. package/dist/Form/atoms/ButtonWithLoading.d.ts.map +1 -1
  46. package/dist/Form/atoms/Checkbox.d.ts.map +1 -1
  47. package/dist/Form/atoms/CropArea.d.ts.map +1 -1
  48. package/dist/Form/atoms/DropArea.d.ts.map +1 -1
  49. package/dist/Form/atoms/FilterOption.d.ts.map +1 -1
  50. package/dist/Form/atoms/IconButton.d.ts.map +1 -1
  51. package/dist/Form/atoms/Input.d.ts.map +1 -1
  52. package/dist/Form/atoms/InputFileButton.d.ts +1 -1
  53. package/dist/Form/atoms/InputFileButton.d.ts.map +1 -1
  54. package/dist/Form/atoms/Label.d.ts.map +1 -1
  55. package/dist/Form/atoms/RadioButton.d.ts.map +1 -1
  56. package/dist/Form/atoms/SelectField.d.ts.map +1 -1
  57. package/dist/Form/atoms/SliderInput.d.ts.map +1 -1
  58. package/dist/Form/atoms/SmallInput.d.ts.map +1 -1
  59. package/dist/Form/atoms/SplitButtonOption.d.ts.map +1 -1
  60. package/dist/Form/atoms/Switch.d.ts.map +1 -1
  61. package/dist/Form/atoms/TextArea.d.ts.map +1 -1
  62. package/dist/Form/index.d.ts +18 -18
  63. package/dist/Form/index.d.ts.map +1 -1
  64. package/dist/Form/molecules/ActionButtons.d.ts.map +1 -1
  65. package/dist/Form/molecules/ButtonsStack.d.ts.map +1 -1
  66. package/dist/Form/molecules/CropTool.d.ts.map +1 -1
  67. package/dist/Form/molecules/DurationSlider.d.ts.map +1 -1
  68. package/dist/Form/molecules/PasswordField.d.ts.map +1 -1
  69. package/dist/Form/molecules/PercentageSlider.d.ts +1 -1
  70. package/dist/Form/molecules/PercentageSlider.d.ts.map +1 -1
  71. package/dist/Form/molecules/SplitButton.d.ts +1 -1
  72. package/dist/Form/molecules/SplitButton.d.ts.map +1 -1
  73. package/dist/Form/molecules/TextAreaField.d.ts.map +1 -1
  74. package/dist/Form/molecules/TextField.d.ts +1 -1
  75. package/dist/Form/molecules/TextField.d.ts.map +1 -1
  76. package/dist/Form/organisms/AreaUploadManager.d.ts.map +1 -1
  77. package/dist/Form/organisms/AvatarUploader.d.ts.map +1 -1
  78. package/dist/Global/atoms/CloseButton.d.ts.map +1 -1
  79. package/dist/Global/atoms/ContextItem.d.ts +1 -1
  80. package/dist/Global/atoms/ContextItem.d.ts.map +1 -1
  81. package/dist/Global/atoms/DrawerBottomMenu.d.ts.map +1 -1
  82. package/dist/Global/atoms/Layout.d.ts.map +1 -1
  83. package/dist/Global/atoms/MobileLogoLink.d.ts.map +1 -1
  84. package/dist/Global/atoms/MobileNavbarContent.d.ts.map +1 -1
  85. package/dist/Global/atoms/NavigationItem.d.ts +1 -1
  86. package/dist/Global/atoms/NavigationItem.d.ts.map +1 -1
  87. package/dist/Global/atoms/NotificationItem.d.ts.map +1 -1
  88. package/dist/Global/atoms/TopBarBadge.d.ts.map +1 -1
  89. package/dist/Global/atoms/UserDrawerMeta.d.ts.map +1 -1
  90. package/dist/Global/index.d.ts +5 -5
  91. package/dist/Global/index.d.ts.map +1 -1
  92. package/dist/Global/molecules/MobileUserMenu.d.ts.map +1 -1
  93. package/dist/Global/molecules/NotificationsHistory.d.ts.map +1 -1
  94. package/dist/Global/molecules/Sidebar.d.ts.map +1 -1
  95. package/dist/Global/molecules/TopBar.d.ts.map +1 -1
  96. package/dist/Global/molecules/UserMenu.d.ts.map +1 -1
  97. package/dist/Global/organisms/MainMenu.d.ts.map +1 -1
  98. package/dist/Global/organisms/MobileMenu.d.ts.map +1 -1
  99. package/dist/Global/organisms/MobileNavbar.d.ts +1 -1
  100. package/dist/Global/organisms/MobileNavbar.d.ts.map +1 -1
  101. package/dist/Global/templates/GlobalUI.d.ts.map +1 -1
  102. package/dist/Icons/Icon.d.ts +2 -2
  103. package/dist/Icons/Icon.d.ts.map +1 -1
  104. package/dist/Icons/StatusIcon.d.ts.map +1 -1
  105. package/dist/Indicators/Spinner.d.ts.map +1 -1
  106. package/dist/Layouts/atoms/FullWidthContentBlock.d.ts.map +1 -1
  107. package/dist/Layouts/atoms/ResizeLine.d.ts.map +1 -1
  108. package/dist/Layouts/atoms/UtilityHeaderBack.d.ts.map +1 -1
  109. package/dist/Layouts/atoms/UtilityHeaderShare.d.ts.map +1 -1
  110. package/dist/Layouts/index.d.ts +5 -4
  111. package/dist/Layouts/index.d.ts.map +1 -1
  112. package/dist/Layouts/molecules/SplitLayout.d.ts +2 -2
  113. package/dist/Layouts/molecules/SplitLayout.d.ts.map +1 -1
  114. package/dist/Layouts/molecules/UtilityHeader.d.ts.map +1 -1
  115. package/dist/Layouts/organisms/ContentLayout.d.ts.map +1 -1
  116. package/dist/LineUI/Contexts.d.ts +3 -1
  117. package/dist/LineUI/Contexts.d.ts.map +1 -1
  118. package/dist/LineUI/Control.d.ts +1 -3
  119. package/dist/LineUI/Control.d.ts.map +1 -1
  120. package/dist/LineUI/HandleUnit.d.ts +2 -2
  121. package/dist/LineUI/HandleUnit.d.ts.map +1 -1
  122. package/dist/LineUI/LineReducer.d.ts.map +1 -1
  123. package/dist/LineUI/LineSet.d.ts +2 -2
  124. package/dist/LineUI/LineSet.d.ts.map +1 -1
  125. package/dist/LineUI/LineUI.d.ts.map +1 -1
  126. package/dist/LineUI/LineUIRTC.d.ts.map +1 -1
  127. package/dist/LineUI/LineUIVideo.d.ts +1 -18
  128. package/dist/LineUI/LineUIVideo.d.ts.map +1 -1
  129. package/dist/LineUI/LineUIVideoBase.d.ts +25 -0
  130. package/dist/LineUI/LineUIVideoBase.d.ts.map +1 -0
  131. package/dist/LineUI/LineUnit.d.ts +3 -3
  132. package/dist/LineUI/LineUnit.d.ts.map +1 -1
  133. package/dist/LineUI/index.d.ts +5 -5
  134. package/dist/LineUI/index.d.ts.map +1 -1
  135. package/dist/LineUIHls/LineUIVideoHLS.d.ts +5 -0
  136. package/dist/LineUIHls/LineUIVideoHLS.d.ts.map +1 -0
  137. package/dist/LineUIHls/index.d.ts +4 -0
  138. package/dist/LineUIHls/index.d.ts.map +1 -0
  139. package/dist/LineUIVideoBase-09sEI3pc.mjs +1240 -0
  140. package/dist/LineUIVideoBase-09sEI3pc.mjs.map +1 -0
  141. package/dist/LineUIVideoBase-Bs3WCeWl.js +1335 -0
  142. package/dist/LineUIVideoBase-Bs3WCeWl.js.map +1 -0
  143. package/dist/Misc/atoms/ActionsBar.d.ts.map +1 -1
  144. package/dist/Misc/atoms/BasicSearchInput.d.ts.map +1 -1
  145. package/dist/Misc/atoms/BigIconsSummary.d.ts.map +1 -1
  146. package/dist/Misc/atoms/MediaBox.d.ts.map +1 -1
  147. package/dist/Misc/atoms/Tag.d.ts.map +1 -1
  148. package/dist/Misc/index.d.ts +5 -5
  149. package/dist/Misc/index.d.ts.map +1 -1
  150. package/dist/Misc/molecules/DebouncedSearcher.d.ts.map +1 -1
  151. package/dist/Misc/molecules/Pagination.d.ts.map +1 -1
  152. package/dist/Misc/molecules/TagList.d.ts.map +1 -1
  153. package/dist/Modals/ConfirmationModal.d.ts.map +1 -1
  154. package/dist/Modals/Modal.d.ts.map +1 -1
  155. package/dist/Modals/index.d.ts +2 -2
  156. package/dist/Modals/index.d.ts.map +1 -1
  157. package/dist/Pages/atoms/IntroductionText.d.ts.map +1 -1
  158. package/dist/Pages/atoms/PageTitle.d.ts.map +1 -1
  159. package/dist/Pages/index.d.ts +3 -3
  160. package/dist/Pages/index.d.ts.map +1 -1
  161. package/dist/Pages/molecules/MultilineContent.d.ts.map +1 -1
  162. package/dist/Pages/molecules/PageHeader.d.ts.map +1 -1
  163. package/dist/Tables/atoms/TableHeaderTitle.d.ts.map +1 -1
  164. package/dist/Tables/atoms/TableRowThumbnail.d.ts.map +1 -1
  165. package/dist/Tables/atoms/TypeTableCell.d.ts +1 -1
  166. package/dist/Tables/atoms/TypeTableCell.d.ts.map +1 -1
  167. package/dist/Tables/atoms/TypeTableDeviceStatus.d.ts +1 -1
  168. package/dist/Tables/atoms/TypeTableDeviceStatus.d.ts.map +1 -1
  169. package/dist/Tables/atoms/TypeTableRow.d.ts +2 -2
  170. package/dist/Tables/atoms/TypeTableRow.d.ts.map +1 -1
  171. package/dist/Tables/index.d.ts +6 -6
  172. package/dist/Tables/index.d.ts.map +1 -1
  173. package/dist/Tables/molecules/EditCell.d.ts.map +1 -1
  174. package/dist/Tables/molecules/TypeTableHeader.d.ts.map +1 -1
  175. package/dist/Tables/organisms/TypeTable.d.ts.map +1 -1
  176. package/dist/Tabs/TabContent.d.ts.map +1 -1
  177. package/dist/Tabs/TabList.d.ts.map +1 -1
  178. package/dist/Tabs/Tabs.d.ts.map +1 -1
  179. package/dist/Tabs/atoms/MobileTab.d.ts.map +1 -1
  180. package/dist/Tabs/atoms/Tab.d.ts.map +1 -1
  181. package/dist/Tabs/atoms/TabWithIcon.d.ts.map +1 -1
  182. package/dist/Tabs/index.d.ts +5 -5
  183. package/dist/Tabs/index.d.ts.map +1 -1
  184. package/dist/Tabs/molecules/TabsWithIconBar.d.ts.map +1 -1
  185. package/dist/WebRTCClient.d.ts.map +1 -1
  186. package/dist/common/ContentPlaceholder.d.ts.map +1 -1
  187. package/dist/common/index.d.ts.map +1 -1
  188. package/dist/context/ModalContext.d.ts.map +1 -1
  189. package/dist/context/NotificationContext.d.ts +1 -1
  190. package/dist/context/NotificationContext.d.ts.map +1 -1
  191. package/dist/context/index.d.ts +2 -2
  192. package/dist/context/index.d.ts.map +1 -1
  193. package/dist/fonts/index.d.ts.map +1 -1
  194. package/dist/helpers/cropToolHelpers.d.ts +3 -3
  195. package/dist/helpers/cropToolHelpers.d.ts.map +1 -1
  196. package/dist/helpers/index.d.ts +3 -3
  197. package/dist/helpers/index.d.ts.map +1 -1
  198. package/dist/hls.js +70 -0
  199. package/dist/hls.js.map +1 -0
  200. package/dist/hls.modern.js +68 -0
  201. package/dist/hls.modern.js.map +1 -0
  202. package/dist/hooks/index.d.ts +9 -9
  203. package/dist/hooks/index.d.ts.map +1 -1
  204. package/dist/hooks/useBreakpoints.d.ts.map +1 -1
  205. package/dist/hooks/useClickOutside.d.ts +2 -1
  206. package/dist/hooks/useClickOutside.d.ts.map +1 -1
  207. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -1
  208. package/dist/hooks/useInterval.d.ts.map +1 -1
  209. package/dist/hooks/useLocalStorage.d.ts.map +1 -1
  210. package/dist/hooks/useMediaModal.d.ts.map +1 -1
  211. package/dist/hooks/useMediaQuery.d.ts.map +1 -1
  212. package/dist/hooks/useMenu.d.ts.map +1 -1
  213. package/dist/hooks/useModal.d.ts.map +1 -1
  214. package/dist/hooks/usePoll.d.ts.map +1 -1
  215. package/dist/hooks/useThemeToggle.d.ts.map +1 -1
  216. package/dist/hooks/useTitle.d.ts.map +1 -1
  217. package/dist/index.d.ts +3 -3
  218. package/dist/index.d.ts.map +1 -1
  219. package/dist/index.js +11748 -13001
  220. package/dist/index.js.map +1 -1
  221. package/dist/index.modern.js +10660 -11886
  222. package/dist/index.modern.js.map +1 -1
  223. package/dist/styled.d.ts +7 -0
  224. package/dist/styled.d.ts.map +1 -0
  225. package/dist/svg/AvatarPlaceholder.d.ts +2 -2
  226. package/dist/svg/AvatarPlaceholder.d.ts.map +1 -1
  227. package/dist/svg/Invalid.d.ts +2 -2
  228. package/dist/svg/Invalid.d.ts.map +1 -1
  229. package/dist/svg/LogoMark.d.ts +2 -2
  230. package/dist/svg/LogoMark.d.ts.map +1 -1
  231. package/dist/svg/LogoText.d.ts +2 -2
  232. package/dist/svg/LogoText.d.ts.map +1 -1
  233. package/dist/svg/NoImage.d.ts.map +1 -1
  234. package/dist/svg/NoImageBig.d.ts +2 -2
  235. package/dist/svg/NoImageBig.d.ts.map +1 -1
  236. package/dist/svg/PasswordHide.d.ts +2 -2
  237. package/dist/svg/PasswordHide.d.ts.map +1 -1
  238. package/dist/svg/PasswordShow.d.ts +2 -2
  239. package/dist/svg/PasswordShow.d.ts.map +1 -1
  240. package/dist/svg/Required.d.ts +2 -2
  241. package/dist/svg/Required.d.ts.map +1 -1
  242. package/dist/svg/Success.d.ts +2 -2
  243. package/dist/svg/Success.d.ts.map +1 -1
  244. package/dist/svg/checkmark.d.ts.map +1 -1
  245. package/dist/svg/index.d.ts +4 -4
  246. package/dist/svg/index.d.ts.map +1 -1
  247. package/dist/svg/input.d.ts +1 -1
  248. package/dist/theme/ThemeHelpers.d.ts.map +1 -1
  249. package/dist/theme/ThemeVariables.d.ts.map +1 -1
  250. package/dist/theme/common.d.ts.map +1 -1
  251. package/dist/theme/index.d.ts.map +1 -1
  252. package/dist/theme/legacy/custom.d.ts.map +1 -1
  253. package/dist/theme/legacy/styles.d.ts.map +1 -1
  254. package/dist/theme/legacy/typography.d.ts +1 -1
  255. package/dist/theme/legacy/typography.d.ts.map +1 -1
  256. package/package.json +17 -12
@@ -0,0 +1,1240 @@
1
+ import styled, { css, keyframes } from "styled-components";
2
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { IconSVGs } from "@future-standard/icons";
5
+ import update from "immutability-helper";
6
+ //#region src/theme/common.tsx
7
+ var fontFamily = {
8
+ ui: "Monorale, Hiragino Sans, \"ヒラギノ角ゴシック\", Hiragino Kaku Gothic ProN, \"ヒラギノ角ゴ ProN W3\", Roboto, YuGothic, \"游ゴシック\", Meiryo, \"メイリオ\", sans-serif;",
9
+ data: "Lato, Hiragino Sans, \"ヒラギノ角ゴシック\", Hiragino Kaku Gothic ProN, \"ヒラギノ角ゴ ProN W3\", Roboto, YuGothic, \"游ゴシック\", Meiryo, \"メイリオ\", sans-serif;"
10
+ };
11
+ var dimensions = {
12
+ icons: { weights: {
13
+ light: 1,
14
+ regular: 1.5,
15
+ heavy: 3,
16
+ strong: 5
17
+ } },
18
+ form: {
19
+ button: {
20
+ xsmall: {
21
+ height: "20px",
22
+ padding: "0 10px",
23
+ iconSize: 12
24
+ },
25
+ small: {
26
+ height: "30px",
27
+ padding: "0 20px",
28
+ iconSize: 14
29
+ },
30
+ normal: {
31
+ height: "40px",
32
+ padding: "0 20px",
33
+ iconSize: 16
34
+ },
35
+ large: {
36
+ height: "60px",
37
+ padding: "0 20px",
38
+ iconSize: 20
39
+ }
40
+ },
41
+ input: { height: "40px" },
42
+ switch: {
43
+ outer: {
44
+ width: "38px",
45
+ height: "22px",
46
+ borderRadius: "11px"
47
+ },
48
+ inner: {
49
+ width: "16px",
50
+ height: "16px",
51
+ borderRadius: "8px"
52
+ },
53
+ positions: {
54
+ top: "2px",
55
+ off: "2px",
56
+ neutral: "10px",
57
+ locked: "2px",
58
+ on: "18px"
59
+ }
60
+ }
61
+ },
62
+ global: { mainMenu: { width: {
63
+ open: "280px",
64
+ closed: "80px"
65
+ } } }
66
+ };
67
+ var animation$1 = {
68
+ easing: { primary: {
69
+ inOut: "cubic-bezier(0.87, 0, 0.13, 1)",
70
+ out: "cubic-bezier(0.16, 1, 0.3, 1)",
71
+ in: "cubic-bezier(0.7, 0, 0.84, 0)"
72
+ } },
73
+ speed: {
74
+ faster: "0.085s",
75
+ fast: "0.175s",
76
+ normal: "0.35s",
77
+ slow: "0.7s",
78
+ slower: "1.4s",
79
+ slowest: "2.8s"
80
+ }
81
+ };
82
+ var deviceSize = {
83
+ small: 0,
84
+ medium: 768,
85
+ large: 1024,
86
+ xlarge: 1280,
87
+ xxlarge: 1536
88
+ };
89
+ var deviceMediaQuery = {
90
+ small: `(min-width: ${deviceSize.small}px)`,
91
+ medium: `(min-width: ${deviceSize.medium}px)`,
92
+ large: `(min-width: ${deviceSize.large}px)`,
93
+ xlarge: `(min-width: ${deviceSize.xlarge}px)`,
94
+ xxlarge: `(min-width: ${deviceSize.xxlarge}px)`
95
+ };
96
+ //#endregion
97
+ //#region src/Icons/Icon.tsx
98
+ var wrapperCss = css`
99
+
100
+ line-height: 0;
101
+
102
+ svg {
103
+ overflow: visible;
104
+ vector-effect: non-scaling-stroke;
105
+
106
+ line, path, circle, ellipse, foreignObject, polygon, polyline, rect, text, textPath, tspan {
107
+ vector-effect: non-scaling-stroke;
108
+ transition: stroke var(--speed-normal) var(--easing-primary-out);
109
+ }
110
+ }
111
+ `;
112
+ var IconWrapper = styled.div`
113
+ ${wrapperCss};
114
+ `;
115
+ var IconWrapperForSVG = styled.g`
116
+ ${wrapperCss};
117
+ `;
118
+ var Icon = ({ icon, size = 24, weight = "regular", color = "grey-12", forSvgUsage = false }) => {
119
+ const iconWeight = dimensions.icons.weights[weight];
120
+ const IconSVG = IconSVGs[icon];
121
+ return IconSVG != null ? forSvgUsage ? /* @__PURE__ */ jsx(IconWrapperForSVG, { children: IconSVG({
122
+ size,
123
+ weight: iconWeight,
124
+ color: `var(--${color}, var(--grey-12))`
125
+ }) }) : /* @__PURE__ */ jsx(IconWrapper, { children: IconSVG({
126
+ size,
127
+ weight: iconWeight,
128
+ color: `var(--${color}, var(--grey-12))`
129
+ }) }) : null;
130
+ };
131
+ //#endregion
132
+ //#region src/Indicators/Spinner.tsx
133
+ var circumference = (radius) => {
134
+ return 2 * Math.PI * radius;
135
+ };
136
+ var animation = (radius) => {
137
+ const c = circumference(radius);
138
+ return keyframes`
139
+ 0% {
140
+ stroke-dashoffset: -${c * .85};
141
+ }
142
+ 50% {
143
+ stroke-dashoffset: -${c * .5};
144
+ }
145
+ 100% {
146
+ stroke-dashoffset: -${c * .85};
147
+ }
148
+ `;
149
+ };
150
+ var rotate = keyframes`
151
+ 0% {
152
+ transform: rotate(0deg);
153
+ }
154
+ 100% {
155
+ transform: rotate(360deg);
156
+ }
157
+ `;
158
+ var BaseCircle = styled.circle`
159
+ stroke: ${({ $styling, $customColor }) => $customColor ? $customColor : `var(--spinner-${$styling}-base, var(--grey-a8))`};
160
+ fill: none;
161
+ `;
162
+ var RotatingCircle = styled.circle`
163
+ stroke: ${({ $styling, $customColor }) => $customColor ? $customColor : `var(--spinner-${$styling}-top, var(--white-1))`};
164
+ fill: none;
165
+ stroke-dasharray: ${({ r }) => circumference(r)};
166
+ stroke-dashoffset: ${({ r }) => 2 * Math.PI * r / 2};
167
+ animation:
168
+ ${({ r }) => animation(r)} 4s linear infinite,
169
+ ${rotate} 1s linear infinite;
170
+ stroke-linecap: round;
171
+ `;
172
+ var getButtonDesign = (value) => {
173
+ if (value === "primary" || value === "secondary" || value === "warning") return value;
174
+ else if (value === "danger") {
175
+ console.warn("Button.tsx - Warning, the design prop value `danger` is being deprecated. Use `warning` instead.");
176
+ return "danger";
177
+ }
178
+ return "simple";
179
+ };
180
+ var sizeGuide = {
181
+ xsmall: 12,
182
+ small: 16,
183
+ medium: 24,
184
+ large: 36,
185
+ xlarge: 48
186
+ };
187
+ var Spinner = ({ size = "medium", styling = "primary", custom = {} }) => {
188
+ const { baseColor, topColor } = custom;
189
+ const sizeVal = custom?.size ? custom.size : sizeGuide[size];
190
+ const strokeWidth = sizeVal / 5.333;
191
+ const circleRadius = sizeVal / 2 - strokeWidth / 2;
192
+ return /* @__PURE__ */ jsxs("svg", {
193
+ viewBox: `-${sizeVal / 2} -${sizeVal / 2} ${sizeVal} ${sizeVal}`,
194
+ width: sizeVal,
195
+ height: sizeVal,
196
+ xmlns: "http://www.w3.org/2000/svg",
197
+ role: "img",
198
+ "aria-label": "Loading",
199
+ children: [/* @__PURE__ */ jsx(BaseCircle, {
200
+ cx: "0",
201
+ cy: "0",
202
+ r: circleRadius,
203
+ strokeWidth,
204
+ $styling: getButtonDesign(styling),
205
+ $customColor: baseColor
206
+ }), /* @__PURE__ */ jsx(RotatingCircle, {
207
+ cx: "0",
208
+ cy: "0",
209
+ r: circleRadius,
210
+ strokeWidth,
211
+ $styling: getButtonDesign(styling),
212
+ $customColor: topColor
213
+ })]
214
+ });
215
+ };
216
+ //#endregion
217
+ //#region src/LineUI/Contexts.tsx
218
+ var LineSetContext = createContext({});
219
+ //#endregion
220
+ //#region src/LineUI/HandleUnit.tsx
221
+ var HandleTouchReactionKeyframes = keyframes`
222
+ 0% {
223
+ transform: scale(1);
224
+ }
225
+
226
+ 75% {
227
+ transform: scale(3);
228
+ }
229
+
230
+ 100% {
231
+ transform: scale(1.75);
232
+ }
233
+ `;
234
+ var HandleMouseReactionKeyframes = keyframes`
235
+ 0% {
236
+ transform: scale(1);
237
+ }
238
+
239
+ 75% {
240
+ transform: scale(0);
241
+ }
242
+
243
+ 100% {
244
+ transform: scale(0.5);
245
+ }
246
+ `;
247
+ var HandleBase = styled.svg`
248
+ touch-action: none;
249
+ user-select: none;
250
+ overflow: visible;
251
+ cursor: pointer;
252
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].handleBase.fill};
253
+ appearance: none;
254
+ `;
255
+ var HandleRingLayer = styled.circle`
256
+ fill: none;
257
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].handleRingLayer.stroke};
258
+ mask: url(#${(props) => props.$maskID});
259
+ `;
260
+ var HandleReactiveGroup = styled.g`
261
+ opacity: 0.65;
262
+ cursor: pointer;
263
+ transform: scale(1);
264
+
265
+ ${(props) => props.$touchDragging && css`
266
+ animation: ${HandleTouchReactionKeyframes} 0.5s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275) 1;
267
+ `}
268
+
269
+ ${(props) => props.$mouseDragging && css`
270
+ animation: ${HandleMouseReactionKeyframes} 0.25s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275) 1;
271
+ `}
272
+
273
+ `;
274
+ var HandleReactiveFill = styled.circle`
275
+ mix-blend-mode: multiply;
276
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].handleReactiveFill.fill};
277
+ stroke: none;
278
+ `;
279
+ var HandleReactiveRing = styled.circle`
280
+ fill: none;
281
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].handleReactiveRing.stroke};
282
+ `;
283
+ var HandleContrastLayer = styled.circle`
284
+ overflow: visible;
285
+ mix-blend-mode: multiply;
286
+ fill: none;
287
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].handleContrastLayer.stroke};
288
+ `;
289
+ var HandleShadowLayer = styled.circle`
290
+ mix-blend-mode: multiply;
291
+ fill: url(#${(props) => props.$fillID});
292
+ `;
293
+ var GrabHandleIndexGroup$1 = styled.g`
294
+ opacity: 0;
295
+ pointer-events: none;
296
+ ${(props) => props.$showIndex && css`
297
+ opacity: 1;
298
+ `};
299
+
300
+ `;
301
+ var StopStart = styled.stop`
302
+ stop-color: ${({ theme, $styling }) => theme.custom.lines[$styling].stopStart.stopColor};
303
+ `;
304
+ var StopEnd = styled.stop`
305
+ stop-color: ${({ theme, $styling }) => theme.custom.lines[$styling].stopEnd.stopColor};
306
+ `;
307
+ var GrabHandleIndexText$1 = styled.text`
308
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
309
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].grabHandleText.stroke};
310
+ text-align: center;
311
+
312
+ font-weight: bold;
313
+ transition: opacity 250ms ease;
314
+ pointer-events: none;
315
+
316
+
317
+ `;
318
+ var IconGroup = styled.g`
319
+
320
+ `;
321
+ var HandleUnit = (props) => {
322
+ const { index, useAngles, angle, unit, size, lineSetId, x, y, moveCallback, moveEndCB = () => {}, Icon, rotate = 0, options, readOnlyHandle = false, styling = "primary" } = props;
323
+ const handleInstance = useRef(null);
324
+ const [touchDragging, setTouchDragging] = useState(false);
325
+ const [mouseDragging, setMouseDragging] = useState(false);
326
+ const [touchIndex, setTouchIndex] = useState(null);
327
+ /** --- Toucher Events Section --- */
328
+ const handleTouchStart = useCallback((e) => {
329
+ e.preventDefault();
330
+ if (readOnlyHandle) return;
331
+ for (let i = 0; i < e.touches.length; i++) {
332
+ const touchTarget = e.touches[i].target;
333
+ if (touchTarget.parentNode?.parentElement === handleInstance.current || touchTarget.parentNode?.parentElement?.parentElement) {
334
+ setTouchDragging(true);
335
+ setTouchIndex(i);
336
+ }
337
+ }
338
+ }, [readOnlyHandle]);
339
+ const handleTouchEnd = useCallback(() => {
340
+ if (readOnlyHandle) return;
341
+ setTouchDragging(false);
342
+ setTouchIndex(null);
343
+ moveEndCB();
344
+ }, [moveEndCB, readOnlyHandle]);
345
+ const handleTouchMove = useCallback((e) => {
346
+ if (readOnlyHandle) return;
347
+ for (let i = 0; i < e.touches.length; i++) if (i === touchIndex) moveCallback({
348
+ x: e.touches[i].pageX,
349
+ y: e.touches[i].pageY
350
+ }, index);
351
+ }, [
352
+ index,
353
+ moveCallback,
354
+ readOnlyHandle,
355
+ touchIndex
356
+ ]);
357
+ /** --- Mouse Events Section --- */
358
+ const handleMouseMoveRef = useRef(null);
359
+ const handleMouseUpRef = useRef(null);
360
+ const cleanupMouseListeners = useCallback(() => {
361
+ if (handleMouseMoveRef.current) {
362
+ window.removeEventListener("mousemove", handleMouseMoveRef.current);
363
+ handleMouseMoveRef.current = null;
364
+ }
365
+ if (handleMouseUpRef.current) {
366
+ window.removeEventListener("mouseup", handleMouseUpRef.current);
367
+ handleMouseUpRef.current = null;
368
+ }
369
+ }, []);
370
+ const handleMouseMove = useCallback((e) => {
371
+ e.preventDefault();
372
+ if (readOnlyHandle) return;
373
+ moveCallback({
374
+ x: e.pageX,
375
+ y: e.pageY
376
+ }, index);
377
+ }, [
378
+ index,
379
+ moveCallback,
380
+ readOnlyHandle
381
+ ]);
382
+ const handleMouseUp = useCallback((e) => {
383
+ e.preventDefault();
384
+ if (readOnlyHandle) return;
385
+ setMouseDragging(false);
386
+ cleanupMouseListeners();
387
+ moveCallback({
388
+ x: e.pageX,
389
+ y: e.pageY
390
+ }, index);
391
+ setTimeout(moveEndCB);
392
+ }, [
393
+ cleanupMouseListeners,
394
+ index,
395
+ moveCallback,
396
+ moveEndCB,
397
+ readOnlyHandle
398
+ ]);
399
+ const handleMouseDown = useCallback((e) => {
400
+ e.preventDefault();
401
+ if (readOnlyHandle) return;
402
+ cleanupMouseListeners();
403
+ setMouseDragging(true);
404
+ handleMouseMoveRef.current = handleMouseMove;
405
+ handleMouseUpRef.current = handleMouseUp;
406
+ window.addEventListener("mousemove", handleMouseMove);
407
+ window.addEventListener("mouseup", handleMouseUp);
408
+ }, [
409
+ cleanupMouseListeners,
410
+ handleMouseMove,
411
+ handleMouseUp,
412
+ readOnlyHandle
413
+ ]);
414
+ useEffect(() => {
415
+ return cleanupMouseListeners;
416
+ }, [cleanupMouseListeners]);
417
+ const maskID = useAngles ? `mask-${lineSetId}-${index}` : "";
418
+ const shadowGradientID = `shadowGradient-${lineSetId}-${index}`;
419
+ const { showPointHandle = true, showPointLabel = false, pointIndexOffset } = options;
420
+ return /* @__PURE__ */ jsxs(HandleBase, {
421
+ ref: handleInstance,
422
+ $styling: styling,
423
+ x,
424
+ y,
425
+ $mouseDragging: mouseDragging,
426
+ onTouchStart: handleTouchStart,
427
+ onTouchEnd: handleTouchEnd,
428
+ onTouchMove: handleTouchMove,
429
+ onMouseDown: handleMouseDown,
430
+ children: [/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("mask", {
431
+ id: maskID,
432
+ children: [/* @__PURE__ */ jsx("rect", {
433
+ width: "100%",
434
+ height: "100%",
435
+ x: "-50%",
436
+ y: "-50%",
437
+ fill: "white"
438
+ }), /* @__PURE__ */ jsx("rect", {
439
+ width: size / 3,
440
+ height: size / .9,
441
+ x: -(size / 3 / 2),
442
+ y: -(size / .9 + 5),
443
+ fill: "black",
444
+ transform: `rotate(${angle || 0} 0 0)`
445
+ })]
446
+ }), /* @__PURE__ */ jsxs("radialGradient", {
447
+ id: shadowGradientID,
448
+ children: [/* @__PURE__ */ jsx(StopStart, {
449
+ $styling: styling,
450
+ offset: "0%"
451
+ }), /* @__PURE__ */ jsx(StopEnd, {
452
+ $styling: styling,
453
+ offset: "80%"
454
+ })]
455
+ })] }), Icon ? /* @__PURE__ */ jsx(IconGroup, {
456
+ transform: `scale(${unit * 1.5}) translate(-21 -21) rotate(${rotate}, 21, 21 )`,
457
+ children: /* @__PURE__ */ jsx(Icon, {
458
+ height: "42",
459
+ width: "42"
460
+ })
461
+ }) : showPointHandle && /* @__PURE__ */ jsxs("g", {
462
+ transform: `scale(${unit})`,
463
+ children: [
464
+ /* @__PURE__ */ jsx(HandleShadowLayer, {
465
+ r: size * 1,
466
+ $fillID: shadowGradientID
467
+ }),
468
+ /* @__PURE__ */ jsx(HandleContrastLayer, {
469
+ $styling: styling,
470
+ r: size / 2.4,
471
+ strokeWidth: size / 3
472
+ }),
473
+ /* @__PURE__ */ jsxs(HandleReactiveGroup, {
474
+ $touchDragging: touchDragging,
475
+ $mouseDragging: mouseDragging,
476
+ children: [/* @__PURE__ */ jsx(HandleReactiveFill, {
477
+ $styling: styling,
478
+ r: size / 1.8
479
+ }), /* @__PURE__ */ jsx(HandleReactiveRing, {
480
+ $styling: styling,
481
+ r: size / 2.25,
482
+ strokeWidth: size / 3
483
+ })]
484
+ }),
485
+ /* @__PURE__ */ jsx(HandleRingLayer, {
486
+ $styling: styling,
487
+ r: size / 2,
488
+ strokeWidth: size / 6,
489
+ $maskID: maskID
490
+ }),
491
+ showPointLabel && /* @__PURE__ */ jsx(GrabHandleIndexGroup$1, {
492
+ $showIndex: true,
493
+ children: /* @__PURE__ */ jsx(GrabHandleIndexText$1, {
494
+ $styling: styling,
495
+ transform: "translate(-5,6)",
496
+ fontSize: "20px",
497
+ $showIndex: true,
498
+ children: index + pointIndexOffset
499
+ })
500
+ })
501
+ ]
502
+ })]
503
+ });
504
+ };
505
+ //#endregion
506
+ //#region src/LineUI/LineUnit.tsx
507
+ var ContrastLine = styled.line`
508
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].contrastLine.stroke};
509
+ mix-blend-mode: multiply;
510
+ stroke-width: ${({ $lineClickSensing }) => $lineClickSensing}px;
511
+ stroke-opacity: ${({ $showLineBorder }) => $showLineBorder ? "0.35" : "0"};
512
+ cursor: pointer;
513
+ `;
514
+ var HighlightLine = styled.line`
515
+ pointer-events: none;
516
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].highlightLineBorder.stroke};
517
+ `;
518
+ var GrabHandle = styled.circle`
519
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].grabHandle.fill};
520
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].grabHandle.stroke};
521
+ opacity: 1;
522
+ transition: opacity 250ms ease;
523
+ cursor: grab;
524
+
525
+ ${(props) => props.$hide && css`
526
+ pointer-events: none;
527
+ opacity: 0;
528
+ `};
529
+ `;
530
+ var GrabHandleIndexGroup = styled.g`
531
+ opacity: 0;
532
+ pointer-events: none;
533
+ ${(props) => props.$showIndex && css`
534
+ opacity: 1;
535
+ `};
536
+
537
+ `;
538
+ var GrabHandleIndexText = styled.text`
539
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
540
+ text-align: center;
541
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].grabHandleText.stroke};
542
+ font-weight: bold;
543
+ transition: opacity 250ms ease;
544
+ pointer-events: none;
545
+ `;
546
+ var LabelText = styled.text`
547
+ text-align: center;
548
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].label.fill};
549
+ font-weight: bold;
550
+ transition: opacity 250ms ease;
551
+ cursor: pointer;
552
+ ${({ $showLabelShadow }) => $showLabelShadow && css`
553
+ text-shadow:
554
+ -1px -1px 0 #000,
555
+ 1px -1px 0 #000,
556
+ -1px 1px 0 #000,
557
+ 1px 1px 0 #000;
558
+ `}
559
+ `;
560
+ var GrabHandleContrast = styled(GrabHandle)`
561
+ fill: none;
562
+ stroke: ${({ theme, $styling }) => theme.custom.lines[$styling].grabHandleContrast.stroke};
563
+ `;
564
+ var GrabHandleGroup = styled.g`
565
+
566
+ ${GrabHandle}, ${GrabHandleContrast} {
567
+ transition: r 250ms ease;
568
+ }
569
+
570
+ ${(props) => props.$showIndex && css`
571
+ ${GrabHandle}, ${GrabHandleContrast} {
572
+ pointer-events: none;
573
+ r: ${props.$originalRadius * 1.75};
574
+ }
575
+ `};
576
+ `;
577
+ var DMCircle = styled.circle`
578
+ fill: hsla(203, 100%, 35%, 0.49);
579
+ cursor: pointer;
580
+ `;
581
+ var IconFormat = styled(Icon)`
582
+ cursor: pointer;
583
+ `;
584
+ var LineUnit = (props) => {
585
+ const { x1, y1, x2, y2, unit, lineMoveCallback, lineMoveStartCallback, options, lineSetId, label, styling = "primary", moveEndCB = () => {}, lineClickCallback = () => {}, showSmallDirectionMark = false, overrideShowMoveHandle = true } = props;
586
+ const { handleFinderActive, revealSetIndex, showMoveHandle, setIndexOffset, showDirectionMark, showLabelShadow = false } = options;
587
+ const [showLineBorder, setShowLineBorder] = useState();
588
+ const hideGrabHandle = !showMoveHandle || !overrideShowMoveHandle;
589
+ const lineClickSensing = parseInt(props.lineClickSensingBorder, 10);
590
+ /** --- Toucher Events Section --- */
591
+ const grabTouchMove = (e) => {
592
+ for (let i = 0; i < e.touches.length; i++) lineMoveCallback({
593
+ x: e.touches[i].pageX,
594
+ y: e.touches[i].pageY
595
+ });
596
+ moveEndCB();
597
+ };
598
+ const grabTouchStart = (e) => {
599
+ for (let i = 0; i < e.touches.length; i++) lineMoveStartCallback({
600
+ x: e.touches[i].pageX,
601
+ y: e.touches[i].pageY
602
+ });
603
+ };
604
+ /** --- Mouse Events Section --- */
605
+ const mouseMoveRef = useRef(null);
606
+ const mouseUpRef = useRef(null);
607
+ const cleanupMouseListeners = useCallback(() => {
608
+ if (mouseMoveRef.current) {
609
+ window.removeEventListener("mousemove", mouseMoveRef.current);
610
+ mouseMoveRef.current = null;
611
+ }
612
+ if (mouseUpRef.current) {
613
+ window.removeEventListener("mouseup", mouseUpRef.current);
614
+ mouseUpRef.current = null;
615
+ }
616
+ }, []);
617
+ const handleMouseMove = useCallback((e) => {
618
+ lineMoveCallback({
619
+ x: e.pageX,
620
+ y: e.pageY
621
+ });
622
+ e.preventDefault();
623
+ }, [lineMoveCallback]);
624
+ const handleMouseUp = useCallback((e) => {
625
+ cleanupMouseListeners();
626
+ lineMoveCallback({
627
+ x: e.pageX,
628
+ y: e.pageY
629
+ });
630
+ moveEndCB();
631
+ e.preventDefault();
632
+ }, [
633
+ cleanupMouseListeners,
634
+ lineMoveCallback,
635
+ moveEndCB
636
+ ]);
637
+ const handleMouseDown = useCallback((e) => {
638
+ cleanupMouseListeners();
639
+ lineMoveStartCallback({
640
+ x: e.pageX,
641
+ y: e.pageY
642
+ });
643
+ mouseMoveRef.current = handleMouseMove;
644
+ mouseUpRef.current = handleMouseUp;
645
+ window.addEventListener("mousemove", handleMouseMove);
646
+ window.addEventListener("mouseup", handleMouseUp);
647
+ e.preventDefault();
648
+ }, [
649
+ cleanupMouseListeners,
650
+ lineMoveStartCallback,
651
+ handleMouseMove,
652
+ handleMouseUp
653
+ ]);
654
+ useEffect(() => {
655
+ return cleanupMouseListeners;
656
+ }, [cleanupMouseListeners]);
657
+ const midpoint = {
658
+ x: (x2 + x1) / 2,
659
+ y: (y2 + y1) / 2
660
+ };
661
+ const directionMarkCoordinate = () => {
662
+ const angle = Math.atan2(y2 - y1, x2 - x1);
663
+ const angleMode = Math.PI / 2 - angle;
664
+ const x = midpoint.x + Math.sin(angleMode) - 5;
665
+ const y = midpoint.y + Math.cos(angleMode);
666
+ const rotate = 180 / Math.PI * Math.atan2(y2 - y1, x2 - x1);
667
+ return {
668
+ x,
669
+ y,
670
+ rotate,
671
+ labelRotate: -rotate
672
+ };
673
+ };
674
+ const getDirectionMarkLine = () => {
675
+ const dmCoordinate = directionMarkCoordinate();
676
+ return /* @__PURE__ */ jsxs("g", {
677
+ transform: `translate(${dmCoordinate.x},${dmCoordinate.y}) rotate(${dmCoordinate.rotate}) scale(${unit * 1})`,
678
+ style: { cursor: "pointer" },
679
+ children: [
680
+ /* @__PURE__ */ jsxs("g", {
681
+ onClick: () => lineClickCallback(lineSetId),
682
+ transform: "translate(-3,-30) scale(0.8)",
683
+ children: [/* @__PURE__ */ jsx(DMCircle, {
684
+ r: 12,
685
+ cx: 6,
686
+ cy: 7
687
+ }), /* @__PURE__ */ jsx(IconFormat, {
688
+ color: "inverse",
689
+ icon: "Up",
690
+ size: 12,
691
+ weight: "heavy",
692
+ forSvgUsage: true
693
+ })]
694
+ }),
695
+ showSmallDirectionMark && /* @__PURE__ */ jsxs("g", {
696
+ onClick: () => lineClickCallback(lineSetId),
697
+ transform: "translate(5,25) rotate(-180) scale(0.8)",
698
+ children: [/* @__PURE__ */ jsx(DMCircle, {
699
+ r: 8,
700
+ cx: 3.5,
701
+ cy: 4.5
702
+ }), /* @__PURE__ */ jsx(IconFormat, {
703
+ color: "inverse",
704
+ icon: "Up",
705
+ size: 7,
706
+ weight: "heavy",
707
+ forSvgUsage: true
708
+ })]
709
+ }),
710
+ label && /* @__PURE__ */ jsx("g", {
711
+ transform: `translate(0,${showSmallDirectionMark ? 45 : 30}) rotate(${dmCoordinate.labelRotate})`,
712
+ children: /* @__PURE__ */ jsx(LabelText, {
713
+ onClick: () => lineClickCallback(lineSetId),
714
+ textAnchor: showSmallDirectionMark ? dmCoordinate.labelRotate < 0 ? "end" : "start" : "middle",
715
+ dominantBaseline: "middle",
716
+ $styling: styling,
717
+ fontSize: `14px`,
718
+ x: 0,
719
+ y: 0,
720
+ $showIndex: revealSetIndex || handleFinderActive,
721
+ $showLabelShadow: showLabelShadow,
722
+ children: label
723
+ })
724
+ })
725
+ ]
726
+ });
727
+ };
728
+ return /* @__PURE__ */ jsxs("g", { children: [
729
+ /* @__PURE__ */ jsx(ContrastLine, {
730
+ onMouseOver: useCallback(() => {
731
+ if (props.hasClickSensingBorder) setShowLineBorder(true);
732
+ }, [props.hasClickSensingBorder]),
733
+ onMouseOut: useCallback(() => {
734
+ if (props.hasClickSensingBorder) setShowLineBorder(false);
735
+ }, [props.hasClickSensingBorder]),
736
+ $lineClickSensing: lineClickSensing,
737
+ $showLineBorder: showLineBorder,
738
+ onClick: () => lineClickCallback(lineSetId),
739
+ $styling: styling,
740
+ strokeLinecap: "round",
741
+ x1,
742
+ y1,
743
+ x2,
744
+ y2,
745
+ strokeWidth: 4 * unit
746
+ }),
747
+ /* @__PURE__ */ jsx(HighlightLine, {
748
+ $styling: styling,
749
+ x1,
750
+ y1,
751
+ x2,
752
+ y2,
753
+ strokeWidth: 2 * unit
754
+ }),
755
+ /* @__PURE__ */ jsxs(GrabHandleGroup, {
756
+ $styling: styling,
757
+ $showIndex: handleFinderActive && revealSetIndex,
758
+ $originalRadius: 8 * unit,
759
+ children: [/* @__PURE__ */ jsx(GrabHandleContrast, {
760
+ $styling: styling,
761
+ r: 8 * unit,
762
+ strokeWidth: 4 * unit,
763
+ cx: midpoint.x,
764
+ cy: midpoint.y,
765
+ $hide: hideGrabHandle
766
+ }), /* @__PURE__ */ jsx(GrabHandle, {
767
+ $styling: styling,
768
+ textAnchor: "middle",
769
+ r: 8 * unit,
770
+ strokeWidth: 1 * unit,
771
+ cx: midpoint.x,
772
+ cy: midpoint.y,
773
+ $hide: hideGrabHandle,
774
+ onTouchMove: grabTouchMove,
775
+ onTouchStart: grabTouchStart,
776
+ onMouseDown: handleMouseDown
777
+ })]
778
+ }),
779
+ /* @__PURE__ */ jsx(GrabHandleIndexGroup, {
780
+ $showIndex: !hideGrabHandle && (handleFinderActive || revealSetIndex),
781
+ children: /* @__PURE__ */ jsx(GrabHandleIndexText, {
782
+ $styling: styling,
783
+ fontSize: `${unit * 10}px`,
784
+ x: midpoint.x - 3 * unit,
785
+ y: midpoint.y + 4 * unit,
786
+ $showIndex: revealSetIndex || handleFinderActive,
787
+ children: lineSetId + setIndexOffset
788
+ })
789
+ }),
790
+ showDirectionMark ? getDirectionMarkLine() : label && /* @__PURE__ */ jsx(LabelText, {
791
+ $styling: styling,
792
+ fontSize: `${unit * 14}px`,
793
+ x: midpoint.x - 16 * unit,
794
+ y: midpoint.y - 15 * unit,
795
+ $showIndex: revealSetIndex || handleFinderActive,
796
+ $showLabelShadow: showLabelShadow,
797
+ children: label
798
+ })
799
+ ] });
800
+ };
801
+ //#endregion
802
+ //#region src/LineUI/LineSet.tsx
803
+ var FilledPolygon = styled.polygon`
804
+ fill: ${({ $color }) => $color};
805
+ opacity: ${({ $opacity }) => $opacity};
806
+ `;
807
+ var Point = styled.circle`
808
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].point.fill};
809
+ `;
810
+ var AreaLabelText = styled.text`
811
+ text-align: center;
812
+ fill: ${({ theme, $styling }) => theme.custom.lines[$styling].label.fill};
813
+ font-weight: bold;
814
+ transition: opacity 250ms ease;
815
+ pointer-events: none;
816
+ ${({ $showAreaLabelShadow }) => $showAreaLabelShadow && css`
817
+ text-shadow:
818
+ -1px -1px 0 #000,
819
+ 1px -1px 0 #000,
820
+ -1px 1px 0 #000,
821
+ 1px 1px 0 #000;
822
+ `}
823
+ `;
824
+ var AreaLabel = ({ lineSetData, unit, showAreaLabelShadow }) => {
825
+ const pointsLength = lineSetData.points.length;
826
+ if (pointsLength < 3) return null;
827
+ let midpoint = {
828
+ x: 0,
829
+ y: 0
830
+ };
831
+ lineSetData.points.map(({ x, y }) => {
832
+ midpoint.x += x;
833
+ midpoint.y += y;
834
+ return null;
835
+ });
836
+ midpoint = {
837
+ x: midpoint.x / pointsLength,
838
+ y: midpoint.y / pointsLength
839
+ };
840
+ const Textlen = lineSetData.areaName?.length || 1;
841
+ return /* @__PURE__ */ jsx(AreaLabelText, {
842
+ fontSize: `${unit * 14}px`,
843
+ $styling: lineSetData.styling || "primary",
844
+ x: midpoint.x - 4 * Textlen * unit,
845
+ y: midpoint.y + 6 * unit,
846
+ $showAreaLabelShadow: showAreaLabelShadow,
847
+ children: lineSetData.areaName
848
+ });
849
+ };
850
+ var LineSet = ({ getCTM, boundaries, unit, size, lineSetId, options, onLineMoveEnd, onLineClick, lineClickSensingBorder, hasClickSensingBorder }) => {
851
+ const { state, dispatch } = useContext(LineSetContext);
852
+ const lineSetData = state[lineSetId];
853
+ const { showLabelShadow = false } = options;
854
+ const [handleAngles, setHandleAngles] = useState([]);
855
+ const handleRelation = useRef([]);
856
+ const handleRadius = size / 2;
857
+ const handleUsesAngles = lineSetData.points.length === 2;
858
+ /**
859
+ * Ensure provided position vector is within the boundaries (of the container)
860
+ * @param {IVector2} position Vector to be enforced.
861
+ * @returns {IVector2} The position updated clamped to range.
862
+ */
863
+ const enforceBoundaries = useCallback((position) => {
864
+ if (position.x < boundaries.x.min) position.x = boundaries.x.min;
865
+ else if (position.x > boundaries.x.max) position.x = boundaries.x.max;
866
+ if (position.y < boundaries.y.min) position.y = boundaries.y.min;
867
+ else if (position.y > boundaries.y.max) position.y = boundaries.y.max;
868
+ return position;
869
+ }, [boundaries]);
870
+ const handleMoveCallback = useCallback((pointerPosition, index) => {
871
+ const screenCTM = getCTM();
872
+ if (!screenCTM) return;
873
+ const pointer = enforceBoundaries({
874
+ x: (pointerPosition.x - window.scrollX - screenCTM.e) / screenCTM.a,
875
+ y: (pointerPosition.y - window.scrollY - screenCTM.f) / screenCTM.d
876
+ });
877
+ const point = {
878
+ x: Math.round(pointer.x),
879
+ y: Math.round(pointer.y)
880
+ };
881
+ dispatch({
882
+ type: "UPDATE",
883
+ index: lineSetId,
884
+ data: update(lineSetData, { points: { [index]: { $merge: point } } })
885
+ });
886
+ }, [
887
+ getCTM,
888
+ enforceBoundaries,
889
+ lineSetData,
890
+ dispatch,
891
+ lineSetId
892
+ ]);
893
+ const lineDragStart = useCallback((pointerPosition) => {
894
+ const screenCTM = getCTM();
895
+ if (!screenCTM) return;
896
+ const pointer = {
897
+ x: (pointerPosition.x - window.scrollX - screenCTM.e) / screenCTM.a - handleRadius,
898
+ y: (pointerPosition.y - window.scrollY - screenCTM.f) / screenCTM.d - handleRadius
899
+ };
900
+ handleRelation.current = lineSetData.points.map((handle) => {
901
+ return {
902
+ offsetX: pointer.x - handle.x,
903
+ offsetY: pointer.y - handle.y
904
+ };
905
+ });
906
+ }, [
907
+ handleRadius,
908
+ lineSetData.points,
909
+ getCTM
910
+ ]);
911
+ const lineDragUpdate = useCallback((pointerPosition) => {
912
+ const screenCTM = getCTM();
913
+ if (!screenCTM) return;
914
+ const { points } = lineSetData;
915
+ const pointer = {
916
+ x: (pointerPosition.x - window.scrollX - screenCTM.e) / screenCTM.a - handleRadius,
917
+ y: (pointerPosition.y - window.scrollY - screenCTM.f) / screenCTM.d - handleRadius
918
+ };
919
+ const newPoints = points.map((_handle, index) => {
920
+ const { offsetX = 0, offsetY = 0 } = handleRelation.current[index] || {};
921
+ return enforceBoundaries({
922
+ x: Math.round(pointer.x - offsetX),
923
+ y: Math.round(pointer.y - offsetY)
924
+ });
925
+ });
926
+ dispatch({
927
+ type: "UPDATE",
928
+ index: lineSetId,
929
+ data: {
930
+ ...lineSetData,
931
+ points: [...newPoints]
932
+ }
933
+ });
934
+ }, [
935
+ getCTM,
936
+ lineSetData,
937
+ handleRadius,
938
+ dispatch,
939
+ lineSetId,
940
+ enforceBoundaries
941
+ ]);
942
+ const calcAngle = useCallback((originX, originY, towardsX, towardsY) => {
943
+ return Math.atan2(towardsY - originY, towardsX - originX) * 180 / Math.PI + 90;
944
+ }, []);
945
+ const updateHandleAngles = useCallback((inputHandleData) => {
946
+ const { points } = inputHandleData;
947
+ const outputData = [];
948
+ inputHandleData.points.forEach((handle, index) => {
949
+ const nextHandle = points[index + 2 > points.length ? 0 : index + 1];
950
+ const angle = calcAngle(handle.x, handle.y, nextHandle.x, nextHandle.y);
951
+ outputData.push(angle);
952
+ });
953
+ setHandleAngles(outputData);
954
+ }, [calcAngle]);
955
+ useEffect(() => {
956
+ if (handleUsesAngles) updateHandleAngles(lineSetData);
957
+ }, [
958
+ lineSetData,
959
+ updateHandleAngles,
960
+ handleUsesAngles
961
+ ]);
962
+ const initialClampDone = useRef(false);
963
+ useEffect(() => {
964
+ if (boundaries.x.max === 0 && boundaries.y.max === 0) return;
965
+ if (initialClampDone.current) return;
966
+ initialClampDone.current = true;
967
+ if (lineSetData.points.some(({ x, y }) => x < boundaries.x.min || x > boundaries.x.max || y < boundaries.y.min || y > boundaries.y.max)) {
968
+ const clampedPoints = lineSetData.points.map((point) => enforceBoundaries({ ...point }));
969
+ dispatch({
970
+ type: "UPDATE",
971
+ index: lineSetId,
972
+ data: {
973
+ ...lineSetData,
974
+ points: clampedPoints
975
+ }
976
+ });
977
+ }
978
+ }, [
979
+ boundaries,
980
+ lineSetData.points.some,
981
+ dispatch,
982
+ lineSetData.points.map,
983
+ lineSetId,
984
+ lineSetData,
985
+ enforceBoundaries
986
+ ]);
987
+ const handles = (lineSetData?.showPointHandle === void 0 || lineSetData?.showPointHandle) && lineSetData.points.map(({ x, y }, index) => /* @__PURE__ */ jsx(HandleUnit, {
988
+ lineSetId,
989
+ rotate: lineSetData.rotate,
990
+ Icon: lineSetData.icon,
991
+ index,
992
+ unit,
993
+ size,
994
+ useAngles: handleUsesAngles,
995
+ angle: handleAngles[index],
996
+ x,
997
+ y,
998
+ moveEndCB: onLineMoveEnd,
999
+ moveCallback: handleMoveCallback,
1000
+ options,
1001
+ styling: lineSetData.styling,
1002
+ readOnlyHandle: lineSetData.readOnly
1003
+ }, index + lineSetId));
1004
+ const points = options.showPoint && lineSetData.points.map(({ x, y }, index) => /* @__PURE__ */ jsx(Point, {
1005
+ $styling: lineSetData.styling || "primary",
1006
+ r: unit,
1007
+ cx: x,
1008
+ cy: y
1009
+ }, index));
1010
+ const lines = lineSetData.points.map(({ x: x1, y: y1 }, index) => {
1011
+ const { points, name, styling = "primary" } = lineSetData;
1012
+ const nextIndex = index + 1 >= points.length ? 0 : index + 1;
1013
+ if (index === 1 && nextIndex === 0) return null;
1014
+ const { x: x2, y: y2 } = points[nextIndex];
1015
+ return /* @__PURE__ */ jsx(LineUnit, {
1016
+ moveEndCB: onLineMoveEnd,
1017
+ lineSetId,
1018
+ options,
1019
+ x1,
1020
+ y1,
1021
+ x2,
1022
+ y2,
1023
+ unit,
1024
+ label: name,
1025
+ styling,
1026
+ lineClickCallback: onLineClick,
1027
+ lineMoveCallback: lineDragUpdate,
1028
+ lineMoveStartCallback: lineDragStart,
1029
+ showSmallDirectionMark: lineSetData.showSmallDirectionMark,
1030
+ overrideShowMoveHandle: lineSetData.showMoveHandle,
1031
+ lineClickSensingBorder,
1032
+ hasClickSensingBorder
1033
+ }, index);
1034
+ });
1035
+ return /* @__PURE__ */ jsxs("g", { children: [
1036
+ /* @__PURE__ */ jsx(FilledPolygon, {
1037
+ points: lineSetData.points.map((point) => `${point.x},${point.y}`).join(" "),
1038
+ $color: lineSetData.areaFillColor ? lineSetData.areaFillColor : "transparent",
1039
+ $opacity: lineSetData.areaTransparencyLevel ? lineSetData.areaTransparencyLevel / 100 : 0
1040
+ }),
1041
+ lines,
1042
+ handles,
1043
+ points,
1044
+ /* @__PURE__ */ jsx(AreaLabel, {
1045
+ lineSetData,
1046
+ unit,
1047
+ showAreaLabelShadow: showLabelShadow
1048
+ })
1049
+ ] });
1050
+ };
1051
+ //#endregion
1052
+ //#region src/LineUI/LineUIVideoBase.tsx
1053
+ var Container = styled.div`
1054
+ position: relative;
1055
+ line-height: 0;
1056
+ user-select: none;
1057
+ touch-action: none;
1058
+ width: auto;
1059
+ `;
1060
+ var Video = styled.video`
1061
+ width: 100%;
1062
+ height: 100%;
1063
+ border-radius: 3px;
1064
+ background-color: hsla(0deg, 0%, 0%, 35%);
1065
+ `;
1066
+ var LoadingOverlay = styled.div`
1067
+ position: absolute;
1068
+ top: 0;
1069
+ bottom: 0;
1070
+ left: 0;
1071
+ right: 0;
1072
+ display: flex;
1073
+ flex-direction: column;
1074
+ align-items: center;
1075
+ justify-content: center;
1076
+ `;
1077
+ var Frame = styled.svg`
1078
+ touch-action: none;
1079
+ user-select: none;
1080
+ margin: 0;
1081
+
1082
+ overflow: visible;
1083
+
1084
+ position: absolute;
1085
+ top: 0;
1086
+ right: 0;
1087
+ left: 0;
1088
+ bottom: 0;
1089
+ height: 100%;
1090
+ width: 100%;
1091
+ transition: background 250ms ease;
1092
+ background: hsla(0deg, 0%, 0%, 0%);
1093
+
1094
+ ${(props) => props.$transcalent && css`
1095
+ background: hsla(0deg, 0%, 0%, 35%);
1096
+ `}
1097
+ `;
1098
+ var LineUIVideoBase = ({ videoRef, onSizeChange = () => {}, onLineMoveEnd = () => {}, onLineClick = () => {}, onLoaded = () => {}, lineClickSensingBorder = "65", hasClickSensingBorder = true, videoOptions: { loop = false, autoPlay = false, controls = false, muted = true, ...videoOptions }, options: { showHandleFinder, showSetIndex, showPointLabel = false, showPointHandle, showLabelShadow, showMoveHandle, showGrabHandle, setIndexOffset = 0, pointIndexOffset = 0, showPoint = false, boundaryOffset = 0, showDirectionMark = false } = {} }) => {
1099
+ const frame = useRef(null);
1100
+ const [boundaries, setBoundaries] = useState({
1101
+ x: {
1102
+ min: 0,
1103
+ max: 0
1104
+ },
1105
+ y: {
1106
+ min: 0,
1107
+ max: 0
1108
+ }
1109
+ });
1110
+ const { state } = useContext(LineSetContext);
1111
+ const [handleFinder, setHandleFinder] = useState(false);
1112
+ const [videoSize, setVideoSize] = useState({
1113
+ h: 768,
1114
+ w: 1024
1115
+ });
1116
+ const [unit, setUnit] = useState(1);
1117
+ const [loaded, setLoaded] = useState(false);
1118
+ const initScaleAndBounds = useCallback(() => {
1119
+ if (!videoRef.current) return;
1120
+ const { videoHeight, videoWidth, clientHeight } = videoRef.current;
1121
+ if (videoHeight !== videoSize.h || videoWidth !== videoSize.w) {
1122
+ setVideoSize({
1123
+ h: videoHeight,
1124
+ w: videoWidth
1125
+ });
1126
+ onSizeChange({
1127
+ h: videoHeight,
1128
+ w: videoWidth
1129
+ });
1130
+ }
1131
+ if (videoHeight / clientHeight !== unit) setUnit(videoHeight / clientHeight);
1132
+ }, [
1133
+ videoSize.h,
1134
+ videoSize.w,
1135
+ unit,
1136
+ onSizeChange,
1137
+ videoRef
1138
+ ]);
1139
+ const handlePositionTipShow = (e) => {
1140
+ if (e.target === frame.current) setHandleFinder(!handleFinder === false && true);
1141
+ };
1142
+ const handlePositionTipHide = () => {
1143
+ setHandleFinder(showHandleFinder || false);
1144
+ };
1145
+ const calculateCTM = useCallback(() => {
1146
+ if (!frame.current) return null;
1147
+ return frame.current.getScreenCTM();
1148
+ }, []);
1149
+ useEffect(() => {
1150
+ if (!frame.current || !loaded) return;
1151
+ const { viewBox } = frame.current;
1152
+ setBoundaries({
1153
+ x: {
1154
+ min: viewBox.baseVal.x + boundaryOffset,
1155
+ max: viewBox.baseVal.x + viewBox.baseVal.width - boundaryOffset
1156
+ },
1157
+ y: {
1158
+ min: viewBox.baseVal.y + boundaryOffset,
1159
+ max: viewBox.baseVal.y + viewBox.baseVal.height - boundaryOffset
1160
+ }
1161
+ });
1162
+ }, [
1163
+ videoSize,
1164
+ loaded,
1165
+ boundaryOffset
1166
+ ]);
1167
+ const onLoadedMetadata = useCallback(({ target }) => {
1168
+ if (target) {
1169
+ setLoaded(true);
1170
+ initScaleAndBounds();
1171
+ const { videoHeight = 1, videoWidth = 1 } = target;
1172
+ onLoaded({
1173
+ height: videoHeight,
1174
+ width: videoWidth
1175
+ });
1176
+ }
1177
+ }, [initScaleAndBounds, onLoaded]);
1178
+ useEffect(() => {
1179
+ window.addEventListener("resize", initScaleAndBounds);
1180
+ return () => {
1181
+ window.removeEventListener("resize", initScaleAndBounds);
1182
+ };
1183
+ }, [initScaleAndBounds]);
1184
+ const options = {
1185
+ handleFinderActive: handleFinder,
1186
+ revealSetIndex: showSetIndex !== false && (showSetIndex || state.length > 1),
1187
+ showPointLabel,
1188
+ showLabelShadow,
1189
+ showPointHandle: showPointHandle || showPointHandle !== false && showGrabHandle !== false,
1190
+ showMoveHandle: showMoveHandle || showMoveHandle !== false && showGrabHandle !== false,
1191
+ setIndexOffset,
1192
+ pointIndexOffset,
1193
+ showPoint,
1194
+ showDirectionMark
1195
+ };
1196
+ return /* @__PURE__ */ jsxs(Container, { children: [
1197
+ /* @__PURE__ */ jsx(Video, {
1198
+ ref: videoRef,
1199
+ controls,
1200
+ muted,
1201
+ autoPlay,
1202
+ loop,
1203
+ ...videoOptions,
1204
+ onLoadedMetadata,
1205
+ id: "1",
1206
+ children: " "
1207
+ }),
1208
+ !loaded && /* @__PURE__ */ jsx(LoadingOverlay, { children: /* @__PURE__ */ jsx(Spinner, {
1209
+ size: "large",
1210
+ styling: "primary"
1211
+ }) }),
1212
+ loaded && /* @__PURE__ */ jsx(Frame, {
1213
+ ref: frame,
1214
+ viewBox: `0 0 ${videoSize.w} ${videoSize.h} `,
1215
+ version: "1.1",
1216
+ xmlns: "http://www.w3.org/2000/svg",
1217
+ onPointerDown: handlePositionTipShow,
1218
+ onPointerUp: handlePositionTipHide,
1219
+ onPointerLeave: handlePositionTipHide,
1220
+ $transcalent: handleFinder,
1221
+ children: state.map((lineSet, index) => /* @__PURE__ */ jsx(LineSet, {
1222
+ hasClickSensingBorder,
1223
+ lineClickSensingBorder,
1224
+ onLineMoveEnd,
1225
+ onLineClick,
1226
+ lineSetId: index,
1227
+ lineData: lineSet,
1228
+ getCTM: calculateCTM,
1229
+ boundaries,
1230
+ unit,
1231
+ size: 30,
1232
+ options
1233
+ }, index))
1234
+ })
1235
+ ] });
1236
+ };
1237
+ //#endregion
1238
+ export { Icon as a, animation$1 as c, dimensions as d, fontFamily as f, Spinner as i, deviceMediaQuery as l, LineSet as n, IconSVGs as o, LineSetContext as r, IconWrapper as s, LineUIVideoBase as t, deviceSize as u };
1239
+
1240
+ //# sourceMappingURL=LineUIVideoBase-09sEI3pc.mjs.map