dn-react-router-toolkit 0.7.7 → 0.7.8

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 (91) hide show
  1. package/dist/api/create_api_handler.d.mts +5 -5
  2. package/dist/api/create_api_handler.d.ts +5 -5
  3. package/dist/client/env_loader.d.mts +2 -2
  4. package/dist/client/env_loader.d.ts +2 -2
  5. package/dist/client/env_loader.js +2 -12
  6. package/dist/client/env_loader.mjs +2 -2
  7. package/dist/client/file_input.d.mts +3 -2
  8. package/dist/client/file_input.d.ts +3 -2
  9. package/dist/client/file_input.js +30 -37
  10. package/dist/client/file_input.mjs +33 -28
  11. package/dist/client/index.d.mts +1 -0
  12. package/dist/client/index.d.ts +1 -0
  13. package/dist/client/index.js +38 -44
  14. package/dist/client/index.mjs +39 -33
  15. package/dist/client/store_text_editor.d.mts +2 -2
  16. package/dist/client/store_text_editor.d.ts +2 -2
  17. package/dist/client/store_text_editor.js +3 -12
  18. package/dist/client/store_text_editor.mjs +3 -2
  19. package/dist/crud/crud_form.d.mts +5 -4
  20. package/dist/crud/crud_form.d.ts +5 -4
  21. package/dist/crud/crud_form.js +74 -72
  22. package/dist/crud/crud_form.mjs +79 -62
  23. package/dist/crud/crud_form_provider.d.mts +9 -7
  24. package/dist/crud/crud_form_provider.d.ts +9 -7
  25. package/dist/crud/crud_form_provider.js +2 -12
  26. package/dist/crud/crud_form_provider.mjs +6 -3
  27. package/dist/crud/crud_page.d.mts +10 -6
  28. package/dist/crud/crud_page.d.ts +10 -6
  29. package/dist/crud/crud_page.js +272 -409
  30. package/dist/crud/crud_page.mjs +277 -399
  31. package/dist/crud/generate_pages.d.mts +10 -2
  32. package/dist/crud/generate_pages.d.ts +10 -2
  33. package/dist/crud/generate_pages.js +17 -14
  34. package/dist/crud/generate_pages.mjs +17 -4
  35. package/dist/crud/index.d.mts +2 -1
  36. package/dist/crud/index.d.ts +2 -1
  37. package/dist/crud/index.js +290 -404
  38. package/dist/crud/index.mjs +295 -404
  39. package/dist/form/create_form_component.d.mts +3 -2
  40. package/dist/form/create_form_component.d.ts +3 -2
  41. package/dist/form/create_form_component.js +3 -12
  42. package/dist/form/create_form_component.mjs +3 -2
  43. package/dist/form/form_components.d.mts +5 -4
  44. package/dist/form/form_components.d.ts +5 -4
  45. package/dist/form/form_components.js +3 -12
  46. package/dist/form/form_components.mjs +3 -2
  47. package/dist/form/index.d.mts +1 -0
  48. package/dist/form/index.d.ts +1 -0
  49. package/dist/form/index.js +3 -12
  50. package/dist/form/index.mjs +3 -2
  51. package/dist/post/editor_toolbar.d.mts +4 -3
  52. package/dist/post/editor_toolbar.d.ts +4 -3
  53. package/dist/post/editor_toolbar.js +116 -273
  54. package/dist/post/editor_toolbar.mjs +123 -263
  55. package/dist/post/index.d.mts +1 -0
  56. package/dist/post/index.d.ts +1 -0
  57. package/dist/post/index.js +329 -411
  58. package/dist/post/index.mjs +337 -409
  59. package/dist/post/post_form_page.d.mts +5 -4
  60. package/dist/post/post_form_page.d.ts +5 -4
  61. package/dist/post/post_form_page.js +331 -413
  62. package/dist/post/post_form_page.mjs +337 -409
  63. package/dist/post/thumbnail_picker.d.mts +3 -2
  64. package/dist/post/thumbnail_picker.d.ts +3 -2
  65. package/dist/post/thumbnail_picker.js +14 -23
  66. package/dist/post/thumbnail_picker.mjs +14 -13
  67. package/dist/seo/index.d.mts +1 -1
  68. package/dist/seo/index.d.ts +1 -1
  69. package/dist/seo/index.js +2 -2
  70. package/dist/seo/index.mjs +2 -2
  71. package/dist/seo/seo.d.mts +2 -2
  72. package/dist/seo/seo.d.ts +2 -2
  73. package/dist/seo/seo.js +2 -2
  74. package/dist/seo/seo.mjs +2 -2
  75. package/dist/table/buttons.d.mts +2 -2
  76. package/dist/table/buttons.d.ts +2 -2
  77. package/dist/table/buttons.js +42 -57
  78. package/dist/table/buttons.mjs +42 -47
  79. package/dist/table/index.d.mts +1 -0
  80. package/dist/table/index.d.ts +1 -0
  81. package/dist/table/index.js +185 -338
  82. package/dist/table/index.mjs +185 -328
  83. package/dist/table/page.d.mts +5 -4
  84. package/dist/table/page.d.ts +5 -4
  85. package/dist/table/page.js +185 -338
  86. package/dist/table/page.mjs +185 -328
  87. package/dist/table/table.d.mts +5 -4
  88. package/dist/table/table.d.ts +5 -4
  89. package/dist/table/table.js +77 -237
  90. package/dist/table/table.mjs +77 -227
  91. package/package.json +7 -5
