@trops/dash-core 0.1.428 → 0.1.429

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.js CHANGED
@@ -40439,36 +40439,57 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40439
40439
  depSelections = _useState28[0],
40440
40440
  setDepSelections = _useState28[1];
40441
40441
 
40442
- // Step 5: Publish
40443
- var _useState29 = React.useState(false),
40442
+ // Step 5: Defaults verification — surfaced values from each owned
40443
+ // widget package's `.dash.js` userConfig[field].defaultValue. Lets
40444
+ // the publisher review (and optionally blank/edit) values set
40445
+ // during development before the ZIP ships.
40446
+ // defaultsByPackage: { [packageId]: Array<{widgetName, field, currentDefault, displayName, type, instructions}> }
40447
+ // defaultsOverrides: { [packageId]: { [widgetName]: { [field]: newValue } } }
40448
+ // — only fields the user actually edited appear here. Undefined
40449
+ // = "no change"; explicit empty-string = "blank it out".
40450
+ var _useState29 = React.useState({}),
40444
40451
  _useState30 = _slicedToArray(_useState29, 2),
40445
- isPublishing = _useState30[0],
40446
- setIsPublishing = _useState30[1];
40447
- var _useState31 = React.useState(null),
40452
+ defaultsByPackage = _useState30[0],
40453
+ setDefaultsByPackage = _useState30[1];
40454
+ var _useState31 = React.useState(false),
40448
40455
  _useState32 = _slicedToArray(_useState31, 2),
40449
- result = _useState32[0],
40450
- setResult = _useState32[1];
40451
- // Per-step progress during batch publish
40452
- var _useState33 = React.useState([]),
40456
+ defaultsLoading = _useState32[0],
40457
+ setDefaultsLoading = _useState32[1];
40458
+ var _useState33 = React.useState({}),
40453
40459
  _useState34 = _slicedToArray(_useState33, 2),
40454
- publishSteps = _useState34[0],
40455
- setPublishSteps = _useState34[1];
40460
+ defaultsOverrides = _useState34[0],
40461
+ setDefaultsOverrides = _useState34[1];
40456
40462
 
40457
- // Visibility chosen on the Details step. Defaults to public.
40458
- var _useState35 = React.useState("public"),
40463
+ // Step 6: Publish
40464
+ var _useState35 = React.useState(false),
40459
40465
  _useState36 = _slicedToArray(_useState35, 2),
40460
- visibility = _useState36[0],
40461
- setVisibility = _useState36[1];
40466
+ isPublishing = _useState36[0],
40467
+ setIsPublishing = _useState36[1];
40468
+ var _useState37 = React.useState(null),
40469
+ _useState38 = _slicedToArray(_useState37, 2),
40470
+ result = _useState38[0],
40471
+ setResult = _useState38[1];
40472
+ // Per-step progress during batch publish
40473
+ var _useState39 = React.useState([]),
40474
+ _useState40 = _slicedToArray(_useState39, 2),
40475
+ publishSteps = _useState40[0],
40476
+ setPublishSteps = _useState40[1];
40477
+
40478
+ // Visibility — chosen on the Details step. Defaults to public.
40479
+ var _useState41 = React.useState("public"),
40480
+ _useState42 = _slicedToArray(_useState41, 2),
40481
+ visibility = _useState42[0],
40482
+ setVisibility = _useState42[1];
40462
40483
 
40463
40484
  // Dashboard version bump — chosen on the Details step. Defaults to
40464
40485
  // "patch" so repeat-publishes auto-increment the registry's
40465
40486
  // latestVersion. Without this, every republish used the same
40466
40487
  // version string, the registry never saw a new version, and update
40467
40488
  // notifications never fired on installers.
40468
- var _useState37 = React.useState("patch"),
40469
- _useState38 = _slicedToArray(_useState37, 2),
40470
- dashboardBump = _useState38[0],
40471
- setDashboardBump = _useState38[1];
40489
+ var _useState43 = React.useState("patch"),
40490
+ _useState44 = _slicedToArray(_useState43, 2),
40491
+ dashboardBump = _useState44[0],
40492
+ setDashboardBump = _useState44[1];
40472
40493
 
40473
40494
  // Fetch publish preview (widget names) on open
40474
40495
  React.useEffect(function () {
@@ -40604,6 +40625,97 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40604
40625
  });
40605
40626
  // eslint-disable-next-line react-hooks/exhaustive-deps
