dn-react-router-toolkit 0.8.1 → 0.9.1

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 (130) hide show
  1. package/dist/api/create_api_handler.d.mts +2 -2
  2. package/dist/api/create_api_handler.d.ts +2 -2
  3. package/dist/api/create_api_handler.js +55 -52
  4. package/dist/api/create_api_handler.mjs +61 -59
  5. package/dist/api/create_handler.d.mts +5 -5
  6. package/dist/api/create_handler.d.ts +5 -5
  7. package/dist/api/create_handler.js +41 -44
  8. package/dist/api/create_handler.mjs +41 -44
  9. package/dist/api/index.d.mts +4 -3
  10. package/dist/api/index.d.ts +4 -3
  11. package/dist/api/index.js +118 -102
  12. package/dist/api/index.mjs +130 -109
  13. package/dist/api/item_api_handler.d.mts +4 -3
  14. package/dist/api/item_api_handler.d.ts +4 -3
  15. package/dist/api/item_api_handler.js +22 -6
  16. package/dist/api/item_api_handler.mjs +28 -6
  17. package/dist/auth/cookie_manager.d.mts +1 -1
  18. package/dist/auth/cookie_manager.d.ts +1 -1
  19. package/dist/auth/index.d.mts +2 -2
  20. package/dist/auth/index.d.ts +2 -2
  21. package/dist/auth/index.js +18 -18
  22. package/dist/auth/index.mjs +18 -18
  23. package/dist/auth/with_auth.d.mts +2 -2
  24. package/dist/auth/with_auth.d.ts +2 -2
  25. package/dist/auth/with_auth.js +18 -18
  26. package/dist/auth/with_auth.mjs +18 -18
  27. package/dist/client/editor.d.mts +2 -2
  28. package/dist/client/editor.d.ts +2 -2
  29. package/dist/client/editor.js +9 -3
  30. package/dist/client/editor.mjs +9 -3
  31. package/dist/client/index.d.mts +2 -2
  32. package/dist/client/index.d.ts +2 -2
  33. package/dist/client/index.js +9 -3
  34. package/dist/client/index.mjs +9 -3
  35. package/dist/crud/crud_form.js +22 -4
  36. package/dist/crud/crud_form.mjs +11 -3
  37. package/dist/crud/crud_form_provider.js +16 -3
  38. package/dist/crud/crud_form_provider.mjs +14 -1
  39. package/dist/crud/index.d.mts +0 -20
  40. package/dist/crud/index.d.ts +0 -20
  41. package/dist/crud/index.js +32 -8589
  42. package/dist/crud/index.mjs +11 -8599
  43. package/dist/db/backup/index.d.mts +1 -1
  44. package/dist/db/backup/index.d.ts +1 -1
  45. package/dist/form/create_form_component.js +21 -2
  46. package/dist/form/create_form_component.mjs +10 -1
  47. package/dist/form/form_components.js +21 -2
  48. package/dist/form/form_components.mjs +10 -1
  49. package/dist/form/index.js +21 -2
  50. package/dist/form/index.mjs +10 -1
  51. package/dist/post/editor_toolbar.js +20 -3
  52. package/dist/post/editor_toolbar.mjs +9 -2
  53. package/dist/post/index.js +93 -7711
  54. package/dist/post/index.mjs +69 -7723
  55. package/dist/post/post_form_page.js +91 -7711
  56. package/dist/post/post_form_page.mjs +69 -7725
  57. package/dist/post/thumbnail_picker.js +21 -2
  58. package/dist/post/thumbnail_picker.mjs +10 -1
  59. package/dist/table/buttons.js +11 -14
  60. package/dist/table/buttons.mjs +10 -13
  61. package/dist/table/index.d.mts +0 -2
  62. package/dist/table/index.d.ts +0 -2
  63. package/dist/table/index.js +24 -95
  64. package/dist/table/index.mjs +23 -92
  65. package/dist/table/load_table.d.mts +1 -1
  66. package/dist/table/load_table.d.ts +1 -1
  67. package/dist/table/load_table.js +2 -2
  68. package/dist/table/load_table.mjs +2 -2
  69. package/dist/table/loader.js +2 -2
  70. package/dist/table/loader.mjs +2 -2
  71. package/dist/table/table.d.mts +2 -2
  72. package/dist/table/table.d.ts +2 -2
  73. package/dist/table/table.js +14 -25
  74. package/dist/table/table.mjs +11 -24
  75. package/dist/table/table_form.js +16 -39
  76. package/dist/table/table_form.mjs +15 -38
  77. package/dist/utils/cn.d.mts +3 -0
  78. package/dist/utils/cn.d.ts +3 -0
  79. package/dist/utils/cn.js +32 -0
  80. package/dist/utils/cn.mjs +7 -0
  81. package/dist/utils/date.d.mts +5 -0
  82. package/dist/utils/date.d.ts +5 -0
  83. package/dist/utils/date.js +65 -0
  84. package/dist/utils/date.mjs +29 -0
  85. package/dist/utils/index.d.mts +7 -0
  86. package/dist/utils/index.d.ts +7 -0
  87. package/dist/utils/index.js +116 -0
  88. package/dist/utils/index.mjs +73 -0
  89. package/dist/utils/korean.d.mts +6 -0
  90. package/dist/utils/korean.d.ts +6 -0
  91. package/dist/{crud/generate_pages.js → utils/korean.js} +16 -30
  92. package/dist/utils/korean.mjs +16 -0
  93. package/dist/utils/singleton.d.mts +3 -0
  94. package/dist/utils/singleton.d.ts +3 -0
  95. package/dist/utils/singleton.js +37 -0
  96. package/dist/utils/singleton.mjs +12 -0
  97. package/dist/utils/sleep.d.mts +3 -0
  98. package/dist/utils/sleep.d.ts +3 -0
  99. package/dist/{table/item_loader.js → utils/sleep.js} +8 -19
  100. package/dist/utils/sleep.mjs +7 -0
  101. package/dist/utils/slug.d.mts +3 -0
  102. package/dist/utils/slug.d.ts +3 -0
  103. package/dist/{crud/generate_handlers.js → utils/slug.js} +8 -15
  104. package/dist/utils/slug.mjs +7 -0
  105. package/package.json +7 -3
  106. package/dist/crud/crud_loader.d.mts +0 -26
  107. package/dist/crud/crud_loader.d.ts +0 -26
  108. package/dist/crud/crud_loader.js +0 -351
  109. package/dist/crud/crud_loader.mjs +0 -337
  110. package/dist/crud/crud_page.d.mts +0 -32
  111. package/dist/crud/crud_page.d.ts +0 -32
  112. package/dist/crud/crud_page.js +0 -776
  113. package/dist/crud/crud_page.mjs +0 -758
  114. package/dist/crud/generate_handlers.d.mts +0 -16
  115. package/dist/crud/generate_handlers.d.ts +0 -16
  116. package/dist/crud/generate_handlers.mjs +0 -14
  117. package/dist/crud/generate_pages.d.mts +0 -19
  118. package/dist/crud/generate_pages.d.ts +0 -19
  119. package/dist/crud/generate_pages.mjs +0 -30
  120. package/dist/crud/generate_routes.d.mts +0 -5
  121. package/dist/crud/generate_routes.d.ts +0 -5
  122. package/dist/crud/generate_routes.js +0 -7639
  123. package/dist/crud/generate_routes.mjs +0 -7627
  124. package/dist/table/item_loader.d.mts +0 -14
  125. package/dist/table/item_loader.d.ts +0 -14
  126. package/dist/table/item_loader.mjs +0 -18
  127. package/dist/table/page.d.mts +0 -16
  128. package/dist/table/page.d.ts +0 -16
  129. package/dist/table/page.js +0 -375
  130. package/dist/table/page.mjs +0 -350
