@plasmicapp/loader-react 1.0.397 → 1.0.398
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 +5 -5
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;
|
|
@@ -1387,6 +1398,10 @@ function PlasmicComponent(props) {
|
|
|
1387
1398
|
if (isRootLoader) {
|
|
1388
1399
|
const lookup = loader.getLookup();
|
|
1389
1400
|
const ReactWebRootProvider = lookup.getRootProvider();
|
|
1401
|
+
const StyleTokensProvider = lookup.maybeGetStyleTokensProvider({
|
|
1402
|
+
name: component,
|
|
1403
|
+
projectId
|
|
1404
|
+
});
|
|
1390
1405
|
const GlobalContextsProvider = lookup.getGlobalContextsProvider({
|
|
1391
1406
|
name: component,
|
|
1392
1407
|
projectId
|
|
@@ -1408,7 +1423,14 @@ function PlasmicComponent(props) {
|
|
|
1408
1423
|
cond: !!GlobalContextsProvider,
|
|
1409
1424
|
wrapper: (children) => /* @__PURE__ */ React5.createElement(GlobalContextsProvider, __spreadValues({}, globalContextsProps), children)
|
|
1410
1425
|
},
|
|
1411
|
-
/* @__PURE__ */ React5.createElement(
|
|
1426
|
+
/* @__PURE__ */ React5.createElement(
|
|
1427
|
+
MaybeWrap,
|
|
1428
|
+
{
|
|
1429
|
+
cond: !!StyleTokensProvider,
|
|
1430
|
+
wrapper: (children) => /* @__PURE__ */ React5.createElement(StyleTokensProvider, null, children)
|
|
1431
|
+
},
|
|
1432
|
+
/* @__PURE__ */ React5.createElement(PlasmicComponentContext.Provider, { value: true }, elt)
|
|
1433
|
+
)
|
|
1412
1434
|
)
|
|
1413
1435
|
);
|
|
1414
1436
|
}
|