@plasmicapp/loader-react 1.0.252 → 1.0.254
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/PlasmicComponent.d.ts +19 -19
- package/dist/PlasmicRootProvider.d.ts +92 -92
- package/dist/bundles.d.ts +7 -7
- package/dist/component-lookup.d.ts +21 -21
- package/dist/global-variants.d.ts +13 -13
- package/dist/index.d.ts +15 -12
- package/dist/index.js +1464 -5
- package/dist/index.js.map +7 -0
- package/dist/loader-react-server.d.ts +72 -72
- package/dist/loader.d.ts +173 -173
- package/dist/prepass.d.ts +43 -43
- package/dist/react-server.d.ts +5 -0
- package/dist/react-server.js +473 -0
- package/dist/react-server.js.map +7 -0
- package/dist/render.d.ts +27 -27
- package/dist/shared-exports.d.ts +6 -0
- package/dist/usePlasmicComponent.d.ts +15 -15
- package/dist/utils.d.ts +30 -30
- package/dist/variation.d.ts +9 -9
- package/package.json +22 -54
- package/dist/index-react-server.d.ts +0 -5
- package/dist/index-shared.d.ts +0 -6
- package/dist/loader-react.cjs.development.js +0 -2748
- package/dist/loader-react.cjs.development.js.map +0 -1
- package/dist/loader-react.cjs.production.min.js +0 -2
- package/dist/loader-react.cjs.production.min.js.map +0 -1
- package/dist/loader-react.esm.js +0 -2666
- package/dist/loader-react.esm.js.map +0 -1
- package/dist-react-server/PlasmicComponent.d.ts +0 -19
- package/dist-react-server/PlasmicRootProvider.d.ts +0 -92
- package/dist-react-server/bundles.d.ts +0 -7
- package/dist-react-server/component-lookup.d.ts +0 -21
- package/dist-react-server/global-variants.d.ts +0 -13
- package/dist-react-server/index-react-server.d.ts +0 -5
- package/dist-react-server/index-shared.d.ts +0 -6
- package/dist-react-server/index.d.ts +0 -12
- package/dist-react-server/index.js +0 -8
- package/dist-react-server/loader-react-server.d.ts +0 -72
- package/dist-react-server/loader-react.cjs.development.js +0 -1315
- package/dist-react-server/loader-react.cjs.development.js.map +0 -1
- package/dist-react-server/loader-react.cjs.production.min.js +0 -2
- package/dist-react-server/loader-react.cjs.production.min.js.map +0 -1
- package/dist-react-server/loader-react.esm.js +0 -1306
- package/dist-react-server/loader-react.esm.js.map +0 -1
- package/dist-react-server/loader.d.ts +0 -173
- package/dist-react-server/prepass.d.ts +0 -43
- package/dist-react-server/render.d.ts +0 -27
- package/dist-react-server/usePlasmicComponent.d.ts +0 -15
- package/dist-react-server/utils.d.ts +0 -30
- package/dist-react-server/variation.d.ts +0 -9
package/dist/loader.d.ts
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
import { CodeComponentMeta as InternalCodeComponentMeta, GlobalContextMeta as InternalGlobalContextMeta, StateHelpers, StateSpec, TokenRegistration, TraitMeta } from '@plasmicapp/host';
|
|
2
|
-
import { ComponentMeta, LoaderBundleOutput, TrackRenderOptions } from '@plasmicapp/loader-core';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { ComponentLookup } from './component-lookup';
|
|
5
|
-
import { FetchComponentDataOpts, InitOptions } from './loader-react-server';
|
|
6
|
-
import type { GlobalVariantSpec } from './PlasmicRootProvider';
|
|
7
|
-
import { ComponentLookupSpec } from './utils';
|
|
8
|
-
export interface ComponentRenderData {
|
|
9
|
-
entryCompMetas: (ComponentMeta & {
|
|
10
|
-
params?: Record<string, string>;
|
|
11
|
-
})[];
|
|
12
|
-
bundle: LoaderBundleOutput;
|
|
13
|
-
remoteFontUrls: string[];
|
|
14
|
-
}
|
|
15
|
-
interface PlasmicRootWatcher {
|
|
16
|
-
onDataFetched?: () => void;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
19
|
-
/**
|
|
20
|
-
* The path to be used when importing the component in the generated code.
|
|
21
|
-
* It can be the name of the package that contains the component, or the path
|
|
22
|
-
* to the file in the project (relative to the root directory).
|
|
23
|
-
* Optional: not used by Plasmic headless API, only by codegen.
|
|
24
|
-
*/
|
|
25
|
-
importPath?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The states helpers are registered together with the states for the Plasmic headless API
|
|
28
|
-
*/
|
|
29
|
-
states?: Record<string, StateSpec & StateHelpers<P, any>>;
|
|
30
|
-
};
|
|
31
|
-
export
|
|
32
|
-
/**
|
|
33
|
-
* The path to be used when importing the component in the generated code.
|
|
34
|
-
* It can be the name of the package that contains the component, or the path
|
|
35
|
-
* to the file in the project (relative to the root directory).
|
|
36
|
-
* Optional: not used by Plasmic headless API, only by codegen.
|
|
37
|
-
*/
|
|
38
|
-
importPath?: string;
|
|
39
|
-
};
|
|
40
|
-
export
|
|
41
|
-
/**
|
|
42
|
-
* Whether to include dynamic pages in fetchPages() output. A page is
|
|
43
|
-
* considered dynamic if its path contains some param between brackets,
|
|
44
|
-
* e.g. "[slug]".
|
|
45
|
-
*/
|
|
46
|
-
includeDynamicPages?: boolean;
|
|
47
|
-
};
|
|
48
|
-
export declare class InternalPlasmicComponentLoader {
|
|
49
|
-
private opts;
|
|
50
|
-
private readonly reactServerLoader;
|
|
51
|
-
private readonly registry;
|
|
52
|
-
private subs;
|
|
53
|
-
private roots;
|
|
54
|
-
private globalVariants;
|
|
55
|
-
private tracker;
|
|
56
|
-
constructor(opts: InitOptions);
|
|
57
|
-
getBundle(): LoaderBundleOutput;
|
|
58
|
-
setGlobalVariants(globalVariants: GlobalVariantSpec[]): void;
|
|
59
|
-
getGlobalVariants(): GlobalVariantSpec[];
|
|
60
|
-
registerModules(modules: Record<string, any>): void;
|
|
61
|
-
substituteComponent<P>(component: React.ComponentType<P>, name: ComponentLookupSpec): void;
|
|
62
|
-
private internalSubstituteComponent;
|
|
63
|
-
registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
|
|
64
|
-
registerGlobalContext<T extends React.ComponentType<any>>(context: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
|
|
65
|
-
registerTrait(trait: string, meta: TraitMeta): void;
|
|
66
|
-
registerToken(token: TokenRegistration): void;
|
|
67
|
-
registerPrefetchedBundle(bundle: LoaderBundleOutput): void;
|
|
68
|
-
subscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
69
|
-
unsubscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
70
|
-
clearCache(): void;
|
|
71
|
-
getLookup(): ComponentLookup;
|
|
72
|
-
maybeFetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData | null>;
|
|
73
|
-
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
74
|
-
fetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData>;
|
|
75
|
-
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
76
|
-
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
77
|
-
fetchComponents(): Promise<ComponentMeta[]>;
|
|
78
|
-
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
79
|
-
trackConversion(value?: number): void;
|
|
80
|
-
getActiveVariation(opts: {
|
|
81
|
-
traits: Record<string, string | number | boolean>;
|
|
82
|
-
getKnownValue: (key: string) => string | undefined;
|
|
83
|
-
updateKnownValue: (key: string, value: string) => void;
|
|
84
|
-
}): Promise<Record<string, string>>;
|
|
85
|
-
getTeamIds(): string[];
|
|
86
|
-
getProjectIds(): string[];
|
|
87
|
-
trackRender(opts?: TrackRenderOptions): void;
|
|
88
|
-
private refreshRegistry;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Library for fetching component data, and registering
|
|
92
|
-
* custom components.
|
|
93
|
-
*/
|
|
94
|
-
export declare class PlasmicComponentLoader {
|
|
95
|
-
private __internal;
|
|
96
|
-
constructor(internal: InternalPlasmicComponentLoader);
|
|
97
|
-
/**
|
|
98
|
-
* Sets global variants to be used for all components. Note that
|
|
99
|
-
* this is not reactive, and will not re-render all components
|
|
100
|
-
* already mounted; instead, it should be used to activate global
|
|
101
|
-
* variants that should always be activated for the lifetime of this
|
|
102
|
-
* app. If you'd like to reactively change the global variants,
|
|
103
|
-
* you should specify them via <PlasmicRootProvider />
|
|
104
|
-
*/
|
|
105
|
-
setGlobalVariants(globalVariants: GlobalVariantSpec[]): void;
|
|
106
|
-
registerModules(modules: Record<string, any>): void;
|
|
107
|
-
/**
|
|
108
|
-
* Register custom components that should be swapped in for
|
|
109
|
-
* components defined in your project. You can use this to
|
|
110
|
-
* swap in / substitute a Plasmic component with a "real" component.
|
|
111
|
-
*/
|
|
112
|
-
substituteComponent<P>(component: React.ComponentType<P>, name: ComponentLookupSpec): void;
|
|
113
|
-
/**
|
|
114
|
-
* Register code components to be used on Plasmic Editor.
|
|
115
|
-
*/
|
|
116
|
-
registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
|
|
117
|
-
/**
|
|
118
|
-
* [[deprecated]] Please use `substituteComponent` instead for component
|
|
119
|
-
* substitution, or the other `registerComponent` overload to register
|
|
120
|
-
* code components to be used on Plasmic Editor.
|
|
121
|
-
*
|
|
122
|
-
* @see `substituteComponent`
|
|
123
|
-
*/
|
|
124
|
-
registerComponent<T extends React.ComponentType<any>>(component: T, name: ComponentLookupSpec): void;
|
|
125
|
-
private warnedRegisterComponent;
|
|
126
|
-
registerGlobalContext<T extends React.ComponentType<any>>(context: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
|
|
127
|
-
registerTrait(trait: string, meta: TraitMeta): void;
|
|
128
|
-
registerToken(token: TokenRegistration): void;
|
|
129
|
-
/**
|
|
130
|
-
* Pre-fetches component data needed to for PlasmicLoader to render
|
|
131
|
-
* these components. Should be passed into PlasmicRootProvider as
|
|
132
|
-
* the prefetchedData prop.
|
|
133
|
-
*
|
|
134
|
-
* You can look up a component either by:
|
|
135
|
-
* - the name of the component
|
|
136
|
-
* - the path for a page component
|
|
137
|
-
* - an array of strings that make up parts of the path
|
|
138
|
-
* - object { name: "name_or_path", projectId: ...}, to specify which project
|
|
139
|
-
* to use, if multiple projects have the same component name
|
|
140
|
-
*
|
|
141
|
-
* Throws an Error if a specified component to fetch does not exist in
|
|
142
|
-
* the Plasmic project.
|
|
143
|
-
*/
|
|
144
|
-
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
145
|
-
/**
|
|
146
|
-
* Like fetchComponentData(), but returns null instead of throwing an Error
|
|
147
|
-
* when a component is not found. Useful when you are implementing a catch-all
|
|
148
|
-
* page and want to check if a specific path had been defined for Plasmic.
|
|
149
|
-
*/
|
|
150
|
-
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
151
|
-
/**
|
|
152
|
-
* Returns all the page component metadata for these projects.
|
|
153
|
-
*/
|
|
154
|
-
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
155
|
-
/**
|
|
156
|
-
* Returns all components metadata for these projects.
|
|
157
|
-
*/
|
|
158
|
-
fetchComponents(): Promise<ComponentMeta[]>;
|
|
159
|
-
protected _getActiveVariation(opts: {
|
|
160
|
-
traits: Record<string, string | number | boolean>;
|
|
161
|
-
getKnownValue: (key: string) => string | undefined;
|
|
162
|
-
updateKnownValue: (key: string, value: string) => void;
|
|
163
|
-
}): Promise<Record<string, string>>;
|
|
164
|
-
getActiveVariation(opts: {
|
|
165
|
-
known?: Record<string, string>;
|
|
166
|
-
traits: Record<string, string | number | boolean>;
|
|
167
|
-
}): Promise<Record<string, string>>;
|
|
168
|
-
getExternalVariation(variation: Record<string, string>): Record<string, string>;
|
|
169
|
-
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
170
|
-
trackConversion(value?: number): void;
|
|
171
|
-
clearCache(): void;
|
|
172
|
-
}
|
|
173
|
-
export {};
|
|
1
|
+
import { CodeComponentMeta as InternalCodeComponentMeta, GlobalContextMeta as InternalGlobalContextMeta, StateHelpers, StateSpec, TokenRegistration, TraitMeta } from '@plasmicapp/host';
|
|
2
|
+
import { ComponentMeta, LoaderBundleOutput, TrackRenderOptions } from '@plasmicapp/loader-core';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ComponentLookup } from './component-lookup';
|
|
5
|
+
import { FetchComponentDataOpts, InitOptions } from './loader-react-server';
|
|
6
|
+
import type { GlobalVariantSpec } from './PlasmicRootProvider';
|
|
7
|
+
import { ComponentLookupSpec } from './utils';
|
|
8
|
+
export interface ComponentRenderData {
|
|
9
|
+
entryCompMetas: (ComponentMeta & {
|
|
10
|
+
params?: Record<string, string>;
|
|
11
|
+
})[];
|
|
12
|
+
bundle: LoaderBundleOutput;
|
|
13
|
+
remoteFontUrls: string[];
|
|
14
|
+
}
|
|
15
|
+
interface PlasmicRootWatcher {
|
|
16
|
+
onDataFetched?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export type CodeComponentMeta<P> = Omit<InternalCodeComponentMeta<P>, 'importPath' | 'componentHelpers' | 'states'> & {
|
|
19
|
+
/**
|
|
20
|
+
* The path to be used when importing the component in the generated code.
|
|
21
|
+
* It can be the name of the package that contains the component, or the path
|
|
22
|
+
* to the file in the project (relative to the root directory).
|
|
23
|
+
* Optional: not used by Plasmic headless API, only by codegen.
|
|
24
|
+
*/
|
|
25
|
+
importPath?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The states helpers are registered together with the states for the Plasmic headless API
|
|
28
|
+
*/
|
|
29
|
+
states?: Record<string, StateSpec & StateHelpers<P, any>>;
|
|
30
|
+
};
|
|
31
|
+
export type GlobalContextMeta<P> = Omit<InternalGlobalContextMeta<P>, 'importPath'> & {
|
|
32
|
+
/**
|
|
33
|
+
* The path to be used when importing the component in the generated code.
|
|
34
|
+
* It can be the name of the package that contains the component, or the path
|
|
35
|
+
* to the file in the project (relative to the root directory).
|
|
36
|
+
* Optional: not used by Plasmic headless API, only by codegen.
|
|
37
|
+
*/
|
|
38
|
+
importPath?: string;
|
|
39
|
+
};
|
|
40
|
+
export type FetchPagesOpts = {
|
|
41
|
+
/**
|
|
42
|
+
* Whether to include dynamic pages in fetchPages() output. A page is
|
|
43
|
+
* considered dynamic if its path contains some param between brackets,
|
|
44
|
+
* e.g. "[slug]".
|
|
45
|
+
*/
|
|
46
|
+
includeDynamicPages?: boolean;
|
|
47
|
+
};
|
|
48
|
+
export declare class InternalPlasmicComponentLoader {
|
|
49
|
+
private opts;
|
|
50
|
+
private readonly reactServerLoader;
|
|
51
|
+
private readonly registry;
|
|
52
|
+
private subs;
|
|
53
|
+
private roots;
|
|
54
|
+
private globalVariants;
|
|
55
|
+
private tracker;
|
|
56
|
+
constructor(opts: InitOptions);
|
|
57
|
+
getBundle(): LoaderBundleOutput;
|
|
58
|
+
setGlobalVariants(globalVariants: GlobalVariantSpec[]): void;
|
|
59
|
+
getGlobalVariants(): GlobalVariantSpec[];
|
|
60
|
+
registerModules(modules: Record<string, any>): void;
|
|
61
|
+
substituteComponent<P>(component: React.ComponentType<P>, name: ComponentLookupSpec): void;
|
|
62
|
+
private internalSubstituteComponent;
|
|
63
|
+
registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
|
|
64
|
+
registerGlobalContext<T extends React.ComponentType<any>>(context: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
|
|
65
|
+
registerTrait(trait: string, meta: TraitMeta): void;
|
|
66
|
+
registerToken(token: TokenRegistration): void;
|
|
67
|
+
registerPrefetchedBundle(bundle: LoaderBundleOutput): void;
|
|
68
|
+
subscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
69
|
+
unsubscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
70
|
+
clearCache(): void;
|
|
71
|
+
getLookup(): ComponentLookup;
|
|
72
|
+
maybeFetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData | null>;
|
|
73
|
+
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
74
|
+
fetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData>;
|
|
75
|
+
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
76
|
+
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
77
|
+
fetchComponents(): Promise<ComponentMeta[]>;
|
|
78
|
+
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
79
|
+
trackConversion(value?: number): void;
|
|
80
|
+
getActiveVariation(opts: {
|
|
81
|
+
traits: Record<string, string | number | boolean>;
|
|
82
|
+
getKnownValue: (key: string) => string | undefined;
|
|
83
|
+
updateKnownValue: (key: string, value: string) => void;
|
|
84
|
+
}): Promise<Record<string, string>>;
|
|
85
|
+
getTeamIds(): string[];
|
|
86
|
+
getProjectIds(): string[];
|
|
87
|
+
trackRender(opts?: TrackRenderOptions): void;
|
|
88
|
+
private refreshRegistry;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Library for fetching component data, and registering
|
|
92
|
+
* custom components.
|
|
93
|
+
*/
|
|
94
|
+
export declare class PlasmicComponentLoader {
|
|
95
|
+
private __internal;
|
|
96
|
+
constructor(internal: InternalPlasmicComponentLoader);
|
|
97
|
+
/**
|
|
98
|
+
* Sets global variants to be used for all components. Note that
|
|
99
|
+
* this is not reactive, and will not re-render all components
|
|
100
|
+
* already mounted; instead, it should be used to activate global
|
|
101
|
+
* variants that should always be activated for the lifetime of this
|
|
102
|
+
* app. If you'd like to reactively change the global variants,
|
|
103
|
+
* you should specify them via <PlasmicRootProvider />
|
|
104
|
+
*/
|
|
105
|
+
setGlobalVariants(globalVariants: GlobalVariantSpec[]): void;
|
|
106
|
+
registerModules(modules: Record<string, any>): void;
|
|
107
|
+
/**
|
|
108
|
+
* Register custom components that should be swapped in for
|
|
109
|
+
* components defined in your project. You can use this to
|
|
110
|
+
* swap in / substitute a Plasmic component with a "real" component.
|
|
111
|
+
*/
|
|
112
|
+
substituteComponent<P>(component: React.ComponentType<P>, name: ComponentLookupSpec): void;
|
|
113
|
+
/**
|
|
114
|
+
* Register code components to be used on Plasmic Editor.
|
|
115
|
+
*/
|
|
116
|
+
registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
|
|
117
|
+
/**
|
|
118
|
+
* [[deprecated]] Please use `substituteComponent` instead for component
|
|
119
|
+
* substitution, or the other `registerComponent` overload to register
|
|
120
|
+
* code components to be used on Plasmic Editor.
|
|
121
|
+
*
|
|
122
|
+
* @see `substituteComponent`
|
|
123
|
+
*/
|
|
124
|
+
registerComponent<T extends React.ComponentType<any>>(component: T, name: ComponentLookupSpec): void;
|
|
125
|
+
private warnedRegisterComponent;
|
|
126
|
+
registerGlobalContext<T extends React.ComponentType<any>>(context: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
|
|
127
|
+
registerTrait(trait: string, meta: TraitMeta): void;
|
|
128
|
+
registerToken(token: TokenRegistration): void;
|
|
129
|
+
/**
|
|
130
|
+
* Pre-fetches component data needed to for PlasmicLoader to render
|
|
131
|
+
* these components. Should be passed into PlasmicRootProvider as
|
|
132
|
+
* the prefetchedData prop.
|
|
133
|
+
*
|
|
134
|
+
* You can look up a component either by:
|
|
135
|
+
* - the name of the component
|
|
136
|
+
* - the path for a page component
|
|
137
|
+
* - an array of strings that make up parts of the path
|
|
138
|
+
* - object { name: "name_or_path", projectId: ...}, to specify which project
|
|
139
|
+
* to use, if multiple projects have the same component name
|
|
140
|
+
*
|
|
141
|
+
* Throws an Error if a specified component to fetch does not exist in
|
|
142
|
+
* the Plasmic project.
|
|
143
|
+
*/
|
|
144
|
+
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
145
|
+
/**
|
|
146
|
+
* Like fetchComponentData(), but returns null instead of throwing an Error
|
|
147
|
+
* when a component is not found. Useful when you are implementing a catch-all
|
|
148
|
+
* page and want to check if a specific path had been defined for Plasmic.
|
|
149
|
+
*/
|
|
150
|
+
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
151
|
+
/**
|
|
152
|
+
* Returns all the page component metadata for these projects.
|
|
153
|
+
*/
|
|
154
|
+
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Returns all components metadata for these projects.
|
|
157
|
+
*/
|
|
158
|
+
fetchComponents(): Promise<ComponentMeta[]>;
|
|
159
|
+
protected _getActiveVariation(opts: {
|
|
160
|
+
traits: Record<string, string | number | boolean>;
|
|
161
|
+
getKnownValue: (key: string) => string | undefined;
|
|
162
|
+
updateKnownValue: (key: string, value: string) => void;
|
|
163
|
+
}): Promise<Record<string, string>>;
|
|
164
|
+
getActiveVariation(opts: {
|
|
165
|
+
known?: Record<string, string>;
|
|
166
|
+
traits: Record<string, string | number | boolean>;
|
|
167
|
+
}): Promise<Record<string, string>>;
|
|
168
|
+
getExternalVariation(variation: Record<string, string>): Record<string, string>;
|
|
169
|
+
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
170
|
+
trackConversion(value?: number): void;
|
|
171
|
+
clearCache(): void;
|
|
172
|
+
}
|
|
173
|
+
export {};
|
package/dist/prepass.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
/**
|
|
3
|
-
* Performs a prepass over Plasmic content, kicking off the necessary
|
|
4
|
-
* data fetches, and populating the fetched data into a cache. This
|
|
5
|
-
* cache can be passed as prefetchedQueryData into PlasmicRootProvider.
|
|
6
|
-
*
|
|
7
|
-
* To limit rendering errors that can occur when you do this, we recommend
|
|
8
|
-
* that you pass in _only_ the PlasmicComponents that you are planning to use
|
|
9
|
-
* as the argument. For example:
|
|
10
|
-
*
|
|
11
|
-
* const cache = await extractPlasmicQueryData(
|
|
12
|
-
* <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>
|
|
13
|
-
* <PlasmicComponent component="Home" componentProps={{
|
|
14
|
-
* // Specify the component prop overrides you are planning to use
|
|
15
|
-
* // to render the page, as they may change what data is fetched.
|
|
16
|
-
* ...
|
|
17
|
-
* }} />
|
|
18
|
-
* <PlasmicComponent component="NavBar" componentProps={{
|
|
19
|
-
* ...
|
|
20
|
-
* }} />
|
|
21
|
-
* ...
|
|
22
|
-
* </PlasmicRootProvider>
|
|
23
|
-
* );
|
|
24
|
-
*
|
|
25
|
-
* If your PlasmicComponent will be wrapping components that require special
|
|
26
|
-
* context set up, you should also wrap the element above with those context
|
|
27
|
-
* providers.
|
|
28
|
-
*
|
|
29
|
-
* You should avoid passing in elements that are not related to Plasmic, as any
|
|
30
|
-
* rendering errors from those elements during the prepass may result in data
|
|
31
|
-
* not being populated in the cache.
|
|
32
|
-
*
|
|
33
|
-
* @param element a React element containing instances of PlasmicComponent.
|
|
34
|
-
* Will attempt to satisfy all data needs from usePlasmicDataQuery()
|
|
35
|
-
* in this element tree.
|
|
36
|
-
* @returns an object mapping query key to fetched data
|
|
37
|
-
*/
|
|
38
|
-
export declare function extractPlasmicQueryData(element: React.ReactElement): Promise<Record<string, any>>;
|
|
39
|
-
/**
|
|
40
|
-
* Runs react-ssr-prepass on `element`, while isolating rendering errors
|
|
41
|
-
* as much as possible for each PlasmicComponent instance.
|
|
42
|
-
*/
|
|
43
|
-
export declare function plasmicPrepass(element: React.ReactElement): Promise<void>;
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Performs a prepass over Plasmic content, kicking off the necessary
|
|
4
|
+
* data fetches, and populating the fetched data into a cache. This
|
|
5
|
+
* cache can be passed as prefetchedQueryData into PlasmicRootProvider.
|
|
6
|
+
*
|
|
7
|
+
* To limit rendering errors that can occur when you do this, we recommend
|
|
8
|
+
* that you pass in _only_ the PlasmicComponents that you are planning to use
|
|
9
|
+
* as the argument. For example:
|
|
10
|
+
*
|
|
11
|
+
* const cache = await extractPlasmicQueryData(
|
|
12
|
+
* <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>
|
|
13
|
+
* <PlasmicComponent component="Home" componentProps={{
|
|
14
|
+
* // Specify the component prop overrides you are planning to use
|
|
15
|
+
* // to render the page, as they may change what data is fetched.
|
|
16
|
+
* ...
|
|
17
|
+
* }} />
|
|
18
|
+
* <PlasmicComponent component="NavBar" componentProps={{
|
|
19
|
+
* ...
|
|
20
|
+
* }} />
|
|
21
|
+
* ...
|
|
22
|
+
* </PlasmicRootProvider>
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* If your PlasmicComponent will be wrapping components that require special
|
|
26
|
+
* context set up, you should also wrap the element above with those context
|
|
27
|
+
* providers.
|
|
28
|
+
*
|
|
29
|
+
* You should avoid passing in elements that are not related to Plasmic, as any
|
|
30
|
+
* rendering errors from those elements during the prepass may result in data
|
|
31
|
+
* not being populated in the cache.
|
|
32
|
+
*
|
|
33
|
+
* @param element a React element containing instances of PlasmicComponent.
|
|
34
|
+
* Will attempt to satisfy all data needs from usePlasmicDataQuery()
|
|
35
|
+
* in this element tree.
|
|
36
|
+
* @returns an object mapping query key to fetched data
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractPlasmicQueryData(element: React.ReactElement): Promise<Record<string, any>>;
|
|
39
|
+
/**
|
|
40
|
+
* Runs react-ssr-prepass on `element`, while isolating rendering errors
|
|
41
|
+
* as much as possible for each PlasmicComponent instance.
|
|
42
|
+
*/
|
|
43
|
+
export declare function plasmicPrepass(element: React.ReactElement): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { InitOptions, ReactServerPlasmicComponentLoader } from "./loader-react-server";
|
|
3
|
+
export * from "./shared-exports";
|
|
4
|
+
export { ReactServerPlasmicComponentLoader };
|
|
5
|
+
export declare function initPlasmicLoader(opts: InitOptions): ReactServerPlasmicComponentLoader;
|