@trops/dash-core 0.1.24 → 0.1.27
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/electron/index.js +39 -4
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +42 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18138,7 +18138,10 @@ var ComponentManager = {
|
|
|
18138
18138
|
var tempComponentMap = this.componentMap();
|
|
18139
18139
|
// Handle both module exports (widgetConfig.default) and direct config objects
|
|
18140
18140
|
var config = widgetConfig["default"] || widgetConfig;
|
|
18141
|
-
|
|
18141
|
+
// Use scoped id if available (e.g., "trops.clock.AnalogClockWidget"),
|
|
18142
|
+
// otherwise fall back to the provided widgetKey for backward compatibility
|
|
18143
|
+
var registrationKey = config.id || widgetKey;
|
|
18144
|
+
tempComponentMap[registrationKey] = ComponentConfigModel(config);
|
|
18142
18145
|
this.setComponentMap(tempComponentMap);
|
|
18143
18146
|
},
|
|
18144
18147
|
/**
|
|
@@ -18197,7 +18200,22 @@ var ComponentManager = {
|
|
|
18197
18200
|
if (component && this.componentMap()) {
|
|
18198
18201
|
if (ComponentManager.isLayoutContainer(component) === false) {
|
|
18199
18202
|
var m = this.componentMap();
|
|
18203
|
+
// Try exact match first (works for both scoped ids and legacy names)
|
|
18200
18204
|
var cmp = component in m ? m[component] : null;
|
|
18205
|
+
|
|
18206
|
+
// Fallback: scan by config.name for backward compatibility
|
|
18207
|
+
// Handles saved layouts that reference old-style names (e.g., "AnalogClockWidget")
|
|
18208
|
+
// when the widget is now registered under a scoped id (e.g., "trops.clock.AnalogClockWidget")
|
|
18209
|
+
if (cmp === null) {
|
|
18210
|
+
for (var _i = 0, _Object$keys = Object.keys(m); _i < _Object$keys.length; _i++) {
|
|
18211
|
+
var key = _Object$keys[_i];
|
|
18212
|
+
if (m[key].name === component) {
|
|
18213
|
+
cmp = m[key];
|
|
18214
|
+
cmp["componentName"] = key;
|
|
18215
|
+
return cmp;
|
|
18216
|
+
}
|
|
18217
|
+
}
|
|
18218
|
+
}
|
|
18201
18219
|
if (cmp !== null) {
|
|
18202
18220
|
cmp["componentName"] = component;
|
|
18203
18221
|
return cmp;
|
|
@@ -21333,10 +21351,23 @@ var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
|
21333
21351
|
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21334
21352
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21335
21353
|
|
|
21336
|
-
//
|
|
21337
|
-
//
|
|
21338
|
-
//
|
|
21339
|
-
var
|
|
21354
|
+
// Host-injected module references (e.g., "@trops/dash-core").
|
|
21355
|
+
// Set by the host app via setHostModules() after all modules are fully loaded,
|
|
21356
|
+
// avoiding the self-referential import that breaks under webpack scope hoisting.
|
|
21357
|
+
var _hostModules = {};
|
|
21358
|
+
|
|
21359
|
+
/**
|
|
21360
|
+
* Allow the host app to inject module references for the require shim.
|
|
21361
|
+
* Called from Dash.js after importing dash-core, so the full namespace is available.
|
|
21362
|
+
*
|
|
21363
|
+
* @param {object} modules - Map of package names to module namespaces
|
|
21364
|
+
*/
|
|
21365
|
+
function setHostModules(modules) {
|
|
21366
|
+
_hostModules = modules;
|
|
21367
|
+
}
|
|
21368
|
+
|
|
21369
|
+
// Base modules that can be statically imported without circular issues.
|
|
21370
|
+
var BASE_MODULE_MAP = {
|
|
21340
21371
|
react: React__namespace,
|
|
21341
21372
|
"react-dom": ReactDOM__namespace,
|
|
21342
21373
|
"@trops/dash-react": DashReact__namespace,
|
|
@@ -21352,13 +21383,16 @@ var MODULE_MAP = {
|
|
|
21352
21383
|
* @returns {object} The module.exports from the evaluated bundle
|
|
21353
21384
|
*/
|
|
21354
21385
|
function evaluateBundle(source, widgetName) {
|
|
21386
|
+
// Merge base modules with host-provided modules (e.g., "@trops/dash-core")
|
|
21387
|
+
// at call time so _hostModules is populated by the time widgets load.
|
|
21388
|
+
var moduleMap = _objectSpread$b(_objectSpread$b({}, BASE_MODULE_MAP), _hostModules);
|
|
21355
21389
|
var module = {
|
|
21356
21390
|
exports: {}
|
|
21357
21391
|
};
|
|
21358
21392
|
var exports = module.exports;
|
|
21359
21393
|
var require = function require(name) {
|
|
21360
|
-
if (
|
|
21361
|
-
var mod =
|
|
21394
|
+
if (moduleMap[name]) {
|
|
21395
|
+
var mod = moduleMap[name];
|
|
21362
21396
|
// CJS interop: `import * as X` creates an ES module namespace where
|
|
21363
21397
|
// named exports may live under `.default` (e.g. @trops/dash-react).
|
|
21364
21398
|
// CJS bundles expect `require("pkg").Widget` to work, so merge
|
|
@@ -32645,6 +32679,7 @@ exports.renderLayout = _renderLayout;
|
|
|
32645
32679
|
exports.renderLayoutMenu = renderLayoutMenu;
|
|
32646
32680
|
exports.replaceItemInLayout = replaceItemInLayout;
|
|
32647
32681
|
exports.resolveIcon = resolveIcon;
|
|
32682
|
+
exports.setHostModules = setHostModules;
|
|
32648
32683
|
exports.traverseParentTree = traverseParentTree;
|
|
32649
32684
|
exports.updateLayoutItem = updateLayoutItem;
|
|
32650
32685
|
exports.updateParentForItem = updateParentForItem;
|