@weaverse/react 5.5.0-beta.0 → 5.5.0-beta.2
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.mts +4 -21
- package/dist/index.d.ts +4 -21
- package/dist/index.js +33 -2151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -2161
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ export * from '@weaverse/core';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { UIMatch } from 'react-router';
|
|
7
6
|
|
|
8
7
|
declare let WeaverseContext: react.Context<Weaverse>;
|
|
9
8
|
declare let WeaverseContextProvider: react.Provider<Weaverse>;
|
|
@@ -12,23 +11,7 @@ declare let WeaverseItemContext: react.Context<{
|
|
|
12
11
|
parentId: string;
|
|
13
12
|
}>;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
root?: Record<string, unknown>;
|
|
17
|
-
[routeKey: `routes/${string}`]: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
type WeaverseDataContext = RouteKeyedDataContext & Record<string, unknown>;
|
|
20
|
-
/**
|
|
21
|
-
* Hook to get flat route-keyed data context from matches
|
|
22
|
-
* Returns: {root: {...}, "routes/xxx": {...}}
|
|
23
|
-
* No more useLoaderData dependency - everything comes from matches
|
|
24
|
-
*/
|
|
25
|
-
declare function useWeaverseDataContext(): WeaverseDataContext;
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to create flat route-keyed data context from useMatches() result
|
|
28
|
-
* Returns: {root: {...}, "routes/xxx": {...}}
|
|
29
|
-
*/
|
|
30
|
-
declare function createWeaverseDataContext(matches: UIMatch<unknown, unknown>[]): WeaverseDataContext;
|
|
31
|
-
|
|
14
|
+
type DataContext = Record<string, unknown>;
|
|
32
15
|
/**
|
|
33
16
|
* Replaces data connector placeholders in content with actual values from data context
|
|
34
17
|
* Supports {{path}} syntax with dot notation, array indexing, and route prefixes
|
|
@@ -44,7 +27,7 @@ declare function createWeaverseDataContext(matches: UIMatch<unknown, unknown>[])
|
|
|
44
27
|
* @param dataContext - The enhanced WeaverseDataContext with route-keyed data
|
|
45
28
|
* @returns The content with placeholders replaced by actual values
|
|
46
29
|
*/
|
|
47
|
-
declare function replaceContentDataConnectors(content: string, dataContext:
|
|
30
|
+
declare function replaceContentDataConnectors(content: string, dataContext: DataContext | null | undefined): string;
|
|
48
31
|
/**
|
|
49
32
|
* Recursively replaces data connector placeholders in any data structure
|
|
50
33
|
* Handles strings, objects, arrays, and nested combinations
|
|
@@ -54,7 +37,7 @@ declare function replaceContentDataConnectors(content: string, dataContext: Weav
|
|
|
54
37
|
* @param visited - Set to track visited objects for circular reference protection
|
|
55
38
|
* @returns The data with all string placeholders replaced
|
|
56
39
|
*/
|
|
57
|
-
declare function replaceContentDataConnectorsDeep<T>(data: T, dataContext:
|
|
40
|
+
declare function replaceContentDataConnectorsDeep<T>(data: T, dataContext: DataContext | null | undefined, visited?: WeakSet<WeakKey>): T;
|
|
58
41
|
|
|
59
42
|
declare function useWeaverse<T = Weaverse>(): T;
|
|
60
43
|
declare let useItemInstance: (id?: string) => WeaverseItemStore | null;
|
|
@@ -77,4 +60,4 @@ type ItemComponentProps = {
|
|
|
77
60
|
declare const useSafeExternalStore: (subscribe: any, getSnapshot: any, getServerSnapshot?: any) => any;
|
|
78
61
|
declare let WeaverseRoot: react.MemoExoticComponent<({ context }: WeaverseRootPropsType) => react_jsx_runtime.JSX.Element | null>;
|
|
79
62
|
|
|
80
|
-
export { type ItemComponentProps, WeaverseContext, WeaverseContextProvider, type
|
|
63
|
+
export { type ItemComponentProps, WeaverseContext, WeaverseContextProvider, type WeaverseElementProps, WeaverseItemContext, WeaverseRoot, type WeaverseRootPropsType, replaceContentDataConnectors, replaceContentDataConnectorsDeep, useChildInstances, useItemInstance, useParentInstance, useSafeExternalStore, useWeaverse };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from '@weaverse/core';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { UIMatch } from 'react-router';
|
|
7
6
|
|
|
8
7
|
declare let WeaverseContext: react.Context<Weaverse>;
|
|
9
8
|
declare let WeaverseContextProvider: react.Provider<Weaverse>;
|
|
@@ -12,23 +11,7 @@ declare let WeaverseItemContext: react.Context<{
|
|
|
12
11
|
parentId: string;
|
|
13
12
|
}>;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
root?: Record<string, unknown>;
|
|
17
|
-
[routeKey: `routes/${string}`]: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
type WeaverseDataContext = RouteKeyedDataContext & Record<string, unknown>;
|
|
20
|
-
/**
|
|
21
|
-
* Hook to get flat route-keyed data context from matches
|
|
22
|
-
* Returns: {root: {...}, "routes/xxx": {...}}
|
|
23
|
-
* No more useLoaderData dependency - everything comes from matches
|
|
24
|
-
*/
|
|
25
|
-
declare function useWeaverseDataContext(): WeaverseDataContext;
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to create flat route-keyed data context from useMatches() result
|
|
28
|
-
* Returns: {root: {...}, "routes/xxx": {...}}
|
|
29
|
-
*/
|
|
30
|
-
declare function createWeaverseDataContext(matches: UIMatch<unknown, unknown>[]): WeaverseDataContext;
|
|
31
|
-
|
|
14
|
+
type DataContext = Record<string, unknown>;
|
|
32
15
|
/**
|
|
33
16
|
* Replaces data connector placeholders in content with actual values from data context
|
|
34
17
|
* Supports {{path}} syntax with dot notation, array indexing, and route prefixes
|
|
@@ -44,7 +27,7 @@ declare function createWeaverseDataContext(matches: UIMatch<unknown, unknown>[])
|
|
|
44
27
|
* @param dataContext - The enhanced WeaverseDataContext with route-keyed data
|
|
45
28
|
* @returns The content with placeholders replaced by actual values
|
|
46
29
|
*/
|
|
47
|
-
declare function replaceContentDataConnectors(content: string, dataContext:
|
|
30
|
+
declare function replaceContentDataConnectors(content: string, dataContext: DataContext | null | undefined): string;
|
|
48
31
|
/**
|
|
49
32
|
* Recursively replaces data connector placeholders in any data structure
|
|
50
33
|
* Handles strings, objects, arrays, and nested combinations
|
|
@@ -54,7 +37,7 @@ declare function replaceContentDataConnectors(content: string, dataContext: Weav
|
|
|
54
37
|
* @param visited - Set to track visited objects for circular reference protection
|
|
55
38
|
* @returns The data with all string placeholders replaced
|
|
56
39
|
*/
|
|
57
|
-
declare function replaceContentDataConnectorsDeep<T>(data: T, dataContext:
|
|
40
|
+
declare function replaceContentDataConnectorsDeep<T>(data: T, dataContext: DataContext | null | undefined, visited?: WeakSet<WeakKey>): T;
|
|
58
41
|
|
|
59
42
|
declare function useWeaverse<T = Weaverse>(): T;
|
|
60
43
|
declare let useItemInstance: (id?: string) => WeaverseItemStore | null;
|
|
@@ -77,4 +60,4 @@ type ItemComponentProps = {
|
|
|
77
60
|
declare const useSafeExternalStore: (subscribe: any, getSnapshot: any, getServerSnapshot?: any) => any;
|
|
78
61
|
declare let WeaverseRoot: react.MemoExoticComponent<({ context }: WeaverseRootPropsType) => react_jsx_runtime.JSX.Element | null>;
|
|
79
62
|
|
|
80
|
-
export { type ItemComponentProps, WeaverseContext, WeaverseContextProvider, type
|
|
63
|
+
export { type ItemComponentProps, WeaverseContext, WeaverseContextProvider, type WeaverseElementProps, WeaverseItemContext, WeaverseRoot, type WeaverseRootPropsType, replaceContentDataConnectors, replaceContentDataConnectorsDeep, useChildInstances, useItemInstance, useParentInstance, useSafeExternalStore, useWeaverse };
|