@trops/dash-core 0.1.433 → 0.1.435

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.esm.js CHANGED
@@ -8967,7 +8967,7 @@ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBu
8967
8967
  var hasPropertyDescriptors_1 = hasPropertyDescriptors;
8968
8968
 
8969
8969
  var keys = objectKeys$2;
8970
- var hasSymbols$4 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
8970
+ var hasSymbols$5 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
8971
8971
 
8972
8972
  var toStr$4 = Object.prototype.toString;
8973
8973
  var concat = Array.prototype.concat;
@@ -9000,7 +9000,7 @@ var defineProperty$1 = function (object, name, value, predicate) {
9000
9000
  var defineProperties$1 = function (object, map) {
9001
9001
  var predicates = arguments.length > 2 ? arguments[2] : {};
9002
9002
  var props = keys(map);
9003
- if (hasSymbols$4) {
9003
+ if (hasSymbols$5) {
9004
9004
  props = concat.call(props, Object.getOwnPropertySymbols(map));
9005
9005
  }
9006
9006
  for (var i = 0; i < props.length; i += 1) {
@@ -9066,11 +9066,11 @@ var sign$1 = function sign(number) {
9066
9066
  };
9067
9067
 
9068
9068
  var shams$1;
9069
- var hasRequiredShams$1;
9069
+ var hasRequiredShams;
9070
9070
 
9071
- function requireShams$1 () {
9072
- if (hasRequiredShams$1) return shams$1;
9073
- hasRequiredShams$1 = 1;
9071
+ function requireShams () {
9072
+ if (hasRequiredShams) return shams$1;
9073
+ hasRequiredShams = 1;
9074
9074
 
9075
9075
  /** @type {import('./shams')} */
9076
9076
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -9119,10 +9119,10 @@ function requireShams$1 () {
9119
9119
  }
9120
9120
 
9121
9121
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
9122
- var hasSymbolSham = requireShams$1();
9122
+ var hasSymbolSham = requireShams();
9123
9123
 
9124
9124
  /** @type {import('.')} */
9125
- var hasSymbols$3 = function hasNativeSymbols() {
9125
+ var hasSymbols$4 = function hasNativeSymbols() {
9126
9126
  if (typeof origSymbol !== 'function') { return false; }
9127
9127
  if (typeof Symbol !== 'function') { return false; }
9128
9128
  if (typeof origSymbol('foo') !== 'symbol') { return false; }
@@ -9426,7 +9426,7 @@ var ThrowTypeError = $gOPD$1
9426
9426
  }())
9427
9427
  : throwTypeError;
9428
9428
 
9429
- var hasSymbols$2 = hasSymbols$3();
9429
+ var hasSymbols$3 = hasSymbols$4();
9430
9430
 
9431
9431
  var getProto$2 = getProto$3;
9432
9432
  var $ObjectGPO = requireObject_getPrototypeOf();
@@ -9444,7 +9444,7 @@ var INTRINSICS = {
9444
9444
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
9445
9445
  '%Array%': Array,
9446
9446
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
9447
- '%ArrayIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9447
+ '%ArrayIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9448
9448
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
9449
9449
  '%AsyncFunction%': needsEval,
9450
9450
  '%AsyncGenerator%': needsEval,
@@ -9475,10 +9475,10 @@ var INTRINSICS = {
9475
9475
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
9476
9476
  '%isFinite%': isFinite,
9477
9477
  '%isNaN%': isNaN,
9478
- '%IteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9478
+ '%IteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9479
9479
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
9480
9480
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
9481
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9481
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9482
9482
  '%Math%': Math,
9483
9483
  '%Number%': Number,
9484
9484
  '%Object%': $Object$2,
@@ -9492,11 +9492,11 @@ var INTRINSICS = {
9492
9492
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
9493
9493
  '%RegExp%': RegExp,
9494
9494
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
9495
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9495
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9496
9496
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
9497
9497
  '%String%': String,
9498
- '%StringIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9499
- '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
9498
+ '%StringIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9499
+ '%Symbol%': hasSymbols$3 ? Symbol : undefined$1,
9500
9500
  '%SyntaxError%': $SyntaxError$1,
9501
9501
  '%ThrowTypeError%': ThrowTypeError,
9502
9502
  '%TypedArray%': TypedArray,
@@ -9849,12 +9849,12 @@ var callBound$i = function callBoundIntrinsic(name, allowMissing) {
9849
9849
 
9850
9850
  // modified from https://github.com/es-shims/es6-shim
9851
9851
  var objectKeys$1 = objectKeys$2;
9852
- var hasSymbols$1 = requireShams$1()();
9852
+ var hasSymbols$2 = requireShams()();
9853
9853
  var callBound$h = callBound$i;
9854
9854
  var $Object$1 = esObjectAtoms;
9855
9855
  var $push = callBound$h('Array.prototype.push');
9856
9856
  var $propIsEnumerable = callBound$h('Object.prototype.propertyIsEnumerable');
9857
- var originalGetSymbols = hasSymbols$1 ? $Object$1.getOwnPropertySymbols : null;
9857
+ var originalGetSymbols = hasSymbols$2 ? $Object$1.getOwnPropertySymbols : null;
9858
9858
 
9859
9859
  // eslint-disable-next-line no-unused-vars
9860
9860
  var implementation$8 = function assign(target, source1) {
@@ -9868,7 +9868,7 @@ var implementation$8 = function assign(target, source1) {
9868
9868
 
9869
9869
  // step 3.a.ii:
9870
9870
  var keys = objectKeys$1(from);
9871
- var getSymbols = hasSymbols$1 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
9871
+ var getSymbols = hasSymbols$2 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
9872
9872
  if (getSymbols) {
9873
9873
  var syms = getSymbols(from);
9874
9874
  for (var j = 0; j < syms.length; ++j) {
@@ -10165,23 +10165,14 @@ var regexp_prototype_flags = flagsBound;
10165
10165
 
10166
10166
  var esGetIterator = {exports: {}};
10167
10167
 
10168
- var shams;
10169
- var hasRequiredShams;
10170
-
10171
- function requireShams () {
10172
- if (hasRequiredShams) return shams;
10173
- hasRequiredShams = 1;
10174
-
10175
- var hasSymbols = requireShams$1();
10168
+ var hasSymbols$1 = requireShams();
10176
10169
 
10177
- /** @type {import('.')} */
10178
- shams = function hasToStringTagShams() {
10179
- return hasSymbols() && !!Symbol.toStringTag;
10180
- };
10181
- return shams;
10182
- }
10170
+ /** @type {import('.')} */
10171
+ var shams = function hasToStringTagShams() {
10172
+ return hasSymbols$1() && !!Symbol.toStringTag;
10173
+ };
10183
10174
 
10184
- var hasToStringTag$7 = requireShams()();
10175
+ var hasToStringTag$7 = shams();
10185
10176
  var callBound$f = callBound$i;
10186
10177
 
10187
10178
  var $toString$7 = callBound$f('Object.prototype.toString');
@@ -11218,7 +11209,7 @@ var tryStringObject = function tryStringObject(value) {
11218
11209
  /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
11219
11210
  var $toString$6 = callBound$c('Object.prototype.toString');
11220
11211
  var strClass = '[object String]';
11221
- var hasToStringTag$6 = requireShams()();
11212
+ var hasToStringTag$6 = shams();
11222
11213
 
11223
11214
  /** @type {import('.')} */
11224
11215
  var isString$2 = function isString(value) {
@@ -11334,7 +11325,7 @@ var isSet$2 = exported$1 || function isSet(x) {
11334
11325
  var isArguments$1 = isArguments$2;
11335
11326
  var getStopIterationIterator = stopIterationIterator;
11336
11327
 
11337
- if (hasSymbols$3() || requireShams$1()()) {
11328
+ if (hasSymbols$4() || requireShams()()) {
11338
11329
  var $iterator = Symbol.iterator;
11339
11330
  // Symbol is available natively or shammed
11340
11331
  // natively:
@@ -11623,7 +11614,7 @@ var tryDateObject = function tryDateGetDayCall(value) {
11623
11614
  /** @type {(value: unknown) => string} */
11624
11615
  var toStr$2 = callBound$9('Object.prototype.toString');
11625
11616
  var dateClass = '[object Date]';
11626
- var hasToStringTag$5 = requireShams()();
11617
+ var hasToStringTag$5 = shams();
11627
11618
 
11628
11619
  /** @type {import('.')} */
11629
11620
  var isDateObject = function isDateObject(value) {
@@ -11634,7 +11625,7 @@ var isDateObject = function isDateObject(value) {
11634
11625
  };
11635
11626
 
11636
11627
  var callBound$8 = callBound$i;
11637
- var hasToStringTag$4 = requireShams()();
11628
+ var hasToStringTag$4 = shams();
11638
11629
  var hasOwn = hasown;
11639
11630
  var gOPD$1 = gopd$1;
11640
11631
 
@@ -11739,7 +11730,7 @@ var tryNumberObject = function tryNumberObject(value) {
11739
11730
  };
11740
11731
  var $toString$3 = callBound$6('Object.prototype.toString');
11741
11732
  var numClass = '[object Number]';
11742
- var hasToStringTag$3 = requireShams()();
11733
+ var hasToStringTag$3 = shams();
11743
11734
 
11744
11735
  /** @type {import('.')} */
11745
11736
  var isNumberObject = function isNumberObject(value) {
@@ -11766,7 +11757,7 @@ var tryBooleanObject = function booleanBrandCheck(value) {
11766
11757
  }
11767
11758
  };
11768
11759
  var boolClass = '[object Boolean]';
11769
- var hasToStringTag$2 = requireShams()();
11760
+ var hasToStringTag$2 = shams();
11770
11761
 
11771
11762
  /** @type {import('.')} */
11772
11763
  var isBooleanObject = function isBoolean(value) {
@@ -11808,7 +11799,7 @@ function requireSafeRegexTest () {
11808
11799
 
11809
11800
  var callBound$4 = callBound$i;
11810
11801
  var $toString$1 = callBound$4('Object.prototype.toString');
11811
- var hasSymbols = hasSymbols$3();
11802
+ var hasSymbols = hasSymbols$4();
11812
11803
  var safeRegexTest = requireSafeRegexTest();
11813
11804
 
11814
11805
  if (hasSymbols) {
@@ -12254,7 +12245,7 @@ var gOPD = gopd$1;
12254
12245
  var getProto = getProto$3;
12255
12246
 
12256
12247
  var $toString = callBound$2('Object.prototype.toString');
12257
- var hasToStringTag = requireShams()();
12248
+ var hasToStringTag = shams();
12258
12249
 
12259
12250
  var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
12260
12251
  var typedArrays = availableTypedArrays();
@@ -14574,27 +14565,18 @@ var LayoutBuilderConfigModal = function LayoutBuilderConfigModal(_ref) {
14574
14565
  return s.key === activeSection;
14575
14566
  }) || sections[0];
14576
14567
 
14577
- // Scope/package label for the footer so the user can tell which
14578
- // package a widget comes from (ambiguous component names like
14579
- // `ProspectListColumn` can live under either `@ai-built/…` or
14580
- // `@trops/pipeline`). Same derivation order as WidgetCardHeader:
14581
- // widget config id → widget config package → layout item workspace.
14568
+ // Footer label: derive @scope/package straight from the layout
14569
+ // item's scoped component id. Strict no workspace fallback.
14582
14570
  var footerPackageLabel = function () {
14583
- if (!itemSelected) return "";
14584
- var cfg = ComponentManager.config(itemSelected.component, itemSelected);
14585
- var dropTrailingComponent = function dropTrailingComponent(s) {
14586
- if (typeof s !== "string") return "";
14587
- var lastDot = s.lastIndexOf(".");
14588
- return lastDot > 0 ? s.slice(0, lastDot) : s;
14589
- };
14590
- var fromId = dropTrailingComponent((cfg === null || cfg === void 0 ? void 0 : cfg.id) || "");
14591
- if (fromId) return fromId;
14592
- if (cfg !== null && cfg !== void 0 && cfg["package"]) return String(cfg["package"]);
14593
- var ws = itemSelected.workspace;
14594
- if (typeof ws === "string" && ws && ws !== "layout") {
14595
- return ws.startsWith("@") ? ws : "@".concat(ws);
14596
- }
14597
- return "";
14571
+ var scopedId = (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.component) || "";
14572
+ if (typeof scopedId !== "string") return "";
14573
+ var parts = scopedId.split(".");
14574
+ if (parts.length !== 3) return "";
14575
+ var _parts = _slicedToArray(parts, 2),
14576
+ scope = _parts[0],
14577
+ pkg = _parts[1];
14578
+ if (!scope || !pkg) return "";
14579
+ return "@".concat(scope, "/").concat(pkg);
14598
14580
  }();
14599
14581
  var componentName = itemSelected ? itemSelected["component"] : "";
14600
14582
  var footerLeftContent = footerPackageLabel ? /*#__PURE__*/jsxs("span", {
@@ -18900,29 +18882,21 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18900
18882
  // Get widget name from config or item
18901
18883
  var widgetName = (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.displayName) || (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component);
18902
18884
 
18903
- // Build a scope/package subtitle so ambiguous component names like
18904
- // `ProspectListColumn` (which might come from `@ai-built/…` or
18905
- // `@trops/pipeline`) are disambiguated in the layout builder. Derives
18906
- // from whatever identity the config / layout item carries:
18907
- // - widgetConfig.id: e.g. "@ai-built/prospectlistcolumn.ProspectListColumn"
18908
- // - widgetConfig.package: e.g. "@ai-built/prospectlistcolumn"
18909
- // - widgetItem.workspace: fallback hint ("ai-built" / "@trops/pipeline")
18910
- // Falls back to empty string so we can skip rendering if we have
18911
- // nothing meaningful beyond the component name itself.
18885
+ // Derive the "@scope/package" label from the layout item's scoped
18886
+ // component id (`scope.package.Component`). Strict the layout item
18887
+ // is the source of truth. If the item isn't scoped (a legacy layout
18888
+ // that LayoutModel couldn't migrate, or a missing widget) the label
18889
+ // is empty rather than guessed from the workspace category.
18912
18890
  var packageLabel = function () {
18913
- var dropTrailingComponent = function dropTrailingComponent(s) {
18914
- if (typeof s !== "string") return "";
18915
- var lastDot = s.lastIndexOf(".");
18916
- return lastDot > 0 ? s.slice(0, lastDot) : s;
18917
- };
18918
- var fromId = dropTrailingComponent((widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.id) || "");
18919
- if (fromId) return fromId;
18920
- if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig["package"]) return String(widgetConfig["package"]);
18921
- var wsHint = widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.workspace;
18922
- if (typeof wsHint === "string" && wsHint && wsHint !== "layout") {
18923
- return wsHint.startsWith("@") ? wsHint : "@".concat(wsHint);
18924
- }
18925
- return "";
18891
+ var scopedId = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) || (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.id) || "";
18892
+ if (typeof scopedId !== "string") return "";
18893
+ var parts = scopedId.split(".");
18894
+ if (parts.length !== 3) return "";
18895
+ var _parts = _slicedToArray(parts, 2),
18896
+ scope = _parts[0],
18897
+ pkg = _parts[1];
18898
+ if (!scope || !pkg) return "";
18899
+ return "@".concat(scope, "/").concat(pkg);
18926
18900
  }();
18927
18901
 
18928
18902
  // Get provider requirements from widget config (not from item directly)
@@ -27506,10 +27480,10 @@ function addChildToLayoutItem(childComponent, layoutItem, workspace) {
27506
27480
  * widgets share the same bare name
27507
27481
  * @returns {boolean} true if the widget can be rendered
27508
27482
  */
27509
- function isWidgetResolvable(componentKey, data) {
27483
+ function isWidgetResolvable(componentKey) {
27510
27484
  // Layout containers are always resolvable (handled specially by WidgetFactory)
27511
27485
  if (ComponentManager.isLayoutContainer(componentKey)) return true;
27512
- var config = ComponentManager.resolve(componentKey, data);
27486
+ var config = ComponentManager.resolve(componentKey);
27513
27487
  return !!(config && typeof config.component === "function");
27514
27488
  }
27515
27489
 
@@ -27539,6 +27513,52 @@ function isWidgetResolvable(componentKey, data) {
27539
27513
  // isMinOrderForItem
27540
27514
  // }
27541
27515
 
27516
+ /**
27517
+ * One-shot legacy bare-name → canonical scoped-id migration.
27518
+ *
27519
+ * Pre-v0.1.435 dashboards stored layout items with bare component
27520
+ * names (`component: "PipelineKanban"`). Post-v0.1.435 the registry
27521
+ * is keyed strictly by scoped ids (`scope.package.Component`) and
27522
+ * `resolveComponentKey` does no fallback scanning. This helper
27523
+ * bridges the two: at workspace-load time, walk the registry once
27524
+ * and rewrite any bare name that maps unambiguously to a scoped
27525
+ * registration.
27526
+ *
27527
+ * Behavior (deliberately strict):
27528
+ * - Already-scoped (3 dot-separated parts) → return verbatim.
27529
+ * - Bare name with exactly one matching registry key ending in
27530
+ * `.${bareName}` → return the scoped key.
27531
+ * - Zero matches OR multiple matches → return verbatim. The
27532
+ * renderer surfaces `WidgetNotFound` rather than guessing wrong;
27533
+ * the user can resave or republish to fix the layout.
27534
+ *
27535
+ * Should be called once per layout item on workspace load. After the
27536
+ * workspace is saved, every item carries a scoped id and this helper
27537
+ * is a no-op.
27538
+ *
27539
+ * @param {Object} componentMap - The live registry map keyed by scoped ids
27540
+ * @param {string} component - The layout item's `component` field
27541
+ * @returns {string} - The canonical scoped id, or the input unchanged
27542
+ */
27543
+ function migrateBareComponentName(componentMap, component) {
27544
+ if (!componentMap || typeof component !== "string" || !component) {
27545
+ return component;
27546
+ }
27547
+ // Already scoped — fast path. Three dot-separated parts is the
27548
+ // canonical shape (`scope.package.Component`); anything else
27549
+ // (bare names, two-part forms, four-part typos) goes through the
27550
+ // suffix scan.
27551
+ if (component.split(".").length === 3) return component;
27552
+ // Already in the registry under its current key — also a fast path.
27553
+ if (component in componentMap) return component;
27554
+ var suffix = ".".concat(component);
27555
+ var matches = Object.keys(componentMap).filter(function (k) {
27556
+ return k.endsWith(suffix);
27557
+ });
27558
+ if (matches.length === 1) return matches[0];
27559
+ return component;
27560
+ }
27561
+
27542
27562
  function ownKeys$C(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; }
27543
27563
  function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$C(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$C(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
27544
27564
  function _createForOfIteratorHelper$k(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$k(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
@@ -27616,6 +27636,14 @@ var LayoutModel = function LayoutModel(layoutItem, workspaceLayout, dashboardId)
27616
27636
  layout.component = obj["componentName"];
27617
27637
  }
27618
27638
 
27639
+ // Legacy bare-name migration. Pre-v0.1.435 layouts stored
27640
+ // `component: "PipelineKanban"`; the registry is now strictly
27641
+ // keyed by `scope.package.Component`. If the layout item still
27642
+ // carries a bare name AND the registry has exactly one matching
27643
+ // scoped key, rewrite to the scoped form. The next save persists
27644
+ // the migration. Idempotent — already-scoped names pass through.
27645
+ layout.component = migrateBareComponentName(ComponentManager.componentMap(), layout.component);
27646
+
27619
27647
  /**
27620
27648
  * @param {String} direction Layout direction (row|col)
27621
27649
  * @deprecated Use grid layout instead of flexbox direction
@@ -27677,7 +27705,10 @@ var LayoutModel = function LayoutModel(layoutItem, workspaceLayout, dashboardId)
27677
27705
 
27678
27706
  layout.uuid = dashboardId !== undefined ? "".concat(dashboardId, "-").concat(layout["component"], "-").concat(layout.id) : "".concat(layout["component"], "-").concat(layout.id);
27679
27707
 
27680
- /// widget configuration
27708
+ // Resolve widget configuration — strict scoped lookup. By this
27709
+ // point `layout.component` has already been migrated from any
27710
+ // legacy bare name above, so config() either returns the live
27711
+ // entry or null (renderer shows WidgetNotFound).
27681
27712
  var widgetConfig = ComponentManager.config(layout["component"], obj);
27682
27713
  layout.userPrefs = {};
27683
27714
  layout.widgetConfig = widgetConfig;
@@ -27692,16 +27723,6 @@ var LayoutModel = function LayoutModel(layoutItem, workspaceLayout, dashboardId)
27692
27723
  if (Array.isArray(widgetConfig.eventHandlers)) {
27693
27724
  layout.eventHandlers = widgetConfig.eventHandlers;
27694
27725
  }
27695
- // Migrate legacy bare `component` references to the canonical
27696
- // scoped form (`scope.package.Component`). ComponentManager.config
27697
- // returns the resolved scoped key on `widgetConfig.component`, so
27698
- // we just lift it. Idempotent: items already scoped pass through
27699
- // unchanged because resolveComponentKey returns the input verbatim
27700
- // when it's already in the map. Persisted on next save — no
27701
- // separate migration step needed.
27702
- if (typeof widgetConfig.component === "string" && widgetConfig.component && widgetConfig.component !== layout.component) {
27703
- layout.component = widgetConfig.component;
27704
- }
27705
27726
  }
27706
27727
 
27707
27728
  // Merge user-entered config values (from EnhancedWidgetDropdown) into userPrefs
@@ -31387,6 +31408,34 @@ var ContextModel = /*#__PURE__*/function () {
31387
31408
  }]);
31388
31409
  }();
31389
31410
 
31411
+ /**
31412
+ * Resolve a component reference to its registry key.
31413
+ *
31414
+ * Strict exact-match lookup. Layout items carry the canonical scoped
31415
+ * id (`scope.package.Component`); the registry stores entries under
31416
+ * the same key. If the layout item's `component` doesn't match a
31417
+ * registered key exactly, the renderer shows `WidgetNotFound` — there
31418
+ * is no suffix-scan fallback and no `packageId` hint, because both
31419
+ * could silently resolve a typo / legacy bare name to the wrong widget.
31420
+ *
31421
+ * Legacy dashboards that still carry a bare `component` (pre-scope
31422
+ * migration) are handled in `LayoutModel`, which performs a one-shot
31423
+ * suffix-scan rewrite on load. By the time `resolveComponentKey` is
31424
+ * called, every layout item is expected to have a fully scoped id.
31425
+ *
31426
+ * Pure function. No side effects. Stays outside ComponentManager so
31427
+ * it can be tested in isolation without the Models/Layout import chain.
31428
+ *
31429
+ * @param {Object} componentMap - The registry map keyed by scoped ids
31430
+ * @param {string} component - The scoped id from the layout item
31431
+ * @returns {string|null} The matching registry key, or null
31432
+ */
31433
+ function resolveComponentKey(componentMap, component) {
31434
+ if (!componentMap || !component) return null;
31435
+ if (typeof component !== "string") return null;
31436
+ return component in componentMap ? component : null;
31437
+ }
31438
+
31390
31439
  /**
31391
31440
  * scopedComponentId.js
31392
31441
  *
@@ -31453,57 +31502,48 @@ function bareComponentName(idOrName) {
31453
31502
  return parts[parts.length - 1] || "";
31454
31503
  }
31455
31504
 
31505
+ var _componentMap = {};
31506
+ var _containerComponent = null;
31507
+ var _gridContainerComponent = null;
31508
+
31456
31509
  /**
31457
- * Resolve a component name to a registry key. Returns null if no
31458
- * match exists.
31510
+ * Compute the canonical `scope.package.Component` id for a widget
31511
+ * config. Throws if the config doesn't carry enough origin metadata
31512
+ * to derive an id.
31459
31513
  *
31460
- * Pure function — depends only on the passed-in `componentMap` and
31461
- * `data`. Lives outside ComponentManager so it can be tested without
31462
- * pulling in the full Component/Layout import chain (and so other
31463
- * call sites can route through it without circular deps).
31514
+ * Order of precedence:
31515
+ * - `config.id` already scoped (3 dot-separated parts, no leading "@")
31516
+ * - `config.scope` + `config.packageName` + (`config.name` |
31517
+ * `config.component?.displayName` | `config.component?.name`)
31518
+ * - Otherwise throw — the config is missing origin info and would
31519
+ * register under an ambiguous key.
31464
31520
  *
31465
- * Lookup order (the LAYOUT ITEM is the source of truth):
31466
- * 1. EXACT match on `component` covers the new scoped form
31467
- * (`scope.package.X`) and any legacy `.dash.js` that already
31468
- * set `config.id` to a scoped value.
31469
- * 2. If `component` is bare (no dots) AND we have a packageId hint
31470
- * on the layout item, build the scoped id and try that.
31471
- * 3. Bare-name fallback: scan the map for any key ending in
31472
- * `.${component}`. If exactly one matches, use it. If multiple
31473
- * match (the collision case), prefer the one matching the
31474
- * layout item's `packageId` / `_sourcePackage`; otherwise fall
31475
- * through to the first match (deterministic, but also logs a
31476
- * warning so callers can spot the ambiguity).
31477
- *
31478
- * Step (3) is the back-compat path for layouts authored before
31479
- * scoped registration landed. New layouts ALWAYS resolve via step (1).
31521
+ * The `widgetKey` is consulted ONLY when both above paths fail and
31522
+ * the key itself is already a scoped id; this preserves compat with
31523
+ * callers that pass a fully-qualified registration key.
31480
31524
  */
31481
- function resolveComponentKey(componentMap, component, data) {
31482
- if (!componentMap || !component) return null;
31483
- if (component in componentMap) return component;
31484
- if (typeof component !== "string") return null;
31485
- if (component.includes(".")) return null;
31486
- var packageId = (data === null || data === void 0 ? void 0 : data.packageId) || (data === null || data === void 0 ? void 0 : data._sourcePackage) || (data === null || data === void 0 ? void 0 : data.packageName) || null;
31487
- if (packageId) {
31488
- var scoped = makeScopedComponentId(packageId, component);
31489
- if (scoped in componentMap) return scoped;
31490
- }
31491
- var suffix = ".".concat(component);
31492
- var matches = Object.keys(componentMap).filter(function (k) {
31493
- return k.endsWith(suffix);
31494
- });
31495
- if (matches.length === 0) return null;
31496
- if (matches.length === 1) return matches[0];
31497
- if (packageId) {
31498
- var target = makeScopedComponentId(packageId, component);
31499
- if (matches.includes(target)) return target;
31500
- }
31501
- return matches[0];
31525
+ function canonicalScopedId(config, widgetKey) {
31526
+ var looksScoped = function looksScoped(s) {
31527
+ return typeof s === "string" && s.split(".").length === 3 && !s.includes("/");
31528
+ };
31529
+ if (looksScoped(config === null || config === void 0 ? void 0 : config.id)) return config.id;
31530
+ if (looksScoped(widgetKey)) return widgetKey;
31531
+ if (config !== null && config !== void 0 && config.scope && config !== null && config !== void 0 && config.packageName) {
31532
+ var _config$component, _config$component2;
31533
+ var componentName = config.name || ((_config$component = config.component) === null || _config$component === void 0 ? void 0 : _config$component.displayName) || ((_config$component2 = config.component) === null || _config$component2 === void 0 ? void 0 : _config$component2.name) || null;
31534
+ if (componentName) {
31535
+ return makeScopedComponentId("".concat(String(config.scope).replace(/^@/, ""), "/").concat(config.packageName), componentName);
31536
+ }
31537
+ }
31538
+ var dump = JSON.stringify({
31539
+ id: config === null || config === void 0 ? void 0 : config.id,
31540
+ scope: config === null || config === void 0 ? void 0 : config.scope,
31541
+ packageName: config === null || config === void 0 ? void 0 : config.packageName,
31542
+ name: config === null || config === void 0 ? void 0 : config.name,
31543
+ widgetKey: widgetKey
31544
+ });
31545
+ throw new Error("[ComponentManager] Cannot register widget \u2014 missing origin metadata. " + "Need either a scoped `id` (scope.package.Component) or " + "`scope` + `packageName` + `name`. Got: ".concat(dump));
31502
31546
  }
31503
-
31504
- var _componentMap = {};
31505
- var _containerComponent = null;
31506
- var _gridContainerComponent = null;
31507
31547
  var ComponentManager = {
31508
31548
  // _componentMap: {},
31509
31549
 
@@ -31538,39 +31578,50 @@ var ComponentManager = {
31538
31578
  return _componentMap;
31539
31579
  },
31540
31580
  /**
31541
- * Resolve a component name to its registered config — single source
31542
- * of truth for every render-path lookup. Routes through
31543
- * `resolveComponentKey` so legacy bare names (`"ProspectWorkspace"`)
31544
- * still find their registered scoped counterpart
31545
- * (`"ai-built.pipeline.ProspectWorkspace"`). Returns null when the
31546
- * widget isn't registered. Pass the layout item as `data` to use
31547
- * its `packageId` / `_sourcePackage` for disambiguation.
31581
+ * Resolve a component reference to its registered config. Strict
31582
+ * exact-match lookup against the registry. Layout items are
31583
+ * expected to carry the canonical scoped id
31584
+ * (`scope.package.Component`); `LayoutModel` migrates legacy bare
31585
+ * names to the scoped form on dashboard load.
31586
+ *
31587
+ * Returns null when the widget isn't registered — the renderer then
31588
+ * shows `WidgetNotFound`. There is no fallback.
31548
31589
  *
31549
- * @param {string} component
31550
- * @param {object} [data]
31590
+ * @param {string} component - The scoped widget id
31551
31591
  * @returns {object|null} the live registered config, or null
31552
31592
  */
31553
- resolve: function resolve(component, data) {
31593
+ resolve: function resolve(component) {
31554
31594
  var m = _componentMap;
31555
31595
  if (!m) return null;
31556
- var key = resolveComponentKey(m, component, data);
31596
+ var key = resolveComponentKey(m, component);
31557
31597
  return key ? m[key] || null : null;
31558
31598
  },
31559
31599
  /**
31560
- * The method for registering the widget into the Dashboard application
31561
- * This is a requirement for the widget to be included into the Dash
31600
+ * Register a widget config under its canonical scoped id.
31601
+ *
31602
+ * Every widget that enters the registry MUST have a scope.package
31603
+ * .Component id. The id is determined in this order:
31604
+ * 1. `config.id` already in scoped form → trust it.
31605
+ * 2. `config.scope` + `config.packageName` + `config.name` → derive.
31606
+ * 3. Otherwise → throw. Silent fallbacks here are how layouts end
31607
+ * up referencing widgets that were registered under the wrong
31608
+ * key, so we fail loudly at registration instead of producing
31609
+ * a corrupt registry.
31562
31610
  *
31563
- * @param {Object} widgetConfig the widget configuration script created by the developer
31564
- * @param {*} widgetKey the unique id for the widget
31611
+ * `widgetKey` is kept for backwards compatibility with callers that
31612
+ * pass a string key; it is consulted ONLY as a tiebreak when the
31613
+ * config is otherwise complete.
31614
+ *
31615
+ * @param {Object} widgetConfig the widget configuration script
31616
+ * @param {string} [widgetKey] legacy fallback key (informational only)
31617
+ * @throws if origin metadata is missing
31565
31618
  */
31566
31619
  registerWidget: function registerWidget(widgetConfig, widgetKey) {
31567
31620
  var tempComponentMap = this.componentMap();
31568
- // Handle both module exports (widgetConfig.default) and direct config objects
31569
31621
  var config = widgetConfig["default"] || widgetConfig;
31570
- // Register under a single canonical key: config.id (scoped widget ID) if
31571
- // available, otherwise the provided widgetKey. No aliases — one widget, one key.
31572
- var registrationKey = config.id || widgetKey;
31573
- tempComponentMap[registrationKey] = ComponentConfigModel(config);
31622
+ var id = canonicalScopedId(config, widgetKey);
31623
+ config.id = id;
31624
+ tempComponentMap[id] = ComponentConfigModel(config);
31574
31625
  this.setComponentMap(tempComponentMap);
31575
31626
  },
31576
31627
  /**
@@ -31624,15 +31675,14 @@ var ComponentManager = {
31624
31675
  * @returns {Widget} the Widget in the component map
31625
31676
  */
31626
31677
  getComponent: function getComponent(component) {
31627
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31628
31678
  try {
31629
- // console.log("get component");
31630
31679
  if (component && this.componentMap()) {
31631
31680
  if (ComponentManager.isLayoutContainer(component) === false) {
31632
31681
  var m = this.componentMap();
31633
- // Resolve through the scoped/bare lookup pipeline so layouts
31634
- // authored under either format land at the same registry key.
31635
- var resolvedKey = resolveComponentKey(m, component, data);
31682
+ // Strict scoped-id lookup. If the layout item didn't carry
31683
+ // a scoped id, LayoutModel should have migrated it before
31684
+ // we get here.
31685
+ var resolvedKey = resolveComponentKey(m, component);
31636
31686
  var cmp = resolvedKey ? m[resolvedKey] : null;
31637
31687
  if (cmp !== null && cmp !== undefined) {
31638
31688
  cmp["componentName"] = resolvedKey;
@@ -31795,7 +31845,6 @@ var ComponentManager = {
31795
31845
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31796
31846
  try {
31797
31847
  if (component) {
31798
- // console.log("config");
31799
31848
  var requiredFields = {
31800
31849
  type: {
31801
31850
  value: "text"
@@ -31810,35 +31859,19 @@ var ComponentManager = {
31810
31859
  value: ""
31811
31860
  }
31812
31861
  };
31813
-
31814
- // get the component configuration from the map
31815
31862
  var components = this.map();
31816
- var resolvedKey = resolveComponentKey(components, component, data);
31863
+ var resolvedKey = resolveComponentKey(components, component);
31817
31864
  if (resolvedKey && resolvedKey in components) {
31818
- // let c = deepCopy(components['component']);
31819
-
31820
- // we have to make sure that we remove the component if this is a context
31821
-
31822
31865
  var tempComponent = components[resolvedKey];
31823
31866
  delete tempComponent["component"];
31824
31867
  var c = JSON.parse(JSON.stringify(tempComponent));
31825
-
31826
- // Carry the canonical scoped id forward so callers (LayoutModel,
31827
- // ComponentManager.getComponent) can rewrite layout items'
31828
- // `component` to the scoped form on first load.
31829
31868
  c["component"] = resolvedKey;
31830
-
31831
- // if no userConfig key. let's add it for the next step
31832
31869
  if ("userConfig" in c === false) {
31833
31870
  c["userConfig"] = {};
31834
31871
  }
31835
-
31836
- // if (isLayout === false) {
31837
31872
  var userPrefs = {};
31838
- // now we can make sure the configuration is "complete"
31839
31873
  if ("userConfig" in c) {
31840
31874
  Object.keys(c["userConfig"]).forEach(function (key) {
31841
- // check the required fields!
31842
31875
  Object.keys(requiredFields).forEach(function (k) {
31843
31876
  if (k in c["userConfig"][key]) {
31844
31877
  if (k in c["userConfig"][key] === false) {
@@ -31846,16 +31879,21 @@ var ComponentManager = {
31846
31879
  }
31847
31880
  }
31848
31881
  });
31849
- // set the user preferences
31850
31882
  userPrefs[key] = ComponentManager.userPrefsForItem("userPrefs" in data ? data : c, key, c["userConfig"][key]);
31851
31883
  });
31852
31884
  }
31853
-
31854
- // set the user preferences here
31855
31885
  c["userPrefs"] = userPrefs;
31886
+
31887
+ // Identity fields (id/package/scope/...) are forwarded so
31888
+ // consumers can derive the package label without reading
31889
+ // the live registry directly. Without these, callers fall
31890
+ // back to `item.workspace` which is a category, not a
31891
+ // package, and produce labels like `@DashSamples-workspace`.
31856
31892
  return {
31893
+ id: resolvedKey,
31857
31894
  type: c["type"],
31858
31895
  name: c["name"],
31896
+ displayName: c["displayName"],
31859
31897
  workspace: c["workspace"],
31860
31898
  canHaveChildren: c["canHaveChildren"],
31861
31899
  userPrefs: c["userPrefs"],
@@ -31866,7 +31904,13 @@ var ComponentManager = {
31866
31904
  providers: "providers" in c ? c["providers"] : [],
31867
31905
  notifications: "notifications" in c ? c["notifications"] : [],
31868
31906
  scheduledTasks: "scheduledTasks" in c ? c["scheduledTasks"] : [],
31869
- icon: "icon" in c ? c["icon"] : null
31907
+ icon: "icon" in c ? c["icon"] : null,
31908
+ scope: c["scope"],
31909
+ packageName: c["packageName"],
31910
+ "package": c["package"],
31911
+ author: c["author"],
31912
+ version: c["version"],
31913
+ _sourcePackage: c["_sourcePackage"]
31870
31914
  };
31871
31915
  }
31872
31916
  return null;
@@ -55545,26 +55589,23 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
55545
55589
  // footer so the same package label shows in every surface.
55546
55590
  var dependencies = useMemo(function () {
55547
55591
  var byPackage = new Map();
55548
- var stripTrailingComponent = function stripTrailingComponent(s) {
55549
- if (typeof s !== "string") return "";
55550
- var lastDot = s.lastIndexOf(".");
55551
- return lastDot > 0 ? s.slice(0, lastDot) : s;
55552
- };
55592
+ // Derive the @scope/package label from the layout item's scoped
55593
+ // component id. Layout items are always scoped post-v0.1.435
55594
+ // (LayoutModel migrates legacy bare names on load), so this is
55595
+ // the single source of truth — no config lookup, no workspace
55596
+ // fallback, no heuristics.
55553
55597
  var derivePackage = function derivePackage(item) {
55554
- // The layout item records the exact source package id when the
55555
- // widget was added. If present, trust it — no heuristics. This
55556
- // matches the publish flow's attribution, so the Dependencies
55557
- // tab and the Publish modal always agree.
55598
+ var scopedId = typeof (item === null || item === void 0 ? void 0 : item.component) === "string" ? item.component : "";
55599
+ var parts = scopedId.split(".");
55600
+ if (parts.length === 3) {
55601
+ var _parts = _slicedToArray(parts, 2),
55602
+ scope = _parts[0],
55603
+ pkg = _parts[1];
55604
+ if (scope && pkg) return "@".concat(scope, "/").concat(pkg);
55605
+ }
55606
+ // Defensive: an explicit packageId on the item still wins for
55607
+ // legacy items the migration couldn't auto-resolve.
55558
55608
  if (item !== null && item !== void 0 && item.packageId) return String(item.packageId);
55559
- var cfg = typeof getWidgetConfig === "function" ? getWidgetConfig(item.component) : null;
55560
- if (cfg !== null && cfg !== void 0 && cfg._sourcePackage) return String(cfg._sourcePackage);
55561
- var fromId = stripTrailingComponent((cfg === null || cfg === void 0 ? void 0 : cfg.id) || "");
55562
- if (fromId) return fromId;
55563
- if (cfg !== null && cfg !== void 0 && cfg["package"]) return String(cfg["package"]);
55564
- var ws = item === null || item === void 0 ? void 0 : item.workspace;
55565
- if (typeof ws === "string" && ws && ws !== "layout") {
55566
- return ws.startsWith("@") ? ws : "@".concat(ws);
55567
- }
55568
55609
  return "(unknown)";
55569
55610
  };
55570
55611