@plasmicapp/loader-react 1.0.253 → 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.
Files changed (50) hide show
  1. package/dist/PlasmicComponent.d.ts +19 -19
  2. package/dist/PlasmicRootProvider.d.ts +92 -92
  3. package/dist/bundles.d.ts +7 -7
  4. package/dist/component-lookup.d.ts +21 -21
  5. package/dist/global-variants.d.ts +13 -13
  6. package/dist/index.d.ts +15 -12
  7. package/dist/index.js +1464 -5
  8. package/dist/index.js.map +7 -0
  9. package/dist/loader-react-server.d.ts +72 -72
  10. package/dist/loader.d.ts +173 -173
  11. package/dist/prepass.d.ts +43 -43
  12. package/dist/react-server.d.ts +5 -0
  13. package/dist/react-server.js +473 -0
  14. package/dist/react-server.js.map +7 -0
  15. package/dist/render.d.ts +27 -27
  16. package/dist/shared-exports.d.ts +6 -0
  17. package/dist/usePlasmicComponent.d.ts +15 -15
  18. package/dist/utils.d.ts +30 -30
  19. package/dist/variation.d.ts +9 -9
  20. package/package.json +21 -53
  21. package/dist/index-react-server.d.ts +0 -5
  22. package/dist/index-shared.d.ts +0 -6
  23. package/dist/loader-react.cjs.development.js +0 -2748
  24. package/dist/loader-react.cjs.development.js.map +0 -1
  25. package/dist/loader-react.cjs.production.min.js +0 -2
  26. package/dist/loader-react.cjs.production.min.js.map +0 -1
  27. package/dist/loader-react.esm.js +0 -2666
  28. package/dist/loader-react.esm.js.map +0 -1
  29. package/dist-react-server/PlasmicComponent.d.ts +0 -19
  30. package/dist-react-server/PlasmicRootProvider.d.ts +0 -92
  31. package/dist-react-server/bundles.d.ts +0 -7
  32. package/dist-react-server/component-lookup.d.ts +0 -21
  33. package/dist-react-server/global-variants.d.ts +0 -13
  34. package/dist-react-server/index-react-server.d.ts +0 -5
  35. package/dist-react-server/index-shared.d.ts +0 -6
  36. package/dist-react-server/index.d.ts +0 -12
  37. package/dist-react-server/index.js +0 -8
  38. package/dist-react-server/loader-react-server.d.ts +0 -72
  39. package/dist-react-server/loader-react.cjs.development.js +0 -1315
  40. package/dist-react-server/loader-react.cjs.development.js.map +0 -1
  41. package/dist-react-server/loader-react.cjs.production.min.js +0 -2
  42. package/dist-react-server/loader-react.cjs.production.min.js.map +0 -1
  43. package/dist-react-server/loader-react.esm.js +0 -1306
  44. package/dist-react-server/loader-react.esm.js.map +0 -1
  45. package/dist-react-server/loader.d.ts +0 -173
  46. package/dist-react-server/prepass.d.ts +0 -43
  47. package/dist-react-server/render.d.ts +0 -27
  48. package/dist-react-server/usePlasmicComponent.d.ts +0 -15
  49. package/dist-react-server/utils.d.ts +0 -30
  50. package/dist-react-server/variation.d.ts +0 -9
