dn-react-router-toolkit 0.2.7 → 0.3.2

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 (279) hide show
  1. package/dist/api/create_handler.d.mts +13 -0
  2. package/dist/api/create_handler.d.ts +13 -0
  3. package/dist/api/create_handler.js +298 -0
  4. package/dist/api/create_handler.mjs +304 -0
  5. package/dist/api/index.d.mts +4 -0
  6. package/dist/api/index.d.ts +4 -0
  7. package/dist/api/index.js +298 -0
  8. package/dist/api/index.mjs +304 -0
  9. package/dist/auth/client/index.d.mts +3 -0
  10. package/dist/auth/client/index.d.ts +3 -0
  11. package/dist/{date.js → auth/client/index.js} +25 -32
  12. package/dist/auth/client/index.mjs +21 -0
  13. package/dist/auth/client/redirect_page.d.mts +1 -0
  14. package/dist/auth/client/redirect_page.d.ts +1 -0
  15. package/dist/auth/cookie_store.d.mts +13 -0
  16. package/dist/auth/cookie_store.d.ts +13 -0
  17. package/dist/{text_editor/plugins/keymap.js → auth/cookie_store.js} +24 -16
  18. package/dist/auth/cookie_store.mjs +23 -0
  19. package/dist/auth/index.d.mts +5 -0
  20. package/dist/auth/index.d.ts +5 -0
  21. package/dist/auth/index.js +139 -0
  22. package/dist/auth/index.mjs +111 -0
  23. package/dist/auth/server/index.d.mts +1 -0
  24. package/dist/auth/server/index.d.ts +1 -0
  25. package/dist/{slug.js → auth/server/index.js} +6 -14
  26. package/dist/auth/server/index.mjs +2 -0
  27. package/dist/auth/with_auth.d.mts +2 -6
  28. package/dist/auth/with_auth.d.ts +2 -6
  29. package/dist/auth/with_auth.js +3 -0
  30. package/dist/auth/with_auth.mjs +3 -0
  31. package/dist/{components → client}/client_env.d.mts +1 -1
  32. package/dist/{components → client}/client_env.d.ts +1 -1
  33. package/dist/{components → client}/client_env.js +6 -2
  34. package/dist/{components → client}/client_env.mjs +2 -2
  35. package/dist/client/index.d.mts +3 -0
  36. package/dist/client/index.d.ts +3 -0
  37. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  38. package/dist/client/index.mjs +31 -0
  39. package/dist/client/use_user_agent.d.mts +8 -0
  40. package/dist/client/use_user_agent.d.ts +8 -0
  41. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  42. package/dist/client/use_user_agent.mjs +13 -0
  43. package/dist/file/client/index.d.mts +1 -0
  44. package/dist/file/client/index.d.ts +1 -0
  45. package/dist/file/{cdn.js → client/index.js} +6 -16
  46. package/dist/file/client/index.mjs +2 -0
  47. package/dist/file/index.d.mts +1 -0
  48. package/dist/file/index.d.ts +1 -0
  49. package/dist/{cn.js → file/index.js} +6 -14
  50. package/dist/file/index.mjs +2 -0
  51. package/dist/file/server/index.d.mts +1 -0
  52. package/dist/file/server/index.d.ts +1 -0
  53. package/dist/file/server/index.js +24 -0
  54. package/dist/file/server/index.mjs +2 -0
  55. package/dist/http/index.d.mts +1 -1
  56. package/dist/http/index.d.ts +1 -1
  57. package/dist/http/index.js +3 -90
  58. package/dist/http/index.mjs +2 -68
  59. package/dist/index.d.mts +8 -6
  60. package/dist/index.d.ts +8 -6
  61. package/dist/index.js +3 -79
  62. package/dist/index.mjs +2 -58
  63. package/dist/modal/index.d.mts +1 -0
  64. package/dist/modal/index.d.ts +1 -0
  65. package/dist/{sleep.js → modal/index.js} +6 -14
  66. package/dist/modal/index.mjs +2 -0
  67. package/dist/seo/index.d.mts +4 -0
  68. package/dist/seo/index.d.ts +4 -0
  69. package/dist/seo/index.js +304 -0
  70. package/dist/seo/index.mjs +267 -0
  71. package/dist/text_editor/index.d.mts +1 -0
  72. package/dist/text_editor/index.d.ts +1 -0
  73. package/dist/text_editor/index.js +24 -0
  74. package/dist/text_editor/index.mjs +2 -0
  75. package/package.json +58 -32
  76. package/dist/auth/apple_auth.d.mts +0 -38
  77. package/dist/auth/apple_auth.d.ts +0 -38
  78. package/dist/auth/apple_auth.js +0 -88
  79. package/dist/auth/apple_auth.mjs +0 -63
  80. package/dist/auth/auth_repository.d.mts +0 -41
  81. package/dist/auth/auth_repository.d.ts +0 -41
  82. package/dist/auth/auth_repository.js +0 -18
  83. package/dist/auth/auth_repository.mjs +0 -0
  84. package/dist/auth/auth_service.d.mts +0 -63
  85. package/dist/auth/auth_service.d.ts +0 -63
  86. package/dist/auth/auth_service.js +0 -210
  87. package/dist/auth/auth_service.mjs +0 -171
  88. package/dist/auth/client/google_login_button.d.mts +0 -7
  89. package/dist/auth/client/google_login_button.d.ts +0 -7
  90. package/dist/auth/client/google_login_button.mjs +0 -37
  91. package/dist/auth/client/provider.d.mts +0 -24
  92. package/dist/auth/client/provider.d.ts +0 -24
  93. package/dist/auth/client/provider.js +0 -154
  94. package/dist/auth/client/provider.mjs +0 -118
  95. package/dist/auth/google_auth.d.mts +0 -33
  96. package/dist/auth/google_auth.d.ts +0 -33
  97. package/dist/auth/google_auth.js +0 -135
  98. package/dist/auth/google_auth.mjs +0 -108
  99. package/dist/auth/handlers/find_auth.d.mts +0 -13
  100. package/dist/auth/handlers/find_auth.d.ts +0 -13
  101. package/dist/auth/handlers/find_auth.js +0 -82
  102. package/dist/auth/handlers/find_auth.mjs +0 -55
  103. package/dist/auth/handlers/login.d.mts +0 -13
  104. package/dist/auth/handlers/login.d.ts +0 -13
  105. package/dist/auth/handlers/login.js +0 -107
  106. package/dist/auth/handlers/login.mjs +0 -80
  107. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  108. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  109. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  110. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  111. package/dist/auth/handlers/logout.d.mts +0 -13
  112. package/dist/auth/handlers/logout.d.ts +0 -13
  113. package/dist/auth/handlers/logout.js +0 -102
  114. package/dist/auth/handlers/logout.mjs +0 -75
  115. package/dist/auth/handlers/refresh.d.mts +0 -13
  116. package/dist/auth/handlers/refresh.d.ts +0 -13
  117. package/dist/auth/handlers/refresh.js +0 -92
  118. package/dist/auth/handlers/refresh.mjs +0 -65
  119. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  120. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  121. package/dist/auth/handlers/request_password_reset.js +0 -87
  122. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  123. package/dist/auth/handlers/reset_password.d.mts +0 -10
  124. package/dist/auth/handlers/reset_password.d.ts +0 -10
  125. package/dist/auth/handlers/reset_password.js +0 -88
  126. package/dist/auth/handlers/reset_password.mjs +0 -61
  127. package/dist/auth/handlers/signup.d.mts +0 -15
  128. package/dist/auth/handlers/signup.d.ts +0 -15
  129. package/dist/auth/handlers/signup.js +0 -147
  130. package/dist/auth/handlers/signup.mjs +0 -112
  131. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  132. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  133. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  134. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  135. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  136. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  137. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  138. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  139. package/dist/auth/jwt_manager.d.mts +0 -38
  140. package/dist/auth/jwt_manager.d.ts +0 -38
  141. package/dist/auth/jwt_manager.js +0 -90
  142. package/dist/auth/jwt_manager.mjs +0 -65
  143. package/dist/auth/kakao_auth.d.mts +0 -27
  144. package/dist/auth/kakao_auth.d.ts +0 -27
  145. package/dist/auth/kakao_auth.js +0 -56
  146. package/dist/auth/kakao_auth.mjs +0 -31
  147. package/dist/auth/password_recovery.d.mts +0 -34
  148. package/dist/auth/password_recovery.d.ts +0 -34
  149. package/dist/auth/password_recovery.js +0 -169
  150. package/dist/auth/password_recovery.mjs +0 -134
  151. package/dist/auth/thirdparty_auth.d.mts +0 -41
  152. package/dist/auth/thirdparty_auth.d.ts +0 -41
  153. package/dist/auth/thirdparty_auth.js +0 -113
  154. package/dist/auth/thirdparty_auth.mjs +0 -86
  155. package/dist/cn.d.mts +0 -3
  156. package/dist/cn.d.ts +0 -3
  157. package/dist/cn.mjs +0 -7
  158. package/dist/components/index.d.mts +0 -5
  159. package/dist/components/index.d.ts +0 -5
  160. package/dist/components/index.js +0 -261
  161. package/dist/components/index.mjs +0 -219
  162. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  163. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  164. package/dist/components/modal/fullscreen_container.js +0 -102
  165. package/dist/components/modal/fullscreen_container.mjs +0 -68
  166. package/dist/components/modal/hooks.d.mts +0 -18
  167. package/dist/components/modal/hooks.d.ts +0 -18
  168. package/dist/components/modal/hooks.js +0 -236
  169. package/dist/components/modal/hooks.mjs +0 -204
  170. package/dist/components/modal/index.d.mts +0 -4
  171. package/dist/components/modal/index.d.ts +0 -4
  172. package/dist/components/modal/index.js +0 -238
  173. package/dist/components/modal/index.mjs +0 -203
  174. package/dist/components/modal/modal.d.mts +0 -13
  175. package/dist/components/modal/modal.d.ts +0 -13
  176. package/dist/components/modal/modal.js +0 -155
  177. package/dist/components/modal/modal.mjs +0 -130
  178. package/dist/components/styles.d.mts +0 -9
  179. package/dist/components/styles.d.ts +0 -9
  180. package/dist/components/styles.js +0 -48
  181. package/dist/components/styles.mjs +0 -17
  182. package/dist/date.d.mts +0 -5
  183. package/dist/date.d.ts +0 -5
  184. package/dist/date.mjs +0 -29
  185. package/dist/file/cdn.d.mts +0 -6
  186. package/dist/file/cdn.d.ts +0 -6
  187. package/dist/file/cdn.mjs +0 -9
  188. package/dist/file/client/drop_file_input.d.mts +0 -36
  189. package/dist/file/client/drop_file_input.d.ts +0 -36
  190. package/dist/file/client/drop_file_input.js +0 -323
  191. package/dist/file/client/drop_file_input.mjs +0 -294
  192. package/dist/file/client/file_upload_button.d.mts +0 -10
  193. package/dist/file/client/file_upload_button.d.ts +0 -10
  194. package/dist/file/client/file_upload_button.js +0 -89
  195. package/dist/file/client/file_upload_button.mjs +0 -58
  196. package/dist/file/client/file_uploader.d.mts +0 -13
  197. package/dist/file/client/file_uploader.d.ts +0 -13
  198. package/dist/file/client/file_uploader.js +0 -163
  199. package/dist/file/client/file_uploader.mjs +0 -136
  200. package/dist/file/client/format_size.d.mts +0 -3
  201. package/dist/file/client/format_size.d.ts +0 -3
  202. package/dist/file/client/format_size.mjs +0 -13
  203. package/dist/file/client/metadata.d.mts +0 -7
  204. package/dist/file/client/metadata.d.ts +0 -7
  205. package/dist/file/client/metadata.js +0 -85
  206. package/dist/file/client/metadata.mjs +0 -60
  207. package/dist/file/file_repository.d.mts +0 -16
  208. package/dist/file/file_repository.d.ts +0 -16
  209. package/dist/file/file_repository.js +0 -18
  210. package/dist/file/file_repository.mjs +0 -0
  211. package/dist/file/file_service.d.mts +0 -32
  212. package/dist/file/file_service.d.ts +0 -32
  213. package/dist/file/file_service.js +0 -66
  214. package/dist/file/file_service.mjs +0 -41
  215. package/dist/file/handlers/delete_file.d.mts +0 -17
  216. package/dist/file/handlers/delete_file.d.ts +0 -17
  217. package/dist/file/handlers/delete_file.js +0 -99
  218. package/dist/file/handlers/delete_file.mjs +0 -72
  219. package/dist/file/handlers/upload_file.d.mts +0 -16
  220. package/dist/file/handlers/upload_file.d.ts +0 -16
  221. package/dist/file/handlers/upload_file.js +0 -106
  222. package/dist/file/handlers/upload_file.mjs +0 -79
  223. package/dist/file/object_storage.d.mts +0 -20
  224. package/dist/file/object_storage.d.ts +0 -20
  225. package/dist/file/object_storage.js +0 -90
  226. package/dist/file/object_storage.mjs +0 -70
  227. package/dist/file/responsive_image.d.mts +0 -20
  228. package/dist/file/responsive_image.d.ts +0 -20
  229. package/dist/file/responsive_image.js +0 -132
  230. package/dist/file/responsive_image.mjs +0 -96
  231. package/dist/http/response.d.mts +0 -19
  232. package/dist/http/response.d.ts +0 -19
  233. package/dist/http/response.js +0 -109
  234. package/dist/http/response.mjs +0 -68
  235. package/dist/route/api.d.mts +0 -21
  236. package/dist/route/api.d.ts +0 -21
  237. package/dist/route/api.js +0 -584
  238. package/dist/route/api.mjs +0 -547
  239. package/dist/singleton.d.mts +0 -3
  240. package/dist/singleton.d.ts +0 -3
  241. package/dist/singleton.js +0 -37
  242. package/dist/singleton.mjs +0 -12
  243. package/dist/sleep.d.mts +0 -3
  244. package/dist/sleep.d.ts +0 -3
  245. package/dist/sleep.mjs +0 -7
  246. package/dist/slug.d.mts +0 -3
  247. package/dist/slug.d.ts +0 -3
  248. package/dist/slug.mjs +0 -7
  249. package/dist/text_editor/attach_media.d.mts +0 -16
  250. package/dist/text_editor/attach_media.d.ts +0 -16
  251. package/dist/text_editor/attach_media.js +0 -237
  252. package/dist/text_editor/attach_media.mjs +0 -210
  253. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  254. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  255. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  256. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  257. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  258. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  259. package/dist/text_editor/plugins/keymap.mjs +0 -15
  260. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  261. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  262. package/dist/text_editor/plugins/placehoder.js +0 -112
  263. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  264. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  265. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  266. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  267. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  268. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  269. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  270. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  271. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  272. package/dist/text_editor/schema.d.mts +0 -9
  273. package/dist/text_editor/schema.d.ts +0 -9
  274. package/dist/text_editor/schema.js +0 -354
  275. package/dist/text_editor/schema.mjs +0 -319
  276. package/dist/text_editor/text_editor.d.mts +0 -45
  277. package/dist/text_editor/text_editor.d.ts +0 -45
  278. package/dist/text_editor/text_editor.js +0 -834
  279. package/dist/text_editor/text_editor.mjs +0 -806
