@servlyadmin/runtime-react 0.1.34 → 0.1.35

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.
@@ -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 };
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servlyadmin/runtime-react",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
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
+ }