@trops/dash-core 0.1.321 → 0.1.322

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
@@ -8583,7 +8583,7 @@ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBu
8583
8583
  var hasPropertyDescriptors_1 = hasPropertyDescriptors;
8584
8584
 
8585
8585
  var keys = objectKeys$2;
8586
- var hasSymbols$4 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
8586
+ var hasSymbols$5 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
8587
8587
 
8588
8588
  var toStr$4 = Object.prototype.toString;
8589
8589
  var concat = Array.prototype.concat;
@@ -8616,7 +8616,7 @@ var defineProperty$1 = function (object, name, value, predicate) {
8616
8616
  var defineProperties$1 = function (object, map) {
8617
8617
  var predicates = arguments.length > 2 ? arguments[2] : {};
8618
8618
  var props = keys(map);
8619
- if (hasSymbols$4) {
8619
+ if (hasSymbols$5) {
8620
8620
  props = concat.call(props, Object.getOwnPropertySymbols(map));
8621
8621
  }
8622
8622
  for (var i = 0; i < props.length; i += 1) {
@@ -8682,11 +8682,11 @@ var sign$1 = function sign(number) {
8682
8682
  };
8683
8683
 
8684
8684
  var shams$1;
8685
- var hasRequiredShams$1;
8685
+ var hasRequiredShams;
8686
8686
 
8687
- function requireShams$1 () {
8688
- if (hasRequiredShams$1) return shams$1;
8689
- hasRequiredShams$1 = 1;
8687
+ function requireShams () {
8688
+ if (hasRequiredShams) return shams$1;
8689
+ hasRequiredShams = 1;
8690
8690
 
8691
8691
  /** @type {import('./shams')} */
8692
8692
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -8735,10 +8735,10 @@ function requireShams$1 () {
8735
8735
  }
8736
8736
 
8737
8737
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
8738
- var hasSymbolSham = requireShams$1();
8738
+ var hasSymbolSham = requireShams();
8739
8739
 
8740
8740
  /** @type {import('.')} */
8741
- var hasSymbols$3 = function hasNativeSymbols() {
8741
+ var hasSymbols$4 = function hasNativeSymbols() {
8742
8742
  if (typeof origSymbol !== 'function') { return false; }
8743
8743
  if (typeof Symbol !== 'function') { return false; }
8744
8744
  if (typeof origSymbol('foo') !== 'symbol') { return false; }
@@ -9042,7 +9042,7 @@ var ThrowTypeError = $gOPD$1
9042
9042
  }())
9043
9043
  : throwTypeError;
9044
9044
 
9045
- var hasSymbols$2 = hasSymbols$3();
9045
+ var hasSymbols$3 = hasSymbols$4();
9046
9046
 
9047
9047
  var getProto$2 = getProto$3;
9048
9048
  var $ObjectGPO = requireObject_getPrototypeOf();
@@ -9060,7 +9060,7 @@ var INTRINSICS = {
9060
9060
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
9061
9061
  '%Array%': Array,
9062
9062
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
9063
- '%ArrayIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9063
+ '%ArrayIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9064
9064
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
9065
9065
  '%AsyncFunction%': needsEval,
9066
9066
  '%AsyncGenerator%': needsEval,
@@ -9091,10 +9091,10 @@ var INTRINSICS = {
9091
9091
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
9092
9092
  '%isFinite%': isFinite,
9093
9093
  '%isNaN%': isNaN,
9094
- '%IteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9094
+ '%IteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9095
9095
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
9096
9096
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
9097
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9097
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9098
9098
  '%Math%': Math,
9099
9099
  '%Number%': Number,
9100
9100
  '%Object%': $Object$2,
@@ -9108,11 +9108,11 @@ var INTRINSICS = {
9108
9108
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
9109
9109
  '%RegExp%': RegExp,
9110
9110
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
9111
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9111
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9112
9112
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
9113
9113
  '%String%': String,
9114
- '%StringIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9115
- '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
9114
+ '%StringIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9115
+ '%Symbol%': hasSymbols$3 ? Symbol : undefined$1,
9116
9116
  '%SyntaxError%': $SyntaxError$1,
9117
9117
  '%ThrowTypeError%': ThrowTypeError,
9118
9118
  '%TypedArray%': TypedArray,
@@ -9465,12 +9465,12 @@ var callBound$i = function callBoundIntrinsic(name, allowMissing) {
9465
9465
 
9466
9466
  // modified from https://github.com/es-shims/es6-shim
9467
9467
  var objectKeys$1 = objectKeys$2;
9468
- var hasSymbols$1 = requireShams$1()();
9468
+ var hasSymbols$2 = requireShams()();
9469
9469
  var callBound$h = callBound$i;
9470
9470
  var $Object$1 = esObjectAtoms;
9471
9471
  var $push = callBound$h('Array.prototype.push');
9472
9472
  var $propIsEnumerable = callBound$h('Object.prototype.propertyIsEnumerable');
9473
- var originalGetSymbols = hasSymbols$1 ? $Object$1.getOwnPropertySymbols : null;
9473
+ var originalGetSymbols = hasSymbols$2 ? $Object$1.getOwnPropertySymbols : null;
9474
9474
 
9475
9475
  // eslint-disable-next-line no-unused-vars
9476
9476
  var implementation$8 = function assign(target, source1) {
@@ -9484,7 +9484,7 @@ var implementation$8 = function assign(target, source1) {
9484
9484
 
9485
9485
  // step 3.a.ii:
9486
9486
  var keys = objectKeys$1(from);
9487
- var getSymbols = hasSymbols$1 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
9487
+ var getSymbols = hasSymbols$2 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
9488
9488
  if (getSymbols) {
9489
9489
  var syms = getSymbols(from);
9490
9490
  for (var j = 0; j < syms.length; ++j) {
@@ -9781,23 +9781,14 @@ var regexp_prototype_flags = flagsBound;
9781
9781
 
9782
9782
  var esGetIterator = {exports: {}};
9783
9783
 
9784
- var shams;
9785
- var hasRequiredShams;
9786
-
9787
- function requireShams () {
9788
- if (hasRequiredShams) return shams;
9789
- hasRequiredShams = 1;
9790
-
9791
- var hasSymbols = requireShams$1();
9784
+ var hasSymbols$1 = requireShams();
9792
9785
 
9793
- /** @type {import('.')} */
9794
- shams = function hasToStringTagShams() {
9795
- return hasSymbols() && !!Symbol.toStringTag;
9796
- };
9797
- return shams;
9798
- }
9786
+ /** @type {import('.')} */
9787
+ var shams = function hasToStringTagShams() {
9788
+ return hasSymbols$1() && !!Symbol.toStringTag;
9789
+ };
9799
9790
 
9800
- var hasToStringTag$7 = requireShams()();
9791
+ var hasToStringTag$7 = shams();
9801
9792
  var callBound$f = callBound$i;
9802
9793
 
9803
9794
  var $toString$7 = callBound$f('Object.prototype.toString');
@@ -10834,7 +10825,7 @@ var tryStringObject = function tryStringObject(value) {
10834
10825
  /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
10835
10826
  var $toString$6 = callBound$c('Object.prototype.toString');
10836
10827
  var strClass = '[object String]';
10837
- var hasToStringTag$6 = requireShams()();
10828
+ var hasToStringTag$6 = shams();
10838
10829
 
10839
10830
  /** @type {import('.')} */
10840
10831
  var isString$2 = function isString(value) {
@@ -10950,7 +10941,7 @@ var isSet$2 = exported$1 || function isSet(x) {
10950
10941
  var isArguments$1 = isArguments$2;
10951
10942
  var getStopIterationIterator = stopIterationIterator;
10952
10943
 
10953
- if (hasSymbols$3() || requireShams$1()()) {
10944
+ if (hasSymbols$4() || requireShams()()) {
10954
10945
  var $iterator = Symbol.iterator;
10955
10946
  // Symbol is available natively or shammed
10956
10947
  // natively:
@@ -11239,7 +11230,7 @@ var tryDateObject = function tryDateGetDayCall(value) {
11239
11230
  /** @type {(value: unknown) => string} */
11240
11231
  var toStr$2 = callBound$9('Object.prototype.toString');
11241
11232
  var dateClass = '[object Date]';
11242
- var hasToStringTag$5 = requireShams()();
11233
+ var hasToStringTag$5 = shams();
11243
11234
 
11244
11235
  /** @type {import('.')} */
11245
11236
  var isDateObject = function isDateObject(value) {
@@ -11250,7 +11241,7 @@ var isDateObject = function isDateObject(value) {
11250
11241
  };
11251
11242
 
11252
11243
  var callBound$8 = callBound$i;
11253
- var hasToStringTag$4 = requireShams()();
11244
+ var hasToStringTag$4 = shams();
11254
11245
  var hasOwn = hasown;
11255
11246
  var gOPD$1 = gopd$1;
11256
11247
 
@@ -11355,7 +11346,7 @@ var tryNumberObject = function tryNumberObject(value) {
11355
11346
  };
11356
11347
  var $toString$3 = callBound$6('Object.prototype.toString');
11357
11348
  var numClass = '[object Number]';
11358
- var hasToStringTag$3 = requireShams()();
11349
+ var hasToStringTag$3 = shams();
11359
11350
 
11360
11351
  /** @type {import('.')} */
11361
11352
  var isNumberObject = function isNumberObject(value) {
@@ -11382,7 +11373,7 @@ var tryBooleanObject = function booleanBrandCheck(value) {
11382
11373
  }
11383
11374
  };
11384
11375
  var boolClass = '[object Boolean]';
11385
- var hasToStringTag$2 = requireShams()();
11376
+ var hasToStringTag$2 = shams();
11386
11377
 
11387
11378
  /** @type {import('.')} */
11388
11379
  var isBooleanObject = function isBoolean(value) {
@@ -11424,7 +11415,7 @@ function requireSafeRegexTest () {
11424
11415
 
11425
11416
  var callBound$4 = callBound$i;
11426
11417
  var $toString$1 = callBound$4('Object.prototype.toString');
11427
- var hasSymbols = hasSymbols$3();
11418
+ var hasSymbols = hasSymbols$4();
11428
11419
  var safeRegexTest = requireSafeRegexTest();
11429
11420
 
11430
11421
  if (hasSymbols) {
@@ -11870,7 +11861,7 @@ var gOPD = gopd$1;
11870
11861
  var getProto = getProto$3;
11871
11862
 
11872
11863
  var $toString = callBound$2('Object.prototype.toString');
11873
- var hasToStringTag = requireShams()();
11864
+ var hasToStringTag = shams();
11874
11865
 
11875
11866
  var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
11876
11867
  var typedArrays = availableTypedArrays();
@@ -18394,6 +18385,7 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18394
18385
  _ref$onSplitVertical = _ref.onSplitVertical,
18395
18386
  onSplitVertical = _ref$onSplitVertical === void 0 ? null : _ref$onSplitVertical,
18396
18387
  onMoreOptions = _ref.onMoreOptions,
18388
+ onEditWithAI = _ref.onEditWithAI,
18397
18389
  _ref$isSelected = _ref.isSelected,
18398
18390
  isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
18399
18391
  _ref$isSelectable = _ref.isSelectable,
@@ -18511,6 +18503,16 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18511
18503
  }
18512
18504
  });
18513
18505
  }
18506
+ if (onEditWithAI && widgetItem) {
18507
+ overflowActions.push({
18508
+ icon: "wand-magic-sparkles",
18509
+ label: "Edit with AI",
18510
+ onClick: function onClick() {
18511
+ onEditWithAI(widgetItem);
18512
+ setShowOverflowMenu(false);
18513
+ }
18514
+ });
18515
+ }
18514
18516
  if (onSplitHorizontal) {
18515
18517
  overflowActions.push({
18516
18518
  icon: "arrows-left-right",
@@ -18660,6 +18662,13 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18660
18662
  },
18661
18663
  title: "Configure widget",
18662
18664
  theme: false
18665
+ }), onEditWithAI && widgetItem && /*#__PURE__*/jsx(ButtonIcon2, {
18666
+ icon: "wand-magic-sparkles",
18667
+ onClick: function onClick() {
18668
+ return onEditWithAI(widgetItem);
18669
+ },
18670
+ title: "Edit with AI",
18671
+ theme: false
18663
18672
  }), onSplitHorizontal && /*#__PURE__*/jsx(ButtonIcon2, {
18664
18673
  icon: "arrows-left-right",
18665
18674
  onClick: function onClick(e) {
@@ -20479,6 +20488,40 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20479
20488
  // eslint-disable-next-line react-hooks/exhaustive-deps
20480
20489
  }, []);
20481
20490
 
20491
+ // Listen for AI widget remix — swaps existing widget component in-place
20492
+ useEffect(function () {
20493
+ var handler = function handler(e) {
20494
+ var _ref5 = e.detail || {},
20495
+ widgetComponentName = _ref5.widgetComponentName,
20496
+ widgetId = _ref5.widgetId;
20497
+ if (!widgetComponentName || !widgetId) return;
20498
+ var ws = wsRef.current;
20499
+ if (!(ws !== null && ws !== void 0 && ws.layout)) return;
20500
+ var config = ComponentManager.config(widgetComponentName);
20501
+ if (!config) {
20502
+ return;
20503
+ }
20504
+ try {
20505
+ var newLayout = updateLayoutItem(ws.layout, {
20506
+ id: widgetId,
20507
+ component: widgetComponentName
20508
+ });
20509
+ if (!newLayout) {
20510
+ return;
20511
+ }
20512
+ var newWorkspace = JSON.parse(JSON.stringify(ws));
20513
+ newWorkspace.layout = newLayout;
20514
+ setCurrentWorkspace(newWorkspace);
20515
+ } catch (err) {
20516
+ }
20517
+ };
20518
+ window.addEventListener("dash:swap-widget-in-cell", handler);
20519
+ return function () {
20520
+ return window.removeEventListener("dash:swap-widget-in-cell", handler);
20521
+ };
20522
+ // eslint-disable-next-line react-hooks/exhaustive-deps
20523
+ }, []);
20524
+
20482
20525
  /**
20483
20526
  * onClickAdd
20484
20527
  * From the Widget or Container, clicked plus button to add a widget
@@ -20890,11 +20933,11 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20890
20933
 
20891
20934
  // Grid Operation Handlers
20892
20935
 
20893
- function handleSplitCell(_ref5) {
20894
- var cellNumber = _ref5.cellNumber,
20895
- direction = _ref5.direction,
20896
- count = _ref5.count,
20897
- gridContainer = _ref5.gridContainer;
20936
+ function handleSplitCell(_ref6) {
20937
+ var cellNumber = _ref6.cellNumber,
20938
+ direction = _ref6.direction,
20939
+ count = _ref6.count,
20940
+ gridContainer = _ref6.gridContainer;
20898
20941
  try {
20899
20942
  var dashboard = new DashboardModel(currentWorkspace);
20900
20943
  var result = dashboard.splitGridCell(gridContainer.id, cellNumber, direction, count);
@@ -20906,10 +20949,10 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20906
20949
  } catch (e) {
20907
20950
  }
20908
20951
  }
20909
- function handleMergeCells(_ref6) {
20910
- var cellNumbers = _ref6.cellNumbers,
20911
- gridContainer = _ref6.gridContainer,
20912
- keepComponent = _ref6.keepComponent;
20952
+ function handleMergeCells(_ref7) {
20953
+ var cellNumbers = _ref7.cellNumbers,
20954
+ gridContainer = _ref7.gridContainer,
20955
+ keepComponent = _ref7.keepComponent;
20913
20956
  try {
20914
20957
  var dashboard = new DashboardModel(currentWorkspace);
20915
20958
  var result = dashboard.mergeGridCells(gridContainer.id, cellNumbers);
@@ -25230,6 +25273,19 @@ var LayoutGridContainer = /*#__PURE__*/memo(function (_ref3) {
25230
25273
  } : undefined,
25231
25274
  onDelete: cellComponent ? function () {
25232
25275
  if (onClickRemove) onClickRemove(cellComponent.id);
25276
+ } : undefined,
25277
+ onEditWithAI: cellComponent ? function () {
25278
+ var _ComponentManager$con;
25279
+ window.dispatchEvent(new CustomEvent("dash:edit-widget-with-ai", {
25280
+ detail: {
25281
+ cellNumber: cellNumber,
25282
+ gridItemId: item.id,
25283
+ workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id,
25284
+ widgetComponentName: cellComponent.component,
25285
+ widgetId: cellComponent.id,
25286
+ sourcePackage: ((_ComponentManager$con = ComponentManager.config(cellComponent.component, cellComponent)) === null || _ComponentManager$con === void 0 ? void 0 : _ComponentManager$con._sourcePackage) || null
25287
+ }
25288
+ }));
25233
25289
  } : undefined
25234
25290
  }), cellComponent && ComponentManager.config(cellComponent.component, cellComponent) ? /*#__PURE__*/jsx(DraggableDroppableCellBody, {
25235
25291
  cellNumber: cellNumber,