@@ -4,8 +4,10 @@ import { useLoaderData as useLoaderData2, useLocation as useLocation3 } from "re
4
4
  // src/crud/crud_form_provider.tsx
5
5
  import { useNavigate } from "react-router";
6
6
  import { useStore } from "react-store-input";
7
- import { createContext, useContext } from "react";
8
- import React from "react";
7
+ import {
8
+ createContext,
9
+ useContext
10
+ } from "react";
9
11
 
10
12
  // src/crud/serialize.ts
11
13
  function serialize(value) {
@@ -66,6 +68,7 @@ function serialize(value) {
66
68
  }
67
69
 
68
70
  // src/crud/crud_form_provider.tsx
71
+ import { jsx } from "react/jsx-runtime";
69
72
  var FormContext = createContext({});
70
73
  function useFormContext() {
71
74
  return useContext(FormContext);
@@ -146,7 +149,7 @@ function CrudFormProvider({
146
149
  delete: deleteItem,
147
150
  columns
148
151
  };
149
- return /* @__PURE__ */ React.createElement(FormContext.Provider, { value }, children);
152
+ return /* @__PURE__ */ jsx(FormContext.Provider, { value, children });
150
153
  }
151
154
 
152
155
  // src/table/page.tsx
@@ -157,160 +160,12 @@ import {
157
160
  useNavigate as useNavigate2,
158
161
  useSearchParams as useSearchParams3
159
162
  } from "react-router";
160
-
161
- // node_modules/react-icons/lib/iconBase.mjs
162
- import React3 from "react";
163
-
164
- // node_modules/react-icons/lib/iconContext.mjs
165
- import React2 from "react";
166
- var DefaultContext = {
167
- color: void 0,
168
- size: void 0,
169
- className: void 0,
170
- style: void 0,
171
- attr: void 0
172
- };
173
- var IconContext = React2.createContext && /* @__PURE__ */ React2.createContext(DefaultContext);
174
-
175
- // node_modules/react-icons/lib/iconBase.mjs
176
- var _excluded = ["attr", "size", "title"];
177
- function _objectWithoutProperties(source, excluded) {
178
- if (source == null) return {};
179
- var target = _objectWithoutPropertiesLoose(source, excluded);
180
- var key, i;
181
- if (Object.getOwnPropertySymbols) {
182
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
183
- for (i = 0; i < sourceSymbolKeys.length; i++) {
184
- key = sourceSymbolKeys[i];
185
- if (excluded.indexOf(key) >= 0) continue;
186
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
187
- target[key] = source[key];
188
- }
189
- }
190
- return target;
191
- }
192
- function _objectWithoutPropertiesLoose(source, excluded) {
193
- if (source == null) return {};
194
- var target = {};
195
- for (var key in source) {
196
- if (Object.prototype.hasOwnProperty.call(source, key)) {
197
- if (excluded.indexOf(key) >= 0) continue;
198
- target[key] = source[key];
199
- }
200
- }
201
- return target;
202
- }
203
- function _extends() {
204
- _extends = Object.assign ? Object.assign.bind() : function(target) {
205
- for (var i = 1; i < arguments.length; i++) {
206
- var source = arguments[i];
207
- for (var key in source) {
208
- if (Object.prototype.hasOwnProperty.call(source, key)) {
209
- target[key] = source[key];
210
- }
211
- }
212
- }
213
- return target;
214
- };
215
- return _extends.apply(this, arguments);
216
- }
217
- function ownKeys(e, r) {
218
- var t = Object.keys(e);
219
- if (Object.getOwnPropertySymbols) {
220
- var o = Object.getOwnPropertySymbols(e);
221
- r && (o = o.filter(function(r2) {
222
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
223
- })), t.push.apply(t, o);
224
- }
225
- return t;
226
- }
227
- function _objectSpread(e) {
228
- for (var r = 1; r < arguments.length; r++) {
229
- var t = null != arguments[r] ? arguments[r] : {};
230
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
231
- _defineProperty(e, r2, t[r2]);
232
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
233
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
234
- });
235
- }
236
- return e;
237
- }
238
- function _defineProperty(obj, key, value) {
239
- key = _toPropertyKey(key);
240
- if (key in obj) {
241
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
242
- } else {
243
- obj[key] = value;
244
- }
245
- return obj;
246
- }
247
- function _toPropertyKey(t) {
248
- var i = _toPrimitive(t, "string");
249
- return "symbol" == typeof i ? i : i + "";
250
- }
251
- function _toPrimitive(t, r) {
252
- if ("object" != typeof t || !t) return t;
253
- var e = t[Symbol.toPrimitive];
254
- if (void 0 !== e) {
255
- var i = e.call(t, r || "default");
256
- if ("object" != typeof i) return i;
257
- throw new TypeError("@@toPrimitive must return a primitive value.");
258
- }
259
- return ("string" === r ? String : Number)(t);
260
- }
261
- function Tree2Element(tree) {
262
- return tree && tree.map((node, i) => /* @__PURE__ */ React3.createElement(node.tag, _objectSpread({
263
- key: i
264
- }, node.attr), Tree2Element(node.child)));
265
- }
266
- function GenIcon(data) {
267
- return (props) => /* @__PURE__ */ React3.createElement(IconBase, _extends({
268
- attr: _objectSpread({}, data.attr)
269
- }, props), Tree2Element(data.child));
270
- }
271
- function IconBase(props) {
272
- var elem = (conf) => {
273
- var {
274
- attr,
275
- size,
276
- title
277
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
278
- var computedSize = size || conf.size || "1em";
279
- var className;
280
- if (conf.className) className = conf.className;
281
- if (props.className) className = (className ? className + " " : "") + props.className;
282
- return /* @__PURE__ */ React3.createElement("svg", _extends({
283
- stroke: "currentColor",
284
- fill: "currentColor",
285
- strokeWidth: "0"
286
- }, conf.attr, attr, svgProps, {
287
- className,
288
- style: _objectSpread(_objectSpread({
289
- color: props.color || conf.color
290
- }, conf.style), props.style),
291
- height: computedSize,
292
- width: computedSize,
293
- xmlns: "http://www.w3.org/2000/svg"
294
- }), title && /* @__PURE__ */ React3.createElement("title", null, title), props.children);
295
- };
296
- return IconContext !== void 0 ? /* @__PURE__ */ React3.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
297
- }
298
-
299
- // node_modules/react-icons/go/index.mjs
300
- function GoArrowDown(props) {
301
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4.97 13.22a.75.75 0 0 1 1.06 0L11 18.19V3.75a.75.75 0 0 1 1.5 0v14.44l4.97-4.97a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734l-6.25 6.25a.75.75 0 0 1-1.06 0l-6.25-6.25a.75.75 0 0 1 0-1.06Z" }, "child": [] }] })(props);
302
- }
303
- function GoArrowUp(props) {
304
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M18.655 10.405a.75.75 0 0 1-1.06 0l-4.97-4.97v14.44a.75.75 0 0 1-1.5 0V5.435l-4.97 4.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l6.25-6.25a.75.75 0 0 1 1.06 0l6.25 6.25a.75.75 0 0 1 0 1.06Z" }, "child": [] }] })(props);
305
- }
306
- function GoSearch(props) {
307
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10.25 2a8.25 8.25 0 0 1 6.34 13.53l5.69 5.69a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-5.69-5.69A8.25 8.25 0 1 1 10.25 2ZM3.5 10.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0Z" }, "child": [] }] })(props);
308
- }
163
+ import { GoSearch } from "react-icons/go";
309
164
 
310
165
  // src/table/buttons.tsx
311
166
  import { cn } from "dn-react-toolkit/utils";
312
167
  import { Link, useLocation, useSearchParams } from "react-router";
313
- import React4 from "react";
168
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
314
169
  function TablePageButtons({
315
170
  MAX_PAGES_TO_SHOW,
316
171
  total,
@@ -323,63 +178,59 @@ function TablePageButtons({
323
178
  const currentPage = Math.floor(offset / limit) + 1;
324
179
  const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
325
180
  const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
326
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, pages > 1 && /* @__PURE__ */ React4.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ React4.createElement(
327
- Link,
328
- {
329
- to: (() => {
330
- searchParams.set(
331
- "offset",
332
- String((startButton - 1) * limit)
333
- );
334
- return `${pathname}?${searchParams.toString()}`;
335
- })(),
336
- className: "w-10 block text-center transition-colors hover:text-primary"
337
- },
338
- "\uC774\uC804"
339
- ), Array.from({
340
- length: Math.min(
341
- MAX_PAGES_TO_SHOW,
342
- pages - startButton
343
- )
344
- }).map((_, index) => {
345
- return /* @__PURE__ */ React4.createElement(
181
+ return /* @__PURE__ */ jsx2(Fragment, { children: pages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400", children: [
182
+ startButton > 1 && /* @__PURE__ */ jsx2(
346
183
  Link,
347
184
  {
348
- key: index,
349
185
  to: (() => {
350
- searchParams.set(
351
- "offset",
352
- String((startButton + index) * limit)
353
- );
186
+ searchParams.set("offset", String((startButton - 1) * limit));
354
187
  return `${pathname}?${searchParams.toString()}`;
355
188
  })(),
356
- className: cn(
357
- "w-6 block text-center transition-colors",
358
- currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
359
- )
360
- },
361
- startButton + index + 1
362
- );
363
- }), endButton < pages && /* @__PURE__ */ React4.createElement(
364
- Link,
365
- {
366
- to: (() => {
367
- searchParams.set(
368
- "offset",
369
- String((endButton + 1) * limit)
370
- );
371
- return `${pathname}?${searchParams.toString()}`;
372
- })(),
373
- className: "w-10 block text-center transition-colors hover:text-primary"
374
- },
375
- "\uB2E4\uC74C"
376
- )));
189
+ className: "w-10 block text-center transition-colors hover:text-primary",
190
+ children: "\uC774\uC804"
191
+ }
192
+ ),
193
+ Array.from({
194
+ length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
195
+ }).map((_, index) => {
196
+ return /* @__PURE__ */ jsx2(
197
+ Link,
198
+ {
199
+ to: (() => {
200
+ searchParams.set(
201
+ "offset",
202
+ String((startButton + index) * limit)
203
+ );
204
+ return `${pathname}?${searchParams.toString()}`;
205
+ })(),
206
+ className: cn(
207
+ "w-6 block text-center transition-colors",
208
+ currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
209
+ ),
210
+ children: startButton + index + 1
211
+ },
212
+ index
213
+ );
214
+ }),
215
+ endButton < pages && /* @__PURE__ */ jsx2(
216
+ Link,
217
+ {
218
+ to: (() => {
219
+ searchParams.set("offset", String((endButton + 1) * limit));
220
+ return `${pathname}?${searchParams.toString()}`;
221
+ })(),
222
+ className: "w-10 block text-center transition-colors hover:text-primary",
223
+ children: "\uB2E4\uC74C"
224
+ }
225
+ )
226
+ ] }) });
377
227
  }
