dn-react-router-toolkit 0.5.7 → 0.5.9

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.
@@ -119,7 +119,7 @@ function CrudForm({ AdminLayout }) {
119
119
  if (value.type === "textarea") {
120
120
  const Editor = (0, import_store2.useSyncTextEditor)(textarea);
121
121
  return /* @__PURE__ */ import_react3.default.createElement(
122
- Editor.SyncTextEditor,
122
+ Editor.Component,
123
123
  {
124
124
  store: form.store,
125
125
  property: key
@@ -88,7 +88,7 @@ function CrudForm({ AdminLayout }) {
88
88
  if (value.type === "textarea") {
89
89
  const Editor = useSyncTextEditor(textarea);
90
90
  return /* @__PURE__ */ React2.createElement(
91
- Editor.SyncTextEditor,
91
+ Editor.Component,
92
92
  {
93
93
  store: form.store,
94
94
  property: key
@@ -635,7 +635,7 @@ function CrudForm({ AdminLayout }) {
635
635
  if (value.type === "textarea") {
636
636
  const Editor = (0, import_store2.useSyncTextEditor)(textarea);
637
637
  return /* @__PURE__ */ import_react8.default.createElement(
638
- Editor.SyncTextEditor,
638
+ Editor.Component,
639
639
  {
640
640
  store: form.store,
641
641
  property: key
@@ -612,7 +612,7 @@ function CrudForm({ AdminLayout }) {
612
612
  if (value.type === "textarea") {
613
613
  const Editor = useSyncTextEditor(textarea);
614
614
  return /* @__PURE__ */ React7.createElement(
615
- Editor.SyncTextEditor,
615
+ Editor.Component,
616
616
  {
617
617
  store: form.store,
618
618
  property: key
@@ -233,7 +233,7 @@ function CrudForm({ AdminLayout }) {
233
233
  if (value.type === "textarea") {
234
234
  const Editor = (0, import_store2.useSyncTextEditor)(textarea);
235
235
  return /* @__PURE__ */ import_react3.default.createElement(
236
- Editor.SyncTextEditor,
236
+ Editor.Component,
237
237
  {
238
238
  store: form.store,
239
239
  property: key
@@ -196,7 +196,7 @@ function CrudForm({ AdminLayout }) {
196
196
  if (value.type === "textarea") {
197
197
  const Editor = useSyncTextEditor(textarea);
198
198
  return /* @__PURE__ */ React2.createElement(
199
- Editor.SyncTextEditor,
199
+ Editor.Component,
200
200
  {
201
201
  store: form.store,
202
202
  property: key
@@ -1,6 +1,3 @@
1
- import 'drizzle-orm/node-postgres';
2
- import 'drizzle-orm';
3
- import 'drizzle-orm/pg-core';
4
1
  import { ObjectStorage } from 'dn-react-toolkit/file/server';
5
2
 
6
3
  declare const backup: ({ objectStorage }: {
@@ -1,6 +1,3 @@
1
- import 'drizzle-orm/node-postgres';
2
- import 'drizzle-orm';
3
- import 'drizzle-orm/pg-core';
4
1
  import { ObjectStorage } from 'dn-react-toolkit/file/server';
5
2
 
6
3
  declare const backup: ({ objectStorage }: {
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/db/backup.ts
30
+ // src/db/backup/index.ts
31
31
  var backup_exports = {};
32
32
  __export(backup_exports, {
33
33
  backup: () => backup
@@ -1,4 +1,4 @@
1
- // src/db/backup.ts
1
+ // src/db/backup/index.ts
2
2
  import { promisify } from "util";
3
3
  import * as fs from "fs";
4
4
  import { exec } from "child_process";
@@ -2,5 +2,3 @@ export { drizzle } from 'drizzle-orm/node-postgres';
2
2
  export * from 'drizzle-orm';
3
3
  import * as pgCore from 'drizzle-orm/pg-core';
4
4
  export { pgCore as core };
5
- export { backup } from './backup.mjs';
6
- import 'dn-react-toolkit/file/server';
@@ -2,5 +2,3 @@ export { drizzle } from 'drizzle-orm/node-postgres';
2
2
  export * from 'drizzle-orm';
3
3
  import * as pgCore from 'drizzle-orm/pg-core';
4
4
  export { pgCore as core };
5
- export { backup } from './backup.js';
6
- import 'dn-react-toolkit/file/server';
package/dist/db/index.js CHANGED
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/db/index.ts
32
32
  var db_exports = {};
33
33
  __export(db_exports, {
34
- backup: () => backup,
35
34
  core: () => core,
36
35
  drizzle: () => import_node_postgres.drizzle
37
36
  });
@@ -39,27 +38,8 @@ module.exports = __toCommonJS(db_exports);
39
38
  var import_node_postgres = require("drizzle-orm/node-postgres");
40
39
  __reExport(db_exports, require("drizzle-orm"), module.exports);
41
40
  var core = __toESM(require("drizzle-orm/pg-core"));
42
-
43
- // src/db/backup.ts
44
- var import_util = require("util");
45
- var fs = __toESM(require("fs"));
46
- var import_child_process = require("child_process");
47
- var backup = ({ objectStorage }) => async () => {
48
- const now = /* @__PURE__ */ new Date();
49
- console.log(`Running daily database backup at ${now.toISOString()}`);
50
- const out = "./backup.sql";
51
- const databaseUrl = `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`;
52
- await (0, import_util.promisify)(import_child_process.exec)(`pg_dump --dbname=${databaseUrl} > ${out}`);
53
- const buffer = await (0, import_util.promisify)(fs.readFile)(out);
54
- await objectStorage.put(`backup/${now.toISOString()}.sql`, buffer, {
55
- contentType: "application/sql"
56
- });
57
- await (0, import_util.promisify)(fs.unlink)(out);
58
- console.log("Database backup completed and uploaded to object storage");
59
- };
60
41
  // Annotate the CommonJS export names for ESM import in node:
61
42
  0 && (module.exports = {
62
- backup,
63
43
  core,
64
44
  drizzle,
65
45
  ...require("drizzle-orm")
package/dist/db/index.mjs CHANGED
@@ -2,26 +2,7 @@
2
2
  import { drizzle } from "drizzle-orm/node-postgres";
3
3
  export * from "drizzle-orm";
4
4
  import * as core from "drizzle-orm/pg-core";
5
-
6
- // src/db/backup.ts
7
- import { promisify } from "util";
8
- import * as fs from "fs";
9
- import { exec } from "child_process";
10
- var backup = ({ objectStorage }) => async () => {
11
- const now = /* @__PURE__ */ new Date();
12
- console.log(`Running daily database backup at ${now.toISOString()}`);
13
- const out = "./backup.sql";
14
- const databaseUrl = `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`;
15
- await promisify(exec)(`pg_dump --dbname=${databaseUrl} > ${out}`);
16
- const buffer = await promisify(fs.readFile)(out);
17
- await objectStorage.put(`backup/${now.toISOString()}.sql`, buffer, {
18
- contentType: "application/sql"
19
- });
20
- await promisify(fs.unlink)(out);
21
- console.log("Database backup completed and uploaded to object storage");
22
- };
23
5
  export {
24
- backup,
25
6
  core,
26
7
  drizzle
27
8
  };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,32 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/post/index.ts
27
+ var post_exports = {};
28
+ module.exports = __toCommonJS(post_exports);
29
+
30
+ // src/post/thumbnail_picker.tsx
31
+ var import_utils = require("dn-react-toolkit/utils");
32
+ var import_react = __toESM(require("react"));
@@ -0,0 +1,3 @@
1
+ // src/post/thumbnail_picker.tsx
2
+ import { cn } from "dn-react-toolkit/utils";
3
+ import React, { useEffect, useState } from "react";
@@ -0,0 +1,17 @@
1
+ import { RxStore, useSyncTextEditor } from 'dn-react-toolkit/store';
2
+ import React from 'react';
3
+
4
+ declare function PostThumbnailPicker<T extends {
5
+ thumbnail: string | null;
6
+ }>({ store, textEditor, ResponsiveImage, }: {
7
+ store: RxStore<T>;
8
+ textEditor: ReturnType<typeof useSyncTextEditor>["textEditor"];
9
+ ResponsiveImage: React.FC<{
10
+ src: string;
11
+ alt: string;
12
+ className?: string;
13
+ sizes?: string;
14
+ }>;
15
+ }): React.JSX.Element;
16
+
17
+ export { PostThumbnailPicker as default };
@@ -0,0 +1,17 @@
1
+ import { RxStore, useSyncTextEditor } from 'dn-react-toolkit/store';
2
+ import React from 'react';
3
+
4
+ declare function PostThumbnailPicker<T extends {
5
+ thumbnail: string | null;
6
+ }>({ store, textEditor, ResponsiveImage, }: {
7
+ store: RxStore<T>;
8
+ textEditor: ReturnType<typeof useSyncTextEditor>["textEditor"];
9
+ ResponsiveImage: React.FC<{
10
+ src: string;
11
+ alt: string;
12
+ className?: string;
13
+ sizes?: string;
14
+ }>;
15
+ }): React.JSX.Element;
16
+
17
+ export { PostThumbnailPicker as default };
@@ -0,0 +1,97 @@
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/post/thumbnail_picker.tsx
31
+ var thumbnail_picker_exports = {};
32
+ __export(thumbnail_picker_exports, {
33
+ default: () => PostThumbnailPicker
34
+ });
35
+ module.exports = __toCommonJS(thumbnail_picker_exports);
36
+ var import_utils = require("dn-react-toolkit/utils");
37
+ var import_react = __toESM(require("react"));
38
+ function PostThumbnailPicker({
39
+ store,
40
+ textEditor,
41
+ ResponsiveImage
42
+ }) {
43
+ const thumbnail = store.useSelector((state) => state.thumbnail);
44
+ const [thumbnails, setThumbnails] = (0, import_react.useState)([]);
45
+ (0, import_react.useEffect)(() => {
46
+ const update = () => {
47
+ const html = textEditor.commands.serialize();
48
+ if (!html) {
49
+ return;
50
+ }
51
+ const parser = new DOMParser();
52
+ const docHtml = parser.parseFromString(html, "text/html");
53
+ const images = docHtml.querySelectorAll("img");
54
+ const thumbnails2 = Array.from(images).map((img) => img.src);
55
+ setThumbnails(thumbnails2);
56
+ if (thumbnails2.length > 0 && !store.state.thumbnail) {
57
+ store.dispatch((state) => {
58
+ state.thumbnail = thumbnails2[0];
59
+ });
60
+ }
61
+ };
62
+ const sub = textEditor.subject.subscribe((tr) => {
63
+ update();
64
+ });
65
+ setTimeout(() => {
66
+ update();
67
+ }, 0);
68
+ return () => {
69
+ sub.unsubscribe();
70
+ };
71
+ }, []);
72
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "grid grid-cols-2 gap-1" }, thumbnails.map((url, index) => /* @__PURE__ */ import_react.default.createElement(
73
+ "button",
74
+ {
75
+ key: index,
76
+ type: "button",
77
+ className: (0, import_utils.cn)(
78
+ "border border-neutral-200 rounded-lg overflow-hidden aspect-4/3",
79
+ thumbnail === url && "border-transparent ring-2 ring-primary"
80
+ ),
81
+ onClick: () => {
82
+ store.dispatch((state) => {
83
+ state.thumbnail = url;
84
+ });
85
+ }
86
+ },
87
+ /* @__PURE__ */ import_react.default.createElement(
88
+ ResponsiveImage,
89
+ {
90
+ src: url,
91
+ alt: `Thumbnail ${index + 1}`,
92
+ className: "w-full h-full object-cover",
93
+ sizes: "200px"
94
+ }
95
+ )
96
+ )));
97
+ }
@@ -0,0 +1,66 @@
1
+ // src/post/thumbnail_picker.tsx
2
+ import { cn } from "dn-react-toolkit/utils";
3
+ import React, { useEffect, useState } from "react";
4
+ function PostThumbnailPicker({
5
+ store,
6
+ textEditor,
7
+ ResponsiveImage
8
+ }) {
9
+ const thumbnail = store.useSelector((state) => state.thumbnail);
10
+ const [thumbnails, setThumbnails] = useState([]);
11
+ useEffect(() => {
12
+ const update = () => {
13
+ const html = textEditor.commands.serialize();
14
+ if (!html) {
15
+ return;
16
+ }
17
+ const parser = new DOMParser();
18
+ const docHtml = parser.parseFromString(html, "text/html");
19
+ const images = docHtml.querySelectorAll("img");
20
+ const thumbnails2 = Array.from(images).map((img) => img.src);
21
+ setThumbnails(thumbnails2);
22
+ if (thumbnails2.length > 0 && !store.state.thumbnail) {
23
+ store.dispatch((state) => {
24
+ state.thumbnail = thumbnails2[0];
25
+ });
26
+ }
27
+ };
28
+ const sub = textEditor.subject.subscribe((tr) => {
29
+ update();
30
+ });
31
+ setTimeout(() => {
32
+ update();
33
+ }, 0);
34
+ return () => {
35
+ sub.unsubscribe();
36
+ };
37
+ }, []);
38
+ return /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-2 gap-1" }, thumbnails.map((url, index) => /* @__PURE__ */ React.createElement(
39
+ "button",
40
+ {
41
+ key: index,
42
+ type: "button",
43
+ className: cn(
44
+ "border border-neutral-200 rounded-lg overflow-hidden aspect-4/3",
45
+ thumbnail === url && "border-transparent ring-2 ring-primary"
46
+ ),
47
+ onClick: () => {
48
+ store.dispatch((state) => {
49
+ state.thumbnail = url;
50
+ });
51
+ }
52
+ },
53
+ /* @__PURE__ */ React.createElement(
54
+ ResponsiveImage,
55
+ {
56
+ src: url,
57
+ alt: `Thumbnail ${index + 1}`,
58
+ className: "w-full h-full object-cover",
59
+ sizes: "200px"
60
+ }
61
+ )
62
+ )));
63
+ }
64
+ export {
65
+ PostThumbnailPicker as default
66
+ };
package/dist/seo/index.js CHANGED
@@ -50,7 +50,7 @@ var import_react = __toESM(require("react"));
50
50
  var Schema = __toESM(require_schema());
51
51
  var import_react_router = require("react-router");
52
52
  function configSEO(config) {
53
- function init(props) {
53
+ function create(props) {
54
54
  const canonicalPath = props.canonicalPath;
55
55
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
56
56
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -133,9 +133,7 @@ function configSEO(config) {
133
133
  }
134
134
  ] : [],
135
135
  ...props.images || [],
136
- ...props.collection?.map(
137
- (portfolio) => portfolio.thumbnail
138
- ) || []
136
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
139
137
  ].filter(Boolean);
140
138
  const image = images.filter((file) => file.id).map((file) => ({
141
139
  "@type": "ImageObject",
@@ -151,23 +149,21 @@ function configSEO(config) {
151
149
  const collectionMainEntity = props.collection ? {
152
150
  "@type": "ItemList",
153
151
  numberOfItems: props.collection.length,
154
- itemListElement: props.collection.map(
155
- (item, index) => ({
156
- "@type": "ListItem",
157
- position: index + 1,
152
+ itemListElement: props.collection.map((item, index) => ({
153
+ "@type": "ListItem",
154
+ position: index + 1,
155
+ url: item.url,
156
+ item: {
157
+ "@type": "WebPage",
158
+ "@id": `${item.url}#webpage`,
158
159
  url: item.url,
159
- item: {
160
- "@type": "WebPage",
161
- "@id": `${item.url}#webpage`,
162
- url: item.url,
163
- name: item.title,
164
- thumbnailUrl: item.thumbnail?.url,
165
- dateModified: item.updatedAt?.toISOString(),
166
- dateCreated: item.createdAt?.toISOString(),
167
- datePublished: item.createdAt?.toISOString()
168
- }
169
- })
170
- )
160
+ name: item.title,
161
+ thumbnailUrl: item.thumbnail?.url,
162
+ dateModified: item.updatedAt?.toISOString(),
163
+ dateCreated: item.createdAt?.toISOString(),
164
+ datePublished: item.createdAt?.toISOString()
165
+ }
166
+ }))
171
167
  } : void 0;
172
168
  const structuredData = {
173
169
  "@context": "https://schema.org",
@@ -306,7 +302,7 @@ function configSEO(config) {
306
302
  }
307
303
  return {
308
304
  config,
309
- init,
305
+ create,
310
306
  meta,
311
307
  StructedData
312
308
  };
@@ -37,7 +37,7 @@ var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
38
  import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
- function init(props) {
40
+ function create(props) {
41
41
  const canonicalPath = props.canonicalPath;
42
42
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
43
43
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -120,9 +120,7 @@ function configSEO(config) {
120
120
  }
121
121
  ] : [],
122
122
  ...props.images || [],
123
- ...props.collection?.map(
124
- (portfolio) => portfolio.thumbnail
125
- ) || []
123
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
126
124
  ].filter(Boolean);
127
125
  const image = images.filter((file) => file.id).map((file) => ({
128
126
  "@type": "ImageObject",
@@ -138,23 +136,21 @@ function configSEO(config) {
138
136
  const collectionMainEntity = props.collection ? {
139
137
  "@type": "ItemList",
140
138
  numberOfItems: props.collection.length,
141
- itemListElement: props.collection.map(
142
- (item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
139
+ itemListElement: props.collection.map((item, index) => ({
140
+ "@type": "ListItem",
141
+ position: index + 1,
142
+ url: item.url,
143
+ item: {
144
+ "@type": "WebPage",
145
+ "@id": `${item.url}#webpage`,
145
146
  url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
149
- url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- })
157
- )
147
+ name: item.title,
148
+ thumbnailUrl: item.thumbnail?.url,
149
+ dateModified: item.updatedAt?.toISOString(),
150
+ dateCreated: item.createdAt?.toISOString(),
151
+ datePublished: item.createdAt?.toISOString()
152
+ }
153
+ }))
158
154
  } : void 0;
159
155
  const structuredData = {
160
156
  "@context": "https://schema.org",
@@ -293,7 +289,7 @@ function configSEO(config) {
293
289
  }
294
290
  return {
295
291
  config,
296
- init,
292
+ create,
297
293
  meta,
298
294
  StructedData
299
295
  };
@@ -9,7 +9,7 @@ type SEOImage = {
9
9
  width?: number;
10
10
  height?: number;
11
11
  };
12
- type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["init"]>>;
12
+ type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["create"]>>;
13
13
  declare function configSEO(config: {
14
14
  origin: string;
15
15
  siteName: string;
@@ -28,7 +28,7 @@ declare function configSEO(config: {
28
28
  structedData?: Schema.Thing[] | (() => Schema.Thing[]);
29
29
  copyright?: string;
30
30
  };
31
- init: (props: {
31
+ create: (props: {
32
32
  title?: string;
33
33
  description?: string;
34
34
  keywords?: string[];
package/dist/seo/seo.d.ts CHANGED
@@ -9,7 +9,7 @@ type SEOImage = {
9
9
  width?: number;
10
10
  height?: number;
11
11
  };
12
- type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["init"]>>;
12
+ type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["create"]>>;
13
13
  declare function configSEO(config: {
14
14
  origin: string;
15
15
  siteName: string;
@@ -28,7 +28,7 @@ declare function configSEO(config: {
28
28
  structedData?: Schema.Thing[] | (() => Schema.Thing[]);
29
29
  copyright?: string;
30
30
  };
31
- init: (props: {
31
+ create: (props: {
32
32
  title?: string;
33
33
  description?: string;
34
34
  keywords?: string[];
package/dist/seo/seo.js CHANGED
@@ -48,7 +48,7 @@ var import_react = __toESM(require("react"));
48
48
  var Schema = __toESM(require_schema());
49
49
  var import_react_router = require("react-router");
50
50
  function configSEO(config) {
51
- function init(props) {
51
+ function create(props) {
52
52
  const canonicalPath = props.canonicalPath;
53
53
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
54
54
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -131,9 +131,7 @@ function configSEO(config) {
131
131
  }
132
132
  ] : [],
133
133
  ...props.images || [],
134
- ...props.collection?.map(
135
- (portfolio) => portfolio.thumbnail
136
- ) || []
134
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
137
135
  ].filter(Boolean);
138
136
  const image = images.filter((file) => file.id).map((file) => ({
139
137
  "@type": "ImageObject",
@@ -149,23 +147,21 @@ function configSEO(config) {
149
147
  const collectionMainEntity = props.collection ? {
150
148
  "@type": "ItemList",
151
149
  numberOfItems: props.collection.length,
152
- itemListElement: props.collection.map(
153
- (item, index) => ({
154
- "@type": "ListItem",
155
- position: index + 1,
150
+ itemListElement: props.collection.map((item, index) => ({
151
+ "@type": "ListItem",
152
+ position: index + 1,
153
+ url: item.url,
154
+ item: {
155
+ "@type": "WebPage",
156
+ "@id": `${item.url}#webpage`,
156
157
  url: item.url,
157
- item: {
158
- "@type": "WebPage",
159
- "@id": `${item.url}#webpage`,
160
- url: item.url,
161
- name: item.title,
162
- thumbnailUrl: item.thumbnail?.url,
163
- dateModified: item.updatedAt?.toISOString(),
164
- dateCreated: item.createdAt?.toISOString(),
165
- datePublished: item.createdAt?.toISOString()
166
- }
167
- })
168
- )
158
+ name: item.title,
159
+ thumbnailUrl: item.thumbnail?.url,
160
+ dateModified: item.updatedAt?.toISOString(),
161
+ dateCreated: item.createdAt?.toISOString(),
162
+ datePublished: item.createdAt?.toISOString()
163
+ }
164
+ }))
169
165
  } : void 0;
170
166
  const structuredData = {
171
167
  "@context": "https://schema.org",
@@ -304,7 +300,7 @@ function configSEO(config) {
304
300
  }
305
301
  return {
306
302
  config,
307
- init,
303
+ create,
308
304
  meta,
309
305
  StructedData
310
306
  };
package/dist/seo/seo.mjs CHANGED
@@ -37,7 +37,7 @@ var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
38
  import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
- function init(props) {
40
+ function create(props) {
41
41
  const canonicalPath = props.canonicalPath;
42
42
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
43
43
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -120,9 +120,7 @@ function configSEO(config) {
120
120
  }
121
121
  ] : [],
122
122
  ...props.images || [],
123
- ...props.collection?.map(
124
- (portfolio) => portfolio.thumbnail
125
- ) || []
123
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
126
124
  ].filter(Boolean);
127
125
  const image = images.filter((file) => file.id).map((file) => ({
128
126
  "@type": "ImageObject",
@@ -138,23 +136,21 @@ function configSEO(config) {
138
136
  const collectionMainEntity = props.collection ? {
139
137
  "@type": "ItemList",
140
138
  numberOfItems: props.collection.length,
141
- itemListElement: props.collection.map(
142
- (item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
139
+ itemListElement: props.collection.map((item, index) => ({
140
+ "@type": "ListItem",
141
+ position: index + 1,
142
+ url: item.url,
143
+ item: {
144
+ "@type": "WebPage",
145
+ "@id": `${item.url}#webpage`,
145
146
  url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
149
- url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- })
157
- )
147
+ name: item.title,
148
+ thumbnailUrl: item.thumbnail?.url,
149
+ dateModified: item.updatedAt?.toISOString(),
150
+ dateCreated: item.createdAt?.toISOString(),
151
+ datePublished: item.createdAt?.toISOString()
152
+ }
153
+ }))
158
154
  } : void 0;
159
155
  const structuredData = {
160
156
  "@context": "https://schema.org",
@@ -293,7 +289,7 @@ function configSEO(config) {
293
289
  }
294
290
  return {
295
291
  config,
296
- init,
292
+ create,
297
293
  meta,
298
294
  StructedData
299
295
  };
package/package.json CHANGED
@@ -1,84 +1,94 @@
1
1
  {
2
- "name": "dn-react-router-toolkit",
3
- "version": "0.5.7",
4
- "types": "./dist/index.d.ts",
5
- "main": "./dist/index.mjs",
6
- "module": "./dist/index.js",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
2
+ "name": "dn-react-router-toolkit",
3
+ "version": "0.5.9",
4
+ "types": "./dist/index.d.ts",
5
+ "main": "./dist/index.mjs",
6
+ "module": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js"
12
+ },
13
+ "./auth": {
14
+ "types": "./dist/auth/index.d.ts",
15
+ "import": "./dist/auth/index.mjs",
16
+ "require": "./dist/auth/index.js"
17
+ },
18
+ "./api": {
19
+ "types": "./dist/api/index.d.ts",
20
+ "import": "./dist/api/index.mjs",
21
+ "require": "./dist/api/index.js"
22
+ },
23
+ "./client": {
24
+ "types": "./dist/client/index.d.ts",
25
+ "import": "./dist/client/index.mjs",
26
+ "require": "./dist/client/index.js"
27
+ },
28
+ "./seo": {
29
+ "types": "./dist/seo/index.d.ts",
30
+ "import": "./dist/seo/index.mjs",
31
+ "require": "./dist/seo/index.js"
32
+ },
33
+ "./db": {
34
+ "types": "./dist/db/index.d.ts",
35
+ "import": "./dist/db/index.mjs",
36
+ "require": "./dist/db/index.js"
37
+ },
38
+ "./db/backup": {
39
+ "types": "./dist/db/backup/index.d.ts",
40
+ "import": "./dist/db/backup/index.mjs",
41
+ "require": "./dist/db/backup/index.js"
42
+ },
43
+ "./table": {
44
+ "types": "./dist/table/index.d.ts",
45
+ "import": "./dist/table/index.mjs",
46
+ "require": "./dist/table/index.js"
47
+ },
48
+ "./crud": {
49
+ "types": "./dist/crud/index.d.ts",
50
+ "import": "./dist/crud/index.mjs",
51
+ "require": "./dist/crud/index.js"
52
+ },
53
+ "./post": {
54
+ "types": "./dist/post/index.d.ts",
55
+ "import": "./dist/post/index.mjs",
56
+ "require": "./dist/post/index.js"
57
+ }
12
58
  },
13
- "./auth": {
14
- "types": "./dist/auth/index.d.ts",
15
- "import": "./dist/auth/index.mjs",
16
- "require": "./dist/auth/index.js"
59
+ "scripts": {
60
+ "build": "tsup",
61
+ "dev": "tsup --watch"
17
62
  },
18
- "./api": {
19
- "types": "./dist/api/index.d.ts",
20
- "import": "./dist/api/index.mjs",
21
- "require": "./dist/api/index.js"
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
22
66
  },
23
- "./client": {
24
- "types": "./dist/client/index.d.ts",
25
- "import": "./dist/client/index.mjs",
26
- "require": "./dist/client/index.js"
67
+ "author": "",
68
+ "license": "MIT",
69
+ "bugs": {
70
+ "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
27
71
  },
28
- "./seo": {
29
- "types": "./dist/seo/index.d.ts",
30
- "import": "./dist/seo/index.mjs",
31
- "require": "./dist/seo/index.js"
72
+ "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
73
+ "description": "",
74
+ "devDependencies": {
75
+ "@types/node": "^24.10.1",
76
+ "@types/react": "^19",
77
+ "@types/react-dom": "^19",
78
+ "schema-dts": "^1.1.5",
79
+ "tsup": "^8.5.1",
80
+ "typescript": "^5.7.3"
32
81
  },
33
- "./db": {
34
- "types": "./dist/db/index.d.ts",
35
- "import": "./dist/db/index.mjs",
36
- "require": "./dist/db/index.js"
82
+ "dependencies": {
83
+ "@react-router/dev": "^7.11.0",
84
+ "pg": "^8.16.3",
85
+ "uuid": "^13.0.0"
37
86
  },
38
- "./table": {
39
- "types": "./dist/table/index.d.ts",
40
- "import": "./dist/table/index.mjs",
41
- "require": "./dist/table/index.js"
42
- },
43
- "./crud": {
44
- "types": "./dist/crud/index.d.ts",
45
- "import": "./dist/crud/index.mjs",
46
- "require": "./dist/crud/index.js"
87
+ "peerDependencies": {
88
+ "dn-react-toolkit": "^0.2.46",
89
+ "drizzle-orm": "^0.45.1",
90
+ "react": "^19",
91
+ "react-dom": "^19",
92
+ "react-router": "^7"
47
93
  }
48
- },
49
- "scripts": {
50
- "build": "tsup",
51
- "dev": "tsup --watch"
52
- },
53
- "repository": {
54
- "type": "git",
55
- "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
56
- },
57
- "author": "",
58
- "license": "MIT",
59
- "bugs": {
60
- "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
61
- },
62
- "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
63
- "description": "",
64
- "devDependencies": {
65
- "@types/node": "^24.10.1",
66
- "@types/react": "^19",
67
- "@types/react-dom": "^19",
68
- "schema-dts": "^1.1.5",
69
- "tsup": "^8.5.1",
70
- "typescript": "^5.7.3"
71
- },
72
- "dependencies": {
73
- "@react-router/dev": "^7.11.0",
74
- "pg": "^8.16.3",
75
- "uuid": "^13.0.0"
76
- },
77
- "peerDependencies": {
78
- "dn-react-toolkit": "^0.2.43",
79
- "drizzle-orm": "^0.45.1",
80
- "react": "^19",
81
- "react-dom": "^19",
82
- "react-router": "^7"
83
- }
84
94
  }