dn-react-router-toolkit 0.2.3 → 0.2.5

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 (57) hide show
  1. package/dist/auth/client/provider.d.mts +2 -4
  2. package/dist/auth/client/provider.d.ts +2 -4
  3. package/dist/auth/client/provider.js +3 -4
  4. package/dist/auth/client/provider.mjs +3 -4
  5. package/dist/auth/jwt_manager.js +1 -1
  6. package/dist/auth/jwt_manager.mjs +1 -1
  7. package/dist/file/cdn.d.mts +3 -2
  8. package/dist/file/cdn.d.ts +3 -2
  9. package/dist/file/client/drop_file_input.js +36 -10
  10. package/dist/file/client/drop_file_input.mjs +36 -10
  11. package/dist/file/client/file_uploader.js +36 -10
  12. package/dist/file/client/file_uploader.mjs +36 -10
  13. package/dist/file/client/metadata.d.mts +5 -1
  14. package/dist/file/client/metadata.d.ts +5 -1
  15. package/dist/file/client/metadata.js +36 -10
  16. package/dist/file/client/metadata.mjs +36 -10
  17. package/dist/index.d.mts +1 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +7 -0
  20. package/dist/index.mjs +6 -0
  21. package/dist/sleep.d.mts +3 -0
  22. package/dist/sleep.d.ts +3 -0
  23. package/dist/sleep.js +32 -0
  24. package/dist/sleep.mjs +7 -0
  25. package/dist/text_editor/attach_media.d.mts +16 -0
  26. package/dist/text_editor/attach_media.d.ts +16 -0
  27. package/dist/text_editor/attach_media.js +237 -0
  28. package/dist/text_editor/attach_media.mjs +210 -0
  29. package/dist/text_editor/plugins/drag_and_drop.d.mts +13 -0
  30. package/dist/text_editor/plugins/drag_and_drop.d.ts +13 -0
  31. package/dist/text_editor/plugins/drag_and_drop.js +59 -0
  32. package/dist/text_editor/plugins/drag_and_drop.mjs +34 -0
  33. package/dist/text_editor/plugins/keymap.d.mts +5 -0
  34. package/dist/text_editor/plugins/keymap.d.ts +5 -0
  35. package/dist/text_editor/plugins/keymap.js +40 -0
  36. package/dist/text_editor/plugins/keymap.mjs +15 -0
  37. package/dist/text_editor/plugins/placehoder.d.mts +5 -0
  38. package/dist/text_editor/plugins/placehoder.d.ts +5 -0
  39. package/dist/text_editor/plugins/placehoder.js +112 -0
  40. package/dist/text_editor/plugins/placehoder.mjs +87 -0
  41. package/dist/text_editor/plugins/trailing_paragraph.d.mts +5 -0
  42. package/dist/text_editor/plugins/trailing_paragraph.d.ts +5 -0
  43. package/dist/text_editor/plugins/trailing_paragraph.js +46 -0
  44. package/dist/text_editor/plugins/trailing_paragraph.mjs +21 -0
  45. package/dist/text_editor/plugins/upload_placeholder.d.mts +7 -0
  46. package/dist/text_editor/plugins/upload_placeholder.d.ts +7 -0
  47. package/dist/text_editor/plugins/upload_placeholder.js +94 -0
  48. package/dist/text_editor/plugins/upload_placeholder.mjs +68 -0
  49. package/dist/text_editor/schema.d.mts +9 -0
  50. package/dist/text_editor/schema.d.ts +9 -0
  51. package/dist/text_editor/schema.js +354 -0
  52. package/dist/text_editor/schema.mjs +319 -0
  53. package/dist/text_editor/text_editor.d.mts +44 -0
  54. package/dist/text_editor/text_editor.d.ts +44 -0
  55. package/dist/text_editor/text_editor.js +830 -0
  56. package/dist/text_editor/text_editor.mjs +802 -0
  57. package/package.json +14 -2