378
228
 
379
229
  // src/table/table.tsx
380
230
  import { cn as cn2 } from "dn-react-toolkit/utils";
231
+ import { GoArrowDown, GoArrowUp } from "react-icons/go";
381
232
  import { Link as Link2, useSearchParams as useSearchParams2 } from "react-router";
382
- import React5 from "react";
233
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
383
234
  function Table({
384
235
  className = "min-w-full whitespace-nowrap",
385
236
  data,
@@ -394,95 +245,92 @@ function Table({
394
245
  const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
395
246
  const sortedArray = [...data];
396
247
  const [_, setSearchParams] = useSearchParams2();
397
- return /* @__PURE__ */ React5.createElement(
248
+ return /* @__PURE__ */ jsxs2(
398
249
  "table",
399
250
  {
400
- className: cn2(
401
- className,
402
- "text-[15px] border-separate border-spacing-0"
403
- )
404
- },
405
- /* @__PURE__ */ React5.createElement("thead", null, /* @__PURE__ */ React5.createElement("tr", null, keys.map((key) => {
406
- const value = columns[key];
407
- function getReactNode() {
408
- if (value && typeof value === "object" && "label" in value) {
409
- return value.label;
410
- }
411
- return value;
412
- }
413
- function Head() {
414
- const reactNode = getReactNode();
415
- if (typeof reactNode === "string") {
416
- return /* @__PURE__ */ React5.createElement(
417
- "button",
251
+ className: cn2(className, "text-[15px] border-separate border-spacing-0"),
252
+ children: [
253
+ /* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsx3("tr", { children: keys.map((key) => {
254
+ const value = columns[key];
255
+ function getReactNode() {
256
+ if (value && typeof value === "object" && "label" in value) {
257
+ return value.label;
258
+ }
259
+ return value;
260
+ }
261
+ function Head() {
262
+ const reactNode = getReactNode();
263
+ if (typeof reactNode === "string") {
264
+ return /* @__PURE__ */ jsxs2(
265
+ "button",
266
+ {
267
+ className: cn2(
268
+ orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
269
+ "px-4 h-14 flex items-center w-full"
270
+ ),
271
+ onClick: () => {
272
+ let newDirection = "asc";
273
+ if (orderBy === key) {
274
+ newDirection = direction === "asc" ? "desc" : "asc";
275
+ }
276
+ setSearchParams({
277
+ orderBy: key,
278
+ direction: newDirection
279
+ });
280
+ },
281
+ children: [
282
+ reactNode,
283
+ orderBy === key && /* @__PURE__ */ jsx3("div", { className: "ml-0.5", children: direction === "asc" ? /* @__PURE__ */ jsx3(GoArrowUp, {}) : /* @__PURE__ */ jsx3(GoArrowDown, {}) })
284
+ ]
285
+ }
286
+ );
287
+ }
288
+ return /* @__PURE__ */ jsx3(Fragment2, { children: reactNode });
289
+ }
290
+ return /* @__PURE__ */ jsx3("th", { className: cn2("border-y font-normal"), children: /* @__PURE__ */ jsx3(Head, {}) }, key);
291
+ }) }) }),
292
+ /* @__PURE__ */ jsxs2("tbody", { children: [
293
+ sortedArray.length === 0 && /* @__PURE__ */ jsx3("tr", { children: /* @__PURE__ */ jsx3(
294
+ "td",
418
295
  {
419
- className: cn2(
420
- orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
421
- "px-4 h-14 flex items-center w-full"
422
- ),
423
- onClick: () => {
424
- let newDirection = "asc";
425
- if (orderBy === key) {
426
- newDirection = direction === "asc" ? "desc" : "asc";
296
+ colSpan: keys.length,
297
+ className: "px-4 h-14 text-neutral-400 text-center",
298
+ children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
299
+ }
300
+ ) }),
301
+ sortedArray.map((item, i) => /* @__PURE__ */ jsx3("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
302
+ const value = item[key];
303
+ function Content() {
304
+ if (key in columns) {
305
+ const column = columns[key];
306
+ if (column && typeof column === "object" && "mapper" in column) {
307
+ const mapper = column.mapper;
308
+ if (mapper) {
309
+ return /* @__PURE__ */ jsx3(Fragment2, { children: mapper(item) });
310
+ }
427
311
  }
428
- setSearchParams({
429
- orderBy: key,
430
- direction: newDirection
431
- });
432
312
  }
433
- },
434
- reactNode,
435
- orderBy === key && /* @__PURE__ */ React5.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ React5.createElement(GoArrowUp, null) : /* @__PURE__ */ React5.createElement(GoArrowDown, null))
436
- );
437
- }
438
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, reactNode);
439
- }
440
- return /* @__PURE__ */ React5.createElement(
441
- "th",
442
- {
443
- key,
444
- className: cn2("border-y font-normal")
445
- },
446
- /* @__PURE__ */ React5.createElement(Head, null)
447
- );
448
- }))),
449
- /* @__PURE__ */ React5.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ React5.createElement("tr", null, /* @__PURE__ */ React5.createElement(
450
- "td",
451
- {
452
- colSpan: keys.length,
453
- className: "px-4 h-14 text-neutral-400 text-center"
454
- },
455
- "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
456
- )), sortedArray.map((item, i) => /* @__PURE__ */ React5.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
457
- const value = item[key];
458
- function Content() {
459
- if (key in columns) {
460
- const column = columns[key];
461
- if (column && typeof column === "object" && "mapper" in column) {
462
- const mapper = column.mapper;
463
- if (mapper) {
464
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, mapper(item));
313
+ return /* @__PURE__ */ jsx3(Fragment2, { children: String(value) });
465
314
  }
466
- }
467
- }
468
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, String(value));
469
- }
470
- const linkedContent = getLink ? /* @__PURE__ */ React5.createElement(
471
- Link2,
472
- {
473
- to: getLink(item),
474
- className: "block content-center px-4 w-full h-full"
475
- },
476
- /* @__PURE__ */ React5.createElement(Content, null)
477
- ) : /* @__PURE__ */ React5.createElement(Content, null);
478
- const cell = Mapper ? /* @__PURE__ */ React5.createElement(Mapper, { item, index: i2 }, linkedContent) : linkedContent;
479
- return /* @__PURE__ */ React5.createElement("td", { key, className: "px-0 h-14 border-b" }, cell);
480
- }))))
315
+ const linkedContent = getLink ? /* @__PURE__ */ jsx3(
316
+ Link2,
317
+ {
318
+ to: getLink(item),
319
+ className: "block content-center px-4 w-full h-full",
320
+ children: /* @__PURE__ */ jsx3(Content, {})
321
+ }
322
+ ) : /* @__PURE__ */ jsx3(Content, {});
323
+ const cell = Mapper ? /* @__PURE__ */ jsx3(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
324
+ return /* @__PURE__ */ jsx3("td", { className: "px-0 h-14 border-b", children: cell }, key);
325
+ }) }, i))
326
+ ] })
327
+ ]
328
+ }
481
329
  );
