@uniformdev/next-app-router-client 20.7.1-alpha.118
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/LICENSE.txt +2 -0
- package/dist/index.d.mts +129 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.esm.js +521 -0
- package/dist/index.js +550 -0
- package/dist/index.mjs +521 -0
- package/package.json +55 -0
package/LICENSE.txt
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ManifestV2, CompositionMetadata, TestEvent, ContextState, ContextOptions, CookieTransitionDataStoreOptions, Context, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { JSX, PropsWithChildren } from 'react';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
6
|
+
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
7
|
+
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
8
|
+
|
|
9
|
+
type ClientContextComponentProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The Uniform project manifest
|
|
12
|
+
*/
|
|
13
|
+
manifest: ManifestV2;
|
|
14
|
+
/**
|
|
15
|
+
* Whether or not to disable the Uniform Context dev tools
|
|
16
|
+
*/
|
|
17
|
+
disableDevTools: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The default consent value
|
|
20
|
+
*/
|
|
21
|
+
defaultConsent: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated
|
|
24
|
+
* Whether or not to enable the experimental quirk serialization
|
|
25
|
+
*/
|
|
26
|
+
experimentalQuirkSerialization: boolean;
|
|
27
|
+
compositionMetadata?: CompositionMetadata;
|
|
28
|
+
};
|
|
29
|
+
type ClientContextComponent = (props: ClientContextComponentProps) => JSX.Element | null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Transfers test events from RSC to the client-side context.
|
|
33
|
+
* Uses stringify comparison to avoid duplicate processing when the event
|
|
34
|
+
* object reference changes but the content remains the same.
|
|
35
|
+
*/
|
|
36
|
+
declare const ClientContextTestTransfer: ({ event }: {
|
|
37
|
+
event: TestEvent;
|
|
38
|
+
}) => null;
|
|
39
|
+
|
|
40
|
+
type ClientUniformTextProps = {
|
|
41
|
+
/**
|
|
42
|
+
* The name of the HTML tag to render.
|
|
43
|
+
* @default "span"
|
|
44
|
+
*/
|
|
45
|
+
as?: React__default.ElementType;
|
|
46
|
+
/** The ID of the component. */
|
|
47
|
+
component: Pick<ComponentContext, '_id'>;
|
|
48
|
+
/** The ID of the parameter. */
|
|
49
|
+
parameter: ComponentParameter<string>;
|
|
50
|
+
/**
|
|
51
|
+
* When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
isMultiline?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
57
|
+
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
placeholder?: string | ((parameter: {
|
|
61
|
+
id: string;
|
|
62
|
+
}) => string | undefined);
|
|
63
|
+
/**
|
|
64
|
+
* A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
|
|
65
|
+
* @default "(value) => value"
|
|
66
|
+
*/
|
|
67
|
+
render?: (value: string | undefined) => React__default.ReactNode;
|
|
68
|
+
} & Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
|
|
69
|
+
/**
|
|
70
|
+
* Renders text parameters. Offers inline editing capability out of the box.
|
|
71
|
+
*/
|
|
72
|
+
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) => react_jsx_runtime.JSX.Element | null;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Transfers context state updates from RSC to the client-side context.
|
|
76
|
+
* Uses stringify comparison to avoid duplicate processing when the update
|
|
77
|
+
* object reference changes but the content remains the same.
|
|
78
|
+
*/
|
|
79
|
+
declare const ContextUpdateTransfer: ({ update }: {
|
|
80
|
+
update: Partial<ContextState>;
|
|
81
|
+
}) => null;
|
|
82
|
+
|
|
83
|
+
declare const DefaultUniformClientContext: ClientContextComponent;
|
|
84
|
+
|
|
85
|
+
declare const Personalize: ({ parameters, indexes, slots, context: compositionContext, }: PersonalizeProps) => React.FunctionComponentElement<{
|
|
86
|
+
children?: React.ReactNode | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
|
|
89
|
+
declare const UniformScript: () => react_jsx_runtime.JSX.Element;
|
|
90
|
+
|
|
91
|
+
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
92
|
+
parameter: VisibilityParameterValue;
|
|
93
|
+
initialIsVisible: boolean | null;
|
|
94
|
+
}>) => react_jsx_runtime.JSX.Element | null;
|
|
95
|
+
|
|
96
|
+
type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
|
|
97
|
+
serverCookieValue: string | undefined;
|
|
98
|
+
cookieAttributes?: CookieTransitionDataStoreOptions['cookieAttributes'];
|
|
99
|
+
quirkCookieValue?: string;
|
|
100
|
+
experimental_quirksEnabled?: CookieTransitionDataStoreOptions['experimental_quirksEnabled'];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type CreateClientUniformContextOptions = Omit<CreateUniformContextOptions, 'serverCookieValue'>;
|
|
104
|
+
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_context__.Context;
|
|
105
|
+
|
|
106
|
+
declare const useInitUniformContext: (callback: () => Context, compositionMetadata?: CompositionMetadata) => void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
110
|
+
* This can be used when you want to read current quirk values directly.
|
|
111
|
+
*/
|
|
112
|
+
declare function useQuirks(): Quirks;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Provides reactive access to the Uniform Context's current visitor scores values.
|
|
116
|
+
* This can be used when you want to read current score values directly.
|
|
117
|
+
*/
|
|
118
|
+
declare function useScores(): ScoreVector | undefined;
|
|
119
|
+
|
|
120
|
+
declare global {
|
|
121
|
+
interface Window {
|
|
122
|
+
__UNIFORM_CONTEXT__: Context | undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
declare const useUniformContext: () => {
|
|
126
|
+
context: Context | undefined;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer, ClientUniformText, type ClientUniformTextProps, ContextUpdateTransfer, DefaultUniformClientContext, Personalize, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ManifestV2, CompositionMetadata, TestEvent, ContextState, ContextOptions, CookieTransitionDataStoreOptions, Context, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { JSX, PropsWithChildren } from 'react';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ComponentContext, ComponentParameter, PersonalizeProps } from '@uniformdev/next-app-router-shared';
|
|
6
|
+
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
7
|
+
import * as _uniformdev_context__ from '@uniformdev/context/*';
|
|
8
|
+
|
|
9
|
+
type ClientContextComponentProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The Uniform project manifest
|
|
12
|
+
*/
|
|
13
|
+
manifest: ManifestV2;
|
|
14
|
+
/**
|
|
15
|
+
* Whether or not to disable the Uniform Context dev tools
|
|
16
|
+
*/
|
|
17
|
+
disableDevTools: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The default consent value
|
|
20
|
+
*/
|
|
21
|
+
defaultConsent: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated
|
|
24
|
+
* Whether or not to enable the experimental quirk serialization
|
|
25
|
+
*/
|
|
26
|
+
experimentalQuirkSerialization: boolean;
|
|
27
|
+
compositionMetadata?: CompositionMetadata;
|
|
28
|
+
};
|
|
29
|
+
type ClientContextComponent = (props: ClientContextComponentProps) => JSX.Element | null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Transfers test events from RSC to the client-side context.
|
|
33
|
+
* Uses stringify comparison to avoid duplicate processing when the event
|
|
34
|
+
* object reference changes but the content remains the same.
|
|
35
|
+
*/
|
|
36
|
+
declare const ClientContextTestTransfer: ({ event }: {
|
|
37
|
+
event: TestEvent;
|
|
38
|
+
}) => null;
|
|
39
|
+
|
|
40
|
+
type ClientUniformTextProps = {
|
|
41
|
+
/**
|
|
42
|
+
* The name of the HTML tag to render.
|
|
43
|
+
* @default "span"
|
|
44
|
+
*/
|
|
45
|
+
as?: React__default.ElementType;
|
|
46
|
+
/** The ID of the component. */
|
|
47
|
+
component: Pick<ComponentContext, '_id'>;
|
|
48
|
+
/** The ID of the parameter. */
|
|
49
|
+
parameter: ComponentParameter<string>;
|
|
50
|
+
/**
|
|
51
|
+
* When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
isMultiline?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
57
|
+
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
placeholder?: string | ((parameter: {
|
|
61
|
+
id: string;
|
|
62
|
+
}) => string | undefined);
|
|
63
|
+
/**
|
|
64
|
+
* A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
|
|
65
|
+
* @default "(value) => value"
|
|
66
|
+
*/
|
|
67
|
+
render?: (value: string | undefined) => React__default.ReactNode;
|
|
68
|
+
} & Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
|
|
69
|
+
/**
|
|
70
|
+
* Renders text parameters. Offers inline editing capability out of the box.
|
|
71
|
+
*/
|
|
72
|
+
declare const ClientUniformText: ({ as, component, parameter: providedParameter, isMultiline, placeholder, render, ...props }: ClientUniformTextProps) => react_jsx_runtime.JSX.Element | null;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Transfers context state updates from RSC to the client-side context.
|
|
76
|
+
* Uses stringify comparison to avoid duplicate processing when the update
|
|
77
|
+
* object reference changes but the content remains the same.
|
|
78
|
+
*/
|
|
79
|
+
declare const ContextUpdateTransfer: ({ update }: {
|
|
80
|
+
update: Partial<ContextState>;
|
|
81
|
+
}) => null;
|
|
82
|
+
|
|
83
|
+
declare const DefaultUniformClientContext: ClientContextComponent;
|
|
84
|
+
|
|
85
|
+
declare const Personalize: ({ parameters, indexes, slots, context: compositionContext, }: PersonalizeProps) => React.FunctionComponentElement<{
|
|
86
|
+
children?: React.ReactNode | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
|
|
89
|
+
declare const UniformScript: () => react_jsx_runtime.JSX.Element;
|
|
90
|
+
|
|
91
|
+
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
92
|
+
parameter: VisibilityParameterValue;
|
|
93
|
+
initialIsVisible: boolean | null;
|
|
94
|
+
}>) => react_jsx_runtime.JSX.Element | null;
|
|
95
|
+
|
|
96
|
+
type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
|
|
97
|
+
serverCookieValue: string | undefined;
|
|
98
|
+
cookieAttributes?: CookieTransitionDataStoreOptions['cookieAttributes'];
|
|
99
|
+
quirkCookieValue?: string;
|
|
100
|
+
experimental_quirksEnabled?: CookieTransitionDataStoreOptions['experimental_quirksEnabled'];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type CreateClientUniformContextOptions = Omit<CreateUniformContextOptions, 'serverCookieValue'>;
|
|
104
|
+
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_context__.Context;
|
|
105
|
+
|
|
106
|
+
declare const useInitUniformContext: (callback: () => Context, compositionMetadata?: CompositionMetadata) => void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
110
|
+
* This can be used when you want to read current quirk values directly.
|
|
111
|
+
*/
|
|
112
|
+
declare function useQuirks(): Quirks;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Provides reactive access to the Uniform Context's current visitor scores values.
|
|
116
|
+
* This can be used when you want to read current score values directly.
|
|
117
|
+
*/
|
|
118
|
+
declare function useScores(): ScoreVector | undefined;
|
|
119
|
+
|
|
120
|
+
declare global {
|
|
121
|
+
interface Window {
|
|
122
|
+
__UNIFORM_CONTEXT__: Context | undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
declare const useUniformContext: () => {
|
|
126
|
+
context: Context | undefined;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextTestTransfer, ClientUniformText, type ClientUniformTextProps, ContextUpdateTransfer, DefaultUniformClientContext, Personalize, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|