@@ -0,0 +1,65 @@
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/utils/date.ts
31
+ var date_exports = {};
32
+ __export(date_exports, {
33
+ formatHumanDateTime: () => formatHumanDateTime,
34
+ moment: () => import_moment_timezone.default
35
+ });
36
+ module.exports = __toCommonJS(date_exports);
37
+ var import_moment_timezone = __toESM(require("moment-timezone"));
38
+ var formatHumanDateTime = (value) => {
39
+ const date = (0, import_moment_timezone.default)(value).tz("Asia/Seoul");
40
+ const now = (0, import_moment_timezone.default)().tz("Asia/Seoul");
41
+ if (date.isAfter(now.clone().subtract(1, "minute"))) {
42
+ return "\uBC29\uAE08 \uC804";
43
+ }
44
+ if (date.isAfter(now.clone().subtract(1, "hour"))) {
45
+ const diff = now.diff(date, "minute");
46
+ return `${diff}\uBD84 \uC804`;
47
+ }
48
+ if (date.isAfter(now.clone().subtract(6, "hours"))) {
49
+ const diff = now.diff(date, "hour");
50
+ return `${diff}\uC2DC\uAC04 \uC804`;
51
+ }
52
+ if (date.isAfter(now.clone().subtract(1, "week"))) {
53
+ const diff = now.diff(date, "day");
54
+ return `${diff}\uC77C \uC804`;
55
+ }
56
+ if (date.isSame(now, "year")) {
57
+ return date.format("M\uC6D4 D\uC77C");
58
+ }
59
+ return date.format("YYYY\uB144 M\uC6D4 D\uC77C");
60
+ };
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ formatHumanDateTime,
64
+ moment
65
+ });
@@ -0,0 +1,29 @@
1
+ // src/utils/date.ts
2
+ import moment from "moment-timezone";
3
+ var formatHumanDateTime = (value) => {
4
+ const date = moment(value).tz("Asia/Seoul");
5
+ const now = moment().tz("Asia/Seoul");
6
+ if (date.isAfter(now.clone().subtract(1, "minute"))) {
7
+ return "\uBC29\uAE08 \uC804";
8
+ }
9
+ if (date.isAfter(now.clone().subtract(1, "hour"))) {
10
+ const diff = now.diff(date, "minute");
11
+ return `${diff}\uBD84 \uC804`;
12
+ }
13
+ if (date.isAfter(now.clone().subtract(6, "hours"))) {
14
+ const diff = now.diff(date, "hour");
15
+ return `${diff}\uC2DC\uAC04 \uC804`;
16
+ }
17
+ if (date.isAfter(now.clone().subtract(1, "week"))) {
18
+ const diff = now.diff(date, "day");
19
+ return `${diff}\uC77C \uC804`;
20
+ }
21
+ if (date.isSame(now, "year")) {
22
+ return date.format("M\uC6D4 D\uC77C");
23
+ }
24
+ return date.format("YYYY\uB144 M\uC6D4 D\uC77C");
25
+ };
26
+ export {
27
+ formatHumanDateTime,
28
+ moment
29
+ };
@@ -0,0 +1,7 @@
1
+ export { cn } from './cn.mjs';
2
+ export { formatHumanDateTime } from './date.mjs';
3
+ export { singleton } from './singleton.mjs';
4
+ export { toSlug } from './slug.mjs';
5
+ export { sleep } from './sleep.mjs';
6
+ export { Korean } from './korean.mjs';
7
+ export { default as moment } from 'moment-timezone';
@@ -0,0 +1,7 @@
1
+ export { cn } from './cn.js';
2
+ export { formatHumanDateTime } from './date.js';
3
+ export { singleton } from './singleton.js';
4
+ export { toSlug } from './slug.js';
5
+ export { sleep } from './sleep.js';
6
+ export { Korean } from './korean.js';
7
+ export { default as moment } from 'moment-timezone';
@@ -0,0 +1,116 @@
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/utils/index.ts
31
+ var utils_exports = {};
32
+ __export(utils_exports, {
33
+ Korean: () => Korean,
34
+ cn: () => cn,
35
+ formatHumanDateTime: () => formatHumanDateTime,
36
+ moment: () => import_moment_timezone.default,
37
+ singleton: () => singleton,
38
+ sleep: () => sleep,
39
+ toSlug: () => toSlug
40
+ });
41
+ module.exports = __toCommonJS(utils_exports);
42
+
43
+ // src/utils/cn.ts
44
+ function cn(...classes) {
45
+ return classes.filter(Boolean).join(" ").trim();
46
+ }
47
+
48
+ // src/utils/date.ts
49
+ var import_moment_timezone = __toESM(require("moment-timezone"));
50
+ var formatHumanDateTime = (value) => {
51
+ const date = (0, import_moment_timezone.default)(value).tz("Asia/Seoul");
52
+ const now = (0, import_moment_timezone.default)().tz("Asia/Seoul");
53
+ if (date.isAfter(now.clone().subtract(1, "minute"))) {
54
+ return "\uBC29\uAE08 \uC804";
55
+ }
56
+ if (date.isAfter(now.clone().subtract(1, "hour"))) {
57
+ const diff = now.diff(date, "minute");
58
+ return `${diff}\uBD84 \uC804`;
59
+ }
60
+ if (date.isAfter(now.clone().subtract(6, "hours"))) {
61
+ const diff = now.diff(date, "hour");
62
+ return `${diff}\uC2DC\uAC04 \uC804`;
63
+ }
64
+ if (date.isAfter(now.clone().subtract(1, "week"))) {
65
+ const diff = now.diff(date, "day");
66
+ return `${diff}\uC77C \uC804`;
67
+ }
68
+ if (date.isSame(now, "year")) {
69
+ return date.format("M\uC6D4 D\uC77C");
70
+ }
71
+ return date.format("YYYY\uB144 M\uC6D4 D\uC77C");
72
+ };
73
+
74
+ // src/utils/singleton.ts
75
+ function singleton(name, fn) {
76
+ const globalAny = globalThis;
77
+ globalAny.__singletons = globalAny.__singletons || {};
78
+ if (!globalAny.__singletons[name]) {
79
+ globalAny.__singletons[name] = fn();
80
+ }
81
+ return globalAny.__singletons[name];
82
+ }
83
+
84
+ // src/utils/slug.ts
85
+ var toSlug = (str) => {
86
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
87
+ };
88
+
89
+ // src/utils/sleep.ts
90
+ var sleep = (ms) => {
91
+ return new Promise((resolve) => setTimeout(resolve, ms));
92
+ };
93
+
94
+ // src/utils/korean.ts
95
+ var Korean = class _Korean {
96
+ static hasFinalConsonant(word) {
97
+ if (!word) return false;
98
+ const lastChar = word[word.length - 1];
99
+ const code = lastChar.charCodeAt(0);
100
+ if (code < 44032 || code > 55203) return false;
101
+ return (code - 44032) % 28 !== 0;
102
+ }
103
+ static with(word, [withFinal, withoutFinal]) {
104
+ return word + (_Korean.hasFinalConsonant(word) ? withFinal : withoutFinal);
105
+ }
106
+ };
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ Korean,
110
+ cn,
111
+ formatHumanDateTime,
112
+ moment,
113
+ singleton,
114
+ sleep,
115
+ toSlug
116
+ });
@@ -0,0 +1,73 @@
1
+ // src/utils/cn.ts
2
+ function cn(...classes) {
3
+ return classes.filter(Boolean).join(" ").trim();
4
+ }
5
+
6
+ // src/utils/date.ts
7
+ import moment from "moment-timezone";
8
+ var formatHumanDateTime = (value) => {
9
+ const date = moment(value).tz("Asia/Seoul");
10
+ const now = moment().tz("Asia/Seoul");
11
+ if (date.isAfter(now.clone().subtract(1, "minute"))) {
12
+ return "\uBC29\uAE08 \uC804";
13
+ }
14
+ if (date.isAfter(now.clone().subtract(1, "hour"))) {
15
+ const diff = now.diff(date, "minute");
16
+ return `${diff}\uBD84 \uC804`;
17
+ }
18
+ if (date.isAfter(now.clone().subtract(6, "hours"))) {
19
+ const diff = now.diff(date, "hour");
20
+ return `${diff}\uC2DC\uAC04 \uC804`;
21
+ }
22
+ if (date.isAfter(now.clone().subtract(1, "week"))) {
23
+ const diff = now.diff(date, "day");
24
+ return `${diff}\uC77C \uC804`;
25
+ }
26
+ if (date.isSame(now, "year")) {
27
+ return date.format("M\uC6D4 D\uC77C");
28
+ }
29
+ return date.format("YYYY\uB144 M\uC6D4 D\uC77C");
30
+ };
31
+
32
+ // src/utils/singleton.ts
33
+ function singleton(name, fn) {
34
+ const globalAny = globalThis;
35
+ globalAny.__singletons = globalAny.__singletons || {};
36
+ if (!globalAny.__singletons[name]) {
37
+ globalAny.__singletons[name] = fn();
38
+ }
39
+ return globalAny.__singletons[name];
40
+ }
41
+
42
+ // src/utils/slug.ts
43
+ var toSlug = (str) => {
44
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
45
+ };
46
+
47
+ // src/utils/sleep.ts
48
+ var sleep = (ms) => {
49
+ return new Promise((resolve) => setTimeout(resolve, ms));
50
+ };
51
+
52
+ // src/utils/korean.ts
53
+ var Korean = class _Korean {
54
+ static hasFinalConsonant(word) {
55
+ if (!word) return false;
56
+ const lastChar = word[word.length - 1];
57
+ const code = lastChar.charCodeAt(0);
58
+ if (code < 44032 || code > 55203) return false;
59
+ return (code - 44032) % 28 !== 0;
60
+ }
61
+ static with(word, [withFinal, withoutFinal]) {
62
+ return word + (_Korean.hasFinalConsonant(word) ? withFinal : withoutFinal);
63
+ }
64
+ };
65
+ export {
66
+ Korean,
67
+ cn,
68
+ formatHumanDateTime,
69
+ moment,
70
+ singleton,
71
+ sleep,
72
+ toSlug
73
+ };
@@ -0,0 +1,6 @@
1
+ declare class Korean {
2
+ static hasFinalConsonant(word: string): boolean;
3
+ static with(word: string, [withFinal, withoutFinal]: [string, string]): string;
4
+ }
5
+
6
+ export { Korean };
@@ -0,0 +1,6 @@
1
+ declare class Korean {
2
+ static hasFinalConsonant(word: string): boolean;
3
+ static with(word: string, [withFinal, withoutFinal]: [string, string]): string;
4
+ }
5
+
6
+ export { Korean };
@@ -17,39 +17,25 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/crud/generate_pages.tsx
21
- var generate_pages_exports = {};
22
- __export(generate_pages_exports, {
23
- generatePages: () => generatePages
20
+ // src/utils/korean.ts
21
+ var korean_exports = {};
22
+ __export(korean_exports, {
23
+ Korean: () => Korean
24
24
  });
25
- module.exports = __toCommonJS(generate_pages_exports);
26
- var import_react_router = require("react-router");
27
- var import_jsx_runtime = require("react/jsx-runtime");
28
- var generatePages = (pages) => {
29
- function Page() {
30
- const { pathname } = (0, import_react_router.useLocation)();
31
- for (const route of Object.keys(pages)) {
32
- if (pathname.startsWith(route)) {
33
- const Page2 = pages[route].create(route);
34
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page2, {});
35
- }
36
- }
25
+ module.exports = __toCommonJS(korean_exports);
26
+ var Korean = class _Korean {
27
+ static hasFinalConsonant(word) {
28
+ if (!word) return false;
29
+ const lastChar = word[word.length - 1];
30
+ const code = lastChar.charCodeAt(0);
31
+ if (code < 44032 || code > 55203) return false;
32
+ return (code - 44032) % 28 !== 0;
33
+ }
34
+ static with(word, [withFinal, withoutFinal]) {
35
+ return word + (_Korean.hasFinalConsonant(word) ? withFinal : withoutFinal);
37
36
  }
38
- const routes = Object.keys(pages);
39
- const menus = Object.keys(pages).map((path) => {
40
- const page = pages[path];
41
- return {
42
- title: page.name,
43
- to: path
44
- };
45
- });
46
- return {
47
- Page,
48
- routes,
49
- menus
50
- };
51
37
  };
52
38
  // Annotate the CommonJS export names for ESM import in node:
53
39
  0 && (module.exports = {
54
- generatePages
40
+ Korean
55
41
  });
@@ -0,0 +1,16 @@
1
+ // src/utils/korean.ts
2
+ var Korean = class _Korean {
3
+ static hasFinalConsonant(word) {
4
+ if (!word) return false;
5
+ const lastChar = word[word.length - 1];
6
+ const code = lastChar.charCodeAt(0);
7
+ if (code < 44032 || code > 55203) return false;
8
+ return (code - 44032) % 28 !== 0;
9
+ }
10
+ static with(word, [withFinal, withoutFinal]) {
11
+ return word + (_Korean.hasFinalConsonant(word) ? withFinal : withoutFinal);
12
+ }
13
+ };
14
+ export {
15
+ Korean
16
+ };
@@ -0,0 +1,3 @@
1
+ declare function singleton<T>(name: string, fn: () => T): T;
2
+
3
+ export { singleton };
@@ -0,0 +1,3 @@
1
+ declare function singleton<T>(name: string, fn: () => T): T;
2
+
3
+ export { singleton };
@@ -0,0 +1,37 @@
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/utils/singleton.ts
21
+ var singleton_exports = {};
22
+ __export(singleton_exports, {
23
+ singleton: () => singleton
24
+ });
25
+ module.exports = __toCommonJS(singleton_exports);
26
+ function singleton(name, fn) {
27
+ const globalAny = globalThis;
28
+ globalAny.__singletons = globalAny.__singletons || {};
29
+ if (!globalAny.__singletons[name]) {
30
+ globalAny.__singletons[name] = fn();
31
+ }
32
+ return globalAny.__singletons[name];
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ singleton
37
+ });
@@ -0,0 +1,12 @@
1
+ // src/utils/singleton.ts
2
+ function singleton(name, fn) {
3
+ const globalAny = globalThis;
4
+ globalAny.__singletons = globalAny.__singletons || {};
5
+ if (!globalAny.__singletons[name]) {
6
+ globalAny.__singletons[name] = fn();
7
+ }
8
+ return globalAny.__singletons[name];
9
+ }
10
+ export {
11
+ singleton
12
+ };
@@ -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 };
@@ -17,27 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/table/item_loader.tsx
21
- var item_loader_exports = {};
22
- __export(item_loader_exports, {
23
- tableItemloader: () => tableItemloader
20
+ // src/utils/sleep.ts
21
+ var sleep_exports = {};
22
+ __export(sleep_exports, {
23
+ sleep: () => sleep
24
24
  });
25
- module.exports = __toCommonJS(item_loader_exports);
26
- var tableItemloader = ({
27
- repository
28
- }) => {
29
- return async (args) => {
30
- const { params } = args;
31
- if (params["itemId"] === "new") {
32
- return { item: void 0 };
33
- }
34
- const item = params["itemId"] ? await repository.find(params["itemId"]) : void 0;
35
- return {
36
- item
37
- };
38
- };
25
+ module.exports = __toCommonJS(sleep_exports);
26
+ var sleep = (ms) => {
27
+ return new Promise((resolve) => setTimeout(resolve, ms));
39
28
  };
40
29
  // Annotate the CommonJS export names for ESM import in node:
41
30
  0 && (module.exports = {
42
- tableItemloader
31
+ sleep
43
32
  });
@@ -0,0 +1,7 @@
1
+ // src/utils/sleep.ts
2
+ var sleep = (ms) => {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ };
5
+ export {
6
+ sleep
7
+ };
@@ -0,0 +1,3 @@
1
+ declare const toSlug: (str: string) => string;
2
+
3
+ export { toSlug };
@@ -0,0 +1,3 @@
1
+ declare const toSlug: (str: string) => string;
2
+
3
+ export { toSlug };
@@ -17,23 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/crud/generate_handlers.ts
21
- var generate_handlers_exports = {};
22
- __export(generate_handlers_exports, {
23
- generateHandlers: () => generateHandlers
20
+ // src/utils/slug.ts
21
+ var slug_exports = {};
22
+ __export(slug_exports, {
23
+ toSlug: () => toSlug
24
24
  });
25
- module.exports = __toCommonJS(generate_handlers_exports);
26
- var generateHandlers = (handlers) => {
27
- return async (args) => {
28
- const pattern = args.unstable_pattern;
29
- for (const route of Object.keys(handlers)) {
30
- if (pattern.startsWith(route) || pattern.startsWith(`/api${route}`)) {
31
- return handlers[route](route)(args);
32
- }
33
- }
34
- };
25
+ module.exports = __toCommonJS(slug_exports);
26
+ var toSlug = (str) => {
27
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
35
28
  };
36
29
  // Annotate the CommonJS export names for ESM import in node:
37
30
  0 && (module.exports = {
38
- generateHandlers
31
+ toSlug
39
32
  });
@@ -0,0 +1,7 @@
1
+ // src/utils/slug.ts
2
+ var toSlug = (str) => {
3
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
4
+ };
5
+ export {
6
+ toSlug
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",
@@ -88,7 +88,11 @@
88
88
  "dependencies": {
89
89
  "cookie": "^1.1.1",
90
90
  "dn-react-text-editor": "^0.3.9",
91
- "dn-react-toolkit": "^0.2.59",
91
+ "gw-auth": "^0.1.1",
92
+ "gw-file": "^0.1.1",
93
+ "gw-response": "^0.1.7",
94
+ "gw-result": "^0.1.7",
95
+ "moment-timezone": "^0.6.1",
92
96
  "pg": "^8.19.0",
93
97
  "react-icons": "^5.5.0",
94
98
  "react-store-input": "^0.2.1",
@@ -100,4 +104,4 @@
100
104
  "react-dom": "^19",
101
105
  "react-router": "^7.13.1"
102
106
  }
103
- }
107
+ }
@@ -1,26 +0,0 @@
1
- import { LoaderFunctionArgs, LoaderFunction } from 'react-router';
2
- import { TableItemLoaderOptions } from '../table/item_loader.mjs';
3
- import { TableRepository } from '../table/repository.mjs';
4
- import { TableLoaderOptions } from '../table/load_table.mjs';
5
- import { PgTableWithColumns } from 'drizzle-orm/pg-core';
6
- import { APIHandlerOptions } from '../api/create_api_handler.mjs';
7
- import 'drizzle-orm';
8
- import 'drizzle-orm/node-postgres';
9
- import '../auth/with_auth.mjs';
10
- import 'dn-react-toolkit/auth';
11
- import 'dn-react-toolkit/auth/server';
12
-
13
- type CrudHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
14
- repository: TableRepository<T, TSelect>;
15
- apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
16
- loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
17
- loader?: LoaderFunction;
18
- };
19
- itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository"> & {
20
- loader?: LoaderFunction;
21
- };
22
- };
23
- type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
24
- declare function crudHandler<T extends PgTableWithColumns<any>, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
25
-
26
- export { type CrudHandler, type CrudHandlerOptions, crudHandler };
@@ -1,26 +0,0 @@
1
- import { LoaderFunctionArgs, LoaderFunction } from 'react-router';
2
- import { TableItemLoaderOptions } from '../table/item_loader.js';
3
- import { TableRepository } from '../table/repository.js';
4
- import { TableLoaderOptions } from '../table/load_table.js';
5
- import { PgTableWithColumns } from 'drizzle-orm/pg-core';
6
- import { APIHandlerOptions } from '../api/create_api_handler.js';
7
- import 'drizzle-orm';
8
- import 'drizzle-orm/node-postgres';
9
- import '../auth/with_auth.js';
10
- import 'dn-react-toolkit/auth';
11
- import 'dn-react-toolkit/auth/server';
12
-
13
- type CrudHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
14
- repository: TableRepository<T, TSelect>;
15
- apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
16
- loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
17
- loader?: LoaderFunction;
18
- };
19
- itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository"> & {
20
- loader?: LoaderFunction;
21
- };
22
- };
23
- type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
24
- declare function crudHandler<T extends PgTableWithColumns<any>, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
25
-
26
- export { type CrudHandler, type CrudHandlerOptions, crudHandler };