@@ -1,236 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/modal/hooks.tsx
31
- var hooks_exports = {};
32
- __export(hooks_exports, {
33
- ModalContext: () => ModalContext,
34
- useModal: () => useModal,
35
- useModalPortal: () => useModalPortal,
36
- useModalRoot: () => useModalRoot
37
- });
38
- module.exports = __toCommonJS(hooks_exports);
39
- var import_react4 = require("react");
40
- var import_react_dom = require("react-dom");
41
-
42
- // src/components/modal/modal.tsx
43
- var import_react3 = __toESM(require("react"));
44
-
45
- // src/cn.ts
46
- function cn(...classes) {
47
- return classes.filter(Boolean).join(" ").trim();
48
- }
49
-
50
- // src/components/modal/fullscreen_container.tsx
51
- var import_react = __toESM(require("react"));
52
- var import_react2 = require("react");
53
- function useFullscreen(ref) {
54
- (0, import_react2.useEffect)(() => {
55
- const container = ref.current;
56
- if (!container) {
57
- return;
58
- }
59
- const scroll = () => {
60
- if (scrollY > 0) {
61
- window.scrollTo({
62
- top: 0,
63
- behavior: "instant"
64
- });
65
- }
66
- };
67
- const resize = () => {
68
- if (!visualViewport) {
69
- return;
70
- }
71
- container.classList.remove("bottom-0");
72
- container.style.height = `${visualViewport?.height}px`;
73
- if (visualViewport.height < window.innerHeight) {
74
- window.addEventListener("scroll", scroll);
75
- } else {
76
- window.removeEventListener("scroll", scroll);
77
- }
78
- };
79
- resize();
80
- visualViewport?.addEventListener("resize", resize);
81
- scroll();
82
- return () => {
83
- window.removeEventListener("scroll", scroll);
84
- visualViewport?.removeEventListener("resize", resize);
85
- };
86
- }, [ref]);
87
- return "fixed inset-0";
88
- }
89
-
90
- // src/components/modal/modal.tsx
91
- function Modal({
92
- open,
93
- className,
94
- background = "bg-gray-500/25",
95
- onBackgroundClick,
96
- children,
97
- ...props
98
- }) {
99
- const containerRef = (0, import_react3.useRef)(null);
100
- const fullscreen = useFullscreen(containerRef);
101
- const [mounted, setMounted] = import_react3.default.useState(false);
102
- (0, import_react3.useEffect)(() => {
103
- if (open) {
104
- setMounted(true);
105
- } else {
106
- setTimeout(() => {
107
- setMounted(false);
108
- }, 200);
109
- }
110
- return () => {
111
- };
112
- }, [open]);
113
- const onBackgroundMouseDown = (event) => {
114
- event.preventDefault();
115
- onBackgroundClick?.();
116
- };
117
- const onModalMouseDown = (event) => {
118
- event.stopPropagation();
119
- };
120
- const onBackgroundTouchStart = (event) => {
121
- event.preventDefault();
122
- onBackgroundClick?.();
123
- };
124
- const onModalTouchStart = (event) => {
125
- event.stopPropagation();
126
- };
127
- return /* @__PURE__ */ import_react3.default.createElement(
128
- "div",
129
- {
130
- ref: containerRef,
131
- className: cn(
132
- fullscreen,
133
- "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
134
- open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
135
- ),
136
- onMouseDown: onBackgroundMouseDown,
137
- onTouchStart: onBackgroundTouchStart
138
- },
139
- /* @__PURE__ */ import_react3.default.createElement(
140
- "div",
141
- {
142
- className: cn(
143
- "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
144
- open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
145
- )
146
- },
147
- (open || mounted) && /* @__PURE__ */ import_react3.default.createElement(
148
- "div",
149
- {
150
- ...props,
151
- className: cn(
152
- className,
153
- "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
154
- ),
155
- onMouseDown: onModalMouseDown,
156
- onTouchStart: onModalTouchStart
157
- },
158
- children
159
- )
160
- )
161
- );
162
- }
163
-
164
- // src/components/modal/hooks.tsx
165
- var import_react5 = __toESM(require("react"));
166
- function useModalRoot() {
167
- const [container, setContainer] = (0, import_react4.useState)(null);
168
- (0, import_react4.useEffect)(() => {
169
- const container2 = document.getElementById("modal-root");
170
- if (container2) {
171
- setContainer(container2);
172
- }
173
- return () => {
174
- setContainer(null);
175
- };
176
- }, []);
177
- return container;
178
- }
179
- function useModalPortal() {
180
- const container = useModalRoot();
181
- if (!container) {
182
- return (children) => null;
183
- }
184
- return (children) => {
185
- return (0, import_react_dom.createPortal)(children, container);
186
- };
187
- }
188
- var ModalContext = (0, import_react4.createContext)({});
189
- function useModal() {
190
- const ch2 = (0, import_react4.useRef)(
191
- null
192
- );
193
- const open = () => {
194
- ch2.current?.(true);
195
- };
196
- const close = () => {
197
- ch2.current?.(false);
198
- };
199
- const Component = (0, import_react4.useCallback)(
200
- function Component2(props) {
201
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
202
- const createPortal2 = useModalPortal();
203
- (0, import_react4.useEffect)(() => {
204
- ch2.current = (v) => {
205
- setIsOpen(v);
206
- };
207
- return () => {
208
- ch2.current = null;
209
- };
210
- }, []);
211
- (0, import_react4.useEffect)(() => {
212
- if (isOpen) {
213
- } else {
214
- }
215
- return () => {
216
- };
217
- }, [isOpen]);
218
- return /* @__PURE__ */ import_react5.default.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
219
- /* @__PURE__ */ import_react5.default.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
220
- ));
221
- },
222
- []
223
- );
224
- return {
225
- open,
226
- close,
227
- Modal: Component
228
- };
229
- }
230
- // Annotate the CommonJS export names for ESM import in node:
231
- 0 && (module.exports = {
232
- ModalContext,
233
- useModal,
234
- useModalPortal,
235
- useModalRoot
236
- });
@@ -1,204 +0,0 @@
1
- // src/components/modal/hooks.tsx
2
- import { createContext, useCallback, useEffect as useEffect3, useRef as useRef3, useState } from "react";
3
- import { createPortal } from "react-dom";
4
-
5
- // src/components/modal/modal.tsx
6
- import React2, {
7
- useEffect as useEffect2,
8
- useRef as useRef2
9
- } from "react";
10
-
11
- // src/cn.ts
12
- function cn(...classes) {
13
- return classes.filter(Boolean).join(" ").trim();
14
- }
15
-
16
- // src/components/modal/fullscreen_container.tsx
17
- import React from "react";
18
- import {
19
- useEffect,
20
- useRef
21
- } from "react";
22
- function useFullscreen(ref) {
23
- useEffect(() => {
24
- const container = ref.current;
25
- if (!container) {
26
- return;
27
- }
28
- const scroll = () => {
29
- if (scrollY > 0) {
30
- window.scrollTo({
31
- top: 0,
32
- behavior: "instant"
33
- });
34
- }
35
- };
36
- const resize = () => {
37
- if (!visualViewport) {
38
- return;
39
- }
40
- container.classList.remove("bottom-0");
41
- container.style.height = `${visualViewport?.height}px`;
42
- if (visualViewport.height < window.innerHeight) {
43
- window.addEventListener("scroll", scroll);
44
- } else {
45
- window.removeEventListener("scroll", scroll);
46
- }
47
- };
48
- resize();
49
- visualViewport?.addEventListener("resize", resize);
50
- scroll();
51
- return () => {
52
- window.removeEventListener("scroll", scroll);
53
- visualViewport?.removeEventListener("resize", resize);
54
- };
55
- }, [ref]);
56
- return "fixed inset-0";
57
- }
58
-
59
- // src/components/modal/modal.tsx
60
- function Modal({
61
- open,
62
- className,
63
- background = "bg-gray-500/25",
64
- onBackgroundClick,
65
- children,
66
- ...props
67
- }) {
68
- const containerRef = useRef2(null);
69
- const fullscreen = useFullscreen(containerRef);
70
- const [mounted, setMounted] = React2.useState(false);
71
- useEffect2(() => {
72
- if (open) {
73
- setMounted(true);
74
- } else {
75
- setTimeout(() => {
76
- setMounted(false);
77
- }, 200);
78
- }
79
- return () => {
80
- };
81
- }, [open]);
82
- const onBackgroundMouseDown = (event) => {
83
- event.preventDefault();
84
- onBackgroundClick?.();
85
- };
86
- const onModalMouseDown = (event) => {
87
- event.stopPropagation();
88
- };
89
- const onBackgroundTouchStart = (event) => {
90
- event.preventDefault();
91
- onBackgroundClick?.();
92
- };
93
- const onModalTouchStart = (event) => {
94
- event.stopPropagation();
95
- };
96
- return /* @__PURE__ */ React2.createElement(
97
- "div",
98
- {
99
- ref: containerRef,
100
- className: cn(
101
- fullscreen,
102
- "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
103
- open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
104
- ),
105
- onMouseDown: onBackgroundMouseDown,
106
- onTouchStart: onBackgroundTouchStart
107
- },
108
- /* @__PURE__ */ React2.createElement(
109
- "div",
110
- {
111
- className: cn(
112
- "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
113
- open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
114
- )
115
- },
116
- (open || mounted) && /* @__PURE__ */ React2.createElement(
117
- "div",
118
- {
119
- ...props,
120
- className: cn(
121
- className,
122
- "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
123
- ),
124
- onMouseDown: onModalMouseDown,
125
- onTouchStart: onModalTouchStart
126
- },
127
- children
128
- )
129
- )
130
- );
131
- }
132
-
133
- // src/components/modal/hooks.tsx
134
- import React3 from "react";
135
- function useModalRoot() {
136
- const [container, setContainer] = useState(null);
137
- useEffect3(() => {
138
- const container2 = document.getElementById("modal-root");
139
- if (container2) {
140
- setContainer(container2);
141
- }
142
- return () => {
143
- setContainer(null);
144
- };
145
- }, []);
146
- return container;
147
- }
148
- function useModalPortal() {
149
- const container = useModalRoot();
150
- if (!container) {
151
- return (children) => null;
152
- }
153
- return (children) => {
154
- return createPortal(children, container);
155
- };
156
- }
157
- var ModalContext = createContext({});
158
- function useModal() {
159
- const ch2 = useRef3(
160
- null
161
- );
162
- const open = () => {
163
- ch2.current?.(true);
164
- };
165
- const close = () => {
166
- ch2.current?.(false);
167
- };
168
- const Component = useCallback(
169
- function Component2(props) {
170
- const [isOpen, setIsOpen] = useState(false);
171
- const createPortal2 = useModalPortal();
172
- useEffect3(() => {
173
- ch2.current = (v) => {
174
- setIsOpen(v);
175
- };
176
- return () => {
177
- ch2.current = null;
178
- };
179
- }, []);
180
- useEffect3(() => {
181
- if (isOpen) {
182
- } else {
183
- }
184
- return () => {
185
- };
186
- }, [isOpen]);
187
- return /* @__PURE__ */ React3.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
188
- /* @__PURE__ */ React3.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
189
- ));
190
- },
191
- []
192
- );
193
- return {
194
- open,
195
- close,
196
- Modal: Component
197
- };
198
- }
199
- export {
200
- ModalContext,
201
- useModal,
202
- useModalPortal,
203
- useModalRoot
204
- };
@@ -1,4 +0,0 @@
1
- export { Props, useFullscreen } from './fullscreen_container.mjs';
2
- export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './hooks.mjs';
3
- export { ModalProps } from './modal.mjs';
4
- import 'react';
@@ -1,4 +0,0 @@
1
- export { Props, useFullscreen } from './fullscreen_container.js';
2
- export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './hooks.js';
3
- export { ModalProps } from './modal.js';
4
- import 'react';
@@ -1,238 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/modal/index.ts
31
- var modal_exports = {};
32
- __export(modal_exports, {
33
- ModalContext: () => ModalContext,
34
- useFullscreen: () => useFullscreen,
35
- useModal: () => useModal,
36
- useModalPortal: () => useModalPortal,
37
- useModalRoot: () => useModalRoot
38
- });
39
- module.exports = __toCommonJS(modal_exports);
40
-
41
- // src/cn.ts
42
- function cn(...classes) {
43
- return classes.filter(Boolean).join(" ").trim();
44
- }
45
-
46
- // src/components/modal/fullscreen_container.tsx
47
- var import_react = __toESM(require("react"));
48
- var import_react2 = require("react");
49
- function useFullscreen(ref) {
50
- (0, import_react2.useEffect)(() => {
51
- const container = ref.current;
52
- if (!container) {
53
- return;
54
- }
55
- const scroll = () => {
56
- if (scrollY > 0) {
57
- window.scrollTo({
58
- top: 0,
59
- behavior: "instant"
60
- });
61
- }
62
- };
63
- const resize = () => {
64
- if (!visualViewport) {
65
- return;
66
- }
67
- container.classList.remove("bottom-0");
68
- container.style.height = `${visualViewport?.height}px`;
69
- if (visualViewport.height < window.innerHeight) {
70
- window.addEventListener("scroll", scroll);
71
- } else {
72
- window.removeEventListener("scroll", scroll);
73
- }
74
- };
75
- resize();
76
- visualViewport?.addEventListener("resize", resize);
77
- scroll();
78
- return () => {
79
- window.removeEventListener("scroll", scroll);
80
- visualViewport?.removeEventListener("resize", resize);
81
- };
82
- }, [ref]);
83
- return "fixed inset-0";
84
- }
85
-
86
- // src/components/modal/hooks.tsx
87
- var import_react4 = require("react");
88
- var import_react_dom = require("react-dom");
89
-
90
- // src/components/modal/modal.tsx
91
- var import_react3 = __toESM(require("react"));
92
- function Modal({
93
- open,
94
- className,
95
- background = "bg-gray-500/25",
96
- onBackgroundClick,
97
- children,
98
- ...props
99
- }) {
100
- const containerRef = (0, import_react3.useRef)(null);
101
- const fullscreen = useFullscreen(containerRef);
102
- const [mounted, setMounted] = import_react3.default.useState(false);
103
- (0, import_react3.useEffect)(() => {
104
- if (open) {
105
- setMounted(true);
106
- } else {
107
- setTimeout(() => {
108
- setMounted(false);
109
- }, 200);
110
- }
111
- return () => {
112
- };
113
- }, [open]);
114
- const onBackgroundMouseDown = (event) => {
115
- event.preventDefault();
116
- onBackgroundClick?.();
117
- };
118
- const onModalMouseDown = (event) => {
119
- event.stopPropagation();
120
- };
121
- const onBackgroundTouchStart = (event) => {
122
- event.preventDefault();
123
- onBackgroundClick?.();
124
- };
125
- const onModalTouchStart = (event) => {
126
- event.stopPropagation();
127
- };
128
- return /* @__PURE__ */ import_react3.default.createElement(
129
- "div",
130
- {
131
- ref: containerRef,
132
- className: cn(
133
- fullscreen,
134
- "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
135
- open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
136
- ),
137
- onMouseDown: onBackgroundMouseDown,
138
- onTouchStart: onBackgroundTouchStart
139
- },
140
- /* @__PURE__ */ import_react3.default.createElement(
141
- "div",
142
- {
143
- className: cn(
144
- "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
145
- open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
146
- )
147
- },
148
- (open || mounted) && /* @__PURE__ */ import_react3.default.createElement(
149
- "div",
150
- {
151
- ...props,
152
- className: cn(
153
- className,
154
- "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
155
- ),
156
- onMouseDown: onModalMouseDown,
157
- onTouchStart: onModalTouchStart
158
- },
159
- children
160
- )
161
- )
162
- );
163
- }
164
-
165
- // src/components/modal/hooks.tsx
166
- var import_react5 = __toESM(require("react"));
167
- function useModalRoot() {
168
- const [container, setContainer] = (0, import_react4.useState)(null);
169
- (0, import_react4.useEffect)(() => {
170
- const container2 = document.getElementById("modal-root");
171
- if (container2) {
172
- setContainer(container2);
173
- }
174
- return () => {
175
- setContainer(null);
176
- };
177
- }, []);
178
- return container;
179
- }
180
- function useModalPortal() {
181
- const container = useModalRoot();
182
- if (!container) {
183
- return (children) => null;
184
- }
185
- return (children) => {
186
- return (0, import_react_dom.createPortal)(children, container);
187
- };
188
- }
189
- var ModalContext = (0, import_react4.createContext)({});
190
- function useModal() {
191
- const ch2 = (0, import_react4.useRef)(
192
- null
193
- );
194
- const open = () => {
195
- ch2.current?.(true);
196
- };
197
- const close = () => {
198
- ch2.current?.(false);
199
- };
200
- const Component = (0, import_react4.useCallback)(
201
- function Component2(props) {
202
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
203
- const createPortal2 = useModalPortal();
204
- (0, import_react4.useEffect)(() => {
205
- ch2.current = (v) => {
206
- setIsOpen(v);
207
- };
208
- return () => {
209
- ch2.current = null;
210
- };
211
- }, []);
212
- (0, import_react4.useEffect)(() => {
213
- if (isOpen) {
214
- } else {
215
- }
216
- return () => {
217
- };
218
- }, [isOpen]);
219
- return /* @__PURE__ */ import_react5.default.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
220
- /* @__PURE__ */ import_react5.default.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
221
- ));
222
- },
223
- []
224
- );
225
- return {
226
- open,
227
- close,
228
- Modal: Component
229
- };
230
- }
231
- // Annotate the CommonJS export names for ESM import in node:
232
- 0 && (module.exports = {
233
- ModalContext,
234
- useFullscreen,
235
- useModal,
236
- useModalPortal,
237
- useModalRoot
238
- });