@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.d.ts
CHANGED
|
@@ -158,6 +158,8 @@ declare class ComponentLookup {
|
|
|
158
158
|
meta: GlobalGroupMeta;
|
|
159
159
|
context: any;
|
|
160
160
|
}[];
|
|
161
|
+
/** Returns StyleTokensProvider if the project has style token overrides. */
|
|
162
|
+
maybeGetStyleTokensProvider(spec: ComponentLookupSpec): any;
|
|
161
163
|
getGlobalContextsProvider(spec: ComponentLookupSpec): any;
|
|
162
164
|
getRootProvider(): any;
|
|
163
165
|
getCss(): AssetModule[];
|
package/dist/index.esm.js
CHANGED
|
@@ -537,6 +537,7 @@ 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),
|
|
540
541
|
...bundle.projects.map((x) => x.globalContextsProviderFileName).filter((x) => !!x),
|
|
541
542
|
// We need to explicitly include global context provider components
|
|
542
543
|
// to make sure they are kept in bundle.components. That's because
|
|
@@ -704,6 +705,16 @@ var ComponentLookup = class {
|
|
|
704
705
|
context: this.registry.load(meta.contextFile).default
|
|
705
706
|
}));
|
|
706
707
|
}
|
|
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
|
+
}
|
|
707
718
|
getGlobalContextsProvider(spec) {
|
|
708
719
|
const compMeta = getFirstCompMeta(this.bundle.components, spec);
|
|
709
720
|
const projectMeta = compMeta ? this.bundle.projects.find((x) => x.id === compMeta.projectId) : void 0;
|
|
@@ -1354,6 +1365,10 @@ function PlasmicComponent(props) {
|
|
|
1354
1365
|
if (isRootLoader) {
|
|
1355
1366
|
const lookup = loader.getLookup();
|
|
1356
1367
|
const ReactWebRootProvider = lookup.getRootProvider();
|
|
1368
|
+
const StyleTokensProvider = lookup.maybeGetStyleTokensProvider({
|
|
1369
|
+
name: component,
|
|
1370
|
+
projectId
|
|
1371
|
+
});
|
|
1357
1372
|
const GlobalContextsProvider = lookup.getGlobalContextsProvider({
|
|
1358
1373
|
name: component,
|
|
1359
1374
|
projectId
|
|
@@ -1375,7 +1390,14 @@ function PlasmicComponent(props) {
|
|
|
1375
1390
|
cond: !!GlobalContextsProvider,
|
|
1376
1391
|
wrapper: (children) => /* @__PURE__ */ React5.createElement(GlobalContextsProvider, __spreadValues({}, globalContextsProps), children)
|
|
1377
1392
|
},
|
|
1378
|
-
/* @__PURE__ */ React5.createElement(
|
|
1393
|
+
/* @__PURE__ */ React5.createElement(
|
|
1394
|
+
MaybeWrap,
|
|
1395
|
+
{
|
|
1396
|
+
cond: !!StyleTokensProvider,
|
|
1397
|
+
wrapper: (children) => /* @__PURE__ */ React5.createElement(StyleTokensProvider, null, children)
|
|
1398
|
+
},
|
|
1399
|
+
/* @__PURE__ */ React5.createElement(PlasmicComponentContext.Provider, { value: true }, elt)
|
|
1400
|
+
)
|
|
1379
1401
|
)
|
|
1380
1402
|
);
|
|
1381
1403
|
}
|