482
330
  }
483
331
 
484
332
  // src/table/page.tsx
485
- import React6 from "react";
333
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
486
334
  function createTablePage({
487
335
  name,
488
336
  columns,
@@ -502,73 +350,83 @@ function createTablePage({
502
350
  navigate(`${pathname}?${searchParams2.toString()}`);
503
351
  };
504
352
  const [searchParams] = useSearchParams3();
505
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
506
- Header,
507
- {
508
- title: name,
509
- actions: /* @__PURE__ */ React6.createElement(Link3, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
510
- }
511
- ), /* @__PURE__ */ React6.createElement("div", { className: "max-w-7xl mx-auto w-full overflow-auto" }, searchKey && /* @__PURE__ */ React6.createElement(
512
- "form",
513
- {
514
- className: "h-18 px-4 flex items-center border-t",
515
- onSubmit: (e) => {
516
- e.preventDefault();
517
- const formData = new FormData(e.currentTarget);
518
- const query = formData.get("query");
519
- search(query);
520
- }
521
- },
522
- /* @__PURE__ */ React6.createElement(
523
- "button",
353
+ return /* @__PURE__ */ jsxs3(Fragment3, { children: [
354
+ /* @__PURE__ */ jsx4(
355
+ Header,
524
356
  {
525
- type: "submit",
526
- className: "w-10 h-10 flex justify-center items-center"
527
- },
528
- /* @__PURE__ */ React6.createElement(GoSearch, { className: "text-xl mr-4" })
529
- ),
530
- /* @__PURE__ */ React6.createElement(
531
- "input",
532
- {
533
- className: "outline-none h-full flex-1",
534
- placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
535
- name: "query",
536
- defaultValue: searchParams.get("query") ?? ""
357
+ title: name,
358
+ actions: /* @__PURE__ */ jsxs3(Link3, { to: `${pathname}/new`, className: "button-primary", children: [
359
+ name,
360
+ " \uCD94\uAC00"
361
+ ] })
537
362
  }
538
- )
539
- ), /* @__PURE__ */ React6.createElement(
540
- Table,
541
- {
542
- data: items,
543
- columns,
544
- getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
545
- limit,
546
- offset,
547
- orderBy,
548
- direction
549
- }
550
- ), /* @__PURE__ */ React6.createElement(
551
- TablePageButtons,
552
- {
553
- total,
554
- limit,
555
- offset,
556
- MAX_PAGES_TO_SHOW: 10
557
- }
558
- )));
363
+ ),
364
+ /* @__PURE__ */ jsxs3("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
365
+ searchKey && /* @__PURE__ */ jsxs3(
366
+ "form",
367
+ {
368
+ className: "h-18 px-4 flex items-center border-t",
369
+ onSubmit: (e) => {
370
+ e.preventDefault();
371
+ const formData = new FormData(e.currentTarget);
372
+ const query = formData.get("query");
373
+ search(query);
374
+ },
375
+ children: [
376
+ /* @__PURE__ */ jsx4(
377
+ "button",
378
+ {
379
+ type: "submit",
380
+ className: "w-10 h-10 flex justify-center items-center",
381
+ children: /* @__PURE__ */ jsx4(GoSearch, { className: "text-xl mr-4" })
382
+ }
383
+ ),
384
+ /* @__PURE__ */ jsx4(
385
+ "input",
386
+ {
387
+ className: "outline-none h-full flex-1",
388
+ placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
389
+ name: "query",
390
+ defaultValue: searchParams.get("query") ?? ""
391
+ }
392
+ )
393
+ ]
394
+ }
395
+ ),
396
+ /* @__PURE__ */ jsx4(
397
+ Table,
398
+ {
399
+ data: items,
400
+ columns,
401
+ getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
402
+ limit,
403
+ offset,
404
+ orderBy,
405
+ direction
406
+ }
407
+ ),
408
+ /* @__PURE__ */ jsx4(
409
+ TablePageButtons,
410
+ {
411
+ total,
412
+ limit,
413
+ offset,
414
+ MAX_PAGES_TO_SHOW: 10
415
+ }
416
+ )
417
+ ] })
418
+ ] });
559
419
  };