@@ -4,12 +4,10 @@ import 'jose';
4
4
 
5
5
  type AuthContextValue = {
6
6
  auth: AccessTokenPayload | undefined;
7
- login: (id: string, password: string) => Promise<void>;
7
+ login: (id: string, password: string) => Promise<AccessTokenPayload>;
8
8
  loginWithGoogle: (redirectUrl?: string) => Promise<void>;
9
9
  logout: () => Promise<void>;
10
- signup: (email: string, password: string, passwordConfirm: string) => Promise<{
11
- userId: string;
12
- }>;
10
+ signup: (email: string, password: string, passwordConfirm: string) => Promise<AccessTokenPayload>;
13
11
  requestResetPassword: (email: string) => Promise<boolean>;
14
12
  resetPassword: (token: string, password: string, passwordConfirm: string) => Promise<boolean>;
15
13
  };
@@ -4,12 +4,10 @@ import 'jose';
4
4
 
5
5
  type AuthContextValue = {
6
6
  auth: AccessTokenPayload | undefined;
7
- login: (id: string, password: string) => Promise<void>;
7
+ login: (id: string, password: string) => Promise<AccessTokenPayload>;
8
8
  loginWithGoogle: (redirectUrl?: string) => Promise<void>;
9
9
  logout: () => Promise<void>;
10
- signup: (email: string, password: string, passwordConfirm: string) => Promise<{
11
- userId: string;
12
- }>;
10
+ signup: (email: string, password: string, passwordConfirm: string) => Promise<AccessTokenPayload>;
13
11
  requestResetPassword: (email: string) => Promise<boolean>;
14
12
  resetPassword: (token: string, password: string, passwordConfirm: string) => Promise<boolean>;
15
13
  };
@@ -57,12 +57,11 @@ function AuthProvider({
57
57
  },
58
58
  body: JSON.stringify({ id, password })
59
59
  });
60
- if (res.ok) {
61
- navigate("/");
62
- } else {
60
+ if (!res.ok) {
63
61
  const { message } = await res.json();
64
- alert(message);
62
+ throw new Error(message);
65
63
  }
64
+ return res.json();
66
65
  };
