@uniformdev/next-app-router 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.
@@ -0,0 +1,264 @@
1
+ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
2
+ import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
+ import { ManifestClient } from '@uniformdev/context/api';
4
+ import { ProjectMapClient } from '@uniformdev/project-map';
5
+ import { U as UniformCompositionProps } from './UniformComposition-Bekn8k24.mjs';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-Bekn8k24.mjs';
7
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-CA63-EPp.mjs';
8
+ export { A as AwaitedUniformPageParameters, R as ResolveRouteFunction, U as UniformPageParameters, r as resolveRouteFromCode } from './resolveRouteFromCode-CA63-EPp.mjs';
9
+ import React from 'react';
10
+ export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.mjs';
11
+ import '@uniformdev/next-app-router-client';
12
+ import '@uniformdev/context';
13
+
14
+ type SpecificCacheMode<TCacheMode extends CacheMode> = {
15
+ cache: TCacheMode;
16
+ };
17
+ type StateCacheMode = {
18
+ state: number;
19
+ };
20
+ type DetectCacheMode = {
21
+ searchParams: URLSearchParams;
22
+ draftModeEnabled: boolean;
23
+ };
24
+ type ResolvableCacheOptions<TCacheMode extends CacheMode> = SpecificCacheMode<TCacheMode> | StateCacheMode | DetectCacheMode;
25
+
26
+ type GetCanvasClientOptions = ResolvableCacheOptions<CanvasCacheMode>;
27
+ declare const getCanvasClient: (options?: GetCanvasClientOptions) => CanvasClient;
28
+
29
+ type GetManifestClientOptions = ResolvableCacheOptions<ManifestCacheMode>;
30
+ declare const getManifestClient: (options?: GetManifestClientOptions) => ManifestClient;
31
+ type GetManifestOptions = GetManifestClientOptions;
32
+ declare const getManifest: (options: GetManifestOptions) => Promise<{
33
+ project: {
34
+ id?: string;
35
+ name?: string;
36
+ ui_version?: number;
37
+ pz?: {
38
+ sig?: {
39
+ [key: string]: {
40
+ str: number;
41
+ cap: number;
42
+ dur: "s" | "p" | "t";
43
+ crit: {
44
+ type: "G";
45
+ op?: "&" | "|";
46
+ clauses: ({
47
+ type: "G";
48
+ op?: "&" | "|";
49
+ clauses: (/*elided*/ any | ({
50
+ type: "CK";
51
+ cookieName: string;
52
+ match: {
53
+ rhs: string;
54
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
55
+ cs?: boolean;
56
+ } | {
57
+ op: "*" | "!*";
58
+ };
59
+ } | {
60
+ type: "QS";
61
+ queryName: string;
62
+ match: {
63
+ rhs: string;
64
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
65
+ cs?: boolean;
66
+ } | {
67
+ op: "*" | "!*";
68
+ };
69
+ } | {
70
+ type: "QK";
71
+ key: string;
72
+ match: {
73
+ rhs: string;
74
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
75
+ cs?: boolean;
76
+ } | {
77
+ op: "*" | "!*";
78
+ };
79
+ } | {
80
+ type: "EVT";
81
+ event: {
82
+ rhs: string;
83
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
84
+ cs?: boolean;
85
+ } | {
86
+ op: "*" | "!*";
87
+ };
88
+ } | {
89
+ type: "PV";
90
+ path: {
91
+ rhs: string;
92
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
93
+ cs?: boolean;
94
+ } | {
95
+ op: "*" | "!*";
96
+ };
97
+ } | {
98
+ type: "PVC";
99
+ match: {
100
+ rhs: number;
101
+ op: "=" | "<" | ">" | "!=";
102
+ };
103
+ }))[];
104
+ } | ({
105
+ type: "CK";
106
+ cookieName: string;
107
+ match: {
108
+ rhs: string;
109
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
110
+ cs?: boolean;
111
+ } | {
112
+ op: "*" | "!*";
113
+ };
114
+ } | {
115
+ type: "QS";
116
+ queryName: string;
117
+ match: {
118
+ rhs: string;
119
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
120
+ cs?: boolean;
121
+ } | {
122
+ op: "*" | "!*";
123
+ };
124
+ } | {
125
+ type: "QK";
126
+ key: string;
127
+ match: {
128
+ rhs: string;
129
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
130
+ cs?: boolean;
131
+ } | {
132
+ op: "*" | "!*";
133
+ };
134
+ } | {
135
+ type: "EVT";
136
+ event: {
137
+ rhs: string;
138
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
139
+ cs?: boolean;
140
+ } | {
141
+ op: "*" | "!*";
142
+ };
143
+ } | {
144
+ type: "PV";
145
+ path: {
146
+ rhs: string;
147
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
148
+ cs?: boolean;
149
+ } | {
150
+ op: "*" | "!*";
151
+ };
152
+ } | {
153
+ type: "PVC";
154
+ match: {
155
+ rhs: number;
156
+ op: "=" | "<" | ">" | "!=";
157
+ };
158
+ }))[];
159
+ };
160
+ conversion?: {
161
+ freq: "O";
162
+ } | null;
163
+ };
164
+ };
165
+ enr?: {
166
+ [key: string]: {
167
+ cap: number;
168
+ };
169
+ };
170
+ agg?: {
171
+ [key: string]: {
172
+ inputs: {
173
+ dim: string;
174
+ sign?: "+" | "-" | "c";
175
+ }[];
176
+ };
177
+ };
178
+ control?: number;
179
+ };
180
+ test?: {
181
+ [key: string]: {
182
+ wv?: string;
183
+ };
184
+ };
185
+ };
186
+ }>;
187
+
188
+ type GetProjectMapClientOptions = ResolvableCacheOptions<ProjectMapCacheMode>;
189
+ declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
190
+
191
+ type GetRouteClientOptions = ResolvableCacheOptions<CanvasCacheMode>;
192
+ declare const getRouteClient: (options?: GetRouteClientOptions) => RouteClient;
193
+
194
+ type PlaygroundParameters = {
195
+ params: Promise<{
196
+ code: string;
197
+ }>;
198
+ };
199
+
200
+ type UniformPlaygroundProps = UniformCompositionProps;
201
+ declare const UniformPlayground: ({ resolveRoute, ...rest }: UniformPlaygroundProps) => Promise<React.JSX.Element>;
202
+
203
+ type CreateStaticParamsOptions = {
204
+ paths: string[];
205
+ rewrite?: (options: {
206
+ path: string;
207
+ }) => Promise<RewriteRequestPathResult | undefined>;
208
+ };
209
+ /**
210
+ * @deprecated
211
+ * Experimental function to generate all possible page states for the given paths.
212
+ * @param options
213
+ * @returns
214
+ */
215
+ declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
216
+ code: string;
217
+ }[]>;
218
+ /**
219
+ * @deprecated
220
+ * Experimental function to generate all possible page states for the given paths.
221
+ * @param options
222
+ * @returns
223
+ */
224
+ declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
225
+ code: string;
226
+ }[]>;
227
+
228
+ type EvaluateTestsFunction = (test: {
229
+ name: string;
230
+ component: ComponentInstance;
231
+ }) => boolean;
232
+ type EvaluatePersonalizationsFunction = (personalization: {
233
+ name: string;
234
+ component: ComponentInstance;
235
+ }) => boolean;
236
+ type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
237
+ /**
238
+ * Whether to evaluate tests
239
+ * @default true
240
+ */
241
+ evaluateTests?: boolean | EvaluateTestsFunction;
242
+ /**
243
+ * Whether to evaluate personalizations
244
+ * @default true
245
+ */
246
+ evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
247
+ };
248
+ declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
249
+
250
+ declare const resolvePlaygroundRoute: ({ params, }: PlaygroundParameters) => Promise<ResolvedRouteResult>;
251
+
252
+ type CustomRoute = {
253
+ id: string;
254
+ pattern: string;
255
+ };
256
+ type RouteMatch = {
257
+ route: CustomRoute;
258
+ params: Record<string, string>;
259
+ };
260
+ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatch | undefined;
261
+
262
+ declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
263
+
264
+ export { type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };
@@ -0,0 +1,264 @@
1
+ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
2
+ import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
+ import { ManifestClient } from '@uniformdev/context/api';
4
+ import { ProjectMapClient } from '@uniformdev/project-map';
5
+ import { U as UniformCompositionProps } from './UniformComposition-CdXfLiaB.js';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-CdXfLiaB.js';
7
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-B2rqnHgJ.js';
8
+ export { A as AwaitedUniformPageParameters, R as ResolveRouteFunction, U as UniformPageParameters, r as resolveRouteFromCode } from './resolveRouteFromCode-B2rqnHgJ.js';
9
+ import React from 'react';
10
+ export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.js';
11
+ import '@uniformdev/next-app-router-client';
12
+ import '@uniformdev/context';
13
+
14
+ type SpecificCacheMode<TCacheMode extends CacheMode> = {
15
+ cache: TCacheMode;
16
+ };
17
+ type StateCacheMode = {
18
+ state: number;
19
+ };
20
+ type DetectCacheMode = {
21
+ searchParams: URLSearchParams;
22
+ draftModeEnabled: boolean;
23
+ };
24
+ type ResolvableCacheOptions<TCacheMode extends CacheMode> = SpecificCacheMode<TCacheMode> | StateCacheMode | DetectCacheMode;
25
+
26
+ type GetCanvasClientOptions = ResolvableCacheOptions<CanvasCacheMode>;
27
+ declare const getCanvasClient: (options?: GetCanvasClientOptions) => CanvasClient;
28
+
29
+ type GetManifestClientOptions = ResolvableCacheOptions<ManifestCacheMode>;
30
+ declare const getManifestClient: (options?: GetManifestClientOptions) => ManifestClient;
31
+ type GetManifestOptions = GetManifestClientOptions;
32
+ declare const getManifest: (options: GetManifestOptions) => Promise<{
33
+ project: {
34
+ id?: string;
35
+ name?: string;
36
+ ui_version?: number;
37
+ pz?: {
38
+ sig?: {
39
+ [key: string]: {
40
+ str: number;
41
+ cap: number;
42
+ dur: "s" | "p" | "t";
43
+ crit: {
44
+ type: "G";
45
+ op?: "&" | "|";
46
+ clauses: ({
47
+ type: "G";
48
+ op?: "&" | "|";
49
+ clauses: (/*elided*/ any | ({
50
+ type: "CK";
51
+ cookieName: string;
52
+ match: {
53
+ rhs: string;
54
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
55
+ cs?: boolean;
56
+ } | {
57
+ op: "*" | "!*";
58
+ };
59
+ } | {
60
+ type: "QS";
61
+ queryName: string;
62
+ match: {
63
+ rhs: string;
64
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
65
+ cs?: boolean;
66
+ } | {
67
+ op: "*" | "!*";
68
+ };
69
+ } | {
70
+ type: "QK";
71
+ key: string;
72
+ match: {
73
+ rhs: string;
74
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
75
+ cs?: boolean;
76
+ } | {
77
+ op: "*" | "!*";
78
+ };
79
+ } | {
80
+ type: "EVT";
81
+ event: {
82
+ rhs: string;
83
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
84
+ cs?: boolean;
85
+ } | {
86
+ op: "*" | "!*";
87
+ };
88
+ } | {
89
+ type: "PV";
90
+ path: {
91
+ rhs: string;
92
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
93
+ cs?: boolean;
94
+ } | {
95
+ op: "*" | "!*";
96
+ };
97
+ } | {
98
+ type: "PVC";
99
+ match: {
100
+ rhs: number;
101
+ op: "=" | "<" | ">" | "!=";
102
+ };
103
+ }))[];
104
+ } | ({
105
+ type: "CK";
106
+ cookieName: string;
107
+ match: {
108
+ rhs: string;
109
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
110
+ cs?: boolean;
111
+ } | {
112
+ op: "*" | "!*";
113
+ };
114
+ } | {
115
+ type: "QS";
116
+ queryName: string;
117
+ match: {
118
+ rhs: string;
119
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
120
+ cs?: boolean;
121
+ } | {
122
+ op: "*" | "!*";
123
+ };
124
+ } | {
125
+ type: "QK";
126
+ key: string;
127
+ match: {
128
+ rhs: string;
129
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
130
+ cs?: boolean;
131
+ } | {
132
+ op: "*" | "!*";
133
+ };
134
+ } | {
135
+ type: "EVT";
136
+ event: {
137
+ rhs: string;
138
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
139
+ cs?: boolean;
140
+ } | {
141
+ op: "*" | "!*";
142
+ };
143
+ } | {
144
+ type: "PV";
145
+ path: {
146
+ rhs: string;
147
+ op: "=" | "~" | "//" | "!=" | "!~" | "!//";
148
+ cs?: boolean;
149
+ } | {
150
+ op: "*" | "!*";
151
+ };
152
+ } | {
153
+ type: "PVC";
154
+ match: {
155
+ rhs: number;
156
+ op: "=" | "<" | ">" | "!=";
157
+ };
158
+ }))[];
159
+ };
160
+ conversion?: {
161
+ freq: "O";
162
+ } | null;
163
+ };
164
+ };
165
+ enr?: {
166
+ [key: string]: {
167
+ cap: number;
168
+ };
169
+ };
170
+ agg?: {
171
+ [key: string]: {
172
+ inputs: {
173
+ dim: string;
174
+ sign?: "+" | "-" | "c";
175
+ }[];
176
+ };
177
+ };
178
+ control?: number;
179
+ };
180
+ test?: {
181
+ [key: string]: {
182
+ wv?: string;
183
+ };
184
+ };
185
+ };
186
+ }>;
187
+
188
+ type GetProjectMapClientOptions = ResolvableCacheOptions<ProjectMapCacheMode>;
189
+ declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
190
+
191
+ type GetRouteClientOptions = ResolvableCacheOptions<CanvasCacheMode>;
192
+ declare const getRouteClient: (options?: GetRouteClientOptions) => RouteClient;
193
+
194
+ type PlaygroundParameters = {
195
+ params: Promise<{
196
+ code: string;
197
+ }>;
198
+ };
199
+
200
+ type UniformPlaygroundProps = UniformCompositionProps;
201
+ declare const UniformPlayground: ({ resolveRoute, ...rest }: UniformPlaygroundProps) => Promise<React.JSX.Element>;
202
+
203
+ type CreateStaticParamsOptions = {
204
+ paths: string[];
205
+ rewrite?: (options: {
206
+ path: string;
207
+ }) => Promise<RewriteRequestPathResult | undefined>;
208
+ };
209
+ /**
210
+ * @deprecated
211
+ * Experimental function to generate all possible page states for the given paths.
212
+ * @param options
213
+ * @returns
214
+ */
215
+ declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
216
+ code: string;
217
+ }[]>;
218
+ /**
219
+ * @deprecated
220
+ * Experimental function to generate all possible page states for the given paths.
221
+ * @param options
222
+ * @returns
223
+ */
224
+ declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
225
+ code: string;
226
+ }[]>;
227
+
228
+ type EvaluateTestsFunction = (test: {
229
+ name: string;
230
+ component: ComponentInstance;
231
+ }) => boolean;
232
+ type EvaluatePersonalizationsFunction = (personalization: {
233
+ name: string;
234
+ component: ComponentInstance;
235
+ }) => boolean;
236
+ type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
237
+ /**
238
+ * Whether to evaluate tests
239
+ * @default true
240
+ */
241
+ evaluateTests?: boolean | EvaluateTestsFunction;
242
+ /**
243
+ * Whether to evaluate personalizations
244
+ * @default true
245
+ */
246
+ evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
247
+ };
248
+ declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
249
+
250
+ declare const resolvePlaygroundRoute: ({ params, }: PlaygroundParameters) => Promise<ResolvedRouteResult>;
251
+
252
+ type CustomRoute = {
253
+ id: string;
254
+ pattern: string;
255
+ };
256
+ type RouteMatch = {
257
+ route: CustomRoute;
258
+ params: Record<string, string>;
259
+ };
260
+ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatch | undefined;
261
+
262
+ declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
263
+
264
+ export { type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };