@trops/dash-core 0.1.241 → 0.1.242

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
@@ -6291,11 +6291,37 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6291
6291
  createdDashboard = _useState12[0],
6292
6292
  setCreatedDashboard = _useState12[1];
6293
6293
 
6294
- // Sub-step state (DASH-188): 0 = Name, 1 = Folder, 2 = Theme
6295
- var _useState13 = useState(0),
6294
+ // Auth flow state (device-code auth for registry install)
6295
+ var _useState13 = useState(null),
6296
6296
  _useState14 = _slicedToArray(_useState13, 2),
6297
- subStep = _useState14[0],
6298
- setSubStep = _useState14[1];
6297
+ authNeeded = _useState14[0],
6298
+ setAuthNeeded = _useState14[1];
6299
+ var _useState15 = useState(null),
6300
+ _useState16 = _slicedToArray(_useState15, 2),
6301
+ authFlow = _useState16[0],
6302
+ setAuthFlow = _useState16[1];
6303
+ var _useState17 = useState(false),
6304
+ _useState18 = _slicedToArray(_useState17, 2),
6305
+ isPolling = _useState18[0],
6306
+ setIsPolling = _useState18[1];
6307
+ var _useState19 = useState(null),
6308
+ _useState20 = _slicedToArray(_useState19, 2),
6309
+ authError = _useState20[0],
6310
+ setAuthError = _useState20[1];
6311
+ var pollIntervalRef = useRef(null);
6312
+
6313
+ // Clean up polling on unmount
6314
+ useEffect(function () {
6315
+ return function () {
6316
+ if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
6317
+ };
6318
+ }, []);
6319
+
6320
+ // Sub-step state (DASH-188): 0 = Name, 1 = Folder, 2 = Theme
6321
+ var _useState21 = useState(0),
6322
+ _useState22 = _slicedToArray(_useState21, 2),
6323
+ subStep = _useState22[0],
6324
+ setSubStep = _useState22[1];
6299
6325
  var isPrebuilt = state.path === "prebuilt";
6300
6326
 
6301
6327
  // Initialize customization defaults when stepping into this step
@@ -6337,6 +6363,7 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6337
6363
  case 0:
6338
6364
  setCreating(true);
6339
6365
  setError(null);
6366
+ setAuthNeeded(null);
6340
6367
  _context2.prev = 1;
6341
6368
  _state$customization = state.customization, name = _state$customization.name, menuId = _state$customization.menuId, theme = _state$customization.theme;
6342
6369
  if (!(isPrebuilt && state.selectedDashboard)) {
@@ -6372,7 +6399,9 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6372
6399
  _context2.next = 5;
6373
6400
  break;
6374
6401
  }
6375
- throw new Error(installResult.error || "Sign in to install this dashboard.");
6402
+ setAuthNeeded(installResult.error || "Sign in to install this dashboard.");
6403
+ setCreating(false);
6404
+ return _context2.abrupt("return");
6376
6405
  case 5:
6377
6406
  if (!(installResult !== null && installResult !== void 0 && installResult.workspace)) {
6378
6407
  _context2.next = 7;
@@ -6635,7 +6664,80 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6635
6664
  setNewFolderIcon(null);
6636
6665
  }
6637
6666
 
6638
- // --- Success state ---
6667
+ // --- Registry auth sign-in (device-code flow) ---
6668
+ function handleSignIn() {
6669
+ return _handleSignIn.apply(this, arguments);
6670
+ } // --- Success state ---
6671
+ function _handleSignIn() {
6672
+ _handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
6673
+ var flow, interval;
6674
+ return _regeneratorRuntime.wrap(function (_context4) {
6675
+ while (1) switch (_context4.prev = _context4.next) {
6676
+ case 0:
6677
+ setAuthError(null);
6678
+ _context4.prev = 1;
6679
+ _context4.next = 2;
6680
+ return window.mainApi.registryAuth.initiateLogin();
6681
+ case 2:
6682
+ flow = _context4.sent;
6683
+ setAuthFlow(flow);
6684
+ if (flow.verificationUrlComplete) {
6685
+ window.mainApi.shell.openExternal(flow.verificationUrlComplete);
6686
+ }
6687
+ setIsPolling(true);
6688
+ interval = (flow.interval || 5) * 1000;
6689
+ pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
6690
+ var pollResult;
6691
+ return _regeneratorRuntime.wrap(function (_context3) {
6692
+ while (1) switch (_context3.prev = _context3.next) {
6693
+ case 0:
6694
+ _context3.prev = 0;
6695
+ _context3.next = 1;
6696
+ return window.mainApi.registryAuth.pollToken(flow.deviceCode);
6697
+ case 1:
6698
+ pollResult = _context3.sent;
6699
+ if (pollResult.status === "authorized") {
6700
+ clearInterval(pollIntervalRef.current);
6701
+ pollIntervalRef.current = null;
6702
+ setIsPolling(false);
6703
+ setAuthFlow(null);
6704
+ setAuthNeeded(null);
6705
+ handleCreate();
6706
+ } else if (pollResult.status === "expired") {
6707
+ clearInterval(pollIntervalRef.current);
6708
+ pollIntervalRef.current = null;
6709
+ setIsPolling(false);
6710
+ setAuthFlow(null);
6711
+ setAuthError("Authorization expired. Please try again.");
6712
+ }
6713
+ _context3.next = 3;
6714
+ break;
6715
+ case 2:
6716
+ _context3.prev = 2;
6717
+ _context3["catch"](0);
6718
+ clearInterval(pollIntervalRef.current);
6719
+ pollIntervalRef.current = null;
6720
+ setIsPolling(false);
6721
+ case 3:
6722
+ case "end":
6723
+ return _context3.stop();
6724
+ }
6725
+ }, _callee2, null, [[0, 2]]);
6726
+ })), interval);
6727
+ _context4.next = 4;
6728
+ break;
6729
+ case 3:
6730
+ _context4.prev = 3;
6731
+ _context4["catch"](1);
6732
+ setAuthError("Could not reach the registry. Check your connection and try again.");
6733
+ case 4:
6734
+ case "end":
6735
+ return _context4.stop();
6736
+ }
6737
+ }, _callee3, null, [[1, 3]]);
6738
+ }));
6739
+ return _handleSignIn.apply(this, arguments);
6740
+ }
6639
6741
  if (createdDashboard) {
6640
6742
  return /*#__PURE__*/jsx("div", {
6641
6743
  className: "flex flex-col gap-4",
@@ -6999,6 +7101,55 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
6999
7101
  children: isPrebuilt ? ((_state$selectedDashbo = state.selectedDashboard) === null || _state$selectedDashbo === void 0 ? void 0 : _state$selectedDashbo.displayName) || ((_state$selectedDashbo2 = state.selectedDashboard) === null || _state$selectedDashbo2 === void 0 ? void 0 : _state$selectedDashbo2.name) || "Pre-built dashboard" : "".concat(state.selectedWidgets.length, " widget").concat(state.selectedWidgets.length !== 1 ? "s" : "")
7000
7102
  })]
7001
7103
  })]