@@ -1,19 +1,19 @@
1
- import * as React from 'react';
2
- export declare function PlasmicComponent(props: {
3
- /**
4
- * Name of the component to render, or the path of the page component
5
- */
6
- component: string;
7
- /**
8
- * Optionally specify a projectId if there are multiple components
9
- * of the same name from different projects
10
- */
11
- projectId?: string;
12
- /**
13
- * If you used registerComponent(), then if the name matches a registered
14
- * component, that component is used. If you want the Plasmic-generated
15
- * component instead, specify forceOriginal.
16
- */
17
- forceOriginal?: boolean;
18
- componentProps?: any;
19
- }): React.ReactElement | null;
1
+ import * as React from "react";
2
+ export declare function PlasmicComponent(props: {
3
+ /**
4
+ * Name of the component to render, or the path of the page component
5
+ */
6
+ component: string;
7
+ /**
8
+ * Optionally specify a projectId if there are multiple components
9
+ * of the same name from different projects
10
+ */
11
+ projectId?: string;
12
+ /**
13
+ * If you used registerComponent(), then if the name matches a registered
14
+ * component, that component is used. If you want the Plasmic-generated
15
+ * component instead, specify forceOriginal.
16
+ */
17
+ forceOriginal?: boolean;
18
+ componentProps?: any;
19
+ }): React.ReactElement | null;
@@ -1,92 +1,92 @@
1
- import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
2
- import * as React from 'react';
3
- import { ComponentRenderData, InternalPlasmicComponentLoader, PlasmicComponentLoader } from './loader';
4
- interface PlasmicRootContextValue extends PlasmicDataSourceContextValue {
5
- globalVariants?: GlobalVariantSpec[];
6
- globalContextsProps?: Record<string, any>;
7
- loader: InternalPlasmicComponentLoader;
8
- variation?: Record<string, string>;
9
- translator?: PlasmicTranslator;
10
- Head?: React.ComponentType<any>;
11
- }
12
- export interface GlobalVariantSpec {
13
- name: string;
14
- projectId?: string;
15
- value: any;
16
- }
17
- export declare type PlasmicTranslator = (str: string, opts?: {
18
- components?: {
19
- [key: string]: React.ReactElement | React.ReactFragment;
20
- };
21
- }) => React.ReactNode;
22
- /**
23
- * PlasmicRootProvider should be used at the root of your page
24
- * or application.
25
- */
26
- export declare function PlasmicRootProvider(props: {
27
- /**
28
- * The global PlasmicComponentLoader instance you created via
29
- * initPlasmicLoader().
30
- */
31
- loader: PlasmicComponentLoader;
32
- /**
33
- * Global variants to activate for Plasmic components
34
- */
35
- globalVariants?: GlobalVariantSpec[];
36
- children?: React.ReactNode;
37
- /**
38
- * If true, will skip rendering css
39
- */
40
- skipCss?: boolean;
41
- /**
42
- * If true, will skip installing fonts
43
- */
44
- skipFonts?: boolean;
45
- /**
46
- * If you have pre-fetched component data via PlasmicComponentLoader,
47
- * you can pass them in here; PlasmicComponent will avoid fetching
48
- * component data that have already been pre-fetched.
49
- */
50
- prefetchedData?: ComponentRenderData;
51
- /**
52
- * If you have pre-fetched data that are needed by usePlasmicQueryData(),
53
- * then pass in the pre-fetched cache here, mapping query key to fetched data.
54
- */
55
- prefetchedQueryData?: Record<string, any>;
56
- /**
57
- * Specifies whether usePlasmicQueryData() should be operating in suspense mode
58
- * (throwing promises).
59
- */
60
- suspenseForQueryData?: boolean;
61
- /**
62
- * Override your Global Contexts Provider props. This is a map from
63
- * globalContextComponentNameProps to object of props to use for that
64
- * component.
65
- */
66
- globalContextsProps?: Record<string, any>;
67
- /**
68
- * Specifies a mapping of split id to slice id that should be activated
69
- */
70
- variation?: Record<string, string>;
71
- /**
72
- * Translator function to be used for text blocks
73
- */
74
- translator?: PlasmicTranslator;
75
- /**
76
- * Head component to use in PlasmicHead component (e.g. Head from next/head
77
- * or Helmet from react-helmet).
78
- */
79
- Head?: React.ComponentType<any>;
80
- /**
81
- * Page path parameters (e.g. {slug: "foo"} if page path is
82
- * /products/[slug] and URI is /products/foo).
83
- */
84
- pageParams?: Record<string, string | string[] | undefined>;
85
- /**
86
- * Page query parameters (e.g. {q: "foo"} if page path is
87
- * /some/path?q=foo).
88
- */
89
- pageQuery?: Record<string, string | string[] | undefined>;
90
- } & PlasmicDataSourceContextValue): JSX.Element;
91
- export declare function usePlasmicRootContext(): PlasmicRootContextValue | undefined;
92
- export {};
1
+ import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
2
+ import * as React from 'react';
3
+ import { ComponentRenderData, InternalPlasmicComponentLoader, PlasmicComponentLoader } from './loader';
4
+ interface PlasmicRootContextValue extends PlasmicDataSourceContextValue {
5
+ globalVariants?: GlobalVariantSpec[];
6
+ globalContextsProps?: Record<string, any>;
7
+ loader: InternalPlasmicComponentLoader;
8
+ variation?: Record<string, string>;
9
+ translator?: PlasmicTranslator;
10
+ Head?: React.ComponentType<any>;
11
+ }
12
+ export interface GlobalVariantSpec {
13
+ name: string;
14
+ projectId?: string;
15
+ value: any;
16
+ }
17
+ export type PlasmicTranslator = (str: string, opts?: {
18
+ components?: {
19
+ [key: string]: React.ReactElement | React.ReactFragment;
20
+ };
21
+ }) => React.ReactNode;
22
+ /**
23
+ * PlasmicRootProvider should be used at the root of your page
24
+ * or application.
25
+ */
26
+ export declare function PlasmicRootProvider(props: {
27
+ /**
28
+ * The global PlasmicComponentLoader instance you created via
29
+ * initPlasmicLoader().
30
+ */
31
+ loader: PlasmicComponentLoader;
32
+ /**
33
+ * Global variants to activate for Plasmic components
34
+ */
35
+ globalVariants?: GlobalVariantSpec[];
36
+ children?: React.ReactNode;
37
+ /**
38
+ * If true, will skip rendering css
39
+ */
40
+ skipCss?: boolean;
41
+ /**
42
+ * If true, will skip installing fonts
43
+ */
44
+ skipFonts?: boolean;
45
+ /**
46
+ * If you have pre-fetched component data via PlasmicComponentLoader,
47
+ * you can pass them in here; PlasmicComponent will avoid fetching
48
+ * component data that have already been pre-fetched.
49
+ */
50
+ prefetchedData?: ComponentRenderData;
51
+ /**
52
+ * If you have pre-fetched data that are needed by usePlasmicQueryData(),
53
+ * then pass in the pre-fetched cache here, mapping query key to fetched data.
54
+ */
55
+ prefetchedQueryData?: Record<string, any>;
56
+ /**
57
+ * Specifies whether usePlasmicQueryData() should be operating in suspense mode
58
+ * (throwing promises).
59
+ */
60
+ suspenseForQueryData?: boolean;
61
+ /**
62
+ * Override your Global Contexts Provider props. This is a map from
63
+ * globalContextComponentNameProps to object of props to use for that
64
+ * component.
65
+ */
66
+ globalContextsProps?: Record<string, any>;
67
+ /**
68
+ * Specifies a mapping of split id to slice id that should be activated
69
+ */
70
+ variation?: Record<string, string>;
71
+ /**
72
+ * Translator function to be used for text blocks
73
+ */
74
+ translator?: PlasmicTranslator;
75
+ /**
76
+ * Head component to use in PlasmicHead component (e.g. Head from next/head
77
+ * or Helmet from react-helmet).
78
+ */
79
+ Head?: React.ComponentType<any>;
80
+ /**
81
+ * Page path parameters (e.g. {slug: "foo"} if page path is
82
+ * /products/[slug] and URI is /products/foo).
83
+ */
84
+ pageParams?: Record<string, string | string[] | undefined>;
85
+ /**
86
+ * Page query parameters (e.g. {q: "foo"} if page path is
87
+ * /some/path?q=foo).
88
+ */
89
+ pageQuery?: Record<string, string | string[] | undefined>;
90
+ } & PlasmicDataSourceContextValue): JSX.Element;
91
+ export declare function usePlasmicRootContext(): PlasmicRootContextValue | undefined;
92
+ export {};
package/dist/bundles.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-core';
2
- import type { ComponentRenderData } from './loader';
3
- export declare function prepComponentData(bundle: LoaderBundleOutput, compMetas: ComponentMeta[], opts?: {
4
- target?: 'browser' | 'server';
5
- }): ComponentRenderData;
6
- export declare function mergeBundles(target: LoaderBundleOutput, from: LoaderBundleOutput): LoaderBundleOutput;
7
- export declare const convertBundlesToComponentRenderData: (bundles: LoaderBundleOutput[], compMetas: ComponentMeta[]) => ComponentRenderData | null;
1
+ import { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-core';
2
+ import type { ComponentRenderData } from './loader';
3
+ export declare function prepComponentData(bundle: LoaderBundleOutput, compMetas: ComponentMeta[], opts?: {
4
+ target?: 'browser' | 'server';
5
+ }): ComponentRenderData;
6
+ export declare function mergeBundles(target: LoaderBundleOutput, from: LoaderBundleOutput): LoaderBundleOutput;
7
+ export declare const convertBundlesToComponentRenderData: (bundles: LoaderBundleOutput[], compMetas: ComponentMeta[]) => ComponentRenderData | null;
@@ -1,21 +1,21 @@
1
- import { AssetModule, ComponentMeta, FontMeta, GlobalGroupMeta, LoaderBundleOutput, Registry } from '@plasmicapp/loader-core';
2
- import * as React from 'react';
3
- import { ComponentLookupSpec } from './utils';
4
- export declare class ComponentLookup {
5
- private bundle;
6
- private registry;
7
- constructor(bundle: LoaderBundleOutput, registry: Registry);
8
- getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined;
9
- getComponent<P extends React.ComponentType = any>(spec: ComponentLookupSpec, opts?: {
10
- forceOriginal?: boolean;
11
- }): any;
12
- hasComponent(spec: ComponentLookupSpec): boolean;
13
- getGlobalContexts(): {
14
- meta: GlobalGroupMeta;
15
- context: any;
16
- }[];
17
- getGlobalContextsProvider(spec: ComponentLookupSpec): any;
18
- getRootProvider(): any;
19
- getCss(): AssetModule[];
20
- getRemoteFonts(): FontMeta[];
21
- }
1
+ import { AssetModule, ComponentMeta, FontMeta, GlobalGroupMeta, LoaderBundleOutput, Registry } from '@plasmicapp/loader-core';
2
+ import * as React from 'react';
3
+ import { ComponentLookupSpec } from './utils';
4
+ export declare class ComponentLookup {
5
+ private bundle;
6
+ private registry;
7
+ constructor(bundle: LoaderBundleOutput, registry: Registry);
8
+ getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined;
9
+ getComponent<P extends React.ComponentType = any>(spec: ComponentLookupSpec, opts?: {
10
+ forceOriginal?: boolean;
11
+ }): any;
12
+ hasComponent(spec: ComponentLookupSpec): boolean;
13
+ getGlobalContexts(): {
14
+ meta: GlobalGroupMeta;
15
+ context: any;
16
+ }[];
17
+ getGlobalContextsProvider(spec: ComponentLookupSpec): any;
18
+ getRootProvider(): any;
19
+ getCss(): AssetModule[];
20
+ getRemoteFonts(): FontMeta[];
21
+ }
@@ -1,13 +1,13 @@
1
- /**
2
- * We don't actually make use of the global variant React contexts generated
3
- * in the bundle. That's because we would have to wait until the data is
4
- * loaded before we can set up the context providers, but setting up context
5
- * providers will mutate the React tree and invalidate all the children. That means
6
- * once data comes in, we'll re-render the React tree from the providers down
7
- * in a way that will lose all existing React state. Therefore, instead,
8
- * we always have a single context provided -- the PlasmicRootContext -- and we
9
- * create these fake useGlobalVariant() hooks that just read from that
10
- * PlasmicRootContext. This allows us to have a stable React tree before and
11
- * after the data load.
12
- */
13
- export declare function createUseGlobalVariant(name: string, projectId: string): () => any;
1
+ /**
2
+ * We don't actually make use of the global variant React contexts generated
3
+ * in the bundle. That's because we would have to wait until the data is
4
+ * loaded before we can set up the context providers, but setting up context
5
+ * providers will mutate the React tree and invalidate all the children. That means
6
+ * once data comes in, we'll re-render the React tree from the providers down
7
+ * in a way that will lose all existing React state. Therefore, instead,
8
+ * we always have a single context provided -- the PlasmicRootContext -- and we
9
+ * create these fake useGlobalVariant() hooks that just read from that
10
+ * PlasmicRootContext. This allows us to have a stable React tree before and
11
+ * after the data load.
12
+ */
13
+ export declare function createUseGlobalVariant(name: string, projectId: string): () => any;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,15 @@
1
- import { CodeComponentMeta, InternalPlasmicComponentLoader, PlasmicComponentLoader } from './loader';
2
- import type { InitOptions } from './loader-react-server';
3
- export { DataCtxReader, DataProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, PrimitiveType, PropType, repeatedElement, TokenRegistration, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors, } from '@plasmicapp/host';
4
- export { usePlasmicQueryData } from '@plasmicapp/query';
5
- export * from './index-shared';
6
- export { PlasmicComponent } from './PlasmicComponent';
7
- export { GlobalVariantSpec, PlasmicRootProvider, PlasmicTranslator, } from './PlasmicRootProvider';
8
- export { extractPlasmicQueryData, plasmicPrepass } from './prepass';
9
- export { extractPlasmicQueryDataFromElement, hydrateFromElement, renderToElement, renderToString, } from './render';
10
- export { usePlasmicComponent } from './usePlasmicComponent';
11
- export { InternalPlasmicComponentLoader, PlasmicComponentLoader, CodeComponentMeta, };
12
- export declare function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader;
1
+ import { CodeComponentMeta, InternalPlasmicComponentLoader, PlasmicComponentLoader } from "./loader";
2
+ import type { InitOptions } from "./loader-react-server";
3
+ export type { PrimitiveType, PropType, TokenRegistration, } from "@plasmicapp/host";
4
+ export { DataCtxReader, DataProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, repeatedElement, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors, } from "@plasmicapp/host";
5
+ export { usePlasmicQueryData } from "@plasmicapp/query";
6
+ export * from "./shared-exports";
7
+ export { PlasmicComponent } from "./PlasmicComponent";
8
+ export type { GlobalVariantSpec, PlasmicTranslator, } from "./PlasmicRootProvider";
9
+ export { PlasmicRootProvider } from "./PlasmicRootProvider";
10
+ export { extractPlasmicQueryData, plasmicPrepass } from "./prepass";
11
+ export { extractPlasmicQueryDataFromElement, hydrateFromElement, renderToElement, renderToString, } from "./render";
12
+ export { usePlasmicComponent } from "./usePlasmicComponent";
13
+ export type { CodeComponentMeta };
14
+ export { InternalPlasmicComponentLoader, PlasmicComponentLoader };
15
+ export declare function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader;