@plasmicapp/loader-react 1.0.229 → 1.0.231
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/loader-react.cjs.development.js +38 -7
- package/dist/loader-react.cjs.development.js.map +1 -1
- package/dist/loader-react.cjs.production.min.js +1 -1
- package/dist/loader-react.cjs.production.min.js.map +1 -1
- package/dist/loader-react.esm.js +38 -7
- package/dist/loader-react.esm.js.map +1 -1
- package/dist/loader.d.ts +7 -2
- package/dist-react-server/loader.d.ts +7 -2
- package/package.json +3 -3
package/dist/loader-react.esm.js
CHANGED
|
@@ -1739,6 +1739,7 @@ function parseFetchComponentDataArgs() {
|
|
|
1739
1739
|
}
|
|
1740
1740
|
|
|
1741
1741
|
var SUBSTITUTED_COMPONENTS = {};
|
|
1742
|
+
var REGISTERED_CODE_COMPONENT_HELPERS = {};
|
|
1742
1743
|
var SUBSTITUTED_GLOBAL_VARIANT_HOOKS = {};
|
|
1743
1744
|
var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
|
|
1744
1745
|
function InternalPlasmicComponentLoader(opts) {
|
|
@@ -1780,7 +1781,8 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
|
|
|
1780
1781
|
'@plasmicapp/host': PlasmicHost,
|
|
1781
1782
|
'@plasmicapp/loader-runtime-registry': {
|
|
1782
1783
|
components: SUBSTITUTED_COMPONENTS,
|
|
1783
|
-
globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS
|
|
1784
|
+
globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,
|
|
1785
|
+
codeComponentHelpers: REGISTERED_CODE_COMPONENT_HELPERS
|
|
1784
1786
|
}
|
|
1785
1787
|
});
|
|
1786
1788
|
}
|
|
@@ -1810,25 +1812,51 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
|
|
|
1810
1812
|
}
|
|
1811
1813
|
};
|
|
1812
1814
|
_proto.substituteComponent = function substituteComponent(component, name) {
|
|
1815
|
+
this.internalSubstituteComponent(component, name, undefined);
|
|
1816
|
+
};
|
|
1817
|
+
_proto.internalSubstituteComponent = function internalSubstituteComponent(component, name, codeComponentHelpers) {
|
|
1813
1818
|
if (!this.registry.isEmpty()) {
|
|
1814
1819
|
console.warn('Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.');
|
|
1815
1820
|
this.registry.clear();
|
|
1816
1821
|
}
|
|
1817
1822
|
this.subs.push({
|
|
1818
1823
|
lookup: name,
|
|
1819
|
-
component: component
|
|
1824
|
+
component: component,
|
|
1825
|
+
codeComponentHelpers: codeComponentHelpers
|
|
1820
1826
|
});
|
|
1821
1827
|
};
|
|
1822
1828
|
_proto.registerComponent = function registerComponent$1(component, meta) {
|
|
1823
|
-
var _meta$importPath;
|
|
1824
|
-
|
|
1829
|
+
var _meta$states, _meta$importPath;
|
|
1830
|
+
// making the component meta consistent between codegen and loader
|
|
1831
|
+
var stateHelpers = Object.fromEntries(Object.entries((_meta$states = meta.states) != null ? _meta$states : {}).filter(function (_ref) {
|
|
1832
|
+
var stateSpec = _ref[1];
|
|
1833
|
+
return 'initFunc' in stateSpec || 'onChangeArgsToValue' in stateSpec;
|
|
1834
|
+
}).map(function (_ref2) {
|
|
1835
|
+
var stateName = _ref2[0],
|
|
1836
|
+
stateSpec = _ref2[1];
|
|
1837
|
+
return [stateName, _extends({}, 'initFunc' in stateSpec ? {
|
|
1838
|
+
initFunc: stateSpec.initFunc
|
|
1839
|
+
} : {}, 'onChangeArgsToValue' in stateSpec ? {
|
|
1840
|
+
onChangeArgsToValue: stateSpec.onChangeArgsToValue
|
|
1841
|
+
} : {})];
|
|
1842
|
+
}));
|
|
1843
|
+
var helpers = {
|
|
1844
|
+
states: stateHelpers
|
|
1845
|
+
};
|
|
1846
|
+
this.internalSubstituteComponent(component, {
|
|
1825
1847
|
name: meta.name,
|
|
1826
1848
|
isCode: true
|
|
1827
|
-
});
|
|
1828
|
-
// Import path is not used as we will use component substitution
|
|
1849
|
+
}, Object.keys(stateHelpers).length > 0 ? helpers : undefined);
|
|
1829
1850
|
registerComponent(component, _extends({}, meta, {
|
|
1851
|
+
// Import path is not used as we will use component substitution
|
|
1830
1852
|
importPath: (_meta$importPath = meta.importPath) != null ? _meta$importPath : ''
|
|
1831
|
-
})
|
|
1853
|
+
}, Object.keys(stateHelpers).length > 0 ? {
|
|
1854
|
+
componentHelpers: {
|
|
1855
|
+
helpers: helpers,
|
|
1856
|
+
importPath: '',
|
|
1857
|
+
importName: ''
|
|
1858
|
+
}
|
|
1859
|
+
} : {}));
|
|
1832
1860
|
};
|
|
1833
1861
|
_proto.registerGlobalContext = function registerGlobalContext$1(context, meta) {
|
|
1834
1862
|
var _meta$importPath2;
|
|
@@ -1949,6 +1977,9 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
|
|
|
1949
1977
|
var metas = getCompMetas(_this3.getBundle().components, sub.lookup);
|
|
1950
1978
|
metas.forEach(function (meta) {
|
|
1951
1979
|
SUBSTITUTED_COMPONENTS[meta.id] = sub.component;
|
|
1980
|
+
if (sub.codeComponentHelpers) {
|
|
1981
|
+
REGISTERED_CODE_COMPONENT_HELPERS[meta.id] = sub.codeComponentHelpers;
|
|
1982
|
+
}
|
|
1952
1983
|
});
|
|
1953
1984
|
};
|
|
1954
1985
|
// Once we have received data, we register components to
|