40606
40627
  }, [step, isOpen]);
40628
+
40629
+ // Load per-package default-value scans when the user arrives at the
40630
+ // Defaults step. We only scan packages that are actually going to be
40631
+ // republished (include + owned) to keep the step focused — a
40632
+ // third-party package the user isn't republishing can't have its
40633
+ // defaults changed anyway.
40634
+ React.useEffect(function () {
40635
+ if (!isOpen || step !== 5 || !plan || defaultsLoading) return;
40636
+ var packagesToScan = [];
40637
+ var _iterator2 = _createForOfIteratorHelper$c(plan.widgets || []),
40638
+ _step2;
40639
+ try {
40640
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
40641
+ var w = _step2.value;
40642
+ if (!w.scope || !w.packageName) continue;
40643
+ var key = "".concat(w.scope, "/").concat(w.packageName);
40644
+ var sel = depSelections[key];
40645
+ if (!(sel !== null && sel !== void 0 && sel.include) || !(sel !== null && sel !== void 0 && sel.owned)) continue;
40646
+ // Resolve the local package id the scanner expects — same shape
40647
+ // the inspect IPC already takes.
40648
+ var localPkgId = w.packageId || "@".concat(w.scope, "/").concat(w.packageName);
40649
+ if (!defaultsByPackage[localPkgId]) packagesToScan.push(localPkgId);
40650
+ }
40651
+ } catch (err) {
40652
+ _iterator2.e(err);
40653
+ } finally {
40654
+ _iterator2.f();
40655
+ }
40656
+ if (packagesToScan.length === 0) return;
40657
+ setDefaultsLoading(true);
40658
+ Promise.all(packagesToScan.map(function (pkgId) {
40659
+ return window.mainApi.registry.scanWidgetDefaults(pkgId).then(function (res) {
40660
+ return {
40661
+ pkgId: pkgId,
40662
+ res: res
40663
+ };
40664
+ })["catch"](function (err) {
40665
+ return {
40666
+ pkgId: pkgId,
40667
+ res: {
40668
+ success: false,
40669
+ error: (err === null || err === void 0 ? void 0 : err.message) || String(err)
40670
+ }
40671
+ };
40672
+ });
40673
+ })).then(function (results) {
40674
+ setDefaultsByPackage(function (prev) {
40675
+ var next = _objectSpread$r({}, prev);
40676
+ var _iterator3 = _createForOfIteratorHelper$c(results),
40677
+ _step3;
40678
+ try {
40679
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
40680
+ var _step3$value = _step3.value,
40681
+ pkgId = _step3$value.pkgId,
40682
+ res = _step3$value.res;
40683
+ next[pkgId] = res !== null && res !== void 0 && res.success ? res.defaults || [] : [];
40684
+ }
40685
+ } catch (err) {
40686
+ _iterator3.e(err);
40687
+ } finally {
40688
+ _iterator3.f();
40689
+ }
40690
+ return next;
40691
+ });
40692
+ setDefaultsLoading(false);
40693
+ });
40694
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40695
+ }, [step, isOpen, plan, depSelections]);
40696
+ function setDefaultOverride(packageId, widgetName, field, newValue) {
40697
+ setDefaultsOverrides(function (prev) {
40698
+ var next = _objectSpread$r({}, prev);
40699
+ var forPkg = _objectSpread$r({}, next[packageId] || {});
40700
+ var forWidget = _objectSpread$r({}, forPkg[widgetName] || {});
40701
+ if (newValue === undefined) {
40702
+ delete forWidget[field];
40703
+ } else {
40704
+ forWidget[field] = newValue;
40705
+ }
40706
+ if (Object.keys(forWidget).length === 0) {
40707
+ delete forPkg[widgetName];
40708
+ } else {
40709
+ forPkg[widgetName] = forWidget;
40710
+ }
40711
+ if (Object.keys(forPkg).length === 0) {
40712
+ delete next[packageId];
40713
+ } else {
40714
+ next[packageId] = forPkg;
40715
+ }
40716
+ return next;
40717
+ });
40718
+ }
40607
40719
  function updateDepSelection(key, patch) {
40608
40720
  setDepSelections(function (prev) {
40609
40721
  return _objectSpread$r(_objectSpread$r({}, prev), {}, _defineProperty({}, key, _objectSpread$r(_objectSpread$r({}, prev[key]), patch)));
@@ -40621,7 +40733,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40621
40733
  }
40622
40734
  function _handlePublish() {
40623
40735
  _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
40624
- var steps, seenPackages, _iterator2, _step2, w, _key2, _sel, key, sel, updateStep, i, _step3, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
40736
+ var steps, seenPackages, _iterator4, _step4, w, _key2, _sel, key, sel, updateStep, i, _step5, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
40625
40737
  return _regeneratorRuntime.wrap(function (_context2) {
40626
40738
  while (1) switch (_context2.prev = _context2.next) {
40627
40739
  case 0:
@@ -40643,15 +40755,15 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40643
40755
  break;
40644
40756
  }
40645
40757
  seenPackages = new Set();
40646
- _iterator2 = _createForOfIteratorHelper$c(plan.widgets || []);
40758
+ _iterator4 = _createForOfIteratorHelper$c(plan.widgets || []);
40647
40759
  _context2.prev = 2;
40648
- _iterator2.s();
40760
+ _iterator4.s();
40649
40761
  case 3:
40650
- if ((_step2 = _iterator2.n()).done) {
40762
+ if ((_step4 = _iterator4.n()).done) {
40651
40763
  _context2.next = 8;
40652
40764
  break;
40653
40765
  }
40654
- w = _step2.value;
40766
+ w = _step4.value;
40655
40767
  if (!(!w.scope || !w.packageName)) {
40656
40768
  _context2.next = 4;
40657
40769
  break;
@@ -40689,10 +40801,10 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40689
40801
  case 9:
40690
40802
  _context2.prev = 9;
40691
40803
  _t2 = _context2["catch"](2);
40692
- _iterator2.e(_t2);
40804
+ _iterator4.e(_t2);
40693
40805
  case 10:
40694
40806
  _context2.prev = 10;
40695
- _iterator2.f();
40807
+ _iterator4.f();
40696
40808
  return _context2.finish(10);
40697
40809
  case 11:
40698
40810
  if (plan.theme && plan.theme.scope && plan.theme.name) {
@@ -40736,28 +40848,30 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40736
40848
  _context2.next = 24;
40737
40849
  break;
40738
40850
  }
40739
- _step3 = steps[i];
40851
+ _step5 = steps[i];
40740
40852
  updateStep(i, {
40741
40853
  status: "running"
40742
40854
  });
40743
- if (!(_step3.kind === "widget")) {
40855
+ if (!(_step5.kind === "widget")) {
40744
40856
  _context2.next = 17;
40745
40857
  break;
40746
40858
  }
40747
- bump = _step3.selection.bump;
40859
+ bump = _step5.selection.bump;
40748
40860
  options = _objectSpread$r(_objectSpread$r({}, bump && bump !== "none" ? {
40749
40861
  bump: bump
40750
40862
  } : {}), {}, {
40751
- visibility: _step3.selection.visibility,
40863
+ visibility: _step5.selection.visibility,
40752
40864
  // Plumb the publisher's display name through to the widget
40753
40865
  // publish call so the manifest — and the rewritten dash.json
40754
40866
  // inside the zipped package — records the actual human who
40755
40867
  // published, not the AI Widget Builder's "AI Assistant"
40756
40868
  // placeholder.
40757
40869
  authorName: authorName.trim() || undefined
40758
- });
40870
+ }, defaultsOverrides[_step5.packageId] ? {
40871
+ defaultsOverride: defaultsOverrides[_step5.packageId]
40872
+ } : {});
40759
40873
  _context2.next = 15;
40760
- return window.mainApi.registry.publishWidget(appId, _step3.packageId, options);
40874
+ return window.mainApi.registry.publishWidget(appId, _step5.packageId, options);
40761
40875
  case 15:
40762
40876
  res = _context2.sent;
40763
40877
  if (res !== null && res !== void 0 && res.success) {
@@ -40770,7 +40884,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40770
40884
  });
40771
40885
  setResult({
40772
40886
  success: false,
40773
- error: "Failed to publish widget ".concat(_step3.key, ": ").concat((res === null || res === void 0 ? void 0 : res.error) || "unknown error")
40887
+ error: "Failed to publish widget ".concat(_step5.key, ": ").concat((res === null || res === void 0 ? void 0 : res.error) || "unknown error")
40774
40888
  });
40775
40889
  setIsPublishing(false);
40776
40890
  return _context2.abrupt("return");
@@ -40782,13 +40896,13 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40782
40896
  _context2.next = 23;
40783
40897
  break;
40784
40898
  case 17:
40785
- if (!(_step3.kind === "theme")) {
40899
+ if (!(_step5.kind === "theme")) {
40786
40900
  _context2.next = 20;
40787
40901
  break;
40788
40902
  }
40789
40903
  _context2.next = 18;
40790
- return window.mainApi.themes.publishTheme(appId, _step3.themeKey, {
40791
- visibility: _step3.selection.visibility
40904
+ return window.mainApi.themes.publishTheme(appId, _step5.themeKey, {
40905
+ visibility: _step5.selection.visibility
40792
40906
  });
40793
40907
  case 18:
40794
40908
  _res = _context2.sent;
@@ -40802,7 +40916,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40802
40916
  });
40803
40917
  setResult({
40804
40918
  success: false,
40805
- error: "Failed to publish theme ".concat(_step3.themeKey, ": ").concat((_res === null || _res === void 0 ? void 0 : _res.error) || "unknown error")
40919
+ error: "Failed to publish theme ".concat(_step5.themeKey, ": ").concat((_res === null || _res === void 0 ? void 0 : _res.error) || "unknown error")
40806
40920
  });
40807
40921
  setIsPublishing(false);
40808
40922
  return _context2.abrupt("return");
@@ -40814,7 +40928,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40814
40928
  _context2.next = 23;
40815
40929
  break;
40816
40930
  case 20:
40817
- if (!(_step3.kind === "dashboard")) {
40931
+ if (!(_step5.kind === "dashboard")) {
40818
40932
  _context2.next = 23;
40819
40933
  break;
40820
40934
  }
@@ -40968,7 +41082,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40968
41082
  }
40969
41083
  function handleSignOut() {
40970
41084
  return _handleSignOut.apply(this, arguments);
40971
- } // Steps: 0=Account, 1=Details, 2=Tags, 3=Icon, 4=Dependencies, 5=Publish
41085
+ } // Steps: 0=Account, 1=Details, 2=Tags, 3=Icon, 4=Dependencies, 5=Defaults, 6=Publish
40972
41086
  function _handleSignOut() {
40973
41087
  _handleSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
40974
41088
  return _regeneratorRuntime.wrap(function (_context5) {
@@ -40993,8 +41107,8 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40993
41107
  }));
40994
41108
  return _handleSignOut.apply(this, arguments);
40995
41109
  }
40996
- var isLastStep = step === 5;
40997
- var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : step === 4 ? !planLoading : true;
41110
+ var isLastStep = step === 6;
41111
+ var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : step === 4 ? !planLoading : step === 5 ? !defaultsLoading : true;
40998
41112
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
40999
41113
  isOpen: isOpen,
41000
41114
  setIsOpen: handleClose,
@@ -41255,6 +41369,26 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
41255
41369
  onChange: updateDepSelection
41256
41370
  })]
41257
41371
  })
