@plasmicapp/loader-react 1.0.16 → 1.0.21
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 +1 -0
- package/dist/loader-react.cjs.development.js +54 -3
- 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 -4
- package/dist/loader-react.esm.js.map +1 -1
- package/dist/loader.d.ts +2 -4
- package/package.json +9 -12
- package/host/dist/host.d.ts +0 -1
- package/host/dist/index.cjs.js +0 -27
- package/host/dist/index.cjs.js.map +0 -1
- package/host/dist/index.esm.js +0 -2
- package/host/dist/index.esm.js.map +0 -1
- package/host/package.json +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { PlasmicCanvasContext, PlasmicCanvasHost, PrimitiveType, PropType, repeatedElement, } from '@plasmicapp/host';
|
|
1
2
|
export { convertBundlesToComponentRenderData } from './bundles';
|
|
2
3
|
export { ComponentRenderData, InitOptions, initPlasmicLoader, PlasmicComponentLoader, } from './loader';
|
|
3
4
|
export { PlasmicComponent } from './PlasmicComponent';
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
+
var host = require('@plasmicapp/host');
|
|
7
8
|
var loaderCore = require('@plasmicapp/loader-core');
|
|
8
|
-
var _registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var React__default = _interopDefault(React);
|
|
11
11
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
@@ -104,6 +104,36 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
104
104
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
function getUsedComps(allComponents, entryCompIds) {
|
|
108
|
+
var q = [].concat(entryCompIds);
|
|
109
|
+
var seenIds = new Set(entryCompIds);
|
|
110
|
+
var componentMetaById = new Map(allComponents.map(function (meta) {
|
|
111
|
+
return [meta.id, meta];
|
|
112
|
+
}));
|
|
113
|
+
var usedComps = [];
|
|
114
|
+
|
|
115
|
+
while (q.length > 0) {
|
|
116
|
+
var _q$splice = q.splice(0, 1),
|
|
117
|
+
id = _q$splice[0];
|
|
118
|
+
|
|
119
|
+
var meta = componentMetaById.get(id);
|
|
120
|
+
|
|
121
|
+
if (!meta) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
usedComps.push(meta);
|
|
126
|
+
meta.usedComponents.forEach(function (usedCompId) {
|
|
127
|
+
if (!seenIds.has(usedCompId)) {
|
|
128
|
+
seenIds.add(usedCompId);
|
|
129
|
+
q.push(usedCompId);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return usedComps;
|
|
135
|
+
}
|
|
136
|
+
|
|
107
137
|
function prepComponentData(bundle) {
|
|
108
138
|
for (var _len = arguments.length, compMetas = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
109
139
|
compMetas[_key - 1] = arguments[_key];
|
|
@@ -117,7 +147,10 @@ function prepComponentData(bundle) {
|
|
|
117
147
|
};
|
|
118
148
|
}
|
|
119
149
|
|
|
120
|
-
var
|
|
150
|
+
var usedComps = getUsedComps(bundle.components, compMetas.map(function (compMeta) {
|
|
151
|
+
return compMeta.id;
|
|
152
|
+
}));
|
|
153
|
+
var compPaths = usedComps.map(function (compMeta) {
|
|
121
154
|
return compMeta.entry;
|
|
122
155
|
});
|
|
123
156
|
var subBundle = loaderCore.getBundleSubset.apply(void 0, [bundle, 'entrypoint.css'].concat(compPaths, ['root-provider.js'], bundle.globalGroups.map(function (g) {
|
|
@@ -1328,7 +1361,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
|
|
|
1328
1361
|
isCode: true
|
|
1329
1362
|
}); // Import path is not used as we will use component substitution
|
|
1330
1363
|
|
|
1331
|
-
|
|
1364
|
+
host.registerComponent(component, _extends({}, meta, {
|
|
1332
1365
|
importPath: (_meta$importPath = meta.importPath) != null ? _meta$importPath : ''
|
|
1333
1366
|
}));
|
|
1334
1367
|
};
|
|
@@ -2048,6 +2081,24 @@ function makeElement(loader, lookup, opts) {
|
|
|
2048
2081
|
}));
|
|
2049
2082
|
}
|
|
2050
2083
|
|
|
2084
|
+
Object.defineProperty(exports, 'PlasmicCanvasContext', {
|
|
2085
|
+
enumerable: true,
|
|
2086
|
+
get: function () {
|
|
2087
|
+
return host.PlasmicCanvasContext;
|
|
2088
|
+
}
|
|
2089
|
+
});
|
|
2090
|
+
Object.defineProperty(exports, 'PlasmicCanvasHost', {
|
|
2091
|
+
enumerable: true,
|
|
2092
|
+
get: function () {
|
|
2093
|
+
return host.PlasmicCanvasHost;
|
|
2094
|
+
}
|
|
2095
|
+
});
|
|
2096
|
+
Object.defineProperty(exports, 'repeatedElement', {
|
|
2097
|
+
enumerable: true,
|
|
2098
|
+
get: function () {
|
|
2099
|
+
return host.repeatedElement;
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2051
2102
|
exports.PlasmicComponent = PlasmicComponent;
|
|
2052
2103
|
exports.PlasmicComponentLoader = PlasmicComponentLoader;
|
|
2053
2104
|
exports.PlasmicRootProvider = PlasmicRootProvider;
|