admin-lib-cms 1.2.8 → 1.2.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.
- package/dist/chunk-IXZXII3M.mjs +795 -0
- package/dist/client.d.mts +132 -0
- package/dist/client.d.ts +132 -0
- package/dist/client.js +725 -0
- package/dist/client.mjs +26 -0
- package/dist/index.d.mts +8 -113
- package/dist/index.d.ts +8 -113
- package/dist/index.mjs +703 -1468
- package/package.json +7 -1
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CmsProvider,
|
|
4
|
+
EditableFile,
|
|
5
|
+
EditableImage,
|
|
6
|
+
EditableLink,
|
|
7
|
+
EditableList,
|
|
8
|
+
EditableReference,
|
|
9
|
+
EditableText,
|
|
10
|
+
useCmsContext,
|
|
11
|
+
useCmsOptional,
|
|
12
|
+
useSubmit
|
|
13
|
+
} from "./chunk-IXZXII3M.mjs";
|
|
14
|
+
import "./chunk-WBQAMGXK.mjs";
|
|
15
|
+
export {
|
|
16
|
+
CmsProvider,
|
|
17
|
+
EditableFile,
|
|
18
|
+
EditableImage,
|
|
19
|
+
EditableLink,
|
|
20
|
+
EditableList,
|
|
21
|
+
EditableReference,
|
|
22
|
+
EditableText,
|
|
23
|
+
useCmsContext,
|
|
24
|
+
useCmsOptional,
|
|
25
|
+
useSubmit
|
|
26
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,115 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
export { CmsProvider, EditableFile, EditableImage, EditableLink, EditableList, EditableReference, EditableText, useCmsContext, useCmsOptional, useSubmit } from './client.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { CollectionDef, CollectionEntry, CollectionField, FieldType, GlobalGroup, PageDef, Submission } from './types.mjs';
|
|
4
|
+
import { MenuLabels } from './types.mjs';
|
|
5
|
+
export { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, OverridesMap, PageDef, StorageAdapter, Submission } from './types.mjs';
|
|
5
6
|
export { generateDefaultTemplate, sendEmailNotification } from './emails/index.mjs';
|
|
6
7
|
|
|
7
|
-
interface CmsContextValue {
|
|
8
|
-
config: CmsConfig;
|
|
9
|
-
adapter: StorageAdapter;
|
|
10
|
-
overrides: OverridesMap;
|
|
11
|
-
editMode: boolean;
|
|
12
|
-
selectedId: string | null;
|
|
13
|
-
setSelectedId: (id: string | null) => void;
|
|
14
|
-
setOverride: (id: string, value: unknown) => void;
|
|
15
|
-
registerEditable: (meta: EditableMeta) => void;
|
|
16
|
-
unregisterEditable: (id: string) => void;
|
|
17
|
-
getRegistered: () => EditableMeta[];
|
|
18
|
-
save: () => Promise<void>;
|
|
19
|
-
reset: (id?: string) => Promise<void>;
|
|
20
|
-
isDirty: boolean;
|
|
21
|
-
iconMap?: Record<string, React.ComponentType<{
|
|
22
|
-
className?: string;
|
|
23
|
-
}>>;
|
|
24
|
-
uploadImage?: (file: File) => Promise<string>;
|
|
25
|
-
/** Increments whenever a collection entry is saved or deleted — components can use this as a useEffect dep to auto-refresh. */
|
|
26
|
-
collectionChangedAt: number;
|
|
27
|
-
notifyCollectionChanged: () => void;
|
|
28
|
-
}
|
|
29
|
-
declare function useCmsContext(): CmsContextValue;
|
|
30
|
-
declare function useCmsOptional(): CmsContextValue | null;
|
|
31
|
-
interface CmsProviderProps {
|
|
32
|
-
config: CmsConfig;
|
|
33
|
-
adapter: StorageAdapter;
|
|
34
|
-
children: ReactNode;
|
|
35
|
-
iconMap?: Record<string, React.ComponentType<{
|
|
36
|
-
className?: string;
|
|
37
|
-
}>>;
|
|
38
|
-
initialOverrides?: OverridesMap;
|
|
39
|
-
apiUrl?: string;
|
|
40
|
-
projectId?: string;
|
|
41
|
-
email?: string;
|
|
42
|
-
validateSubscriptionUrl?: string;
|
|
43
|
-
}
|
|
44
|
-
declare function CmsProvider(props: CmsProviderProps): React$1.JSX.Element;
|
|
45
|
-
/** Hook to submit form data to the CMS inbox. */
|
|
46
|
-
declare function useSubmit(formId: string): (data: Record<string, unknown>) => Promise<void>;
|
|
47
|
-
|
|
48
|
-
interface BaseProps {
|
|
49
|
-
id: string;
|
|
50
|
-
label?: string;
|
|
51
|
-
section?: string;
|
|
52
|
-
pageId?: string;
|
|
53
|
-
}
|
|
54
|
-
interface EditableTextProps extends BaseProps {
|
|
55
|
-
children: string;
|
|
56
|
-
as?: "span" | "p" | "h1" | "h2" | "h3" | "h4" | "div";
|
|
57
|
-
className?: string;
|
|
58
|
-
type?: "text" | "textarea" | "richtext";
|
|
59
|
-
lineClassNames?: string[];
|
|
60
|
-
renderLine?: (line: string, index: number) => React__default.ReactNode;
|
|
61
|
-
}
|
|
62
|
-
declare function EditableText({ id, label, section, pageId, children, as, className, type, lineClassNames, renderLine, }: EditableTextProps): React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
|
63
|
-
interface EditableImageProps extends BaseProps {
|
|
64
|
-
src: string;
|
|
65
|
-
alt?: string;
|
|
66
|
-
className?: string;
|
|
67
|
-
width?: number;
|
|
68
|
-
height?: number;
|
|
69
|
-
}
|
|
70
|
-
declare function EditableImage({ id, label, section, pageId, src, alt, className, width, height, }: EditableImageProps): React__default.JSX.Element;
|
|
71
|
-
interface EditableFileProps extends BaseProps {
|
|
72
|
-
src?: string;
|
|
73
|
-
defaultUrl?: string;
|
|
74
|
-
className?: string;
|
|
75
|
-
children?: (url: string) => React__default.ReactNode;
|
|
76
|
-
}
|
|
77
|
-
declare function EditableFile({ id, label, section, pageId, src, defaultUrl, className, children, }: EditableFileProps): React__default.JSX.Element;
|
|
78
|
-
interface EditableLinkProps extends BaseProps {
|
|
79
|
-
href: string;
|
|
80
|
-
children?: React__default.ReactNode;
|
|
81
|
-
text?: string;
|
|
82
|
-
className?: string;
|
|
83
|
-
target?: string;
|
|
84
|
-
}
|
|
85
|
-
declare function EditableLink({ id, label, section, pageId, href, children, text, className, target, }: EditableLinkProps): React__default.JSX.Element;
|
|
86
|
-
interface EditableListProps<T = any> extends BaseProps {
|
|
87
|
-
initialItems: T[];
|
|
88
|
-
renderItem?: (item: T, index: number) => React__default.ReactNode;
|
|
89
|
-
renderList?: (items: T[]) => React__default.ReactNode;
|
|
90
|
-
itemSchema?: {
|
|
91
|
-
key: string;
|
|
92
|
-
type: "text" | "textarea" | "boolean" | "icon" | "image" | "file" | "number" | "select";
|
|
93
|
-
label?: string;
|
|
94
|
-
options?: string[];
|
|
95
|
-
}[];
|
|
96
|
-
fixedLength?: boolean;
|
|
97
|
-
className?: string;
|
|
98
|
-
listClassName?: string;
|
|
99
|
-
search?: boolean;
|
|
100
|
-
reorderable?: boolean;
|
|
101
|
-
sortable?: boolean;
|
|
102
|
-
}
|
|
103
|
-
declare function EditableList<T = any>({ id, label, section, pageId, initialItems, renderItem, renderList, itemSchema, fixedLength, className, listClassName, search, reorderable, sortable, }: EditableListProps<T>): React__default.JSX.Element;
|
|
104
|
-
interface EditableReferenceProps extends BaseProps {
|
|
105
|
-
collection: string;
|
|
106
|
-
max?: number;
|
|
107
|
-
displayField?: string;
|
|
108
|
-
className?: string;
|
|
109
|
-
children?: React__default.ReactNode | ((items: any[]) => React__default.ReactNode);
|
|
110
|
-
}
|
|
111
|
-
declare function EditableReference({ id, label, section, pageId, collection, max, displayField, className, children, }: EditableReferenceProps): React__default.JSX.Element;
|
|
112
|
-
|
|
113
8
|
interface AdminAppProps {
|
|
114
9
|
apiUrl?: string;
|
|
115
10
|
projectId?: string;
|
|
@@ -127,7 +22,7 @@ interface AdminLoginProps {
|
|
|
127
22
|
authApiRoute?: string;
|
|
128
23
|
redirectRoute?: string;
|
|
129
24
|
}
|
|
130
|
-
declare function AdminLogin({ authApiRoute, redirectRoute, }: AdminLoginProps): React
|
|
25
|
+
declare function AdminLogin({ authApiRoute, redirectRoute, }: AdminLoginProps): React.JSX.Element;
|
|
131
26
|
|
|
132
27
|
interface SubscriptionData {
|
|
133
28
|
subscriptionStatus: string;
|
|
@@ -158,8 +53,8 @@ declare function SubscriptionProvider({ children, apiUrl, projectId, email, vali
|
|
|
158
53
|
projectId?: string;
|
|
159
54
|
email?: string;
|
|
160
55
|
validateSubscriptionUrl?: string;
|
|
161
|
-
}): React
|
|
56
|
+
}): React.JSX.Element;
|
|
162
57
|
|
|
163
|
-
declare function SubscriptionPage(): React
|
|
58
|
+
declare function SubscriptionPage(): React.JSX.Element;
|
|
164
59
|
|
|
165
|
-
export { AdminApp, AdminLogin, type AdminLoginProps,
|
|
60
|
+
export { AdminApp, AdminLogin, type AdminLoginProps, MenuLabels, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useSubscription, useSubscriptionContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,115 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
export { CmsProvider, EditableFile, EditableImage, EditableLink, EditableList, EditableReference, EditableText, useCmsContext, useCmsOptional, useSubmit } from './client.js';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import React__default, { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { CollectionDef, CollectionEntry, CollectionField, FieldType, GlobalGroup, PageDef, Submission } from './types.js';
|
|
4
|
+
import { MenuLabels } from './types.js';
|
|
5
|
+
export { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, OverridesMap, PageDef, StorageAdapter, Submission } from './types.js';
|
|
5
6
|
export { generateDefaultTemplate, sendEmailNotification } from './emails/index.js';
|
|
6
7
|
|
|
7
|
-
interface CmsContextValue {
|
|
8
|
-
config: CmsConfig;
|
|
9
|
-
adapter: StorageAdapter;
|
|
10
|
-
overrides: OverridesMap;
|
|
11
|
-
editMode: boolean;
|
|
12
|
-
selectedId: string | null;
|
|
13
|
-
setSelectedId: (id: string | null) => void;
|
|
14
|
-
setOverride: (id: string, value: unknown) => void;
|
|
15
|
-
registerEditable: (meta: EditableMeta) => void;
|
|
16
|
-
unregisterEditable: (id: string) => void;
|
|
17
|
-
getRegistered: () => EditableMeta[];
|
|
18
|
-
save: () => Promise<void>;
|
|
19
|
-
reset: (id?: string) => Promise<void>;
|
|
20
|
-
isDirty: boolean;
|
|
21
|
-
iconMap?: Record<string, React.ComponentType<{
|
|
22
|
-
className?: string;
|
|
23
|
-
}>>;
|
|
24
|
-
uploadImage?: (file: File) => Promise<string>;
|
|
25
|
-
/** Increments whenever a collection entry is saved or deleted — components can use this as a useEffect dep to auto-refresh. */
|
|
26
|
-
collectionChangedAt: number;
|
|
27
|
-
notifyCollectionChanged: () => void;
|
|
28
|
-
}
|
|
29
|
-
declare function useCmsContext(): CmsContextValue;
|
|
30
|
-
declare function useCmsOptional(): CmsContextValue | null;
|
|
31
|
-
interface CmsProviderProps {
|
|
32
|
-
config: CmsConfig;
|
|
33
|
-
adapter: StorageAdapter;
|
|
34
|
-
children: ReactNode;
|
|
35
|
-
iconMap?: Record<string, React.ComponentType<{
|
|
36
|
-
className?: string;
|
|
37
|
-
}>>;
|
|
38
|
-
initialOverrides?: OverridesMap;
|
|
39
|
-
apiUrl?: string;
|
|
40
|
-
projectId?: string;
|
|
41
|
-
email?: string;
|
|
42
|
-
validateSubscriptionUrl?: string;
|
|
43
|
-
}
|
|
44
|
-
declare function CmsProvider(props: CmsProviderProps): React$1.JSX.Element;
|
|
45
|
-
/** Hook to submit form data to the CMS inbox. */
|
|
46
|
-
declare function useSubmit(formId: string): (data: Record<string, unknown>) => Promise<void>;
|
|
47
|
-
|
|
48
|
-
interface BaseProps {
|
|
49
|
-
id: string;
|
|
50
|
-
label?: string;
|
|
51
|
-
section?: string;
|
|
52
|
-
pageId?: string;
|
|
53
|
-
}
|
|
54
|
-
interface EditableTextProps extends BaseProps {
|
|
55
|
-
children: string;
|
|
56
|
-
as?: "span" | "p" | "h1" | "h2" | "h3" | "h4" | "div";
|
|
57
|
-
className?: string;
|
|
58
|
-
type?: "text" | "textarea" | "richtext";
|
|
59
|
-
lineClassNames?: string[];
|
|
60
|
-
renderLine?: (line: string, index: number) => React__default.ReactNode;
|
|
61
|
-
}
|
|
62
|
-
declare function EditableText({ id, label, section, pageId, children, as, className, type, lineClassNames, renderLine, }: EditableTextProps): React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
|
63
|
-
interface EditableImageProps extends BaseProps {
|
|
64
|
-
src: string;
|
|
65
|
-
alt?: string;
|
|
66
|
-
className?: string;
|
|
67
|
-
width?: number;
|
|
68
|
-
height?: number;
|
|
69
|
-
}
|
|
70
|
-
declare function EditableImage({ id, label, section, pageId, src, alt, className, width, height, }: EditableImageProps): React__default.JSX.Element;
|
|
71
|
-
interface EditableFileProps extends BaseProps {
|
|
72
|
-
src?: string;
|
|
73
|
-
defaultUrl?: string;
|
|
74
|
-
className?: string;
|
|
75
|
-
children?: (url: string) => React__default.ReactNode;
|
|
76
|
-
}
|
|
77
|
-
declare function EditableFile({ id, label, section, pageId, src, defaultUrl, className, children, }: EditableFileProps): React__default.JSX.Element;
|
|
78
|
-
interface EditableLinkProps extends BaseProps {
|
|
79
|
-
href: string;
|
|
80
|
-
children?: React__default.ReactNode;
|
|
81
|
-
text?: string;
|
|
82
|
-
className?: string;
|
|
83
|
-
target?: string;
|
|
84
|
-
}
|
|
85
|
-
declare function EditableLink({ id, label, section, pageId, href, children, text, className, target, }: EditableLinkProps): React__default.JSX.Element;
|
|
86
|
-
interface EditableListProps<T = any> extends BaseProps {
|
|
87
|
-
initialItems: T[];
|
|
88
|
-
renderItem?: (item: T, index: number) => React__default.ReactNode;
|
|
89
|
-
renderList?: (items: T[]) => React__default.ReactNode;
|
|
90
|
-
itemSchema?: {
|
|
91
|
-
key: string;
|
|
92
|
-
type: "text" | "textarea" | "boolean" | "icon" | "image" | "file" | "number" | "select";
|
|
93
|
-
label?: string;
|
|
94
|
-
options?: string[];
|
|
95
|
-
}[];
|
|
96
|
-
fixedLength?: boolean;
|
|
97
|
-
className?: string;
|
|
98
|
-
listClassName?: string;
|
|
99
|
-
search?: boolean;
|
|
100
|
-
reorderable?: boolean;
|
|
101
|
-
sortable?: boolean;
|
|
102
|
-
}
|
|
103
|
-
declare function EditableList<T = any>({ id, label, section, pageId, initialItems, renderItem, renderList, itemSchema, fixedLength, className, listClassName, search, reorderable, sortable, }: EditableListProps<T>): React__default.JSX.Element;
|
|
104
|
-
interface EditableReferenceProps extends BaseProps {
|
|
105
|
-
collection: string;
|
|
106
|
-
max?: number;
|
|
107
|
-
displayField?: string;
|
|
108
|
-
className?: string;
|
|
109
|
-
children?: React__default.ReactNode | ((items: any[]) => React__default.ReactNode);
|
|
110
|
-
}
|
|
111
|
-
declare function EditableReference({ id, label, section, pageId, collection, max, displayField, className, children, }: EditableReferenceProps): React__default.JSX.Element;
|
|
112
|
-
|
|
113
8
|
interface AdminAppProps {
|
|
114
9
|
apiUrl?: string;
|
|
115
10
|
projectId?: string;
|
|
@@ -127,7 +22,7 @@ interface AdminLoginProps {
|
|
|
127
22
|
authApiRoute?: string;
|
|
128
23
|
redirectRoute?: string;
|
|
129
24
|
}
|
|
130
|
-
declare function AdminLogin({ authApiRoute, redirectRoute, }: AdminLoginProps): React
|
|
25
|
+
declare function AdminLogin({ authApiRoute, redirectRoute, }: AdminLoginProps): React.JSX.Element;
|
|
131
26
|
|
|
132
27
|
interface SubscriptionData {
|
|
133
28
|
subscriptionStatus: string;
|
|
@@ -158,8 +53,8 @@ declare function SubscriptionProvider({ children, apiUrl, projectId, email, vali
|
|
|
158
53
|
projectId?: string;
|
|
159
54
|
email?: string;
|
|
160
55
|
validateSubscriptionUrl?: string;
|
|
161
|
-
}): React
|
|
56
|
+
}): React.JSX.Element;
|
|
162
57
|
|
|
163
|
-
declare function SubscriptionPage(): React
|
|
58
|
+
declare function SubscriptionPage(): React.JSX.Element;
|
|
164
59
|
|
|
165
|
-
export { AdminApp, AdminLogin, type AdminLoginProps,
|
|
60
|
+
export { AdminApp, AdminLogin, type AdminLoginProps, MenuLabels, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useSubscription, useSubscriptionContext };
|