@plasmicapp/loader-react 1.0.396-beta.0 → 1.0.396
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/index.d.ts +2 -7
- package/dist/index.esm.js +4 -34
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +3 -33
- package/dist/index.js.map +2 -2
- package/dist/react-server.d.ts +2 -7
- package/dist/react-server.esm.js +3 -24
- package/dist/react-server.esm.js.map +3 -3
- package/dist/react-server.js +2 -23
- package/dist/react-server.js.map +2 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ import { PlasmicCanvasContext } from '@plasmicapp/host';
|
|
|
29
29
|
import { PlasmicCanvasHost } from '@plasmicapp/host';
|
|
30
30
|
import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
|
|
31
31
|
import { PlasmicModulesFetcher } from '@plasmicapp/loader-core';
|
|
32
|
-
import { PlasmicTracker } from '@plasmicapp/loader-core';
|
|
33
32
|
import { PlasmicTranslatorContext } from '@plasmicapp/host';
|
|
34
33
|
import { PropType } from '@plasmicapp/host';
|
|
35
34
|
import { react } from 'react';
|
|
@@ -58,7 +57,6 @@ import { useSelectors } from '@plasmicapp/host';
|
|
|
58
57
|
declare abstract class BaseInternalPlasmicComponentLoader {
|
|
59
58
|
readonly opts: InitOptions;
|
|
60
59
|
private readonly registry;
|
|
61
|
-
private readonly tracker;
|
|
62
60
|
private readonly fetcher;
|
|
63
61
|
private readonly onBundleMerged?;
|
|
64
62
|
private readonly onBundleFetched?;
|
|
@@ -68,7 +66,6 @@ declare abstract class BaseInternalPlasmicComponentLoader {
|
|
|
68
66
|
constructor(args: {
|
|
69
67
|
opts: InitOptions;
|
|
70
68
|
fetcher: PlasmicModulesFetcher;
|
|
71
|
-
tracker: PlasmicTracker;
|
|
72
69
|
/** Called after `mergeBundle` (including `fetch` calls). */
|
|
73
70
|
onBundleMerged?: () => void;
|
|
74
71
|
/** Called after any `fetch` calls. */
|
|
@@ -105,11 +102,11 @@ declare abstract class BaseInternalPlasmicComponentLoader {
|
|
|
105
102
|
getGlobalVariants(): GlobalVariantSpec[];
|
|
106
103
|
registerPrefetchedBundle(bundle: LoaderBundleOutput): void;
|
|
107
104
|
getLookup(): ComponentLookup;
|
|
108
|
-
trackConversion(
|
|
105
|
+
trackConversion(_value?: number): void;
|
|
109
106
|
getActiveVariation(opts: Omit<Parameters<typeof getActiveVariation>[0], "splits">): Promise<Record<string, string>>;
|
|
110
107
|
getTeamIds(): string[];
|
|
111
108
|
getProjectIds(): string[];
|
|
112
|
-
trackRender(
|
|
109
|
+
trackRender(_opts?: TrackRenderOptions): void;
|
|
113
110
|
loadServerQueriesModule(fileName: string): any;
|
|
114
111
|
}
|
|
115
112
|
|
|
@@ -161,8 +158,6 @@ declare class ComponentLookup {
|
|
|
161
158
|
meta: GlobalGroupMeta;
|
|
162
159
|
context: any;
|
|
163
160
|
}[];
|
|
164
|
-
/** Returns StyleTokensProvider if the project has style token overrides. */
|
|
165
|
-
maybeGetStyleTokensProvider(spec: ComponentLookupSpec): any;
|
|
166
161
|
getGlobalContextsProvider(spec: ComponentLookupSpec): any;
|
|
167
162
|
getRootProvider(): any;
|
|
168
163
|
getCss(): AssetModule[];
|
package/dist/index.esm.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
registerTrait,
|
|
63
63
|
stateHelpersKeys
|
|
64
64
|
} from "@plasmicapp/host";
|
|
65
|
-
import { PlasmicModulesFetcher as PlasmicModulesFetcher2
|
|
65
|
+
import { PlasmicModulesFetcher as PlasmicModulesFetcher2 } from "@plasmicapp/loader-core";
|
|
66
66
|
import * as PlasmicQuery from "@plasmicapp/query";
|
|
67
67
|
import React3 from "react";
|
|
68
68
|
import ReactDOM from "react-dom";
|
|
@@ -537,7 +537,6 @@ function prepComponentData(bundle, compMetas, opts) {
|
|
|
537
537
|
"entrypoint.css",
|
|
538
538
|
...compPaths,
|
|
539
539
|
"root-provider.js",
|
|
540
|
-
...bundle.projects.map((x) => x.styleTokensProviderFileName).filter((x) => !!x),
|
|
541
540
|
...bundle.projects.map((x) => x.globalContextsProviderFileName).filter((x) => !!x),
|
|
542
541
|
// We need to explicitly include global context provider components
|
|
543
542
|
// to make sure they are kept in bundle.components. That's because
|
|
@@ -705,16 +704,6 @@ var ComponentLookup = class {
|
|
|
705
704
|
context: this.registry.load(meta.contextFile).default
|
|
706
705
|
}));
|
|
707
706
|
}
|
|
708
|
-
/** Returns StyleTokensProvider if the project has style token overrides. */
|
|
709
|
-
maybeGetStyleTokensProvider(spec) {
|
|
710
|
-
const compMeta = getFirstCompMeta(this.bundle.components, spec);
|
|
711
|
-
const projectMeta = compMeta ? this.bundle.projects.find((x) => x.id === compMeta.projectId) : void 0;
|
|
712
|
-
if (!projectMeta || !projectMeta.styleTokensProviderFileName || !this.registry.hasModule(projectMeta.styleTokensProviderFileName) || !projectMeta.hasStyleTokenOverrides) {
|
|
713
|
-
return void 0;
|
|
714
|
-
}
|
|
715
|
-
const entry = this.registry.load(projectMeta.styleTokensProviderFileName);
|
|
716
|
-
return entry.StyleTokensProvider;
|
|
717
|
-
}
|
|
718
707
|
getGlobalContextsProvider(spec) {
|
|
719
708
|
const compMeta = getFirstCompMeta(this.bundle.components, spec);
|
|
720
709
|
const projectMeta = compMeta ? this.bundle.projects.find((x) => x.id === compMeta.projectId) : void 0;
|
|
@@ -785,7 +774,6 @@ var BaseInternalPlasmicComponentLoader = class {
|
|
|
785
774
|
};
|
|
786
775
|
this.opts = args.opts;
|
|
787
776
|
this.fetcher = args.fetcher;
|
|
788
|
-
this.tracker = args.tracker;
|
|
789
777
|
this.onBundleMerged = args.onBundleMerged;
|
|
790
778
|
this.onBundleFetched = args.onBundleFetched;
|
|
791
779
|
this.registerModules(args.builtinModules);
|
|
@@ -885,7 +873,6 @@ var BaseInternalPlasmicComponentLoader = class {
|
|
|
885
873
|
return __async(this, null, function* () {
|
|
886
874
|
var _a;
|
|
887
875
|
const bundle = yield this.fetcher.fetchAllData();
|
|
888
|
-
this.tracker.trackFetch();
|
|
889
876
|
this.mergeBundle(bundle);
|
|
890
877
|
(_a = this.onBundleFetched) == null ? void 0 : _a.call(this);
|
|
891
878
|
return bundle;
|
|
@@ -988,8 +975,7 @@ ${this.bundle.bundleKey}`
|
|
|
988
975
|
getLookup() {
|
|
989
976
|
return new ComponentLookup(this.getBundle(), this.registry);
|
|
990
977
|
}
|
|
991
|
-
trackConversion(
|
|
992
|
-
this.tracker.trackConversion(value);
|
|
978
|
+
trackConversion(_value = 0) {
|
|
993
979
|
}
|
|
994
980
|
getActiveVariation(opts) {
|
|
995
981
|
return __async(this, null, function* () {
|
|
@@ -1013,8 +999,7 @@ ${this.bundle.bundleKey}`
|
|
|
1013
999
|
)
|
|
1014
1000
|
);
|
|
1015
1001
|
}
|
|
1016
|
-
trackRender(
|
|
1017
|
-
this.tracker.trackRender(opts);
|
|
1002
|
+
trackRender(_opts) {
|
|
1018
1003
|
}
|
|
1019
1004
|
loadServerQueriesModule(fileName) {
|
|
1020
1005
|
return this.registry.load(fileName);
|
|
@@ -1161,12 +1146,8 @@ var PlasmicComponentLoader = class {
|
|
|
1161
1146
|
// src/loader-client.ts
|
|
1162
1147
|
var InternalPlasmicComponentLoader = class extends BaseInternalPlasmicComponentLoader {
|
|
1163
1148
|
constructor(opts) {
|
|
1164
|
-
const tracker = new PlasmicTracker2(__spreadProps(__spreadValues({}, opts), {
|
|
1165
|
-
projectIds: opts.projects.map((p) => p.id)
|
|
1166
|
-
}));
|
|
1167
1149
|
super({
|
|
1168
1150
|
opts,
|
|
1169
|
-
tracker,
|
|
1170
1151
|
fetcher: new PlasmicModulesFetcher2(opts),
|
|
1171
1152
|
onBundleMerged: () => {
|
|
1172
1153
|
this.refreshRegistry();
|
|
@@ -1373,10 +1354,6 @@ function PlasmicComponent(props) {
|
|
|
1373
1354
|
if (isRootLoader) {
|
|
1374
1355
|
const lookup = loader.getLookup();
|
|
1375
1356
|
const ReactWebRootProvider = lookup.getRootProvider();
|
|
1376
|
-
const StyleTokensProvider = lookup.maybeGetStyleTokensProvider({
|
|
1377
|
-
name: component,
|
|
1378
|
-
projectId
|
|
1379
|
-
});
|
|
1380
1357
|
const GlobalContextsProvider = lookup.getGlobalContextsProvider({
|
|
1381
1358
|
name: component,
|
|
1382
1359
|
projectId
|
|
@@ -1398,14 +1375,7 @@ function PlasmicComponent(props) {
|
|
|
1398
1375
|
cond: !!GlobalContextsProvider,
|
|
1399
1376
|
wrapper: (children) => /* @__PURE__ */ React5.createElement(GlobalContextsProvider, __spreadValues({}, globalContextsProps), children)
|
|
1400
1377
|
},
|
|
1401
|
-
/* @__PURE__ */ React5.createElement(
|
|
1402
|
-
MaybeWrap,
|
|
1403
|
-
{
|
|
1404
|
-
cond: !!StyleTokensProvider,
|
|
1405
|
-
wrapper: (children) => /* @__PURE__ */ React5.createElement(StyleTokensProvider, null, children)
|
|
1406
|
-
},
|
|
1407
|
-
/* @__PURE__ */ React5.createElement(PlasmicComponentContext.Provider, { value: true }, elt)
|
|
1408
|
-
)
|
|
1378
|
+
/* @__PURE__ */ React5.createElement(PlasmicComponentContext.Provider, { value: true }, elt)
|
|
1409
1379
|
)
|
|
1410
1380
|
);
|
|
1411
1381
|
}
|