67
66
  const loginWithGoogle = async (redirectUrl = "/") => {
68
67
  if (!googleAuth) {
@@ -21,12 +21,11 @@ function AuthProvider({
21
21
  },
22
22
  body: JSON.stringify({ id, password })
23
23
  });
24
- if (res.ok) {
25
- navigate("/");
26
- } else {
24
+ if (!res.ok) {
27
25
  const { message } = await res.json();
28
- alert(message);
26
+ throw new Error(message);
29
27
  }
28
+ return res.json();
30
29
  };
31
30
  const loginWithGoogle = async (redirectUrl = "/") => {
32
31
  if (!googleAuth) {
@@ -33,7 +33,7 @@ var JWTManager = class {
33
33
  constructor({
34
34
  siteOrigin,
35
35
  accessTokenSecret,
36
- accessTokenExpiresIn = "10s",
36
+ accessTokenExpiresIn = "1m",
37
37
  refreshTokenSecret,
38
38
  refreshTokenExpiresIn = "1y"
39
39
  }) {
@@ -9,7 +9,7 @@ var JWTManager = class {
9
9
  constructor({
10
10
  siteOrigin,
11
11
  accessTokenSecret,
12
- accessTokenExpiresIn = "10s",
12
+ accessTokenExpiresIn = "1m",
13
13
  refreshTokenSecret,
14
14
  refreshTokenExpiresIn = "1y"
15
15
  }) {
@@ -1,5 +1,6 @@
1
- declare const createCDN: (origin: string) => <T extends string | undefined>(key: T, { width }?: {
1
+ type CDN = <T extends string | undefined>(key: T, options?: {
2
2
  width?: number;
3
3
  }) => T extends undefined ? T : string;
4
+ declare const createCDN: (origin: string) => CDN;
4
5
 
5
- export { createCDN };
6
+ export { type CDN, createCDN };
@@ -1,5 +1,6 @@
1
- declare const createCDN: (origin: string) => <T extends string | undefined>(key: T, { width }?: {
1
+ type CDN = <T extends string | undefined>(key: T, options?: {
2
2
  width?: number;
3
3
  }) => T extends undefined ? T : string;
4
+ declare const createCDN: (origin: string) => CDN;
4
5
 
5
- export { createCDN };
6
+ export { type CDN, createCDN };
@@ -43,8 +43,10 @@ function cn(...classes) {
43
43
  }
44
44
 
45
45
  // src/file/client/metadata.ts
46
- function generateMetadata(blob) {
47
- return new Promise((resolve, reject) => {
46
+ function generateMetadata(blob, {
47
+ uploadBlob
48
+ } = {}) {
49
+ return new Promise((resolve) => {
48
50
  if (blob.type.startsWith("image/")) {
49
51
  const img = new Image();
50
52
  img.src = URL.createObjectURL(blob);
@@ -54,20 +56,44 @@ function generateMetadata(blob) {
54
56
  height: img.height
55
57
  });
56
58
  };
57
- img.onerror = reject;
59
+ img.onerror = () => resolve({});
58
60
  return;
59
61
  }
60
62
  if (blob.type.startsWith("video/")) {
61
63
  const video = document.createElement("video");
62
- video.src = URL.createObjectURL(blob);
63
- video.onloadedmetadata = () => {
64
- resolve({
65
- width: video.videoWidth,
66
- height: video.videoHeight,
67
- duration: video.duration
64
+ video.onloadeddata = () => {
65
+ const canvas = document.createElement("canvas");
66
+ canvas.width = video.videoWidth;
67
+ canvas.height = video.videoHeight;
68
+ const context = canvas.getContext("2d");
69
+ if (!context || !uploadBlob) {
70
+ return resolve({
71
+ width: video.videoWidth,
72
+ height: video.videoHeight
73
+ });
74
+ }
75
+ video.addEventListener("seeked", () => {
76
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
77
+ canvas.toBlob((blob2) => {
78
+ if (!blob2) {
79
+ return resolve({
80
+ width: video.videoWidth,
81
+ height: video.videoHeight
82
+ });
83
+ }
84
+ uploadBlob(blob2, "poster").then(({ url }) => {
85
+ resolve({
86
+ width: video.videoWidth,
87
+ height: video.videoHeight,
88
+ poster: url
89
+ });
90
+ });
91
+ }, "image/jpeg");
68
92
  });
93
+ video.currentTime = 0;
69
94
  };
70
- video.onerror = reject;
95
+ video.onerror = () => resolve({});
96
+ video.src = URL.createObjectURL(blob);
71
97
  return;
72
98
  }
73
99
  resolve({});
@@ -14,8 +14,10 @@ function cn(...classes) {
14
14
  }
15
15
 
16
16
  // src/file/client/metadata.ts
17
- function generateMetadata(blob) {
18
- return new Promise((resolve, reject) => {
17
+ function generateMetadata(blob, {
18
+ uploadBlob
19
+ } = {}) {
20
+ return new Promise((resolve) => {
19
21
  if (blob.type.startsWith("image/")) {
20
22
  const img = new Image();
21
23
  img.src = URL.createObjectURL(blob);
@@ -25,20 +27,44 @@ function generateMetadata(blob) {
25
27
  height: img.height
26
28
  });
27
29
  };
28
- img.onerror = reject;
30
+ img.onerror = () => resolve({});
29
31
  return;
30
32
  }
31
33
  if (blob.type.startsWith("video/")) {
32
34
  const video = document.createElement("video");
33
- video.src = URL.createObjectURL(blob);
34
- video.onloadedmetadata = () => {
35
- resolve({
36
- width: video.videoWidth,
37
- height: video.videoHeight,
38
- duration: video.duration
35
+ video.onloadeddata = () => {
36
+ const canvas = document.createElement("canvas");
37
+ canvas.width = video.videoWidth;
38
+ canvas.height = video.videoHeight;
39
+ const context = canvas.getContext("2d");
40
+ if (!context || !uploadBlob) {
41
+ return resolve({
42
+ width: video.videoWidth,
43
+ height: video.videoHeight
44
+ });
45
+ }
46
+ video.addEventListener("seeked", () => {
47
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
48
+ canvas.toBlob((blob2) => {
49
+ if (!blob2) {
50
+ return resolve({
51
+ width: video.videoWidth,
52
+ height: video.videoHeight
53
+ });
54
+ }
55
+ uploadBlob(blob2, "poster").then(({ url }) => {
56
+ resolve({
57
+ width: video.videoWidth,
58
+ height: video.videoHeight,
59
+ poster: url
60
+ });
61
+ });
62
+ }, "image/jpeg");
39
63
  });
64
+ video.currentTime = 0;
40
65
  };
41
- video.onerror = reject;
66
+ video.onerror = () => resolve({});
67
+ video.src = URL.createObjectURL(blob);
42
68
  return;
43
69
  }
44
70
  resolve({});
@@ -25,8 +25,10 @@ __export(file_uploader_exports, {
25
25
  module.exports = __toCommonJS(file_uploader_exports);
26
26
 
27
27
  // src/file/client/metadata.ts
28
- function generateMetadata(blob) {
29
- return new Promise((resolve, reject) => {
28
+ function generateMetadata(blob, {
29
+ uploadBlob
30
+ } = {}) {
31
+ return new Promise((resolve) => {
30
32
  if (blob.type.startsWith("image/")) {
31
33
  const img = new Image();
32
34
  img.src = URL.createObjectURL(blob);
@@ -36,20 +38,44 @@ function generateMetadata(blob) {
36
38
  height: img.height
37
39
  });
38
40
  };
39
- img.onerror = reject;
41
+ img.onerror = () => resolve({});
40
42
  return;
41
43
  }
42
44
  if (blob.type.startsWith("video/")) {
43
45
  const video = document.createElement("video");
44
- video.src = URL.createObjectURL(blob);
45
- video.onloadedmetadata = () => {
46
- resolve({
47
- width: video.videoWidth,
48
- height: video.videoHeight,
49
- duration: video.duration
46
+ video.onloadeddata = () => {
47
+ const canvas = document.createElement("canvas");
48
+ canvas.width = video.videoWidth;
49
+ canvas.height = video.videoHeight;
50
+ const context = canvas.getContext("2d");
51
+ if (!context || !uploadBlob) {
52
+ return resolve({
53
+ width: video.videoWidth,
54
+ height: video.videoHeight
55
+ });
56
+ }
57
+ video.addEventListener("seeked", () => {
58
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
59
+ canvas.toBlob((blob2) => {
60
+ if (!blob2) {
61
+ return resolve({
62
+ width: video.videoWidth,
63
+ height: video.videoHeight
64
+ });
65
+ }
66
+ uploadBlob(blob2, "poster").then(({ url }) => {
67
+ resolve({
68
+ width: video.videoWidth,
69
+ height: video.videoHeight,
70
+ poster: url
71
+ });
72
+ });
73
+ }, "image/jpeg");
50
74
  });
75
+ video.currentTime = 0;
51
76
  };
52
- video.onerror = reject;
77
+ video.onerror = () => resolve({});
78
+ video.src = URL.createObjectURL(blob);
53
79
  return;
54
80
  }
55
81
  resolve({});
@@ -1,6 +1,8 @@
1
1
  // src/file/client/metadata.ts
2
- function generateMetadata(blob) {
3
- return new Promise((resolve, reject) => {
2
+ function generateMetadata(blob, {
3
+ uploadBlob
4
+ } = {}) {
5
+ return new Promise((resolve) => {
4
6
  if (blob.type.startsWith("image/")) {
5
7
  const img = new Image();
6
8
  img.src = URL.createObjectURL(blob);
@@ -10,20 +12,44 @@ function generateMetadata(blob) {
10
12
  height: img.height
11
13
  });
12
14
  };
13
- img.onerror = reject;
15
+ img.onerror = () => resolve({});
14
16
  return;
15
17
  }
16
18
  if (blob.type.startsWith("video/")) {
17
19
  const video = document.createElement("video");
18
- video.src = URL.createObjectURL(blob);
19
- video.onloadedmetadata = () => {
20
- resolve({
21
- width: video.videoWidth,
22
- height: video.videoHeight,
23
- duration: video.duration
20
+ video.onloadeddata = () => {
21
+ const canvas = document.createElement("canvas");
22
+ canvas.width = video.videoWidth;
23
+ canvas.height = video.videoHeight;
24
+ const context = canvas.getContext("2d");
25
+ if (!context || !uploadBlob) {
26
+ return resolve({
27
+ width: video.videoWidth,
28
+ height: video.videoHeight
29
+ });
30
+ }
31
+ video.addEventListener("seeked", () => {
32
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
33
+ canvas.toBlob((blob2) => {
34
+ if (!blob2) {
35
+ return resolve({
36
+ width: video.videoWidth,
37
+ height: video.videoHeight
38
+ });
39
+ }
40
+ uploadBlob(blob2, "poster").then(({ url }) => {
41
+ resolve({
42
+ width: video.videoWidth,
43
+ height: video.videoHeight,
44
+ poster: url
45
+ });
46
+ });
47
+ }, "image/jpeg");
24
48
  });
49
+ video.currentTime = 0;
25
50
  };
26
- video.onerror = reject;
51
+ video.onerror = () => resolve({});
52
+ video.src = URL.createObjectURL(blob);
27
53
  return;
28
54
  }
29
55
  resolve({});
@@ -1,3 +1,7 @@
1
- declare function generateMetadata(blob: Blob | File): Promise<Record<string, unknown>>;
1
+ declare function generateMetadata(blob: Blob | File, { uploadBlob, }?: {
2
+ uploadBlob?: (blob: Blob, type: string) => Promise<{
3
+ url: string;
4
+ }>;
5
+ }): Promise<Record<string, unknown>>;
2
6
 
3
7
  export { generateMetadata };
@@ -1,3 +1,7 @@
1
- declare function generateMetadata(blob: Blob | File): Promise<Record<string, unknown>>;
1
+ declare function generateMetadata(blob: Blob | File, { uploadBlob, }?: {
2
+ uploadBlob?: (blob: Blob, type: string) => Promise<{
3
+ url: string;
4
+ }>;
5
+ }): Promise<Record<string, unknown>>;
2
6
 
3
7
  export { generateMetadata };
@@ -23,8 +23,10 @@ __export(metadata_exports, {
23
23
  generateMetadata: () => generateMetadata
24
24
  });
25
25
  module.exports = __toCommonJS(metadata_exports);
26
- function generateMetadata(blob) {
27
- return new Promise((resolve, reject) => {
26
+ function generateMetadata(blob, {
27
+ uploadBlob
28
+ } = {}) {
29
+ return new Promise((resolve) => {
28
30
  if (blob.type.startsWith("image/")) {
29
31
  const img = new Image();
30
32
  img.src = URL.createObjectURL(blob);
@@ -34,20 +36,44 @@ function generateMetadata(blob) {
34
36
  height: img.height
35
37
  });
36
38
  };
37
- img.onerror = reject;
39
+ img.onerror = () => resolve({});
38
40
  return;
39
41
  }
40
42
  if (blob.type.startsWith("video/")) {
41
43
  const video = document.createElement("video");
42
- video.src = URL.createObjectURL(blob);
43
- video.onloadedmetadata = () => {
44
- resolve({
45
- width: video.videoWidth,
46
- height: video.videoHeight,
47
- duration: video.duration
44
+ video.onloadeddata = () => {
45
+ const canvas = document.createElement("canvas");
46
+ canvas.width = video.videoWidth;
47
+ canvas.height = video.videoHeight;
48
+ const context = canvas.getContext("2d");
49
+ if (!context || !uploadBlob) {
50
+ return resolve({
51
+ width: video.videoWidth,
52
+ height: video.videoHeight
53
+ });
54
+ }
55
+ video.addEventListener("seeked", () => {
56
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
57
+ canvas.toBlob((blob2) => {
58
+ if (!blob2) {
59
+ return resolve({
60
+ width: video.videoWidth,
61
+ height: video.videoHeight
62
+ });
63
+ }
64
+ uploadBlob(blob2, "poster").then(({ url }) => {
65
+ resolve({
66
+ width: video.videoWidth,
67
+ height: video.videoHeight,
68
+ poster: url
69
+ });
70
+ });
71
+ }, "image/jpeg");
48
72
  });
73
+ video.currentTime = 0;
49
74
  };
50
- video.onerror = reject;
75
+ video.onerror = () => resolve({});
76
+ video.src = URL.createObjectURL(blob);
51
77
  return;
52
78
  }
53
79
  resolve({});
@@ -1,6 +1,8 @@
1
1
  // src/file/client/metadata.ts
2
- function generateMetadata(blob) {
3
- return new Promise((resolve, reject) => {
2
+ function generateMetadata(blob, {
3
+ uploadBlob
4
+ } = {}) {
5
+ return new Promise((resolve) => {
4
6
  if (blob.type.startsWith("image/")) {
5
7
  const img = new Image();
6
8
  img.src = URL.createObjectURL(blob);
@@ -10,20 +12,44 @@ function generateMetadata(blob) {
10
12
  height: img.height
11
13
  });
12
14
  };
13
- img.onerror = reject;
15
+ img.onerror = () => resolve({});
14
16
  return;
15
17
  }
16
18
  if (blob.type.startsWith("video/")) {
17
19
  const video = document.createElement("video");
18
- video.src = URL.createObjectURL(blob);
19
- video.onloadedmetadata = () => {
20
- resolve({
21
- width: video.videoWidth,
22
- height: video.videoHeight,
23
- duration: video.duration
20
+ video.onloadeddata = () => {
21
+ const canvas = document.createElement("canvas");
22
+ canvas.width = video.videoWidth;
23
+ canvas.height = video.videoHeight;
24
+ const context = canvas.getContext("2d");
25
+ if (!context || !uploadBlob) {
26
+ return resolve({
27
+ width: video.videoWidth,
28
+ height: video.videoHeight
29
+ });
30
+ }
31
+ video.addEventListener("seeked", () => {
32
+ context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
33
+ canvas.toBlob((blob2) => {
34
+ if (!blob2) {
35
+ return resolve({
36
+ width: video.videoWidth,
37
+ height: video.videoHeight
38
+ });
39
+ }
40
+ uploadBlob(blob2, "poster").then(({ url }) => {
41
+ resolve({
42
+ width: video.videoWidth,
43
+ height: video.videoHeight,
44
+ poster: url
45
+ });
46
+ });
47
+ }, "image/jpeg");
24
48
  });
49
+ video.currentTime = 0;
25
50
  };
26
- video.onerror = reject;
51
+ video.onerror = () => resolve({});
52
+ video.src = URL.createObjectURL(blob);
27
53
  return;
28
54
  }
29
55
  resolve({});
package/dist/index.d.mts CHANGED
@@ -2,4 +2,5 @@ export { cn } from './cn.mjs';
2
2
  export { formatHumanDateTime } from './date.mjs';
3
3
  export { singleton } from './singleton.mjs';
4
4
  export { toSlug } from './slug.mjs';
5
+ export { sleep } from './sleep.mjs';
5
6
  export { default as moment } from 'moment-timezone';
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export { cn } from './cn.js';
2
2
  export { formatHumanDateTime } from './date.js';
3
3
  export { singleton } from './singleton.js';
4
4
  export { toSlug } from './slug.js';
5
+ export { sleep } from './sleep.js';
5
6
  export { default as moment } from 'moment-timezone';
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  formatHumanDateTime: () => formatHumanDateTime,
35
35
  moment: () => import_moment_timezone.default,
36
36
  singleton: () => singleton,
37
+ sleep: () => sleep,
37
38
  toSlug: () => toSlug
38
39
  });
39
40
  module.exports = __toCommonJS(index_exports);
@@ -83,11 +84,17 @@ function singleton(name, fn) {
83
84
  var toSlug = (str) => {
84
85
  return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
85
86
  };
87
+
88
+ // src/sleep.ts
89
+ var sleep = (ms) => {
90
+ return new Promise((resolve) => setTimeout(resolve, ms));
91
+ };
86
92
  // Annotate the CommonJS export names for ESM import in node:
87
93
  0 && (module.exports = {
88
94
  cn,
89
95
  formatHumanDateTime,
90
96
  moment,
91
97
  singleton,
98
+ sleep,
92
99
  toSlug
93
100
  });
package/dist/index.mjs CHANGED
@@ -43,10 +43,16 @@ function singleton(name, fn) {
43
43
  var toSlug = (str) => {
44
44
  return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
45
45
  };
46
+
47
+ // src/sleep.ts
48
+ var sleep = (ms) => {
49
+ return new Promise((resolve) => setTimeout(resolve, ms));
50
+ };
46
51
  export {
47
52
  cn,
48
53
  formatHumanDateTime,
49
54
  moment,
50
55
  singleton,
56
+ sleep,
51
57
  toSlug
52
58
  };
@@ -0,0 +1,3 @@
1
+ declare const sleep: (ms: number) => Promise<unknown>;
2
+
3
+ export { sleep };
@@ -0,0 +1,3 @@
1
+ declare const sleep: (ms: number) => Promise<unknown>;
2
+
3
+ export { sleep };
package/dist/sleep.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/sleep.ts
21
+ var sleep_exports = {};
22
+ __export(sleep_exports, {
23
+ sleep: () => sleep
24
+ });
25
+ module.exports = __toCommonJS(sleep_exports);
26
+ var sleep = (ms) => {
27
+ return new Promise((resolve) => setTimeout(resolve, ms));
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ sleep
32
+ });
package/dist/sleep.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/sleep.ts
2
+ var sleep = (ms) => {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ };
5
+ export {
6
+ sleep
7
+ };
@@ -0,0 +1,16 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { Node } from 'prosemirror-model';
3
+ import { FileUploader } from '../file/client/file_uploader.mjs';
4
+ import { createSchema } from './schema.mjs';
5
+ import 'orderedmap';
6
+
7
+ declare function createAttachMedia<TFile extends {
8
+ name?: string;
9
+ key: string;
10
+ }>({ schema, cdnOrigin, fileUploader, }: {
11
+ schema: ReturnType<typeof createSchema>;
12
+ cdnOrigin: string;
13
+ fileUploader: FileUploader<TFile>;
14
+ }): (view: EditorView, medias: File[], pos?: number) => Promise<Node[]>;
15
+
16
+ export { createAttachMedia };
@@ -0,0 +1,16 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { Node } from 'prosemirror-model';
3
+ import { FileUploader } from '../file/client/file_uploader.js';
4
+ import { createSchema } from './schema.js';
5
+ import 'orderedmap';
6
+
7
+ declare function createAttachMedia<TFile extends {
8
+ name?: string;
9
+ key: string;
10
+ }>({ schema, cdnOrigin, fileUploader, }: {
11
+ schema: ReturnType<typeof createSchema>;
12
+ cdnOrigin: string;
13
+ fileUploader: FileUploader<TFile>;
14
+ }): (view: EditorView, medias: File[], pos?: number) => Promise<Node[]>;
15
+
16
+ export { createAttachMedia };