7104
+ }), authNeeded && /*#__PURE__*/jsxs("div", {
7105
+ className: "flex flex-col gap-3",
7106
+ children: [/*#__PURE__*/jsx("div", {
7107
+ className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
7108
+ children: /*#__PURE__*/jsxs("div", {
7109
+ className: "flex items-start gap-2",
7110
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
7111
+ icon: "lock",
7112
+ className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
7113
+ }), /*#__PURE__*/jsx("span", {
7114
+ className: "text-sm text-yellow-300/90",
7115
+ children: authNeeded
7116
+ })]
7117
+ })
7118
+ }), !authFlow && !isPolling && /*#__PURE__*/jsxs(Fragment, {
7119
+ children: [/*#__PURE__*/jsx("button", {
7120
+ type: "button",
7121
+ onClick: handleSignIn,
7122
+ className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
7123
+ children: "Sign in to Registry"
7124
+ }), authError && /*#__PURE__*/jsx("div", {
7125
+ className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
7126
+ children: /*#__PURE__*/jsxs("div", {
7127
+ className: "flex items-start gap-2",
7128
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
7129
+ icon: "circle-xmark",
7130
+ className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
7131
+ }), /*#__PURE__*/jsx("span", {
7132
+ className: "text-xs text-red-300/90",
7133
+ children: authError
7134
+ })]
7135
+ })
7136
+ })]
7137
+ }), authFlow && isPolling && /*#__PURE__*/jsxs("div", {
7138
+ className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
7139
+ children: [/*#__PURE__*/jsx("p", {
7140
+ className: "text-xs text-blue-300/90",
7141
+ children: "Enter this code in your browser:"
7142
+ }), /*#__PURE__*/jsx("div", {
7143
+ className: "text-center",
7144
+ children: /*#__PURE__*/jsx("span", {
7145
+ className: "text-2xl font-mono font-bold tracking-widest text-white",
7146
+ children: authFlow.userCode
7147
+ })
7148
+ }), /*#__PURE__*/jsx("p", {
7149
+ className: "text-xs text-blue-300/70 text-center",
7150
+ children: "Waiting for authorization \u2014 install will resume automatically..."
7151
+ })]
7152
+ })]
7002
7153
  }), error && /*#__PURE__*/jsxs("div", {
7003
7154
  className: "flex items-center gap-2 text-red-400 py-2",
7004
7155
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -7985,7 +8136,7 @@ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBu
7985
8136
  var hasPropertyDescriptors_1 = hasPropertyDescriptors;
7986
8137
 
7987
8138
  var keys = objectKeys$2;
7988
- var hasSymbols$4 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
8139
+ var hasSymbols$5 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
7989
8140
 
7990
8141
  var toStr$4 = Object.prototype.toString;
7991
8142
  var concat = Array.prototype.concat;
@@ -8018,7 +8169,7 @@ var defineProperty$1 = function (object, name, value, predicate) {
8018
8169
  var defineProperties$1 = function (object, map) {
8019
8170
  var predicates = arguments.length > 2 ? arguments[2] : {};
8020
8171
  var props = keys(map);
8021
- if (hasSymbols$4) {
8172
+ if (hasSymbols$5) {
8022
8173
  props = concat.call(props, Object.getOwnPropertySymbols(map));
8023
8174
  }
8024
8175
  for (var i = 0; i < props.length; i += 1) {
@@ -8084,11 +8235,11 @@ var sign$1 = function sign(number) {
8084
8235
  };
8085
8236
 
8086
8237
  var shams$1;
8087
- var hasRequiredShams$1;
8238
+ var hasRequiredShams;
8088
8239
 
8089
- function requireShams$1 () {
8090
- if (hasRequiredShams$1) return shams$1;
8091
- hasRequiredShams$1 = 1;
8240
+ function requireShams () {
8241
+ if (hasRequiredShams) return shams$1;
8242
+ hasRequiredShams = 1;
8092
8243
 
8093
8244
  /** @type {import('./shams')} */
8094
8245
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -8137,10 +8288,10 @@ function requireShams$1 () {
8137
8288
  }
8138
8289
 
8139
8290
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
8140
- var hasSymbolSham = requireShams$1();
8291
+ var hasSymbolSham = requireShams();
8141
8292
 
8142
8293
  /** @type {import('.')} */
8143
- var hasSymbols$3 = function hasNativeSymbols() {
8294
+ var hasSymbols$4 = function hasNativeSymbols() {
8144
8295
  if (typeof origSymbol !== 'function') { return false; }
8145
8296
  if (typeof Symbol !== 'function') { return false; }
8146
8297
  if (typeof origSymbol('foo') !== 'symbol') { return false; }
@@ -8444,7 +8595,7 @@ var ThrowTypeError = $gOPD$1
8444
8595
  }())
8445
8596
  : throwTypeError;
8446
8597
 
8447
- var hasSymbols$2 = hasSymbols$3();
8598
+ var hasSymbols$3 = hasSymbols$4();
8448
8599
 
8449
8600
  var getProto$2 = getProto$3;
8450
8601
  var $ObjectGPO = requireObject_getPrototypeOf();
@@ -8462,7 +8613,7 @@ var INTRINSICS = {
8462
8613
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
8463
8614
  '%Array%': Array,
8464
8615
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
8465
- '%ArrayIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
8616
+ '%ArrayIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
8466
8617
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
8467
8618
  '%AsyncFunction%': needsEval,
8468
8619
  '%AsyncGenerator%': needsEval,
@@ -8493,10 +8644,10 @@ var INTRINSICS = {
8493
8644
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
8494
8645
  '%isFinite%': isFinite,
8495
8646
  '%isNaN%': isNaN,
8496
- '%IteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
8647
+ '%IteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
8497
8648
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
8498
8649
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
8499
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
8650
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
8500
8651
  '%Math%': Math,
8501
8652
  '%Number%': Number,
8502
8653
  '%Object%': $Object$2,
@@ -8510,11 +8661,11 @@ var INTRINSICS = {
8510
8661
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
8511
8662
  '%RegExp%': RegExp,
8512
8663
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
8513
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
8664
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
8514
8665
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
8515
8666
  '%String%': String,
8516
- '%StringIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
8517
- '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
8667
+ '%StringIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
8668
+ '%Symbol%': hasSymbols$3 ? Symbol : undefined$1,
8518
8669
  '%SyntaxError%': $SyntaxError$1,
8519
8670
  '%ThrowTypeError%': ThrowTypeError,
8520
8671
  '%TypedArray%': TypedArray,
@@ -8867,12 +9018,12 @@ var callBound$i = function callBoundIntrinsic(name, allowMissing) {
8867
9018
 
8868
9019
  // modified from https://github.com/es-shims/es6-shim
8869
9020
  var objectKeys$1 = objectKeys$2;
8870
- var hasSymbols$1 = requireShams$1()();
9021
+ var hasSymbols$2 = requireShams()();
8871
9022
  var callBound$h = callBound$i;
8872
9023
  var $Object$1 = esObjectAtoms;
8873
9024
  var $push = callBound$h('Array.prototype.push');
8874
9025
  var $propIsEnumerable = callBound$h('Object.prototype.propertyIsEnumerable');
8875
- var originalGetSymbols = hasSymbols$1 ? $Object$1.getOwnPropertySymbols : null;
9026
+ var originalGetSymbols = hasSymbols$2 ? $Object$1.getOwnPropertySymbols : null;
8876
9027
 
8877
9028
  // eslint-disable-next-line no-unused-vars
8878
9029
  var implementation$8 = function assign(target, source1) {
@@ -8886,7 +9037,7 @@ var implementation$8 = function assign(target, source1) {
8886
9037
 
8887
9038
  // step 3.a.ii:
8888
9039
  var keys = objectKeys$1(from);
8889
- var getSymbols = hasSymbols$1 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
9040
+ var getSymbols = hasSymbols$2 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
8890
9041
  if (getSymbols) {
8891
9042
  var syms = getSymbols(from);
8892
9043
  for (var j = 0; j < syms.length; ++j) {
@@ -9183,23 +9334,14 @@ var regexp_prototype_flags = flagsBound;
9183
9334
 
9184
9335
  var esGetIterator = {exports: {}};
9185
9336
 
9186
- var shams;
9187
- var hasRequiredShams;
9188
-
9189
- function requireShams () {
9190
- if (hasRequiredShams) return shams;
9191
- hasRequiredShams = 1;
9337
+ var hasSymbols$1 = requireShams();
9192
9338
 
9193
- var hasSymbols = requireShams$1();
9194
-
9195
- /** @type {import('.')} */
9196
- shams = function hasToStringTagShams() {
9197
- return hasSymbols() && !!Symbol.toStringTag;
9198
- };
9199
- return shams;
9200
- }
9339
+ /** @type {import('.')} */
9340
+ var shams = function hasToStringTagShams() {
9341
+ return hasSymbols$1() && !!Symbol.toStringTag;
9342
+ };
9201
9343
 
9202
- var hasToStringTag$7 = requireShams()();
9344
+ var hasToStringTag$7 = shams();
9203
9345
  var callBound$f = callBound$i;
9204
9346
 
9205
9347
  var $toString$7 = callBound$f('Object.prototype.toString');
@@ -10236,7 +10378,7 @@ var tryStringObject = function tryStringObject(value) {
10236
10378
  /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
10237
10379
  var $toString$6 = callBound$c('Object.prototype.toString');
10238
10380
  var strClass = '[object String]';
10239
- var hasToStringTag$6 = requireShams()();
10381
+ var hasToStringTag$6 = shams();
10240
10382
 
10241
10383
  /** @type {import('.')} */
10242
10384
  var isString$2 = function isString(value) {
@@ -10352,7 +10494,7 @@ var isSet$2 = exported$1 || function isSet(x) {
10352
10494
  var isArguments$1 = isArguments$2;
10353
10495
  var getStopIterationIterator = stopIterationIterator;
10354
10496
 
10355
- if (hasSymbols$3() || requireShams$1()()) {
10497
+ if (hasSymbols$4() || requireShams()()) {
10356
10498
  var $iterator = Symbol.iterator;
10357
10499
  // Symbol is available natively or shammed
10358
10500
  // natively:
@@ -10641,7 +10783,7 @@ var tryDateObject = function tryDateGetDayCall(value) {
10641
10783
  /** @type {(value: unknown) => string} */
10642
10784
  var toStr$2 = callBound$9('Object.prototype.toString');
10643
10785
  var dateClass = '[object Date]';
10644
- var hasToStringTag$5 = requireShams()();
10786
+ var hasToStringTag$5 = shams();
10645
10787
 
10646
10788
  /** @type {import('.')} */
10647
10789
  var isDateObject = function isDateObject(value) {
@@ -10652,7 +10794,7 @@ var isDateObject = function isDateObject(value) {
10652
10794
  };
10653
10795
 
10654
10796
  var callBound$8 = callBound$i;
10655
- var hasToStringTag$4 = requireShams()();
10797
+ var hasToStringTag$4 = shams();
10656
10798
  var hasOwn = hasown;
10657
10799
  var gOPD$1 = gopd$1;
10658
10800
 
@@ -10757,7 +10899,7 @@ var tryNumberObject = function tryNumberObject(value) {
10757
10899
  };
10758
10900
  var $toString$3 = callBound$6('Object.prototype.toString');
10759
10901
  var numClass = '[object Number]';
10760
- var hasToStringTag$3 = requireShams()();
10902
+ var hasToStringTag$3 = shams();
10761
10903
 
10762
10904
  /** @type {import('.')} */
10763
10905
  var isNumberObject = function isNumberObject(value) {
@@ -10784,7 +10926,7 @@ var tryBooleanObject = function booleanBrandCheck(value) {
10784
10926
  }
10785
10927
  };
10786
10928
  var boolClass = '[object Boolean]';
10787
- var hasToStringTag$2 = requireShams()();
10929
+ var hasToStringTag$2 = shams();
10788
10930
 
10789
10931
  /** @type {import('.')} */
10790
10932
  var isBooleanObject = function isBoolean(value) {
@@ -10826,7 +10968,7 @@ function requireSafeRegexTest () {
10826
10968
 
10827
10969
  var callBound$4 = callBound$i;
10828
10970
  var $toString$1 = callBound$4('Object.prototype.toString');
10829
- var hasSymbols = hasSymbols$3();
10971
+ var hasSymbols = hasSymbols$4();
10830
10972
  var safeRegexTest = requireSafeRegexTest();
10831
10973
 
10832
10974
  if (hasSymbols) {
@@ -11272,7 +11414,7 @@ var gOPD = gopd$1;
11272
11414
  var getProto = getProto$3;
11273
11415
 
11274
11416
  var $toString = callBound$2('Object.prototype.toString');
11275
- var hasToStringTag = requireShams()();
11417
+ var hasToStringTag = shams();
11276
11418
 
11277
11419
  var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
11278
11420
  var typedArrays = availableTypedArrays();