@servlyadmin/runtime-react 0.1.34 → 0.1.36
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.cjs +2 -2
- package/dist/index.d.cts +54 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -128,7 +128,7 @@ function ServlyComponent({
|
|
|
128
128
|
className,
|
|
129
129
|
style,
|
|
130
130
|
showSkeleton = true,
|
|
131
|
-
cacheStrategy = "
|
|
131
|
+
cacheStrategy = "localStorage",
|
|
132
132
|
retryConfig,
|
|
133
133
|
eventHandlers,
|
|
134
134
|
children,
|
|
@@ -236,7 +236,7 @@ function ServlyComponent({
|
|
|
236
236
|
setIsRendered(false);
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
|
-
}, [state.data, eventHandlers, waitForStyles]);
|
|
239
|
+
}, [state.data, state.views, state.registry, eventHandlers, waitForStyles]);
|
|
240
240
|
(0, import_react.useEffect)(() => {
|
|
241
241
|
if (!renderResultRef.current || !state.data) return;
|
|
242
242
|
const context = {
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CacheStrategy, RetryConfig } from '@servlyadmin/runtime-core';
|
|
3
|
+
export { BindingContext, CacheStrategy, ComponentData, FetchOptions, LayoutElement, PropDefinition, RetryConfig, clearAllCaches, compareVersions, fetchComponent, getRegistryUrl, invalidateCache, isComponentAvailable, parseVersion, prefetchComponents, resolveVersion, satisfiesVersion, setRegistryUrl } from '@servlyadmin/runtime-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ServlyComponent
|
|
7
|
+
* React wrapper for Servly runtime renderer with slot support
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Slot content type - React nodes keyed by slot name
|
|
12
|
+
*/
|
|
13
|
+
type SlotContent = Record<string, React.ReactNode>;
|
|
14
|
+
/**
|
|
15
|
+
* Props for ServlyComponent
|
|
16
|
+
*/
|
|
17
|
+
interface ServlyComponentProps<P = Record<string, any>> {
|
|
18
|
+
/** Component ID from the registry */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Version specifier (exact, range, or "latest") */
|
|
21
|
+
version?: string;
|
|
22
|
+
/** Props to pass to the component */
|
|
23
|
+
props?: P;
|
|
24
|
+
/** Slot content - React nodes to portal into named slots */
|
|
25
|
+
slots?: SlotContent;
|
|
26
|
+
/** Fallback UI while loading or on error */
|
|
27
|
+
fallback?: React.ReactNode;
|
|
28
|
+
/** Error callback */
|
|
29
|
+
onError?: (error: Error) => void;
|
|
30
|
+
/** Load complete callback */
|
|
31
|
+
onLoad?: () => void;
|
|
32
|
+
/** Custom className for wrapper */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Custom styles for wrapper */
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/** Show loading skeleton */
|
|
37
|
+
showSkeleton?: boolean;
|
|
38
|
+
/** Cache strategy */
|
|
39
|
+
cacheStrategy?: CacheStrategy;
|
|
40
|
+
/** Retry configuration */
|
|
41
|
+
retryConfig?: Partial<RetryConfig>;
|
|
42
|
+
/** Event handlers keyed by element ID then event name */
|
|
43
|
+
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
44
|
+
/** Children - rendered into default slot if no slots prop */
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
/** Wait for Tailwind CSS to load before showing component (prevents FOUC) */
|
|
47
|
+
waitForStyles?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* ServlyComponent - React wrapper for Servly runtime with slot support
|
|
51
|
+
*/
|
|
52
|
+
declare function ServlyComponent<P = Record<string, any>>({ id, version, props, slots, fallback, onError, onLoad, className, style, showSkeleton, cacheStrategy, retryConfig, eventHandlers, children, waitForStyles, }: ServlyComponentProps<P>): React.ReactElement | null;
|
|
53
|
+
|
|
54
|
+
export { ServlyComponent, type ServlyComponentProps, ServlyComponent as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CacheStrategy, RetryConfig } from '@servlyadmin/runtime-core';
|
|
3
|
+
export { BindingContext, CacheStrategy, ComponentData, FetchOptions, LayoutElement, PropDefinition, RetryConfig, clearAllCaches, compareVersions, fetchComponent, getRegistryUrl, invalidateCache, isComponentAvailable, parseVersion, prefetchComponents, resolveVersion, satisfiesVersion, setRegistryUrl } from '@servlyadmin/runtime-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ServlyComponent
|
|
7
|
+
* React wrapper for Servly runtime renderer with slot support
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Slot content type - React nodes keyed by slot name
|
|
12
|
+
*/
|
|
13
|
+
type SlotContent = Record<string, React.ReactNode>;
|
|
14
|
+
/**
|
|
15
|
+
* Props for ServlyComponent
|
|
16
|
+
*/
|
|
17
|
+
interface ServlyComponentProps<P = Record<string, any>> {
|
|
18
|
+
/** Component ID from the registry */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Version specifier (exact, range, or "latest") */
|
|
21
|
+
version?: string;
|
|
22
|
+
/** Props to pass to the component */
|
|
23
|
+
props?: P;
|
|
24
|
+
/** Slot content - React nodes to portal into named slots */
|
|
25
|
+
slots?: SlotContent;
|
|
26
|
+
/** Fallback UI while loading or on error */
|
|
27
|
+
fallback?: React.ReactNode;
|
|
28
|
+
/** Error callback */
|
|
29
|
+
onError?: (error: Error) => void;
|
|
30
|
+
/** Load complete callback */
|
|
31
|
+
onLoad?: () => void;
|
|
32
|
+
/** Custom className for wrapper */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Custom styles for wrapper */
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/** Show loading skeleton */
|
|
37
|
+
showSkeleton?: boolean;
|
|
38
|
+
/** Cache strategy */
|
|
39
|
+
cacheStrategy?: CacheStrategy;
|
|
40
|
+
/** Retry configuration */
|
|
41
|
+
retryConfig?: Partial<RetryConfig>;
|
|
42
|
+
/** Event handlers keyed by element ID then event name */
|
|
43
|
+
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
44
|
+
/** Children - rendered into default slot if no slots prop */
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
/** Wait for Tailwind CSS to load before showing component (prevents FOUC) */
|
|
47
|
+
waitForStyles?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* ServlyComponent - React wrapper for Servly runtime with slot support
|
|
51
|
+
*/
|
|
52
|
+
declare function ServlyComponent<P = Record<string, any>>({ id, version, props, slots, fallback, onError, onLoad, className, style, showSkeleton, cacheStrategy, retryConfig, eventHandlers, children, waitForStyles, }: ServlyComponentProps<P>): React.ReactElement | null;
|
|
53
|
+
|
|
54
|
+
export { ServlyComponent, type ServlyComponentProps, ServlyComponent as default };
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ function ServlyComponent({
|
|
|
96
96
|
className,
|
|
97
97
|
style,
|
|
98
98
|
showSkeleton = true,
|
|
99
|
-
cacheStrategy = "
|
|
99
|
+
cacheStrategy = "localStorage",
|
|
100
100
|
retryConfig,
|
|
101
101
|
eventHandlers,
|
|
102
102
|
children,
|
|
@@ -204,7 +204,7 @@ function ServlyComponent({
|
|
|
204
204
|
setIsRendered(false);
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
|
-
}, [state.data, eventHandlers, waitForStyles]);
|
|
207
|
+
}, [state.data, state.views, state.registry, eventHandlers, waitForStyles]);
|
|
208
208
|
useEffect(() => {
|
|
209
209
|
if (!renderResultRef.current || !state.data) return;
|
|
210
210
|
const context = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servlyadmin/runtime-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "React wrapper for Servly runtime renderer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
"tsup": "^8.0.0",
|
|
47
47
|
"typescript": "^5.3.0"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|