560
420
  }
561
421
 
562
- // src/crud/crud_form.tsx
563
- import React11 from "react";
564
-
565
422
  // src/form/create_form_component.tsx
566
423
  import { cn as cn3 } from "dn-react-toolkit/utils";
567
- import React7 from "react";
424
+ import "react";
425
+ import { jsx as jsx5 } from "react/jsx-runtime";
568
426
  function createComponent(tag, options) {
569
427
  return function FormComponent({ className, ...props }) {
570
428
  const Tag = tag;
571
- return /* @__PURE__ */ React7.createElement(Tag, { ...props, className: cn3(options.className, className) });
429
+ return /* @__PURE__ */ jsx5(Tag, { ...props, className: cn3(options.className, className) });
572
430
  };
573
431
  }
574
432
 
@@ -587,12 +445,14 @@ var FormLabel = createComponent("label", {
587
445
  import { useStoreComponent } from "react-store-input";
588
446
 
589
447
  // src/client/env_loader.tsx
590
- import React8 from "react";
591
448
  import { useRouteLoaderData } from "react-router";
449
+ import { jsx as jsx6 } from "react/jsx-runtime";
592
450
 
593
451
  // src/client/file_input.tsx
594
- import "react";
595
- import React9 from "react";
452
+ import {
453
+ useRef
454
+ } from "react";
455
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
596
456
 
597
457
  // src/client/use_user_agent.tsx
598
458
  import { useRouteLoaderData as useRouteLoaderData2 } from "react-router";
@@ -602,7 +462,8 @@ import {
602
462
  TextEditor
603
463
  } from "dn-react-text-editor";
604
464
  import { useStoreController } from "react-store-input";
605
- import React10, { useImperativeHandle, useRef } from "react";
465
+ import { useImperativeHandle, useRef as useRef2 } from "react";
466
+ import { jsx as jsx8 } from "react/jsx-runtime";
606
467
  function StoreTextEditor({
607
468
  store,
608
469
  name,
@@ -612,7 +473,7 @@ function StoreTextEditor({
612
473
  ref,
613
474
  ...props
614
475
  }) {
615
- const controllerRef = useRef(null);
476
+ const controllerRef = useRef2(null);
616
477
  useImperativeHandle(
617
478
  ref,
618
479
  () => controllerRef.current,
@@ -661,7 +522,7 @@ function StoreTextEditor({
661
522
  }
662
523
  return void 0;
663
524
  };
664
- return /* @__PURE__ */ React10.createElement(
525
+ return /* @__PURE__ */ jsx8(
665
526
  TextEditor,
666
527
  {
667
528
  ...props,
@@ -679,71 +540,84 @@ function StoreTextEditor({
679
540
  import { generateMetadata } from "dn-react-toolkit/file/client";
680
541
 
681
542
  // src/crud/crud_form.tsx
543
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
682
544
  function CrudForm({
683
545
  AdminHeader
684
546
  }) {
685
547
  const form = useFormContext();
686
548
  const component = useStoreComponent(form.store);
687
- return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
688
- AdminHeader,
689
- {
690
- title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
691
- actions: /* @__PURE__ */ React11.createElement(React11.Fragment, null, form.item && /* @__PURE__ */ React11.createElement(
692
- "button",
693
- {
694
- type: "button",
695
- className: "button-outline",
696
- onClick: () => {
697
- form.delete();
549
+ return /* @__PURE__ */ jsxs5(Fragment5, { children: [
550
+ /* @__PURE__ */ jsx9(
551
+ AdminHeader,
552
+ {
553
+ title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
554
+ actions: /* @__PURE__ */ jsxs5(Fragment5, { children: [
555
+ form.item && /* @__PURE__ */ jsx9(
556
+ "button",
557
+ {
558
+ type: "button",
559
+ className: "button-outline",
560
+ onClick: () => {
561
+ form.delete();
562
+ },
563
+ children: "\uC0AD\uC81C\uD558\uAE30"
564
+ }
565
+ ),
566
+ /* @__PURE__ */ jsx9(
567
+ "button",
568
+ {
569
+ type: "button",
570
+ className: "button-primary",
571
+ onClick: form.submit,
572
+ children: "\uC800\uC7A5\uD558\uAE30"
573
+ }
574
+ )
575
+ ] })
576
+ }
577
+ ),
578
+ /* @__PURE__ */ jsx9("div", { className: "max-w-2xl mx-auto", children: Object.keys(form.columns).length > 0 && /* @__PURE__ */ jsx9(Fragment5, { children: Object.entries(form.columns).map(
579
+ ([name, value]) => {
580
+ function InputComponent() {
581
+ if (value.type === "textarea") {
582
+ return /* @__PURE__ */ jsx9(
583
+ StoreTextEditor,
584
+ {
585
+ store: form.store,
586
+ name
587
+ }
588
+ );
698
589
  }
699
- },
700
- "\uC0AD\uC81C\uD558\uAE30"
701
- ), /* @__PURE__ */ React11.createElement(
702
- "button",
703
- {
704
- type: "button",
705
- className: "button-primary",
706
- onClick: form.submit
707
- },
708
- "\uC800\uC7A5\uD558\uAE30"
709
- ))
710
- }
711
- ), /* @__PURE__ */ React11.createElement("div", { className: "max-w-2xl mx-auto" }, Object.keys(form.columns).length > 0 && /* @__PURE__ */ React11.createElement(React11.Fragment, null, Object.entries(form.columns).map(
712
- ([name, value]) => {
713
- function InputComponent() {
714
- if (value.type === "textarea") {
715
- return /* @__PURE__ */ React11.createElement(
716
- StoreTextEditor,
590
+ if (value.options) {
591
+ const Component = value.options;
592
+ return /* @__PURE__ */ jsx9(component.select, { name, className: "select-form", children: /* @__PURE__ */ jsx9(Component, {}) });
593
+ }
594
+ return /* @__PURE__ */ jsx9(
595
+ component.input,
717
596
  {
718
- store: form.store,
719
- name
597
+ name,
598
+ type: value.type,
599
+ className: "input-form"
720
600
  }
721
601
  );
722
602
  }
723
- if (value.options) {
724
- const Component = value.options;
725
- return /* @__PURE__ */ React11.createElement(component.select, { name, className: "select-form" }, /* @__PURE__ */ React11.createElement(Component, null));
603
+ const v = form.store.state[name];
604
+ if (typeof v === "boolean") {
605
+ return /* @__PURE__ */ jsxs5("div", { className: "flex", children: [
606
+ value.label,
607
+ /* @__PURE__ */ jsx9("div", { className: "ml-auto", children: /* @__PURE__ */ jsx9(InputComponent, {}) })
608
+ ] });
726
609
  }
727
- return /* @__PURE__ */ React11.createElement(
728
- component.input,
729
- {
730
- name,
731
- type: value.type,
732
- className: "input-form"
733
- }
734
- );
735
- }
736
- const v = form.store.state[name];
737
- if (typeof v === "boolean") {
738
- return /* @__PURE__ */ React11.createElement("div", { className: "flex" }, value.label, /* @__PURE__ */ React11.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React11.createElement(InputComponent, null)));
610
+ return /* @__PURE__ */ jsx9(FormRow, { children: /* @__PURE__ */ jsxs5(FormEntry, { children: [
611
+ /* @__PURE__ */ jsx9(FormLabel, { children: value.label }, name),
612
+ /* @__PURE__ */ jsx9(InputComponent, {})
613
+ ] }) });
739
614
  }
740
- return /* @__PURE__ */ React11.createElement(FormRow, null, /* @__PURE__ */ React11.createElement(FormEntry, null, /* @__PURE__ */ React11.createElement(FormLabel, { key: name }, value.label), /* @__PURE__ */ React11.createElement(InputComponent, null)));
741
- }
742
- ))));
615
+ ) }) })
616
+ ] });
743
617
  }
744
618
 
745
619
  // src/crud/crud_page.tsx
746
- import React12 from "react";
620
+ import { jsx as jsx10 } from "react/jsx-runtime";
747
621
  function crudPage({
748
622
  name,
749
623
  primaryKey,
@@ -751,7 +625,7 @@ function crudPage({
751
625
  formOptions,
752
626
  header
753
627
  }) {
754
- return (prefix) => {
628
+ const create = (prefix) => {
755
629
  return function Page() {
756
630
  const data = useLoaderData2();
757
631
  const { pathname } = useLocation3();
@@ -760,29 +634,33 @@ function crudPage({
760
634
  ...tablePageOptions,
761
635
  name
762
636
  });
763
- return /* @__PURE__ */ React12.createElement(Component, { header });
637
+ return /* @__PURE__ */ jsx10(Component, { header });
764
638
  }
765
639
  if (pathname.startsWith(prefix)) {
766
- return /* @__PURE__ */ React12.createElement(
640
+ return /* @__PURE__ */ jsx10(
767
641
  CrudFormProvider,
768
642
  {
769
643
  item: data?.item,
770
644
  prefix,
771
645
  name,
772
646
  columns: formOptions.columns,
773
- primaryKey
774
- },
775
- formOptions.form ? /* @__PURE__ */ React12.createElement(FormDelegate, { component: formOptions.form }) : /* @__PURE__ */ React12.createElement(CrudForm, { AdminHeader: header })
647
+ primaryKey,
648
+ children: formOptions.form ? /* @__PURE__ */ jsx10(FormDelegate, { component: formOptions.form }) : /* @__PURE__ */ jsx10(CrudForm, { AdminHeader: header })
649
+ }
776
650
  );
777
651
  }
778
652
  };
779
653
  };
654
+ return {
655
+ name,
656
+ create
657
+ };
780
658
  }
781
659
  function FormDelegate({
782
660
  component: Component
783
661
  }) {
784
662
  const form = useFormContext();
785
- return /* @__PURE__ */ React12.createElement(Component, { form });
663
+ return /* @__PURE__ */ jsx10(Component, { form });
786
664
  }
787
665
  export {
788
666
  crudPage