@bgub/fig 0.1.0-alpha.7 → 0.1.1
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/CHANGELOG.md +610 -0
- package/dist/{element-Od8CmsBL.d.ts → element-9MtOc5qb.d.ts} +113 -0
- package/dist/{element-wieeFL9f.js → element-mHDfizuh.js} +55 -1
- package/dist/element-mHDfizuh.js.map +1 -0
- package/dist/{hooks-BSqKOOez.d.ts → hooks-Bw3vbom7.d.ts} +63 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/internal.d.ts +45 -2
- package/dist/internal.js +24 -4
- package/dist/internal.js.map +1 -1
- package/dist/jsx-runtime.d.ts +4 -1
- package/dist/jsx-runtime.js +7 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
- package/dist/payload-format-BbsvTG9V.js.map +1 -0
- package/dist/payload.d.ts +6 -1
- package/dist/payload.js +11 -8
- package/dist/payload.js.map +1 -1
- package/{dist-development/resource-Cp01PvqW.js → dist/resource-BJxS62H2.js} +23 -3
- package/dist/resource-BJxS62H2.js.map +1 -0
- package/dist/{transition-DBjQTorq.js → transition-WvgFiYNY.js} +23 -4
- package/dist/transition-WvgFiYNY.js.map +1 -0
- package/dist-development/{element-Bb5fLsPy.js → element-CVlfN_3_.js} +55 -1
- package/dist-development/element-CVlfN_3_.js.map +1 -0
- package/dist-development/index.js +3 -3
- package/dist-development/internal.js +24 -4
- package/dist-development/internal.js.map +1 -1
- package/dist-development/jsx-runtime.js +7 -1
- package/dist-development/jsx-runtime.js.map +1 -1
- package/dist-development/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
- package/dist-development/payload-format-BbsvTG9V.js.map +1 -0
- package/dist-development/payload.js +11 -8
- package/dist-development/payload.js.map +1 -1
- package/{dist/resource-BfNHyXun.js → dist-development/resource-Bhusybfq.js} +23 -3
- package/dist-development/resource-Bhusybfq.js.map +1 -0
- package/dist-development/{transition-CNVJyoT2.js → transition-BSxdDR9D.js} +23 -4
- package/dist-development/transition-BSxdDR9D.js.map +1 -0
- package/package.json +2 -2
- package/dist/element-wieeFL9f.js.map +0 -1
- package/dist/payload-format-Dgap54q-.js.map +0 -1
- package/dist/resource-BfNHyXun.js.map +0 -1
- package/dist/transition-DBjQTorq.js.map +0 -1
- package/dist-development/element-Bb5fLsPy.js.map +0 -1
- package/dist-development/payload-format-Dgap54q-.js.map +0 -1
- package/dist-development/resource-Cp01PvqW.js.map +0 -1
- package/dist-development/transition-CNVJyoT2.js.map +0 -1
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
//#region src/data.d.ts
|
|
2
|
+
/** Describes data resource key input. */
|
|
2
3
|
type DataResourceKeyInput = string | number | boolean | null | readonly DataResourceKeyInput[] | {
|
|
3
4
|
readonly [key: string]: DataResourceKeyInput;
|
|
4
5
|
};
|
|
6
|
+
/** Describes data resource key. */
|
|
5
7
|
type DataResourceKey = readonly [string, ...DataResourceKeyInput[]];
|
|
8
|
+
/** Describes data resource load context. */
|
|
6
9
|
interface DataResourceLoadContext {
|
|
7
10
|
signal: AbortSignal;
|
|
8
11
|
}
|
|
12
|
+
/** Describes data resource loader. */
|
|
9
13
|
type DataResourceLoader<TArgs extends unknown[], TValue> = (...argsAndContext: [...TArgs, DataResourceLoadContext]) => TValue | PromiseLike<TValue>;
|
|
14
|
+
/** Describes data resource. */
|
|
10
15
|
interface DataResource<TArgs extends unknown[] = unknown[], TValue = unknown> {
|
|
11
16
|
readonly $$typeof: symbol;
|
|
12
17
|
readonly debugArgs?: (...args: TArgs) => DataResourceKeyInput;
|
|
13
18
|
readonly key: (...args: TArgs) => DataResourceKey;
|
|
14
19
|
readonly load?: DataResourceLoader<TArgs, TValue>;
|
|
15
20
|
}
|
|
21
|
+
/** Describes data refresh result. */
|
|
16
22
|
type DataRefreshResult<T> = {
|
|
17
23
|
status: "fulfilled";
|
|
18
24
|
value: T;
|
|
@@ -29,11 +35,14 @@ type DataRefreshResult<T> = {
|
|
|
29
35
|
reason: "no-client-loader";
|
|
30
36
|
staleValue?: T;
|
|
31
37
|
};
|
|
38
|
+
/** Describes Fig data hydration entry. */
|
|
32
39
|
interface FigDataHydrationEntry {
|
|
33
40
|
key: DataResourceKey;
|
|
34
41
|
value: unknown;
|
|
35
42
|
}
|
|
43
|
+
/** Describes Fig data entry status. */
|
|
36
44
|
type FigDataEntryStatus = "pending" | "fulfilled" | "rejected" | "refreshing";
|
|
45
|
+
/** Describes data store entry snapshot. */
|
|
37
46
|
interface DataStoreEntrySnapshot {
|
|
38
47
|
canonicalKey: string;
|
|
39
48
|
error?: unknown;
|
|
@@ -46,6 +55,7 @@ interface DataStoreEntrySnapshot {
|
|
|
46
55
|
subscriberCount: number;
|
|
47
56
|
value?: unknown;
|
|
48
57
|
}
|
|
58
|
+
/** Describes Fig data store handle. */
|
|
49
59
|
interface FigDataStoreHandle {
|
|
50
60
|
ensureData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): Promise<TValue>;
|
|
51
61
|
hydrate(entries: readonly FigDataHydrationEntry[]): void;
|
|
@@ -65,10 +75,12 @@ interface FigDataStoreController extends FigDataStoreHandle {
|
|
|
65
75
|
dispose(): void;
|
|
66
76
|
snapshot(): FigDataHydrationEntry[];
|
|
67
77
|
}
|
|
78
|
+
/** Describes Fig data store options. */
|
|
68
79
|
interface FigDataStoreOptions {
|
|
69
80
|
initialData?: readonly FigDataHydrationEntry[];
|
|
70
81
|
partition?: DataResourceKeyInput;
|
|
71
82
|
}
|
|
83
|
+
/** Describes Fig data store. */
|
|
72
84
|
interface FigDataStore extends FigDataStoreHandle {
|
|
73
85
|
commitDataDependencies(owner: object, previousOwner: object | null): void;
|
|
74
86
|
deleteDataOwner(owner: object): void;
|
|
@@ -80,35 +92,52 @@ interface FigDataStore extends FigDataStoreHandle {
|
|
|
80
92
|
snapshot(): FigDataHydrationEntry[];
|
|
81
93
|
readData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, args: TArgs, owner: object): TValue;
|
|
82
94
|
}
|
|
95
|
+
/** Describes Fig data store host. */
|
|
83
96
|
interface FigDataStoreHost {
|
|
84
97
|
getLane(): unknown;
|
|
85
98
|
partition?: DataResourceKeyInput;
|
|
86
99
|
schedule(owner: object, lane: unknown): void;
|
|
87
100
|
}
|
|
101
|
+
/** Describes Fig data store factory. */
|
|
88
102
|
type FigDataStoreFactory = (host: FigDataStoreHost) => FigDataStore;
|
|
103
|
+
/** Describes load context hydrate. */
|
|
89
104
|
type LoadContextHydrate = (entries: readonly FigDataHydrationEntry[]) => void;
|
|
105
|
+
/** Describes load context attribute error. */
|
|
90
106
|
type LoadContextAttributeError = (error: unknown) => void;
|
|
107
|
+
/** Describes load context capabilities. */
|
|
91
108
|
interface LoadContextCapabilities {
|
|
92
109
|
attributeError: LoadContextAttributeError;
|
|
93
110
|
hydrate: LoadContextHydrate;
|
|
94
111
|
key?: DataResourceKey;
|
|
95
112
|
}
|
|
113
|
+
/** Define load context capabilities. */
|
|
96
114
|
declare function defineLoadContextCapabilities(context: DataResourceLoadContext, capabilities: LoadContextCapabilities): void;
|
|
115
|
+
/** Load context capabilities. */
|
|
97
116
|
declare function loadContextCapabilities(context: DataResourceLoadContext): LoadContextCapabilities | undefined;
|
|
117
|
+
/** Resolves current data store. */
|
|
98
118
|
declare function resolveCurrentDataStore(message?: string): FigDataStore;
|
|
119
|
+
/** Sets current data store. */
|
|
99
120
|
declare function setCurrentDataStore(store: FigDataStore | null): FigDataStore | null;
|
|
121
|
+
/** Marks data resource error. */
|
|
100
122
|
declare function markDataResourceError(error: unknown, key: DataResourceKey): void;
|
|
123
|
+
/** Data resource keys for error. */
|
|
101
124
|
declare function dataResourceKeysForError(error: unknown): DataResourceKey[] | undefined;
|
|
102
125
|
//#endregion
|
|
103
126
|
//#region src/resource.d.ts
|
|
127
|
+
/** Describes asset resource blocking. */
|
|
104
128
|
type AssetResourceBlocking = "reveal" | "none";
|
|
129
|
+
/** Describes cross origin. */
|
|
105
130
|
type CrossOrigin = "anonymous" | "use-credentials" | "";
|
|
131
|
+
/** Describes fetch priority. */
|
|
106
132
|
type FetchPriority = "high" | "low" | "auto";
|
|
133
|
+
/** Describes asset resource destination. */
|
|
107
134
|
type AssetResourceDestination = "head" | "stream";
|
|
135
|
+
/** Describes Fig asset resource. */
|
|
108
136
|
type FigAssetResource = StylesheetResource | PreloadResource | ModulePreloadResource | ScriptResource | FontResource | PreconnectResource | TitleResource | MetaResource;
|
|
109
137
|
interface ResourceBase {
|
|
110
138
|
key?: string;
|
|
111
139
|
}
|
|
140
|
+
/** Describes stylesheet resource. */
|
|
112
141
|
interface StylesheetResource extends ResourceBase {
|
|
113
142
|
blocking?: AssetResourceBlocking;
|
|
114
143
|
crossorigin?: CrossOrigin;
|
|
@@ -117,6 +146,7 @@ interface StylesheetResource extends ResourceBase {
|
|
|
117
146
|
media?: string;
|
|
118
147
|
precedence?: string;
|
|
119
148
|
}
|
|
149
|
+
/** Describes preload resource. */
|
|
120
150
|
interface PreloadResource extends ResourceBase {
|
|
121
151
|
as: string;
|
|
122
152
|
crossorigin?: CrossOrigin;
|
|
@@ -128,12 +158,14 @@ interface PreloadResource extends ResourceBase {
|
|
|
128
158
|
referrerpolicy?: string;
|
|
129
159
|
type?: string;
|
|
130
160
|
}
|
|
161
|
+
/** Describes module preload resource. */
|
|
131
162
|
interface ModulePreloadResource extends ResourceBase {
|
|
132
163
|
crossorigin?: CrossOrigin;
|
|
133
164
|
fetchpriority?: FetchPriority;
|
|
134
165
|
href: string;
|
|
135
166
|
kind: "modulepreload";
|
|
136
167
|
}
|
|
168
|
+
/** Describes script resource. */
|
|
137
169
|
interface ScriptResource extends ResourceBase {
|
|
138
170
|
async?: boolean;
|
|
139
171
|
crossorigin?: CrossOrigin;
|
|
@@ -142,6 +174,7 @@ interface ScriptResource extends ResourceBase {
|
|
|
142
174
|
module?: boolean;
|
|
143
175
|
src: string;
|
|
144
176
|
}
|
|
177
|
+
/** Describes font resource. */
|
|
145
178
|
interface FontResource extends ResourceBase {
|
|
146
179
|
crossorigin?: CrossOrigin;
|
|
147
180
|
fetchpriority?: FetchPriority;
|
|
@@ -149,11 +182,13 @@ interface FontResource extends ResourceBase {
|
|
|
149
182
|
kind: "font";
|
|
150
183
|
type: string;
|
|
151
184
|
}
|
|
185
|
+
/** Describes preconnect resource. */
|
|
152
186
|
interface PreconnectResource extends ResourceBase {
|
|
153
187
|
crossorigin?: CrossOrigin;
|
|
154
188
|
href: string;
|
|
155
189
|
kind: "preconnect";
|
|
156
190
|
}
|
|
191
|
+
/** Describes title resource. */
|
|
157
192
|
interface TitleResource extends ResourceBase {
|
|
158
193
|
kind: "title";
|
|
159
194
|
value: string;
|
|
@@ -162,6 +197,7 @@ interface MetaResourceBase extends ResourceBase {
|
|
|
162
197
|
kind: "meta";
|
|
163
198
|
}
|
|
164
199
|
type DistributiveOmit<Value, Key extends PropertyKey> = Value extends unknown ? Omit<Value, Key> : never;
|
|
200
|
+
/** Describes meta resource. */
|
|
165
201
|
type MetaResource = (MetaResourceBase & {
|
|
166
202
|
charset: string;
|
|
167
203
|
content?: never;
|
|
@@ -187,43 +223,74 @@ type MetaResource = (MetaResourceBase & {
|
|
|
187
223
|
name?: never;
|
|
188
224
|
property?: never;
|
|
189
225
|
});
|
|
226
|
+
/** Describes meta resource options. */
|
|
190
227
|
type MetaResourceOptions = DistributiveOmit<MetaResource, "kind">;
|
|
228
|
+
/** Describes Fig asset resource list. */
|
|
191
229
|
type FigAssetResourceList = FigAssetResource | readonly FigAssetResource[];
|
|
230
|
+
/** Describes client reference assets. */
|
|
192
231
|
type ClientReferenceAssets = FigAssetResourceList | (() => FigAssetResourceList);
|
|
232
|
+
/** Describes assets props. */
|
|
193
233
|
interface AssetsProps {
|
|
194
234
|
assets: FigAssetResourceList;
|
|
195
235
|
children?: FigNode;
|
|
196
236
|
}
|
|
237
|
+
/** Assets. */
|
|
197
238
|
declare function assets(value: FigAssetResourceList, children?: FigNode): FigElement<AssetsProps>;
|
|
239
|
+
/** Stylesheet. */
|
|
198
240
|
declare function stylesheet(href: string, options?: Omit<StylesheetResource, "href" | "kind">): StylesheetResource;
|
|
241
|
+
/** Preload. */
|
|
199
242
|
declare function preload(href: string, as: string, options?: Omit<PreloadResource, "as" | "href" | "kind">): PreloadResource;
|
|
243
|
+
/** Modulepreload. */
|
|
200
244
|
declare function modulepreload(href: string, options?: Omit<ModulePreloadResource, "href" | "kind">): ModulePreloadResource;
|
|
245
|
+
/** Script. */
|
|
201
246
|
declare function script(src: string, options?: Omit<ScriptResource, "kind" | "src">): ScriptResource;
|
|
247
|
+
/** Font. */
|
|
202
248
|
declare function font(href: string, type: string, options?: Omit<FontResource, "href" | "kind" | "type">): FontResource;
|
|
249
|
+
/** Preconnect. */
|
|
203
250
|
declare function preconnect(href: string, options?: Omit<PreconnectResource, "href" | "kind">): PreconnectResource;
|
|
251
|
+
/** Title. */
|
|
204
252
|
declare function title(value: string): TitleResource;
|
|
253
|
+
/** Meta. */
|
|
205
254
|
declare function meta(options: MetaResourceOptions): MetaResource;
|
|
255
|
+
/** Checks whether Fig asset resource. */
|
|
206
256
|
declare function isFigAssetResource(value: unknown): value is FigAssetResource;
|
|
257
|
+
/** Client reference assets. */
|
|
207
258
|
declare function clientReferenceAssets(reference: FigClientReference): readonly FigAssetResource[];
|
|
259
|
+
/** Asset resource key. */
|
|
208
260
|
declare function assetResourceKey(resource: FigAssetResource): string;
|
|
261
|
+
/** Asset resource destination. */
|
|
209
262
|
declare function assetResourceDestination(resource: FigAssetResource): AssetResourceDestination;
|
|
263
|
+
/** Asset resource from host props. */
|
|
210
264
|
declare function assetResourceFromHostProps(type: string, props: Props): FigAssetResource | null;
|
|
265
|
+
/** Prevent asset resource hoist. */
|
|
211
266
|
declare function preventAssetResourceHoist<P extends Props>(props: P): P;
|
|
267
|
+
/** Asset resource from host attributes. */
|
|
212
268
|
declare function assetResourceFromHostAttributes(type: string, getAttribute: (name: string) => unknown): FigAssetResource | null;
|
|
269
|
+
/** Describes asset resource host props. */
|
|
213
270
|
type AssetResourceHostProps = Record<string, string | true>;
|
|
271
|
+
/** Asset resource host props. */
|
|
214
272
|
declare function assetResourceHostProps(resource: FigAssetResource, props?: AssetResourceHostProps): AssetResourceHostProps;
|
|
273
|
+
/** Asset resource from host values. */
|
|
215
274
|
declare function assetResourceFromHostValues(type: string, prop: (name: string) => unknown, children?: FigNode, requireAsyncScript?: boolean): FigAssetResource | null;
|
|
216
275
|
//#endregion
|
|
217
276
|
//#region src/element.d.ts
|
|
277
|
+
/** Describes key. */
|
|
218
278
|
type Key = string | number;
|
|
279
|
+
/** Describes props. */
|
|
219
280
|
type Props = Record<string, any>;
|
|
281
|
+
/** Describes component type. */
|
|
220
282
|
type ComponentType<P = Props> = (props: P & {
|
|
221
283
|
children?: FigNode;
|
|
222
284
|
}) => FigNode;
|
|
285
|
+
/** Describes component props. */
|
|
223
286
|
type ComponentProps<T extends ComponentType<any>> = Parameters<T> extends [infer P, ...unknown[]] ? P extends Props ? P : Props : {};
|
|
287
|
+
/** Describes element type. */
|
|
224
288
|
type ElementType<P = Props> = string | typeof Fragment | FigAssets | FigClientReference<P> | FigErrorBoundary | FigSuspense | FigActivity | FigViewTransition | ComponentType<P>;
|
|
289
|
+
/** Describes awaited Fig node. */
|
|
225
290
|
type AwaitedFigNode = FigElement<any> | FigPortal<any> | string | number | boolean | null | undefined | FigNode[];
|
|
291
|
+
/** Describes Fig node. */
|
|
226
292
|
type FigNode = AwaitedFigNode | PromiseLike<AwaitedFigNode>;
|
|
293
|
+
/** Describes Fig element. */
|
|
227
294
|
interface FigElement<P = Props> {
|
|
228
295
|
readonly $$typeof: symbol;
|
|
229
296
|
readonly type: ElementType<any>;
|
|
@@ -232,17 +299,20 @@ interface FigElement<P = Props> {
|
|
|
232
299
|
children?: FigNode;
|
|
233
300
|
};
|
|
234
301
|
}
|
|
302
|
+
/** Describes Fig portal. */
|
|
235
303
|
interface FigPortal<Target = unknown> {
|
|
236
304
|
readonly $$typeof: symbol;
|
|
237
305
|
readonly children: FigNode;
|
|
238
306
|
readonly key: Key | null;
|
|
239
307
|
readonly target: Target;
|
|
240
308
|
}
|
|
309
|
+
/** Describes client reference options. */
|
|
241
310
|
interface ClientReferenceOptions<P extends Props = Props> {
|
|
242
311
|
assets?: ClientReferenceAssets;
|
|
243
312
|
id: string;
|
|
244
313
|
ssr?: ComponentType<P>;
|
|
245
314
|
}
|
|
315
|
+
/** Describes Fig client reference. */
|
|
246
316
|
interface FigClientReference<P = Props> {
|
|
247
317
|
(props: P & {
|
|
248
318
|
children?: FigNode;
|
|
@@ -252,35 +322,47 @@ interface FigClientReference<P = Props> {
|
|
|
252
322
|
readonly id: string;
|
|
253
323
|
readonly ssr?: ComponentType<P>;
|
|
254
324
|
}
|
|
325
|
+
/** Describes lazy loader. */
|
|
255
326
|
type LazyLoader<T extends ComponentType<any> = ComponentType<any>> = () => PromiseLike<T>;
|
|
327
|
+
/** Describes suspense props. */
|
|
256
328
|
interface SuspenseProps {
|
|
257
329
|
fallback?: FigNode;
|
|
258
330
|
children?: FigNode;
|
|
259
331
|
}
|
|
332
|
+
/** Describes Fig suspense. */
|
|
260
333
|
interface FigSuspense {
|
|
261
334
|
(props: SuspenseProps): FigNode;
|
|
262
335
|
readonly $$typeof: symbol;
|
|
263
336
|
}
|
|
337
|
+
/** Describes activity mode. */
|
|
264
338
|
type ActivityMode = "visible" | "hidden";
|
|
339
|
+
/** Describes activity props. */
|
|
265
340
|
interface ActivityProps {
|
|
266
341
|
mode: ActivityMode;
|
|
267
342
|
children?: FigNode;
|
|
268
343
|
}
|
|
344
|
+
/** Describes Fig activity. */
|
|
269
345
|
interface FigActivity {
|
|
270
346
|
(props: ActivityProps): FigNode;
|
|
271
347
|
readonly $$typeof: symbol;
|
|
272
348
|
}
|
|
349
|
+
/** Describes view transition class. */
|
|
273
350
|
type ViewTransitionClass = "auto" | "none" | (string & {});
|
|
351
|
+
/** Describes view transition phase. */
|
|
274
352
|
type ViewTransitionPhase = "enter" | "exit" | "share" | "update";
|
|
353
|
+
/** Describes view transition surface. */
|
|
275
354
|
interface ViewTransitionSurface {
|
|
276
355
|
readonly name: string;
|
|
277
356
|
}
|
|
357
|
+
/** Describes view transition event. */
|
|
278
358
|
interface ViewTransitionEvent {
|
|
279
359
|
readonly phase: ViewTransitionPhase;
|
|
280
360
|
readonly surfaces: readonly ViewTransitionSurface[];
|
|
281
361
|
readonly types: readonly string[];
|
|
282
362
|
}
|
|
363
|
+
/** Describes view transition callback. */
|
|
283
364
|
type ViewTransitionCallback = (event: ViewTransitionEvent, signal: AbortSignal) => undefined;
|
|
365
|
+
/** Describes view transition props. */
|
|
284
366
|
interface ViewTransitionProps {
|
|
285
367
|
name?: string;
|
|
286
368
|
children?: FigNode;
|
|
@@ -291,56 +373,87 @@ interface ViewTransitionProps {
|
|
|
291
373
|
update?: ViewTransitionClass;
|
|
292
374
|
onTransition?: ViewTransitionCallback;
|
|
293
375
|
}
|
|
376
|
+
/** Describes Fig view transition. */
|
|
294
377
|
interface FigViewTransition {
|
|
295
378
|
(props: ViewTransitionProps): FigNode;
|
|
296
379
|
readonly $$typeof: symbol;
|
|
297
380
|
}
|
|
381
|
+
/** Describes error boundary props. */
|
|
298
382
|
interface ErrorBoundaryProps {
|
|
299
383
|
fallback?: FigNode | ((error: unknown, info: ErrorInfo) => FigNode);
|
|
300
384
|
onError?: (error: unknown, info: ErrorInfo) => void;
|
|
301
385
|
children?: FigNode;
|
|
302
386
|
}
|
|
387
|
+
/** Describes error info. */
|
|
303
388
|
interface ErrorInfo {
|
|
304
389
|
componentStack: string;
|
|
305
390
|
dataResourceKeys?: DataResourceKey[];
|
|
306
391
|
}
|
|
392
|
+
/** Describes Fig error boundary. */
|
|
307
393
|
interface FigErrorBoundary {
|
|
308
394
|
(props: ErrorBoundaryProps): FigNode;
|
|
309
395
|
readonly $$typeof: symbol;
|
|
310
396
|
}
|
|
397
|
+
/** Describes Fig assets. */
|
|
311
398
|
interface FigAssets {
|
|
312
399
|
(props: Props & {
|
|
313
400
|
children?: FigNode;
|
|
314
401
|
}): FigNode;
|
|
315
402
|
readonly $$typeof: symbol;
|
|
316
403
|
}
|
|
404
|
+
/** The fragment. */
|
|
317
405
|
declare const Fragment: unique symbol;
|
|
406
|
+
/** The Fig element symbol. */
|
|
318
407
|
declare const FigElementSymbol: unique symbol;
|
|
408
|
+
/** The Fig client reference symbol. */
|
|
319
409
|
declare const FigClientReferenceSymbol: unique symbol;
|
|
410
|
+
/** The Fig activity symbol. */
|
|
320
411
|
declare const FigActivitySymbol: unique symbol;
|
|
412
|
+
/** The Fig error boundary symbol. */
|
|
321
413
|
declare const FigErrorBoundarySymbol: unique symbol;
|
|
414
|
+
/** The Fig portal symbol. */
|
|
322
415
|
declare const FigPortalSymbol: unique symbol;
|
|
416
|
+
/** The Fig assets symbol. */
|
|
323
417
|
declare const FigAssetsSymbol: unique symbol;
|
|
418
|
+
/** The Fig suspense symbol. */
|
|
324
419
|
declare const FigSuspenseSymbol: unique symbol;
|
|
420
|
+
/** The Fig view transition symbol. */
|
|
325
421
|
declare const FigViewTransitionSymbol: unique symbol;
|
|
422
|
+
/** The assets. */
|
|
326
423
|
declare const Assets: FigAssets;
|
|
424
|
+
/** The error boundary. */
|
|
327
425
|
declare const ErrorBoundary: FigErrorBoundary;
|
|
426
|
+
/** The suspense. */
|
|
328
427
|
declare const Suspense: FigSuspense;
|
|
428
|
+
/** The activity. */
|
|
329
429
|
declare const Activity: FigActivity;
|
|
430
|
+
/** The view transition. */
|
|
330
431
|
declare const ViewTransition: FigViewTransition;
|
|
432
|
+
/** Creates element. */
|
|
331
433
|
declare function createElement<P extends Props>(type: ElementType<P>, config?: (P & {
|
|
332
434
|
key?: Key | null;
|
|
333
435
|
}) | null, ...children: FigNode[]): FigElement<P>;
|
|
436
|
+
/** Checks whether valid element. */
|
|
334
437
|
declare function isValidElement(value: unknown): value is FigElement;
|
|
438
|
+
/** Creates portal node. */
|
|
335
439
|
declare function createPortalNode<Target>(children: FigNode, target: Target, key?: Key | null): FigPortal<Target>;
|
|
440
|
+
/** Checks whether portal. */
|
|
336
441
|
declare function isPortal(value: unknown): value is FigPortal;
|
|
442
|
+
/** Client reference. */
|
|
337
443
|
declare function clientReference<P extends Props = Props>(options: ClientReferenceOptions<P>): FigClientReference<P>;
|
|
444
|
+
/** Lazy. */
|
|
338
445
|
declare function lazy<T extends ComponentType<any>>(load: LazyLoader<T>): ComponentType<ComponentProps<T>>;
|
|
446
|
+
/** Checks whether client reference. */
|
|
339
447
|
declare function isClientReference(value: unknown): value is FigClientReference;
|
|
448
|
+
/** Checks whether suspense. */
|
|
340
449
|
declare function isSuspense(value: unknown): value is FigSuspense;
|
|
450
|
+
/** Checks whether activity. */
|
|
341
451
|
declare function isActivity(value: unknown): value is FigActivity;
|
|
452
|
+
/** Checks whether error boundary. */
|
|
342
453
|
declare function isErrorBoundary(value: unknown): value is FigErrorBoundary;
|
|
454
|
+
/** Checks whether view transition. */
|
|
343
455
|
declare function isViewTransition(value: unknown): value is FigViewTransition;
|
|
456
|
+
/** Checks whether assets. */
|
|
344
457
|
declare function isAssets(value: unknown): value is FigAssets;
|
|
345
458
|
//#endregion
|
|
346
459
|
export { isViewTransition as $, LoadContextCapabilities as $t, Fragment as A, modulepreload as At, ViewTransitionPhase as B, DataResourceKeyInput as Bt, FigNode as C, assetResourceHostProps as Ct, FigSuspenseSymbol as D, font as Dt, FigSuspense as E, clientReferenceAssets as Et, SuspenseProps as F, stylesheet as Ft, createPortalNode as G, FigDataHydrationEntry as Gt, ViewTransitionSurface as H, DataResourceLoader as Ht, ViewTransition as I, title as It, isClientReference as J, FigDataStoreFactory as Jt, isActivity as K, FigDataStore as Kt, ViewTransitionCallback as L, DataRefreshResult as Lt, LazyLoader as M, preload as Mt, Props as N, preventAssetResourceHoist as Nt, FigViewTransition as O, isFigAssetResource as Ot, Suspense as P, script as Pt, isValidElement as Q, LoadContextAttributeError as Qt, ViewTransitionClass as R, DataResource as Rt, FigErrorBoundarySymbol as S, assetResourceFromHostValues as St, FigPortalSymbol as T, assets as Tt, clientReference as U, DataStoreEntrySnapshot as Ut, ViewTransitionProps as V, DataResourceLoadContext as Vt, createElement as W, FigDataEntryStatus as Wt, isPortal as X, FigDataStoreHost as Xt, isErrorBoundary as Y, FigDataStoreHandle as Yt, isSuspense as Z, FigDataStoreOptions as Zt, FigClientReference as _, StylesheetResource as _t, AwaitedFigNode as a, resolveCurrentDataStore as an, ClientReferenceAssets as at, FigElementSymbol as b, assetResourceFromHostAttributes as bt, ComponentType as c, FigAssetResource as ct, ErrorBoundaryProps as d, MetaResource as dt, LoadContextHydrate as en, lazy as et, ErrorInfo as f, MetaResourceOptions as ft, FigAssetsSymbol as g, ScriptResource as gt, FigAssets as h, PreloadResource as ht, Assets as i, markDataResourceError as in, AssetsProps as it, Key as j, preconnect as jt, FigViewTransitionSymbol as k, meta as kt, ElementType as l, FigAssetResourceList as lt, FigActivitySymbol as m, PreconnectResource as mt, ActivityMode as n, defineLoadContextCapabilities as nn, AssetResourceDestination as nt, ClientReferenceOptions as o, setCurrentDataStore as on, CrossOrigin as ot, FigActivity as p, ModulePreloadResource as pt, isAssets as q, FigDataStoreController as qt, ActivityProps as r, loadContextCapabilities as rn, AssetResourceHostProps as rt, ComponentProps as s, FetchPriority as st, Activity as t, dataResourceKeysForError as tn, AssetResourceBlocking as tt, ErrorBoundary as u, FontResource as ut, FigClientReferenceSymbol as v, TitleResource as vt, FigPortal as w, assetResourceKey as wt, FigErrorBoundary as x, assetResourceFromHostProps as xt, FigElement as y, assetResourceDestination as yt, ViewTransitionEvent as z, DataResourceKey as zt };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/data.ts
|
|
2
2
|
const LoadContextCapabilitiesSymbol = Symbol.for("fig.data-load-context");
|
|
3
|
+
/** Define load context capabilities. */
|
|
3
4
|
function defineLoadContextCapabilities(context, capabilities) {
|
|
4
5
|
Object.defineProperty(context, LoadContextCapabilitiesSymbol, {
|
|
5
6
|
configurable: true,
|
|
@@ -7,20 +8,24 @@ function defineLoadContextCapabilities(context, capabilities) {
|
|
|
7
8
|
value: capabilities
|
|
8
9
|
});
|
|
9
10
|
}
|
|
11
|
+
/** Load context capabilities. */
|
|
10
12
|
function loadContextCapabilities(context) {
|
|
11
13
|
return context[LoadContextCapabilitiesSymbol];
|
|
12
14
|
}
|
|
13
15
|
const objectDataErrors = /* @__PURE__ */ new WeakMap();
|
|
14
16
|
let currentDataStore = null;
|
|
17
|
+
/** Resolves current data store. */
|
|
15
18
|
function resolveCurrentDataStore(message = "Data resource APIs require a Fig data store.") {
|
|
16
19
|
if (currentDataStore === null) throw new Error(message);
|
|
17
20
|
return currentDataStore;
|
|
18
21
|
}
|
|
22
|
+
/** Sets current data store. */
|
|
19
23
|
function setCurrentDataStore(store) {
|
|
20
24
|
const previousStore = currentDataStore;
|
|
21
25
|
currentDataStore = store;
|
|
22
26
|
return previousStore;
|
|
23
27
|
}
|
|
28
|
+
/** Marks data resource error. */
|
|
24
29
|
function markDataResourceError(error, key) {
|
|
25
30
|
if (!isAttributableError(error)) return;
|
|
26
31
|
let keys = objectDataErrors.get(error);
|
|
@@ -31,6 +36,7 @@ function markDataResourceError(error, key) {
|
|
|
31
36
|
if (keys.some((existing) => sameDataResourceKey(existing, key))) return;
|
|
32
37
|
keys.push(key);
|
|
33
38
|
}
|
|
39
|
+
/** Data resource keys for error. */
|
|
34
40
|
function dataResourceKeysForError(error) {
|
|
35
41
|
if (!isAttributableError(error)) return void 0;
|
|
36
42
|
const keys = objectDataErrors.get(error);
|
|
@@ -45,6 +51,7 @@ function isAttributableError(value) {
|
|
|
45
51
|
//#endregion
|
|
46
52
|
//#region src/hooks.ts
|
|
47
53
|
let currentDispatcher = null;
|
|
54
|
+
/** Returns state. */
|
|
48
55
|
function useState(initialState) {
|
|
49
56
|
return resolveDispatcher().useState(initialState);
|
|
50
57
|
}
|
|
@@ -63,45 +70,59 @@ function useState(initialState) {
|
|
|
63
70
|
function useActionState(action, initialState) {
|
|
64
71
|
return resolveDispatcher().useActionState(action, initialState);
|
|
65
72
|
}
|
|
73
|
+
/** Returns ID. */
|
|
66
74
|
function useId() {
|
|
67
75
|
return resolveDispatcher().useId();
|
|
68
76
|
}
|
|
77
|
+
/** Returns deferred value. */
|
|
69
78
|
function useDeferredValue(value, initialValue) {
|
|
70
79
|
return resolveDispatcher().useDeferredValue(value, initialValue, arguments.length > 1);
|
|
71
80
|
}
|
|
81
|
+
/** Returns memo. */
|
|
72
82
|
function useMemo(calculate, deps) {
|
|
73
83
|
return resolveDispatcher().useMemo(calculate, deps);
|
|
74
84
|
}
|
|
85
|
+
/** Returns transition. */
|
|
75
86
|
function useTransition() {
|
|
76
87
|
return resolveDispatcher().useTransition();
|
|
77
88
|
}
|
|
89
|
+
/** Returns callback. */
|
|
78
90
|
function useCallback(callback, deps) {
|
|
79
91
|
return resolveDispatcher().useMemo(() => callback, deps);
|
|
80
92
|
}
|
|
93
|
+
/** Returns reactive. */
|
|
81
94
|
function useReactive(effect, deps) {
|
|
82
95
|
resolveDispatcher().useReactive(effect, deps);
|
|
83
96
|
}
|
|
97
|
+
/** Returns before paint. */
|
|
84
98
|
function useBeforePaint(effect, deps) {
|
|
85
99
|
resolveDispatcher().useBeforePaint(effect, deps);
|
|
86
100
|
}
|
|
101
|
+
/** Returns before layout. */
|
|
87
102
|
function useBeforeLayout(effect, deps) {
|
|
88
103
|
resolveDispatcher().useBeforeLayout(effect, deps);
|
|
89
104
|
}
|
|
105
|
+
/** Returns sync external store. */
|
|
90
106
|
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
91
107
|
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
92
108
|
}
|
|
109
|
+
/** Returns stable event. */
|
|
93
110
|
function useStableEvent(handler) {
|
|
94
111
|
return resolveDispatcher().useStableEvent(handler);
|
|
95
112
|
}
|
|
113
|
+
/** Reads context. */
|
|
96
114
|
function readContext(context) {
|
|
97
115
|
return resolveDispatcher("readContext can only be called while rendering a component.").readContext(context);
|
|
98
116
|
}
|
|
117
|
+
/** Reads promise. */
|
|
99
118
|
function readPromise(promise) {
|
|
100
119
|
return resolveDispatcher("readPromise can only be called while rendering a component.").readPromise(promise);
|
|
101
120
|
}
|
|
121
|
+
/** Reads data. */
|
|
102
122
|
function readData(resource, ...args) {
|
|
103
123
|
return resolveDispatcher("readData can only be called while rendering a component.").readData(resource, args);
|
|
104
124
|
}
|
|
125
|
+
/** Preloads data. */
|
|
105
126
|
function preloadData(resource, ...args) {
|
|
106
127
|
if (currentDispatcher !== null) {
|
|
107
128
|
currentDispatcher.preloadData(resource, args);
|
|
@@ -109,6 +130,7 @@ function preloadData(resource, ...args) {
|
|
|
109
130
|
}
|
|
110
131
|
resolveDataStore().preloadData(resource, ...args);
|
|
111
132
|
}
|
|
133
|
+
/** Sets current dispatcher. */
|
|
112
134
|
function setCurrentDispatcher(dispatcher) {
|
|
113
135
|
const previousDispatcher = currentDispatcher;
|
|
114
136
|
currentDispatcher = dispatcher;
|
|
@@ -123,6 +145,7 @@ function resolveDataStore() {
|
|
|
123
145
|
}
|
|
124
146
|
//#endregion
|
|
125
147
|
//#region src/mixin.ts
|
|
148
|
+
/** The Fig mixin symbol. */
|
|
126
149
|
const FigMixinSymbol = Symbol.for("fig.mixin");
|
|
127
150
|
const FigMixinSlotSymbol = Symbol.for("fig.mixin-slot");
|
|
128
151
|
const FigClientOnlyHostBehaviorSymbol = Symbol.for("fig.client-only-host-behavior");
|
|
@@ -136,6 +159,7 @@ function createMixin(type) {
|
|
|
136
159
|
});
|
|
137
160
|
}
|
|
138
161
|
const maximumResolvedMixins = 1024;
|
|
162
|
+
/** Resolves host mix. */
|
|
139
163
|
function resolveHostMix(type, input) {
|
|
140
164
|
const props = input;
|
|
141
165
|
const mix = props.mix;
|
|
@@ -172,12 +196,15 @@ function resolveHostMix(type, input) {
|
|
|
172
196
|
props.mix = mix;
|
|
173
197
|
return props;
|
|
174
198
|
}
|
|
199
|
+
/** Mixin slot. */
|
|
175
200
|
function mixinSlot(context) {
|
|
176
201
|
return context[FigMixinSlotSymbol];
|
|
177
202
|
}
|
|
203
|
+
/** Marks client only host behavior. */
|
|
178
204
|
function markClientOnlyHostBehavior(context, behavior) {
|
|
179
205
|
markClientOnlyHostProps(context.props, behavior);
|
|
180
206
|
}
|
|
207
|
+
/** Marks client only host props. */
|
|
181
208
|
function markClientOnlyHostProps(value, behavior) {
|
|
182
209
|
const props = value;
|
|
183
210
|
if (props[FigClientOnlyHostBehaviorSymbol] !== void 0) return;
|
|
@@ -186,6 +213,7 @@ function markClientOnlyHostProps(value, behavior) {
|
|
|
186
213
|
value: behavior
|
|
187
214
|
});
|
|
188
215
|
}
|
|
216
|
+
/** Client only host behavior. */
|
|
189
217
|
function clientOnlyHostBehavior(props) {
|
|
190
218
|
const behavior = props[FigClientOnlyHostBehaviorSymbol];
|
|
191
219
|
return typeof behavior === "string" ? behavior : void 0;
|
|
@@ -198,20 +226,35 @@ function isMixinDescriptor(value) {
|
|
|
198
226
|
}
|
|
199
227
|
//#endregion
|
|
200
228
|
//#region src/element.ts
|
|
229
|
+
/** The fragment. */
|
|
201
230
|
const Fragment = Symbol.for("fig.fragment");
|
|
231
|
+
/** The Fig element symbol. */
|
|
202
232
|
const FigElementSymbol = Symbol.for("fig.element");
|
|
233
|
+
/** The Fig client reference symbol. */
|
|
203
234
|
const FigClientReferenceSymbol = Symbol.for("fig.client-reference");
|
|
235
|
+
/** The Fig activity symbol. */
|
|
204
236
|
const FigActivitySymbol = Symbol.for("fig.activity");
|
|
237
|
+
/** The Fig error boundary symbol. */
|
|
205
238
|
const FigErrorBoundarySymbol = Symbol.for("fig.error-boundary");
|
|
239
|
+
/** The Fig portal symbol. */
|
|
206
240
|
const FigPortalSymbol = Symbol.for("fig.portal");
|
|
241
|
+
/** The Fig assets symbol. */
|
|
207
242
|
const FigAssetsSymbol = Symbol.for("fig.assets");
|
|
243
|
+
/** The Fig suspense symbol. */
|
|
208
244
|
const FigSuspenseSymbol = Symbol.for("fig.suspense");
|
|
245
|
+
/** The Fig view transition symbol. */
|
|
209
246
|
const FigViewTransitionSymbol = Symbol.for("fig.view-transition");
|
|
247
|
+
/** The assets. */
|
|
210
248
|
const Assets = Object.assign((props) => props.children, { $$typeof: FigAssetsSymbol });
|
|
249
|
+
/** The error boundary. */
|
|
211
250
|
const ErrorBoundary = Object.assign((props) => props.children, { $$typeof: FigErrorBoundarySymbol });
|
|
251
|
+
/** The suspense. */
|
|
212
252
|
const Suspense = Object.assign((props) => props.children, { $$typeof: FigSuspenseSymbol });
|
|
253
|
+
/** The activity. */
|
|
213
254
|
const Activity = Object.assign((props) => props.children, { $$typeof: FigActivitySymbol });
|
|
255
|
+
/** The view transition. */
|
|
214
256
|
const ViewTransition = Object.assign((props) => props.children, { $$typeof: FigViewTransitionSymbol });
|
|
257
|
+
/** Creates element. */
|
|
215
258
|
function createElement(type, config, ...children) {
|
|
216
259
|
const props = { ...config };
|
|
217
260
|
const key = props.key ?? null;
|
|
@@ -225,9 +268,11 @@ function createElement(type, config, ...children) {
|
|
|
225
268
|
props: "mix" in props && typeof type === "string" ? resolveHostMix(type, props) : props
|
|
226
269
|
};
|
|
227
270
|
}
|
|
271
|
+
/** Checks whether valid element. */
|
|
228
272
|
function isValidElement(value) {
|
|
229
273
|
return hasObjectBrand(value, FigElementSymbol);
|
|
230
274
|
}
|
|
275
|
+
/** Creates portal node. */
|
|
231
276
|
function createPortalNode(children, target, key = null) {
|
|
232
277
|
return {
|
|
233
278
|
$$typeof: FigPortalSymbol,
|
|
@@ -236,9 +281,11 @@ function createPortalNode(children, target, key = null) {
|
|
|
236
281
|
target
|
|
237
282
|
};
|
|
238
283
|
}
|
|
284
|
+
/** Checks whether portal. */
|
|
239
285
|
function isPortal(value) {
|
|
240
286
|
return hasObjectBrand(value, FigPortalSymbol);
|
|
241
287
|
}
|
|
288
|
+
/** Client reference. */
|
|
242
289
|
function clientReference(options) {
|
|
243
290
|
return Object.assign(() => {
|
|
244
291
|
throw new Error(`Client reference "${options.id}" cannot be rendered on the server directly.`);
|
|
@@ -249,6 +296,7 @@ function clientReference(options) {
|
|
|
249
296
|
ssr: options.ssr
|
|
250
297
|
});
|
|
251
298
|
}
|
|
299
|
+
/** Lazy. */
|
|
252
300
|
function lazy(load) {
|
|
253
301
|
let promise = null;
|
|
254
302
|
let rejected = false;
|
|
@@ -273,21 +321,27 @@ function lazy(load) {
|
|
|
273
321
|
};
|
|
274
322
|
return Lazy;
|
|
275
323
|
}
|
|
324
|
+
/** Checks whether client reference. */
|
|
276
325
|
function isClientReference(value) {
|
|
277
326
|
return hasFunctionBrand(value, FigClientReferenceSymbol);
|
|
278
327
|
}
|
|
328
|
+
/** Checks whether suspense. */
|
|
279
329
|
function isSuspense(value) {
|
|
280
330
|
return hasFunctionBrand(value, FigSuspenseSymbol);
|
|
281
331
|
}
|
|
332
|
+
/** Checks whether activity. */
|
|
282
333
|
function isActivity(value) {
|
|
283
334
|
return hasFunctionBrand(value, FigActivitySymbol);
|
|
284
335
|
}
|
|
336
|
+
/** Checks whether error boundary. */
|
|
285
337
|
function isErrorBoundary(value) {
|
|
286
338
|
return hasFunctionBrand(value, FigErrorBoundarySymbol);
|
|
287
339
|
}
|
|
340
|
+
/** Checks whether view transition. */
|
|
288
341
|
function isViewTransition(value) {
|
|
289
342
|
return hasFunctionBrand(value, FigViewTransitionSymbol);
|
|
290
343
|
}
|
|
344
|
+
/** Checks whether assets. */
|
|
291
345
|
function isAssets(value) {
|
|
292
346
|
return hasFunctionBrand(value, FigAssetsSymbol);
|
|
293
347
|
}
|
|
@@ -300,4 +354,4 @@ function hasFunctionBrand(value, brand) {
|
|
|
300
354
|
//#endregion
|
|
301
355
|
export { isAttributableError as $, markClientOnlyHostBehavior as A, useBeforeLayout as B, isSuspense as C, FigMixinSymbol as D, lazy as E, readContext as F, useMemo as G, useCallback as H, readData as I, useState as J, useReactive as K, readPromise as L, mixinSlot as M, resolveHostMix as N, clientOnlyHostBehavior as O, preloadData as P, defineLoadContextCapabilities as Q, setCurrentDispatcher as R, isPortal as S, isViewTransition as T, useDeferredValue as U, useBeforePaint as V, useId as W, useTransition as X, useSyncExternalStore as Y, dataResourceKeysForError as Z, createPortalNode as _, FigAssetsSymbol as a, isClientReference as b, FigErrorBoundarySymbol as c, FigViewTransitionSymbol as d, loadContextCapabilities as et, Fragment as f, createElement as g, clientReference as h, FigActivitySymbol as i, markClientOnlyHostProps as j, createMixin as k, FigPortalSymbol as l, ViewTransition as m, Assets as n, resolveCurrentDataStore as nt, FigClientReferenceSymbol as o, Suspense as p, useStableEvent as q, ErrorBoundary as r, setCurrentDataStore as rt, FigElementSymbol as s, Activity as t, markDataResourceError as tt, FigSuspenseSymbol as u, isActivity as v, isValidElement as w, isErrorBoundary as x, isAssets as y, useActionState as z };
|
|
302
356
|
|
|
303
|
-
//# sourceMappingURL=element-
|
|
357
|
+
//# sourceMappingURL=element-mHDfizuh.js.map
|