@olonjs/react 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +194 -0
- package/dist/olonjs-react.js +1248 -0
- package/dist/olonjs-react.umd.cjs +57 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { AssetsConfig } from '@olonjs/core';
|
|
2
|
+
import { buildThemeVariableMap } from '@olonjs/core';
|
|
3
|
+
import { Component } from 'react';
|
|
4
|
+
import { Context } from 'react';
|
|
5
|
+
import { default as default_2 } from 'react';
|
|
6
|
+
import { ErrorInfo } from 'react';
|
|
7
|
+
import { JsonPagesConfig } from '@olonjs/core';
|
|
8
|
+
import { JSX } from 'react/jsx-runtime';
|
|
9
|
+
import { LucideIcon } from 'lucide-react';
|
|
10
|
+
import { MenuConfig } from '@olonjs/core';
|
|
11
|
+
import { MenuItem } from '@olonjs/core';
|
|
12
|
+
import { PageConfig } from '@olonjs/core';
|
|
13
|
+
import { PageMeta } from '@olonjs/core';
|
|
14
|
+
import { PageRendererProps } from '@olonjs/core';
|
|
15
|
+
import { ReactNode } from 'react';
|
|
16
|
+
import { Section } from '@olonjs/core';
|
|
17
|
+
import { SiteConfig } from '@olonjs/core';
|
|
18
|
+
import { StudioRouteBodyProps } from '@olonjs/studio';
|
|
19
|
+
import { ThemeConfig } from '@olonjs/core';
|
|
20
|
+
|
|
21
|
+
export { buildThemeVariableMap }
|
|
22
|
+
|
|
23
|
+
export declare interface ConfigContextValue {
|
|
24
|
+
registry: Registry;
|
|
25
|
+
schemas: Schemas;
|
|
26
|
+
tenantId?: string;
|
|
27
|
+
basePath?: string;
|
|
28
|
+
assets?: AssetsConfig;
|
|
29
|
+
overlayDisabledSectionTypes?: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare const ConfigProvider: default_2.FC<{
|
|
33
|
+
config: Pick<JsonPagesConfig, 'registry' | 'schemas' | 'tenantId' | 'basePath' | 'assets' | 'overlayDisabledSectionTypes'>;
|
|
34
|
+
children: default_2.ReactNode;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
export declare const DefaultNotFound: default_2.FC;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Engine-level error boundary: prevents black screen on any render error
|
|
41
|
+
* and surfaces a visible error UI.
|
|
42
|
+
*/
|
|
43
|
+
export declare class EngineErrorBoundary extends Component<{
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}, {
|
|
46
|
+
hasError: boolean;
|
|
47
|
+
error: Error | null;
|
|
48
|
+
}> {
|
|
49
|
+
constructor(props: {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
});
|
|
52
|
+
static getDerivedStateFromError(error: Error): {
|
|
53
|
+
hasError: boolean;
|
|
54
|
+
error: Error;
|
|
55
|
+
};
|
|
56
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
57
|
+
render(): string | number | bigint | boolean | Iterable<default_2.ReactNode> | Promise<string | number | bigint | boolean | default_2.ReactPortal | default_2.ReactElement<unknown, string | default_2.JSXElementConstructor<any>> | Iterable<default_2.ReactNode> | null | undefined> | JSX.Element | null | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare interface FormState {
|
|
61
|
+
status: FormStatus;
|
|
62
|
+
message: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export declare type FormStatus = 'idle' | 'submitting' | 'success' | 'error';
|
|
66
|
+
|
|
67
|
+
export declare type IconRegistry = Record<string, LucideIcon>;
|
|
68
|
+
|
|
69
|
+
export declare const IconRegistryContext: Context<IconRegistry>;
|
|
70
|
+
|
|
71
|
+
export declare function JsonPagesEngine({ config }: JsonPagesEngineProps): JSX.Element;
|
|
72
|
+
|
|
73
|
+
export declare interface JsonPagesEngineProps {
|
|
74
|
+
config: JsonPagesConfig;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Context holding the submission state of every olon-managed form,
|
|
79
|
+
* keyed by the form's id attribute (or anchorId).
|
|
80
|
+
* Provided by App.tsx via useOlonForms().
|
|
81
|
+
*/
|
|
82
|
+
export declare const OlonFormsContext: Context<Record<string, FormState>>;
|
|
83
|
+
|
|
84
|
+
export declare function OlonJSEngine({ config }: OlonJSEngineProps): JSX.Element;
|
|
85
|
+
|
|
86
|
+
export declare interface OlonJSEngineProps {
|
|
87
|
+
config: JsonPagesConfig;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare const PageRenderer: default_2.FC<Props>;
|
|
91
|
+
|
|
92
|
+
export declare const PreviewEntry: default_2.FC;
|
|
93
|
+
|
|
94
|
+
export declare const PreviewRoute: default_2.FC<PreviewRouteProps>;
|
|
95
|
+
|
|
96
|
+
export declare interface PreviewRouteProps {
|
|
97
|
+
tenantCss: string;
|
|
98
|
+
adminCss: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare type Props = PageRendererProps & {
|
|
102
|
+
onReorder?: (sectionId: string, newIndex: number) => void;
|
|
103
|
+
scrollToSectionId?: string | null;
|
|
104
|
+
onActiveSectionChange?: (sectionId: string | null) => void;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare type Registry = JsonPagesConfig['registry'];
|
|
108
|
+
|
|
109
|
+
declare type Schemas = JsonPagesConfig['schemas'];
|
|
110
|
+
|
|
111
|
+
export declare const SectionRenderer: default_2.FC<SectionRendererProps>;
|
|
112
|
+
|
|
113
|
+
declare interface SectionRendererProps {
|
|
114
|
+
section: Section;
|
|
115
|
+
menu?: MenuItem[];
|
|
116
|
+
selectedId?: string | null;
|
|
117
|
+
reorderable?: boolean;
|
|
118
|
+
sectionIndex?: number;
|
|
119
|
+
totalSections?: number;
|
|
120
|
+
onReorder?: (sectionId: string, newIndex: number) => void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare interface StudioContextType {
|
|
124
|
+
mode: StudioMode;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare type StudioMode = 'visitor' | 'studio';
|
|
128
|
+
|
|
129
|
+
export declare const StudioProvider: default_2.FC<{
|
|
130
|
+
mode: StudioMode;
|
|
131
|
+
children: ReactNode;
|
|
132
|
+
}>;
|
|
133
|
+
|
|
134
|
+
export declare const StudioRoute: default_2.FC<StudioRouteProps>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Thin composition bridge: wires up the react-bound `ThemeLoader` /
|
|
138
|
+
* `StudioProvider` context around `@olonjs/studio`'s `StudioRouteBody`.
|
|
139
|
+
*
|
|
140
|
+
* Per ADR-0016 D2/D6, `@olonjs/studio` is never a static import anywhere in
|
|
141
|
+
* this package — only the `import type` above (erased at compile time) and
|
|
142
|
+
* the dynamic `import('@olonjs/studio')` below. This is the single bridge
|
|
143
|
+
* point where the optional Studio dependency actually loads, and it only
|
|
144
|
+
* loads when a consumer's router mounts this component (i.e. navigates to
|
|
145
|
+
* `/admin`).
|
|
146
|
+
*/
|
|
147
|
+
export declare interface StudioRouteProps extends StudioRouteBodyProps {
|
|
148
|
+
tenantCss: string;
|
|
149
|
+
adminCss: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare const ThemeLoader: default_2.FC<ThemeLoaderProps>;
|
|
153
|
+
|
|
154
|
+
export declare interface ThemeLoaderProps {
|
|
155
|
+
mode: 'tenant' | 'admin';
|
|
156
|
+
tenantCss: string;
|
|
157
|
+
adminCss: string;
|
|
158
|
+
children: default_2.ReactNode;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare const themeManager: {
|
|
162
|
+
setTheme: (theme: ThemeConfig) => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export declare function useConfig(): ConfigContextValue;
|
|
166
|
+
|
|
167
|
+
export declare const useDocumentMeta: (meta: PageMeta) => void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Read the submission state for a specific form.
|
|
171
|
+
* @param formId - must match the id attribute on the <form> element.
|
|
172
|
+
*/
|
|
173
|
+
export declare function useFormState(formId: string): FormState;
|
|
174
|
+
|
|
175
|
+
export declare const useIconRegistry: () => IconRegistry;
|
|
176
|
+
|
|
177
|
+
export declare const useStudio: () => StudioContextType;
|
|
178
|
+
|
|
179
|
+
export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
|
|
180
|
+
|
|
181
|
+
export declare interface VisitorRouteProps {
|
|
182
|
+
pageRegistry: Record<string, PageConfig>;
|
|
183
|
+
siteConfig: SiteConfig;
|
|
184
|
+
menuConfig: MenuConfig;
|
|
185
|
+
themeConfig: JsonPagesConfig['themeConfig'];
|
|
186
|
+
collections?: JsonPagesConfig['collections'];
|
|
187
|
+
collectionSchemas?: JsonPagesConfig['collectionSchemas'];
|
|
188
|
+
refDocuments?: JsonPagesConfig['refDocuments'];
|
|
189
|
+
tenantCss: string;
|
|
190
|
+
adminCss: string;
|
|
191
|
+
NotFoundComponent: default_2.ComponentType;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { }
|