@plasmicapp/loader-react 1.0.394 → 1.0.396-beta.0
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 -0
- package/dist/index.esm.js +23 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +23 -1
- package/dist/index.js.map +2 -2
- package/dist/react-server.d.ts +2 -0
- package/dist/react-server.esm.js +11 -0
- package/dist/react-server.esm.js.map +2 -2
- package/dist/react-server.js +11 -0
- package/dist/react-server.js.map +2 -2
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -585,6 +585,7 @@ function prepComponentData(bundle, compMetas, opts) {
|
|
|
585
585
|
"entrypoint.css",
|
|
586
586
|
...compPaths,
|
|
587
587
|
"root-provider.js",
|
|
588
|
+
...bundle.projects.map((x) => x.styleTokensProviderFileName).filter((x) => !!x),
|
|
588
589
|
...bundle.projects.map((x) => x.globalContextsProviderFileName).filter((x) => !!x),
|
|
589
590
|
// We need to explicitly include global context provider components
|
|
590
591
|
// to make sure they are kept in bundle.components. That's because
|
|
@@ -752,6 +753,16 @@ var ComponentLookup = class {
|
|
|
752
753
|
context: this.registry.load(meta.contextFile).default
|
|
753
754
|
}));
|
|
754
755
|
}
|
|
756
|
+
/** Returns StyleTokensProvider if the project has style token overrides. */
|
|
757
|
+
maybeGetStyleTokensProvider(spec) {
|
|
758
|
+
const compMeta = getFirstCompMeta(this.bundle.components, spec);
|
|
759
|
+
const projectMeta = compMeta ? this.bundle.projects.find((x) => x.id === compMeta.projectId) : void 0;
|
|
760
|
+
if (!projectMeta || !projectMeta.styleTokensProviderFileName || !this.registry.hasModule(projectMeta.styleTokensProviderFileName) || !projectMeta.hasStyleTokenOverrides) {
|
|
761
|
+
return void 0;
|
|
762
|
+
}
|
|
763
|
+
const entry = this.registry.load(projectMeta.styleTokensProviderFileName);
|
|
764
|
+
return entry.StyleTokensProvider;
|
|
765
|
+
}
|
|
755
766
|
getGlobalContextsProvider(spec) {
|
|
756
767
|
const compMeta = getFirstCompMeta(this.bundle.components, spec);
|
|
757
768
|
const projectMeta = compMeta ? this.bundle.projects.find((x) => x.id === compMeta.projectId) : void 0;
|
|
@@ -1395,6 +1406,10 @@ function PlasmicComponent(props) {
|
|
|
1395
1406
|
if (isRootLoader) {
|
|
1396
1407
|
const lookup = loader.getLookup();
|
|
1397
1408
|
const ReactWebRootProvider = lookup.getRootProvider();
|
|
1409
|
+
const StyleTokensProvider = lookup.maybeGetStyleTokensProvider({
|
|
1410
|
+
name: component,
|
|
1411
|
+
projectId
|
|
1412
|
+
});
|
|
1398
1413
|
const GlobalContextsProvider = lookup.getGlobalContextsProvider({
|
|
1399
1414
|
name: component,
|
|
1400
1415
|
projectId
|
|
@@ -1416,7 +1431,14 @@ function PlasmicComponent(props) {
|
|
|
1416
1431
|
cond: !!GlobalContextsProvider,
|
|
1417
1432
|
wrapper: (children) => /* @__PURE__ */ React5.createElement(GlobalContextsProvider, __spreadValues({}, globalContextsProps), children)
|
|
1418
1433
|
},
|
|
1419
|
-
/* @__PURE__ */ React5.createElement(
|
|
1434
|
+
/* @__PURE__ */ React5.createElement(
|
|
1435
|
+
MaybeWrap,
|
|
1436
|
+
{
|
|
1437
|
+
cond: !!StyleTokensProvider,
|
|
1438
|
+
wrapper: (children) => /* @__PURE__ */ React5.createElement(StyleTokensProvider, null, children)
|
|
1439
|
+
},
|
|
1440
|
+
/* @__PURE__ */ React5.createElement(PlasmicComponentContext.Provider, { value: true }, elt)
|
|
1441
|
+
)
|
|
1420
1442
|
)
|
|
1421
1443
|
);
|
|
1422
1444
|
}
|