41372
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
41373
+ label: "Defaults",
41374
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
41375
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-4",
41376
+ children: [/*#__PURE__*/jsxRuntime.jsxs("p", {
41377
+ className: "text-sm opacity-70",
41378
+ children: ["Review ", /*#__PURE__*/jsxRuntime.jsx("code", {
41379
+ children: "userConfig"
41380
+ }), " default values the widget's dev-time dash.js ships. Anything you leave as-is gets published as the current default. Values you blank or edit here get rewritten in a staged copy before the ZIP is built \u2014 your local source files are untouched."]
41381
+ }), defaultsLoading && /*#__PURE__*/jsxRuntime.jsx("div", {
41382
+ className: "text-sm opacity-60 py-6 text-center",
41383
+ children: "Scanning widget configs for default values\u2026"
41384
+ }), !defaultsLoading && /*#__PURE__*/jsxRuntime.jsx(DefaultsReviewList, {
41385
+ plan: plan,
41386
+ depSelections: depSelections,
41387
+ defaultsByPackage: defaultsByPackage,
41388
+ overrides: defaultsOverrides,
41389
+ onChange: setDefaultOverride
41390
+ })]
41391
+ })
41258
41392
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
41259
41393
  label: "Publish",
41260
41394
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -41444,7 +41578,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
41444
41578
  className: "flex-1 text-center",
