dn-react-router-toolkit 0.9.11 → 0.10.0
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.
- package/dist/api/default_api_handler.d.mts +2 -1
- package/dist/api/default_api_handler.d.ts +2 -1
- package/dist/api/default_api_handler.js +15 -14
- package/dist/api/default_api_handler.mjs +1 -0
- package/dist/api/index.js +17 -37
- package/dist/api/index.mjs +4 -31
- package/dist/api/patch_resource_handler.js +2 -23
- package/dist/api/patch_resource_handler.mjs +3 -31
- package/dist/api/put_resource_handler.js +2 -23
- package/dist/api/put_resource_handler.mjs +3 -31
- package/dist/api/resource_handler.d.mts +3 -2
- package/dist/api/resource_handler.d.ts +3 -2
- package/dist/api/resource_handler.js +2 -23
- package/dist/api/resource_handler.mjs +3 -31
- package/dist/auth/cookie_manager.d.mts +5 -2
- package/dist/auth/cookie_manager.d.ts +5 -2
- package/dist/auth/cookie_manager.js +16 -9
- package/dist/auth/cookie_manager.mjs +14 -8
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +14 -7
- package/dist/auth/index.mjs +13 -7
- package/dist/client/env_loader.d.mts +2 -2
- package/dist/client/env_loader.d.ts +2 -2
- package/dist/client/file_input.d.mts +2 -2
- package/dist/client/file_input.d.ts +2 -2
- package/dist/client/index.d.mts +0 -7
- package/dist/client/index.d.ts +0 -7
- package/dist/client/index.js +0 -117
- package/dist/client/index.mjs +0 -117
- package/dist/crud/crud_form.d.mts +2 -2
- package/dist/crud/crud_form.d.ts +2 -2
- package/dist/crud/crud_form.js +40 -151
- package/dist/crud/crud_form.mjs +40 -158
- package/dist/crud/crud_form_provider.d.mts +6 -7
- package/dist/crud/crud_form_provider.d.ts +6 -7
- package/dist/crud/crud_form_provider.mjs +1 -4
- package/dist/crud/index.d.mts +0 -1
- package/dist/crud/index.d.ts +0 -1
- package/dist/crud/index.js +2 -23
- package/dist/crud/index.mjs +3 -31
- package/dist/form/create_form_component.d.mts +2 -2
- package/dist/form/create_form_component.d.ts +2 -2
- package/dist/form/form_components.d.mts +3 -4
- package/dist/form/form_components.d.ts +3 -4
- package/dist/form/index.d.mts +0 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/post/index.d.mts +2 -3
- package/dist/post/index.d.ts +2 -3
- package/dist/post/thumbnail_picker.d.mts +4 -4
- package/dist/post/thumbnail_picker.d.ts +4 -4
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/seo.d.mts +2 -2
- package/dist/seo/seo.d.ts +2 -2
- package/dist/table/buttons.d.mts +2 -2
- package/dist/table/buttons.d.ts +2 -2
- package/dist/table/index.d.mts +1 -2
- package/dist/table/index.d.ts +1 -2
- package/dist/table/table.d.mts +2 -2
- package/dist/table/table.d.ts +2 -2
- package/dist/table/table_form.d.mts +2 -3
- package/dist/table/table_form.d.ts +2 -3
- package/package.json +12 -12
- package/dist/client/editor.d.mts +0 -12
- package/dist/client/editor.d.ts +0 -12
- package/dist/client/editor.js +0 -63
- package/dist/client/editor.mjs +0 -38
- package/dist/client/store_text_editor.d.mts +0 -13
- package/dist/client/store_text_editor.d.ts +0 -13
- package/dist/client/store_text_editor.js +0 -104
- package/dist/client/store_text_editor.mjs +0 -81
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { HTMLElementType, DetailedHTMLProps, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, ButtonHTMLAttributes, LabelHTMLAttributes, FormHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
type ElementPropsMap = {
|
|
@@ -24,6 +24,6 @@ type ElementPropsMap = {
|
|
|
24
24
|
type Props<T extends HTMLElementType> = T extends keyof ElementPropsMap ? ElementPropsMap[T] : DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
25
25
|
declare function createComponent<T extends HTMLElementType>(tag: T, options: {
|
|
26
26
|
className?: string;
|
|
27
|
-
}): ({ className, ...props }: Props<T>) =>
|
|
27
|
+
}): ({ className, ...props }: Props<T>) => react.JSX.Element;
|
|
28
28
|
|
|
29
29
|
export { createComponent };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
|
|
4
|
-
declare const FormEntry: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) =>
|
|
5
|
-
declare const FormRow: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) =>
|
|
6
|
-
declare const FormLabel: ({ className, ...props }: react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>) =>
|
|
3
|
+
declare const FormEntry: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react.JSX.Element;
|
|
4
|
+
declare const FormRow: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react.JSX.Element;
|
|
5
|
+
declare const FormLabel: ({ className, ...props }: react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>) => react.JSX.Element;
|
|
7
6
|
|
|
8
7
|
export { FormEntry, FormLabel, FormRow };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
|
|
4
|
-
declare const FormEntry: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) =>
|
|
5
|
-
declare const FormRow: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) =>
|
|
6
|
-
declare const FormLabel: ({ className, ...props }: react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>) =>
|
|
3
|
+
declare const FormEntry: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react.JSX.Element;
|
|
4
|
+
declare const FormRow: ({ className, ...props }: react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => react.JSX.Element;
|
|
5
|
+
declare const FormLabel: ({ className, ...props }: react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>) => react.JSX.Element;
|
|
7
6
|
|
|
8
7
|
export { FormEntry, FormLabel, FormRow };
|
package/dist/form/index.d.mts
CHANGED
package/dist/form/index.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'drizzle-orm/pg-core';
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'drizzle-orm/pg-core';
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/post/index.d.mts
CHANGED
package/dist/post/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Store } from 'react-store-input';
|
|
1
|
+
import * as react from 'react';
|
|
3
2
|
import { RefObject } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { Store } from 'react-store-input';
|
|
4
|
+
import { TextEditorController } from 'gw-rich-text-editor';
|
|
5
5
|
|
|
6
6
|
declare function PostThumbnailPicker<T extends {
|
|
7
7
|
thumbnail: string | null;
|
|
8
8
|
}>({ store, textEditorRef, }: {
|
|
9
9
|
store: Store<T>;
|
|
10
10
|
textEditorRef: RefObject<TextEditorController | null>;
|
|
11
|
-
}):
|
|
11
|
+
}): react.JSX.Element;
|
|
12
12
|
|
|
13
13
|
export { PostThumbnailPicker };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Store } from 'react-store-input';
|
|
1
|
+
import * as react from 'react';
|
|
3
2
|
import { RefObject } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { Store } from 'react-store-input';
|
|
4
|
+
import { TextEditorController } from 'gw-rich-text-editor';
|
|
5
5
|
|
|
6
6
|
declare function PostThumbnailPicker<T extends {
|
|
7
7
|
thumbnail: string | null;
|
|
8
8
|
}>({ store, textEditorRef, }: {
|
|
9
9
|
store: Store<T>;
|
|
10
10
|
textEditorRef: RefObject<TextEditorController | null>;
|
|
11
|
-
}):
|
|
11
|
+
}): react.JSX.Element;
|
|
12
12
|
|
|
13
13
|
export { PostThumbnailPicker };
|
package/dist/seo/index.d.mts
CHANGED
package/dist/seo/index.d.ts
CHANGED
package/dist/seo/seo.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import * as Schema from 'schema-dts';
|
|
3
3
|
import { MetaFunction } from 'react-router';
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ declare function configSEO(config: {
|
|
|
65
65
|
thumbnail: SEOImage | null | undefined;
|
|
66
66
|
};
|
|
67
67
|
meta: MetaFunction<unknown, Record<string, unknown>>;
|
|
68
|
-
StructedData: () =>
|
|
68
|
+
StructedData: () => react.JSX.Element;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export { type SEO, type SEOImage, configSEO };
|
package/dist/seo/seo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import * as Schema from 'schema-dts';
|
|
3
3
|
import { MetaFunction } from 'react-router';
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ declare function configSEO(config: {
|
|
|
65
65
|
thumbnail: SEOImage | null | undefined;
|
|
66
66
|
};
|
|
67
67
|
meta: MetaFunction<unknown, Record<string, unknown>>;
|
|
68
|
-
StructedData: () =>
|
|
68
|
+
StructedData: () => react.JSX.Element;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export { type SEO, type SEOImage, configSEO };
|
package/dist/table/buttons.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare function TablePageButtons({ MAX_PAGES_TO_SHOW, total, limit, offset, }: {
|
|
4
4
|
MAX_PAGES_TO_SHOW: number;
|
|
5
5
|
total: number;
|
|
6
6
|
limit: number;
|
|
7
7
|
offset: number;
|
|
8
|
-
}):
|
|
8
|
+
}): react.JSX.Element;
|
|
9
9
|
|
|
10
10
|
export { TablePageButtons };
|
package/dist/table/buttons.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare function TablePageButtons({ MAX_PAGES_TO_SHOW, total, limit, offset, }: {
|
|
4
4
|
MAX_PAGES_TO_SHOW: number;
|
|
5
5
|
total: number;
|
|
6
6
|
limit: number;
|
|
7
7
|
offset: number;
|
|
8
|
-
}):
|
|
8
|
+
}): react.JSX.Element;
|
|
9
9
|
|
|
10
10
|
export { TablePageButtons };
|
package/dist/table/index.d.mts
CHANGED
package/dist/table/index.d.ts
CHANGED
package/dist/table/table.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { DetailedHTMLProps, TableHTMLAttributes, ReactNode, FC } from 'react';
|
|
3
3
|
|
|
4
4
|
type TableColumnProps<T> = ReactNode | {
|
|
@@ -26,6 +26,6 @@ type OrderedTableProps<T> = DetailedHTMLProps<TableHTMLAttributes<HTMLTableEleme
|
|
|
26
26
|
[key: string]: unknown[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
declare function Table<T>({ className, data, columns, mapper: Mapper, getLink, limit, offset, orderBy, direction, filters, }: OrderedTableProps<T>):
|
|
29
|
+
declare function Table<T>({ className, data, columns, mapper: Mapper, getLink, limit, offset, orderBy, direction, filters, }: OrderedTableProps<T>): react.JSX.Element;
|
|
30
30
|
|
|
31
31
|
export { type OrderedTableProps, Table, type TableColumnOptions, type TableColumnProps };
|
package/dist/table/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { DetailedHTMLProps, TableHTMLAttributes, ReactNode, FC } from 'react';
|
|
3
3
|
|
|
4
4
|
type TableColumnProps<T> = ReactNode | {
|
|
@@ -26,6 +26,6 @@ type OrderedTableProps<T> = DetailedHTMLProps<TableHTMLAttributes<HTMLTableEleme
|
|
|
26
26
|
[key: string]: unknown[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
declare function Table<T>({ className, data, columns, mapper: Mapper, getLink, limit, offset, orderBy, direction, filters, }: OrderedTableProps<T>):
|
|
29
|
+
declare function Table<T>({ className, data, columns, mapper: Mapper, getLink, limit, offset, orderBy, direction, filters, }: OrderedTableProps<T>): react.JSX.Element;
|
|
30
30
|
|
|
31
31
|
export { type OrderedTableProps, Table, type TableColumnOptions, type TableColumnProps };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { TableColumnOptions } from './table.mjs';
|
|
3
3
|
import { TableLoaderData } from './use_table.mjs';
|
|
4
|
-
import 'react';
|
|
5
4
|
|
|
6
5
|
type TablePageOptions<TModel> = {
|
|
7
6
|
columns: TableColumnOptions<TModel>;
|
|
8
7
|
primaryKey?: keyof TModel;
|
|
9
8
|
};
|
|
10
9
|
type LoadedModel<T extends (...args: any) => any> = TableLoaderData<T>["items"][number];
|
|
11
|
-
declare function TableForm<T extends (...args: any) => any>({ columns, primaryKey, }: TablePageOptions<LoadedModel<T>>):
|
|
10
|
+
declare function TableForm<T extends (...args: any) => any>({ columns, primaryKey, }: TablePageOptions<LoadedModel<T>>): react.JSX.Element;
|
|
12
11
|
|
|
13
12
|
export { type LoadedModel, TableForm, type TablePageOptions };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { TableColumnOptions } from './table.js';
|
|
3
3
|
import { TableLoaderData } from './use_table.js';
|
|
4
|
-
import 'react';
|
|
5
4
|
|
|
6
5
|
type TablePageOptions<TModel> = {
|
|
7
6
|
columns: TableColumnOptions<TModel>;
|
|
8
7
|
primaryKey?: keyof TModel;
|
|
9
8
|
};
|
|
10
9
|
type LoadedModel<T extends (...args: any) => any> = TableLoaderData<T>["items"][number];
|
|
11
|
-
declare function TableForm<T extends (...args: any) => any>({ columns, primaryKey, }: TablePageOptions<LoadedModel<T>>):
|
|
10
|
+
declare function TableForm<T extends (...args: any) => any>({ columns, primaryKey, }: TablePageOptions<LoadedModel<T>>): react.JSX.Element;
|
|
12
11
|
|
|
13
12
|
export { type LoadedModel, TableForm, type TablePageOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dn-react-router-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
|
|
78
78
|
"description": "",
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@react-router/dev": "^
|
|
80
|
+
"@react-router/dev": "^8.3.0",
|
|
81
81
|
"@types/node": "^25.3.1",
|
|
82
82
|
"@types/react": "^19",
|
|
83
83
|
"@types/react-dom": "^19",
|
|
@@ -86,22 +86,22 @@
|
|
|
86
86
|
"typescript": "^5.9.3"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"cookie": "^
|
|
90
|
-
"gw-
|
|
91
|
-
"gw-auth": "^0.1.
|
|
89
|
+
"cookie": "^2.0.1",
|
|
90
|
+
"gw-rich-text-editor": "^0.1.0",
|
|
91
|
+
"gw-auth": "^0.1.2",
|
|
92
92
|
"gw-file": "^0.1.3",
|
|
93
93
|
"gw-response": "^0.1.8",
|
|
94
|
-
"gw-result": "^0.
|
|
95
|
-
"moment-timezone": "^0.6.
|
|
96
|
-
"pg": "^8.
|
|
97
|
-
"react-icons": "^5.
|
|
98
|
-
"react-store-input": "^0.
|
|
99
|
-
"uuid": "^
|
|
94
|
+
"gw-result": "^0.3.0",
|
|
95
|
+
"moment-timezone": "^0.6.3",
|
|
96
|
+
"pg": "^8.22.0",
|
|
97
|
+
"react-icons": "^5.7.0",
|
|
98
|
+
"react-store-input": "^0.4.0",
|
|
99
|
+
"uuid": "^14.0.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"drizzle-orm": "^0.45.1",
|
|
103
103
|
"react": "^19",
|
|
104
104
|
"react-dom": "^19",
|
|
105
|
-
"react-router": "^
|
|
105
|
+
"react-router": "^8.3.0"
|
|
106
106
|
}
|
|
107
107
|
}
|
package/dist/client/editor.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FileUploader } from 'gw-file/client';
|
|
2
|
-
import { AttachFileOptions } from 'gw-react-text-editor';
|
|
3
|
-
import { CDN } from 'gw-file';
|
|
4
|
-
|
|
5
|
-
declare function createAttachFileOptions<TFile extends {
|
|
6
|
-
key: string;
|
|
7
|
-
}>({ cdn, fileUploader, }: {
|
|
8
|
-
cdn: CDN;
|
|
9
|
-
fileUploader: FileUploader<TFile>;
|
|
10
|
-
}): Omit<AttachFileOptions, "schema">;
|
|
11
|
-
|
|
12
|
-
export { createAttachFileOptions };
|
package/dist/client/editor.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FileUploader } from 'gw-file/client';
|
|
2
|
-
import { AttachFileOptions } from 'gw-react-text-editor';
|
|
3
|
-
import { CDN } from 'gw-file';
|
|
4
|
-
|
|
5
|
-
declare function createAttachFileOptions<TFile extends {
|
|
6
|
-
key: string;
|
|
7
|
-
}>({ cdn, fileUploader, }: {
|
|
8
|
-
cdn: CDN;
|
|
9
|
-
fileUploader: FileUploader<TFile>;
|
|
10
|
-
}): Omit<AttachFileOptions, "schema">;
|
|
11
|
-
|
|
12
|
-
export { createAttachFileOptions };
|
package/dist/client/editor.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
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/client/editor.tsx
|
|
21
|
-
var editor_exports = {};
|
|
22
|
-
__export(editor_exports, {
|
|
23
|
-
createAttachFileOptions: () => createAttachFileOptions
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(editor_exports);
|
|
26
|
-
var import_client = require("gw-file/client");
|
|
27
|
-
function createAttachFileOptions({
|
|
28
|
-
cdn,
|
|
29
|
-
fileUploader
|
|
30
|
-
}) {
|
|
31
|
-
return {
|
|
32
|
-
uploadFile: async (file) => {
|
|
33
|
-
const result = await fileUploader.uploadFile(file, {
|
|
34
|
-
convertToWebp: true
|
|
35
|
-
});
|
|
36
|
-
if (result.isErr) {
|
|
37
|
-
throw new Error(result.error.message);
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
alt: file.name,
|
|
41
|
-
src: cdn(result.value.key)
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
generateMetadata: (file) => (0, import_client.generateMetadata)(file, {
|
|
45
|
-
uploadBlob: async (blob) => {
|
|
46
|
-
const result = await fileUploader.uploadBlob(blob, "file", {
|
|
47
|
-
convertToWebp: true
|
|
48
|
-
});
|
|
49
|
-
if (result.isErr) {
|
|
50
|
-
throw new Error(result.error.message);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
alt: file.name,
|
|
54
|
-
src: cdn(result.value.key)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
createAttachFileOptions
|
|
63
|
-
});
|
package/dist/client/editor.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// src/client/editor.tsx
|
|
2
|
-
import { generateMetadata } from "gw-file/client";
|
|
3
|
-
function createAttachFileOptions({
|
|
4
|
-
cdn,
|
|
5
|
-
fileUploader
|
|
6
|
-
}) {
|
|
7
|
-
return {
|
|
8
|
-
uploadFile: async (file) => {
|
|
9
|
-
const result = await fileUploader.uploadFile(file, {
|
|
10
|
-
convertToWebp: true
|
|
11
|
-
});
|
|
12
|
-
if (result.isErr) {
|
|
13
|
-
throw new Error(result.error.message);
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
alt: file.name,
|
|
17
|
-
src: cdn(result.value.key)
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
generateMetadata: (file) => generateMetadata(file, {
|
|
21
|
-
uploadBlob: async (blob) => {
|
|
22
|
-
const result = await fileUploader.uploadBlob(blob, "file", {
|
|
23
|
-
convertToWebp: true
|
|
24
|
-
});
|
|
25
|
-
if (result.isErr) {
|
|
26
|
-
throw new Error(result.error.message);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
alt: file.name,
|
|
30
|
-
src: cdn(result.value.key)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
createAttachFileOptions
|
|
38
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextEditorProps } from 'gw-react-text-editor';
|
|
3
|
-
import { Store } from 'react-store-input';
|
|
4
|
-
|
|
5
|
-
type Props<TState> = {
|
|
6
|
-
store: Store<TState>;
|
|
7
|
-
name?: keyof TState;
|
|
8
|
-
getter?: (state: TState) => string;
|
|
9
|
-
setter?: (state: TState, value: string) => void;
|
|
10
|
-
} & TextEditorProps;
|
|
11
|
-
declare function StoreTextEditor<TState>({ store, name, getter, setter, defaultValue, ref, ...props }: Props<TState>): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { StoreTextEditor };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextEditorProps } from 'gw-react-text-editor';
|
|
3
|
-
import { Store } from 'react-store-input';
|
|
4
|
-
|
|
5
|
-
type Props<TState> = {
|
|
6
|
-
store: Store<TState>;
|
|
7
|
-
name?: keyof TState;
|
|
8
|
-
getter?: (state: TState) => string;
|
|
9
|
-
setter?: (state: TState, value: string) => void;
|
|
10
|
-
} & TextEditorProps;
|
|
11
|
-
declare function StoreTextEditor<TState>({ store, name, getter, setter, defaultValue, ref, ...props }: Props<TState>): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { StoreTextEditor };
|
|
@@ -1,104 +0,0 @@
|
|
|
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/client/store_text_editor.tsx
|
|
21
|
-
var store_text_editor_exports = {};
|
|
22
|
-
__export(store_text_editor_exports, {
|
|
23
|
-
StoreTextEditor: () => StoreTextEditor
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(store_text_editor_exports);
|
|
26
|
-
var import_gw_react_text_editor = require("gw-react-text-editor");
|
|
27
|
-
var import_react_store_input = require("react-store-input");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
function StoreTextEditor({
|
|
31
|
-
store,
|
|
32
|
-
name,
|
|
33
|
-
getter,
|
|
34
|
-
setter,
|
|
35
|
-
defaultValue,
|
|
36
|
-
ref,
|
|
37
|
-
...props
|
|
38
|
-
}) {
|
|
39
|
-
const controllerRef = (0, import_react.useRef)(null);
|
|
40
|
-
(0, import_react.useImperativeHandle)(
|
|
41
|
-
ref,
|
|
42
|
-
() => controllerRef.current,
|
|
43
|
-
[]
|
|
44
|
-
);
|
|
45
|
-
const { dispatch } = (0, import_react_store_input.useStoreController)(store, {
|
|
46
|
-
onSubscribe: (state) => {
|
|
47
|
-
const controller = controllerRef.current;
|
|
48
|
-
if (!controller) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const getResult = () => {
|
|
52
|
-
if (getter) {
|
|
53
|
-
return getter(state) || "";
|
|
54
|
-
}
|
|
55
|
-
if (name) {
|
|
56
|
-
return state[name] || "";
|
|
57
|
-
}
|
|
58
|
-
return "";
|
|
59
|
-
};
|
|
60
|
-
const result = getResult();
|
|
61
|
-
if (controller.value !== result) {
|
|
62
|
-
controller.value = result;
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
onDispatch: (state) => {
|
|
66
|
-
const controller = controllerRef.current;
|
|
67
|
-
if (!controller) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (setter) {
|
|
71
|
-
setter(state, controller.value);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (name) {
|
|
75
|
-
state[name] = controller.value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
const getDefaultValue = () => {
|
|
80
|
-
if (getter) {
|
|
81
|
-
return getter(store.state);
|
|
82
|
-
}
|
|
83
|
-
if (name) {
|
|
84
|
-
return store.state[name];
|
|
85
|
-
}
|
|
86
|
-
return void 0;
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
import_gw_react_text_editor.TextEditor,
|
|
90
|
-
{
|
|
91
|
-
...props,
|
|
92
|
-
ref: controllerRef,
|
|
93
|
-
defaultValue: defaultValue ?? getDefaultValue(),
|
|
94
|
-
onChange: (e) => {
|
|
95
|
-
dispatch();
|
|
96
|
-
props.onChange?.(e);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
StoreTextEditor
|
|
104
|
-
});
|