41445
41579
  children: /*#__PURE__*/jsxRuntime.jsxs("span", {
41446
41580
  className: "text-xs opacity-40",
41447
- children: ["Step ", step + 1, " of 6"]
41581
+ children: ["Step ", step + 1, " of 7"]
41448
41582
  })
41449
41583
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
41450
41584
  className: "flex flex-row gap-2",
@@ -41533,11 +41667,11 @@ function DependencyTable(_ref4) {
41533
41667
  // row. Each row shows the list of component widgets that live inside it
41534
41668
  // so the user knows what's getting published.
41535
41669
  var byKey = new Map();
41536
- var _iterator3 = _createForOfIteratorHelper$c(plan.widgets || []),
41537
- _step4;
41670
+ var _iterator5 = _createForOfIteratorHelper$c(plan.widgets || []),
41671
+ _step6;
41538
41672
  try {
41539
- for (_iterator3.s(); !(_step4 = _iterator3.n()).done;) {
41540
- var w = _step4.value;
41673
+ for (_iterator5.s(); !(_step6 = _iterator5.n()).done;) {
41674
+ var w = _step6.value;
41541
41675
  if (!w.scope || !w.packageName) continue;
41542
41676
  var _key3 = "".concat(w.scope, "/").concat(w.packageName);
41543
41677
  var entry = byKey.get(_key3) || {
@@ -41550,9 +41684,9 @@ function DependencyTable(_ref4) {
41550
41684
  byKey.set(_key3, entry);
41551
41685
  }
41552
41686
  } catch (err) {
41553
- _iterator3.e(err);
41687
+ _iterator5.e(err);
41554
41688
  } finally {
41555
- _iterator3.f();
41689
+ _iterator5.f();
41556
41690
  }
41557
41691
  var rows = Array.from(byKey.values()).map(function (e) {
41558
41692
  return _objectSpread$r(_objectSpread$r({}, e), {}, {
@@ -41686,6 +41820,134 @@ function DependencyTable(_ref4) {
41686
41820
  });
41687
41821
  }
41688
41822
 
41823
+ /**
41824
+ * Per-package editable list of every non-empty userConfig default.
41825
+ * Renders once per owned package selected for republish. Edits are
41826
+ * two-way: typing into a field stages an override; hitting "Reset"
41827
+ * clears the override so the original defaultValue ships. The
41828
+ * outside world treats `overrides[packageId][widgetName][field]` as
41829
+ * the source of truth for the publish call.
41830
+ */
41831
+ function DefaultsReviewList(_ref6) {
41832
+ var plan = _ref6.plan,
41833
+ depSelections = _ref6.depSelections,
41834
+ defaultsByPackage = _ref6.defaultsByPackage,
41835
+ overrides = _ref6.overrides,
41836
+ _onChange2 = _ref6.onChange;
41837
+ // Collect the packages we're actually about to republish so the UI
41838
+ // stays aligned with Dependencies — no surprises about WHICH
41839
+ // package's defaults you're editing.
41840
+ var rows = [];
41841
+ var _iterator6 = _createForOfIteratorHelper$c((plan === null || plan === void 0 ? void 0 : plan.widgets) || []),
41842
+ _step7;
41843
+ try {
41844
+ for (_iterator6.s(); !(_step7 = _iterator6.n()).done;) {
41845
+ var w = _step7.value;
41846
+ if (!w.scope || !w.packageName) continue;
41847
+ var key = "".concat(w.scope, "/").concat(w.packageName);
41848
+ var sel = depSelections[key];
41849
+ if (!(sel !== null && sel !== void 0 && sel.include) || !(sel !== null && sel !== void 0 && sel.owned)) continue;
41850
+ var localPkgId = w.packageId || "@".concat(w.scope, "/").concat(w.packageName);
41851
+ var defaults = defaultsByPackage[localPkgId];
41852
+ if (!Array.isArray(defaults)) continue;
41853
+ rows.push({
41854
+ key: key,
41855
+ localPkgId: localPkgId,
41856
+ label: "@".concat(w.scope, "/").concat(w.packageName),
41857
+ defaults: defaults
41858
+ });
41859
+ }
41860
+ } catch (err) {
41861
+ _iterator6.e(err);
41862
+ } finally {
41863
+ _iterator6.f();
41864
+ }
41865
+ if (rows.length === 0) {
41866
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
41867
+ className: "text-sm opacity-60 py-6 text-center",
41868
+ children: "No non-empty defaults found in any owned widget. Nothing to review."
41869
+ });
41870
+ }
41871
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
41872
+ className: "flex flex-col gap-4",
41873
+ children: rows.map(function (_ref7) {
41874
+ var key = _ref7.key,
41875
+ localPkgId = _ref7.localPkgId,
41876
+ label = _ref7.label,
41877
+ defaults = _ref7.defaults;
41878
+ if (defaults.length === 0) {
41879
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
41880
+ className: "border border-white/10 rounded-lg px-4 py-3 bg-white/5",
41881
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
41882
+ className: "text-sm font-semibold font-mono",
41883
+ children: label
41884
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
41885
+ className: "text-xs opacity-60 mt-1",
41886
+ children: ["No non-empty ", /*#__PURE__*/jsxRuntime.jsx("code", {
41887
+ children: "defaultValue"
41888
+ }), " entries detected."]
41889
+ })]
41890
+ }, key);
41891
+ }
41892
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
41893
+ className: "border border-white/10 rounded-lg px-4 py-3 bg-white/5",
41894
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
41895
+ className: "text-sm font-semibold font-mono mb-2",
41896
+ children: label
41897
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
41898
+ className: "flex flex-col gap-3",
41899
+ children: defaults.map(function (d) {
41900
+ var _overrides$localPkgId, _d$currentDefault;
41901
+ var overriddenValue = overrides === null || overrides === void 0 || (_overrides$localPkgId = overrides[localPkgId]) === null || _overrides$localPkgId === void 0 || (_overrides$localPkgId = _overrides$localPkgId[d.widgetName]) === null || _overrides$localPkgId === void 0 ? void 0 : _overrides$localPkgId[d.field];
41902
+ var isOverridden = overriddenValue !== undefined;
41903
+ var displayValue = isOverridden ? String(overriddenValue !== null && overriddenValue !== void 0 ? overriddenValue : "") : String((_d$currentDefault = d.currentDefault) !== null && _d$currentDefault !== void 0 ? _d$currentDefault : "");
41904
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
41905
+ className: "flex flex-col gap-1",
41906
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
41907
+ className: "flex items-center gap-2 flex-wrap",
41908
+ children: [/*#__PURE__*/jsxRuntime.jsxs("code", {
41909
+ className: "text-xs opacity-70",
41910
+ children: [d.widgetName, ".", d.field]
41911
+ }), /*#__PURE__*/jsxRuntime.jsxs("span", {
41912
+ className: "text-[10px] opacity-50",
41913
+ children: ["(", d.type, ")"]
41914
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
41915
+ className: "text-[10px] opacity-50",
41916
+ children: d.displayName
41917
+ }), isOverridden && /*#__PURE__*/jsxRuntime.jsx("span", {
41918
+ className: "text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-900/40 text-amber-200",
41919
+ children: "edited"
41920
+ })]
41921
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
41922
+ className: "flex items-center gap-2",
41923
+ children: [/*#__PURE__*/jsxRuntime.jsx("input", {
41924
+ type: "text",
41925
+ value: displayValue,
41926
+ onChange: function onChange(e) {
41927
+ return _onChange2(localPkgId, d.widgetName, d.field, e.target.value);
41928
+ },
41929
+ className: "flex-1 bg-gray-900 border border-white/10 rounded px-2 py-1 text-xs font-mono"
41930
+ }), isOverridden && /*#__PURE__*/jsxRuntime.jsx("button", {
41931
+ type: "button",
41932
+ onClick: function onClick() {
41933
+ return _onChange2(localPkgId, d.widgetName, d.field, undefined);
41934
+ },
41935
+ className: "text-xs opacity-60 hover:opacity-100 underline underline-offset-2",
41936
+ title: "Discard edit \u2014 ship the original defaultValue",
41937
+ children: "Reset"
41938
+ })]
41939
+ }), d.instructions && /*#__PURE__*/jsxRuntime.jsx("div", {
41940
+ className: "text-[10px] opacity-50",
41941
+ children: d.instructions
41942
+ })]
41943
+ }, "".concat(d.widgetName, "|").concat(d.field));
41944
+ })
41945
+ })]
41946
+ }, key);
41947
+ })
41948
+ });
41949
+ }
41950
+
41689
41951
  function ownKeys$q(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; }
41690
41952
  function _objectSpread$q(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$q(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$q(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
41691
41953
  var LayoutPreview = function LayoutPreview(_ref) {